Liferay.Loader.define("@liferay/commerce-product-definitions-web@7.0.105/js/ProductOptionText",["module","exports","require","@frontend-taglib-clay$clayui/form","liferay!frontend-js-react-web$classnames","liferay!frontend-js-react-web$react","./Asterisk"],(function(e,t,r){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=_interopRequireWildcard(r("@frontend-taglib-clay$clayui/form")),l=_interopRequireDefault(r("liferay!frontend-js-react-web$classnames")),n=_interopRequireWildcard(r("liferay!frontend-js-react-web$react")),i=_interopRequireDefault(r("./Asterisk"));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={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in e)if(Object.prototype.hasOwnProperty.call(e,l)){var n=a?Object.getOwnPropertyDescriptor(e,l):null;n&&(n.get||n.set)?Object.defineProperty(r,l,n):r[l]=e[l]}return r.default=e,t&&t.set(e,r),r}var _default=({id:e,label:t,name:r,onChange:u,productOptionValues:d,required:o})=>{const[c,f]=(0,n.useState)(d[0].value),[s,p]=(0,n.useState)({});return n.default.createElement(a.default.Group,{className:(0,l.default)({"has-error":s.emptyField})},n.default.createElement("label",{htmlFor:e},t,n.default.createElement(i.default,{required:o})),n.default.createElement(a.ClayInput,{id:e,name:r,onBlur:({target:{value:e}})=>{o&&""===e?p({emptyField:!0}):(p({}),u(c))},onChange:({target:{value:e}})=>{f(e)},value:c}),s.emptyField&&n.default.createElement(a.default.FeedbackItem,null,n.default.createElement(a.default.FeedbackIndicator,{symbol:"exclamation-full"}),Liferay.Language.get("this-field-is-required")))};t.default=_default}}));
//# sourceMappingURL=ProductOptionText.js.map