"use strict"; (self["webpackChunk_woocommerce_storybook"] = self["webpackChunk_woocommerce_storybook"] || []).push([[5452],{ /***/ "../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js": /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ A: () => (/* binding */ _arrayLikeToArray) /* harmony export */ }); 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; } /***/ }), /***/ "../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js": /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ A: () => (/* binding */ _arrayWithHoles) /* harmony export */ }); function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } /***/ }), /***/ "../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/nonIterableRest.js": /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ A: () => (/* binding */ _nonIterableRest) /* harmony export */ }); function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } /***/ }), /***/ "../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/slicedToArray.js": /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { // EXPORTS __webpack_require__.d(__webpack_exports__, { A: () => (/* binding */ _slicedToArray) }); // EXTERNAL MODULE: ../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js var arrayWithHoles = __webpack_require__("../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js"); ;// CONCATENATED MODULE: ../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } } // EXTERNAL MODULE: ../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js var unsupportedIterableToArray = __webpack_require__("../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js"); // EXTERNAL MODULE: ../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/nonIterableRest.js var nonIterableRest = __webpack_require__("../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/nonIterableRest.js"); ;// CONCATENATED MODULE: ../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/slicedToArray.js function _slicedToArray(arr, i) { return (0,arrayWithHoles/* default */.A)(arr) || _iterableToArrayLimit(arr, i) || (0,unsupportedIterableToArray/* default */.A)(arr, i) || (0,nonIterableRest/* default */.A)(); } /***/ }), /***/ "../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js": /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ A: () => (/* binding */ _unsupportedIterableToArray) /* harmony export */ }); /* harmony import */ var _arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js"); function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return (0,_arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A)(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 (0,_arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A)(o, minLen); } /***/ }), /***/ "../../node_modules/.pnpm/@wordpress+icons@8.2.3/node_modules/@wordpress/icons/build-module/library/chevron-left.js": /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js"); /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/@wordpress+primitives@3.4.1/node_modules/@wordpress/primitives/build-module/svg/index.js"); /** * WordPress dependencies */ const chevronLeft = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__/* .SVG */ .t4, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24" }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__/* .Path */ .wA, { d: "M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z" })); /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (chevronLeft); //# sourceMappingURL=chevron-left.js.map /***/ }), /***/ "../../node_modules/.pnpm/@wordpress+icons@8.2.3/node_modules/@wordpress/icons/build-module/library/chevron-right.js": /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js"); /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/@wordpress+primitives@3.4.1/node_modules/@wordpress/primitives/build-module/svg/index.js"); /** * WordPress dependencies */ const chevronRight = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__/* .SVG */ .t4, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24" }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__/* .Path */ .wA, { d: "M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z" })); /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (chevronRight); //# sourceMappingURL=chevron-right.js.map /***/ }), /***/ "../../packages/js/components/src/pagination/page-size-picker.tsx": /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ $: () => (/* binding */ PageSizePicker), /* harmony export */ v: () => (/* binding */ DEFAULT_PER_PAGE_OPTIONS) /* harmony export */ }); /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js"); /* harmony import */ var core_js_modules_es_parse_int_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/modules/es.parse-int.js"); /* harmony import */ var core_js_modules_es_parse_int_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_parse_int_js__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var core_js_modules_es_array_map_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/modules/es.array.map.js"); /* harmony import */ var core_js_modules_es_array_map_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_map_js__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var core_js_modules_es_date_to_string_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/modules/es.date.to-string.js"); /* harmony import */ var core_js_modules_es_date_to_string_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_date_to_string_js__WEBPACK_IMPORTED_MODULE_2__); /* harmony import */ var core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/modules/es.object.to-string.js"); /* harmony import */ var core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_3__); /* harmony import */ var core_js_modules_es_regexp_to_string_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/modules/es.regexp.to-string.js"); /* harmony import */ var core_js_modules_es_regexp_to_string_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_regexp_to_string_js__WEBPACK_IMPORTED_MODULE_4__); /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@19.8.5_@types+react@17.0.71_react-dom@17.0.2_react@17.0.2__react-with-d_oli5xz3n7pc4ztqokra47llglu/node_modules/@wordpress/components/build-module/select-control/index.js"); /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("../../node_modules/.pnpm/@wordpress+i18n@4.6.1/node_modules/@wordpress/i18n/build-module/index.js"); /** * External dependencies */ var DEFAULT_PER_PAGE_OPTIONS = [25, 50, 75, 100]; function PageSizePicker(_ref) { var perPage = _ref.perPage, currentPage = _ref.currentPage, total = _ref.total, setCurrentPage = _ref.setCurrentPage, _ref$setPerPageChange = _ref.setPerPageChange, setPerPageChange = _ref$setPerPageChange === void 0 ? function () {} : _ref$setPerPageChange, _ref$perPageOptions = _ref.perPageOptions, perPageOptions = _ref$perPageOptions === void 0 ? DEFAULT_PER_PAGE_OPTIONS : _ref$perPageOptions, _ref$label = _ref.label, label = _ref$label === void 0 ? (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Rows per page', 'woocommerce') : _ref$label; function perPageChange(newPerPage) { setPerPageChange(parseInt(newPerPage, 10)); var newMaxPage = Math.ceil(total / parseInt(newPerPage, 10)); if (currentPage > newMaxPage) { setCurrentPage(newMaxPage); } } // @todo Replace this with a styleized Select drop-down/control? var pickerOptions = perPageOptions.map(function (option) { return { value: option.toString(), label: option.toString() }; }); return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_6__.createElement)("div", { className: "woocommerce-pagination__per-page-picker" }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_6__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .A, { label: label // @ts-expect-error outdated types file. , labelPosition: "side", value: perPage.toString(), onChange: perPageChange, options: pickerOptions })); } try { // @ts-ignore PageSizePicker.displayName = "PageSizePicker"; // @ts-ignore PageSizePicker.__docgenInfo = { "description": "", "displayName": "PageSizePicker", "props": { "currentPage": { "defaultValue": null, "description": "", "name": "currentPage", "required": true, "type": { "name": "number" } }, "perPage": { "defaultValue": null, "description": "", "name": "perPage", "required": true, "type": { "name": "number" } }, "total": { "defaultValue": null, "description": "", "name": "total", "required": true, "type": { "name": "number" } }, "setCurrentPage": { "defaultValue": null, "description": "", "name": "setCurrentPage", "required": true, "type": { "name": "(page: number, action?: \"previous\" | \"next\" | \"goto\" | undefined) => void" } }, "setPerPageChange": { "defaultValue": { value: "() => {}" }, "description": "", "name": "setPerPageChange", "required": false, "type": { "name": "((perPage: number) => void)" } }, "perPageOptions": { "defaultValue": { value: "[ 25, 50, 75, 100 ]" }, "description": "", "name": "perPageOptions", "required": false, "type": { "name": "number[]" } }, "label": { "defaultValue": { value: "__( 'Rows per page', 'woocommerce' )" }, "description": "", "name": "label", "required": false, "type": { "name": "string" } } } }; // @ts-ignore if (typeof STORYBOOK_REACT_CLASSES !== "undefined") // @ts-ignore STORYBOOK_REACT_CLASSES["../../packages/js/components/src/pagination/page-size-picker.tsx#PageSizePicker"] = { docgenInfo: PageSizePicker.__docgenInfo, name: "PageSizePicker", path: "../../packages/js/components/src/pagination/page-size-picker.tsx#PageSizePicker" }; } catch (__react_docgen_typescript_loader_error) { } /***/ }), /***/ "../../packages/js/components/src/pagination/pagination.tsx": /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { // EXPORTS __webpack_require__.d(__webpack_exports__, { d: () => (/* binding */ Pagination) }); // EXTERNAL MODULE: ../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js var react = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js"); // EXTERNAL MODULE: ../../node_modules/.pnpm/classnames@2.3.2/node_modules/classnames/index.js var classnames = __webpack_require__("../../node_modules/.pnpm/classnames@2.3.2/node_modules/classnames/index.js"); var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames); // EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@19.8.5_@types+react@17.0.71_react-dom@17.0.2_react@17.0.2__react-with-d_oli5xz3n7pc4ztqokra47llglu/node_modules/@wordpress/components/build-module/button/index.js var build_module_button = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@19.8.5_@types+react@17.0.71_react-dom@17.0.2_react@17.0.2__react-with-d_oli5xz3n7pc4ztqokra47llglu/node_modules/@wordpress/components/build-module/button/index.js"); // EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@19.8.5_@types+react@17.0.71_react-dom@17.0.2_react@17.0.2__react-with-d_oli5xz3n7pc4ztqokra47llglu/node_modules/@wordpress/components/build-module/icon/index.js + 1 modules var icon = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@19.8.5_@types+react@17.0.71_react-dom@17.0.2_react@17.0.2__react-with-d_oli5xz3n7pc4ztqokra47llglu/node_modules/@wordpress/components/build-module/icon/index.js"); // EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+icons@8.2.3/node_modules/@wordpress/icons/build-module/library/chevron-left.js var chevron_left = __webpack_require__("../../node_modules/.pnpm/@wordpress+icons@8.2.3/node_modules/@wordpress/icons/build-module/library/chevron-left.js"); // EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+icons@8.2.3/node_modules/@wordpress/icons/build-module/library/chevron-right.js var chevron_right = __webpack_require__("../../node_modules/.pnpm/@wordpress+icons@8.2.3/node_modules/@wordpress/icons/build-module/library/chevron-right.js"); // EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+i18n@4.6.1/node_modules/@wordpress/i18n/build-module/index.js + 3 modules var build_module = __webpack_require__("../../node_modules/.pnpm/@wordpress+i18n@4.6.1/node_modules/@wordpress/i18n/build-module/index.js"); ;// CONCATENATED MODULE: ../../packages/js/components/src/pagination/page-arrows.tsx /** * External dependencies */ function PageArrows(_ref) { var pageCount = _ref.pageCount, currentPage = _ref.currentPage, _ref$showPageArrowsLa = _ref.showPageArrowsLabel, showPageArrowsLabel = _ref$showPageArrowsLa === void 0 ? true : _ref$showPageArrowsLa, setCurrentPage = _ref.setCurrentPage; function previousPage(event) { event.stopPropagation(); if (currentPage - 1 < 1) { return; } setCurrentPage(currentPage - 1, 'previous'); } function nextPage(event) { event.stopPropagation(); if (currentPage + 1 > pageCount) { return; } setCurrentPage(currentPage + 1, 'next'); } if (pageCount <= 1) { return null; } var previousLinkClass = classnames_default()('woocommerce-pagination__link', { 'is-active': currentPage > 1 }); var nextLinkClass = classnames_default()('woocommerce-pagination__link', { 'is-active': currentPage < pageCount }); return (0,react.createElement)("div", { className: "woocommerce-pagination__page-arrows" }, showPageArrowsLabel && (0,react.createElement)("span", { className: "woocommerce-pagination__page-arrows-label", role: "status", "aria-live": "polite" }, (0,build_module/* sprintf */.nv)( /* translators: 1: current page number, 2: total number of pages */ (0,build_module.__)('Page %1$d of %2$d', 'woocommerce'), currentPage, pageCount)), (0,react.createElement)("div", { className: "woocommerce-pagination__page-arrows-buttons" }, (0,react.createElement)(build_module_button/* default */.A, { className: previousLinkClass, disabled: !(currentPage > 1), onClick: previousPage, label: (0,build_module.__)('Previous Page', 'woocommerce') }, (0,react.createElement)(icon/* default */.A, { icon: chevron_left/* default */.A })), (0,react.createElement)(build_module_button/* default */.A, { className: nextLinkClass, disabled: !(currentPage < pageCount), onClick: nextPage, label: (0,build_module.__)('Next Page', 'woocommerce') }, (0,react.createElement)(icon/* default */.A, { icon: chevron_right/* default */.A })))); } try { // @ts-ignore PageArrows.displayName = "PageArrows"; // @ts-ignore PageArrows.__docgenInfo = { "description": "", "displayName": "PageArrows", "props": { "currentPage": { "defaultValue": null, "description": "", "name": "currentPage", "required": true, "type": { "name": "number" } }, "pageCount": { "defaultValue": null, "description": "", "name": "pageCount", "required": true, "type": { "name": "number" } }, "showPageArrowsLabel": { "defaultValue": { value: "true" }, "description": "", "name": "showPageArrowsLabel", "required": false, "type": { "name": "boolean" } }, "setCurrentPage": { "defaultValue": null, "description": "", "name": "setCurrentPage", "required": true, "type": { "name": "(page: number, action?: \"previous\" | \"next\" | \"goto\" | undefined) => void" } } } }; // @ts-ignore if (typeof STORYBOOK_REACT_CLASSES !== "undefined") // @ts-ignore STORYBOOK_REACT_CLASSES["../../packages/js/components/src/pagination/page-arrows.tsx#PageArrows"] = { docgenInfo: PageArrows.__docgenInfo, name: "PageArrows", path: "../../packages/js/components/src/pagination/page-arrows.tsx#PageArrows" }; } catch (__react_docgen_typescript_loader_error) { } // EXTERNAL MODULE: ../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/slicedToArray.js + 1 modules var slicedToArray = __webpack_require__("../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/slicedToArray.js"); // EXTERNAL MODULE: ../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/modules/es.parse-int.js var es_parse_int = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/modules/es.parse-int.js"); // EXTERNAL MODULE: ../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/modules/es.number.is-finite.js var es_number_is_finite = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/modules/es.number.is-finite.js"); // EXTERNAL MODULE: ../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/modules/es.number.constructor.js var es_number_constructor = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/modules/es.number.constructor.js"); // EXTERNAL MODULE: ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/lodash.js var lodash = __webpack_require__("../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/lodash.js"); ;// CONCATENATED MODULE: ../../packages/js/components/src/pagination/page-picker.tsx /** * External dependencies */ function PagePicker(_ref) { var pageCount = _ref.pageCount, currentPage = _ref.currentPage, setCurrentPage = _ref.setCurrentPage; var _useState = (0,react.useState)(currentPage), _useState2 = (0,slicedToArray/* default */.A)(_useState, 2), inputValue = _useState2[0], setInputValue = _useState2[1]; function onInputChange(event) { setInputValue(parseInt(event.currentTarget.value, 10)); } function onInputBlur(event) { var newPage = parseInt(event.target.value, 10); if (newPage !== currentPage && Number.isFinite(newPage) && newPage > 0 && pageCount && pageCount >= newPage) { setCurrentPage(newPage, 'goto'); } } function selectInputValue(event) { event.currentTarget.select(); } var isError = currentPage < 1 || currentPage > pageCount; var inputClass = classnames_default()('woocommerce-pagination__page-picker-input', { 'has-error': isError }); var instanceId = (0,lodash.uniqueId)('woocommerce-pagination-page-picker-'); return (0,react.createElement)("div", { className: "woocommerce-pagination__page-picker" }, (0,react.createElement)("label", { htmlFor: instanceId, className: "woocommerce-pagination__page-picker-label" }, (0,build_module.__)('Go to page', 'woocommerce'), (0,react.createElement)("input", { id: instanceId, className: inputClass, "aria-invalid": isError, type: "number", onClick: selectInputValue, onChange: onInputChange, onBlur: onInputBlur, value: inputValue, min: 1, max: pageCount }))); } try { // @ts-ignore PagePicker.displayName = "PagePicker"; // @ts-ignore PagePicker.__docgenInfo = { "description": "", "displayName": "PagePicker", "props": { "currentPage": { "defaultValue": null, "description": "", "name": "currentPage", "required": true, "type": { "name": "number" } }, "pageCount": { "defaultValue": null, "description": "", "name": "pageCount", "required": true, "type": { "name": "number" } }, "setCurrentPage": { "defaultValue": null, "description": "", "name": "setCurrentPage", "required": true, "type": { "name": "(page: number, action?: \"previous\" | \"next\" | \"goto\" | undefined) => void" } } } }; // @ts-ignore if (typeof STORYBOOK_REACT_CLASSES !== "undefined") // @ts-ignore STORYBOOK_REACT_CLASSES["../../packages/js/components/src/pagination/page-picker.tsx#PagePicker"] = { docgenInfo: PagePicker.__docgenInfo, name: "PagePicker", path: "../../packages/js/components/src/pagination/page-picker.tsx#PagePicker" }; } catch (__react_docgen_typescript_loader_error) { } // EXTERNAL MODULE: ../../packages/js/components/src/pagination/page-size-picker.tsx var page_size_picker = __webpack_require__("../../packages/js/components/src/pagination/page-size-picker.tsx"); ;// CONCATENATED MODULE: ../../packages/js/components/src/pagination/pagination.tsx /** * External dependencies */ /** * Internal dependencies */ function Pagination(_ref) { var page = _ref.page, _ref$onPageChange = _ref.onPageChange, onPageChange = _ref$onPageChange === void 0 ? function () {} : _ref$onPageChange, total = _ref.total, perPage = _ref.perPage, _ref$onPerPageChange = _ref.onPerPageChange, onPerPageChange = _ref$onPerPageChange === void 0 ? function () {} : _ref$onPerPageChange, _ref$showPagePicker = _ref.showPagePicker, showPagePicker = _ref$showPagePicker === void 0 ? true : _ref$showPagePicker, _ref$showPerPagePicke = _ref.showPerPagePicker, showPerPagePicker = _ref$showPerPagePicke === void 0 ? true : _ref$showPerPagePicke, _ref$showPageArrowsLa = _ref.showPageArrowsLabel, showPageArrowsLabel = _ref$showPageArrowsLa === void 0 ? true : _ref$showPageArrowsLa, className = _ref.className, _ref$perPageOptions = _ref.perPageOptions, perPageOptions = _ref$perPageOptions === void 0 ? page_size_picker/* DEFAULT_PER_PAGE_OPTIONS */.v : _ref$perPageOptions, children = _ref.children; var pageCount = Math.ceil(total / perPage); if (children && typeof children === 'function') { return children({ pageCount: pageCount }); } var classes = classnames_default()('woocommerce-pagination', className); if (pageCount <= 1) { return total > perPageOptions[0] && (0,react.createElement)("div", { className: classes }, (0,react.createElement)(page_size_picker/* PageSizePicker */.$, { currentPage: page, perPage: perPage, setCurrentPage: onPageChange, total: total, setPerPageChange: onPerPageChange, perPageOptions: perPageOptions })) || null; } return (0,react.createElement)("div", { className: classes }, (0,react.createElement)(PageArrows, { currentPage: page, pageCount: pageCount, showPageArrowsLabel: showPageArrowsLabel, setCurrentPage: onPageChange }), showPagePicker && (0,react.createElement)(PagePicker, { currentPage: page, pageCount: pageCount, setCurrentPage: onPageChange }), showPerPagePicker && (0,react.createElement)(page_size_picker/* PageSizePicker */.$, { currentPage: page, perPage: perPage, setCurrentPage: onPageChange, total: total, setPerPageChange: onPerPageChange, perPageOptions: perPageOptions })); } try { // @ts-ignore Pagination.displayName = "Pagination"; // @ts-ignore Pagination.__docgenInfo = { "description": "", "displayName": "Pagination", "props": { "page": { "defaultValue": null, "description": "", "name": "page", "required": true, "type": { "name": "number" } }, "perPage": { "defaultValue": null, "description": "", "name": "perPage", "required": true, "type": { "name": "number" } }, "total": { "defaultValue": null, "description": "", "name": "total", "required": true, "type": { "name": "number" } }, "onPageChange": { "defaultValue": { value: "() => {}" }, "description": "", "name": "onPageChange", "required": false, "type": { "name": "((page: number, action?: \"previous\" | \"next\" | \"goto\") => void)" } }, "onPerPageChange": { "defaultValue": { value: "() => {}" }, "description": "", "name": "onPerPageChange", "required": false, "type": { "name": "((perPage: number) => void)" } }, "className": { "defaultValue": null, "description": "", "name": "className", "required": false, "type": { "name": "string" } }, "showPagePicker": { "defaultValue": { value: "true" }, "description": "", "name": "showPagePicker", "required": false, "type": { "name": "boolean" } }, "showPerPagePicker": { "defaultValue": { value: "true" }, "description": "", "name": "showPerPagePicker", "required": false, "type": { "name": "boolean" } }, "showPageArrowsLabel": { "defaultValue": { value: "true" }, "description": "", "name": "showPageArrowsLabel", "required": false, "type": { "name": "boolean" } }, "perPageOptions": { "defaultValue": { value: "[ 25, 50, 75, 100 ]" }, "description": "", "name": "perPageOptions", "required": false, "type": { "name": "number[]" } } } }; // @ts-ignore if (typeof STORYBOOK_REACT_CLASSES !== "undefined") // @ts-ignore STORYBOOK_REACT_CLASSES["../../packages/js/components/src/pagination/pagination.tsx#Pagination"] = { docgenInfo: Pagination.__docgenInfo, name: "Pagination", path: "../../packages/js/components/src/pagination/pagination.tsx#Pagination" }; } catch (__react_docgen_typescript_loader_error) { } /***/ }), /***/ "../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/array-iteration.js": /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var bind = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/function-bind-context.js"); var uncurryThis = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/function-uncurry-this.js"); var IndexedObject = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/indexed-object.js"); var toObject = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/to-object.js"); var lengthOfArrayLike = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/length-of-array-like.js"); var arraySpeciesCreate = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/array-species-create.js"); var push = uncurryThis([].push); // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterReject }` methods implementation var createMethod = function (TYPE) { var IS_MAP = TYPE === 1; var IS_FILTER = TYPE === 2; var IS_SOME = TYPE === 3; var IS_EVERY = TYPE === 4; var IS_FIND_INDEX = TYPE === 6; var IS_FILTER_REJECT = TYPE === 7; var NO_HOLES = TYPE === 5 || IS_FIND_INDEX; return function ($this, callbackfn, that, specificCreate) { var O = toObject($this); var self = IndexedObject(O); var length = lengthOfArrayLike(self); var boundFunction = bind(callbackfn, that); var index = 0; var create = specificCreate || arraySpeciesCreate; var target = IS_MAP ? create($this, length) : IS_FILTER || IS_FILTER_REJECT ? create($this, 0) : undefined; var value, result; for (;length > index; index++) if (NO_HOLES || index in self) { value = self[index]; result = boundFunction(value, index, O); if (TYPE) { if (IS_MAP) target[index] = result; // map else if (result) switch (TYPE) { case 3: return true; // some case 5: return value; // find case 6: return index; // findIndex case 2: push(target, value); // filter } else switch (TYPE) { case 4: return false; // every case 7: push(target, value); // filterReject } } } return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target; }; }; module.exports = { // `Array.prototype.forEach` method // https://tc39.es/ecma262/#sec-array.prototype.foreach forEach: createMethod(0), // `Array.prototype.map` method // https://tc39.es/ecma262/#sec-array.prototype.map map: createMethod(1), // `Array.prototype.filter` method // https://tc39.es/ecma262/#sec-array.prototype.filter filter: createMethod(2), // `Array.prototype.some` method // https://tc39.es/ecma262/#sec-array.prototype.some some: createMethod(3), // `Array.prototype.every` method // https://tc39.es/ecma262/#sec-array.prototype.every every: createMethod(4), // `Array.prototype.find` method // https://tc39.es/ecma262/#sec-array.prototype.find find: createMethod(5), // `Array.prototype.findIndex` method // https://tc39.es/ecma262/#sec-array.prototype.findIndex findIndex: createMethod(6), // `Array.prototype.filterReject` method // https://github.com/tc39/proposal-array-filtering filterReject: createMethod(7) }; /***/ }), /***/ "../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/array-method-has-species-support.js": /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var fails = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/fails.js"); var wellKnownSymbol = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/well-known-symbol.js"); var V8_VERSION = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/engine-v8-version.js"); var SPECIES = wellKnownSymbol('species'); module.exports = function (METHOD_NAME) { // We can't use this feature detection in V8 since it causes // deoptimization and serious performance degradation // https://github.com/zloirock/core-js/issues/677 return V8_VERSION >= 51 || !fails(function () { var array = []; var constructor = array.constructor = {}; constructor[SPECIES] = function () { return { foo: 1 }; }; return array[METHOD_NAME](Boolean).foo !== 1; }); }; /***/ }), /***/ "../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/array-species-constructor.js": /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var isArray = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/is-array.js"); var isConstructor = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/is-constructor.js"); var isObject = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/is-object.js"); var wellKnownSymbol = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/well-known-symbol.js"); var SPECIES = wellKnownSymbol('species'); var $Array = Array; // a part of `ArraySpeciesCreate` abstract operation // https://tc39.es/ecma262/#sec-arrayspeciescreate module.exports = function (originalArray) { var C; if (isArray(originalArray)) { C = originalArray.constructor; // cross-realm fallback if (isConstructor(C) && (C === $Array || isArray(C.prototype))) C = undefined; else if (isObject(C)) { C = C[SPECIES]; if (C === null) C = undefined; } } return C === undefined ? $Array : C; }; /***/ }), /***/ "../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/array-species-create.js": /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var arraySpeciesConstructor = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/array-species-constructor.js"); // `ArraySpeciesCreate` abstract operation // https://tc39.es/ecma262/#sec-arrayspeciescreate module.exports = function (originalArray, length) { return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length); }; /***/ }), /***/ "../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/inherit-if-required.js": /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var isCallable = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/is-callable.js"); var isObject = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/is-object.js"); var setPrototypeOf = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/object-set-prototype-of.js"); // makes subclassing work correct for wrapped built-ins module.exports = function ($this, dummy, Wrapper) { var NewTarget, NewTargetPrototype; if ( // it can work only with native `setPrototypeOf` setPrototypeOf && // we haven't completely correct pre-ES6 way for getting `new.target`, so use this isCallable(NewTarget = dummy.constructor) && NewTarget !== Wrapper && isObject(NewTargetPrototype = NewTarget.prototype) && NewTargetPrototype !== Wrapper.prototype ) setPrototypeOf($this, NewTargetPrototype); return $this; }; /***/ }), /***/ "../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/is-array.js": /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var classof = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/classof-raw.js"); // `IsArray` abstract operation // https://tc39.es/ecma262/#sec-isarray // eslint-disable-next-line es/no-array-isarray -- safe module.exports = Array.isArray || function isArray(argument) { return classof(argument) === 'Array'; }; /***/ }), /***/ "../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/number-is-finite.js": /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var global = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/global.js"); var globalIsFinite = global.isFinite; // `Number.isFinite` method // https://tc39.es/ecma262/#sec-number.isfinite // eslint-disable-next-line es/no-number-isfinite -- safe module.exports = Number.isFinite || function isFinite(it) { return typeof it == 'number' && globalIsFinite(it); }; /***/ }), /***/ "../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/number-parse-int.js": /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var global = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/global.js"); var fails = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/fails.js"); var uncurryThis = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/function-uncurry-this.js"); var toString = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/to-string.js"); var trim = (__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/string-trim.js").trim); var whitespaces = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/whitespaces.js"); var $parseInt = global.parseInt; var Symbol = global.Symbol; var ITERATOR = Symbol && Symbol.iterator; var hex = /^[+-]?0x/i; var exec = uncurryThis(hex.exec); var FORCED = $parseInt(whitespaces + '08') !== 8 || $parseInt(whitespaces + '0x16') !== 22 // MS Edge 18- broken with boxed symbols || (ITERATOR && !fails(function () { $parseInt(Object(ITERATOR)); })); // `parseInt` method // https://tc39.es/ecma262/#sec-parseint-string-radix module.exports = FORCED ? function parseInt(string, radix) { var S = trim(toString(string)); return $parseInt(S, (radix >>> 0) || (exec(hex, S) ? 16 : 10)); } : $parseInt; /***/ }), /***/ "../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/path.js": /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var global = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/global.js"); module.exports = global; /***/ }), /***/ "../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/regexp-get-flags.js": /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var call = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/function-call.js"); var hasOwn = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/has-own-property.js"); var isPrototypeOf = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/object-is-prototype-of.js"); var regExpFlags = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/regexp-flags.js"); var RegExpPrototype = RegExp.prototype; module.exports = function (R) { var flags = R.flags; return flags === undefined && !('flags' in RegExpPrototype) && !hasOwn(R, 'flags') && isPrototypeOf(RegExpPrototype, R) ? call(regExpFlags, R) : flags; }; /***/ }), /***/ "../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/string-trim.js": /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var uncurryThis = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/function-uncurry-this.js"); var requireObjectCoercible = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/require-object-coercible.js"); var toString = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/to-string.js"); var whitespaces = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/whitespaces.js"); var replace = uncurryThis(''.replace); var ltrim = RegExp('^[' + whitespaces + ']+'); var rtrim = RegExp('(^|[^' + whitespaces + '])[' + whitespaces + ']+$'); // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation var createMethod = function (TYPE) { return function ($this) { var string = toString(requireObjectCoercible($this)); if (TYPE & 1) string = replace(string, ltrim, ''); if (TYPE & 2) string = replace(string, rtrim, '$1'); return string; }; }; module.exports = { // `String.prototype.{ trimLeft, trimStart }` methods // https://tc39.es/ecma262/#sec-string.prototype.trimstart start: createMethod(1), // `String.prototype.{ trimRight, trimEnd }` methods // https://tc39.es/ecma262/#sec-string.prototype.trimend end: createMethod(2), // `String.prototype.trim` method // https://tc39.es/ecma262/#sec-string.prototype.trim trim: createMethod(3) }; /***/ }), /***/ "../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/this-number-value.js": /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var uncurryThis = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/function-uncurry-this.js"); // `thisNumberValue` abstract operation // https://tc39.es/ecma262/#sec-thisnumbervalue module.exports = uncurryThis(1.0.valueOf); /***/ }), /***/ "../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/whitespaces.js": /***/ ((module) => { // a string of all valid unicode whitespaces module.exports = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' + '\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF'; /***/ }), /***/ "../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/modules/es.array.map.js": /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/export.js"); var $map = (__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/array-iteration.js").map); var arrayMethodHasSpeciesSupport = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/array-method-has-species-support.js"); var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('map'); // `Array.prototype.map` method // https://tc39.es/ecma262/#sec-array.prototype.map // with adding support of @@species $({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, { map: function map(callbackfn /* , thisArg */) { return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); } }); /***/ }), /***/ "../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/modules/es.date.to-string.js": /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { // TODO: Remove from `core-js@4` var uncurryThis = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/function-uncurry-this.js"); var defineBuiltIn = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/define-built-in.js"); var DatePrototype = Date.prototype; var INVALID_DATE = 'Invalid Date'; var TO_STRING = 'toString'; var nativeDateToString = uncurryThis(DatePrototype[TO_STRING]); var thisTimeValue = uncurryThis(DatePrototype.getTime); // `Date.prototype.toString` method // https://tc39.es/ecma262/#sec-date.prototype.tostring if (String(new Date(NaN)) !== INVALID_DATE) { defineBuiltIn(DatePrototype, TO_STRING, function toString() { var value = thisTimeValue(this); // eslint-disable-next-line no-self-compare -- NaN check return value === value ? nativeDateToString(this) : INVALID_DATE; }); } /***/ }), /***/ "../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/modules/es.number.constructor.js": /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/export.js"); var IS_PURE = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/is-pure.js"); var DESCRIPTORS = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/descriptors.js"); var global = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/global.js"); var path = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/path.js"); var uncurryThis = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/function-uncurry-this.js"); var isForced = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/is-forced.js"); var hasOwn = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/has-own-property.js"); var inheritIfRequired = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/inherit-if-required.js"); var isPrototypeOf = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/object-is-prototype-of.js"); var isSymbol = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/is-symbol.js"); var toPrimitive = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/to-primitive.js"); var fails = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/fails.js"); var getOwnPropertyNames = (__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/object-get-own-property-names.js").f); var getOwnPropertyDescriptor = (__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/object-get-own-property-descriptor.js").f); var defineProperty = (__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/object-define-property.js").f); var thisNumberValue = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/this-number-value.js"); var trim = (__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/string-trim.js").trim); var NUMBER = 'Number'; var NativeNumber = global[NUMBER]; var PureNumberNamespace = path[NUMBER]; var NumberPrototype = NativeNumber.prototype; var TypeError = global.TypeError; var stringSlice = uncurryThis(''.slice); var charCodeAt = uncurryThis(''.charCodeAt); // `ToNumeric` abstract operation // https://tc39.es/ecma262/#sec-tonumeric var toNumeric = function (value) { var primValue = toPrimitive(value, 'number'); return typeof primValue == 'bigint' ? primValue : toNumber(primValue); }; // `ToNumber` abstract operation // https://tc39.es/ecma262/#sec-tonumber var toNumber = function (argument) { var it = toPrimitive(argument, 'number'); var first, third, radix, maxCode, digits, length, index, code; if (isSymbol(it)) throw new TypeError('Cannot convert a Symbol value to a number'); if (typeof it == 'string' && it.length > 2) { it = trim(it); first = charCodeAt(it, 0); if (first === 43 || first === 45) { third = charCodeAt(it, 2); if (third === 88 || third === 120) return NaN; // Number('+0x1') should be NaN, old V8 fix } else if (first === 48) { switch (charCodeAt(it, 1)) { // fast equal of /^0b[01]+$/i case 66: case 98: radix = 2; maxCode = 49; break; // fast equal of /^0o[0-7]+$/i case 79: case 111: radix = 8; maxCode = 55; break; default: return +it; } digits = stringSlice(it, 2); length = digits.length; for (index = 0; index < length; index++) { code = charCodeAt(digits, index); // parseInt parses a string to a first unavailable symbol // but ToNumber should return NaN if a string contains unavailable symbols if (code < 48 || code > maxCode) return NaN; } return parseInt(digits, radix); } } return +it; }; var FORCED = isForced(NUMBER, !NativeNumber(' 0o1') || !NativeNumber('0b1') || NativeNumber('+0x1')); var calledWithNew = function (dummy) { // includes check on 1..constructor(foo) case return isPrototypeOf(NumberPrototype, dummy) && fails(function () { thisNumberValue(dummy); }); }; // `Number` constructor // https://tc39.es/ecma262/#sec-number-constructor var NumberWrapper = function Number(value) { var n = arguments.length < 1 ? 0 : NativeNumber(toNumeric(value)); return calledWithNew(this) ? inheritIfRequired(Object(n), this, NumberWrapper) : n; }; NumberWrapper.prototype = NumberPrototype; if (FORCED && !IS_PURE) NumberPrototype.constructor = NumberWrapper; $({ global: true, constructor: true, wrap: true, forced: FORCED }, { Number: NumberWrapper }); // Use `internal/copy-constructor-properties` helper in `core-js@4` var copyConstructorProperties = function (target, source) { for (var keys = DESCRIPTORS ? getOwnPropertyNames(source) : ( // ES3: 'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' + // ES2015 (in case, if modules with ES2015 Number statics required before): 'EPSILON,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,isFinite,isInteger,isNaN,isSafeInteger,parseFloat,parseInt,' + // ESNext 'fromString,range' ).split(','), j = 0, key; keys.length > j; j++) { if (hasOwn(source, key = keys[j]) && !hasOwn(target, key)) { defineProperty(target, key, getOwnPropertyDescriptor(source, key)); } } }; if (IS_PURE && PureNumberNamespace) copyConstructorProperties(path[NUMBER], PureNumberNamespace); if (FORCED || IS_PURE) copyConstructorProperties(path[NUMBER], NativeNumber); /***/ }), /***/ "../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/modules/es.number.is-finite.js": /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/export.js"); var numberIsFinite = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/number-is-finite.js"); // `Number.isFinite` method // https://tc39.es/ecma262/#sec-number.isfinite $({ target: 'Number', stat: true }, { isFinite: numberIsFinite }); /***/ }), /***/ "../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/modules/es.parse-int.js": /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/export.js"); var $parseInt = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/number-parse-int.js"); // `parseInt` method // https://tc39.es/ecma262/#sec-parseint-string-radix $({ global: true, forced: parseInt !== $parseInt }, { parseInt: $parseInt }); /***/ }), /***/ "../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/modules/es.regexp.to-string.js": /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var PROPER_FUNCTION_NAME = (__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/function-name.js").PROPER); var defineBuiltIn = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/define-built-in.js"); var anObject = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/an-object.js"); var $toString = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/to-string.js"); var fails = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/fails.js"); var getRegExpFlags = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/regexp-get-flags.js"); var TO_STRING = 'toString'; var RegExpPrototype = RegExp.prototype; var nativeToString = RegExpPrototype[TO_STRING]; var NOT_GENERIC = fails(function () { return nativeToString.call({ source: 'a', flags: 'b' }) !== '/a/b'; }); // FF44- RegExp#toString has a wrong name var INCORRECT_NAME = PROPER_FUNCTION_NAME && nativeToString.name !== TO_STRING; // `RegExp.prototype.toString` method // https://tc39.es/ecma262/#sec-regexp.prototype.tostring if (NOT_GENERIC || INCORRECT_NAME) { defineBuiltIn(RegExp.prototype, TO_STRING, function toString() { var R = anObject(this); var pattern = $toString(R.source); var flags = $toString(getRegExpFlags(R)); return '/' + pattern + '/' + flags; }, { unsafe: true }); } /***/ }), /***/ "../../packages/js/components/src/pagination/stories/pagination.story.js": /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { CustomWithHook: () => (/* binding */ CustomWithHook), Default: () => (/* binding */ Default), "default": () => (/* binding */ pagination_story) }); // EXTERNAL MODULE: ../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/extends.js var esm_extends = __webpack_require__("../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/extends.js"); // EXTERNAL MODULE: ../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/slicedToArray.js + 1 modules var slicedToArray = __webpack_require__("../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/slicedToArray.js"); // EXTERNAL MODULE: ../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js var react = __webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js"); // EXTERNAL MODULE: ../../packages/js/components/src/pagination/pagination.tsx + 2 modules var pagination = __webpack_require__("../../packages/js/components/src/pagination/pagination.tsx"); ;// CONCATENATED MODULE: ../../packages/js/components/src/pagination/use-pagination.ts /** * External dependencies */ function usePagination(_ref) { var totalCount = _ref.totalCount, _ref$defaultPerPage = _ref.defaultPerPage, defaultPerPage = _ref$defaultPerPage === void 0 ? 25 : _ref$defaultPerPage, onPageChange = _ref.onPageChange, onPerPageChange = _ref.onPerPageChange; var _useState = (0,react.useState)(1), _useState2 = (0,slicedToArray/* default */.A)(_useState, 2), currentPage = _useState2[0], _setCurrentPage = _useState2[1]; var _useState3 = (0,react.useState)(defaultPerPage), _useState4 = (0,slicedToArray/* default */.A)(_useState3, 2), perPage = _useState4[0], setPerPage = _useState4[1]; var pageCount = Math.ceil(totalCount / perPage); var start = perPage * (currentPage - 1) + 1; var end = Math.min(perPage * currentPage, totalCount); return { start: start, end: end, currentPage: currentPage, perPage: perPage, pageCount: pageCount, setCurrentPage: function setCurrentPage(newPage) { _setCurrentPage(newPage); if (onPageChange) { onPageChange(newPage); } }, setPerPageChange: function setPerPageChange(newPerPage) { _setCurrentPage(1); setPerPage(newPerPage); if (onPerPageChange) { onPerPageChange(newPerPage); } } }; } // EXTERNAL MODULE: ../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/modules/es.parse-int.js var es_parse_int = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/modules/es.parse-int.js"); // EXTERNAL MODULE: ../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/modules/es.number.is-finite.js var es_number_is_finite = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/modules/es.number.is-finite.js"); // EXTERNAL MODULE: ../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/modules/es.number.constructor.js var es_number_constructor = __webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/modules/es.number.constructor.js"); // EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+components@19.8.5_@types+react@17.0.71_react-dom@17.0.2_react@17.0.2__react-with-d_oli5xz3n7pc4ztqokra47llglu/node_modules/@wordpress/components/build-module/button/index.js var build_module_button = __webpack_require__("../../node_modules/.pnpm/@wordpress+components@19.8.5_@types+react@17.0.71_react-dom@17.0.2_react@17.0.2__react-with-d_oli5xz3n7pc4ztqokra47llglu/node_modules/@wordpress/components/build-module/button/index.js"); // EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+icons@8.2.3/node_modules/@wordpress/icons/build-module/library/chevron-left.js var chevron_left = __webpack_require__("../../node_modules/.pnpm/@wordpress+icons@8.2.3/node_modules/@wordpress/icons/build-module/library/chevron-left.js"); // EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+icons@8.2.3/node_modules/@wordpress/icons/build-module/library/chevron-right.js var chevron_right = __webpack_require__("../../node_modules/.pnpm/@wordpress+icons@8.2.3/node_modules/@wordpress/icons/build-module/library/chevron-right.js"); // EXTERNAL MODULE: ../../node_modules/.pnpm/@wordpress+i18n@4.6.1/node_modules/@wordpress/i18n/build-module/index.js + 3 modules var build_module = __webpack_require__("../../node_modules/.pnpm/@wordpress+i18n@4.6.1/node_modules/@wordpress/i18n/build-module/index.js"); // EXTERNAL MODULE: ../../node_modules/.pnpm/classnames@2.3.2/node_modules/classnames/index.js var classnames = __webpack_require__("../../node_modules/.pnpm/classnames@2.3.2/node_modules/classnames/index.js"); var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames); // EXTERNAL MODULE: ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/lodash.js var lodash = __webpack_require__("../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/lodash.js"); ;// CONCATENATED MODULE: ../../packages/js/components/src/pagination/page-arrows-with-picker.tsx /** * External dependencies */ function PageArrowsWithPicker(_ref) { var pageCount = _ref.pageCount, currentPage = _ref.currentPage, setCurrentPage = _ref.setCurrentPage; var _useState = (0,react.useState)(currentPage), _useState2 = (0,slicedToArray/* default */.A)(_useState, 2), inputValue = _useState2[0], setInputValue = _useState2[1]; (0,react.useEffect)(function () { if (currentPage !== inputValue) { setInputValue(currentPage); } }, [currentPage]); function onInputChange(event) { setInputValue(parseInt(event.currentTarget.value, 10)); } function onInputBlur(event) { var newPage = parseInt(event.target.value, 10); if (newPage !== currentPage && Number.isFinite(newPage) && newPage > 0 && pageCount && pageCount >= newPage) { setCurrentPage(newPage, 'goto'); } else { setInputValue(currentPage); } } function previousPage(event) { event.stopPropagation(); if (currentPage - 1 < 1) { return; } setInputValue(currentPage - 1); setCurrentPage(currentPage - 1, 'previous'); } function nextPage(event) { event.stopPropagation(); if (currentPage + 1 > pageCount) { return; } setInputValue(currentPage + 1); setCurrentPage(currentPage + 1, 'next'); } if (pageCount <= 1) { return null; } var previousLinkClass = classnames_default()('woocommerce-pagination__link', { 'is-active': currentPage > 1 }); var nextLinkClass = classnames_default()('woocommerce-pagination__link', { 'is-active': currentPage < pageCount }); var isError = currentPage < 1 || currentPage > pageCount; var inputClass = classnames_default()('woocommerce-pagination__page-arrow-picker-input', { 'has-error': isError }); var instanceId = (0,lodash.uniqueId)('woocommerce-pagination-page-picker-'); return (0,react.createElement)("div", { className: "woocommerce-pagination__page-arrows" }, (0,react.createElement)(build_module_button/* default */.A, { className: previousLinkClass, icon: chevron_left/* default */.A, disabled: !(currentPage > 1), onClick: previousPage, label: (0,build_module.__)('Previous Page', 'woocommerce') }), (0,react.createElement)("input", { id: instanceId, className: inputClass, "aria-invalid": isError, type: "number", onChange: onInputChange, onBlur: onInputBlur, value: inputValue, min: 1, max: pageCount }), (0,build_module/* sprintf */.nv)( /* translators: %d: total number of pages */ (0,build_module.__)('of %d', 'woocommerce'), pageCount), (0,react.createElement)(build_module_button/* default */.A, { className: nextLinkClass, icon: chevron_right/* default */.A, disabled: !(currentPage < pageCount), onClick: nextPage, label: (0,build_module.__)('Next Page', 'woocommerce') })); } try { // @ts-ignore PageArrowsWithPicker.displayName = "PageArrowsWithPicker"; // @ts-ignore PageArrowsWithPicker.__docgenInfo = { "description": "", "displayName": "PageArrowsWithPicker", "props": { "currentPage": { "defaultValue": null, "description": "", "name": "currentPage", "required": true, "type": { "name": "number" } }, "pageCount": { "defaultValue": null, "description": "", "name": "pageCount", "required": true, "type": { "name": "number" } }, "setCurrentPage": { "defaultValue": null, "description": "", "name": "setCurrentPage", "required": true, "type": { "name": "(page: number, action?: \"previous\" | \"next\" | \"goto\" | undefined) => void" } } } }; // @ts-ignore if (typeof STORYBOOK_REACT_CLASSES !== "undefined") // @ts-ignore STORYBOOK_REACT_CLASSES["../../packages/js/components/src/pagination/page-arrows-with-picker.tsx#PageArrowsWithPicker"] = { docgenInfo: PageArrowsWithPicker.__docgenInfo, name: "PageArrowsWithPicker", path: "../../packages/js/components/src/pagination/page-arrows-with-picker.tsx#PageArrowsWithPicker" }; } catch (__react_docgen_typescript_loader_error) { } // EXTERNAL MODULE: ../../packages/js/components/src/pagination/page-size-picker.tsx var page_size_picker = __webpack_require__("../../packages/js/components/src/pagination/page-size-picker.tsx"); ;// CONCATENATED MODULE: ../../packages/js/components/src/pagination/stories/pagination.story.js /** * External dependencies */ /** * Internal dependencies */ /* harmony default export */ const pagination_story = ({ title: 'WooCommerce Admin/components/Pagination', component: pagination/* Pagination */.d, args: { total: 500, showPagePicker: true, showPerPagePicker: true, showPageArrowsLabel: true }, argTypes: { onPageChange: { action: 'onPageChange' }, onPerPageChange: { action: 'onPerPageChange' } } }); var Default = function Default(args) { var _useState = (0,react.useState)(2), _useState2 = (0,slicedToArray/* default */.A)(_useState, 2), statePage = _useState2[0], setPage = _useState2[1]; var _useState3 = (0,react.useState)(50), _useState4 = (0,slicedToArray/* default */.A)(_useState3, 2), statePerPage = _useState4[0], setPerPage = _useState4[1]; return (0,react.createElement)(pagination/* Pagination */.d, (0,esm_extends/* default */.A)({ page: statePage, perPage: statePerPage, onPageChange: function onPageChange(newPage) { return setPage(newPage); }, onPerPageChange: function onPerPageChange(newPerPage) { return setPerPage(newPerPage); } }, args)); }; var CustomWithHook = function CustomWithHook(args) { var paginationProps = usePagination({ totalCount: args.total, defaultPerPage: 25, onPageChange: args.onPageChange, onPerPageChange: args.onPerPageChange }); return (0,react.createElement)("div", null, (0,react.createElement)("div", null, "Viewing ", paginationProps.start, "-", paginationProps.end, " of", ' ', args.total, " items"), (0,react.createElement)(PageArrowsWithPicker, paginationProps), (0,react.createElement)(page_size_picker/* PageSizePicker */.$, (0,esm_extends/* default */.A)({}, paginationProps, { total: args.total, perPageOptions: [5, 10, 25], label: "" }))); }; Default.parameters = { ...Default.parameters, docs: { ...Default.parameters?.docs, source: { originalSource: "args => {\n const [statePage, setPage] = useState(2);\n const [statePerPage, setPerPage] = useState(50);\n return setPage(newPage)} onPerPageChange={newPerPage => setPerPage(newPerPage)} {...args} />;\n}", ...Default.parameters?.docs?.source } } }; CustomWithHook.parameters = { ...CustomWithHook.parameters, docs: { ...CustomWithHook.parameters?.docs, source: { originalSource: "args => {\n const paginationProps = usePagination({\n totalCount: args.total,\n defaultPerPage: 25,\n onPageChange: args.onPageChange,\n onPerPageChange: args.onPerPageChange\n });\n return
\n
\n Viewing {paginationProps.start}-{paginationProps.end} of{' '}\n {args.total} items\n
\n \n \n
;\n}", ...CustomWithHook.parameters?.docs?.source } } }; /***/ }) }]);