@elementor/editor-panels 0.11.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +25 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +24 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/external/index.ts +1 -0
- package/src/components/external/panel-footer.tsx +23 -0
- package/src/sync.ts +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 0.12.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 994025a: Added "save changes" button to global classes panel.
|
|
8
|
+
|
|
9
|
+
## 0.11.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- e2d88d0: Changed aria-hidden to inert on panel hide when adding widget
|
|
14
|
+
|
|
3
15
|
## 0.11.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -30,4 +30,6 @@ declare function PanelHeaderTitle({ children, ...props }: TypographyProps): Reac
|
|
|
30
30
|
|
|
31
31
|
declare function PanelBody({ children, sx, ...props }: BoxProps): React.JSX.Element;
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
declare function PanelFooter({ children, sx, ...props }: BoxProps): React.JSX.Element;
|
|
34
|
+
|
|
35
|
+
export { Panel, PanelBody, PanelFooter, PanelHeader, PanelHeaderTitle, createPanel as __createPanel, registerPanel as __registerPanel };
|
package/dist/index.d.ts
CHANGED
|
@@ -30,4 +30,6 @@ declare function PanelHeaderTitle({ children, ...props }: TypographyProps): Reac
|
|
|
30
30
|
|
|
31
31
|
declare function PanelBody({ children, sx, ...props }: BoxProps): React.JSX.Element;
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
declare function PanelFooter({ children, sx, ...props }: BoxProps): React.JSX.Element;
|
|
34
|
+
|
|
35
|
+
export { Panel, PanelBody, PanelFooter, PanelHeader, PanelHeaderTitle, createPanel as __createPanel, registerPanel as __registerPanel };
|
package/dist/index.js
CHANGED
|
@@ -32,6 +32,7 @@ var index_exports = {};
|
|
|
32
32
|
__export(index_exports, {
|
|
33
33
|
Panel: () => Panel,
|
|
34
34
|
PanelBody: () => PanelBody,
|
|
35
|
+
PanelFooter: () => PanelFooter,
|
|
35
36
|
PanelHeader: () => PanelHeader,
|
|
36
37
|
PanelHeaderTitle: () => PanelHeaderTitle,
|
|
37
38
|
__createPanel: () => createPanel,
|
|
@@ -107,14 +108,14 @@ function sync() {
|
|
|
107
108
|
(0, import_editor_v1_adapters.__privateListenTo)((0, import_editor_v1_adapters.routeOpenEvent)(V2_PANEL), () => {
|
|
108
109
|
getV1PanelElements().forEach((el) => {
|
|
109
110
|
el.setAttribute("hidden", "hidden");
|
|
110
|
-
el.setAttribute("
|
|
111
|
+
el.setAttribute("inert", "true");
|
|
111
112
|
});
|
|
112
113
|
});
|
|
113
114
|
(0, import_editor_v1_adapters.__privateListenTo)((0, import_editor_v1_adapters.routeCloseEvent)(V2_PANEL), () => selectOpenId((0, import_store4.__getState)()) && (0, import_store4.__dispatch)(slice_default.actions.close()));
|
|
114
115
|
(0, import_editor_v1_adapters.__privateListenTo)((0, import_editor_v1_adapters.routeCloseEvent)(V2_PANEL), () => {
|
|
115
116
|
getV1PanelElements().forEach((el) => {
|
|
116
117
|
el.removeAttribute("hidden");
|
|
117
|
-
el.removeAttribute("
|
|
118
|
+
el.removeAttribute("inert");
|
|
118
119
|
});
|
|
119
120
|
});
|
|
120
121
|
(0, import_editor_v1_adapters.__privateListenTo)(
|
|
@@ -315,12 +316,34 @@ function PanelBody({ children, sx, ...props }) {
|
|
|
315
316
|
);
|
|
316
317
|
}
|
|
317
318
|
|
|
319
|
+
// src/components/external/panel-footer.tsx
|
|
320
|
+
var React7 = __toESM(require("react"));
|
|
321
|
+
var import_ui6 = require("@elementor/ui");
|
|
322
|
+
function PanelFooter({ children, sx, ...props }) {
|
|
323
|
+
return /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement(import_ui6.Divider, null), /* @__PURE__ */ React7.createElement(
|
|
324
|
+
import_ui6.Box,
|
|
325
|
+
{
|
|
326
|
+
component: "footer",
|
|
327
|
+
sx: {
|
|
328
|
+
display: "flex",
|
|
329
|
+
position: "sticky",
|
|
330
|
+
bottom: 0,
|
|
331
|
+
px: 2,
|
|
332
|
+
py: 1.5
|
|
333
|
+
},
|
|
334
|
+
...props
|
|
335
|
+
},
|
|
336
|
+
children
|
|
337
|
+
));
|
|
338
|
+
}
|
|
339
|
+
|
|
318
340
|
// src/index.ts
|
|
319
341
|
init();
|
|
320
342
|
// Annotate the CommonJS export names for ESM import in node:
|
|
321
343
|
0 && (module.exports = {
|
|
322
344
|
Panel,
|
|
323
345
|
PanelBody,
|
|
346
|
+
PanelFooter,
|
|
324
347
|
PanelHeader,
|
|
325
348
|
PanelHeaderTitle,
|
|
326
349
|
__createPanel,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/init.ts","../src/components/internal/panels.tsx","../src/hooks/use-open-panel-injection.ts","../src/location.ts","../src/store/selectors.ts","../src/store/slice.ts","../src/components/internal/portal.tsx","../src/sync.ts","../src/api.ts","../src/components/external/panel.tsx","../src/components/external/panel-header.tsx","../src/components/external/panel-header-title.tsx","../src/components/external/panel-body.tsx"],"sourcesContent":["import init from './init';\n\nexport { createPanel as __createPanel, registerPanel as __registerPanel } from './api';\n\nexport * from './components/external';\n\ninit();\n","import { injectIntoTop } from '@elementor/editor';\nimport { __registerSlice } from '@elementor/store';\n\nimport Panels from './components/internal/panels';\nimport { slice } from './store';\nimport { sync } from './sync';\n\nexport default function init() {\n\tsync();\n\n\t__registerSlice( slice );\n\n\tinjectIntoTop( { id: 'panels', component: Panels } );\n}\n","import * as React from 'react';\n\nimport useOpenPanelInjection from '../../hooks/use-open-panel-injection';\nimport Portal from './portal';\n\nexport default function Panels() {\n\tconst openPanel = useOpenPanelInjection();\n\tconst Component = openPanel?.component ?? null;\n\n\tif ( ! Component ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Portal>\n\t\t\t<Component />\n\t\t</Portal>\n\t);\n}\n","import { useMemo } from 'react';\nimport { __useSelector as useSelector } from '@elementor/store';\n\nimport { usePanelsInjections } from '../location';\nimport { selectOpenId } from '../store';\n\nexport default function useOpenPanelInjection() {\n\tconst injections = usePanelsInjections();\n\tconst openId = useSelector( selectOpenId );\n\n\treturn useMemo( () => injections.find( ( injection ) => openId === injection.id ), [ injections, openId ] );\n}\n","import { createLocation } from '@elementor/locations';\n\nexport const { inject: injectIntoPanels, useInjections: usePanelsInjections } = createLocation();\n","import { type SliceState } from '@elementor/store';\n\nimport type slice from './slice';\n\ntype State = SliceState< typeof slice >;\n\nexport const selectOpenId = ( state: State ) => state.panels.openId;\n","import { __createSlice, type PayloadAction } from '@elementor/store';\n\nconst initialState: {\n\topenId: string | null;\n} = {\n\topenId: null,\n};\n\nexport default __createSlice( {\n\tname: 'panels',\n\tinitialState,\n\treducers: {\n\t\topen( state, action: PayloadAction< string > ) {\n\t\t\tstate.openId = action.payload;\n\t\t},\n\t\tclose( state, action: PayloadAction< string | undefined > ) {\n\t\t\tif ( ! action.payload || state.openId === action.payload ) {\n\t\t\t\tstate.openId = null;\n\t\t\t}\n\t\t},\n\t},\n} );\n","import * as React from 'react';\nimport { useRef } from 'react';\nimport { Portal as BasePortal, type PortalProps } from '@elementor/ui';\n\nimport { getPortalContainer } from '../../sync';\n\ntype Props = Omit< PortalProps, 'container' >;\n\nexport default function Portal( props: Props ) {\n\tconst containerRef = useRef( getPortalContainer );\n\n\tif ( ! containerRef.current ) {\n\t\treturn null;\n\t}\n\n\treturn <BasePortal container={ containerRef.current } { ...props } />;\n}\n","import {\n\t__privateIsRouteActive as isRouteActive,\n\t__privateListenTo as listenTo,\n\t__privateOpenRoute as openRoute,\n\t__privateRegisterRoute as registerRoute,\n\t__privateUseRouteStatus as useRouteStatus,\n\trouteCloseEvent,\n\trouteOpenEvent,\n\twindowEvent,\n} from '@elementor/editor-v1-adapters';\nimport { __dispatch, __getState, __subscribe as originalSubscribe } from '@elementor/store';\n\nimport { selectOpenId, slice } from './store';\n\nconst V2_PANEL = 'panel/v2';\n\nexport function getPortalContainer() {\n\treturn document.querySelector( '#elementor-panel-inner' );\n}\n\nexport function useV1PanelStatus() {\n\t// For now supporting only panels that are not part of the kit and not in preview mode.\n\treturn useRouteStatus( V2_PANEL, {\n\t\tblockOnKitRoutes: true,\n\t\tblockOnPreviewMode: true,\n\t} );\n}\n\nexport function sync() {\n\t// Register the V2 panel route on panel init.\n\tlistenTo( windowEvent( 'elementor/panel/init' ), () => registerRoute( V2_PANEL ) );\n\n\t// On empty route open, hide V1 panel elements.\n\tlistenTo( routeOpenEvent( V2_PANEL ), () => {\n\t\tgetV1PanelElements().forEach( ( el ) => {\n\t\t\tel.setAttribute( 'hidden', 'hidden' );\n\t\t\tel.setAttribute( 'aria-hidden', 'true' );\n\t\t} );\n\t} );\n\n\t// On empty route close, close the V2 panel.\n\tlistenTo( routeCloseEvent( V2_PANEL ), () => selectOpenId( __getState() ) && __dispatch( slice.actions.close() ) );\n\n\t// On empty route close, show V1 panel elements.\n\tlistenTo( routeCloseEvent( V2_PANEL ), () => {\n\t\tgetV1PanelElements().forEach( ( el ) => {\n\t\t\tel.removeAttribute( 'hidden' );\n\t\t\tel.removeAttribute( 'aria-hidden' );\n\t\t} );\n\t} );\n\n\t// On V2 panel open, open the V2 panel route.\n\tlistenTo( windowEvent( 'elementor/panel/init' ), () =>\n\t\tsubscribe( {\n\t\t\ton: ( state ) => selectOpenId( state ),\n\t\t\twhen: ( { prev, current } ) => !! ( ! prev && current ), // is panel opened\n\t\t\tcallback: () => openRoute( V2_PANEL ),\n\t\t} )\n\t);\n\n\t// On V2 panel close, close the V2 panel route.\n\tlistenTo( windowEvent( 'elementor/panel/init' ), () =>\n\t\tsubscribe( {\n\t\t\ton: ( state ) => selectOpenId( state ),\n\t\t\twhen: ( { prev, current } ) => !! ( ! current && prev ), // is panel closed\n\t\t\tcallback: () => isRouteActive( V2_PANEL ) && openRoute( getDefaultRoute() ),\n\t\t} )\n\t);\n}\n\nfunction getV1PanelElements() {\n\tconst v1ElementsSelector = [\n\t\t'#elementor-panel-header-wrapper',\n\t\t'#elementor-panel-content-wrapper',\n\t\t'#elementor-panel-state-loading',\n\t\t'#elementor-panel-footer',\n\t].join( ', ' );\n\n\treturn document.querySelectorAll( v1ElementsSelector );\n}\n\nfunction getDefaultRoute() {\n\ttype ExtendedWindow = Window & {\n\t\telementor?: {\n\t\t\tdocuments?: {\n\t\t\t\tgetCurrent?: () => {\n\t\t\t\t\tconfig?: {\n\t\t\t\t\t\tpanel?: {\n\t\t\t\t\t\t\tdefault_route?: string;\n\t\t\t\t\t\t};\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t};\n\t\t};\n\t};\n\n\tconst defaultRoute = ( window as unknown as ExtendedWindow )?.elementor?.documents?.getCurrent?.()?.config?.panel\n\t\t?.default_route;\n\n\treturn defaultRoute || 'panel/elements/categories';\n}\n\nfunction subscribe< TVal >( {\n\ton,\n\twhen,\n\tcallback,\n}: {\n\ton: ( state: ReturnType< typeof __getState > ) => TVal;\n\twhen: ( { prev, current }: { prev: TVal; current: TVal } ) => boolean;\n\tcallback: ( { prev, current }: { prev: TVal; current: TVal } ) => void;\n} ) {\n\tlet prev: TVal;\n\n\toriginalSubscribe( () => {\n\t\tconst current = on( __getState() );\n\n\t\tif ( when( { prev, current } ) ) {\n\t\t\tcallback( { prev, current } );\n\t\t}\n\n\t\tprev = current;\n\t} );\n}\n","import { type ComponentType } from 'react';\nimport { __useDispatch as useDispatch, __useSelector as useSelector } from '@elementor/store';\n\nimport { injectIntoPanels } from './location';\nimport { selectOpenId, slice } from './store';\nimport { useV1PanelStatus } from './sync';\n\ntype PanelDeclaration = {\n\tid: string;\n\tcomponent: ComponentType;\n};\n\nexport function createPanel( { id, component }: PanelDeclaration ) {\n\tconst usePanelStatus = createUseStatus( id );\n\tconst usePanelActions = createUseActions( id, usePanelStatus );\n\n\treturn {\n\t\tpanel: {\n\t\t\tid,\n\t\t\tcomponent,\n\t\t},\n\t\tusePanelStatus,\n\t\tusePanelActions,\n\t};\n}\n\nexport function registerPanel( { id, component }: Pick< PanelDeclaration, 'id' | 'component' > ) {\n\tinjectIntoPanels( {\n\t\tid,\n\t\tcomponent,\n\t} );\n}\n\nfunction createUseStatus( id: PanelDeclaration[ 'id' ] ) {\n\treturn () => {\n\t\tconst openPanelId = useSelector( selectOpenId );\n\t\tconst v1PanelStatus = useV1PanelStatus();\n\n\t\treturn {\n\t\t\tisOpen: openPanelId === id && v1PanelStatus.isActive,\n\t\t\tisBlocked: v1PanelStatus.isBlocked,\n\t\t};\n\t};\n}\n\nfunction createUseActions( id: PanelDeclaration[ 'id' ], useStatus: ReturnType< typeof createUseStatus > ) {\n\treturn () => {\n\t\tconst dispatch = useDispatch();\n\t\tconst { isBlocked } = useStatus();\n\n\t\treturn {\n\t\t\topen: async () => {\n\t\t\t\tif ( isBlocked ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tdispatch( slice.actions.open( id ) );\n\t\t\t},\n\t\t\tclose: async () => {\n\t\t\t\tif ( isBlocked ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tdispatch( slice.actions.close( id ) );\n\t\t\t},\n\t\t};\n\t};\n}\n","import * as React from 'react';\nimport { Drawer, type DrawerProps } from '@elementor/ui';\n\nexport default function Panel( { children, sx, ...props }: DrawerProps ) {\n\treturn (\n\t\t<Drawer\n\t\t\topen={ true }\n\t\t\tvariant=\"persistent\"\n\t\t\tanchor=\"left\"\n\t\t\tPaperProps={ {\n\t\t\t\tsx: {\n\t\t\t\t\tposition: 'relative',\n\t\t\t\t\twidth: '100%',\n\t\t\t\t\tbgcolor: 'background.default',\n\t\t\t\t\tborder: 'none',\n\t\t\t\t},\n\t\t\t} }\n\t\t\tsx={ { height: '100%', ...sx } }\n\t\t\t{ ...props }\n\t\t>\n\t\t\t{ children }\n\t\t</Drawer>\n\t);\n}\n","import * as React from 'react';\nimport { Box, type BoxProps, Divider, styled } from '@elementor/ui';\n\nconst Header = styled( Box )( ( { theme } ) => ( {\n\theight: theme?.spacing( 6 ) || '48px',\n\tdisplay: 'flex',\n\talignItems: 'center',\n\tjustifyContent: 'center',\n} ) );\n\nexport default function PanelHeader( { children, ...props }: BoxProps ) {\n\treturn (\n\t\t<>\n\t\t\t<Header component=\"header\" { ...props }>\n\t\t\t\t{ children }\n\t\t\t</Header>\n\t\t\t<Divider />\n\t\t</>\n\t);\n}\n","import * as React from 'react';\nimport { styled, Typography as TypographySource, type TypographyProps } from '@elementor/ui';\n\n// This is to override Editor reset.scss that overrides eui styles\nconst Typography = styled( TypographySource )< TypographyProps >( ( { theme, variant = 'body1' } ) => {\n\tif ( variant === 'inherit' ) {\n\t\treturn {};\n\t}\n\n\treturn {\n\t\t'&.MuiTypography-root': {\n\t\t\t...theme.typography[ variant ],\n\t\t},\n\t};\n} );\n\nexport default function PanelHeaderTitle( { children, ...props }: TypographyProps ) {\n\treturn (\n\t\t<Typography component=\"h2\" variant=\"subtitle1\" { ...props }>\n\t\t\t{ children }\n\t\t</Typography>\n\t);\n}\n","import * as React from 'react';\nimport { Box, type BoxProps } from '@elementor/ui';\n\nexport default function PanelBody( { children, sx, ...props }: BoxProps ) {\n\treturn (\n\t\t<Box\n\t\t\tcomponent=\"main\"\n\t\t\tsx={ {\n\t\t\t\toverflowY: 'auto',\n\t\t\t\theight: '100%',\n\t\t\t\t...sx,\n\t\t\t} }\n\t\t\t{ ...props }\n\t\t>\n\t\t\t{ children }\n\t\t</Box>\n\t);\n}\n"],"mappings":";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A8B,EAAE,UAAU,GAAG,MAAM,GAAc;AACvE,SACC,4DACC,qCAAC,UAAO,WAAU,UAAW,GAAG,SAC7B,QACH,GACA,qCAAC,wBAAQ,CACV;AAEF;;;ACnBA,IAAAC,SAAuB;AACvB,IAAAC,aAA6E;AAG7E,IAAM,iBAAa,mBAAQ,WAAAC,UAAiB,EAAsB,CAAE,EAAE,OAAO,UAAU,QAAQ,MAAO;AACrG,MAAK,YAAY,WAAY;AAC5B,WAAO,CAAC;AAAA,EACT;AAEA,SAAO;AAAA,IACN,wBAAwB;AAAA,MACvB,GAAG,MAAM,WAAY,OAAQ;AAAA,IAC9B;AAAA,EACD;AACD,CAAE;AAEa,SAAR,iBAAmC,EAAE,UAAU,GAAG,MAAM,GAAqB;AACnF,SACC,qCAAC,cAAW,WAAU,MAAK,SAAQ,aAAc,GAAG,SACjD,QACH;AAEF;;;ACtBA,IAAAC,SAAuB;AACvB,IAAAC,aAAmC;AAEpB,SAAR,UAA4B,EAAE,UAAU,IAAI,GAAG,MAAM,GAAc;AACzE,SACC;AAAA,IAAC;AAAA;AAAA,MACA,WAAU;AAAA,MACV,IAAK;AAAA,QACJ,WAAW;AAAA,QACX,QAAQ;AAAA,QACR,GAAG;AAAA,MACJ;AAAA,MACE,GAAG;AAAA;AAAA,IAEH;AAAA,EACH;AAEF;;;AbXA,KAAK;","names":["import_store","React","import_store","useSelector","import_react","import_store","useRouteStatus","listenTo","registerRoute","openRoute","isRouteActive","originalSubscribe","BasePortal","import_store","useSelector","useDispatch","React","import_ui","React","import_ui","React","import_ui","TypographySource","React","import_ui"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/init.ts","../src/components/internal/panels.tsx","../src/hooks/use-open-panel-injection.ts","../src/location.ts","../src/store/selectors.ts","../src/store/slice.ts","../src/components/internal/portal.tsx","../src/sync.ts","../src/api.ts","../src/components/external/panel.tsx","../src/components/external/panel-header.tsx","../src/components/external/panel-header-title.tsx","../src/components/external/panel-body.tsx","../src/components/external/panel-footer.tsx"],"sourcesContent":["import init from './init';\n\nexport { createPanel as __createPanel, registerPanel as __registerPanel } from './api';\n\nexport * from './components/external';\n\ninit();\n","import { injectIntoTop } from '@elementor/editor';\nimport { __registerSlice } from '@elementor/store';\n\nimport Panels from './components/internal/panels';\nimport { slice } from './store';\nimport { sync } from './sync';\n\nexport default function init() {\n\tsync();\n\n\t__registerSlice( slice );\n\n\tinjectIntoTop( { id: 'panels', component: Panels } );\n}\n","import * as React from 'react';\n\nimport useOpenPanelInjection from '../../hooks/use-open-panel-injection';\nimport Portal from './portal';\n\nexport default function Panels() {\n\tconst openPanel = useOpenPanelInjection();\n\tconst Component = openPanel?.component ?? null;\n\n\tif ( ! Component ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Portal>\n\t\t\t<Component />\n\t\t</Portal>\n\t);\n}\n","import { useMemo } from 'react';\nimport { __useSelector as useSelector } from '@elementor/store';\n\nimport { usePanelsInjections } from '../location';\nimport { selectOpenId } from '../store';\n\nexport default function useOpenPanelInjection() {\n\tconst injections = usePanelsInjections();\n\tconst openId = useSelector( selectOpenId );\n\n\treturn useMemo( () => injections.find( ( injection ) => openId === injection.id ), [ injections, openId ] );\n}\n","import { createLocation } from '@elementor/locations';\n\nexport const { inject: injectIntoPanels, useInjections: usePanelsInjections } = createLocation();\n","import { type SliceState } from '@elementor/store';\n\nimport type slice from './slice';\n\ntype State = SliceState< typeof slice >;\n\nexport const selectOpenId = ( state: State ) => state.panels.openId;\n","import { __createSlice, type PayloadAction } from '@elementor/store';\n\nconst initialState: {\n\topenId: string | null;\n} = {\n\topenId: null,\n};\n\nexport default __createSlice( {\n\tname: 'panels',\n\tinitialState,\n\treducers: {\n\t\topen( state, action: PayloadAction< string > ) {\n\t\t\tstate.openId = action.payload;\n\t\t},\n\t\tclose( state, action: PayloadAction< string | undefined > ) {\n\t\t\tif ( ! action.payload || state.openId === action.payload ) {\n\t\t\t\tstate.openId = null;\n\t\t\t}\n\t\t},\n\t},\n} );\n","import * as React from 'react';\nimport { useRef } from 'react';\nimport { Portal as BasePortal, type PortalProps } from '@elementor/ui';\n\nimport { getPortalContainer } from '../../sync';\n\ntype Props = Omit< PortalProps, 'container' >;\n\nexport default function Portal( props: Props ) {\n\tconst containerRef = useRef( getPortalContainer );\n\n\tif ( ! containerRef.current ) {\n\t\treturn null;\n\t}\n\n\treturn <BasePortal container={ containerRef.current } { ...props } />;\n}\n","import {\n\t__privateIsRouteActive as isRouteActive,\n\t__privateListenTo as listenTo,\n\t__privateOpenRoute as openRoute,\n\t__privateRegisterRoute as registerRoute,\n\t__privateUseRouteStatus as useRouteStatus,\n\trouteCloseEvent,\n\trouteOpenEvent,\n\twindowEvent,\n} from '@elementor/editor-v1-adapters';\nimport { __dispatch, __getState, __subscribe as originalSubscribe } from '@elementor/store';\n\nimport { selectOpenId, slice } from './store';\n\nconst V2_PANEL = 'panel/v2';\n\nexport function getPortalContainer() {\n\treturn document.querySelector( '#elementor-panel-inner' );\n}\n\nexport function useV1PanelStatus() {\n\t// For now supporting only panels that are not part of the kit and not in preview mode.\n\treturn useRouteStatus( V2_PANEL, {\n\t\tblockOnKitRoutes: true,\n\t\tblockOnPreviewMode: true,\n\t} );\n}\n\nexport function sync() {\n\t// Register the V2 panel route on panel init.\n\tlistenTo( windowEvent( 'elementor/panel/init' ), () => registerRoute( V2_PANEL ) );\n\n\t// On empty route open, hide V1 panel elements.\n\tlistenTo( routeOpenEvent( V2_PANEL ), () => {\n\t\tgetV1PanelElements().forEach( ( el ) => {\n\t\t\tel.setAttribute( 'hidden', 'hidden' );\n\t\t\tel.setAttribute( 'inert', 'true' );\n\t\t} );\n\t} );\n\n\t// On empty route close, close the V2 panel.\n\tlistenTo( routeCloseEvent( V2_PANEL ), () => selectOpenId( __getState() ) && __dispatch( slice.actions.close() ) );\n\n\t// On empty route close, show V1 panel elements.\n\tlistenTo( routeCloseEvent( V2_PANEL ), () => {\n\t\tgetV1PanelElements().forEach( ( el ) => {\n\t\t\tel.removeAttribute( 'hidden' );\n\t\t\tel.removeAttribute( 'inert' );\n\t\t} );\n\t} );\n\n\t// On V2 panel open, open the V2 panel route.\n\tlistenTo( windowEvent( 'elementor/panel/init' ), () =>\n\t\tsubscribe( {\n\t\t\ton: ( state ) => selectOpenId( state ),\n\t\t\twhen: ( { prev, current } ) => !! ( ! prev && current ), // is panel opened\n\t\t\tcallback: () => openRoute( V2_PANEL ),\n\t\t} )\n\t);\n\n\t// On V2 panel close, close the V2 panel route.\n\tlistenTo( windowEvent( 'elementor/panel/init' ), () =>\n\t\tsubscribe( {\n\t\t\ton: ( state ) => selectOpenId( state ),\n\t\t\twhen: ( { prev, current } ) => !! ( ! current && prev ), // is panel closed\n\t\t\tcallback: () => isRouteActive( V2_PANEL ) && openRoute( getDefaultRoute() ),\n\t\t} )\n\t);\n}\n\nfunction getV1PanelElements() {\n\tconst v1ElementsSelector = [\n\t\t'#elementor-panel-header-wrapper',\n\t\t'#elementor-panel-content-wrapper',\n\t\t'#elementor-panel-state-loading',\n\t\t'#elementor-panel-footer',\n\t].join( ', ' );\n\n\treturn document.querySelectorAll( v1ElementsSelector );\n}\n\nfunction getDefaultRoute() {\n\ttype ExtendedWindow = Window & {\n\t\telementor?: {\n\t\t\tdocuments?: {\n\t\t\t\tgetCurrent?: () => {\n\t\t\t\t\tconfig?: {\n\t\t\t\t\t\tpanel?: {\n\t\t\t\t\t\t\tdefault_route?: string;\n\t\t\t\t\t\t};\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t};\n\t\t};\n\t};\n\n\tconst defaultRoute = ( window as unknown as ExtendedWindow )?.elementor?.documents?.getCurrent?.()?.config?.panel\n\t\t?.default_route;\n\n\treturn defaultRoute || 'panel/elements/categories';\n}\n\nfunction subscribe< TVal >( {\n\ton,\n\twhen,\n\tcallback,\n}: {\n\ton: ( state: ReturnType< typeof __getState > ) => TVal;\n\twhen: ( { prev, current }: { prev: TVal; current: TVal } ) => boolean;\n\tcallback: ( { prev, current }: { prev: TVal; current: TVal } ) => void;\n} ) {\n\tlet prev: TVal;\n\n\toriginalSubscribe( () => {\n\t\tconst current = on( __getState() );\n\n\t\tif ( when( { prev, current } ) ) {\n\t\t\tcallback( { prev, current } );\n\t\t}\n\n\t\tprev = current;\n\t} );\n}\n","import { type ComponentType } from 'react';\nimport { __useDispatch as useDispatch, __useSelector as useSelector } from '@elementor/store';\n\nimport { injectIntoPanels } from './location';\nimport { selectOpenId, slice } from './store';\nimport { useV1PanelStatus } from './sync';\n\ntype PanelDeclaration = {\n\tid: string;\n\tcomponent: ComponentType;\n};\n\nexport function createPanel( { id, component }: PanelDeclaration ) {\n\tconst usePanelStatus = createUseStatus( id );\n\tconst usePanelActions = createUseActions( id, usePanelStatus );\n\n\treturn {\n\t\tpanel: {\n\t\t\tid,\n\t\t\tcomponent,\n\t\t},\n\t\tusePanelStatus,\n\t\tusePanelActions,\n\t};\n}\n\nexport function registerPanel( { id, component }: Pick< PanelDeclaration, 'id' | 'component' > ) {\n\tinjectIntoPanels( {\n\t\tid,\n\t\tcomponent,\n\t} );\n}\n\nfunction createUseStatus( id: PanelDeclaration[ 'id' ] ) {\n\treturn () => {\n\t\tconst openPanelId = useSelector( selectOpenId );\n\t\tconst v1PanelStatus = useV1PanelStatus();\n\n\t\treturn {\n\t\t\tisOpen: openPanelId === id && v1PanelStatus.isActive,\n\t\t\tisBlocked: v1PanelStatus.isBlocked,\n\t\t};\n\t};\n}\n\nfunction createUseActions( id: PanelDeclaration[ 'id' ], useStatus: ReturnType< typeof createUseStatus > ) {\n\treturn () => {\n\t\tconst dispatch = useDispatch();\n\t\tconst { isBlocked } = useStatus();\n\n\t\treturn {\n\t\t\topen: async () => {\n\t\t\t\tif ( isBlocked ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tdispatch( slice.actions.open( id ) );\n\t\t\t},\n\t\t\tclose: async () => {\n\t\t\t\tif ( isBlocked ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tdispatch( slice.actions.close( id ) );\n\t\t\t},\n\t\t};\n\t};\n}\n","import * as React from 'react';\nimport { Drawer, type DrawerProps } from '@elementor/ui';\n\nexport default function Panel( { children, sx, ...props }: DrawerProps ) {\n\treturn (\n\t\t<Drawer\n\t\t\topen={ true }\n\t\t\tvariant=\"persistent\"\n\t\t\tanchor=\"left\"\n\t\t\tPaperProps={ {\n\t\t\t\tsx: {\n\t\t\t\t\tposition: 'relative',\n\t\t\t\t\twidth: '100%',\n\t\t\t\t\tbgcolor: 'background.default',\n\t\t\t\t\tborder: 'none',\n\t\t\t\t},\n\t\t\t} }\n\t\t\tsx={ { height: '100%', ...sx } }\n\t\t\t{ ...props }\n\t\t>\n\t\t\t{ children }\n\t\t</Drawer>\n\t);\n}\n","import * as React from 'react';\nimport { Box, type BoxProps, Divider, styled } from '@elementor/ui';\n\nconst Header = styled( Box )( ( { theme } ) => ( {\n\theight: theme?.spacing( 6 ) || '48px',\n\tdisplay: 'flex',\n\talignItems: 'center',\n\tjustifyContent: 'center',\n} ) );\n\nexport default function PanelHeader( { children, ...props }: BoxProps ) {\n\treturn (\n\t\t<>\n\t\t\t<Header component=\"header\" { ...props }>\n\t\t\t\t{ children }\n\t\t\t</Header>\n\t\t\t<Divider />\n\t\t</>\n\t);\n}\n","import * as React from 'react';\nimport { styled, Typography as TypographySource, type TypographyProps } from '@elementor/ui';\n\n// This is to override Editor reset.scss that overrides eui styles\nconst Typography = styled( TypographySource )< TypographyProps >( ( { theme, variant = 'body1' } ) => {\n\tif ( variant === 'inherit' ) {\n\t\treturn {};\n\t}\n\n\treturn {\n\t\t'&.MuiTypography-root': {\n\t\t\t...theme.typography[ variant ],\n\t\t},\n\t};\n} );\n\nexport default function PanelHeaderTitle( { children, ...props }: TypographyProps ) {\n\treturn (\n\t\t<Typography component=\"h2\" variant=\"subtitle1\" { ...props }>\n\t\t\t{ children }\n\t\t</Typography>\n\t);\n}\n","import * as React from 'react';\nimport { Box, type BoxProps } from '@elementor/ui';\n\nexport default function PanelBody( { children, sx, ...props }: BoxProps ) {\n\treturn (\n\t\t<Box\n\t\t\tcomponent=\"main\"\n\t\t\tsx={ {\n\t\t\t\toverflowY: 'auto',\n\t\t\t\theight: '100%',\n\t\t\t\t...sx,\n\t\t\t} }\n\t\t\t{ ...props }\n\t\t>\n\t\t\t{ children }\n\t\t</Box>\n\t);\n}\n","import * as React from 'react';\nimport { Box, type BoxProps, Divider } from '@elementor/ui';\n\nexport default function PanelFooter( { children, sx, ...props }: BoxProps ) {\n\treturn (\n\t\t<>\n\t\t\t<Divider />\n\t\t\t<Box\n\t\t\t\tcomponent=\"footer\"\n\t\t\t\tsx={ {\n\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\tposition: 'sticky',\n\t\t\t\t\tbottom: 0,\n\t\t\t\t\tpx: 2,\n\t\t\t\t\tpy: 1.5,\n\t\t\t\t} }\n\t\t\t\t{ ...props }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</Box>\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,oBAA8B;AAC9B,IAAAA,gBAAgC;;;ACDhC,IAAAC,SAAuB;;;ACAvB,mBAAwB;AACxB,IAAAC,gBAA6C;;;ACD7C,uBAA+B;AAExB,IAAM,EAAE,QAAQ,kBAAkB,eAAe,oBAAoB,QAAI,iCAAe;;;ACIxF,IAAM,eAAe,CAAE,UAAkB,MAAM,OAAO;;;ACN7D,mBAAkD;AAElD,IAAM,eAEF;AAAA,EACH,QAAQ;AACT;AAEA,IAAO,oBAAQ,4BAAe;AAAA,EAC7B,MAAM;AAAA,EACN;AAAA,EACA,UAAU;AAAA,IACT,KAAM,OAAO,QAAkC;AAC9C,YAAM,SAAS,OAAO;AAAA,IACvB;AAAA,IACA,MAAO,OAAO,QAA8C;AAC3D,UAAK,CAAE,OAAO,WAAW,MAAM,WAA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AR,UAA4B,EAAE,UAAU,IAAI,GAAG,MAAM,GAAc;AACzE,SACC;AAAA,IAAC;AAAA;AAAA,MACA,WAAU;AAAA,MACV,IAAK;AAAA,QACJ,WAAW;AAAA,QACX,QAAQ;AAAA,QACR,GAAG;AAAA,MACJ;AAAA,MACE,GAAG;AAAA;AAAA,IAEH;AAAA,EACH;AAEF;;;ACjBA,IAAAC,SAAuB;AACvB,IAAAC,aAA4C;AAE7B,SAAR,YAA8B,EAAE,UAAU,IAAI,GAAG,MAAM,GAAc;AAC3E,SACC,4DACC,qCAAC,wBAAQ,GACT;AAAA,IAAC;AAAA;AAAA,MACA,WAAU;AAAA,MACV,IAAK;AAAA,QACJ,SAAS;AAAA,QACT,UAAU;AAAA,QACV,QAAQ;AAAA,QACR,IAAI;AAAA,QACJ,IAAI;AAAA,MACL;AAAA,MACE,GAAG;AAAA;AAAA,IAEH;AAAA,EACH,CACD;AAEF;;;AdhBA,KAAK;","names":["import_store","React","import_store","useSelector","import_react","import_store","useRouteStatus","listenTo","registerRoute","openRoute","isRouteActive","originalSubscribe","BasePortal","import_store","useSelector","useDispatch","React","import_ui","React","import_ui","React","import_ui","TypographySource","React","import_ui","React","import_ui"]}
|
package/dist/index.mjs
CHANGED
|
@@ -75,14 +75,14 @@ function sync() {
|
|
|
75
75
|
listenTo(routeOpenEvent(V2_PANEL), () => {
|
|
76
76
|
getV1PanelElements().forEach((el) => {
|
|
77
77
|
el.setAttribute("hidden", "hidden");
|
|
78
|
-
el.setAttribute("
|
|
78
|
+
el.setAttribute("inert", "true");
|
|
79
79
|
});
|
|
80
80
|
});
|
|
81
81
|
listenTo(routeCloseEvent(V2_PANEL), () => selectOpenId(__getState()) && __dispatch(slice_default.actions.close()));
|
|
82
82
|
listenTo(routeCloseEvent(V2_PANEL), () => {
|
|
83
83
|
getV1PanelElements().forEach((el) => {
|
|
84
84
|
el.removeAttribute("hidden");
|
|
85
|
-
el.removeAttribute("
|
|
85
|
+
el.removeAttribute("inert");
|
|
86
86
|
});
|
|
87
87
|
});
|
|
88
88
|
listenTo(
|
|
@@ -283,11 +283,33 @@ function PanelBody({ children, sx, ...props }) {
|
|
|
283
283
|
);
|
|
284
284
|
}
|
|
285
285
|
|
|
286
|
+
// src/components/external/panel-footer.tsx
|
|
287
|
+
import * as React7 from "react";
|
|
288
|
+
import { Box as Box3, Divider as Divider2 } from "@elementor/ui";
|
|
289
|
+
function PanelFooter({ children, sx, ...props }) {
|
|
290
|
+
return /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement(Divider2, null), /* @__PURE__ */ React7.createElement(
|
|
291
|
+
Box3,
|
|
292
|
+
{
|
|
293
|
+
component: "footer",
|
|
294
|
+
sx: {
|
|
295
|
+
display: "flex",
|
|
296
|
+
position: "sticky",
|
|
297
|
+
bottom: 0,
|
|
298
|
+
px: 2,
|
|
299
|
+
py: 1.5
|
|
300
|
+
},
|
|
301
|
+
...props
|
|
302
|
+
},
|
|
303
|
+
children
|
|
304
|
+
));
|
|
305
|
+
}
|
|
306
|
+
|
|
286
307
|
// src/index.ts
|
|
287
308
|
init();
|
|
288
309
|
export {
|
|
289
310
|
Panel,
|
|
290
311
|
PanelBody,
|
|
312
|
+
PanelFooter,
|
|
291
313
|
PanelHeader,
|
|
292
314
|
PanelHeaderTitle,
|
|
293
315
|
createPanel as __createPanel,
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/init.ts","../src/components/internal/panels.tsx","../src/hooks/use-open-panel-injection.ts","../src/location.ts","../src/store/selectors.ts","../src/store/slice.ts","../src/components/internal/portal.tsx","../src/sync.ts","../src/api.ts","../src/components/external/panel.tsx","../src/components/external/panel-header.tsx","../src/components/external/panel-header-title.tsx","../src/components/external/panel-body.tsx","../src/index.ts"],"sourcesContent":["import { injectIntoTop } from '@elementor/editor';\nimport { __registerSlice } from '@elementor/store';\n\nimport Panels from './components/internal/panels';\nimport { slice } from './store';\nimport { sync } from './sync';\n\nexport default function init() {\n\tsync();\n\n\t__registerSlice( slice );\n\n\tinjectIntoTop( { id: 'panels', component: Panels } );\n}\n","import * as React from 'react';\n\nimport useOpenPanelInjection from '../../hooks/use-open-panel-injection';\nimport Portal from './portal';\n\nexport default function Panels() {\n\tconst openPanel = useOpenPanelInjection();\n\tconst Component = openPanel?.component ?? null;\n\n\tif ( ! Component ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Portal>\n\t\t\t<Component />\n\t\t</Portal>\n\t);\n}\n","import { useMemo } from 'react';\nimport { __useSelector as useSelector } from '@elementor/store';\n\nimport { usePanelsInjections } from '../location';\nimport { selectOpenId } from '../store';\n\nexport default function useOpenPanelInjection() {\n\tconst injections = usePanelsInjections();\n\tconst openId = useSelector( selectOpenId );\n\n\treturn useMemo( () => injections.find( ( injection ) => openId === injection.id ), [ injections, openId ] );\n}\n","import { createLocation } from '@elementor/locations';\n\nexport const { inject: injectIntoPanels, useInjections: usePanelsInjections } = createLocation();\n","import { type SliceState } from '@elementor/store';\n\nimport type slice from './slice';\n\ntype State = SliceState< typeof slice >;\n\nexport const selectOpenId = ( state: State ) => state.panels.openId;\n","import { __createSlice, type PayloadAction } from '@elementor/store';\n\nconst initialState: {\n\topenId: string | null;\n} = {\n\topenId: null,\n};\n\nexport default __createSlice( {\n\tname: 'panels',\n\tinitialState,\n\treducers: {\n\t\topen( state, action: PayloadAction< string > ) {\n\t\t\tstate.openId = action.payload;\n\t\t},\n\t\tclose( state, action: PayloadAction< string | undefined > ) {\n\t\t\tif ( ! action.payload || state.openId === action.payload ) {\n\t\t\t\tstate.openId = null;\n\t\t\t}\n\t\t},\n\t},\n} );\n","import * as React from 'react';\nimport { useRef } from 'react';\nimport { Portal as BasePortal, type PortalProps } from '@elementor/ui';\n\nimport { getPortalContainer } from '../../sync';\n\ntype Props = Omit< PortalProps, 'container' >;\n\nexport default function Portal( props: Props ) {\n\tconst containerRef = useRef( getPortalContainer );\n\n\tif ( ! containerRef.current ) {\n\t\treturn null;\n\t}\n\n\treturn <BasePortal container={ containerRef.current } { ...props } />;\n}\n","import {\n\t__privateIsRouteActive as isRouteActive,\n\t__privateListenTo as listenTo,\n\t__privateOpenRoute as openRoute,\n\t__privateRegisterRoute as registerRoute,\n\t__privateUseRouteStatus as useRouteStatus,\n\trouteCloseEvent,\n\trouteOpenEvent,\n\twindowEvent,\n} from '@elementor/editor-v1-adapters';\nimport { __dispatch, __getState, __subscribe as originalSubscribe } from '@elementor/store';\n\nimport { selectOpenId, slice } from './store';\n\nconst V2_PANEL = 'panel/v2';\n\nexport function getPortalContainer() {\n\treturn document.querySelector( '#elementor-panel-inner' );\n}\n\nexport function useV1PanelStatus() {\n\t// For now supporting only panels that are not part of the kit and not in preview mode.\n\treturn useRouteStatus( V2_PANEL, {\n\t\tblockOnKitRoutes: true,\n\t\tblockOnPreviewMode: true,\n\t} );\n}\n\nexport function sync() {\n\t// Register the V2 panel route on panel init.\n\tlistenTo( windowEvent( 'elementor/panel/init' ), () => registerRoute( V2_PANEL ) );\n\n\t// On empty route open, hide V1 panel elements.\n\tlistenTo( routeOpenEvent( V2_PANEL ), () => {\n\t\tgetV1PanelElements().forEach( ( el ) => {\n\t\t\tel.setAttribute( 'hidden', 'hidden' );\n\t\t\tel.setAttribute( 'aria-hidden', 'true' );\n\t\t} );\n\t} );\n\n\t// On empty route close, close the V2 panel.\n\tlistenTo( routeCloseEvent( V2_PANEL ), () => selectOpenId( __getState() ) && __dispatch( slice.actions.close() ) );\n\n\t// On empty route close, show V1 panel elements.\n\tlistenTo( routeCloseEvent( V2_PANEL ), () => {\n\t\tgetV1PanelElements().forEach( ( el ) => {\n\t\t\tel.removeAttribute( 'hidden' );\n\t\t\tel.removeAttribute( 'aria-hidden' );\n\t\t} );\n\t} );\n\n\t// On V2 panel open, open the V2 panel route.\n\tlistenTo( windowEvent( 'elementor/panel/init' ), () =>\n\t\tsubscribe( {\n\t\t\ton: ( state ) => selectOpenId( state ),\n\t\t\twhen: ( { prev, current } ) => !! ( ! prev && current ), // is panel opened\n\t\t\tcallback: () => openRoute( V2_PANEL ),\n\t\t} )\n\t);\n\n\t// On V2 panel close, close the V2 panel route.\n\tlistenTo( windowEvent( 'elementor/panel/init' ), () =>\n\t\tsubscribe( {\n\t\t\ton: ( state ) => selectOpenId( state ),\n\t\t\twhen: ( { prev, current } ) => !! ( ! current && prev ), // is panel closed\n\t\t\tcallback: () => isRouteActive( V2_PANEL ) && openRoute( getDefaultRoute() ),\n\t\t} )\n\t);\n}\n\nfunction getV1PanelElements() {\n\tconst v1ElementsSelector = [\n\t\t'#elementor-panel-header-wrapper',\n\t\t'#elementor-panel-content-wrapper',\n\t\t'#elementor-panel-state-loading',\n\t\t'#elementor-panel-footer',\n\t].join( ', ' );\n\n\treturn document.querySelectorAll( v1ElementsSelector );\n}\n\nfunction getDefaultRoute() {\n\ttype ExtendedWindow = Window & {\n\t\telementor?: {\n\t\t\tdocuments?: {\n\t\t\t\tgetCurrent?: () => {\n\t\t\t\t\tconfig?: {\n\t\t\t\t\t\tpanel?: {\n\t\t\t\t\t\t\tdefault_route?: string;\n\t\t\t\t\t\t};\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t};\n\t\t};\n\t};\n\n\tconst defaultRoute = ( window as unknown as ExtendedWindow )?.elementor?.documents?.getCurrent?.()?.config?.panel\n\t\t?.default_route;\n\n\treturn defaultRoute || 'panel/elements/categories';\n}\n\nfunction subscribe< TVal >( {\n\ton,\n\twhen,\n\tcallback,\n}: {\n\ton: ( state: ReturnType< typeof __getState > ) => TVal;\n\twhen: ( { prev, current }: { prev: TVal; current: TVal } ) => boolean;\n\tcallback: ( { prev, current }: { prev: TVal; current: TVal } ) => void;\n} ) {\n\tlet prev: TVal;\n\n\toriginalSubscribe( () => {\n\t\tconst current = on( __getState() );\n\n\t\tif ( when( { prev, current } ) ) {\n\t\t\tcallback( { prev, current } );\n\t\t}\n\n\t\tprev = current;\n\t} );\n}\n","import { type ComponentType } from 'react';\nimport { __useDispatch as useDispatch, __useSelector as useSelector } from '@elementor/store';\n\nimport { injectIntoPanels } from './location';\nimport { selectOpenId, slice } from './store';\nimport { useV1PanelStatus } from './sync';\n\ntype PanelDeclaration = {\n\tid: string;\n\tcomponent: ComponentType;\n};\n\nexport function createPanel( { id, component }: PanelDeclaration ) {\n\tconst usePanelStatus = createUseStatus( id );\n\tconst usePanelActions = createUseActions( id, usePanelStatus );\n\n\treturn {\n\t\tpanel: {\n\t\t\tid,\n\t\t\tcomponent,\n\t\t},\n\t\tusePanelStatus,\n\t\tusePanelActions,\n\t};\n}\n\nexport function registerPanel( { id, component }: Pick< PanelDeclaration, 'id' | 'component' > ) {\n\tinjectIntoPanels( {\n\t\tid,\n\t\tcomponent,\n\t} );\n}\n\nfunction createUseStatus( id: PanelDeclaration[ 'id' ] ) {\n\treturn () => {\n\t\tconst openPanelId = useSelector( selectOpenId );\n\t\tconst v1PanelStatus = useV1PanelStatus();\n\n\t\treturn {\n\t\t\tisOpen: openPanelId === id && v1PanelStatus.isActive,\n\t\t\tisBlocked: v1PanelStatus.isBlocked,\n\t\t};\n\t};\n}\n\nfunction createUseActions( id: PanelDeclaration[ 'id' ], useStatus: ReturnType< typeof createUseStatus > ) {\n\treturn () => {\n\t\tconst dispatch = useDispatch();\n\t\tconst { isBlocked } = useStatus();\n\n\t\treturn {\n\t\t\topen: async () => {\n\t\t\t\tif ( isBlocked ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tdispatch( slice.actions.open( id ) );\n\t\t\t},\n\t\t\tclose: async () => {\n\t\t\t\tif ( isBlocked ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tdispatch( slice.actions.close( id ) );\n\t\t\t},\n\t\t};\n\t};\n}\n","import * as React from 'react';\nimport { Drawer, type DrawerProps } from '@elementor/ui';\n\nexport default function Panel( { children, sx, ...props }: DrawerProps ) {\n\treturn (\n\t\t<Drawer\n\t\t\topen={ true }\n\t\t\tvariant=\"persistent\"\n\t\t\tanchor=\"left\"\n\t\t\tPaperProps={ {\n\t\t\t\tsx: {\n\t\t\t\t\tposition: 'relative',\n\t\t\t\t\twidth: '100%',\n\t\t\t\t\tbgcolor: 'background.default',\n\t\t\t\t\tborder: 'none',\n\t\t\t\t},\n\t\t\t} }\n\t\t\tsx={ { height: '100%', ...sx } }\n\t\t\t{ ...props }\n\t\t>\n\t\t\t{ children }\n\t\t</Drawer>\n\t);\n}\n","import * as React from 'react';\nimport { Box, type BoxProps, Divider, styled } from '@elementor/ui';\n\nconst Header = styled( Box )( ( { theme } ) => ( {\n\theight: theme?.spacing( 6 ) || '48px',\n\tdisplay: 'flex',\n\talignItems: 'center',\n\tjustifyContent: 'center',\n} ) );\n\nexport default function PanelHeader( { children, ...props }: BoxProps ) {\n\treturn (\n\t\t<>\n\t\t\t<Header component=\"header\" { ...props }>\n\t\t\t\t{ children }\n\t\t\t</Header>\n\t\t\t<Divider />\n\t\t</>\n\t);\n}\n","import * as React from 'react';\nimport { styled, Typography as TypographySource, type TypographyProps } from '@elementor/ui';\n\n// This is to override Editor reset.scss that overrides eui styles\nconst Typography = styled( TypographySource )< TypographyProps >( ( { theme, variant = 'body1' } ) => {\n\tif ( variant === 'inherit' ) {\n\t\treturn {};\n\t}\n\n\treturn {\n\t\t'&.MuiTypography-root': {\n\t\t\t...theme.typography[ variant ],\n\t\t},\n\t};\n} );\n\nexport default function PanelHeaderTitle( { children, ...props }: TypographyProps ) {\n\treturn (\n\t\t<Typography component=\"h2\" variant=\"subtitle1\" { ...props }>\n\t\t\t{ children }\n\t\t</Typography>\n\t);\n}\n","import * as React from 'react';\nimport { Box, type BoxProps } from '@elementor/ui';\n\nexport default function PanelBody( { children, sx, ...props }: BoxProps ) {\n\treturn (\n\t\t<Box\n\t\t\tcomponent=\"main\"\n\t\t\tsx={ {\n\t\t\t\toverflowY: 'auto',\n\t\t\t\theight: '100%',\n\t\t\t\t...sx,\n\t\t\t} }\n\t\t\t{ ...props }\n\t\t>\n\t\t\t{ children }\n\t\t</Box>\n\t);\n}\n","import init from './init';\n\nexport { createPanel as __createPanel, registerPanel as __registerPanel } from './api';\n\nexport * from './components/external';\n\ninit();\n"],"mappings":";AAAA,SAAS,qBAAqB;AAC9B,SAAS,uBAAuB;;;ACDhC,YAAYA,YAAW;;;ACAvB,SAAS,eAAe;AACxB,SAAS,iBAAiB,mBAAmB;;;ACD7C,SAAS,sBAAsB;AAExB,IAAM,EAAE,QAAQ,kBAAkB,eAAe,oBAAoB,IAAI,eAAe;;;ACIxF,IAAM,eAAe,CAAE,UAAkB,MAAM,OAAO;;;ACN7D,SAAS,qBAAyC;AAElD,IAAM,eAEF;AAAA,EACH,QAAQ;AACT;AAEA,IAAO,gBAAQ,cAAe;AAAA,EAC7B,MAAM;AAAA,EACN;AAAA,EACA,UAAU;AAAA,IACT,KAAM,OAAO,QAAkC;AAC9C,YAAM,SAAS,OAAO;AAAA,IACvB;AAAA,IACA,MAAO,OAAO,QAA8C;AAC3D,UAAK,CAAE,OAAO,WAAW,MAAM,WAAW,OAAO,SAAU;AAC1D,cAAM,SAAS;AAAA,MAChB;AAAA,IACD;AAAA,EACD;AACD,CAAE;;;AHfa,SAAR,wBAAyC;AAC/C,QAAM,aAAa,oBAAoB;AACvC,QAAM,SAAS,YAAa,YAAa;AAEzC,SAAO,QAAS,MAAM,WAAW,KAAM,CAAE,cAAe,WAAW,UAAU,EAAG,GAAG,CAAE,YAAY,MAAO,CAAE;AAC3G;;;AIXA,YAAY,WAAW;AACvB,SAAS,cAAc;AACvB,SAAS,UAAU,kBAAoC;;;ACFvD;AAAA,EACC,0BAA0B;AAAA,EAC1B,qBAAqB;AAAA,EACrB,sBAAsB;AAAA,EACtB,0BAA0B;AAAA,EAC1B,2BAA2B;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,YAAY,YAAY,eAAe,yBAAyB;AAIzE,IAAM,WAAW;AAEV,SAAS,qBAAqB;AACpC,SAAO,SAAS,cA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AAE,KAAK;AAAA,EAC/B,SAAS;AAAA,EACT,YAAY;AAAA,EACZ,gBAAgB;AACjB,EAAI;AAEW,SAAR,YAA8B,EAAE,UAAU,GAAG,MAAM,GAAc;AACvE,SACC,4DACC,qCAAC,UAAO,WAAU,UAAW,GAAG,SAC7B,QACH,GACA,qCAAC,aAAQ,CACV;AAEF;;;ACnBA,YAAYC,YAAW;AACvB,SAAS,UAAAC,SAAQ,cAAc,wBAA8C;AAG7E,IAAM,aAAaA,QAAQ,gBAAiB,EAAsB,CAAE,EAAE,OAAO,UAAU,QAAQ,MAAO;AACrG,MAAK,YAAY,WAAY;AAC5B,WAAO,CAAC;AAAA,EACT;AAEA,SAAO;AAAA,IACN,wBAAwB;AAAA,MACvB,GAAG,MAAM,WAAY,OAAQ;AAAA,IAC9B;AAAA,EACD;AACD,CAAE;AAEa,SAAR,iBAAmC,EAAE,UAAU,GAAG,MAAM,GAAqB;AACnF,SACC,qCAAC,cAAW,WAAU,MAAK,SAAQ,aAAc,GAAG,SACjD,QACH;AAEF;;;ACtBA,YAAYC,YAAW;AACvB,SAAS,OAAAC,YAA0B;AAEpB,SAAR,UAA4B,EAAE,UAAU,IAAI,GAAG,MAAM,GAAc;AACzE,SACC;AAAA,IAACA;AAAA,IAAA;AAAA,MACA,WAAU;AAAA,MACV,IAAK;AAAA,QACJ,WAAW;AAAA,QACX,QAAQ;AAAA,QACR,GAAG;AAAA,MACJ;AAAA,MACE,GAAG;AAAA;AAAA,IAEH;AAAA,EACH;AAEF;;;ACXA,KAAK;","names":["React","useSelector","useSelector","React","React","React","styled","React","Box"]}
|
|
1
|
+
{"version":3,"sources":["../src/init.ts","../src/components/internal/panels.tsx","../src/hooks/use-open-panel-injection.ts","../src/location.ts","../src/store/selectors.ts","../src/store/slice.ts","../src/components/internal/portal.tsx","../src/sync.ts","../src/api.ts","../src/components/external/panel.tsx","../src/components/external/panel-header.tsx","../src/components/external/panel-header-title.tsx","../src/components/external/panel-body.tsx","../src/components/external/panel-footer.tsx","../src/index.ts"],"sourcesContent":["import { injectIntoTop } from '@elementor/editor';\nimport { __registerSlice } from '@elementor/store';\n\nimport Panels from './components/internal/panels';\nimport { slice } from './store';\nimport { sync } from './sync';\n\nexport default function init() {\n\tsync();\n\n\t__registerSlice( slice );\n\n\tinjectIntoTop( { id: 'panels', component: Panels } );\n}\n","import * as React from 'react';\n\nimport useOpenPanelInjection from '../../hooks/use-open-panel-injection';\nimport Portal from './portal';\n\nexport default function Panels() {\n\tconst openPanel = useOpenPanelInjection();\n\tconst Component = openPanel?.component ?? null;\n\n\tif ( ! Component ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Portal>\n\t\t\t<Component />\n\t\t</Portal>\n\t);\n}\n","import { useMemo } from 'react';\nimport { __useSelector as useSelector } from '@elementor/store';\n\nimport { usePanelsInjections } from '../location';\nimport { selectOpenId } from '../store';\n\nexport default function useOpenPanelInjection() {\n\tconst injections = usePanelsInjections();\n\tconst openId = useSelector( selectOpenId );\n\n\treturn useMemo( () => injections.find( ( injection ) => openId === injection.id ), [ injections, openId ] );\n}\n","import { createLocation } from '@elementor/locations';\n\nexport const { inject: injectIntoPanels, useInjections: usePanelsInjections } = createLocation();\n","import { type SliceState } from '@elementor/store';\n\nimport type slice from './slice';\n\ntype State = SliceState< typeof slice >;\n\nexport const selectOpenId = ( state: State ) => state.panels.openId;\n","import { __createSlice, type PayloadAction } from '@elementor/store';\n\nconst initialState: {\n\topenId: string | null;\n} = {\n\topenId: null,\n};\n\nexport default __createSlice( {\n\tname: 'panels',\n\tinitialState,\n\treducers: {\n\t\topen( state, action: PayloadAction< string > ) {\n\t\t\tstate.openId = action.payload;\n\t\t},\n\t\tclose( state, action: PayloadAction< string | undefined > ) {\n\t\t\tif ( ! action.payload || state.openId === action.payload ) {\n\t\t\t\tstate.openId = null;\n\t\t\t}\n\t\t},\n\t},\n} );\n","import * as React from 'react';\nimport { useRef } from 'react';\nimport { Portal as BasePortal, type PortalProps } from '@elementor/ui';\n\nimport { getPortalContainer } from '../../sync';\n\ntype Props = Omit< PortalProps, 'container' >;\n\nexport default function Portal( props: Props ) {\n\tconst containerRef = useRef( getPortalContainer );\n\n\tif ( ! containerRef.current ) {\n\t\treturn null;\n\t}\n\n\treturn <BasePortal container={ containerRef.current } { ...props } />;\n}\n","import {\n\t__privateIsRouteActive as isRouteActive,\n\t__privateListenTo as listenTo,\n\t__privateOpenRoute as openRoute,\n\t__privateRegisterRoute as registerRoute,\n\t__privateUseRouteStatus as useRouteStatus,\n\trouteCloseEvent,\n\trouteOpenEvent,\n\twindowEvent,\n} from '@elementor/editor-v1-adapters';\nimport { __dispatch, __getState, __subscribe as originalSubscribe } from '@elementor/store';\n\nimport { selectOpenId, slice } from './store';\n\nconst V2_PANEL = 'panel/v2';\n\nexport function getPortalContainer() {\n\treturn document.querySelector( '#elementor-panel-inner' );\n}\n\nexport function useV1PanelStatus() {\n\t// For now supporting only panels that are not part of the kit and not in preview mode.\n\treturn useRouteStatus( V2_PANEL, {\n\t\tblockOnKitRoutes: true,\n\t\tblockOnPreviewMode: true,\n\t} );\n}\n\nexport function sync() {\n\t// Register the V2 panel route on panel init.\n\tlistenTo( windowEvent( 'elementor/panel/init' ), () => registerRoute( V2_PANEL ) );\n\n\t// On empty route open, hide V1 panel elements.\n\tlistenTo( routeOpenEvent( V2_PANEL ), () => {\n\t\tgetV1PanelElements().forEach( ( el ) => {\n\t\t\tel.setAttribute( 'hidden', 'hidden' );\n\t\t\tel.setAttribute( 'inert', 'true' );\n\t\t} );\n\t} );\n\n\t// On empty route close, close the V2 panel.\n\tlistenTo( routeCloseEvent( V2_PANEL ), () => selectOpenId( __getState() ) && __dispatch( slice.actions.close() ) );\n\n\t// On empty route close, show V1 panel elements.\n\tlistenTo( routeCloseEvent( V2_PANEL ), () => {\n\t\tgetV1PanelElements().forEach( ( el ) => {\n\t\t\tel.removeAttribute( 'hidden' );\n\t\t\tel.removeAttribute( 'inert' );\n\t\t} );\n\t} );\n\n\t// On V2 panel open, open the V2 panel route.\n\tlistenTo( windowEvent( 'elementor/panel/init' ), () =>\n\t\tsubscribe( {\n\t\t\ton: ( state ) => selectOpenId( state ),\n\t\t\twhen: ( { prev, current } ) => !! ( ! prev && current ), // is panel opened\n\t\t\tcallback: () => openRoute( V2_PANEL ),\n\t\t} )\n\t);\n\n\t// On V2 panel close, close the V2 panel route.\n\tlistenTo( windowEvent( 'elementor/panel/init' ), () =>\n\t\tsubscribe( {\n\t\t\ton: ( state ) => selectOpenId( state ),\n\t\t\twhen: ( { prev, current } ) => !! ( ! current && prev ), // is panel closed\n\t\t\tcallback: () => isRouteActive( V2_PANEL ) && openRoute( getDefaultRoute() ),\n\t\t} )\n\t);\n}\n\nfunction getV1PanelElements() {\n\tconst v1ElementsSelector = [\n\t\t'#elementor-panel-header-wrapper',\n\t\t'#elementor-panel-content-wrapper',\n\t\t'#elementor-panel-state-loading',\n\t\t'#elementor-panel-footer',\n\t].join( ', ' );\n\n\treturn document.querySelectorAll( v1ElementsSelector );\n}\n\nfunction getDefaultRoute() {\n\ttype ExtendedWindow = Window & {\n\t\telementor?: {\n\t\t\tdocuments?: {\n\t\t\t\tgetCurrent?: () => {\n\t\t\t\t\tconfig?: {\n\t\t\t\t\t\tpanel?: {\n\t\t\t\t\t\t\tdefault_route?: string;\n\t\t\t\t\t\t};\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t};\n\t\t};\n\t};\n\n\tconst defaultRoute = ( window as unknown as ExtendedWindow )?.elementor?.documents?.getCurrent?.()?.config?.panel\n\t\t?.default_route;\n\n\treturn defaultRoute || 'panel/elements/categories';\n}\n\nfunction subscribe< TVal >( {\n\ton,\n\twhen,\n\tcallback,\n}: {\n\ton: ( state: ReturnType< typeof __getState > ) => TVal;\n\twhen: ( { prev, current }: { prev: TVal; current: TVal } ) => boolean;\n\tcallback: ( { prev, current }: { prev: TVal; current: TVal } ) => void;\n} ) {\n\tlet prev: TVal;\n\n\toriginalSubscribe( () => {\n\t\tconst current = on( __getState() );\n\n\t\tif ( when( { prev, current } ) ) {\n\t\t\tcallback( { prev, current } );\n\t\t}\n\n\t\tprev = current;\n\t} );\n}\n","import { type ComponentType } from 'react';\nimport { __useDispatch as useDispatch, __useSelector as useSelector } from '@elementor/store';\n\nimport { injectIntoPanels } from './location';\nimport { selectOpenId, slice } from './store';\nimport { useV1PanelStatus } from './sync';\n\ntype PanelDeclaration = {\n\tid: string;\n\tcomponent: ComponentType;\n};\n\nexport function createPanel( { id, component }: PanelDeclaration ) {\n\tconst usePanelStatus = createUseStatus( id );\n\tconst usePanelActions = createUseActions( id, usePanelStatus );\n\n\treturn {\n\t\tpanel: {\n\t\t\tid,\n\t\t\tcomponent,\n\t\t},\n\t\tusePanelStatus,\n\t\tusePanelActions,\n\t};\n}\n\nexport function registerPanel( { id, component }: Pick< PanelDeclaration, 'id' | 'component' > ) {\n\tinjectIntoPanels( {\n\t\tid,\n\t\tcomponent,\n\t} );\n}\n\nfunction createUseStatus( id: PanelDeclaration[ 'id' ] ) {\n\treturn () => {\n\t\tconst openPanelId = useSelector( selectOpenId );\n\t\tconst v1PanelStatus = useV1PanelStatus();\n\n\t\treturn {\n\t\t\tisOpen: openPanelId === id && v1PanelStatus.isActive,\n\t\t\tisBlocked: v1PanelStatus.isBlocked,\n\t\t};\n\t};\n}\n\nfunction createUseActions( id: PanelDeclaration[ 'id' ], useStatus: ReturnType< typeof createUseStatus > ) {\n\treturn () => {\n\t\tconst dispatch = useDispatch();\n\t\tconst { isBlocked } = useStatus();\n\n\t\treturn {\n\t\t\topen: async () => {\n\t\t\t\tif ( isBlocked ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tdispatch( slice.actions.open( id ) );\n\t\t\t},\n\t\t\tclose: async () => {\n\t\t\t\tif ( isBlocked ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tdispatch( slice.actions.close( id ) );\n\t\t\t},\n\t\t};\n\t};\n}\n","import * as React from 'react';\nimport { Drawer, type DrawerProps } from '@elementor/ui';\n\nexport default function Panel( { children, sx, ...props }: DrawerProps ) {\n\treturn (\n\t\t<Drawer\n\t\t\topen={ true }\n\t\t\tvariant=\"persistent\"\n\t\t\tanchor=\"left\"\n\t\t\tPaperProps={ {\n\t\t\t\tsx: {\n\t\t\t\t\tposition: 'relative',\n\t\t\t\t\twidth: '100%',\n\t\t\t\t\tbgcolor: 'background.default',\n\t\t\t\t\tborder: 'none',\n\t\t\t\t},\n\t\t\t} }\n\t\t\tsx={ { height: '100%', ...sx } }\n\t\t\t{ ...props }\n\t\t>\n\t\t\t{ children }\n\t\t</Drawer>\n\t);\n}\n","import * as React from 'react';\nimport { Box, type BoxProps, Divider, styled } from '@elementor/ui';\n\nconst Header = styled( Box )( ( { theme } ) => ( {\n\theight: theme?.spacing( 6 ) || '48px',\n\tdisplay: 'flex',\n\talignItems: 'center',\n\tjustifyContent: 'center',\n} ) );\n\nexport default function PanelHeader( { children, ...props }: BoxProps ) {\n\treturn (\n\t\t<>\n\t\t\t<Header component=\"header\" { ...props }>\n\t\t\t\t{ children }\n\t\t\t</Header>\n\t\t\t<Divider />\n\t\t</>\n\t);\n}\n","import * as React from 'react';\nimport { styled, Typography as TypographySource, type TypographyProps } from '@elementor/ui';\n\n// This is to override Editor reset.scss that overrides eui styles\nconst Typography = styled( TypographySource )< TypographyProps >( ( { theme, variant = 'body1' } ) => {\n\tif ( variant === 'inherit' ) {\n\t\treturn {};\n\t}\n\n\treturn {\n\t\t'&.MuiTypography-root': {\n\t\t\t...theme.typography[ variant ],\n\t\t},\n\t};\n} );\n\nexport default function PanelHeaderTitle( { children, ...props }: TypographyProps ) {\n\treturn (\n\t\t<Typography component=\"h2\" variant=\"subtitle1\" { ...props }>\n\t\t\t{ children }\n\t\t</Typography>\n\t);\n}\n","import * as React from 'react';\nimport { Box, type BoxProps } from '@elementor/ui';\n\nexport default function PanelBody( { children, sx, ...props }: BoxProps ) {\n\treturn (\n\t\t<Box\n\t\t\tcomponent=\"main\"\n\t\t\tsx={ {\n\t\t\t\toverflowY: 'auto',\n\t\t\t\theight: '100%',\n\t\t\t\t...sx,\n\t\t\t} }\n\t\t\t{ ...props }\n\t\t>\n\t\t\t{ children }\n\t\t</Box>\n\t);\n}\n","import * as React from 'react';\nimport { Box, type BoxProps, Divider } from '@elementor/ui';\n\nexport default function PanelFooter( { children, sx, ...props }: BoxProps ) {\n\treturn (\n\t\t<>\n\t\t\t<Divider />\n\t\t\t<Box\n\t\t\t\tcomponent=\"footer\"\n\t\t\t\tsx={ {\n\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\tposition: 'sticky',\n\t\t\t\t\tbottom: 0,\n\t\t\t\t\tpx: 2,\n\t\t\t\t\tpy: 1.5,\n\t\t\t\t} }\n\t\t\t\t{ ...props }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</Box>\n\t\t</>\n\t);\n}\n","import init from './init';\n\nexport { createPanel as __createPanel, registerPanel as __registerPanel } from './api';\n\nexport * from './components/external';\n\ninit();\n"],"mappings":";AAAA,SAAS,qBAAqB;AAC9B,SAAS,uBAAuB;;;ACDhC,YAAYA,YAAW;;;ACAvB,SAAS,eAAe;AACxB,SAAS,iBAAiB,mBAAmB;;;ACD7C,SAAS,sBAAsB;AAExB,IAAM,EAAE,QAAQ,kBAAkB,eAAe,oBAAoB,IAAI,eAAe;;;ACIxF,IAAM,eAAe,CAAE,UAAkB,MAAM,OAAO;;;ACN7D,SAAS,qBAAyC;AAElD,IAAM,eAEF;AAAA,EACH,QAAQ;AACT;AAEA,IAAO,gBAAQ,cAAe;AAAA,EAC7B,MAAM;AAAA,EACN;AAAA,EACA,UAAU;AAAA,IACT,KAAM,OAAO,QAAkC;AAC9C,YAAM,SAAS,OAAO;AAAA,IACvB;AAAA,IACA,MAAO,OAAO,QAA8C;AAC3D,UAAK,CAAE,OAAO,WAAW,MAAM,WAAW,OAAO,SAAU;AAC1D,cAAM,SAAS;AAAA,MAChB;AAAA,IACD;AAAA,EACD;AACD,C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E,UAAU,IAAI,GAAG,MAAM,GAAc;AACzE,SACC;AAAA,IAACA;AAAA,IAAA;AAAA,MACA,WAAU;AAAA,MACV,IAAK;AAAA,QACJ,WAAW;AAAA,QACX,QAAQ;AAAA,QACR,GAAG;AAAA,MACJ;AAAA,MACE,GAAG;AAAA;AAAA,IAEH;AAAA,EACH;AAEF;;;ACjBA,YAAYC,YAAW;AACvB,SAAS,OAAAC,MAAoB,WAAAC,gBAAe;AAE7B,SAAR,YAA8B,EAAE,UAAU,IAAI,GAAG,MAAM,GAAc;AAC3E,SACC,4DACC,qCAACA,UAAA,IAAQ,GACT;AAAA,IAACD;AAAA,IAAA;AAAA,MACA,WAAU;AAAA,MACV,IAAK;AAAA,QACJ,SAAS;AAAA,QACT,UAAU;AAAA,QACV,QAAQ;AAAA,QACR,IAAI;AAAA,QACJ,IAAI;AAAA,MACL;AAAA,MACE,GAAG;AAAA;AAAA,IAEH;AAAA,EACH,CACD;AAEF;;;AChBA,KAAK;","names":["React","useSelector","useSelector","React","React","React","styled","React","Box","React","Box","Divider"]}
|
package/package.json
CHANGED
|
@@ -2,3 +2,4 @@ export { default as Panel } from './panel';
|
|
|
2
2
|
export { default as PanelHeader } from './panel-header';
|
|
3
3
|
export { default as PanelHeaderTitle } from './panel-header-title';
|
|
4
4
|
export { default as PanelBody } from './panel-body';
|
|
5
|
+
export { default as PanelFooter } from './panel-footer';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Box, type BoxProps, Divider } from '@elementor/ui';
|
|
3
|
+
|
|
4
|
+
export default function PanelFooter( { children, sx, ...props }: BoxProps ) {
|
|
5
|
+
return (
|
|
6
|
+
<>
|
|
7
|
+
<Divider />
|
|
8
|
+
<Box
|
|
9
|
+
component="footer"
|
|
10
|
+
sx={ {
|
|
11
|
+
display: 'flex',
|
|
12
|
+
position: 'sticky',
|
|
13
|
+
bottom: 0,
|
|
14
|
+
px: 2,
|
|
15
|
+
py: 1.5,
|
|
16
|
+
} }
|
|
17
|
+
{ ...props }
|
|
18
|
+
>
|
|
19
|
+
{ children }
|
|
20
|
+
</Box>
|
|
21
|
+
</>
|
|
22
|
+
);
|
|
23
|
+
}
|
package/src/sync.ts
CHANGED
|
@@ -34,7 +34,7 @@ export function sync() {
|
|
|
34
34
|
listenTo( routeOpenEvent( V2_PANEL ), () => {
|
|
35
35
|
getV1PanelElements().forEach( ( el ) => {
|
|
36
36
|
el.setAttribute( 'hidden', 'hidden' );
|
|
37
|
-
el.setAttribute( '
|
|
37
|
+
el.setAttribute( 'inert', 'true' );
|
|
38
38
|
} );
|
|
39
39
|
} );
|
|
40
40
|
|
|
@@ -45,7 +45,7 @@ export function sync() {
|
|
|
45
45
|
listenTo( routeCloseEvent( V2_PANEL ), () => {
|
|
46
46
|
getV1PanelElements().forEach( ( el ) => {
|
|
47
47
|
el.removeAttribute( 'hidden' );
|
|
48
|
-
el.removeAttribute( '
|
|
48
|
+
el.removeAttribute( 'inert' );
|
|
49
49
|
} );
|
|
50
50
|
} );
|
|
51
51
|
|