Liferay.Loader.define("@liferay/object-web@1.0.145/js/components/ObjectField/Tabs/BasicInfo/MaxLengthProperties",["module","exports","require","@frontend-taglib-clay$clayui/form","@liferay/object-js-components-web","frontend-js-web","liferay!frontend-js-react-web$react","liferay!object-web$text-mask-core","../../../../utils/createAutoCorrectedNumberPipe","../../../../utils/fieldSettings"],(function(e,t,r){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.MaxLengthProperties=function MaxLengthProperties({disabled:e,errors:t,objectField:r,objectFieldSettings:s,onSettingsChange:d,setValues:f}){const[g,b]="Text"===r.businessType?[280,"280"]:[65e3,"65,000"],p=(0,c.normalizeFieldSettings)(s),m=(0,o.useRef)(null),h=(0,o.useRef)();return(0,o.useEffect)((()=>{p.showCounter&&(h.current=(0,i.createTextMaskInputElement)({guide:!1,inputElement:m.current,keepCharPositions:!0,mask:"Text"===r.businessType?[/\d/,/\d/,/\d/]:[/\d/,/\d/,/\d/,/\d/,/\d/],pipe:(0,l.createAutoCorrectedNumberPipe)(g,1),showMask:!0}))}),[g,r.businessType,p.showCounter]),o.default.createElement(o.default.Fragment,null,o.default.createElement(a.default.Group,null,o.default.createElement(n.Toggle,{disabled:e,label:Liferay.Language.get("limit-characters"),name:"showCounter",onToggle:e=>{const t=[{name:"showCounter",value:e}];e&&t.push({name:"maxLength",value:g}),f({objectFieldSettings:t})},toggled:!!p.showCounter,tooltip:Liferay.Language.get("when-enabled-a-character-counter-will-be-shown-to-the-user")})),o.default.createElement(a.default.Group,null,p.showCounter&&o.default.createElement(n.Input,{disabled:e,error:t.maxLength,feedbackMessage:(0,u.sub)(Liferay.Language.get("set-the-maximum-number-of-characters-accepted-this-value-cant-be-less-than-x-or-greater-than-x"),"1",b),label:Liferay.Language.get("maximum-number-of-characters"),onChange:({target:{value:e}})=>d({name:"maxLength",value:e&&Number(e)}),onInput:({target:{value:e}})=>h.current.update(e),ref:m,required:!0,value:"".concat(p.maxLength)})))};var a=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(r("@frontend-taglib-clay$clayui/form")),n=r("@liferay/object-js-components-web"),u=r("frontend-js-web"),o=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache();if(t&&t.has(e))return t.get(e);var r={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var u=a?Object.getOwnPropertyDescriptor(e,n):null;u&&(u.get||u.set)?Object.defineProperty(r,n,u):r[n]=e[n]}r.default=e,t&&t.set(e,r);return r}(r("liferay!frontend-js-react-web$react")),i=r("liferay!object-web$text-mask-core"),l=r("../../../../utils/createAutoCorrectedNumberPipe"),c=r("../../../../utils/fieldSettings");function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function _getRequireWildcardCache(){return e},e}}}));
//# sourceMappingURL=MaxLengthProperties.js.map