each(['Width', 'Height'], function (name) {
domUtils['doc' + name] = function (refWin) {
// firefox chrome documentElement.scrollHeight< body.scrollHeight
// ie standard mode : documentElement.scrollHeight> body.scrollHeight
d.documentElement['scroll' + name],
// quirks : documentElement.scrollHeight 最大等于可视窗口多一点?
d.body['scroll' + name], domUtils['viewport' + name](d));
domUtils['viewport' + name] = function (win) {
// pc browser includes scrollbar in window.innerWidth
var prop = 'client' + name;
var documentElement = doc.documentElement;
var documentElementProp = documentElement[prop];
return doc.compatMode === 'CSS1Compat' && documentElementProp || body && body[prop] || documentElementProp;
@param {String} [extra] 'padding' : (css width) + padding
'border' : (css width) + padding + border
'margin' : (css width) + padding + border + margin
function getWH(elem, name, extra) {
return name === 'width' ? domUtils.viewportWidth(elem) : domUtils.viewportHeight(elem);
} else if (elem.nodeType === 9) {
return name === 'width' ? domUtils.docWidth(elem) : domUtils.docHeight(elem);
var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom'];
var borderBoxValue = name === 'width' ? elem.offsetWidth : elem.offsetHeight;
var computedStyle = getComputedStyleX(elem);
var isBorderBox = isBorderBoxFn(elem, computedStyle);
if (borderBoxValue == null || borderBoxValue <= 0) {
borderBoxValue = undefined;
// Fall back to computed then un computed css if necessary
cssBoxValue = getComputedStyleX(elem, name);
if (cssBoxValue == null || Number(cssBoxValue) < 0) {
cssBoxValue = elem.style[name] || 0;
// Normalize '', auto, and prepare for extra
cssBoxValue = parseFloat(cssBoxValue) || 0;
if (extra === undefined) {
extra = isBorderBox ? BORDER_INDEX : CONTENT_INDEX;
var borderBoxValueOrIsBorderBox = borderBoxValue !== undefined || isBorderBox;
var val = borderBoxValue || cssBoxValue;
if (extra === CONTENT_INDEX) {
if (borderBoxValueOrIsBorderBox) {
return val - getPBMWidth(elem, ['border', 'padding'], which, computedStyle);
if (borderBoxValueOrIsBorderBox) {
var padding = extra === PADDING_INDEX ? -getPBMWidth(elem, ['border'], which, computedStyle) : getPBMWidth(elem, ['margin'], which, computedStyle);
return val + (extra === BORDER_INDEX ? 0 : padding);
return cssBoxValue + getPBMWidth(elem, BOX_MODELS.slice(extra), which, computedStyle);
// fix #119 : https://github.com/kissyteam/kissy/issues/119
function getWHIgnoreDisplay(elem) {
// in case elem is window
// elem.offsetWidth === undefined
if (elem.offsetWidth !== 0) {
val = getWH.apply(undefined, args);
swap(elem, cssShow, function () {
val = getWH.apply(undefined, args);
function css(el, name, v) {
if ((typeof name === 'undefined' ? 'undefined' : _typeof(name)) === 'object') {
if (name.hasOwnProperty(i)) {
if (typeof value !== 'undefined') {
if (typeof value === 'number') {
return getComputedStyleX(el, name);
each(['width', 'height'], function (name) {
var first = name.charAt(0).toUpperCase() + name.slice(1);
domUtils['outer' + first] = function (el, includeMargin) {
return el && getWHIgnoreDisplay(el, name, includeMargin ? MARGIN_INDEX : BORDER_INDEX);
var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom'];
domUtils[name] = function (elem, val) {
var computedStyle = getComputedStyleX(elem);
var isBorderBox = isBorderBoxFn(elem);
val += getPBMWidth(elem, ['padding', 'border'], which, computedStyle);
return css(elem, name, val);
return elem && getWHIgnoreDisplay(elem, name, CONTENT_INDEX);
// 设置 elem 相对 elem.ownerDocument 的坐标
function setOffset(elem, offset) {
// set position first, in-case top/left are set even on static elem
if (css(elem, 'position') === 'static') {
elem.style.position = 'relative';
var old = getOffset(elem);
if (offset.hasOwnProperty(key)) {
current = parseFloat(css(elem, key)) || 0;
ret[key] = current + offset[key] - old[key];
module.exports = _extends({
getWindow: function getWindow(node) {
var doc = node.ownerDocument || node;
return doc.defaultView || doc.parentWindow;
offset: function offset(el, value) {
if (typeof value !== 'undefined') {
clone: function clone(obj) {
if (obj.hasOwnProperty(i)) {
var overflow = obj.overflow;
if (obj.hasOwnProperty(i)) {
ret.overflow[i] = obj.overflow[i];
scrollLeft: function scrollLeft(w, v) {
window.scrollTo(v, getScrollTop(w));
scrollTop: function scrollTop(w, v) {
window.scrollTo(getScrollLeft(w), v);
/***/ (function(module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", {
exports['default'] = toISOMonthString;
var _moment = __webpack_require__("wy2R");
var _moment2 = _interopRequireDefault(_moment);
var _toMomentObject = __webpack_require__("WmS1");
var _toMomentObject2 = _interopRequireDefault(_toMomentObject);
var _constants = __webpack_require__("Fv1B");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function toISOMonthString(date, currentFormat) {
var dateObj = _moment2['default'].isMoment(date) ? date : (0, _toMomentObject2['default'])(date, currentFormat);
if (!dateObj) return null;
return dateObj.format(_constants.ISO_MONTH_FORMAT);
/***/ (function(module, __webpack_exports__, __webpack_require__) {
/* unused harmony export createScrollLockComponent */
/* harmony import */ var _babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("1OyB");
/* harmony import */ var _babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("vuIU");
/* harmony import */ var _babel_runtime_helpers_esm_inherits__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("Ji7U");
/* harmony import */ var _babel_runtime_helpers_esm_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("md7G");
/* harmony import */ var _babel_runtime_helpers_esm_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("foSv");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("GRId");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_5__);
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = Object(_babel_runtime_helpers_esm_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = Object(_babel_runtime_helpers_esm_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(_babel_runtime_helpers_esm_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])(this, result); }; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
* Creates a ScrollLock component bound to the specified document.
* This function creates a ScrollLock component for the specified document
* and is exposed so we can create an isolated component for unit testing.
* @param {Object} args Keyword args.
* @param {HTMLDocument} args.htmlDocument The document to lock the scroll for.
* @param {string} args.className The name of the class used to lock scrolling.
* @return {WPComponent} The bound ScrollLock component.
function createScrollLockComponent() {
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
_ref$htmlDocument = _ref.htmlDocument,
htmlDocument = _ref$htmlDocument === void 0 ? document : _ref$htmlDocument,
_ref$className = _ref.className,
className = _ref$className === void 0 ? 'lockscroll' : _ref$className;
* Setting `overflow: hidden` on html and body elements resets body scroll in iOS.
* Save scroll top so we can restore it after locking scroll.
* NOTE: It would be cleaner and possibly safer to find a localized solution such
* as preventing default on certain touchmove events.
var previousScrollTop = 0;
* Locks and unlocks scroll depending on the boolean argument.
* @param {boolean} locked Whether or not scroll should be locked.
function setLocked(locked) {
var scrollingElement = htmlDocument.scrollingElement || htmlDocument.body;
previousScrollTop = scrollingElement.scrollTop;
var methodName = locked ? 'add' : 'remove';
scrollingElement.classList[methodName](className); // Adding the class to the document element seems to be necessary in iOS.
htmlDocument.documentElement.classList[methodName](className);
scrollingElement.scrollTop = previousScrollTop;
* This function tracks requests for scroll lock. It locks scroll on the first
* request and counts each request so `releaseLock` can unlock scroll when
* all requests have been released.
* Releases a request for scroll lock.
* This function tracks released requests for scroll lock. When all requests
* have been released, it unlocks scroll.
return /*#__PURE__*/function (_Component) {
Object(_babel_runtime_helpers_esm_inherits__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])(ScrollLock, _Component);
var _super = _createSuper(ScrollLock);
Object(_babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(this, ScrollLock);
return _super.apply(this, arguments);
Object(_babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(ScrollLock, [{
key: "componentDidMount",
* Requests scroll lock on mount.
value: function componentDidMount() {
* Releases scroll lock before unmount.
key: "componentWillUnmount",
value: function componentWillUnmount() {
* Render nothing as this component is merely a way to declare scroll lock.
* @return {null} Render nothing by returning `null`.
value: function render() {
}(_wordpress_element__WEBPACK_IMPORTED_MODULE_5__["Component"]);
/* harmony default export */ __webpack_exports__["a"] = (createScrollLockComponent());
/***/ (function(module, __webpack_exports__, __webpack_require__) {
/* unused harmony export Button */
/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("wx14");
/* harmony import */ var _babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Ff2n");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("GRId");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("TSYQ");
/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("YLtl");
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var _wordpress_deprecated__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("NMb1");
/* harmony import */ var _wordpress_deprecated__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_deprecated__WEBPACK_IMPORTED_MODULE_5__);
/* harmony import */ var _tooltip__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("W/NR");
/* harmony import */ var _icon__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__("9VDH");
/* harmony import */ var _visually_hidden__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__("ldlY");
function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
var disabledEventsOnDisabledButton = ['onMouseDown', 'onClick'];
function Button(props, ref) {
isPrimary = props.isPrimary,
isTertiary = props.isTertiary,
isPressed = props.isPressed,
isDefault = props.isDefault,
isSecondary = props.isSecondary,
isDestructive = props.isDestructive,
className = props.className,
disabled = props.disabled,
_props$iconPosition = props.iconPosition,
iconPosition = _props$iconPosition === void 0 ? 'left' : _props$iconPosition,
iconSize = props.iconSize,
showTooltip = props.showTooltip,
tooltipPosition = props.tooltipPosition,
shortcut = props.shortcut,
children = props.children,
isFocusable = props.__experimentalIsFocusable,
describedBy = props.describedBy,
additionalProps = Object(_babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(props, ["href", "target", "isPrimary", "isSmall", "isTertiary", "isPressed", "isBusy", "isDefault", "isSecondary", "isLink", "isDestructive", "className", "disabled", "icon", "iconPosition", "iconSize", "showTooltip", "tooltipPosition", "shortcut", "label", "children", "text", "__experimentalIsFocusable", "describedBy"]);
_wordpress_deprecated__WEBPACK_IMPORTED_MODULE_5___default()('Button isDefault prop', {
alternative: 'isSecondary'
var classes = classnames__WEBPACK_IMPORTED_MODULE_3___default()('components-button', className, {
'is-secondary': isDefault || isSecondary,