Liferay.Loader.define("@liferay/layout-content-page-editor-web@3.0.132/page_editor/app/components/DisplayPagePreviewItemSelector",["module","exports","require","@frontend-taglib-clay$clayui/drop-down","@frontend-taglib-clay$clayui/icon","@liferay/frontend-js-react-web","liferay!frontend-js-react-web$classnames","liferay!frontend-js-react-web$prop-types","liferay!frontend-js-react-web$react","../../core/hooks/useId","../../core/openItemSelector","../config/constants/layoutTypes","../config/index","../contexts/DisplayPagePreviewItemContext","../utils/item-selector-value/itemSelectorValueToInfoItem"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.DisplayPagePreviewItemSelector=function({dark:e=!1}){const t=(0,i.useMemo)((()=>f.config.layoutType===d.LAYOUT_TYPES.display&&document.getElementById("infoItemSelectorContainer")),[]);return t?i.default.createElement(n.ReactPortal,{container:t},i.default.createElement(b,{dark:e})):null},t.DisplayPagePreviewItemSelectorContent=b;var l=g(a("@frontend-taglib-clay$clayui/drop-down")),r=m(a("@frontend-taglib-clay$clayui/icon")),n=a("@liferay/frontend-js-react-web"),o=m(a("liferay!frontend-js-react-web$classnames")),i=(m(a("liferay!frontend-js-react-web$prop-types")),g(a("liferay!frontend-js-react-web$react"))),c=a("../../core/hooks/useId"),s=a("../../core/openItemSelector"),d=a("../config/constants/layoutTypes"),f=a("../config/index"),u=a("../contexts/DisplayPagePreviewItemContext"),p=m(a("../utils/item-selector-value/itemSelectorValueToInfoItem"));function m(e){return e&&e.__esModule?e:{default:e}}function y(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return y=function(){return e},e}function g(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=y();if(t&&t.has(e))return t.get(e);var a={},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var n=l?Object.getOwnPropertyDescriptor(e,r):null;n&&(n.get||n.set)?Object.defineProperty(a,r,n):a[r]=e[r]}return a.default=e,t&&t.set(e,a),a}const e="-- ".concat(Liferay.Language.get("none")," --");function b({dark:t=!1}){const[a,n]=(0,i.useState)(!1),d=(0,u.useDisplayPagePreviewItem)(),m=(0,u.useDisplayPageRecentPreviewItemList)(),y=(0,c.useId)(),g=(0,u.useSelectDisplayPagePreviewItem)(),b=e=>{n(!1),g(e)};return i.default.createElement(l.default,{active:a,alignmentPosition:l.Align.BottomRight,"aria-labelledby":y,menuElementAttrs:{containerProps:{className:"cadmin"}},onActiveChange:n,role:"listbox",trigger:i.default.createElement("p",{className:(0,o.default)("align-items-center d-flex flex-row mb-0 page-editor__display-page-preview-item-selector-label-wrapper w-100",{"page-editor__display-page-preview-item-selector-label-wrapper-dark":t}),id:y,role:"label"},i.default.createElement("strong",{className:(0,o.default)("d-block page-editor__display-page-preview-item-selector-label",{"text-secondary":!t})},Liferay.Language.get("preview-with"),":"),i.default.createElement("button",{className:(0,o.default)("align-items-center btn btn-sm d-flex page-editor__display-page-preview-item-selector-button",t?"btn-dark":"btn-secondary"),type:"button"},i.default.createElement("span",{className:"flex-grow-1 overflow-hidden text-left text-truncate"},d?d.label:e),i.default.createElement(r.default,{className:"flex-shrink-0 text-secondary",symbol:"caret-bottom"})))},i.default.createElement(l.default.ItemList,null,i.default.createElement(l.default.Item,{"aria-selected":!d,onClick:()=>b(null),role:"option",symbolRight:d?void 0:"check"},e),m.map((e=>i.default.createElement(l.default.Item,{"aria-selected":d===e,className:"page-editor__display-page-preview-item-selector-dropdown-item",key:e.label,onClick:()=>b(e),symbolRight:d===e?"check":""},i.default.createElement("span",{className:"page-editor__display-page-preview-item-selector-dropdown-item-label"},e.label))))),i.default.createElement(l.default.Divider,null),i.default.createElement(l.default.ItemList,null,i.default.createElement(l.default.Item,{onClick:()=>(0,s.openItemSelector)({callback:e=>b({data:e,label:e.title}),eventName:"".concat(f.config.portletNamespace,"selectInfoItem"),itemSelectorURL:f.config.infoItemPreviewSelectorURL,transformValueCallback:p.default})},Liferay.Language.get("select-other-item"),"...")))}}}));
//# sourceMappingURL=DisplayPagePreviewItemSelector.js.map