Liferay.Loader.define("@liferay/commerce-product-definitions-web@7.0.110/js/ProductOptionSelect",["module","exports","require","@frontend-taglib-clay$clayui/form","liferay!frontend-js-react-web$classnames","liferay!frontend-js-react-web$react","./Asterisk","./utils"],(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")),u=r("./utils");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:d,productOptionValues:c,required:o})=>{const f=(0,u.getInitialOption)(c),[s,p]=(0,n.useState)(f),[y,m]=(0,n.useState)({});return n.default.createElement(a.default.Group,{className:(0,l.default)({"has-error":y.selectedPlaceholder})},n.default.createElement("label",{htmlFor:e},t,n.default.createElement(i.default,{required:o})),n.default.createElement(a.ClaySelect,{id:e,name:r,onBlur:({target:{selectedIndex:e}})=>{m(o&&0===e?{selectedPlaceholder:!0}:{})},onChange:e=>{const t=c.find((t=>t.value===e));p(t),d(t)}},n.default.createElement(a.ClaySelect.Option,{disabled:o,label:Liferay.Language.get("choose-an-option"),selected:!f}),c.map((({key:e,label:t,name:r,value:l})=>n.default.createElement(a.ClaySelect.Option,{key:e,label:t,name:r,selected:(null==s?void 0:s.value)===l,value:l})))),y.selectedPlaceholder&&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=ProductOptionSelect.js.map