Liferay.Loader.define("@liferay/object-web@1.0.181/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!frontend-js-dependencies-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:c,onSettingsChange:d,setValues:f}){const[g,p]="Encrypted"===r.businessType||"Text"===r.businessType?[280,"280"]:[65e3,"65,000"],b=(0,s.normalizeFieldSettings)(c),m=(0,o.useRef)(null),h=(0,o.useRef)();return(0,o.useEffect)((()=>{b.showCounter&&(h.current=(0,u.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,b.showCounter]),o.default.createElement(o.default.Fragment,null,o.default.createElement(n.default.Group,null,o.default.createElement(a.Toggle,{disabled:e,label:Liferay.Language.get("limit-characters"),name:"showCounter",onToggle:e=>{let t;t=e?(0,s.updateFieldSettings)(c,{name:"maxLength",value:g}):(0,s.removeFieldSettings)(["maxLength"],r),f({objectFieldSettings:(0,s.updateFieldSettings)(t,{name:"showCounter",value:e})})},toggled:!!b.showCounter,tooltip:Liferay.Language.get("when-enabled-a-character-counter-will-be-shown-to-the-user")}),b.showCounter&&o.default.createElement(a.Input,{className:"mt-3",disabled:e,error:t.maxLength,feedbackMessage:(0,i.sub)(Liferay.Language.get("set-the-maximum-number-of-characters-accepted-this-value-cant-be-less-than-x-or-greater-than-x"),"1",p),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(b.maxLength)})))};var n=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(r("@frontend-taglib-clay$clayui/form")),a=r("@liferay/object-js-components-web"),i=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={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(Object.prototype.hasOwnProperty.call(e,a)){var i=n?Object.getOwnPropertyDescriptor(e,a):null;i&&(i.get||i.set)?Object.defineProperty(r,a,i):r[a]=e[a]}r.default=e,t&&t.set(e,r);return r}(r("liferay!frontend-js-react-web$react")),u=r("liferay!frontend-js-dependencies-web$text-mask-core"),l=r("../../../../utils/createAutoCorrectedNumberPipe"),s=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