Liferay.Loader.define("dynamic-data-mapping-form-field-type@6.0.147/util/localizable/LocalesDropdown",["module","exports","require","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/drop-down","@frontend-taglib-clay$clayui/icon","@frontend-taglib-clay$clayui/layout","data-engine-js-components-web","liferay!frontend-js-react-web$react","./AvailableLocaleLabel"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var l=_interopRequireDefault(a("@frontend-taglib-clay$clayui/button")),n=_interopRequireDefault(a("@frontend-taglib-clay$clayui/drop-down")),i=_interopRequireDefault(a("@frontend-taglib-clay$clayui/icon")),r=_interopRequireDefault(a("@frontend-taglib-clay$clayui/layout")),o=a("data-engine-js-components-web"),u=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 a={},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var i=l?Object.getOwnPropertyDescriptor(e,n):null;i&&(i.get||i.set)?Object.defineProperty(a,n,i):a[n]=e[n]}a.default=e,t&&t.set(e,a);return a}(a("liferay!frontend-js-react-web$react")),c=_interopRequireDefault(a("./AvailableLocaleLabel"));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}}var _default=({availableLocales:e,editingLocale:t,fieldName:a,onLanguageClicked:d})=>{const{pages:f}=(0,o.useFormState)(),s=(0,u.useRef)(null),m=(0,u.useRef)(null),[p,y]=(0,u.useState)(!1);return u.default.createElement("div",null,u.default.createElement(l.default,{"aria-expanded":"false","aria-haspopup":"true",className:"dropdown-toggle","data-testid":"triggerButton",displayType:"secondary",monospaced:!0,onClick:()=>y(!p),ref:s},u.default.createElement("span",{className:"inline-item"},u.default.createElement(i.default,{symbol:t.icon})),u.default.createElement("span",{className:"btn-section","data-testid":"triggerText"},t.icon)),u.default.createElement(n.default.Menu,{active:p,alignElementRef:s,onSetActive:y,ref:m},u.default.createElement(n.default.ItemList,null,e.map((({displayName:e,icon:t,isDefault:l,isTranslated:s,localeId:m})=>u.default.createElement(n.default.Item,{className:"custom-dropdown-item-row","data-testid":"availableLocalesDropdown".concat(m),key:m,name:a+m,onClick:e=>{if(d(m),y(!1),e.isTrusted){new o.PagesVisitor(f).mapFields((e=>{e.localizable&&a!==e.fieldName&&document.getElementsByName(e.fieldName+m)[0].click()}),!0,!0)}}},u.default.createElement(r.default.ContentRow,{containerElement:"span"},u.default.createElement(r.default.ContentCol,{containerElement:"span",expand:!0},u.default.createElement(r.default.ContentSection,{containerElement:"span"},u.default.createElement("span",{className:"inline-item inline-item-before"},u.default.createElement(i.default,{symbol:t})),e)),u.default.createElement(r.default.ContentCol,{containerElement:"span"},u.default.createElement(c.default,{isDefault:l,isSubmitLabel:"submitLabel"===a,isTranslated:s})))))))))};t.default=_default}}));
//# sourceMappingURL=LocalesDropdown.js.map