Liferay.Loader.define("@liferay/layout-content-page-editor-web@3.0.132/page_editor/app/components/fragment-configuration-fields/TextField",["module","exports","require","@frontend-taglib-clay$clayui/form","liferay!frontend-js-react-web$prop-types","liferay!frontend-js-react-web$react","../../../core/hooks/useControlledState","../../../core/hooks/useId","../../../prop-types/index"],(function(e,t,r){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.TextField=function({field:e,onValueSelect:t,value:r}){const[l,u]=(0,a.useState)(""),c=(0,i.useId)(),p=(0,i.useId)(),[s,y]=(0,o.default)(r),{additionalProps:m={},component:b="input",placeholder:g="",type:O="text"}=function(e={}){if(!e.validation)return d(d({},e),{},{type:"text"});const t=e.validation,{type:r}=t,n=function(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}(t,["type"]),a=d(d({},e),{},{additionalProps:{},type:"text"});r&&"text"!==r||(a.type="text",Number.isInteger(n.minLength)&&(a.additionalProps.minLength=n.minLength),Number.isInteger(n.maxLength)&&(a.additionalProps.maxLength=n.maxLength));"pattern"===r&&(a.additionalProps={pattern:e.validation.regexp});"url"!==r&&"email"!==r||(a.type=r,Number.isInteger(n.minLength)&&(a.additionalProps.minLength=n.minLength),Number.isInteger(n.maxLength)&&(a.additionalProps.maxLength=n.maxLength));"number"===r&&(a.type=r,Number.isInteger(n.min)&&(a.additionalProps.min=n.min),Number.isInteger(n.max)&&(a.additionalProps.max=n.max));return a}(e.typeOptions);return a.default.createElement(n.default.Group,{className:l?"has-error":""},a.default.createElement("label",{htmlFor:p},e.label),a.default.createElement(n.ClayInput,f({"aria-describedby":c,component:b,id:p,onBlur:n=>{n.target.checkValidity()&&(u(""),s!==r&&t(e.name,s))},onChange:t=>{if(t.target.validity.valid)u("");else{const t=e.typeOptions&&e.typeOptions.validation&&e.typeOptions.validation.errorMessage||Liferay.Language.get("you-have-entered-invalid-data");u(t)}y(t.target.value)},onKeyDown:n=>{"Enter"===n.key&&n.target.checkValidity()&&(u(""),s!==r&&t(e.name,s))},placeholder:g,sizing:"sm",type:O,value:s||""},m)),e.description?a.default.createElement("p",{className:"m-0 mt-1 small text-secondary",id:c},e.description):null,l&&a.default.createElement(n.default.FeedbackGroup,null,a.default.createElement(n.default.FeedbackItem,null,a.default.createElement(n.default.FeedbackIndicator,{symbol:"exclamation-full"}),l)))};var n=c(r("@frontend-taglib-clay$clayui/form")),a=(l(r("liferay!frontend-js-react-web$prop-types")),c(r("liferay!frontend-js-react-web$react"))),o=l(r("../../../core/hooks/useControlledState")),i=r("../../../core/hooks/useId");r("../../../prop-types/index");function l(e){return e&&e.__esModule?e:{default:e}}function u(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return u=function(){return e},e}function c(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=u();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 o=n?Object.getOwnPropertyDescriptor(e,a):null;o&&(o.get||o.set)?Object.defineProperty(r,a,o):r[a]=e[a]}return r.default=e,t&&t.set(e,r),r}function p(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function d(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?p(Object(r),!0).forEach((function(t){s(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):p(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function f(){return(f=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}}}));
//# sourceMappingURL=TextField.js.map