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