@elementor/editor-notifications 4.3.0-999 → 4.4.0-1065
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/dist/index.js +13 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/components/notifications.tsx +7 -0
- package/src/sync/get-app-bar-height.ts +5 -0
package/dist/index.js
CHANGED
|
@@ -111,6 +111,12 @@ var useEnqueueNotification = (notifications) => {
|
|
|
111
111
|
}, [notifications, enqueueSnackbar, dispatch]);
|
|
112
112
|
};
|
|
113
113
|
|
|
114
|
+
// src/sync/get-app-bar-height.ts
|
|
115
|
+
var EDITOR_APP_BAR_WRAPPER_ID = "elementor-editor-wrapper-v2";
|
|
116
|
+
function getAppBarHeight() {
|
|
117
|
+
return document.getElementById(EDITOR_APP_BAR_WRAPPER_ID)?.getBoundingClientRect().height ?? 0;
|
|
118
|
+
}
|
|
119
|
+
|
|
114
120
|
// src/sync/get-editing-panel-width.ts
|
|
115
121
|
function getEditingPanelWidth() {
|
|
116
122
|
return document.querySelector(".elementor-panel")?.clientWidth || 0;
|
|
@@ -121,6 +127,7 @@ var AUTO_HIDE_DURATION2 = 8e3;
|
|
|
121
127
|
var DefaultCustomSnackbar = (0, import_react2.forwardRef)((props, ref) => {
|
|
122
128
|
const filteredProps = getFilteredSnackbarProps(props);
|
|
123
129
|
const panelWidth = getEditingPanelWidth();
|
|
130
|
+
const appBarHeight = getAppBarHeight();
|
|
124
131
|
return /* @__PURE__ */ React2.createElement(import_ui2.ThemeProvider, { palette: "unstable" }, /* @__PURE__ */ React2.createElement(
|
|
125
132
|
import_ui2.SnackbarContent,
|
|
126
133
|
{
|
|
@@ -128,13 +135,15 @@ var DefaultCustomSnackbar = (0, import_react2.forwardRef)((props, ref) => {
|
|
|
128
135
|
...filteredProps,
|
|
129
136
|
sx: {
|
|
130
137
|
"&.MuiPaper-root": { minWidth: "max-content" },
|
|
131
|
-
ml: panelWidth + "px"
|
|
138
|
+
ml: panelWidth + "px",
|
|
139
|
+
mt: `-${appBarHeight}px`
|
|
132
140
|
}
|
|
133
141
|
}
|
|
134
142
|
));
|
|
135
143
|
});
|
|
136
144
|
var AlertSnackbar = (0, import_react2.forwardRef)(({ color, icon, ...props }, ref) => {
|
|
137
145
|
const panelWidth = getEditingPanelWidth();
|
|
146
|
+
const appBarHeight = getAppBarHeight();
|
|
138
147
|
return /* @__PURE__ */ React2.createElement(import_ui2.ThemeProvider, { colorScheme: "light", palette: "unstable" }, /* @__PURE__ */ React2.createElement(
|
|
139
148
|
import_ui2.Alert,
|
|
140
149
|
{
|
|
@@ -147,6 +156,7 @@ var AlertSnackbar = (0, import_react2.forwardRef)(({ color, icon, ...props }, re
|
|
|
147
156
|
onClose: () => (0, import_notistack2.closeSnackbar)(props.id),
|
|
148
157
|
sx: {
|
|
149
158
|
ml: panelWidth + "px",
|
|
159
|
+
mt: `-${appBarHeight}px`,
|
|
150
160
|
"& .MuiAlert-message": { display: "flex", flexWrap: "nowrap", alignItems: "center" },
|
|
151
161
|
"& .MuiAlert-content": { whiteSpace: "nowrap" }
|
|
152
162
|
}
|
|
@@ -178,7 +188,8 @@ var Wrapper = () => {
|
|
|
178
188
|
autoHideDuration: AUTO_HIDE_DURATION2,
|
|
179
189
|
disableWindowBlurListener: true,
|
|
180
190
|
anchorOrigin: { horizontal: "center", vertical: "bottom" },
|
|
181
|
-
Components: muiToEuiMapper
|
|
191
|
+
Components: muiToEuiMapper,
|
|
192
|
+
domRoot: document.body
|
|
182
193
|
},
|
|
183
194
|
/* @__PURE__ */ React2.createElement(Handler, null)
|
|
184
195
|
);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/init.ts","../src/components/notifications.tsx","../src/hooks/use-enqueue-notifications.tsx","../src/slice.ts","../src/sync/get-editing-panel-width.ts"],"sourcesContent":["export { init } from './init';\n\nexport { type NotificationData } from './types';\nexport { dismissNotification, NotifyReact, notify } from './components/notifications';\n","import { injectIntoTop } from '@elementor/editor';\nimport { __registerSlice as registerSlice } from '@elementor/store';\n\nimport Wrapper from './components/notifications';\nimport { notificationsSlice } from './slice';\n\nexport function init() {\n\tregisterSlice( notificationsSlice );\n\tinjectIntoTop( {\n\t\tid: 'notifications',\n\t\tcomponent: Wrapper,\n\t} );\n}\n","import * as React from 'react';\nimport { forwardRef } from 'react';\nimport { closeSnackbar, type CustomContentProps, SnackbarProvider } from 'notistack';\nimport { AlertCircleFilled, CircleCheckFilledIcon, CrownFilledIcon, InfoCircleFilledIcon } from '@elementor/icons';\nimport { __getStore as getStore, __useDispatch as useDispatch, __useSelector as useSelector } from '@elementor/store';\nimport { Alert, SnackbarContent, type SnackbarProps, ThemeProvider } from '@elementor/ui';\n\nimport { useEnqueueNotification } from '../hooks/use-enqueue-notifications';\nimport { clearAction, notifyAction } from '../slice';\nimport { getEditingPanelWidth } from '../sync/get-editing-panel-width';\nimport { type NotificationData, type Notifications } from '../types';\n\n// 8 seconds\nconst AUTO_HIDE_DURATION = 8000;\n\nconst DefaultCustomSnackbar = forwardRef( ( props: SnackbarProps, ref ) => {\n\tconst filteredProps = getFilteredSnackbarProps( props );\n\tconst panelWidth = getEditingPanelWidth();\n\n\treturn (\n\t\t<ThemeProvider palette=\"unstable\">\n\t\t\t<SnackbarContent\n\t\t\t\tref={ ref }\n\t\t\t\t{ ...filteredProps }\n\t\t\t\tsx={ {\n\t\t\t\t\t'&.MuiPaper-root': { minWidth: 'max-content' },\n\t\t\t\t\tml: panelWidth + 'px',\n\t\t\t\t} }\n\t\t\t/>\n\t\t</ThemeProvider>\n\t);\n} );\n\ninterface AlertSnackbarProps extends CustomContentProps {\n\tcolor: 'promotion' | 'info' | 'success' | 'error';\n\ticon: React.ReactElement;\n}\n\nconst AlertSnackbar = forwardRef< HTMLDivElement, AlertSnackbarProps >( ( { color, icon, ...props }, ref ) => {\n\tconst panelWidth = getEditingPanelWidth();\n\n\treturn (\n\t\t<ThemeProvider colorScheme=\"light\" palette=\"unstable\">\n\t\t\t<Alert\n\t\t\t\tref={ ref }\n\t\t\t\tvariant=\"standard\"\n\t\t\t\tcolor={ color }\n\t\t\t\ticon={ icon }\n\t\t\t\trole=\"alert\"\n\t\t\t\taction={ props.action }\n\t\t\t\tonClose={ () => closeSnackbar( props.id ) }\n\t\t\t\tsx={ {\n\t\t\t\t\tml: panelWidth + 'px',\n\t\t\t\t\t'& .MuiAlert-message': { display: 'flex', flexWrap: 'nowrap', alignItems: 'center' },\n\t\t\t\t\t'& .MuiAlert-content': { whiteSpace: 'nowrap' },\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ props.message }\n\t\t\t</Alert>\n\t\t</ThemeProvider>\n\t);\n} );\n\nconst PromotionSnackbar = forwardRef< HTMLDivElement, CustomContentProps >( ( props, ref ) => (\n\t<AlertSnackbar ref={ ref } color=\"promotion\" icon={ <CrownFilledIcon /> } { ...props } />\n) );\n\nconst InfoSnackbar = forwardRef< HTMLDivElement, CustomContentProps >( ( props, ref ) => (\n\t<AlertSnackbar ref={ ref } color=\"info\" icon={ <InfoCircleFilledIcon /> } { ...props } />\n) );\n\nconst SuccessSnackbar = forwardRef< HTMLDivElement, CustomContentProps >( ( props, ref ) => (\n\t<AlertSnackbar ref={ ref } color=\"success\" icon={ <CircleCheckFilledIcon /> } { ...props } />\n) );\n\nconst ErrorSnackbar = forwardRef< HTMLDivElement, CustomContentProps >( ( props, ref ) => (\n\t<AlertSnackbar ref={ ref } color=\"error\" icon={ <AlertCircleFilled /> } { ...props } />\n) );\n\nconst muiToEuiMapper = {\n\tdefault: DefaultCustomSnackbar,\n\tpromotion: PromotionSnackbar,\n\tinfo: InfoSnackbar,\n\tsuccess: SuccessSnackbar,\n\terror: ErrorSnackbar,\n};\n\nconst Handler = () => {\n\tconst notifications = useSelector( ( state: { notifications: Notifications } ) => state.notifications );\n\n\tuseEnqueueNotification( notifications );\n\n\treturn null;\n};\n\nconst Wrapper = () => {\n\treturn (\n\t\t<SnackbarProvider\n\t\t\tmaxSnack={ 3 }\n\t\t\tautoHideDuration={ AUTO_HIDE_DURATION }\n\t\t\tdisableWindowBlurListener\n\t\t\tanchorOrigin={ { horizontal: 'center', vertical: 'bottom' } }\n\t\t\tComponents={ muiToEuiMapper }\n\t\t>\n\t\t\t<Handler />\n\t\t</SnackbarProvider>\n\t);\n};\n\n/*\n * This function can be used to trigger notifications from anywhere in the code.\n * even if you're running in a JS environment as opposed to a React environment.\n */\nexport function notify( notification: NotificationData ) {\n\tconst store = getStore();\n\n\tstore?.dispatch( notifyAction( notification ) );\n}\n\nexport function dismissNotification( id: NotificationData[ 'id' ] ) {\n\tconst store = getStore();\n\n\tcloseSnackbar( id );\n\tstore?.dispatch( clearAction( { id } ) );\n}\n\n/*\n * This function can be used to trigger notifications from within a React component.\n * This is the preferred way to trigger notifications.\n */\nexport function NotifyReact( notification: NotificationData ) {\n\tconst dispatch = useDispatch();\n\tdispatch( notifyAction( notification ) );\n}\n\nfunction getFilteredSnackbarProps( props: SnackbarProps ) {\n\tconst forbiddenProps = [ 'autoHideDuration', 'persist', 'hideIconVariant', 'iconVariant', 'anchorOrigin' ];\n\n\treturn Object.entries( props ).reduce(\n\t\t( filteredProps, [ key, value ] ) => {\n\t\t\tif ( ! forbiddenProps.includes( key ) ) {\n\t\t\t\tfilteredProps[ key ] = value;\n\t\t\t}\n\n\t\t\treturn filteredProps;\n\t\t},\n\t\t{} as Record< string, unknown >\n\t);\n}\n\nexport default Wrapper;\n","import { Fragment, useEffect } from 'react';\nimport * as React from 'react';\nimport { closeSnackbar, useSnackbar, type VariantType } from 'notistack';\nimport { __useDispatch as useDispatch } from '@elementor/store';\nimport { Button, CloseButton } from '@elementor/ui';\n\nimport { clearAction } from '../slice';\nimport type { NotificationData, Notifications } from '../types';\n\nconst AUTO_HIDE_DURATION = 8000;\n\nfunction createDefaultAction( notification: NotificationData, onDismiss: () => void ) {\n\treturn (\n\t\t<Fragment key={ notification.id }>\n\t\t\t{ notification.additionalActionProps?.map( ( additionalAction, index ) => (\n\t\t\t\t<Button key={ `${ index }` } { ...additionalAction } />\n\t\t\t) ) }\n\n\t\t\t<CloseButton aria-label=\"close\" color=\"inherit\" onClick={ onDismiss } />\n\t\t</Fragment>\n\t);\n}\n\nfunction createPromotionAction( notification: NotificationData ) {\n\treturn (\n\t\t<Fragment key={ notification.id }>\n\t\t\t{ notification.additionalActionProps?.map( ( additionalAction, index ) => (\n\t\t\t\t<Button key={ `${ index }` } { ...additionalAction } />\n\t\t\t) ) }\n\t\t</Fragment>\n\t);\n}\n\nexport const useEnqueueNotification = ( notifications: Notifications ) => {\n\tconst { enqueueSnackbar } = useSnackbar();\n\tconst dispatch = useDispatch();\n\n\tuseEffect( () => {\n\t\tObject.values( notifications ).forEach( ( notification ) => {\n\t\t\tconst dismiss = () => {\n\t\t\t\tcloseSnackbar( notification.id );\n\t\t\t\tdispatch( clearAction( { id: notification.id } ) );\n\t\t\t};\n\n\t\t\tconst useAlertAction = [ 'promotion', 'info', 'success', 'error' ].includes( notification.type );\n\n\t\t\tconst action = useAlertAction\n\t\t\t\t? createPromotionAction( notification )\n\t\t\t\t: createDefaultAction( notification, dismiss );\n\n\t\t\tenqueueSnackbar( notification.message, {\n\t\t\t\tvariant: notification.type as VariantType,\n\t\t\t\tkey: notification.id,\n\t\t\t\tonClose: () => dispatch( clearAction( { id: notification.id } ) ),\n\t\t\t\tpreventDuplicate: true,\n\t\t\t\taction,\n\t\t\t\tautoHideDuration: notification.autoHideDuration ?? AUTO_HIDE_DURATION,\n\t\t\t} );\n\t\t} );\n\t}, [ notifications, enqueueSnackbar, dispatch ] );\n};\n","import { __createSlice as createSlice } from '@elementor/store';\n\nimport { type Notifications } from './types';\n\nexport const notificationsSlice = createSlice( {\n\tname: 'notifications',\n\tinitialState: {} as Notifications,\n\treducers: {\n\t\tnotifyAction: ( state, action ) => {\n\t\t\tconst newState = { ...state };\n\t\t\tif ( ! newState[ action.payload.id ] ) {\n\t\t\t\tnewState[ action.payload.id ] = action.payload;\n\t\t\t}\n\n\t\t\treturn newState;\n\t\t},\n\t\tclearAction: ( state, action ) => {\n\t\t\tconst newState = { ...state };\n\t\t\tif ( newState[ action.payload.id ] ) {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n\t\t\t\tdelete newState[ action.payload.id ];\n\t\t\t}\n\n\t\t\treturn newState;\n\t\t},\n\t},\n} );\n\nexport const { notifyAction, clearAction } = notificationsSlice.actions;\n","export function getEditingPanelWidth() {\n\treturn document.querySelector( '.elementor-panel' )?.clientWidth || 0;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,oBAA8B;AAC9B,IAAAA,gBAAiD;;;ACDjD,IAAAC,SAAuB;AACvB,IAAAC,gBAA2B;AAC3B,IAAAC,oBAAyE;AACzE,mBAAgG;AAChG,IAAAC,gBAAmG;AACnG,IAAAC,aAA0E;;;ACL1E,mBAAoC;AACpC,YAAuB;AACvB,uBAA6D;AAC7D,IAAAC,gBAA6C;AAC7C,gBAAoC;;;ACJpC,mBAA6C;AAItC,IAAM,yBAAqB,aAAAC,eAAa;AAAA,EAC9C,MAAM;AAAA,EACN,cAAc,CAAC;AAAA,EACf,UAAU;AAAA,IACT,cAAc,CAAE,OAAO,WAAY;AAClC,YAAM,WAAW,EAAE,GAAG,MAAM;AAC5B,UAAK,CAAE,SAAU,OAAO,QAAQ,EAAG,GAAI;AACtC,iBAAU,OAAO,QAAQ,EAAG,IAAI,OAAO;AAAA,MACxC;AAEA,aAAO;AAAA,IACR;AAAA,IACA,aAAa,CAAE,OAAO,WAAY;AACjC,YAAM,WAAW,EAAE,GAAG,MAAM;AAC5B,UAAK,SAAU,OAAO,QAAQ,EAAG,GAAI;AAEpC,eAAO,SAAU,OAAO,QAAQ,EAAG;AAAA,MACpC;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AK,KAAM,MAAO;AACpC,UAAK,CAAE,eAAe,SAAU,GAAI,GAAI;AACvC,sBAAe,GAAI,IAAI;AAAA,MACxB;AAEA,aAAO;AAAA,IACR;AAAA,IACA,CAAC;AAAA,EACF;AACD;AAEA,IAAO,wBAAQ;;;ADhJR,SAAS,OAAO;AACtB,oBAAAC,iBAAe,kBAAmB;AAClC,mCAAe;AAAA,IACd,IAAI;AAAA,IACJ,WAAW;AAAA,EACZ,CAAE;AACH;","names":["import_store","React","import_react","import_notistack","import_store","import_ui","import_store","createSlice","useDispatch","AUTO_HIDE_DURATION","useSelector","getStore","useDispatch","registerSlice"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/init.ts","../src/components/notifications.tsx","../src/hooks/use-enqueue-notifications.tsx","../src/slice.ts","../src/sync/get-app-bar-height.ts","../src/sync/get-editing-panel-width.ts"],"sourcesContent":["export { init } from './init';\n\nexport { type NotificationData } from './types';\nexport { dismissNotification, NotifyReact, notify } from './components/notifications';\n","import { injectIntoTop } from '@elementor/editor';\nimport { __registerSlice as registerSlice } from '@elementor/store';\n\nimport Wrapper from './components/notifications';\nimport { notificationsSlice } from './slice';\n\nexport function init() {\n\tregisterSlice( notificationsSlice );\n\tinjectIntoTop( {\n\t\tid: 'notifications',\n\t\tcomponent: Wrapper,\n\t} );\n}\n","import * as React from 'react';\nimport { forwardRef } from 'react';\nimport { closeSnackbar, type CustomContentProps, SnackbarProvider } from 'notistack';\nimport { AlertCircleFilled, CircleCheckFilledIcon, CrownFilledIcon, InfoCircleFilledIcon } from '@elementor/icons';\nimport { __getStore as getStore, __useDispatch as useDispatch, __useSelector as useSelector } from '@elementor/store';\nimport { Alert, SnackbarContent, type SnackbarProps, ThemeProvider } from '@elementor/ui';\n\nimport { useEnqueueNotification } from '../hooks/use-enqueue-notifications';\nimport { clearAction, notifyAction } from '../slice';\nimport { getAppBarHeight } from '../sync/get-app-bar-height';\nimport { getEditingPanelWidth } from '../sync/get-editing-panel-width';\nimport { type NotificationData, type Notifications } from '../types';\n\n// 8 seconds\nconst AUTO_HIDE_DURATION = 8000;\n\nconst DefaultCustomSnackbar = forwardRef( ( props: SnackbarProps, ref ) => {\n\tconst filteredProps = getFilteredSnackbarProps( props );\n\tconst panelWidth = getEditingPanelWidth();\n\tconst appBarHeight = getAppBarHeight();\n\n\treturn (\n\t\t<ThemeProvider palette=\"unstable\">\n\t\t\t<SnackbarContent\n\t\t\t\tref={ ref }\n\t\t\t\t{ ...filteredProps }\n\t\t\t\tsx={ {\n\t\t\t\t\t'&.MuiPaper-root': { minWidth: 'max-content' },\n\t\t\t\t\tml: panelWidth + 'px',\n\t\t\t\t\tmt: `-${ appBarHeight }px`,\n\t\t\t\t} }\n\t\t\t/>\n\t\t</ThemeProvider>\n\t);\n} );\n\ninterface AlertSnackbarProps extends CustomContentProps {\n\tcolor: 'promotion' | 'info' | 'success' | 'error';\n\ticon: React.ReactElement;\n}\n\nconst AlertSnackbar = forwardRef< HTMLDivElement, AlertSnackbarProps >( ( { color, icon, ...props }, ref ) => {\n\tconst panelWidth = getEditingPanelWidth();\n\tconst appBarHeight = getAppBarHeight();\n\n\treturn (\n\t\t<ThemeProvider colorScheme=\"light\" palette=\"unstable\">\n\t\t\t<Alert\n\t\t\t\tref={ ref }\n\t\t\t\tvariant=\"standard\"\n\t\t\t\tcolor={ color }\n\t\t\t\ticon={ icon }\n\t\t\t\trole=\"alert\"\n\t\t\t\taction={ props.action }\n\t\t\t\tonClose={ () => closeSnackbar( props.id ) }\n\t\t\t\tsx={ {\n\t\t\t\t\tml: panelWidth + 'px',\n\t\t\t\t\tmt: `-${ appBarHeight }px`,\n\t\t\t\t\t'& .MuiAlert-message': { display: 'flex', flexWrap: 'nowrap', alignItems: 'center' },\n\t\t\t\t\t'& .MuiAlert-content': { whiteSpace: 'nowrap' },\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ props.message }\n\t\t\t</Alert>\n\t\t</ThemeProvider>\n\t);\n} );\n\nconst PromotionSnackbar = forwardRef< HTMLDivElement, CustomContentProps >( ( props, ref ) => (\n\t<AlertSnackbar ref={ ref } color=\"promotion\" icon={ <CrownFilledIcon /> } { ...props } />\n) );\n\nconst InfoSnackbar = forwardRef< HTMLDivElement, CustomContentProps >( ( props, ref ) => (\n\t<AlertSnackbar ref={ ref } color=\"info\" icon={ <InfoCircleFilledIcon /> } { ...props } />\n) );\n\nconst SuccessSnackbar = forwardRef< HTMLDivElement, CustomContentProps >( ( props, ref ) => (\n\t<AlertSnackbar ref={ ref } color=\"success\" icon={ <CircleCheckFilledIcon /> } { ...props } />\n) );\n\nconst ErrorSnackbar = forwardRef< HTMLDivElement, CustomContentProps >( ( props, ref ) => (\n\t<AlertSnackbar ref={ ref } color=\"error\" icon={ <AlertCircleFilled /> } { ...props } />\n) );\n\nconst muiToEuiMapper = {\n\tdefault: DefaultCustomSnackbar,\n\tpromotion: PromotionSnackbar,\n\tinfo: InfoSnackbar,\n\tsuccess: SuccessSnackbar,\n\terror: ErrorSnackbar,\n};\n\nconst Handler = () => {\n\tconst notifications = useSelector( ( state: { notifications: Notifications } ) => state.notifications );\n\n\tuseEnqueueNotification( notifications );\n\n\treturn null;\n};\n\nconst Wrapper = () => {\n\treturn (\n\t\t<SnackbarProvider\n\t\t\tmaxSnack={ 3 }\n\t\t\tautoHideDuration={ AUTO_HIDE_DURATION }\n\t\t\tdisableWindowBlurListener\n\t\t\tanchorOrigin={ { horizontal: 'center', vertical: 'bottom' } }\n\t\t\tComponents={ muiToEuiMapper }\n\t\t\tdomRoot={ document.body }\n\t\t>\n\t\t\t<Handler />\n\t\t</SnackbarProvider>\n\t);\n};\n\n/*\n * This function can be used to trigger notifications from anywhere in the code.\n * even if you're running in a JS environment as opposed to a React environment.\n */\nexport function notify( notification: NotificationData ) {\n\tconst store = getStore();\n\n\tstore?.dispatch( notifyAction( notification ) );\n}\n\nexport function dismissNotification( id: NotificationData[ 'id' ] ) {\n\tconst store = getStore();\n\n\tcloseSnackbar( id );\n\tstore?.dispatch( clearAction( { id } ) );\n}\n\n/*\n * This function can be used to trigger notifications from within a React component.\n * This is the preferred way to trigger notifications.\n */\nexport function NotifyReact( notification: NotificationData ) {\n\tconst dispatch = useDispatch();\n\n\tdispatch( notifyAction( notification ) );\n}\n\nfunction getFilteredSnackbarProps( props: SnackbarProps ) {\n\tconst forbiddenProps = [ 'autoHideDuration', 'persist', 'hideIconVariant', 'iconVariant', 'anchorOrigin' ];\n\n\treturn Object.entries( props ).reduce(\n\t\t( filteredProps, [ key, value ] ) => {\n\t\t\tif ( ! forbiddenProps.includes( key ) ) {\n\t\t\t\tfilteredProps[ key ] = value;\n\t\t\t}\n\n\t\t\treturn filteredProps;\n\t\t},\n\t\t{} as Record< string, unknown >\n\t);\n}\n\nexport default Wrapper;\n","import { Fragment, useEffect } from 'react';\nimport * as React from 'react';\nimport { closeSnackbar, useSnackbar, type VariantType } from 'notistack';\nimport { __useDispatch as useDispatch } from '@elementor/store';\nimport { Button, CloseButton } from '@elementor/ui';\n\nimport { clearAction } from '../slice';\nimport type { NotificationData, Notifications } from '../types';\n\nconst AUTO_HIDE_DURATION = 8000;\n\nfunction createDefaultAction( notification: NotificationData, onDismiss: () => void ) {\n\treturn (\n\t\t<Fragment key={ notification.id }>\n\t\t\t{ notification.additionalActionProps?.map( ( additionalAction, index ) => (\n\t\t\t\t<Button key={ `${ index }` } { ...additionalAction } />\n\t\t\t) ) }\n\n\t\t\t<CloseButton aria-label=\"close\" color=\"inherit\" onClick={ onDismiss } />\n\t\t</Fragment>\n\t);\n}\n\nfunction createPromotionAction( notification: NotificationData ) {\n\treturn (\n\t\t<Fragment key={ notification.id }>\n\t\t\t{ notification.additionalActionProps?.map( ( additionalAction, index ) => (\n\t\t\t\t<Button key={ `${ index }` } { ...additionalAction } />\n\t\t\t) ) }\n\t\t</Fragment>\n\t);\n}\n\nexport const useEnqueueNotification = ( notifications: Notifications ) => {\n\tconst { enqueueSnackbar } = useSnackbar();\n\tconst dispatch = useDispatch();\n\n\tuseEffect( () => {\n\t\tObject.values( notifications ).forEach( ( notification ) => {\n\t\t\tconst dismiss = () => {\n\t\t\t\tcloseSnackbar( notification.id );\n\t\t\t\tdispatch( clearAction( { id: notification.id } ) );\n\t\t\t};\n\n\t\t\tconst useAlertAction = [ 'promotion', 'info', 'success', 'error' ].includes( notification.type );\n\n\t\t\tconst action = useAlertAction\n\t\t\t\t? createPromotionAction( notification )\n\t\t\t\t: createDefaultAction( notification, dismiss );\n\n\t\t\tenqueueSnackbar( notification.message, {\n\t\t\t\tvariant: notification.type as VariantType,\n\t\t\t\tkey: notification.id,\n\t\t\t\tonClose: () => dispatch( clearAction( { id: notification.id } ) ),\n\t\t\t\tpreventDuplicate: true,\n\t\t\t\taction,\n\t\t\t\tautoHideDuration: notification.autoHideDuration ?? AUTO_HIDE_DURATION,\n\t\t\t} );\n\t\t} );\n\t}, [ notifications, enqueueSnackbar, dispatch ] );\n};\n","import { __createSlice as createSlice } from '@elementor/store';\n\nimport { type Notifications } from './types';\n\nexport const notificationsSlice = createSlice( {\n\tname: 'notifications',\n\tinitialState: {} as Notifications,\n\treducers: {\n\t\tnotifyAction: ( state, action ) => {\n\t\t\tconst newState = { ...state };\n\t\t\tif ( ! newState[ action.payload.id ] ) {\n\t\t\t\tnewState[ action.payload.id ] = action.payload;\n\t\t\t}\n\n\t\t\treturn newState;\n\t\t},\n\t\tclearAction: ( state, action ) => {\n\t\t\tconst newState = { ...state };\n\t\t\tif ( newState[ action.payload.id ] ) {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n\t\t\t\tdelete newState[ action.payload.id ];\n\t\t\t}\n\n\t\t\treturn newState;\n\t\t},\n\t},\n} );\n\nexport const { notifyAction, clearAction } = notificationsSlice.actions;\n","const EDITOR_APP_BAR_WRAPPER_ID = 'elementor-editor-wrapper-v2';\n\nexport function getAppBarHeight() {\n\treturn document.getElementById( EDITOR_APP_BAR_WRAPPER_ID )?.getBoundingClientRect().height ?? 0;\n}\n","export function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AO;AAAA,IACR;AAAA,IACA,CAAC;AAAA,EACF;AACD;AAEA,IAAO,wBAAQ;;;ADvJR,SAAS,OAAO;AACtB,oBAAAC,iBAAe,kBAAmB;AAClC,mCAAe;AAAA,IACd,IAAI;AAAA,IACJ,WAAW;AAAA,EACZ,CAAE;AACH;","names":["import_store","React","import_react","import_notistack","import_store","import_ui","import_store","createSlice","useDispatch","AUTO_HIDE_DURATION","useSelector","getStore","useDispatch","registerSlice"]}
|
package/dist/index.mjs
CHANGED
|
@@ -72,6 +72,12 @@ var useEnqueueNotification = (notifications) => {
|
|
|
72
72
|
}, [notifications, enqueueSnackbar, dispatch]);
|
|
73
73
|
};
|
|
74
74
|
|
|
75
|
+
// src/sync/get-app-bar-height.ts
|
|
76
|
+
var EDITOR_APP_BAR_WRAPPER_ID = "elementor-editor-wrapper-v2";
|
|
77
|
+
function getAppBarHeight() {
|
|
78
|
+
return document.getElementById(EDITOR_APP_BAR_WRAPPER_ID)?.getBoundingClientRect().height ?? 0;
|
|
79
|
+
}
|
|
80
|
+
|
|
75
81
|
// src/sync/get-editing-panel-width.ts
|
|
76
82
|
function getEditingPanelWidth() {
|
|
77
83
|
return document.querySelector(".elementor-panel")?.clientWidth || 0;
|
|
@@ -82,6 +88,7 @@ var AUTO_HIDE_DURATION2 = 8e3;
|
|
|
82
88
|
var DefaultCustomSnackbar = forwardRef((props, ref) => {
|
|
83
89
|
const filteredProps = getFilteredSnackbarProps(props);
|
|
84
90
|
const panelWidth = getEditingPanelWidth();
|
|
91
|
+
const appBarHeight = getAppBarHeight();
|
|
85
92
|
return /* @__PURE__ */ React2.createElement(ThemeProvider, { palette: "unstable" }, /* @__PURE__ */ React2.createElement(
|
|
86
93
|
SnackbarContent,
|
|
87
94
|
{
|
|
@@ -89,13 +96,15 @@ var DefaultCustomSnackbar = forwardRef((props, ref) => {
|
|
|
89
96
|
...filteredProps,
|
|
90
97
|
sx: {
|
|
91
98
|
"&.MuiPaper-root": { minWidth: "max-content" },
|
|
92
|
-
ml: panelWidth + "px"
|
|
99
|
+
ml: panelWidth + "px",
|
|
100
|
+
mt: `-${appBarHeight}px`
|
|
93
101
|
}
|
|
94
102
|
}
|
|
95
103
|
));
|
|
96
104
|
});
|
|
97
105
|
var AlertSnackbar = forwardRef(({ color, icon, ...props }, ref) => {
|
|
98
106
|
const panelWidth = getEditingPanelWidth();
|
|
107
|
+
const appBarHeight = getAppBarHeight();
|
|
99
108
|
return /* @__PURE__ */ React2.createElement(ThemeProvider, { colorScheme: "light", palette: "unstable" }, /* @__PURE__ */ React2.createElement(
|
|
100
109
|
Alert,
|
|
101
110
|
{
|
|
@@ -108,6 +117,7 @@ var AlertSnackbar = forwardRef(({ color, icon, ...props }, ref) => {
|
|
|
108
117
|
onClose: () => closeSnackbar2(props.id),
|
|
109
118
|
sx: {
|
|
110
119
|
ml: panelWidth + "px",
|
|
120
|
+
mt: `-${appBarHeight}px`,
|
|
111
121
|
"& .MuiAlert-message": { display: "flex", flexWrap: "nowrap", alignItems: "center" },
|
|
112
122
|
"& .MuiAlert-content": { whiteSpace: "nowrap" }
|
|
113
123
|
}
|
|
@@ -139,7 +149,8 @@ var Wrapper = () => {
|
|
|
139
149
|
autoHideDuration: AUTO_HIDE_DURATION2,
|
|
140
150
|
disableWindowBlurListener: true,
|
|
141
151
|
anchorOrigin: { horizontal: "center", vertical: "bottom" },
|
|
142
|
-
Components: muiToEuiMapper
|
|
152
|
+
Components: muiToEuiMapper,
|
|
153
|
+
domRoot: document.body
|
|
143
154
|
},
|
|
144
155
|
/* @__PURE__ */ React2.createElement(Handler, null)
|
|
145
156
|
);
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/init.ts","../src/components/notifications.tsx","../src/hooks/use-enqueue-notifications.tsx","../src/slice.ts","../src/sync/get-editing-panel-width.ts"],"sourcesContent":["import { injectIntoTop } from '@elementor/editor';\nimport { __registerSlice as registerSlice } from '@elementor/store';\n\nimport Wrapper from './components/notifications';\nimport { notificationsSlice } from './slice';\n\nexport function init() {\n\tregisterSlice( notificationsSlice );\n\tinjectIntoTop( {\n\t\tid: 'notifications',\n\t\tcomponent: Wrapper,\n\t} );\n}\n","import * as React from 'react';\nimport { forwardRef } from 'react';\nimport { closeSnackbar, type CustomContentProps, SnackbarProvider } from 'notistack';\nimport { AlertCircleFilled, CircleCheckFilledIcon, CrownFilledIcon, InfoCircleFilledIcon } from '@elementor/icons';\nimport { __getStore as getStore, __useDispatch as useDispatch, __useSelector as useSelector } from '@elementor/store';\nimport { Alert, SnackbarContent, type SnackbarProps, ThemeProvider } from '@elementor/ui';\n\nimport { useEnqueueNotification } from '../hooks/use-enqueue-notifications';\nimport { clearAction, notifyAction } from '../slice';\nimport { getEditingPanelWidth } from '../sync/get-editing-panel-width';\nimport { type NotificationData, type Notifications } from '../types';\n\n// 8 seconds\nconst AUTO_HIDE_DURATION = 8000;\n\nconst DefaultCustomSnackbar = forwardRef( ( props: SnackbarProps, ref ) => {\n\tconst filteredProps = getFilteredSnackbarProps( props );\n\tconst panelWidth = getEditingPanelWidth();\n\n\treturn (\n\t\t<ThemeProvider palette=\"unstable\">\n\t\t\t<SnackbarContent\n\t\t\t\tref={ ref }\n\t\t\t\t{ ...filteredProps }\n\t\t\t\tsx={ {\n\t\t\t\t\t'&.MuiPaper-root': { minWidth: 'max-content' },\n\t\t\t\t\tml: panelWidth + 'px',\n\t\t\t\t} }\n\t\t\t/>\n\t\t</ThemeProvider>\n\t);\n} );\n\ninterface AlertSnackbarProps extends CustomContentProps {\n\tcolor: 'promotion' | 'info' | 'success' | 'error';\n\ticon: React.ReactElement;\n}\n\nconst AlertSnackbar = forwardRef< HTMLDivElement, AlertSnackbarProps >( ( { color, icon, ...props }, ref ) => {\n\tconst panelWidth = getEditingPanelWidth();\n\n\treturn (\n\t\t<ThemeProvider colorScheme=\"light\" palette=\"unstable\">\n\t\t\t<Alert\n\t\t\t\tref={ ref }\n\t\t\t\tvariant=\"standard\"\n\t\t\t\tcolor={ color }\n\t\t\t\ticon={ icon }\n\t\t\t\trole=\"alert\"\n\t\t\t\taction={ props.action }\n\t\t\t\tonClose={ () => closeSnackbar( props.id ) }\n\t\t\t\tsx={ {\n\t\t\t\t\tml: panelWidth + 'px',\n\t\t\t\t\t'& .MuiAlert-message': { display: 'flex', flexWrap: 'nowrap', alignItems: 'center' },\n\t\t\t\t\t'& .MuiAlert-content': { whiteSpace: 'nowrap' },\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ props.message }\n\t\t\t</Alert>\n\t\t</ThemeProvider>\n\t);\n} );\n\nconst PromotionSnackbar = forwardRef< HTMLDivElement, CustomContentProps >( ( props, ref ) => (\n\t<AlertSnackbar ref={ ref } color=\"promotion\" icon={ <CrownFilledIcon /> } { ...props } />\n) );\n\nconst InfoSnackbar = forwardRef< HTMLDivElement, CustomContentProps >( ( props, ref ) => (\n\t<AlertSnackbar ref={ ref } color=\"info\" icon={ <InfoCircleFilledIcon /> } { ...props } />\n) );\n\nconst SuccessSnackbar = forwardRef< HTMLDivElement, CustomContentProps >( ( props, ref ) => (\n\t<AlertSnackbar ref={ ref } color=\"success\" icon={ <CircleCheckFilledIcon /> } { ...props } />\n) );\n\nconst ErrorSnackbar = forwardRef< HTMLDivElement, CustomContentProps >( ( props, ref ) => (\n\t<AlertSnackbar ref={ ref } color=\"error\" icon={ <AlertCircleFilled /> } { ...props } />\n) );\n\nconst muiToEuiMapper = {\n\tdefault: DefaultCustomSnackbar,\n\tpromotion: PromotionSnackbar,\n\tinfo: InfoSnackbar,\n\tsuccess: SuccessSnackbar,\n\terror: ErrorSnackbar,\n};\n\nconst Handler = () => {\n\tconst notifications = useSelector( ( state: { notifications: Notifications } ) => state.notifications );\n\n\tuseEnqueueNotification( notifications );\n\n\treturn null;\n};\n\nconst Wrapper = () => {\n\treturn (\n\t\t<SnackbarProvider\n\t\t\tmaxSnack={ 3 }\n\t\t\tautoHideDuration={ AUTO_HIDE_DURATION }\n\t\t\tdisableWindowBlurListener\n\t\t\tanchorOrigin={ { horizontal: 'center', vertical: 'bottom' } }\n\t\t\tComponents={ muiToEuiMapper }\n\t\t>\n\t\t\t<Handler />\n\t\t</SnackbarProvider>\n\t);\n};\n\n/*\n * This function can be used to trigger notifications from anywhere in the code.\n * even if you're running in a JS environment as opposed to a React environment.\n */\nexport function notify( notification: NotificationData ) {\n\tconst store = getStore();\n\n\tstore?.dispatch( notifyAction( notification ) );\n}\n\nexport function dismissNotification( id: NotificationData[ 'id' ] ) {\n\tconst store = getStore();\n\n\tcloseSnackbar( id );\n\tstore?.dispatch( clearAction( { id } ) );\n}\n\n/*\n * This function can be used to trigger notifications from within a React component.\n * This is the preferred way to trigger notifications.\n */\nexport function NotifyReact( notification: NotificationData ) {\n\tconst dispatch = useDispatch();\n\tdispatch( notifyAction( notification ) );\n}\n\nfunction getFilteredSnackbarProps( props: SnackbarProps ) {\n\tconst forbiddenProps = [ 'autoHideDuration', 'persist', 'hideIconVariant', 'iconVariant', 'anchorOrigin' ];\n\n\treturn Object.entries( props ).reduce(\n\t\t( filteredProps, [ key, value ] ) => {\n\t\t\tif ( ! forbiddenProps.includes( key ) ) {\n\t\t\t\tfilteredProps[ key ] = value;\n\t\t\t}\n\n\t\t\treturn filteredProps;\n\t\t},\n\t\t{} as Record< string, unknown >\n\t);\n}\n\nexport default Wrapper;\n","import { Fragment, useEffect } from 'react';\nimport * as React from 'react';\nimport { closeSnackbar, useSnackbar, type VariantType } from 'notistack';\nimport { __useDispatch as useDispatch } from '@elementor/store';\nimport { Button, CloseButton } from '@elementor/ui';\n\nimport { clearAction } from '../slice';\nimport type { NotificationData, Notifications } from '../types';\n\nconst AUTO_HIDE_DURATION = 8000;\n\nfunction createDefaultAction( notification: NotificationData, onDismiss: () => void ) {\n\treturn (\n\t\t<Fragment key={ notification.id }>\n\t\t\t{ notification.additionalActionProps?.map( ( additionalAction, index ) => (\n\t\t\t\t<Button key={ `${ index }` } { ...additionalAction } />\n\t\t\t) ) }\n\n\t\t\t<CloseButton aria-label=\"close\" color=\"inherit\" onClick={ onDismiss } />\n\t\t</Fragment>\n\t);\n}\n\nfunction createPromotionAction( notification: NotificationData ) {\n\treturn (\n\t\t<Fragment key={ notification.id }>\n\t\t\t{ notification.additionalActionProps?.map( ( additionalAction, index ) => (\n\t\t\t\t<Button key={ `${ index }` } { ...additionalAction } />\n\t\t\t) ) }\n\t\t</Fragment>\n\t);\n}\n\nexport const useEnqueueNotification = ( notifications: Notifications ) => {\n\tconst { enqueueSnackbar } = useSnackbar();\n\tconst dispatch = useDispatch();\n\n\tuseEffect( () => {\n\t\tObject.values( notifications ).forEach( ( notification ) => {\n\t\t\tconst dismiss = () => {\n\t\t\t\tcloseSnackbar( notification.id );\n\t\t\t\tdispatch( clearAction( { id: notification.id } ) );\n\t\t\t};\n\n\t\t\tconst useAlertAction = [ 'promotion', 'info', 'success', 'error' ].includes( notification.type );\n\n\t\t\tconst action = useAlertAction\n\t\t\t\t? createPromotionAction( notification )\n\t\t\t\t: createDefaultAction( notification, dismiss );\n\n\t\t\tenqueueSnackbar( notification.message, {\n\t\t\t\tvariant: notification.type as VariantType,\n\t\t\t\tkey: notification.id,\n\t\t\t\tonClose: () => dispatch( clearAction( { id: notification.id } ) ),\n\t\t\t\tpreventDuplicate: true,\n\t\t\t\taction,\n\t\t\t\tautoHideDuration: notification.autoHideDuration ?? AUTO_HIDE_DURATION,\n\t\t\t} );\n\t\t} );\n\t}, [ notifications, enqueueSnackbar, dispatch ] );\n};\n","import { __createSlice as createSlice } from '@elementor/store';\n\nimport { type Notifications } from './types';\n\nexport const notificationsSlice = createSlice( {\n\tname: 'notifications',\n\tinitialState: {} as Notifications,\n\treducers: {\n\t\tnotifyAction: ( state, action ) => {\n\t\t\tconst newState = { ...state };\n\t\t\tif ( ! newState[ action.payload.id ] ) {\n\t\t\t\tnewState[ action.payload.id ] = action.payload;\n\t\t\t}\n\n\t\t\treturn newState;\n\t\t},\n\t\tclearAction: ( state, action ) => {\n\t\t\tconst newState = { ...state };\n\t\t\tif ( newState[ action.payload.id ] ) {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n\t\t\t\tdelete newState[ action.payload.id ];\n\t\t\t}\n\n\t\t\treturn newState;\n\t\t},\n\t},\n} );\n\nexport const { notifyAction, clearAction } = notificationsSlice.actions;\n","export function getEditingPanelWidth() {\n\treturn document.querySelector( '.elementor-panel' )?.clientWidth || 0;\n}\n"],"mappings":";AAAA,SAAS,qBAAqB;AAC9B,SAAS,mBAAmB,qBAAqB;;;ACDjD,YAAYA,YAAW;AACvB,SAAS,kBAAkB;AAC3B,SAAS,iBAAAC,gBAAwC,wBAAwB;AACzE,SAAS,mBAAmB,uBAAuB,iBAAiB,4BAA4B;AAChG,SAAS,cAAc,UAAU,iBAAiBC,cAAa,iBAAiB,mBAAmB;AACnG,SAAS,OAAO,iBAAqC,qBAAqB;;;ACL1E,SAAS,UAAU,iBAAiB;AACpC,YAAY,WAAW;AACvB,SAAS,eAAe,mBAAqC;AAC7D,SAAS,iBAAiB,mBAAmB;AAC7C,SAAS,QAAQ,mBAAmB;;;ACJpC,SAAS,iBAAiB,mBAAmB;AAItC,IAAM,qBAAqB,YAAa;AAAA,EAC9C,MAAM;AAAA,EACN,cAAc,CAAC;AAAA,EACf,UAAU;AAAA,IACT,cAAc,CAAE,OAAO,WAAY;AAClC,YAAM,WAAW,EAAE,GAAG,MAAM;AAC5B,UAAK,CAAE,SAAU,OAAO,QAAQ,EAAG,GAAI;AACtC,iBAAU,OAAO,QAAQ,EAAG,IAAI,OAAO;AAAA,MACxC;AAEA,aAAO;AAAA,IACR;AAAA,IACA,aAAa,CAAE,OAAO,WAAY;AACjC,YAAM,WAAW,EAAE,GAAG,MAAM;AAC5B,UAAK,SAAU,OAAO,QAAQ,EAAG,GAAI;AAEpC,eAAO,SAAU,OAAO,QAAQ,EAAG;AAAA,MACpC;AAEA,aAAO;AAAA,IACR;AAAA,EACD;AACD,CAAE;AAEK,IAAM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aAAO;AAAA,IACR;AAAA,IACA,CAAC;AAAA,EACF;AACD;AAEA,IAAO,wBAAQ;;;ADhJR,SAAS,OAAO;AACtB,gBAAe,kBAAmB;AAClC,gBAAe;AAAA,IACd,IAAI;AAAA,IACJ,WAAW;AAAA,EACZ,CAAE;AACH;","names":["React","closeSnackbar","useDispatch","AUTO_HIDE_DURATION","closeSnackbar","useDispatch"]}
|
|
1
|
+
{"version":3,"sources":["../src/init.ts","../src/components/notifications.tsx","../src/hooks/use-enqueue-notifications.tsx","../src/slice.ts","../src/sync/get-app-bar-height.ts","../src/sync/get-editing-panel-width.ts"],"sourcesContent":["import { injectIntoTop } from '@elementor/editor';\nimport { __registerSlice as registerSlice } from '@elementor/store';\n\nimport Wrapper from './components/notifications';\nimport { notificationsSlice } from './slice';\n\nexport function init() {\n\tregisterSlice( notificationsSlice );\n\tinjectIntoTop( {\n\t\tid: 'notifications',\n\t\tcomponent: Wrapper,\n\t} );\n}\n","import * as React from 'react';\nimport { forwardRef } from 'react';\nimport { closeSnackbar, type CustomContentProps, SnackbarProvider } from 'notistack';\nimport { AlertCircleFilled, CircleCheckFilledIcon, CrownFilledIcon, InfoCircleFilledIcon } from '@elementor/icons';\nimport { __getStore as getStore, __useDispatch as useDispatch, __useSelector as useSelector } from '@elementor/store';\nimport { Alert, SnackbarContent, type SnackbarProps, ThemeProvider } from '@elementor/ui';\n\nimport { useEnqueueNotification } from '../hooks/use-enqueue-notifications';\nimport { clearAction, notifyAction } from '../slice';\nimport { getAppBarHeight } from '../sync/get-app-bar-height';\nimport { getEditingPanelWidth } from '../sync/get-editing-panel-width';\nimport { type NotificationData, type Notifications } from '../types';\n\n// 8 seconds\nconst AUTO_HIDE_DURATION = 8000;\n\nconst DefaultCustomSnackbar = forwardRef( ( props: SnackbarProps, ref ) => {\n\tconst filteredProps = getFilteredSnackbarProps( props );\n\tconst panelWidth = getEditingPanelWidth();\n\tconst appBarHeight = getAppBarHeight();\n\n\treturn (\n\t\t<ThemeProvider palette=\"unstable\">\n\t\t\t<SnackbarContent\n\t\t\t\tref={ ref }\n\t\t\t\t{ ...filteredProps }\n\t\t\t\tsx={ {\n\t\t\t\t\t'&.MuiPaper-root': { minWidth: 'max-content' },\n\t\t\t\t\tml: panelWidth + 'px',\n\t\t\t\t\tmt: `-${ appBarHeight }px`,\n\t\t\t\t} }\n\t\t\t/>\n\t\t</ThemeProvider>\n\t);\n} );\n\ninterface AlertSnackbarProps extends CustomContentProps {\n\tcolor: 'promotion' | 'info' | 'success' | 'error';\n\ticon: React.ReactElement;\n}\n\nconst AlertSnackbar = forwardRef< HTMLDivElement, AlertSnackbarProps >( ( { color, icon, ...props }, ref ) => {\n\tconst panelWidth = getEditingPanelWidth();\n\tconst appBarHeight = getAppBarHeight();\n\n\treturn (\n\t\t<ThemeProvider colorScheme=\"light\" palette=\"unstable\">\n\t\t\t<Alert\n\t\t\t\tref={ ref }\n\t\t\t\tvariant=\"standard\"\n\t\t\t\tcolor={ color }\n\t\t\t\ticon={ icon }\n\t\t\t\trole=\"alert\"\n\t\t\t\taction={ props.action }\n\t\t\t\tonClose={ () => closeSnackbar( props.id ) }\n\t\t\t\tsx={ {\n\t\t\t\t\tml: panelWidth + 'px',\n\t\t\t\t\tmt: `-${ appBarHeight }px`,\n\t\t\t\t\t'& .MuiAlert-message': { display: 'flex', flexWrap: 'nowrap', alignItems: 'center' },\n\t\t\t\t\t'& .MuiAlert-content': { whiteSpace: 'nowrap' },\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ props.message }\n\t\t\t</Alert>\n\t\t</ThemeProvider>\n\t);\n} );\n\nconst PromotionSnackbar = forwardRef< HTMLDivElement, CustomContentProps >( ( props, ref ) => (\n\t<AlertSnackbar ref={ ref } color=\"promotion\" icon={ <CrownFilledIcon /> } { ...props } />\n) );\n\nconst InfoSnackbar = forwardRef< HTMLDivElement, CustomContentProps >( ( props, ref ) => (\n\t<AlertSnackbar ref={ ref } color=\"info\" icon={ <InfoCircleFilledIcon /> } { ...props } />\n) );\n\nconst SuccessSnackbar = forwardRef< HTMLDivElement, CustomContentProps >( ( props, ref ) => (\n\t<AlertSnackbar ref={ ref } color=\"success\" icon={ <CircleCheckFilledIcon /> } { ...props } />\n) );\n\nconst ErrorSnackbar = forwardRef< HTMLDivElement, CustomContentProps >( ( props, ref ) => (\n\t<AlertSnackbar ref={ ref } color=\"error\" icon={ <AlertCircleFilled /> } { ...props } />\n) );\n\nconst muiToEuiMapper = {\n\tdefault: DefaultCustomSnackbar,\n\tpromotion: PromotionSnackbar,\n\tinfo: InfoSnackbar,\n\tsuccess: SuccessSnackbar,\n\terror: ErrorSnackbar,\n};\n\nconst Handler = () => {\n\tconst notifications = useSelector( ( state: { notifications: Notifications } ) => state.notifications );\n\n\tuseEnqueueNotification( notifications );\n\n\treturn null;\n};\n\nconst Wrapper = () => {\n\treturn (\n\t\t<SnackbarProvider\n\t\t\tmaxSnack={ 3 }\n\t\t\tautoHideDuration={ AUTO_HIDE_DURATION }\n\t\t\tdisableWindowBlurListener\n\t\t\tanchorOrigin={ { horizontal: 'center', vertical: 'bottom' } }\n\t\t\tComponents={ muiToEuiMapper }\n\t\t\tdomRoot={ document.body }\n\t\t>\n\t\t\t<Handler />\n\t\t</SnackbarProvider>\n\t);\n};\n\n/*\n * This function can be used to trigger notifications from anywhere in the code.\n * even if you're running in a JS environment as opposed to a React environment.\n */\nexport function notify( notification: NotificationData ) {\n\tconst store = getStore();\n\n\tstore?.dispatch( notifyAction( notification ) );\n}\n\nexport function dismissNotification( id: NotificationData[ 'id' ] ) {\n\tconst store = getStore();\n\n\tcloseSnackbar( id );\n\tstore?.dispatch( clearAction( { id } ) );\n}\n\n/*\n * This function can be used to trigger notifications from within a React component.\n * This is the preferred way to trigger notifications.\n */\nexport function NotifyReact( notification: NotificationData ) {\n\tconst dispatch = useDispatch();\n\n\tdispatch( notifyAction( notification ) );\n}\n\nfunction getFilteredSnackbarProps( props: SnackbarProps ) {\n\tconst forbiddenProps = [ 'autoHideDuration', 'persist', 'hideIconVariant', 'iconVariant', 'anchorOrigin' ];\n\n\treturn Object.entries( props ).reduce(\n\t\t( filteredProps, [ key, value ] ) => {\n\t\t\tif ( ! forbiddenProps.includes( key ) ) {\n\t\t\t\tfilteredProps[ key ] = value;\n\t\t\t}\n\n\t\t\treturn filteredProps;\n\t\t},\n\t\t{} as Record< string, unknown >\n\t);\n}\n\nexport default Wrapper;\n","import { Fragment, useEffect } from 'react';\nimport * as React from 'react';\nimport { closeSnackbar, useSnackbar, type VariantType } from 'notistack';\nimport { __useDispatch as useDispatch } from '@elementor/store';\nimport { Button, CloseButton } from '@elementor/ui';\n\nimport { clearAction } from '../slice';\nimport type { NotificationData, Notifications } from '../types';\n\nconst AUTO_HIDE_DURATION = 8000;\n\nfunction createDefaultAction( notification: NotificationData, onDismiss: () => void ) {\n\treturn (\n\t\t<Fragment key={ notification.id }>\n\t\t\t{ notification.additionalActionProps?.map( ( additionalAction, index ) => (\n\t\t\t\t<Button key={ `${ index }` } { ...additionalAction } />\n\t\t\t) ) }\n\n\t\t\t<CloseButton aria-label=\"close\" color=\"inherit\" onClick={ onDismiss } />\n\t\t</Fragment>\n\t);\n}\n\nfunction createPromotionAction( notification: NotificationData ) {\n\treturn (\n\t\t<Fragment key={ notification.id }>\n\t\t\t{ notification.additionalActionProps?.map( ( additionalAction, index ) => (\n\t\t\t\t<Button key={ `${ index }` } { ...additionalAction } />\n\t\t\t) ) }\n\t\t</Fragment>\n\t);\n}\n\nexport const useEnqueueNotification = ( notifications: Notifications ) => {\n\tconst { enqueueSnackbar } = useSnackbar();\n\tconst dispatch = useDispatch();\n\n\tuseEffect( () => {\n\t\tObject.values( notifications ).forEach( ( notification ) => {\n\t\t\tconst dismiss = () => {\n\t\t\t\tcloseSnackbar( notification.id );\n\t\t\t\tdispatch( clearAction( { id: notification.id } ) );\n\t\t\t};\n\n\t\t\tconst useAlertAction = [ 'promotion', 'info', 'success', 'error' ].includes( notification.type );\n\n\t\t\tconst action = useAlertAction\n\t\t\t\t? createPromotionAction( notification )\n\t\t\t\t: createDefaultAction( notification, dismiss );\n\n\t\t\tenqueueSnackbar( notification.message, {\n\t\t\t\tvariant: notification.type as VariantType,\n\t\t\t\tkey: notification.id,\n\t\t\t\tonClose: () => dispatch( clearAction( { id: notification.id } ) ),\n\t\t\t\tpreventDuplicate: true,\n\t\t\t\taction,\n\t\t\t\tautoHideDuration: notification.autoHideDuration ?? AUTO_HIDE_DURATION,\n\t\t\t} );\n\t\t} );\n\t}, [ notifications, enqueueSnackbar, dispatch ] );\n};\n","import { __createSlice as createSlice } from '@elementor/store';\n\nimport { type Notifications } from './types';\n\nexport const notificationsSlice = createSlice( {\n\tname: 'notifications',\n\tinitialState: {} as Notifications,\n\treducers: {\n\t\tnotifyAction: ( state, action ) => {\n\t\t\tconst newState = { ...state };\n\t\t\tif ( ! newState[ action.payload.id ] ) {\n\t\t\t\tnewState[ action.payload.id ] = action.payload;\n\t\t\t}\n\n\t\t\treturn newState;\n\t\t},\n\t\tclearAction: ( state, action ) => {\n\t\t\tconst newState = { ...state };\n\t\t\tif ( newState[ action.payload.id ] ) {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n\t\t\t\tdelete newState[ action.payload.id ];\n\t\t\t}\n\n\t\t\treturn newState;\n\t\t},\n\t},\n} );\n\nexport const { notifyAction, clearAction } = notificationsSlice.actions;\n","const EDITOR_APP_BAR_WRAPPER_ID = 'elementor-editor-wrapper-v2';\n\nexport function getAppBarHeight() {\n\treturn document.getElementById( EDITOR_APP_BAR_WRAPPER_ID )?.getBoundingClientRect().height ?? 0;\n}\n","export function getEditingPanelWidth() {\n\treturn document.querySelector( '.elementor-panel' )?.clientWidth || 0;\n}\n"],"mappings":";AAAA,SAAS,qBAAqB;AAC9B,SAAS,mBAAmB,qBAAqB;;;ACDjD,YAAYA,YAAW;AACvB,SAAS,kBAAkB;AAC3B,SAAS,iBAAAC,gBAAwC,wBAAwB;AACzE,SAAS,mBAAmB,uBA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bar","useDispatch","AUTO_HIDE_DURATION","closeSnackbar","useDispatch"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elementor/editor-notifications",
|
|
3
3
|
"description": "Notifications manager for the Elementor editor",
|
|
4
|
-
"version": "4.
|
|
4
|
+
"version": "4.4.0-1065",
|
|
5
5
|
"private": false,
|
|
6
6
|
"author": "Elementor Team",
|
|
7
7
|
"homepage": "https://elementor.com/",
|
|
@@ -40,9 +40,9 @@
|
|
|
40
40
|
"dev": "tsup --config=../../tsup.dev.ts"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@elementor/editor": "4.
|
|
43
|
+
"@elementor/editor": "4.4.0-1065",
|
|
44
44
|
"@elementor/icons": "~1.75.1",
|
|
45
|
-
"@elementor/store": "4.
|
|
45
|
+
"@elementor/store": "4.4.0-1065",
|
|
46
46
|
"@elementor/ui": "1.37.5",
|
|
47
47
|
"notistack": "^3.0.2"
|
|
48
48
|
},
|
|
@@ -7,6 +7,7 @@ import { Alert, SnackbarContent, type SnackbarProps, ThemeProvider } from '@elem
|
|
|
7
7
|
|
|
8
8
|
import { useEnqueueNotification } from '../hooks/use-enqueue-notifications';
|
|
9
9
|
import { clearAction, notifyAction } from '../slice';
|
|
10
|
+
import { getAppBarHeight } from '../sync/get-app-bar-height';
|
|
10
11
|
import { getEditingPanelWidth } from '../sync/get-editing-panel-width';
|
|
11
12
|
import { type NotificationData, type Notifications } from '../types';
|
|
12
13
|
|
|
@@ -16,6 +17,7 @@ const AUTO_HIDE_DURATION = 8000;
|
|
|
16
17
|
const DefaultCustomSnackbar = forwardRef( ( props: SnackbarProps, ref ) => {
|
|
17
18
|
const filteredProps = getFilteredSnackbarProps( props );
|
|
18
19
|
const panelWidth = getEditingPanelWidth();
|
|
20
|
+
const appBarHeight = getAppBarHeight();
|
|
19
21
|
|
|
20
22
|
return (
|
|
21
23
|
<ThemeProvider palette="unstable">
|
|
@@ -25,6 +27,7 @@ const DefaultCustomSnackbar = forwardRef( ( props: SnackbarProps, ref ) => {
|
|
|
25
27
|
sx={ {
|
|
26
28
|
'&.MuiPaper-root': { minWidth: 'max-content' },
|
|
27
29
|
ml: panelWidth + 'px',
|
|
30
|
+
mt: `-${ appBarHeight }px`,
|
|
28
31
|
} }
|
|
29
32
|
/>
|
|
30
33
|
</ThemeProvider>
|
|
@@ -38,6 +41,7 @@ interface AlertSnackbarProps extends CustomContentProps {
|
|
|
38
41
|
|
|
39
42
|
const AlertSnackbar = forwardRef< HTMLDivElement, AlertSnackbarProps >( ( { color, icon, ...props }, ref ) => {
|
|
40
43
|
const panelWidth = getEditingPanelWidth();
|
|
44
|
+
const appBarHeight = getAppBarHeight();
|
|
41
45
|
|
|
42
46
|
return (
|
|
43
47
|
<ThemeProvider colorScheme="light" palette="unstable">
|
|
@@ -51,6 +55,7 @@ const AlertSnackbar = forwardRef< HTMLDivElement, AlertSnackbarProps >( ( { colo
|
|
|
51
55
|
onClose={ () => closeSnackbar( props.id ) }
|
|
52
56
|
sx={ {
|
|
53
57
|
ml: panelWidth + 'px',
|
|
58
|
+
mt: `-${ appBarHeight }px`,
|
|
54
59
|
'& .MuiAlert-message': { display: 'flex', flexWrap: 'nowrap', alignItems: 'center' },
|
|
55
60
|
'& .MuiAlert-content': { whiteSpace: 'nowrap' },
|
|
56
61
|
} }
|
|
@@ -101,6 +106,7 @@ const Wrapper = () => {
|
|
|
101
106
|
disableWindowBlurListener
|
|
102
107
|
anchorOrigin={ { horizontal: 'center', vertical: 'bottom' } }
|
|
103
108
|
Components={ muiToEuiMapper }
|
|
109
|
+
domRoot={ document.body }
|
|
104
110
|
>
|
|
105
111
|
<Handler />
|
|
106
112
|
</SnackbarProvider>
|
|
@@ -130,6 +136,7 @@ export function dismissNotification( id: NotificationData[ 'id' ] ) {
|
|
|
130
136
|
*/
|
|
131
137
|
export function NotifyReact( notification: NotificationData ) {
|
|
132
138
|
const dispatch = useDispatch();
|
|
139
|
+
|
|
133
140
|
dispatch( notifyAction( notification ) );
|
|
134
141
|
}
|
|
135
142
|
|