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