Liferay.Loader.define("@liferay/layout-content-page-editor-web@3.0.179/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/layout-js-components-web","frontend-js-components-web","liferay!frontend-js-react-web$react","../../../common/components/PopoverTooltip","../../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,u.useId)(),f=(0,u.useId)(),[m,g]=(0,i.useControlledState)(r||e),[p,y]=(0,c.useState)(!1),onSelect=n=>{e.trim()!==(null==n?void 0:n.trim())?r!==n&&a(t.name,n):r&&a(t.name,"")};return c.default.createElement(c.default.Fragment,null,c.default.createElement(l.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",{htmlFor:s},Liferay.Language.get("custom-css"),c.default.createElement(d.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(o.default,{"aria-label":Liferay.Language.get("show-more"),className:"ml-2",symbol:"question-circle-full"})})),c.default.createElement(n.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")})),c.default.createElement("textarea",{className:"form-control text-3",id:s,onBlur:()=>{onSelect(m)},onChange:e=>g(e.target.value),value:m})),c.default.createElement(CustomCSSEditorModal,{customCSS:m,onClose:()=>{y(!1)},onSave:e=>{g(e),onSelect(e)},visible:p}))};var n=_interopRequireWildcard(a("@frontend-taglib-clay$clayui/button")),l=_interopRequireDefault(a("@frontend-taglib-clay$clayui/form")),o=_interopRequireDefault(a("@frontend-taglib-clay$clayui/icon")),r=_interopRequireWildcard(a("@frontend-taglib-clay$clayui/modal")),i=a("@liferay/layout-js-components-web"),u=a("frontend-js-components-web"),c=_interopRequireWildcard(a("liferay!frontend-js-react-web$react")),d=a("../../../common/components/PopoverTooltip"),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={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in e)if(Object.prototype.hasOwnProperty.call(e,l)){var o=n?Object.getOwnPropertyDescriptor(e,l):null;o&&(o.get||o.set)?Object.defineProperty(a,l,o):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[o,u]=(0,i.useControlledState)(e),{observer:d,onClose:s}=(0,r.useModal)({onClose:()=>{t()}});return l&&c.default.createElement(r.default,{containerProps:{className:"cadmin"},observer:d,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:o,mode:"css",onChange:u})),c.default.createElement(r.default.Footer,{last:c.default.createElement(n.default.Group,{spaced:!0},c.default.createElement(n.default,{displayType:"secondary",onClick:()=>{s()}},Liferay.Language.get("cancel")),c.default.createElement(n.default,{onClick:()=>{a(o),s()}},Liferay.Language.get("add")))}))}}}));
//# sourceMappingURL=CustomCSSField.js.map