Liferay.Loader.define("commerce-frontend-js@4.0.75/components/dropdown/Dropdown",["module","exports","require","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/drop-down","@frontend-taglib-clay$clayui/icon","frontend-js-web","liferay!frontend-js-react-web$prop-types","liferay!frontend-js-react-web$react","../../utilities/eventsDefinitions","../../utilities/index","../../utilities/modals/index","../modal/Modal"],(function(e,t,r){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=_interopRequireDefault(r("@frontend-taglib-clay$clayui/button")),a=_interopRequireDefault(r("@frontend-taglib-clay$clayui/drop-down")),i=_interopRequireDefault(r("@frontend-taglib-clay$clayui/icon")),l=r("frontend-js-web"),o=(_interopRequireDefault(r("liferay!frontend-js-react-web$prop-types")),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("../../utilities/eventsDefinitions"),d=r("../../utilities/index"),f=r("../../utilities/modals/index"),c=_interopRequireDefault(r("../modal/Modal"));function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function _getRequireWildcardCache(){return e},e}function _interopRequireDefault(e){return e&&e.__esModule?e:{default: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)}var s=function Dropdown(e){const[t,r]=(0,o.useState)(!1),[s]=(0,o.useState)("support-modal-"+(0,d.getRandomId)());if(!e.items||!e.items.length)return null;const p=(0,d.sortByKey)(e.items,"order");return o.default.createElement(a.default,{active:t,onActiveChange:r,trigger:o.default.createElement(n.default,{className:"component-action dropdown-toggle",displayType:"unstyled"},o.default.createElement(i.default,{symbol:"ellipsis-v"}))},o.default.createElement(c.default,{id:s}),o.default.createElement(a.default.ItemList,null,o.default.createElement(a.default.Group,null,p.map(((e,t)=>{const n="modal"===e.target||"submitWithConfirmation"===e.target?{onClick:t=>(t.preventDefault(),r(!1),function handleAction({data:e,label:t,target:r,url:n}){"submitWithConfirmation"===r?(0,l.openConfirmModal)({message:(null==e?void 0:e.confirmationMessage)||"",onConfirm:t=>{t&&((null==e?void 0:e.formId)?submitForm(document.getElementById(e.formId)):(0,d.liferayNavigate)(n))},title:t}):r.includes("modal")&&Liferay.fire(u.OPEN_MODAL,{closeOnSubmit:!0,id:s,size:(0,f.resolveModalSize)(r),url:n})}({data:e.data,label:e.label,target:e.target,url:e.href}))}:{"data-senna-off":!0,href:e.href};return o.default.createElement(a.default.Item,_extends({key:t},n),e.icon&&o.default.createElement("span",{className:"pr-2"},o.default.createElement(i.default,{symbol:e.icon})),e.label)})))))};t.default=s}}));
//# sourceMappingURL=Dropdown.js.map