Liferay.Loader.define("@liferay/layout-content-page-editor-web@3.0.132/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","../../../../../../../core/hooks/useControlledState","../../../../../../../core/hooks/useId"],(function(e,a,t){window;{Object.defineProperty(a,"__esModule",{value:!0}),a.PaginationOptions=function({displayAllPages:e,handleConfigurationChanged:a,initialNumberOfItemsPerPage:t,initialNumberOfPages:m}){const g=(0,f.useId)(),d=(0,f.useId)(),[p,b]=(0,c.default)(t),[y,h]=(0,o.useState)(null),[P,E]=(0,o.useState)(m),w=t>u.config.searchContainerPageMaxDelta;return(0,o.useEffect)((()=>{let e=null;w?e=(0,l.sub)(s.PAGINATION_ERROR_MESSAGES.maximumItemsPerPage,u.config.searchContainerPageMaxDelta):t<1&&(e=s.PAGINATION_ERROR_MESSAGES.neededItem),h(e)}),[w,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:d},Liferay.Language.get("maximum-number-of-pages-to-display")),o.default.createElement(n.ClayInput,{id:d,min:"1",onBlur:e=>{const t=Math.abs(Number(e.target.value))||1;(!P||P<0)&&E(t),t!==m&&a({numberOfPages:t})},onChange:e=>E(Number(e.target.value)),type:"number",value:P||""})),o.default.createElement(n.default.Group,{className:(0,r.default)({"has-warning":y}),small:!0},o.default.createElement("label",{htmlFor:g},Liferay.Language.get("maximum-number-of-items-per-page")),o.default.createElement(n.ClayInput,{id:g,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",w&&y?"text-warning":"text-secondary",{"font-weight-bold":w&&y})},(0,l.sub)(Liferay.Language.get("x-items-maximum"),u.config.searchContainerPageMaxDelta)),y&&o.default.createElement(i.WarningMessage,{message:y}))))};var n=d(t("@frontend-taglib-clay$clayui/form")),r=m(t("liferay!frontend-js-react-web$classnames")),l=t("frontend-js-web"),o=(m(t("liferay!frontend-js-react-web$prop-types")),d(t("liferay!frontend-js-react-web$react"))),s=t("../../../../../../../app/config/constants/paginationErrorMessages"),u=t("../../../../../../../app/config/index"),i=t("../../../../../../../common/components/WarningMessage"),c=m(t("../../../../../../../core/hooks/useControlledState")),f=t("../../../../../../../core/hooks/useId");function m(e){return e&&e.__esModule?e:{default:e}}function g(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return g=function(){return e},e}function d(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var a=g();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