Liferay.Loader.define("@liferay/layout-content-page-editor-web@3.0.156/page_editor/app/components/fragment_configuration_fields/CustomCSSField",["module","exports","require","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/form","@frontend-taglib-clay$clayui/icon","@frontend-taglib-clay$clayui/modal","liferay!frontend-js-react-web$react","../../../common/components/PopoverTooltip","../../../common/hooks/useControlledState","../../../common/hooks/useId","../../config/constants/fragmentClassPlaceholder","../CodeMirrorEditor"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function CustomCSSField({field:t,onValueSelect:a,value:r}){const s=(0,d.useId)(),f=(0,d.useId)(),[m,g]=(0,c.default)(r||e),[p,y]=(0,i.useState)(!1),onSelect=o=>{e.trim()!==(null==o?void 0:o.trim())?r!==o&&a(t.name,o):r&&a(t.name,"")};return i.default.createElement(i.default.Fragment,null,i.default.createElement(l.default.Group,{className:"page-editor__custom-css-field",small:!0},i.default.createElement("div",{className:"align-items-end d-flex justify-content-between"},i.default.createElement("label",{htmlFor:s},Liferay.Language.get("custom-css"),i.default.createElement(u.PopoverTooltip,{content:Liferay.Language.get("you-can-add-your-own-css-and-include-variables-to-use-existing-tokens"),header:Liferay.Language.get("custom-css"),id:f,trigger:i.default.createElement(n.default,{"aria-label":Liferay.Language.get("show-more"),className:"ml-2",symbol:"question-circle-full"})})),i.default.createElement(o.ClayButtonWithIcon,{"aria-label":Liferay.Language.get("expand"),className:"mb-2 p-0 page-editor__custom-css-field__expand-button text-secondary",displayType:"unstyled",monospaced:!0,onClick:()=>y(!0),size:"sm",symbol:"expand",title:Liferay.Language.get("expand")})),i.default.createElement("textarea",{className:"form-control text-3",id:s,onBlur:()=>{onSelect(m)},onChange:e=>g(e.target.value),value:m})),i.default.createElement(CustomCSSEditorModal,{customCSS:m,onClose:()=>{y(!1)},onSave:e=>{g(e),onSelect(e)},visible:p}))};var o=_interopRequireWildcard(a("@frontend-taglib-clay$clayui/button")),l=_interopRequireDefault(a("@frontend-taglib-clay$clayui/form")),n=_interopRequireDefault(a("@frontend-taglib-clay$clayui/icon")),r=_interopRequireWildcard(a("@frontend-taglib-clay$clayui/modal")),i=_interopRequireWildcard(a("liferay!frontend-js-react-web$react")),u=a("../../../common/components/PopoverTooltip"),c=_interopRequireDefault(a("../../../common/hooks/useControlledState")),d=a("../../../common/hooks/useId"),s=a("../../config/constants/fragmentClassPlaceholder"),f=_interopRequireDefault(a("../CodeMirrorEditor"));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={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in e)if(Object.prototype.hasOwnProperty.call(e,l)){var n=o?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(s.FRAGMENT_CLASS_PLACEHOLDER," {\n\n}");function CustomCSSEditorModal({customCSS:e,onClose:t,onSave:a,visible:l}){const[n,u]=(0,c.default)(e),{observer:d,onClose:s}=(0,r.useModal)({onClose:()=>{t()}});return l&&i.default.createElement(r.default,{containerProps:{className:"cadmin"},observer:d,size:"full-screen"},i.default.createElement(r.default.Header,null,Liferay.Language.get("custom-css")),i.default.createElement(r.default.Body,null,i.default.createElement(f.default,{className:"page-editor__custom-css-field__editor-modal",initialContent:n,mode:"css",onChange:u})),i.default.createElement(r.default.Footer,{last:i.default.createElement(o.default.Group,{spaced:!0},i.default.createElement(o.default,{displayType:"secondary",onClick:()=>{s()}},Liferay.Language.get("cancel")),i.default.createElement(o.default,{onClick:()=>{a(n),s()}},Liferay.Language.get("add")))}))}}}));
//# sourceMappingURL=CustomCSSField.js.map