Liferay.Loader.define("@liferay/layout-content-page-editor-web@3.0.169/page_editor/plugins/browser/components/page_structure/components/item_configuration_panels/collection_general_panel/PaginationOptions",["module","exports","require","@frontend-taglib-clay$clayui/form","liferay!frontend-js-react-web$classnames","frontend-js-web","liferay!frontend-js-react-web$prop-types","liferay!frontend-js-react-web$react","../../../../../../../app/config/constants/paginationErrorMessages","../../../../../../../app/config/index","../../../../../../../common/components/WarningMessage","../../../../../../../common/hooks/useControlledState","../../../../../../../common/hooks/useId"],(function(e,a,t){window;{Object.defineProperty(a,"__esModule",{value:!0}),a.PaginationOptions=function PaginationOptions({displayAllPages:e,handleConfigurationChanged:a,initialNumberOfItemsPerPage:t,initialNumberOfPages:d}){const m=(0,f.useId)(),g=(0,f.useId)(),[p,b]=(0,c.default)(t),[y,h]=(0,o.useState)(null),[_,P]=(0,o.useState)(d),E=t>u.config.searchContainerPageMaxDelta;return(0,o.useEffect)((()=>{let e=null;E?e=(0,l.sub)(i.PAGINATION_ERROR_MESSAGES.maximumItemsPerPage,u.config.searchContainerPageMaxDelta):t<1&&(e=i.PAGINATION_ERROR_MESSAGES.neededItem),h(e)}),[E,t]),o.default.createElement(o.default.Fragment,null,o.default.createElement("div",{className:"mb-2 pt-1"},o.default.createElement(n.ClayCheckbox,{checked:e,label:Liferay.Language.get("display-all-pages"),onChange:e=>a({displayAllPages:e.target.checked})})),!e&&o.default.createElement(n.default.Group,{small:!0},o.default.createElement("label",{htmlFor:g},Liferay.Language.get("maximum-number-of-pages-to-display")),o.default.createElement(n.ClayInput,{id:g,min:"1",onBlur:e=>{const t=Math.abs(Number(e.target.value))||1;(!_||_<0)&&P(t),t!==d&&a({numberOfPages:t})},onChange:e=>P(Number(e.target.value)),type:"number",value:_||""})),o.default.createElement(n.default.Group,{className:(0,r.default)({"has-warning":y}),small:!0},o.default.createElement("label",{htmlFor:m},Liferay.Language.get("maximum-number-of-items-per-page")),o.default.createElement(n.ClayInput,{id:m,min:"1",onBlur:e=>{const n=Math.abs(Number(e.target.value))||1;(!p||p<0)&&b(n),n!==t&&a({numberOfItemsPerPage:n})},onChange:e=>b(Number(e.target.value)),type:"number",value:p||""}),o.default.createElement("div",{className:"mb-2 mt-1"},o.default.createElement("span",{className:(0,r.default)("mr-1 small",E&&y?"text-warning":"text-secondary",{"font-weight-bold":E&&y})},(0,l.sub)(Liferay.Language.get("x-items-maximum"),u.config.searchContainerPageMaxDelta)),y&&o.default.createElement(s.WarningMessage,{message:y}))))};var n=_interopRequireWildcard(t("@frontend-taglib-clay$clayui/form")),r=_interopRequireDefault(t("liferay!frontend-js-react-web$classnames")),l=t("frontend-js-web"),o=(_interopRequireDefault(t("liferay!frontend-js-react-web$prop-types")),_interopRequireWildcard(t("liferay!frontend-js-react-web$react"))),i=t("../../../../../../../app/config/constants/paginationErrorMessages"),u=t("../../../../../../../app/config/index"),s=t("../../../../../../../common/components/WarningMessage"),c=_interopRequireDefault(t("../../../../../../../common/hooks/useControlledState")),f=t("../../../../../../../common/hooks/useId");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function _getRequireWildcardCache(){return e},e}function _interopRequireWildcard(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var a=_getRequireWildcardCache();if(a&&a.has(e))return a.get(e);var t={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var l=n?Object.getOwnPropertyDescriptor(e,r):null;l&&(l.get||l.set)?Object.defineProperty(t,r,l):t[r]=e[r]}return t.default=e,a&&a.set(e,t),t}}}));
//# sourceMappingURL=PaginationOptions.js.map