Liferay.Loader.define("@liferay/layout-content-page-editor-web@3.0.169/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","../../common/hooks/useId","../../common/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 DisplayPagePreviewItemSelector({dark:e=!1}){const t=(0,i.useMemo)((()=>u.config.layoutType===d.LAYOUT_TYPES.display&&document.getElementById("infoItemSelectorContainer")),[]);return t?i.default.createElement(n.ReactPortal,{container:t},i.default.createElement(DisplayPagePreviewItemSelectorContent,{dark:e})):null},t.DisplayPagePreviewItemSelectorContent=DisplayPagePreviewItemSelectorContent;var r=_interopRequireWildcard(a("@frontend-taglib-clay$clayui/drop-down")),l=_interopRequireDefault(a("@frontend-taglib-clay$clayui/icon")),n=a("@liferay/frontend-js-react-web"),o=_interopRequireDefault(a("liferay!frontend-js-react-web$classnames")),i=(_interopRequireDefault(a("liferay!frontend-js-react-web$prop-types")),_interopRequireWildcard(a("liferay!frontend-js-react-web$react"))),c=a("../../common/hooks/useId"),s=a("../../common/openItemSelector"),d=a("../config/constants/layoutTypes"),u=a("../config/index"),f=a("../contexts/DisplayPagePreviewItemContext"),p=_interopRequireDefault(a("../utils/item_selector_value/itemSelectorValueToInfoItem"));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 a={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in e)if(Object.prototype.hasOwnProperty.call(e,l)){var n=r?Object.getOwnPropertyDescriptor(e,l):null;n&&(n.get||n.set)?Object.defineProperty(a,l,n):a[l]=e[l]}return a.default=e,t&&t.set(e,a),a}const e="-- ".concat(Liferay.Language.get("none")," --");function DisplayPagePreviewItemSelectorContent({dark:t=!1}){const[a,n]=(0,i.useState)(!1),d=(0,f.useDisplayPagePreviewItem)(),m=(0,f.useDisplayPageRecentPreviewItemList)(),y=(0,c.useId)(),g=(0,f.useSelectDisplayPagePreviewItem)(),selectItem=e=>{n(!1),g(e)};return i.default.createElement(r.default,{active:a,alignmentPosition:r.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(l.default,{className:"flex-shrink-0 text-secondary",symbol:"caret-bottom"})))},i.default.createElement(r.default.ItemList,null,i.default.createElement(r.default.Item,{"aria-selected":!d,onClick:()=>selectItem(null),role:"option",symbolRight:d?void 0:"check"},e),m.map((e=>i.default.createElement(r.default.Item,{"aria-selected":d===e,className:"page-editor__display-page-preview-item-selector-dropdown-item",key:e.label,onClick:()=>selectItem(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(r.default.Divider,null),i.default.createElement(r.default.ItemList,null,i.default.createElement(r.default.Item,{onClick:()=>(0,s.openItemSelector)({callback:e=>selectItem({data:e,label:e.title}),eventName:"".concat(u.config.portletNamespace,"selectInfoItem"),itemSelectorURL:u.config.infoItemPreviewSelectorURL,transformValueCallback:p.default})},Liferay.Language.get("select-other-item"),"...")))}}}));
//# sourceMappingURL=DisplayPagePreviewItemSelector.js.map