Liferay.Loader.define("@liferay/layout-content-page-editor-web@3.0.169/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","../../../common/hooks/useControlledState","../../../common/hooks/useId","../../../prop_types/index"],(function(e,t,r){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.TextField=function TextField({field:e,onValueSelect:t,value:r}){const[l,u]=(0,o.useState)(""),c=(0,i.useId)(),d=(0,i.useId)(),[p,s]=(0,a.default)(r),{additionalProps:f={},component:y="input",placeholder:m="",type:b="text"}=function parseTypeOptions(e={}){if(!e.validation)return _objectSpread(_objectSpread({},e),{},{type:"text"});const t=e.validation,{type:r}=t,n=function _objectWithoutProperties(e,t){if(null==e)return{};var r,n,o=function _objectWithoutPropertiesLoose(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(t,["type"]),o=_objectSpread(_objectSpread({},e),{},{additionalProps:{},type:"text"});r&&"text"!==r||(o.type="text",Number.isInteger(n.minLength)&&(o.additionalProps.minLength=n.minLength),Number.isInteger(n.maxLength)&&(o.additionalProps.maxLength=n.maxLength));"pattern"===r&&(o.additionalProps={pattern:e.validation.regexp});"url"!==r&&"email"!==r||(o.type=r,Number.isInteger(n.minLength)&&(o.additionalProps.minLength=n.minLength),Number.isInteger(n.maxLength)&&(o.additionalProps.maxLength=n.maxLength));"number"===r&&(o.type=r,Number.isInteger(n.min)&&(o.additionalProps.min=n.min),Number.isInteger(n.max)&&(o.additionalProps.max=n.max));return o}(e.typeOptions);return o.default.createElement(n.default.Group,{className:l?"has-error":""},o.default.createElement("label",{htmlFor:d},e.label),o.default.createElement(n.ClayInput,_extends({"aria-describedby":e.description?c:null,component:y,id:d,onBlur:n=>{n.target.checkValidity()&&(u(""),p!==r&&t(e.name,p))},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)}s(t.target.value)},onKeyDown:n=>{"Enter"===n.key&&n.target.checkValidity()&&(u(""),p!==r&&t(e.name,p))},placeholder:m,sizing:"sm",type:b,value:p||""},f)),e.description?o.default.createElement("p",{className:"m-0 mt-1 small text-secondary",id:c},e.description):null,l&&o.default.createElement(n.default.FeedbackGroup,null,o.default.createElement(n.default.FeedbackItem,null,o.default.createElement(n.default.FeedbackIndicator,{symbol:"exclamation-full"}),l)))};var n=_interopRequireWildcard(r("@frontend-taglib-clay$clayui/form")),o=(_interopRequireDefault(r("liferay!frontend-js-react-web$prop-types")),_interopRequireWildcard(r("liferay!frontend-js-react-web$react"))),a=_interopRequireDefault(r("../../../common/hooks/useControlledState")),i=r("../../../common/hooks/useId");r("../../../prop_types/index");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 t=_getRequireWildcardCache();if(t&&t.has(e))return t.get(e);var r={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)){var a=n?Object.getOwnPropertyDescriptor(e,o):null;a&&(a.get||a.set)?Object.defineProperty(r,o,a):r[o]=e[o]}return r.default=e,t&&t.set(e,r),r}function ownKeys(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 _objectSpread(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach((function(t){_defineProperty(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _defineProperty(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _extends(){return(_extends=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