@elementor/editor-ui 0.5.0 → 0.7.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/.turbo/turbo-build.log +10 -10
- package/CHANGELOG.md +19 -0
- package/dist/index.d.mts +26 -3
- package/dist/index.d.ts +26 -3
- package/dist/index.js +84 -27
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +96 -27
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -1
- package/src/components/infotip-card.tsx +46 -0
- package/src/components/introduction-modal.tsx +32 -8
- package/src/components/menu-item.tsx +17 -15
- package/src/components/theme-provider.tsx +16 -0
- package/src/hooks/__tests__/use-color-scheme.test.ts +91 -0
- package/src/hooks/use-color-scheme.ts +46 -0
- package/src/index.ts +2 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @elementor/editor-ui@0.
|
|
2
|
+
> @elementor/editor-ui@0.7.0 build
|
|
3
3
|
> tsup --config=../../tsup.build.ts
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -10,13 +10,13 @@
|
|
|
10
10
|
[34mCLI[39m Cleaning output folder
|
|
11
11
|
[34mESM[39m Build start
|
|
12
12
|
[34mCJS[39m Build start
|
|
13
|
-
[32mESM[39m [1mdist/index.mjs [22m[
|
|
14
|
-
[32mESM[39m [1mdist/index.mjs.map [22m[
|
|
15
|
-
[32mESM[39m ⚡️ Build success in
|
|
16
|
-
[32mCJS[39m [1mdist/index.js [22m[
|
|
17
|
-
[32mCJS[39m [1mdist/index.js.map [22m[
|
|
18
|
-
[32mCJS[39m ⚡️ Build success in
|
|
13
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m8.77 KB[39m
|
|
14
|
+
[32mESM[39m [1mdist/index.mjs.map [22m[32m17.09 KB[39m
|
|
15
|
+
[32mESM[39m ⚡️ Build success in 107ms
|
|
16
|
+
[32mCJS[39m [1mdist/index.js [22m[32m10.88 KB[39m
|
|
17
|
+
[32mCJS[39m [1mdist/index.js.map [22m[32m17.42 KB[39m
|
|
18
|
+
[32mCJS[39m ⚡️ Build success in 108ms
|
|
19
19
|
[34mDTS[39m Build start
|
|
20
|
-
[32mDTS[39m ⚡️ Build success in
|
|
21
|
-
[32mDTS[39m [1mdist/index.d.mts [22m[
|
|
22
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[
|
|
20
|
+
[32mDTS[39m ⚡️ Build success in 17181ms
|
|
21
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m2.48 KB[39m
|
|
22
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m2.48 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @elementor/editor-ui
|
|
2
2
|
|
|
3
|
+
## 0.7.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- f644084: Added a "take me there" button in link-in-link restriction info-tip
|
|
8
|
+
|
|
9
|
+
## 0.6.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- fdfc87a: Classes and selector UI updates.
|
|
14
|
+
- 548209b: Add link restriction infotip
|
|
15
|
+
|
|
16
|
+
## 0.5.1
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- 666ffdd: Change theme provider styles for editing panel and class manager panel
|
|
21
|
+
|
|
3
22
|
## 0.5.0
|
|
4
23
|
|
|
5
24
|
### Minor Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React$1 from 'react';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
2
3
|
import { MenuItemProps } from '@elementor/ui';
|
|
3
4
|
|
|
4
5
|
type EllipsisWithTooltipProps<T extends React$1.ElementType> = {
|
|
@@ -13,13 +14,35 @@ declare const EditableField: React$1.ForwardRefExoticComponent<Omit<any, "ref">
|
|
|
13
14
|
type IntroductionModalProps = {
|
|
14
15
|
open: boolean;
|
|
15
16
|
handleClose: (shouldShowAgain: boolean) => void;
|
|
16
|
-
title
|
|
17
|
+
title?: string;
|
|
17
18
|
content: React$1.ReactNode;
|
|
19
|
+
image?: {
|
|
20
|
+
src: string;
|
|
21
|
+
alt: string;
|
|
22
|
+
};
|
|
18
23
|
};
|
|
19
|
-
declare const IntroductionModal: ({ open, handleClose, title, content }: IntroductionModalProps) => React$1.JSX.Element;
|
|
24
|
+
declare const IntroductionModal: ({ open, handleClose, title, content, image }: IntroductionModalProps) => React$1.JSX.Element;
|
|
25
|
+
|
|
26
|
+
declare function ThemeProvider({ children }: {
|
|
27
|
+
children: React$1.ReactNode;
|
|
28
|
+
}): React$1.JSX.Element;
|
|
20
29
|
|
|
21
30
|
declare const MenuListItem: ({ children, ...props }: MenuItemProps) => React$1.JSX.Element;
|
|
22
31
|
|
|
32
|
+
type InfoTipCardProps = {
|
|
33
|
+
content: ReactNode;
|
|
34
|
+
svgIcon: ReactNode;
|
|
35
|
+
learnMoreButton?: {
|
|
36
|
+
label: string;
|
|
37
|
+
href: string;
|
|
38
|
+
};
|
|
39
|
+
ctaButton?: {
|
|
40
|
+
label: string;
|
|
41
|
+
onClick: () => void;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
declare const InfoTipCard: ({ content, svgIcon, learnMoreButton, ctaButton }: InfoTipCardProps) => React$1.JSX.Element;
|
|
45
|
+
|
|
23
46
|
type UseEditableParams = {
|
|
24
47
|
value: string;
|
|
25
48
|
onSubmit: (value: string) => unknown;
|
|
@@ -45,4 +68,4 @@ declare const useEditable: ({ value, onSubmit, validation, onClick }: UseEditabl
|
|
|
45
68
|
};
|
|
46
69
|
};
|
|
47
70
|
|
|
48
|
-
export { EditableField, EllipsisWithTooltip, IntroductionModal, MenuListItem, useEditable };
|
|
71
|
+
export { EditableField, EllipsisWithTooltip, InfoTipCard, IntroductionModal, MenuListItem, ThemeProvider, useEditable };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React$1 from 'react';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
2
3
|
import { MenuItemProps } from '@elementor/ui';
|
|
3
4
|
|
|
4
5
|
type EllipsisWithTooltipProps<T extends React$1.ElementType> = {
|
|
@@ -13,13 +14,35 @@ declare const EditableField: React$1.ForwardRefExoticComponent<Omit<any, "ref">
|
|
|
13
14
|
type IntroductionModalProps = {
|
|
14
15
|
open: boolean;
|
|
15
16
|
handleClose: (shouldShowAgain: boolean) => void;
|
|
16
|
-
title
|
|
17
|
+
title?: string;
|
|
17
18
|
content: React$1.ReactNode;
|
|
19
|
+
image?: {
|
|
20
|
+
src: string;
|
|
21
|
+
alt: string;
|
|
22
|
+
};
|
|
18
23
|
};
|
|
19
|
-
declare const IntroductionModal: ({ open, handleClose, title, content }: IntroductionModalProps) => React$1.JSX.Element;
|
|
24
|
+
declare const IntroductionModal: ({ open, handleClose, title, content, image }: IntroductionModalProps) => React$1.JSX.Element;
|
|
25
|
+
|
|
26
|
+
declare function ThemeProvider({ children }: {
|
|
27
|
+
children: React$1.ReactNode;
|
|
28
|
+
}): React$1.JSX.Element;
|
|
20
29
|
|
|
21
30
|
declare const MenuListItem: ({ children, ...props }: MenuItemProps) => React$1.JSX.Element;
|
|
22
31
|
|
|
32
|
+
type InfoTipCardProps = {
|
|
33
|
+
content: ReactNode;
|
|
34
|
+
svgIcon: ReactNode;
|
|
35
|
+
learnMoreButton?: {
|
|
36
|
+
label: string;
|
|
37
|
+
href: string;
|
|
38
|
+
};
|
|
39
|
+
ctaButton?: {
|
|
40
|
+
label: string;
|
|
41
|
+
onClick: () => void;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
declare const InfoTipCard: ({ content, svgIcon, learnMoreButton, ctaButton }: InfoTipCardProps) => React$1.JSX.Element;
|
|
45
|
+
|
|
23
46
|
type UseEditableParams = {
|
|
24
47
|
value: string;
|
|
25
48
|
onSubmit: (value: string) => unknown;
|
|
@@ -45,4 +68,4 @@ declare const useEditable: ({ value, onSubmit, validation, onClick }: UseEditabl
|
|
|
45
68
|
};
|
|
46
69
|
};
|
|
47
70
|
|
|
48
|
-
export { EditableField, EllipsisWithTooltip, IntroductionModal, MenuListItem, useEditable };
|
|
71
|
+
export { EditableField, EllipsisWithTooltip, InfoTipCard, IntroductionModal, MenuListItem, ThemeProvider, useEditable };
|
package/dist/index.js
CHANGED
|
@@ -32,8 +32,10 @@ var index_exports = {};
|
|
|
32
32
|
__export(index_exports, {
|
|
33
33
|
EditableField: () => EditableField,
|
|
34
34
|
EllipsisWithTooltip: () => EllipsisWithTooltip,
|
|
35
|
+
InfoTipCard: () => InfoTipCard,
|
|
35
36
|
IntroductionModal: () => IntroductionModal,
|
|
36
37
|
MenuListItem: () => MenuListItem,
|
|
38
|
+
ThemeProvider: () => ThemeProvider,
|
|
37
39
|
useEditable: () => useEditable
|
|
38
40
|
});
|
|
39
41
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -104,7 +106,7 @@ var import_react3 = require("react");
|
|
|
104
106
|
var import_ui3 = require("@elementor/ui");
|
|
105
107
|
var import_i18n = require("@wordpress/i18n");
|
|
106
108
|
var OPEN_DELAY = 1e3;
|
|
107
|
-
var IntroductionModal = ({ open, handleClose, title, content }) => {
|
|
109
|
+
var IntroductionModal = ({ open, handleClose, title, content, image }) => {
|
|
108
110
|
const [shouldShowAgain, setShouldShowAgain] = (0, import_react3.useState)(true);
|
|
109
111
|
return /* @__PURE__ */ React3.createElement(
|
|
110
112
|
import_ui3.Dialog,
|
|
@@ -117,7 +119,8 @@ var IntroductionModal = ({ open, handleClose, title, content }) => {
|
|
|
117
119
|
style: { transitionDelay: open ? `${OPEN_DELAY}ms` : "0ms" }
|
|
118
120
|
}
|
|
119
121
|
},
|
|
120
|
-
/* @__PURE__ */ React3.createElement(import_ui3.DialogHeader, { logo: false }, /* @__PURE__ */ React3.createElement(import_ui3.DialogTitle, null, title)),
|
|
122
|
+
title && /* @__PURE__ */ React3.createElement(import_ui3.DialogHeader, { logo: false }, /* @__PURE__ */ React3.createElement(import_ui3.DialogTitle, null, title)),
|
|
123
|
+
image && /* @__PURE__ */ React3.createElement(import_ui3.Image, { sx: { width: "100%" }, src: image.src, alt: image.alt }),
|
|
121
124
|
content,
|
|
122
125
|
/* @__PURE__ */ React3.createElement(import_ui3.DialogActions, null, /* @__PURE__ */ React3.createElement(
|
|
123
126
|
import_ui3.FormControlLabel,
|
|
@@ -130,40 +133,92 @@ var IntroductionModal = ({ open, handleClose, title, content }) => {
|
|
|
130
133
|
onChange: () => setShouldShowAgain(!shouldShowAgain)
|
|
131
134
|
}
|
|
132
135
|
),
|
|
133
|
-
label: (0, import_i18n.__)("Don't show this again", "elementor")
|
|
136
|
+
label: /* @__PURE__ */ React3.createElement(import_ui3.Typography, { variant: "body2" }, (0, import_i18n.__)("Don't show this again", "elementor"))
|
|
134
137
|
}
|
|
135
|
-
), /* @__PURE__ */ React3.createElement(
|
|
138
|
+
), /* @__PURE__ */ React3.createElement(
|
|
139
|
+
import_ui3.Button,
|
|
140
|
+
{
|
|
141
|
+
size: "medium",
|
|
142
|
+
variant: "contained",
|
|
143
|
+
sx: { minWidth: "135px" },
|
|
144
|
+
onClick: () => handleClose(shouldShowAgain)
|
|
145
|
+
},
|
|
146
|
+
(0, import_i18n.__)("Got it", "elementor")
|
|
147
|
+
))
|
|
136
148
|
);
|
|
137
149
|
};
|
|
138
150
|
|
|
139
|
-
// src/components/
|
|
151
|
+
// src/components/theme-provider.tsx
|
|
140
152
|
var React4 = __toESM(require("react"));
|
|
141
153
|
var import_ui4 = require("@elementor/ui");
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
},
|
|
151
|
-
|
|
152
|
-
|
|
154
|
+
|
|
155
|
+
// src/hooks/use-color-scheme.ts
|
|
156
|
+
var import_react4 = require("react");
|
|
157
|
+
var import_editor_v1_adapters = require("@elementor/editor-v1-adapters");
|
|
158
|
+
function useColorScheme() {
|
|
159
|
+
const [colorScheme, setColorScheme] = (0, import_react4.useState)(() => getV1ColorScheme());
|
|
160
|
+
(0, import_react4.useEffect)(() => {
|
|
161
|
+
return (0, import_editor_v1_adapters.__privateListenTo)((0, import_editor_v1_adapters.v1ReadyEvent)(), () => setColorScheme(getV1ColorScheme()));
|
|
162
|
+
}, []);
|
|
163
|
+
(0, import_react4.useEffect)(() => {
|
|
164
|
+
return (0, import_editor_v1_adapters.__privateListenTo)((0, import_editor_v1_adapters.commandEndEvent)("document/elements/settings"), (e) => {
|
|
165
|
+
const event = e;
|
|
166
|
+
const isColorScheme = event.args?.settings && "ui_theme" in event.args.settings;
|
|
167
|
+
if (isColorScheme) {
|
|
168
|
+
setColorScheme(getV1ColorScheme());
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
}, []);
|
|
172
|
+
return colorScheme;
|
|
173
|
+
}
|
|
174
|
+
function getV1ColorScheme() {
|
|
175
|
+
return window.elementor?.getPreferences?.("ui_theme") || "auto";
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// src/components/theme-provider.tsx
|
|
179
|
+
var EDITOR_PALLETTE = "unstable";
|
|
180
|
+
function ThemeProvider({ children }) {
|
|
181
|
+
const colorScheme = useColorScheme();
|
|
182
|
+
return /* @__PURE__ */ React4.createElement(import_ui4.ThemeProvider, { colorScheme, palette: EDITOR_PALLETTE }, children);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// src/components/menu-item.tsx
|
|
186
|
+
var React5 = __toESM(require("react"));
|
|
187
|
+
var import_ui5 = require("@elementor/ui");
|
|
188
|
+
var MenuListItem = ({ children, ...props }) => {
|
|
189
|
+
return /* @__PURE__ */ React5.createElement(
|
|
190
|
+
import_ui5.MenuItem,
|
|
153
191
|
{
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
192
|
+
dense: true,
|
|
193
|
+
...props,
|
|
194
|
+
sx: {
|
|
195
|
+
...props.sx ?? {}
|
|
157
196
|
}
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
|
|
197
|
+
},
|
|
198
|
+
/* @__PURE__ */ React5.createElement(
|
|
199
|
+
import_ui5.MenuItemText,
|
|
200
|
+
{
|
|
201
|
+
primary: children,
|
|
202
|
+
primaryTypographyProps: {
|
|
203
|
+
variant: "caption"
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
)
|
|
207
|
+
);
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
// src/components/infotip-card.tsx
|
|
211
|
+
var React6 = __toESM(require("react"));
|
|
212
|
+
var import_ui6 = require("@elementor/ui");
|
|
213
|
+
var InfoTipCard = ({ content, svgIcon, learnMoreButton, ctaButton }) => {
|
|
214
|
+
return /* @__PURE__ */ React6.createElement(import_ui6.Card, { elevation: 0, sx: { width: 320 } }, /* @__PURE__ */ React6.createElement(import_ui6.CardContent, { sx: { pb: 0 } }, /* @__PURE__ */ React6.createElement(import_ui6.Box, { display: "flex", alignItems: "start" }, /* @__PURE__ */ React6.createElement(import_ui6.SvgIcon, { fontSize: "tiny", sx: { mr: 0.5 } }, svgIcon), /* @__PURE__ */ React6.createElement(import_ui6.Typography, { variant: "body2" }, content))), (ctaButton || learnMoreButton) && /* @__PURE__ */ React6.createElement(import_ui6.CardActions, null, learnMoreButton && /* @__PURE__ */ React6.createElement(import_ui6.Button, { size: "small", color: "warning", href: learnMoreButton.href, target: "_blank" }, learnMoreButton.label), ctaButton && /* @__PURE__ */ React6.createElement(import_ui6.Button, { size: "small", color: "warning", variant: "contained", onClick: ctaButton.onClick }, ctaButton.label)));
|
|
215
|
+
};
|
|
161
216
|
|
|
162
217
|
// src/hooks/use-editable.ts
|
|
163
|
-
var
|
|
218
|
+
var import_react5 = require("react");
|
|
164
219
|
var useEditable = ({ value, onSubmit, validation, onClick }) => {
|
|
165
|
-
const [isEditing, setIsEditing] = (0,
|
|
166
|
-
const [error, setError] = (0,
|
|
220
|
+
const [isEditing, setIsEditing] = (0, import_react5.useState)(false);
|
|
221
|
+
const [error, setError] = (0, import_react5.useState)(null);
|
|
167
222
|
const ref = useSelection(isEditing);
|
|
168
223
|
const isDirty = (newValue) => newValue !== value;
|
|
169
224
|
const openEditMode = () => {
|
|
@@ -233,8 +288,8 @@ var useEditable = ({ value, onSubmit, validation, onClick }) => {
|
|
|
233
288
|
};
|
|
234
289
|
};
|
|
235
290
|
var useSelection = (isEditing) => {
|
|
236
|
-
const ref = (0,
|
|
237
|
-
(0,
|
|
291
|
+
const ref = (0, import_react5.useRef)(null);
|
|
292
|
+
(0, import_react5.useEffect)(() => {
|
|
238
293
|
if (isEditing) {
|
|
239
294
|
selectAll(ref.current);
|
|
240
295
|
}
|
|
@@ -255,8 +310,10 @@ var selectAll = (el) => {
|
|
|
255
310
|
0 && (module.exports = {
|
|
256
311
|
EditableField,
|
|
257
312
|
EllipsisWithTooltip,
|
|
313
|
+
InfoTipCard,
|
|
258
314
|
IntroductionModal,
|
|
259
315
|
MenuListItem,
|
|
316
|
+
ThemeProvider,
|
|
260
317
|
useEditable
|
|
261
318
|
});
|
|
262
319
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/components/ellipsis-with-tooltip.tsx","../src/components/editable-field.tsx","../src/components/introduction-modal.tsx","../src/components/menu-item.tsx","../src/hooks/use-editable.ts"],"sourcesContent":["// components\nexport { EllipsisWithTooltip } from './components/ellipsis-with-tooltip';\nexport { EditableField } from './components/editable-field';\nexport { IntroductionModal } from './components/introduction-modal';\nexport { MenuListItem } from './components/menu-item';\n\n// hooks\nexport { useEditable } from './hooks/use-editable';\n","import * as React from 'react';\nimport { useEffect, useState } from 'react';\nimport { Box, Tooltip } from '@elementor/ui';\n\ntype EllipsisWithTooltipProps< T extends React.ElementType > = {\n\tmaxWidth?: React.CSSProperties[ 'maxWidth' ];\n\ttitle: string;\n\tas?: T;\n} & React.ComponentProps< T >;\n\nexport const EllipsisWithTooltip = < T extends React.ElementType >( {\n\tmaxWidth,\n\ttitle,\n\tas,\n\t...props\n}: EllipsisWithTooltipProps< T > ) => {\n\tconst [ setRef, isOverflowing ] = useIsOverflowing();\n\n\tif ( isOverflowing ) {\n\t\treturn (\n\t\t\t<Tooltip title={ title } placement=\"top\">\n\t\t\t\t<Content maxWidth={ maxWidth } ref={ setRef } as={ as } { ...props }>\n\t\t\t\t\t{ title }\n\t\t\t\t</Content>\n\t\t\t</Tooltip>\n\t\t);\n\t}\n\n\treturn (\n\t\t<Content maxWidth={ maxWidth } ref={ setRef } as={ as } { ...props }>\n\t\t\t{ title }\n\t\t</Content>\n\t);\n};\n\ntype ContentProps< T extends React.ElementType > = React.PropsWithChildren<\n\tOmit< EllipsisWithTooltipProps< T >, 'title' >\n>;\n\nconst Content = React.forwardRef(\n\t< T extends React.ElementType >(\n\t\t{ maxWidth, as: Component = Box, ...props }: ContentProps< T >,\n\t\t// forwardRef loses the typing when using generic components.\n\t\tref: unknown\n\t) => (\n\t\t<Component\n\t\t\tref={ ref }\n\t\t\tposition=\"relative\"\n\t\t\t{ ...props }\n\t\t\tstyle={ { overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', maxWidth } }\n\t\t/>\n\t)\n);\n\nconst useIsOverflowing = () => {\n\tconst [ el, setEl ] = useState< HTMLElement | null >( null );\n\tconst [ isOverflowing, setIsOverflown ] = useState( false );\n\n\tuseEffect( () => {\n\t\tconst observer = new ResizeObserver( ( [ { target } ] ) => {\n\t\t\tsetIsOverflown( target.scrollWidth > target.clientWidth );\n\t\t} );\n\n\t\tif ( el ) {\n\t\t\tobserver.observe( el );\n\t\t}\n\n\t\treturn () => {\n\t\t\tobserver.disconnect();\n\t\t};\n\t}, [ el ] );\n\n\treturn [ setEl, isOverflowing ] as const;\n};\n","import * as React from 'react';\nimport { forwardRef } from 'react';\nimport { Box, styled, Tooltip } from '@elementor/ui';\n\ntype EditableFieldProps< T extends React.ElementType > = {\n\tvalue: string;\n\terror?: string;\n\tas?: T;\n} & React.ComponentPropsWithRef< T >;\n\nexport const EditableField = forwardRef(\n\t< T extends React.ElementType >(\n\t\t{ value, error, as = 'span', sx, ...props }: EditableFieldProps< T >,\n\t\tref: unknown\n\t) => {\n\t\treturn (\n\t\t\t<Tooltip title={ error } open={ !! error } placement=\"top\">\n\t\t\t\t<StyledField ref={ ref } component={ as } { ...props }>\n\t\t\t\t\t{ value }\n\t\t\t\t</StyledField>\n\t\t\t</Tooltip>\n\t\t);\n\t}\n);\n\nconst StyledField = styled( Box )`\n\twidth: 100%;\n\t&:focus {\n\t\toutline: none;\n\t}\n`;\n","import * as React from 'react';\nimport { useState } from 'react';\nimport { Button, Checkbox, Dialog, DialogActions, DialogHeader, DialogTitle, FormControlLabel } from '@elementor/ui';\nimport { __ } from '@wordpress/i18n';\n\ntype IntroductionModalProps = {\n\topen: boolean;\n\thandleClose: ( shouldShowAgain: boolean ) => void;\n\ttitle: string;\n\tcontent: React.ReactNode;\n};\n\nconst OPEN_DELAY = 1000;\n\nexport const IntroductionModal = ( { open, handleClose, title, content }: IntroductionModalProps ) => {\n\tconst [ shouldShowAgain, setShouldShowAgain ] = useState( true );\n\n\treturn (\n\t\t<Dialog\n\t\t\topen={ open }\n\t\t\tonClose={ handleClose }\n\t\t\tmaxWidth={ 'sm' }\n\t\t\tTransitionProps={ {\n\t\t\t\ttimeout: 700,\n\t\t\t\tstyle: { transitionDelay: open ? `${ OPEN_DELAY }ms` : '0ms' },\n\t\t\t} }\n\t\t>\n\t\t\t<DialogHeader logo={ false }>\n\t\t\t\t<DialogTitle>{ title }</DialogTitle>\n\t\t\t</DialogHeader>\n\t\t\t{ content }\n\t\t\t<DialogActions>\n\t\t\t\t<FormControlLabel\n\t\t\t\t\tsx={ { marginRight: 'auto' } }\n\t\t\t\t\tcontrol={\n\t\t\t\t\t\t<Checkbox\n\t\t\t\t\t\t\tchecked={ ! shouldShowAgain }\n\t\t\t\t\t\t\tonChange={ () => setShouldShowAgain( ! shouldShowAgain ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t}\n\t\t\t\t\tlabel={ __( \"Don't show this again\", 'elementor' ) }\n\t\t\t\t/>\n\t\t\t\t<Button size={ 'medium' } onClick={ () => handleClose( shouldShowAgain ) } variant=\"contained\">\n\t\t\t\t\t{ __( 'Got it', 'elementor' ) }\n\t\t\t\t</Button>\n\t\t\t</DialogActions>\n\t\t</Dialog>\n\t);\n};\n","import * as React from 'react';\nimport { MenuItem, type MenuItemProps, MenuItemText } from '@elementor/ui';\n\nexport const MenuListItem = ( { children, ...props }: MenuItemProps ) => (\n\t<MenuItem\n\t\tdense\n\t\t{ ...props }\n\t\tsx={ {\n\t\t\t...( props.sx ?? {} ),\n\t\t} }\n\t>\n\t\t<MenuItemText\n\t\t\tprimary={ children }\n\t\t\tprimaryTypographyProps={ {\n\t\t\t\tvariant: 'caption',\n\t\t\t} }\n\t\t/>\n\t</MenuItem>\n);\n","import { useEffect, useRef, useState } from 'react';\n\ntype UseEditableParams = {\n\tvalue: string;\n\tonSubmit: ( value: string ) => unknown;\n\tvalidation?: ( value: string ) => string | null;\n\tonClick?: ( event: React.MouseEvent< HTMLDivElement > ) => void;\n};\n\nexport const useEditable = ( { value, onSubmit, validation, onClick }: UseEditableParams ) => {\n\tconst [ isEditing, setIsEditing ] = useState( false );\n\tconst [ error, setError ] = useState< string | null >( null );\n\n\tconst ref = useSelection( isEditing );\n\n\tconst isDirty = ( newValue: string ) => newValue !== value;\n\n\tconst openEditMode = () => {\n\t\tsetIsEditing( true );\n\t};\n\n\tconst closeEditMode = () => {\n\t\tref.current?.blur();\n\n\t\tsetError( null );\n\t\tsetIsEditing( false );\n\t};\n\n\tconst submit = ( newValue: string ) => {\n\t\tif ( ! isDirty( newValue ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( ! error ) {\n\t\t\ttry {\n\t\t\t\tonSubmit( newValue );\n\t\t\t} finally {\n\t\t\t\tcloseEditMode();\n\t\t\t}\n\t\t}\n\t};\n\n\tconst onChange = ( event: React.ChangeEvent< HTMLSpanElement > ) => {\n\t\tconst { innerText: newValue } = event.target;\n\n\t\tif ( validation ) {\n\t\t\tsetError( isDirty( newValue ) ? validation( newValue ) : null );\n\t\t}\n\t};\n\n\tconst handleKeyDown = ( event: React.KeyboardEvent ) => {\n\t\tevent.stopPropagation();\n\n\t\tif ( [ 'Escape' ].includes( event.key ) ) {\n\t\t\treturn closeEditMode();\n\t\t}\n\n\t\tif ( [ 'Enter' ].includes( event.key ) ) {\n\t\t\tevent.preventDefault();\n\t\t\treturn submit( ( event.target as HTMLElement ).innerText );\n\t\t}\n\t};\n\n\tconst handleClick = ( event: React.MouseEvent< HTMLDivElement > ) => {\n\t\tif ( isEditing ) {\n\t\t\tevent.stopPropagation();\n\t\t}\n\n\t\tonClick?.( event );\n\t};\n\n\tconst listeners = {\n\t\tonClick: handleClick,\n\t\tonKeyDown: handleKeyDown,\n\t\tonInput: onChange,\n\t\tonBlur: closeEditMode,\n\t} as const;\n\n\tconst attributes = {\n\t\tvalue,\n\t\trole: 'textbox',\n\t\tcontentEditable: isEditing,\n\t\t...( isEditing && {\n\t\t\tsuppressContentEditableWarning: true,\n\t\t} ),\n\t} as const;\n\n\treturn {\n\t\tref,\n\t\tisEditing,\n\t\topenEditMode,\n\t\tcloseEditMode,\n\t\tvalue,\n\t\terror,\n\t\tgetProps: () => ( { ...listeners, ...attributes } ),\n\t} as const;\n};\n\nconst useSelection = ( isEditing: boolean ) => {\n\tconst ref = useRef< HTMLElement | null >( null );\n\n\tuseEffect( () => {\n\t\tif ( isEditing ) {\n\t\t\tselectAll( ref.current );\n\t\t}\n\t}, [ isEditing ] );\n\n\treturn ref;\n};\n\nconst selectAll = ( el: HTMLElement | null ) => {\n\tconst selection = getSelection();\n\n\tif ( ! selection || ! el ) {\n\t\treturn;\n\t}\n\n\tconst range = document.createRange();\n\trange.selectNodeContents( el );\n\n\tselection.removeAllRanges();\n\tselection.addRange( range );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;AACvB,mBAAoC;AACpC,gBAA6B;AAQtB,IAAM,sBAAsB,CAAiC;AAAA,EACnE;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACJ,MAAsC;AACrC,QAAM,CAAE,QAAQ,aAAc,IAAI,iBAAiB;AAEnD,MAAK,eAAgB;AACpB,WACC,oCAAC,qBAAQ,OAAgB,WAAU,SAClC,oCAAC,WAAQ,UAAsB,KAAM,QAAS,IAAY,GAAG,SAC1D,KACH,CACD;AAAA,EAEF;AAEA,SACC,oCAAC,WAAQ,UAAsB,KAAM,QAAS,IAAY,GAAG,SAC1D,KACH;AAEF;AAMA,IAAM,UAAgB;AAAA,EACrB,CACC,EAAE,UAAU,IAAI,YAAY,eAAK,GAAG,MAAM,GAE1C,QAEA;AAAA,IAAC;AAAA;AAAA,MACA;AAAA,MACA,UAAS;AAAA,MACP,GAAG;AAAA,MACL,OAAQ,EAAE,UAAU,UAAU,cAAc,YAAY,YAAY,UAAU,SAAS;AAAA;AAAA,EACxF;AAEF;AAEA,IAAM,mBAAmB,MAAM;AAC9B,QAAM,CAAE,IAAI,KAAM,QAAI,uBAAgC,IAAK;AAC3D,QAAM,CAAE,eAAe,cAAe,QAAI,uBAAU,KAAM;AAE1D,8BAAW,MAAM;AAChB,UAAM,WAAW,IAAI,eAAgB,CAAE,CAAE,EAAE,OAAO,CAAE,MAAO;AAC1D,qBAAgB,OAAO,cAAc,OAAO,WAAY;AAAA,IACzD,CAAE;AAEF,QAAK,IAAK;AACT,eAAS,QAAS,EAAG;AAAA,IACtB;AAEA,WAAO,MAAM;AACZ,eAAS,WAAW;AAAA,IACrB;AAAA,EACD,GAAG,CAAE,EAAG,CAAE;AAEV,SAAO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tB,QAAK,CAAE,QAAS,EAAE,SAAU,MAAM,GAAI,GAAI;AACzC,aAAO,cAAc;AAAA,IACtB;AAEA,QAAK,CAAE,OAAQ,EAAE,SAAU,MAAM,GAAI,GAAI;AACxC,YAAM,eAAe;AACrB,aAAO,OAAU,MAAM,OAAwB,SAAU;AAAA,IAC1D;AAAA,EACD;AAEA,QAAM,cAAc,CAAE,UAA+C;AACpE,QAAK,WAAY;AAChB,YAAM,gBAAgB;AAAA,IACvB;AAEA,cAAW,KAAM;AAAA,EAClB;AAEA,QAAM,YAAY;AAAA,IACjB,SAAS;AAAA,IACT,WAAW;AAAA,IACX,SAAS;AAAA,IACT,QAAQ;AAAA,EACT;AAEA,QAAM,aAAa;AAAA,IAClB;AAAA,IACA,MAAM;AAAA,IACN,iBAAiB;AAAA,IACjB,GAAK,aAAa;AAAA,MACjB,gCAAgC;AAAA,IACjC;AAAA,EACD;AAEA,SAAO;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,UAAU,OAAQ,EAAE,GAAG,WAAW,GAAG,WAAW;AAAA,EACjD;AACD;AAEA,IAAM,eAAe,CAAE,cAAwB;AAC9C,QAAM,UAAM,sBAA8B,IAAK;AAE/C,+BAAW,MAAM;AAChB,QAAK,WAAY;AAChB,gBAAW,IAAI,OAAQ;AAAA,IACxB;AAAA,EACD,GAAG,CAAE,SAAU,CAAE;AAEjB,SAAO;AACR;AAEA,IAAM,YAAY,CAAE,OAA4B;AAC/C,QAAM,YAAY,aAAa;AAE/B,MAAK,CAAE,aAAa,CAAE,IAAK;AAC1B;AAAA,EACD;AAEA,QAAM,QAAQ,SAAS,YAAY;AACnC,QAAM,mBAAoB,EAAG;AAE7B,YAAU,gBAAgB;AAC1B,YAAU,SAAU,KAAM;AAC3B;","names":["React","import_react","import_ui","React","import_react","import_ui","React","import_ui","import_react"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/components/ellipsis-with-tooltip.tsx","../src/components/editable-field.tsx","../src/components/introduction-modal.tsx","../src/components/theme-provider.tsx","../src/hooks/use-color-scheme.ts","../src/components/menu-item.tsx","../src/components/infotip-card.tsx","../src/hooks/use-editable.ts"],"sourcesContent":["// components\nexport { EllipsisWithTooltip } from './components/ellipsis-with-tooltip';\nexport { EditableField } from './components/editable-field';\nexport { IntroductionModal } from './components/introduction-modal';\nexport { default as ThemeProvider } from './components/theme-provider';\nexport { MenuListItem } from './components/menu-item';\nexport { InfoTipCard } from './components/infotip-card';\n\n// hooks\nexport { useEditable } from './hooks/use-editable';\n","import * as React from 'react';\nimport { useEffect, useState } from 'react';\nimport { Box, Tooltip } from '@elementor/ui';\n\ntype EllipsisWithTooltipProps< T extends React.ElementType > = {\n\tmaxWidth?: React.CSSProperties[ 'maxWidth' ];\n\ttitle: string;\n\tas?: T;\n} & React.ComponentProps< T >;\n\nexport const EllipsisWithTooltip = < T extends React.ElementType >( {\n\tmaxWidth,\n\ttitle,\n\tas,\n\t...props\n}: EllipsisWithTooltipProps< T > ) => {\n\tconst [ setRef, isOverflowing ] = useIsOverflowing();\n\n\tif ( isOverflowing ) {\n\t\treturn (\n\t\t\t<Tooltip title={ title } placement=\"top\">\n\t\t\t\t<Content maxWidth={ maxWidth } ref={ setRef } as={ as } { ...props }>\n\t\t\t\t\t{ title }\n\t\t\t\t</Content>\n\t\t\t</Tooltip>\n\t\t);\n\t}\n\n\treturn (\n\t\t<Content maxWidth={ maxWidth } ref={ setRef } as={ as } { ...props }>\n\t\t\t{ title }\n\t\t</Content>\n\t);\n};\n\ntype ContentProps< T extends React.ElementType > = React.PropsWithChildren<\n\tOmit< EllipsisWithTooltipProps< T >, 'title' >\n>;\n\nconst Content = React.forwardRef(\n\t< T extends React.ElementType >(\n\t\t{ maxWidth, as: Component = Box, ...props }: ContentProps< T >,\n\t\t// forwardRef loses the typing when using generic components.\n\t\tref: unknown\n\t) => (\n\t\t<Component\n\t\t\tref={ ref }\n\t\t\tposition=\"relative\"\n\t\t\t{ ...props }\n\t\t\tstyle={ { overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', maxWidth } }\n\t\t/>\n\t)\n);\n\nconst useIsOverflowing = () => {\n\tconst [ el, setEl ] = useState< HTMLElement | null >( null );\n\tconst [ isOverflowing, setIsOverflown ] = useState( false );\n\n\tuseEffect( () => {\n\t\tconst observer = new ResizeObserver( ( [ { target } ] ) => {\n\t\t\tsetIsOverflown( target.scrollWidth > target.clientWidth );\n\t\t} );\n\n\t\tif ( el ) {\n\t\t\tobserver.observe( el );\n\t\t}\n\n\t\treturn () => {\n\t\t\tobserver.disconnect();\n\t\t};\n\t}, [ el ] );\n\n\treturn [ setEl, isOverflowing ] as const;\n};\n","import * as React from 'react';\nimport { forwardRef } from 'react';\nimport { Box, styled, Tooltip } from '@elementor/ui';\n\ntype EditableFieldProps< T extends React.ElementType > = {\n\tvalue: string;\n\terror?: string;\n\tas?: T;\n} & React.ComponentPropsWithRef< T >;\n\nexport const EditableField = forwardRef(\n\t< T extends React.ElementType >(\n\t\t{ value, error, as = 'span', sx, ...props }: EditableFieldProps< T >,\n\t\tref: unknown\n\t) => {\n\t\treturn (\n\t\t\t<Tooltip title={ error } open={ !! error } placement=\"top\">\n\t\t\t\t<StyledField ref={ ref } component={ as } { ...props }>\n\t\t\t\t\t{ value }\n\t\t\t\t</StyledField>\n\t\t\t</Tooltip>\n\t\t);\n\t}\n);\n\nconst StyledField = styled( Box )`\n\twidth: 100%;\n\t&:focus {\n\t\toutline: none;\n\t}\n`;\n","import * as React from 'react';\nimport { useState } from 'react';\nimport {\n\tButton,\n\tCheckbox,\n\tDialog,\n\tDialogActions,\n\tDialogHeader,\n\tDialogTitle,\n\tFormControlLabel,\n\tImage,\n\tTypography,\n} from '@elementor/ui';\nimport { __ } from '@wordpress/i18n';\n\ntype IntroductionModalProps = {\n\topen: boolean;\n\thandleClose: ( shouldShowAgain: boolean ) => void;\n\ttitle?: string;\n\tcontent: React.ReactNode;\n\timage?: {\n\t\tsrc: string;\n\t\talt: string;\n\t};\n};\n\nconst OPEN_DELAY = 1000;\n\nexport const IntroductionModal = ( { open, handleClose, title, content, image }: IntroductionModalProps ) => {\n\tconst [ shouldShowAgain, setShouldShowAgain ] = useState( true );\n\n\treturn (\n\t\t<Dialog\n\t\t\topen={ open }\n\t\t\tonClose={ handleClose }\n\t\t\tmaxWidth={ 'sm' }\n\t\t\tTransitionProps={ {\n\t\t\t\ttimeout: 700,\n\t\t\t\tstyle: { transitionDelay: open ? `${ OPEN_DELAY }ms` : '0ms' },\n\t\t\t} }\n\t\t>\n\t\t\t{ title && (\n\t\t\t\t<DialogHeader logo={ false }>\n\t\t\t\t\t<DialogTitle>{ title }</DialogTitle>\n\t\t\t\t</DialogHeader>\n\t\t\t) }\n\t\t\t{ image && <Image sx={ { width: '100%' } } src={ image.src } alt={ image.alt } /> }\n\t\t\t{ content }\n\t\t\t<DialogActions>\n\t\t\t\t<FormControlLabel\n\t\t\t\t\tsx={ { marginRight: 'auto' } }\n\t\t\t\t\tcontrol={\n\t\t\t\t\t\t<Checkbox\n\t\t\t\t\t\t\tchecked={ ! shouldShowAgain }\n\t\t\t\t\t\t\tonChange={ () => setShouldShowAgain( ! shouldShowAgain ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t}\n\t\t\t\t\tlabel={\n\t\t\t\t\t\t<Typography variant={ 'body2' }>{ __( \"Don't show this again\", 'elementor' ) }</Typography>\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t<Button\n\t\t\t\t\tsize={ 'medium' }\n\t\t\t\t\tvariant=\"contained\"\n\t\t\t\t\tsx={ { minWidth: '135px' } }\n\t\t\t\t\tonClick={ () => handleClose( shouldShowAgain ) }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Got it', 'elementor' ) }\n\t\t\t\t</Button>\n\t\t\t</DialogActions>\n\t\t</Dialog>\n\t);\n};\n","import * as React from 'react';\nimport { ThemeProvider as ThemeProviderBase, type ThemeProviderProps } from '@elementor/ui';\n\nimport { useColorScheme } from '../hooks/use-color-scheme';\n\nconst EDITOR_PALLETTE: ThemeProviderProps[ 'palette' ] = 'unstable';\n\nexport default function ThemeProvider( { children }: { children: React.ReactNode } ) {\n\tconst colorScheme = useColorScheme();\n\n\treturn (\n\t\t<ThemeProviderBase colorScheme={ colorScheme } palette={ EDITOR_PALLETTE }>\n\t\t\t{ children }\n\t\t</ThemeProviderBase>\n\t);\n}\n","import { useEffect, useState } from 'react';\nimport {\n\t__privateListenTo as listenTo,\n\tcommandEndEvent,\n\ttype CommandEvent,\n\tv1ReadyEvent,\n} from '@elementor/editor-v1-adapters';\n\nexport type ColorScheme = 'auto' | 'dark' | 'light';\n\nexport type ExtendedWindow = Window & {\n\telementor: {\n\t\tgetPreferences: ( key: 'ui_theme' ) => ColorScheme;\n\t};\n};\n\nexport function useColorScheme() {\n\tconst [ colorScheme, setColorScheme ] = useState< ColorScheme >( () => getV1ColorScheme() );\n\n\tuseEffect( () => {\n\t\treturn listenTo( v1ReadyEvent(), () => setColorScheme( getV1ColorScheme() ) );\n\t}, [] );\n\n\tuseEffect( () => {\n\t\treturn listenTo( commandEndEvent( 'document/elements/settings' ), ( e ) => {\n\t\t\tconst event = e as CommandEvent< {\n\t\t\t\tsettings: {\n\t\t\t\t\tui_theme?: ColorScheme;\n\t\t\t\t};\n\t\t\t} >;\n\n\t\t\t// The User-Preferences settings object has a key named `ui_theme` that controls the color scheme.\n\t\t\tconst isColorScheme = event.args?.settings && 'ui_theme' in event.args.settings;\n\n\t\t\tif ( isColorScheme ) {\n\t\t\t\tsetColorScheme( getV1ColorScheme() );\n\t\t\t}\n\t\t} );\n\t}, [] );\n\n\treturn colorScheme;\n}\n\nfunction getV1ColorScheme() {\n\treturn ( window as unknown as ExtendedWindow ).elementor?.getPreferences?.( 'ui_theme' ) || 'auto';\n}\n","import * as React from 'react';\nimport { MenuItem, type MenuItemProps, MenuItemText } from '@elementor/ui';\n\nexport const MenuListItem = ( { children, ...props }: MenuItemProps ) => {\n\treturn (\n\t\t<MenuItem\n\t\t\tdense\n\t\t\t{ ...props }\n\t\t\tsx={ {\n\t\t\t\t...( props.sx ?? {} ),\n\t\t\t} }\n\t\t>\n\t\t\t<MenuItemText\n\t\t\t\tprimary={ children }\n\t\t\t\tprimaryTypographyProps={ {\n\t\t\t\t\tvariant: 'caption',\n\t\t\t\t} }\n\t\t\t/>\n\t\t</MenuItem>\n\t);\n};\n","import * as React from 'react';\nimport { type ReactNode } from 'react';\nimport { Box, Button, Card, CardActions, CardContent, SvgIcon, Typography } from '@elementor/ui';\n\ntype InfoTipCardProps = {\n\tcontent: ReactNode;\n\tsvgIcon: ReactNode;\n\tlearnMoreButton?: {\n\t\tlabel: string;\n\t\thref: string;\n\t};\n\tctaButton?: {\n\t\tlabel: string;\n\t\tonClick: () => void;\n\t};\n};\n\nexport const InfoTipCard = ( { content, svgIcon, learnMoreButton, ctaButton }: InfoTipCardProps ) => {\n\treturn (\n\t\t<Card elevation={ 0 } sx={ { width: 320 } }>\n\t\t\t<CardContent sx={ { pb: 0 } }>\n\t\t\t\t<Box display=\"flex\" alignItems=\"start\">\n\t\t\t\t\t<SvgIcon fontSize=\"tiny\" sx={ { mr: 0.5 } }>\n\t\t\t\t\t\t{ svgIcon }\n\t\t\t\t\t</SvgIcon>\n\t\t\t\t\t<Typography variant=\"body2\">{ content }</Typography>\n\t\t\t\t</Box>\n\t\t\t</CardContent>\n\n\t\t\t{ ( ctaButton || learnMoreButton ) && (\n\t\t\t\t<CardActions>\n\t\t\t\t\t{ learnMoreButton && (\n\t\t\t\t\t\t<Button size=\"small\" color=\"warning\" href={ learnMoreButton.href } target=\"_blank\">\n\t\t\t\t\t\t\t{ learnMoreButton.label }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ctaButton && (\n\t\t\t\t\t\t<Button size=\"small\" color=\"warning\" variant=\"contained\" onClick={ ctaButton.onClick }>\n\t\t\t\t\t\t\t{ ctaButton.label }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t) }\n\t\t\t\t</CardActions>\n\t\t\t) }\n\t\t</Card>\n\t);\n};\n","import { useEffect, useRef, useState } from 'react';\n\ntype UseEditableParams = {\n\tvalue: string;\n\tonSubmit: ( value: string ) => unknown;\n\tvalidation?: ( value: string ) => string | null;\n\tonClick?: ( event: React.MouseEvent< HTMLDivElement > ) => void;\n};\n\nexport const useEditable = ( { value, onSubmit, validation, onClick }: UseEditableParams ) => {\n\tconst [ isEditing, setIsEditing ] = useState( false );\n\tconst [ error, setError ] = useState< string | null >( null );\n\n\tconst ref = useSelection( isEditing );\n\n\tconst isDirty = ( newValue: string ) => newValue !== value;\n\n\tconst openEditMode = () => {\n\t\tsetIsEditing( true );\n\t};\n\n\tconst closeEditMode = () => {\n\t\tref.current?.blur();\n\n\t\tsetError( null );\n\t\tsetIsEditing( false );\n\t};\n\n\tconst submit = ( newValue: string ) => {\n\t\tif ( ! isDirty( newValue ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( ! error ) {\n\t\t\ttry {\n\t\t\t\tonSubmit( newValue );\n\t\t\t} finally {\n\t\t\t\tcloseEditMode();\n\t\t\t}\n\t\t}\n\t};\n\n\tconst onChange = ( event: React.ChangeEvent< HTMLSpanElement > ) => {\n\t\tconst { innerText: newValue } = event.target;\n\n\t\tif ( validation ) {\n\t\t\tsetError( isDirty( newValue ) ? validation( newValue ) : null );\n\t\t}\n\t};\n\n\tconst handleKeyDown = ( event: React.KeyboardEvent ) => {\n\t\tevent.stopPropagation();\n\n\t\tif ( [ 'Escape' ].includes( event.key ) ) {\n\t\t\treturn closeEditMode();\n\t\t}\n\n\t\tif ( [ 'Enter' ].includes( event.key ) ) {\n\t\t\tevent.preventDefault();\n\t\t\treturn submit( ( event.target as HTMLElement ).innerText );\n\t\t}\n\t};\n\n\tconst handleClick = ( event: React.MouseEvent< HTMLDivElement > ) => {\n\t\tif ( isEditing ) {\n\t\t\tevent.stopPropagation();\n\t\t}\n\n\t\tonClick?.( event );\n\t};\n\n\tconst listeners = {\n\t\tonClick: handleClick,\n\t\tonKeyDown: handleKeyDown,\n\t\tonInput: onChange,\n\t\tonBlur: closeEditMode,\n\t} as const;\n\n\tconst attributes = {\n\t\tvalue,\n\t\trole: 'textbox',\n\t\tcontentEditable: isEditing,\n\t\t...( isEditing && {\n\t\t\tsuppressContentEditableWarning: true,\n\t\t} ),\n\t} as const;\n\n\treturn {\n\t\tref,\n\t\tisEditing,\n\t\topenEditMode,\n\t\tcloseEditMode,\n\t\tvalue,\n\t\terror,\n\t\tgetProps: () => ( { ...listeners, ...attributes } ),\n\t} as const;\n};\n\nconst useSelection = ( isEditing: boolean ) => {\n\tconst ref = useRef< HTMLElement | null >( null );\n\n\tuseEffect( () => {\n\t\tif ( isEditing ) {\n\t\t\tselectAll( ref.current );\n\t\t}\n\t}, [ isEditing ] );\n\n\treturn ref;\n};\n\nconst selectAll = ( el: HTMLElement | null ) => {\n\tconst selection = getSelection();\n\n\tif ( ! selection || ! el ) {\n\t\treturn;\n\t}\n\n\tconst range = document.createRange();\n\trange.selectNodeContents( el );\n\n\tselection.removeAllRanges();\n\tselection.addRange( range );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;AACvB,mBAAoC;AACpC,gBAA6B;AAQtB,IAAM,sBAAsB,CAAiC;AAAA,EACnE;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACJ,MAAsC;AACrC,QAAM,CAAE,QAAQ,aAAc,IAAI,iBAAiB;AAEnD,MAAK,eAAgB;AACpB,WACC,oCAAC,qBAAQ,OAAgB,WAAU,SAClC,oCAAC,WAAQ,UAAsB,KAAM,QAAS,IAAY,GAAG,SAC1D,KACH,CACD;AAAA,EAEF;AAEA,SACC,oCAAC,WAAQ,UAAsB,KAAM,QAAS,IAAY,GAAG,SAC1D,KACH;AA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AI,GAAI;AACxC,YAAM,eAAe;AACrB,aAAO,OAAU,MAAM,OAAwB,SAAU;AAAA,IAC1D;AAAA,EACD;AAEA,QAAM,cAAc,CAAE,UAA+C;AACpE,QAAK,WAAY;AAChB,YAAM,gBAAgB;AAAA,IACvB;AAEA,cAAW,KAAM;AAAA,EAClB;AAEA,QAAM,YAAY;AAAA,IACjB,SAAS;AAAA,IACT,WAAW;AAAA,IACX,SAAS;AAAA,IACT,QAAQ;AAAA,EACT;AAEA,QAAM,aAAa;AAAA,IAClB;AAAA,IACA,MAAM;AAAA,IACN,iBAAiB;AAAA,IACjB,GAAK,aAAa;AAAA,MACjB,gCAAgC;AAAA,IACjC;AAAA,EACD;AAEA,SAAO;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,UAAU,OAAQ,EAAE,GAAG,WAAW,GAAG,WAAW;AAAA,EACjD;AACD;AAEA,IAAM,eAAe,CAAE,cAAwB;AAC9C,QAAM,UAAM,sBAA8B,IAAK;AAE/C,+BAAW,MAAM;AAChB,QAAK,WAAY;AAChB,gBAAW,IAAI,OAAQ;AAAA,IACxB;AAAA,EACD,GAAG,CAAE,SAAU,CAAE;AAEjB,SAAO;AACR;AAEA,IAAM,YAAY,CAAE,OAA4B;AAC/C,QAAM,YAAY,aAAa;AAE/B,MAAK,CAAE,aAAa,CAAE,IAAK;AAC1B;AAAA,EACD;AAEA,QAAM,QAAQ,SAAS,YAAY;AACnC,QAAM,mBAAoB,EAAG;AAE7B,YAAU,gBAAgB;AAC1B,YAAU,SAAU,KAAM;AAC3B;","names":["React","import_react","import_ui","React","import_react","import_ui","React","import_ui","import_react","listenTo","ThemeProviderBase","React","import_ui","React","import_ui","import_react"]}
|
package/dist/index.mjs
CHANGED
|
@@ -61,10 +61,20 @@ var StyledField = styled(Box2)`
|
|
|
61
61
|
// src/components/introduction-modal.tsx
|
|
62
62
|
import * as React3 from "react";
|
|
63
63
|
import { useState as useState2 } from "react";
|
|
64
|
-
import {
|
|
64
|
+
import {
|
|
65
|
+
Button,
|
|
66
|
+
Checkbox,
|
|
67
|
+
Dialog,
|
|
68
|
+
DialogActions,
|
|
69
|
+
DialogHeader,
|
|
70
|
+
DialogTitle,
|
|
71
|
+
FormControlLabel,
|
|
72
|
+
Image,
|
|
73
|
+
Typography
|
|
74
|
+
} from "@elementor/ui";
|
|
65
75
|
import { __ } from "@wordpress/i18n";
|
|
66
76
|
var OPEN_DELAY = 1e3;
|
|
67
|
-
var IntroductionModal = ({ open, handleClose, title, content }) => {
|
|
77
|
+
var IntroductionModal = ({ open, handleClose, title, content, image }) => {
|
|
68
78
|
const [shouldShowAgain, setShouldShowAgain] = useState2(true);
|
|
69
79
|
return /* @__PURE__ */ React3.createElement(
|
|
70
80
|
Dialog,
|
|
@@ -77,7 +87,8 @@ var IntroductionModal = ({ open, handleClose, title, content }) => {
|
|
|
77
87
|
style: { transitionDelay: open ? `${OPEN_DELAY}ms` : "0ms" }
|
|
78
88
|
}
|
|
79
89
|
},
|
|
80
|
-
/* @__PURE__ */ React3.createElement(DialogHeader, { logo: false }, /* @__PURE__ */ React3.createElement(DialogTitle, null, title)),
|
|
90
|
+
title && /* @__PURE__ */ React3.createElement(DialogHeader, { logo: false }, /* @__PURE__ */ React3.createElement(DialogTitle, null, title)),
|
|
91
|
+
image && /* @__PURE__ */ React3.createElement(Image, { sx: { width: "100%" }, src: image.src, alt: image.alt }),
|
|
81
92
|
content,
|
|
82
93
|
/* @__PURE__ */ React3.createElement(DialogActions, null, /* @__PURE__ */ React3.createElement(
|
|
83
94
|
FormControlLabel,
|
|
@@ -90,40 +101,96 @@ var IntroductionModal = ({ open, handleClose, title, content }) => {
|
|
|
90
101
|
onChange: () => setShouldShowAgain(!shouldShowAgain)
|
|
91
102
|
}
|
|
92
103
|
),
|
|
93
|
-
label: __("Don't show this again", "elementor")
|
|
104
|
+
label: /* @__PURE__ */ React3.createElement(Typography, { variant: "body2" }, __("Don't show this again", "elementor"))
|
|
94
105
|
}
|
|
95
|
-
), /* @__PURE__ */ React3.createElement(
|
|
106
|
+
), /* @__PURE__ */ React3.createElement(
|
|
107
|
+
Button,
|
|
108
|
+
{
|
|
109
|
+
size: "medium",
|
|
110
|
+
variant: "contained",
|
|
111
|
+
sx: { minWidth: "135px" },
|
|
112
|
+
onClick: () => handleClose(shouldShowAgain)
|
|
113
|
+
},
|
|
114
|
+
__("Got it", "elementor")
|
|
115
|
+
))
|
|
96
116
|
);
|
|
97
117
|
};
|
|
98
118
|
|
|
99
|
-
// src/components/
|
|
119
|
+
// src/components/theme-provider.tsx
|
|
100
120
|
import * as React4 from "react";
|
|
121
|
+
import { ThemeProvider as ThemeProviderBase } from "@elementor/ui";
|
|
122
|
+
|
|
123
|
+
// src/hooks/use-color-scheme.ts
|
|
124
|
+
import { useEffect as useEffect2, useState as useState3 } from "react";
|
|
125
|
+
import {
|
|
126
|
+
__privateListenTo as listenTo,
|
|
127
|
+
commandEndEvent,
|
|
128
|
+
v1ReadyEvent
|
|
129
|
+
} from "@elementor/editor-v1-adapters";
|
|
130
|
+
function useColorScheme() {
|
|
131
|
+
const [colorScheme, setColorScheme] = useState3(() => getV1ColorScheme());
|
|
132
|
+
useEffect2(() => {
|
|
133
|
+
return listenTo(v1ReadyEvent(), () => setColorScheme(getV1ColorScheme()));
|
|
134
|
+
}, []);
|
|
135
|
+
useEffect2(() => {
|
|
136
|
+
return listenTo(commandEndEvent("document/elements/settings"), (e) => {
|
|
137
|
+
const event = e;
|
|
138
|
+
const isColorScheme = event.args?.settings && "ui_theme" in event.args.settings;
|
|
139
|
+
if (isColorScheme) {
|
|
140
|
+
setColorScheme(getV1ColorScheme());
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
}, []);
|
|
144
|
+
return colorScheme;
|
|
145
|
+
}
|
|
146
|
+
function getV1ColorScheme() {
|
|
147
|
+
return window.elementor?.getPreferences?.("ui_theme") || "auto";
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// src/components/theme-provider.tsx
|
|
151
|
+
var EDITOR_PALLETTE = "unstable";
|
|
152
|
+
function ThemeProvider({ children }) {
|
|
153
|
+
const colorScheme = useColorScheme();
|
|
154
|
+
return /* @__PURE__ */ React4.createElement(ThemeProviderBase, { colorScheme, palette: EDITOR_PALLETTE }, children);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// src/components/menu-item.tsx
|
|
158
|
+
import * as React5 from "react";
|
|
101
159
|
import { MenuItem, MenuItemText } from "@elementor/ui";
|
|
102
|
-
var MenuListItem = ({ children, ...props }) =>
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
dense: true,
|
|
106
|
-
...props,
|
|
107
|
-
sx: {
|
|
108
|
-
...props.sx ?? {}
|
|
109
|
-
}
|
|
110
|
-
},
|
|
111
|
-
/* @__PURE__ */ React4.createElement(
|
|
112
|
-
MenuItemText,
|
|
160
|
+
var MenuListItem = ({ children, ...props }) => {
|
|
161
|
+
return /* @__PURE__ */ React5.createElement(
|
|
162
|
+
MenuItem,
|
|
113
163
|
{
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
164
|
+
dense: true,
|
|
165
|
+
...props,
|
|
166
|
+
sx: {
|
|
167
|
+
...props.sx ?? {}
|
|
117
168
|
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
|
|
169
|
+
},
|
|
170
|
+
/* @__PURE__ */ React5.createElement(
|
|
171
|
+
MenuItemText,
|
|
172
|
+
{
|
|
173
|
+
primary: children,
|
|
174
|
+
primaryTypographyProps: {
|
|
175
|
+
variant: "caption"
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
)
|
|
179
|
+
);
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
// src/components/infotip-card.tsx
|
|
183
|
+
import * as React6 from "react";
|
|
184
|
+
import { Box as Box3, Button as Button2, Card, CardActions, CardContent, SvgIcon, Typography as Typography2 } from "@elementor/ui";
|
|
185
|
+
var InfoTipCard = ({ content, svgIcon, learnMoreButton, ctaButton }) => {
|
|
186
|
+
return /* @__PURE__ */ React6.createElement(Card, { elevation: 0, sx: { width: 320 } }, /* @__PURE__ */ React6.createElement(CardContent, { sx: { pb: 0 } }, /* @__PURE__ */ React6.createElement(Box3, { display: "flex", alignItems: "start" }, /* @__PURE__ */ React6.createElement(SvgIcon, { fontSize: "tiny", sx: { mr: 0.5 } }, svgIcon), /* @__PURE__ */ React6.createElement(Typography2, { variant: "body2" }, content))), (ctaButton || learnMoreButton) && /* @__PURE__ */ React6.createElement(CardActions, null, learnMoreButton && /* @__PURE__ */ React6.createElement(Button2, { size: "small", color: "warning", href: learnMoreButton.href, target: "_blank" }, learnMoreButton.label), ctaButton && /* @__PURE__ */ React6.createElement(Button2, { size: "small", color: "warning", variant: "contained", onClick: ctaButton.onClick }, ctaButton.label)));
|
|
187
|
+
};
|
|
121
188
|
|
|
122
189
|
// src/hooks/use-editable.ts
|
|
123
|
-
import { useEffect as
|
|
190
|
+
import { useEffect as useEffect3, useRef, useState as useState4 } from "react";
|
|
124
191
|
var useEditable = ({ value, onSubmit, validation, onClick }) => {
|
|
125
|
-
const [isEditing, setIsEditing] =
|
|
126
|
-
const [error, setError] =
|
|
192
|
+
const [isEditing, setIsEditing] = useState4(false);
|
|
193
|
+
const [error, setError] = useState4(null);
|
|
127
194
|
const ref = useSelection(isEditing);
|
|
128
195
|
const isDirty = (newValue) => newValue !== value;
|
|
129
196
|
const openEditMode = () => {
|
|
@@ -194,7 +261,7 @@ var useEditable = ({ value, onSubmit, validation, onClick }) => {
|
|
|
194
261
|
};
|
|
195
262
|
var useSelection = (isEditing) => {
|
|
196
263
|
const ref = useRef(null);
|
|
197
|
-
|
|
264
|
+
useEffect3(() => {
|
|
198
265
|
if (isEditing) {
|
|
199
266
|
selectAll(ref.current);
|
|
200
267
|
}
|
|
@@ -214,8 +281,10 @@ var selectAll = (el) => {
|
|
|
214
281
|
export {
|
|
215
282
|
EditableField,
|
|
216
283
|
EllipsisWithTooltip,
|
|
284
|
+
InfoTipCard,
|
|
217
285
|
IntroductionModal,
|
|
218
286
|
MenuListItem,
|
|
287
|
+
ThemeProvider,
|
|
219
288
|
useEditable
|
|
220
289
|
};
|
|
221
290
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/ellipsis-with-tooltip.tsx","../src/components/editable-field.tsx","../src/components/introduction-modal.tsx","../src/components/menu-item.tsx","../src/hooks/use-editable.ts"],"sourcesContent":["import * as React from 'react';\nimport { useEffect, useState } from 'react';\nimport { Box, Tooltip } from '@elementor/ui';\n\ntype EllipsisWithTooltipProps< T extends React.ElementType > = {\n\tmaxWidth?: React.CSSProperties[ 'maxWidth' ];\n\ttitle: string;\n\tas?: T;\n} & React.ComponentProps< T >;\n\nexport const EllipsisWithTooltip = < T extends React.ElementType >( {\n\tmaxWidth,\n\ttitle,\n\tas,\n\t...props\n}: EllipsisWithTooltipProps< T > ) => {\n\tconst [ setRef, isOverflowing ] = useIsOverflowing();\n\n\tif ( isOverflowing ) {\n\t\treturn (\n\t\t\t<Tooltip title={ title } placement=\"top\">\n\t\t\t\t<Content maxWidth={ maxWidth } ref={ setRef } as={ as } { ...props }>\n\t\t\t\t\t{ title }\n\t\t\t\t</Content>\n\t\t\t</Tooltip>\n\t\t);\n\t}\n\n\treturn (\n\t\t<Content maxWidth={ maxWidth } ref={ setRef } as={ as } { ...props }>\n\t\t\t{ title }\n\t\t</Content>\n\t);\n};\n\ntype ContentProps< T extends React.ElementType > = React.PropsWithChildren<\n\tOmit< EllipsisWithTooltipProps< T >, 'title' >\n>;\n\nconst Content = React.forwardRef(\n\t< T extends React.ElementType >(\n\t\t{ maxWidth, as: Component = Box, ...props }: ContentProps< T >,\n\t\t// forwardRef loses the typing when using generic components.\n\t\tref: unknown\n\t) => (\n\t\t<Component\n\t\t\tref={ ref }\n\t\t\tposition=\"relative\"\n\t\t\t{ ...props }\n\t\t\tstyle={ { overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', maxWidth } }\n\t\t/>\n\t)\n);\n\nconst useIsOverflowing = () => {\n\tconst [ el, setEl ] = useState< HTMLElement | null >( null );\n\tconst [ isOverflowing, setIsOverflown ] = useState( false );\n\n\tuseEffect( () => {\n\t\tconst observer = new ResizeObserver( ( [ { target } ] ) => {\n\t\t\tsetIsOverflown( target.scrollWidth > target.clientWidth );\n\t\t} );\n\n\t\tif ( el ) {\n\t\t\tobserver.observe( el );\n\t\t}\n\n\t\treturn () => {\n\t\t\tobserver.disconnect();\n\t\t};\n\t}, [ el ] );\n\n\treturn [ setEl, isOverflowing ] as const;\n};\n","import * as React from 'react';\nimport { forwardRef } from 'react';\nimport { Box, styled, Tooltip } from '@elementor/ui';\n\ntype EditableFieldProps< T extends React.ElementType > = {\n\tvalue: string;\n\terror?: string;\n\tas?: T;\n} & React.ComponentPropsWithRef< T >;\n\nexport const EditableField = forwardRef(\n\t< T extends React.ElementType >(\n\t\t{ value, error, as = 'span', sx, ...props }: EditableFieldProps< T >,\n\t\tref: unknown\n\t) => {\n\t\treturn (\n\t\t\t<Tooltip title={ error } open={ !! error } placement=\"top\">\n\t\t\t\t<StyledField ref={ ref } component={ as } { ...props }>\n\t\t\t\t\t{ value }\n\t\t\t\t</StyledField>\n\t\t\t</Tooltip>\n\t\t);\n\t}\n);\n\nconst StyledField = styled( Box )`\n\twidth: 100%;\n\t&:focus {\n\t\toutline: none;\n\t}\n`;\n","import * as React from 'react';\nimport { useState } from 'react';\nimport { Button, Checkbox, Dialog, DialogActions, DialogHeader, DialogTitle, FormControlLabel } from '@elementor/ui';\nimport { __ } from '@wordpress/i18n';\n\ntype IntroductionModalProps = {\n\topen: boolean;\n\thandleClose: ( shouldShowAgain: boolean ) => void;\n\ttitle: string;\n\tcontent: React.ReactNode;\n};\n\nconst OPEN_DELAY = 1000;\n\nexport const IntroductionModal = ( { open, handleClose, title, content }: IntroductionModalProps ) => {\n\tconst [ shouldShowAgain, setShouldShowAgain ] = useState( true );\n\n\treturn (\n\t\t<Dialog\n\t\t\topen={ open }\n\t\t\tonClose={ handleClose }\n\t\t\tmaxWidth={ 'sm' }\n\t\t\tTransitionProps={ {\n\t\t\t\ttimeout: 700,\n\t\t\t\tstyle: { transitionDelay: open ? `${ OPEN_DELAY }ms` : '0ms' },\n\t\t\t} }\n\t\t>\n\t\t\t<DialogHeader logo={ false }>\n\t\t\t\t<DialogTitle>{ title }</DialogTitle>\n\t\t\t</DialogHeader>\n\t\t\t{ content }\n\t\t\t<DialogActions>\n\t\t\t\t<FormControlLabel\n\t\t\t\t\tsx={ { marginRight: 'auto' } }\n\t\t\t\t\tcontrol={\n\t\t\t\t\t\t<Checkbox\n\t\t\t\t\t\t\tchecked={ ! shouldShowAgain }\n\t\t\t\t\t\t\tonChange={ () => setShouldShowAgain( ! shouldShowAgain ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t}\n\t\t\t\t\tlabel={ __( \"Don't show this again\", 'elementor' ) }\n\t\t\t\t/>\n\t\t\t\t<Button size={ 'medium' } onClick={ () => handleClose( shouldShowAgain ) } variant=\"contained\">\n\t\t\t\t\t{ __( 'Got it', 'elementor' ) }\n\t\t\t\t</Button>\n\t\t\t</DialogActions>\n\t\t</Dialog>\n\t);\n};\n","import * as React from 'react';\nimport { MenuItem, type MenuItemProps, MenuItemText } from '@elementor/ui';\n\nexport const MenuListItem = ( { children, ...props }: MenuItemProps ) => (\n\t<MenuItem\n\t\tdense\n\t\t{ ...props }\n\t\tsx={ {\n\t\t\t...( props.sx ?? {} ),\n\t\t} }\n\t>\n\t\t<MenuItemText\n\t\t\tprimary={ children }\n\t\t\tprimaryTypographyProps={ {\n\t\t\t\tvariant: 'caption',\n\t\t\t} }\n\t\t/>\n\t</MenuItem>\n);\n","import { useEffect, useRef, useState } from 'react';\n\ntype UseEditableParams = {\n\tvalue: string;\n\tonSubmit: ( value: string ) => unknown;\n\tvalidation?: ( value: string ) => string | null;\n\tonClick?: ( event: React.MouseEvent< HTMLDivElement > ) => void;\n};\n\nexport const useEditable = ( { value, onSubmit, validation, onClick }: UseEditableParams ) => {\n\tconst [ isEditing, setIsEditing ] = useState( false );\n\tconst [ error, setError ] = useState< string | null >( null );\n\n\tconst ref = useSelection( isEditing );\n\n\tconst isDirty = ( newValue: string ) => newValue !== value;\n\n\tconst openEditMode = () => {\n\t\tsetIsEditing( true );\n\t};\n\n\tconst closeEditMode = () => {\n\t\tref.current?.blur();\n\n\t\tsetError( null );\n\t\tsetIsEditing( false );\n\t};\n\n\tconst submit = ( newValue: string ) => {\n\t\tif ( ! isDirty( newValue ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( ! error ) {\n\t\t\ttry {\n\t\t\t\tonSubmit( newValue );\n\t\t\t} finally {\n\t\t\t\tcloseEditMode();\n\t\t\t}\n\t\t}\n\t};\n\n\tconst onChange = ( event: React.ChangeEvent< HTMLSpanElement > ) => {\n\t\tconst { innerText: newValue } = event.target;\n\n\t\tif ( validation ) {\n\t\t\tsetError( isDirty( newValue ) ? validation( newValue ) : null );\n\t\t}\n\t};\n\n\tconst handleKeyDown = ( event: React.KeyboardEvent ) => {\n\t\tevent.stopPropagation();\n\n\t\tif ( [ 'Escape' ].includes( event.key ) ) {\n\t\t\treturn closeEditMode();\n\t\t}\n\n\t\tif ( [ 'Enter' ].includes( event.key ) ) {\n\t\t\tevent.preventDefault();\n\t\t\treturn submit( ( event.target as HTMLElement ).innerText );\n\t\t}\n\t};\n\n\tconst handleClick = ( event: React.MouseEvent< HTMLDivElement > ) => {\n\t\tif ( isEditing ) {\n\t\t\tevent.stopPropagation();\n\t\t}\n\n\t\tonClick?.( event );\n\t};\n\n\tconst listeners = {\n\t\tonClick: handleClick,\n\t\tonKeyDown: handleKeyDown,\n\t\tonInput: onChange,\n\t\tonBlur: closeEditMode,\n\t} as const;\n\n\tconst attributes = {\n\t\tvalue,\n\t\trole: 'textbox',\n\t\tcontentEditable: isEditing,\n\t\t...( isEditing && {\n\t\t\tsuppressContentEditableWarning: true,\n\t\t} ),\n\t} as const;\n\n\treturn {\n\t\tref,\n\t\tisEditing,\n\t\topenEditMode,\n\t\tcloseEditMode,\n\t\tvalue,\n\t\terror,\n\t\tgetProps: () => ( { ...listeners, ...attributes } ),\n\t} as const;\n};\n\nconst useSelection = ( isEditing: boolean ) => {\n\tconst ref = useRef< HTMLElement | null >( null );\n\n\tuseEffect( () => {\n\t\tif ( isEditing ) {\n\t\t\tselectAll( ref.current );\n\t\t}\n\t}, [ isEditing ] );\n\n\treturn ref;\n};\n\nconst selectAll = ( el: HTMLElement | null ) => {\n\tconst selection = getSelection();\n\n\tif ( ! selection || ! el ) {\n\t\treturn;\n\t}\n\n\tconst range = document.createRange();\n\trange.selectNodeContents( el );\n\n\tselection.removeAllRanges();\n\tselection.addRange( range );\n};\n"],"mappings":";AAAA,YAAY,WAAW;AACvB,SAAS,WAAW,gBAAgB;AACpC,SAAS,KAAK,eAAe;AAQtB,IAAM,sBAAsB,CAAiC;AAAA,EACnE;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACJ,MAAsC;AACrC,QAAM,CAAE,QAAQ,aAAc,IAAI,iBAAiB;AAEnD,MAAK,eAAgB;AACpB,WACC,oCAAC,WAAQ,OAAgB,WAAU,SAClC,oCAAC,WAAQ,UAAsB,KAAM,QAAS,IAAY,GAAG,SAC1D,KACH,CACD;AAAA,EAEF;AAEA,SACC,oCAAC,WAAQ,UAAsB,KAAM,QAAS,IAAY,GAAG,SAC1D,KACH;AAEF;AAMA,IAAM,UAAgB;AAAA,EACrB,CACC,EAAE,UAAU,IAAI,YAAY,KAAK,GAAG,MAAM,GAE1C,QAEA;AAAA,IAAC;AAAA;AAAA,MACA;AAAA,MACA,UAAS;AAAA,MACP,GAAG;AAAA,MACL,OAAQ,EAAE,UAAU,UAAU,cAAc,YAAY,YAAY,UAAU,SAAS;AAAA;AAAA,EACxF;AAEF;AAEA,IAAM,mBAAmB,MAAM;AA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AAwB;AAC9C,QAAM,MAAM,OAA8B,IAAK;AAE/C,EAAAD,WAAW,MAAM;AAChB,QAAK,WAAY;AAChB,gBAAW,IAAI,OAAQ;AAAA,IACxB;AAAA,EACD,GAAG,CAAE,SAAU,CAAE;AAEjB,SAAO;AACR;AAEA,IAAM,YAAY,CAAE,OAA4B;AAC/C,QAAM,YAAY,aAAa;AAE/B,MAAK,CAAE,aAAa,CAAE,IAAK;AAC1B;AAAA,EACD;AAEA,QAAM,QAAQ,SAAS,YAAY;AACnC,QAAM,mBAAoB,EAAG;AAE7B,YAAU,gBAAgB;AAC1B,YAAU,SAAU,KAAM;AAC3B;","names":["React","forwardRef","Box","Tooltip","React","useState","React","useEffect","useState"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/ellipsis-with-tooltip.tsx","../src/components/editable-field.tsx","../src/components/introduction-modal.tsx","../src/components/theme-provider.tsx","../src/hooks/use-color-scheme.ts","../src/components/menu-item.tsx","../src/components/infotip-card.tsx","../src/hooks/use-editable.ts"],"sourcesContent":["import * as React from 'react';\nimport { useEffect, useState } from 'react';\nimport { Box, Tooltip } from '@elementor/ui';\n\ntype EllipsisWithTooltipProps< T extends React.ElementType > = {\n\tmaxWidth?: React.CSSProperties[ 'maxWidth' ];\n\ttitle: string;\n\tas?: T;\n} & React.ComponentProps< T >;\n\nexport const EllipsisWithTooltip = < T extends React.ElementType >( {\n\tmaxWidth,\n\ttitle,\n\tas,\n\t...props\n}: EllipsisWithTooltipProps< T > ) => {\n\tconst [ setRef, isOverflowing ] = useIsOverflowing();\n\n\tif ( isOverflowing ) {\n\t\treturn (\n\t\t\t<Tooltip title={ title } placement=\"top\">\n\t\t\t\t<Content maxWidth={ maxWidth } ref={ setRef } as={ as } { ...props }>\n\t\t\t\t\t{ title }\n\t\t\t\t</Content>\n\t\t\t</Tooltip>\n\t\t);\n\t}\n\n\treturn (\n\t\t<Content maxWidth={ maxWidth } ref={ setRef } as={ as } { ...props }>\n\t\t\t{ title }\n\t\t</Content>\n\t);\n};\n\ntype ContentProps< T extends React.ElementType > = React.PropsWithChildren<\n\tOmit< EllipsisWithTooltipProps< T >, 'title' >\n>;\n\nconst Content = React.forwardRef(\n\t< T extends React.ElementType >(\n\t\t{ maxWidth, as: Component = Box, ...props }: ContentProps< T >,\n\t\t// forwardRef loses the typing when using generic components.\n\t\tref: unknown\n\t) => (\n\t\t<Component\n\t\t\tref={ ref }\n\t\t\tposition=\"relative\"\n\t\t\t{ ...props }\n\t\t\tstyle={ { overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', maxWidth } }\n\t\t/>\n\t)\n);\n\nconst useIsOverflowing = () => {\n\tconst [ el, setEl ] = useState< HTMLElement | null >( null );\n\tconst [ isOverflowing, setIsOverflown ] = useState( false );\n\n\tuseEffect( () => {\n\t\tconst observer = new ResizeObserver( ( [ { target } ] ) => {\n\t\t\tsetIsOverflown( target.scrollWidth > target.clientWidth );\n\t\t} );\n\n\t\tif ( el ) {\n\t\t\tobserver.observe( el );\n\t\t}\n\n\t\treturn () => {\n\t\t\tobserver.disconnect();\n\t\t};\n\t}, [ el ] );\n\n\treturn [ setEl, isOverflowing ] as const;\n};\n","import * as React from 'react';\nimport { forwardRef } from 'react';\nimport { Box, styled, Tooltip } from '@elementor/ui';\n\ntype EditableFieldProps< T extends React.ElementType > = {\n\tvalue: string;\n\terror?: string;\n\tas?: T;\n} & React.ComponentPropsWithRef< T >;\n\nexport const EditableField = forwardRef(\n\t< T extends React.ElementType >(\n\t\t{ value, error, as = 'span', sx, ...props }: EditableFieldProps< T >,\n\t\tref: unknown\n\t) => {\n\t\treturn (\n\t\t\t<Tooltip title={ error } open={ !! error } placement=\"top\">\n\t\t\t\t<StyledField ref={ ref } component={ as } { ...props }>\n\t\t\t\t\t{ value }\n\t\t\t\t</StyledField>\n\t\t\t</Tooltip>\n\t\t);\n\t}\n);\n\nconst StyledField = styled( Box )`\n\twidth: 100%;\n\t&:focus {\n\t\toutline: none;\n\t}\n`;\n","import * as React from 'react';\nimport { useState } from 'react';\nimport {\n\tButton,\n\tCheckbox,\n\tDialog,\n\tDialogActions,\n\tDialogHeader,\n\tDialogTitle,\n\tFormControlLabel,\n\tImage,\n\tTypography,\n} from '@elementor/ui';\nimport { __ } from '@wordpress/i18n';\n\ntype IntroductionModalProps = {\n\topen: boolean;\n\thandleClose: ( shouldShowAgain: boolean ) => void;\n\ttitle?: string;\n\tcontent: React.ReactNode;\n\timage?: {\n\t\tsrc: string;\n\t\talt: string;\n\t};\n};\n\nconst OPEN_DELAY = 1000;\n\nexport const IntroductionModal = ( { open, handleClose, title, content, image }: IntroductionModalProps ) => {\n\tconst [ shouldShowAgain, setShouldShowAgain ] = useState( true );\n\n\treturn (\n\t\t<Dialog\n\t\t\topen={ open }\n\t\t\tonClose={ handleClose }\n\t\t\tmaxWidth={ 'sm' }\n\t\t\tTransitionProps={ {\n\t\t\t\ttimeout: 700,\n\t\t\t\tstyle: { transitionDelay: open ? `${ OPEN_DELAY }ms` : '0ms' },\n\t\t\t} }\n\t\t>\n\t\t\t{ title && (\n\t\t\t\t<DialogHeader logo={ false }>\n\t\t\t\t\t<DialogTitle>{ title }</DialogTitle>\n\t\t\t\t</DialogHeader>\n\t\t\t) }\n\t\t\t{ image && <Image sx={ { width: '100%' } } src={ image.src } alt={ image.alt } /> }\n\t\t\t{ content }\n\t\t\t<DialogActions>\n\t\t\t\t<FormControlLabel\n\t\t\t\t\tsx={ { marginRight: 'auto' } }\n\t\t\t\t\tcontrol={\n\t\t\t\t\t\t<Checkbox\n\t\t\t\t\t\t\tchecked={ ! shouldShowAgain }\n\t\t\t\t\t\t\tonChange={ () => setShouldShowAgain( ! shouldShowAgain ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t}\n\t\t\t\t\tlabel={\n\t\t\t\t\t\t<Typography variant={ 'body2' }>{ __( \"Don't show this again\", 'elementor' ) }</Typography>\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t<Button\n\t\t\t\t\tsize={ 'medium' }\n\t\t\t\t\tvariant=\"contained\"\n\t\t\t\t\tsx={ { minWidth: '135px' } }\n\t\t\t\t\tonClick={ () => handleClose( shouldShowAgain ) }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Got it', 'elementor' ) }\n\t\t\t\t</Button>\n\t\t\t</DialogActions>\n\t\t</Dialog>\n\t);\n};\n","import * as React from 'react';\nimport { ThemeProvider as ThemeProviderBase, type ThemeProviderProps } from '@elementor/ui';\n\nimport { useColorScheme } from '../hooks/use-color-scheme';\n\nconst EDITOR_PALLETTE: ThemeProviderProps[ 'palette' ] = 'unstable';\n\nexport default function ThemeProvider( { children }: { children: React.ReactNode } ) {\n\tconst colorScheme = useColorScheme();\n\n\treturn (\n\t\t<ThemeProviderBase colorScheme={ colorScheme } palette={ EDITOR_PALLETTE }>\n\t\t\t{ children }\n\t\t</ThemeProviderBase>\n\t);\n}\n","import { useEffect, useState } from 'react';\nimport {\n\t__privateListenTo as listenTo,\n\tcommandEndEvent,\n\ttype CommandEvent,\n\tv1ReadyEvent,\n} from '@elementor/editor-v1-adapters';\n\nexport type ColorScheme = 'auto' | 'dark' | 'light';\n\nexport type ExtendedWindow = Window & {\n\telementor: {\n\t\tgetPreferences: ( key: 'ui_theme' ) => ColorScheme;\n\t};\n};\n\nexport function useColorScheme() {\n\tconst [ colorScheme, setColorScheme ] = useState< ColorScheme >( () => getV1ColorScheme() );\n\n\tuseEffect( () => {\n\t\treturn listenTo( v1ReadyEvent(), () => setColorScheme( getV1ColorScheme() ) );\n\t}, [] );\n\n\tuseEffect( () => {\n\t\treturn listenTo( commandEndEvent( 'document/elements/settings' ), ( e ) => {\n\t\t\tconst event = e as CommandEvent< {\n\t\t\t\tsettings: {\n\t\t\t\t\tui_theme?: ColorScheme;\n\t\t\t\t};\n\t\t\t} >;\n\n\t\t\t// The User-Preferences settings object has a key named `ui_theme` that controls the color scheme.\n\t\t\tconst isColorScheme = event.args?.settings && 'ui_theme' in event.args.settings;\n\n\t\t\tif ( isColorScheme ) {\n\t\t\t\tsetColorScheme( getV1ColorScheme() );\n\t\t\t}\n\t\t} );\n\t}, [] );\n\n\treturn colorScheme;\n}\n\nfunction getV1ColorScheme() {\n\treturn ( window as unknown as ExtendedWindow ).elementor?.getPreferences?.( 'ui_theme' ) || 'auto';\n}\n","import * as React from 'react';\nimport { MenuItem, type MenuItemProps, MenuItemText } from '@elementor/ui';\n\nexport const MenuListItem = ( { children, ...props }: MenuItemProps ) => {\n\treturn (\n\t\t<MenuItem\n\t\t\tdense\n\t\t\t{ ...props }\n\t\t\tsx={ {\n\t\t\t\t...( props.sx ?? {} ),\n\t\t\t} }\n\t\t>\n\t\t\t<MenuItemText\n\t\t\t\tprimary={ children }\n\t\t\t\tprimaryTypographyProps={ {\n\t\t\t\t\tvariant: 'caption',\n\t\t\t\t} }\n\t\t\t/>\n\t\t</MenuItem>\n\t);\n};\n","import * as React from 'react';\nimport { type ReactNode } from 'react';\nimport { Box, Button, Card, CardActions, CardContent, SvgIcon, Typography } from '@elementor/ui';\n\ntype InfoTipCardProps = {\n\tcontent: ReactNode;\n\tsvgIcon: ReactNode;\n\tlearnMoreButton?: {\n\t\tlabel: string;\n\t\thref: string;\n\t};\n\tctaButton?: {\n\t\tlabel: string;\n\t\tonClick: () => void;\n\t};\n};\n\nexport const InfoTipCard = ( { content, svgIcon, learnMoreButton, ctaButton }: InfoTipCardProps ) => {\n\treturn (\n\t\t<Card elevation={ 0 } sx={ { width: 320 } }>\n\t\t\t<CardContent sx={ { pb: 0 } }>\n\t\t\t\t<Box display=\"flex\" alignItems=\"start\">\n\t\t\t\t\t<SvgIcon fontSize=\"tiny\" sx={ { mr: 0.5 } }>\n\t\t\t\t\t\t{ svgIcon }\n\t\t\t\t\t</SvgIcon>\n\t\t\t\t\t<Typography variant=\"body2\">{ content }</Typography>\n\t\t\t\t</Box>\n\t\t\t</CardContent>\n\n\t\t\t{ ( ctaButton || learnMoreButton ) && (\n\t\t\t\t<CardActions>\n\t\t\t\t\t{ learnMoreButton && (\n\t\t\t\t\t\t<Button size=\"small\" color=\"warning\" href={ learnMoreButton.href } target=\"_blank\">\n\t\t\t\t\t\t\t{ learnMoreButton.label }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ctaButton && (\n\t\t\t\t\t\t<Button size=\"small\" color=\"warning\" variant=\"contained\" onClick={ ctaButton.onClick }>\n\t\t\t\t\t\t\t{ ctaButton.label }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t) }\n\t\t\t\t</CardActions>\n\t\t\t) }\n\t\t</Card>\n\t);\n};\n","import { useEffect, useRef, useState } from 'react';\n\ntype UseEditableParams = {\n\tvalue: string;\n\tonSubmit: ( value: string ) => unknown;\n\tvalidation?: ( value: string ) => string | null;\n\tonClick?: ( event: React.MouseEvent< HTMLDivElement > ) => void;\n};\n\nexport const useEditable = ( { value, onSubmit, validation, onClick }: UseEditableParams ) => {\n\tconst [ isEditing, setIsEditing ] = useState( false );\n\tconst [ error, setError ] = useState< string | null >( null );\n\n\tconst ref = useSelection( isEditing );\n\n\tconst isDirty = ( newValue: string ) => newValue !== value;\n\n\tconst openEditMode = () => {\n\t\tsetIsEditing( true );\n\t};\n\n\tconst closeEditMode = () => {\n\t\tref.current?.blur();\n\n\t\tsetError( null );\n\t\tsetIsEditing( false );\n\t};\n\n\tconst submit = ( newValue: string ) => {\n\t\tif ( ! isDirty( newValue ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( ! error ) {\n\t\t\ttry {\n\t\t\t\tonSubmit( newValue );\n\t\t\t} finally {\n\t\t\t\tcloseEditMode();\n\t\t\t}\n\t\t}\n\t};\n\n\tconst onChange = ( event: React.ChangeEvent< HTMLSpanElement > ) => {\n\t\tconst { innerText: newValue } = event.target;\n\n\t\tif ( validation ) {\n\t\t\tsetError( isDirty( newValue ) ? validation( newValue ) : null );\n\t\t}\n\t};\n\n\tconst handleKeyDown = ( event: React.KeyboardEvent ) => {\n\t\tevent.stopPropagation();\n\n\t\tif ( [ 'Escape' ].includes( event.key ) ) {\n\t\t\treturn closeEditMode();\n\t\t}\n\n\t\tif ( [ 'Enter' ].includes( event.key ) ) {\n\t\t\tevent.preventDefault();\n\t\t\treturn submit( ( event.target as HTMLElement ).innerText );\n\t\t}\n\t};\n\n\tconst handleClick = ( event: React.MouseEvent< HTMLDivElement > ) => {\n\t\tif ( isEditing ) {\n\t\t\tevent.stopPropagation();\n\t\t}\n\n\t\tonClick?.( event );\n\t};\n\n\tconst listeners = {\n\t\tonClick: handleClick,\n\t\tonKeyDown: handleKeyDown,\n\t\tonInput: onChange,\n\t\tonBlur: closeEditMode,\n\t} as const;\n\n\tconst attributes = {\n\t\tvalue,\n\t\trole: 'textbox',\n\t\tcontentEditable: isEditing,\n\t\t...( isEditing && {\n\t\t\tsuppressContentEditableWarning: true,\n\t\t} ),\n\t} as const;\n\n\treturn {\n\t\tref,\n\t\tisEditing,\n\t\topenEditMode,\n\t\tcloseEditMode,\n\t\tvalue,\n\t\terror,\n\t\tgetProps: () => ( { ...listeners, ...attributes } ),\n\t} as const;\n};\n\nconst useSelection = ( isEditing: boolean ) => {\n\tconst ref = useRef< HTMLElement | null >( null );\n\n\tuseEffect( () => {\n\t\tif ( isEditing ) {\n\t\t\tselectAll( ref.current );\n\t\t}\n\t}, [ isEditing ] );\n\n\treturn ref;\n};\n\nconst selectAll = ( el: HTMLElement | null ) => {\n\tconst selection = getSelection();\n\n\tif ( ! selection || ! el ) {\n\t\treturn;\n\t}\n\n\tconst range = document.createRange();\n\trange.selectNodeContents( el );\n\n\tselection.removeAllRanges();\n\tselection.addRange( range );\n};\n"],"mappings":";AAAA,YAAY,WAAW;AACvB,SAAS,WAAW,gBAAgB;AACpC,SAAS,KAAK,eAAe;AAQtB,IAAM,sBAAsB,CAAiC;AAAA,EACnE;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACJ,MAAsC;AACrC,QAAM,CAAE,QAAQ,aAAc,IAAI,iBAAiB;AAEnD,MAAK,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AAE,SAAU,CAAE;AAEjB,SAAO;AACR;AAEA,IAAM,YAAY,CAAE,OAA4B;AAC/C,QAAM,YAAY,aAAa;AAE/B,MAAK,CAAE,aAAa,CAAE,IAAK;AAC1B;AAAA,EACD;AAEA,QAAM,QAAQ,SAAS,YAAY;AACnC,QAAM,mBAAoB,EAAG;AAE7B,YAAU,gBAAgB;AAC1B,YAAU,SAAU,KAAM;AAC3B;","names":["React","forwardRef","Box","Tooltip","React","useState","React","useEffect","useState","React","React","Box","Button","Typography","useEffect","useState"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elementor/editor-ui",
|
|
3
3
|
"description": "Elementor Editor UI",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.7.0",
|
|
5
5
|
"private": false,
|
|
6
6
|
"author": "Elementor Team",
|
|
7
7
|
"homepage": "https://elementor.com/",
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
"react": "^18.3.1"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
+
"@elementor/editor-v1-adapters": "0.11.0",
|
|
39
40
|
"@elementor/ui": "1.32.1",
|
|
40
41
|
"@wordpress/i18n": "^5.13.0"
|
|
41
42
|
},
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type ReactNode } from 'react';
|
|
3
|
+
import { Box, Button, Card, CardActions, CardContent, SvgIcon, Typography } from '@elementor/ui';
|
|
4
|
+
|
|
5
|
+
type InfoTipCardProps = {
|
|
6
|
+
content: ReactNode;
|
|
7
|
+
svgIcon: ReactNode;
|
|
8
|
+
learnMoreButton?: {
|
|
9
|
+
label: string;
|
|
10
|
+
href: string;
|
|
11
|
+
};
|
|
12
|
+
ctaButton?: {
|
|
13
|
+
label: string;
|
|
14
|
+
onClick: () => void;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const InfoTipCard = ( { content, svgIcon, learnMoreButton, ctaButton }: InfoTipCardProps ) => {
|
|
19
|
+
return (
|
|
20
|
+
<Card elevation={ 0 } sx={ { width: 320 } }>
|
|
21
|
+
<CardContent sx={ { pb: 0 } }>
|
|
22
|
+
<Box display="flex" alignItems="start">
|
|
23
|
+
<SvgIcon fontSize="tiny" sx={ { mr: 0.5 } }>
|
|
24
|
+
{ svgIcon }
|
|
25
|
+
</SvgIcon>
|
|
26
|
+
<Typography variant="body2">{ content }</Typography>
|
|
27
|
+
</Box>
|
|
28
|
+
</CardContent>
|
|
29
|
+
|
|
30
|
+
{ ( ctaButton || learnMoreButton ) && (
|
|
31
|
+
<CardActions>
|
|
32
|
+
{ learnMoreButton && (
|
|
33
|
+
<Button size="small" color="warning" href={ learnMoreButton.href } target="_blank">
|
|
34
|
+
{ learnMoreButton.label }
|
|
35
|
+
</Button>
|
|
36
|
+
) }
|
|
37
|
+
{ ctaButton && (
|
|
38
|
+
<Button size="small" color="warning" variant="contained" onClick={ ctaButton.onClick }>
|
|
39
|
+
{ ctaButton.label }
|
|
40
|
+
</Button>
|
|
41
|
+
) }
|
|
42
|
+
</CardActions>
|
|
43
|
+
) }
|
|
44
|
+
</Card>
|
|
45
|
+
);
|
|
46
|
+
};
|
|
@@ -1,18 +1,32 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useState } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
Button,
|
|
5
|
+
Checkbox,
|
|
6
|
+
Dialog,
|
|
7
|
+
DialogActions,
|
|
8
|
+
DialogHeader,
|
|
9
|
+
DialogTitle,
|
|
10
|
+
FormControlLabel,
|
|
11
|
+
Image,
|
|
12
|
+
Typography,
|
|
13
|
+
} from '@elementor/ui';
|
|
4
14
|
import { __ } from '@wordpress/i18n';
|
|
5
15
|
|
|
6
16
|
type IntroductionModalProps = {
|
|
7
17
|
open: boolean;
|
|
8
18
|
handleClose: ( shouldShowAgain: boolean ) => void;
|
|
9
|
-
title
|
|
19
|
+
title?: string;
|
|
10
20
|
content: React.ReactNode;
|
|
21
|
+
image?: {
|
|
22
|
+
src: string;
|
|
23
|
+
alt: string;
|
|
24
|
+
};
|
|
11
25
|
};
|
|
12
26
|
|
|
13
27
|
const OPEN_DELAY = 1000;
|
|
14
28
|
|
|
15
|
-
export const IntroductionModal = ( { open, handleClose, title, content }: IntroductionModalProps ) => {
|
|
29
|
+
export const IntroductionModal = ( { open, handleClose, title, content, image }: IntroductionModalProps ) => {
|
|
16
30
|
const [ shouldShowAgain, setShouldShowAgain ] = useState( true );
|
|
17
31
|
|
|
18
32
|
return (
|
|
@@ -25,9 +39,12 @@ export const IntroductionModal = ( { open, handleClose, title, content }: Introd
|
|
|
25
39
|
style: { transitionDelay: open ? `${ OPEN_DELAY }ms` : '0ms' },
|
|
26
40
|
} }
|
|
27
41
|
>
|
|
28
|
-
|
|
29
|
-
<
|
|
30
|
-
|
|
42
|
+
{ title && (
|
|
43
|
+
<DialogHeader logo={ false }>
|
|
44
|
+
<DialogTitle>{ title }</DialogTitle>
|
|
45
|
+
</DialogHeader>
|
|
46
|
+
) }
|
|
47
|
+
{ image && <Image sx={ { width: '100%' } } src={ image.src } alt={ image.alt } /> }
|
|
31
48
|
{ content }
|
|
32
49
|
<DialogActions>
|
|
33
50
|
<FormControlLabel
|
|
@@ -38,9 +55,16 @@ export const IntroductionModal = ( { open, handleClose, title, content }: Introd
|
|
|
38
55
|
onChange={ () => setShouldShowAgain( ! shouldShowAgain ) }
|
|
39
56
|
/>
|
|
40
57
|
}
|
|
41
|
-
label={
|
|
58
|
+
label={
|
|
59
|
+
<Typography variant={ 'body2' }>{ __( "Don't show this again", 'elementor' ) }</Typography>
|
|
60
|
+
}
|
|
42
61
|
/>
|
|
43
|
-
<Button
|
|
62
|
+
<Button
|
|
63
|
+
size={ 'medium' }
|
|
64
|
+
variant="contained"
|
|
65
|
+
sx={ { minWidth: '135px' } }
|
|
66
|
+
onClick={ () => handleClose( shouldShowAgain ) }
|
|
67
|
+
>
|
|
44
68
|
{ __( 'Got it', 'elementor' ) }
|
|
45
69
|
</Button>
|
|
46
70
|
</DialogActions>
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { MenuItem, type MenuItemProps, MenuItemText } from '@elementor/ui';
|
|
3
3
|
|
|
4
|
-
export const MenuListItem = ( { children, ...props }: MenuItemProps ) =>
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
>
|
|
12
|
-
<MenuItemText
|
|
13
|
-
primary={ children }
|
|
14
|
-
primaryTypographyProps={ {
|
|
15
|
-
variant: 'caption',
|
|
4
|
+
export const MenuListItem = ( { children, ...props }: MenuItemProps ) => {
|
|
5
|
+
return (
|
|
6
|
+
<MenuItem
|
|
7
|
+
dense
|
|
8
|
+
{ ...props }
|
|
9
|
+
sx={ {
|
|
10
|
+
...( props.sx ?? {} ),
|
|
16
11
|
} }
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
>
|
|
13
|
+
<MenuItemText
|
|
14
|
+
primary={ children }
|
|
15
|
+
primaryTypographyProps={ {
|
|
16
|
+
variant: 'caption',
|
|
17
|
+
} }
|
|
18
|
+
/>
|
|
19
|
+
</MenuItem>
|
|
20
|
+
);
|
|
21
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ThemeProvider as ThemeProviderBase, type ThemeProviderProps } from '@elementor/ui';
|
|
3
|
+
|
|
4
|
+
import { useColorScheme } from '../hooks/use-color-scheme';
|
|
5
|
+
|
|
6
|
+
const EDITOR_PALLETTE: ThemeProviderProps[ 'palette' ] = 'unstable';
|
|
7
|
+
|
|
8
|
+
export default function ThemeProvider( { children }: { children: React.ReactNode } ) {
|
|
9
|
+
const colorScheme = useColorScheme();
|
|
10
|
+
|
|
11
|
+
return (
|
|
12
|
+
<ThemeProviderBase colorScheme={ colorScheme } palette={ EDITOR_PALLETTE }>
|
|
13
|
+
{ children }
|
|
14
|
+
</ThemeProviderBase>
|
|
15
|
+
);
|
|
16
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { act, renderHook } from '@testing-library/react';
|
|
2
|
+
|
|
3
|
+
import { type ColorScheme, type ExtendedWindow, useColorScheme } from '../use-color-scheme';
|
|
4
|
+
|
|
5
|
+
describe( '@elementor/editor - useColorScheme', () => {
|
|
6
|
+
it( 'should use the "auto" color scheme by default', () => {
|
|
7
|
+
// Act.
|
|
8
|
+
const { result } = renderHook( () => useColorScheme() );
|
|
9
|
+
|
|
10
|
+
// Assert.
|
|
11
|
+
expect( result.current ).toBe( 'auto' );
|
|
12
|
+
} );
|
|
13
|
+
|
|
14
|
+
it( 'should sync color scheme on V1 ready', () => {
|
|
15
|
+
// Arrange.
|
|
16
|
+
mockV1ColorScheme( 'dark' );
|
|
17
|
+
|
|
18
|
+
// Act.
|
|
19
|
+
const { result } = renderHook( () => useColorScheme() );
|
|
20
|
+
|
|
21
|
+
act( () => {
|
|
22
|
+
dispatchEvent( new CustomEvent( 'elementor/initialized' ) );
|
|
23
|
+
} );
|
|
24
|
+
|
|
25
|
+
// Assert.
|
|
26
|
+
expect( result.current ).toBe( 'dark' );
|
|
27
|
+
} );
|
|
28
|
+
|
|
29
|
+
it( 'should sync color scheme on V1 change', () => {
|
|
30
|
+
// Arrange.
|
|
31
|
+
mockV1ColorScheme( 'auto' );
|
|
32
|
+
|
|
33
|
+
const { result } = renderHook( () => useColorScheme() );
|
|
34
|
+
|
|
35
|
+
// Assert - Before change.
|
|
36
|
+
expect( result.current ).toBe( 'auto' );
|
|
37
|
+
|
|
38
|
+
// Act - Change.
|
|
39
|
+
act( () => {
|
|
40
|
+
mockV1ColorScheme( 'dark' );
|
|
41
|
+
|
|
42
|
+
dispatchEvent(
|
|
43
|
+
new CustomEvent( 'elementor/commands/run/after', {
|
|
44
|
+
detail: {
|
|
45
|
+
command: 'document/elements/settings',
|
|
46
|
+
args: {
|
|
47
|
+
container: {
|
|
48
|
+
id: 'editorPreferences_settings',
|
|
49
|
+
},
|
|
50
|
+
settings: {
|
|
51
|
+
ui_theme: 'dark',
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
} )
|
|
56
|
+
);
|
|
57
|
+
} );
|
|
58
|
+
|
|
59
|
+
// Assert.
|
|
60
|
+
expect( result.current ).toBe( 'dark' );
|
|
61
|
+
} );
|
|
62
|
+
|
|
63
|
+
it( 'should not sync color scheme on unrelated commands', () => {
|
|
64
|
+
// Act.
|
|
65
|
+
const { result } = renderHook( () => useColorScheme() );
|
|
66
|
+
|
|
67
|
+
act( () => {
|
|
68
|
+
dispatchEvent(
|
|
69
|
+
new CustomEvent( 'elementor/commands/run/after', {
|
|
70
|
+
detail: {
|
|
71
|
+
command: 'document/elements/settings',
|
|
72
|
+
args: {
|
|
73
|
+
container: {
|
|
74
|
+
id: 'some_other_container',
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
} )
|
|
79
|
+
);
|
|
80
|
+
} );
|
|
81
|
+
|
|
82
|
+
// Assert.
|
|
83
|
+
expect( result.current ).toBe( 'auto' );
|
|
84
|
+
} );
|
|
85
|
+
} );
|
|
86
|
+
|
|
87
|
+
function mockV1ColorScheme( colorScheme: ColorScheme ) {
|
|
88
|
+
( window as unknown as ExtendedWindow ).elementor = {
|
|
89
|
+
getPreferences: () => colorScheme,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
__privateListenTo as listenTo,
|
|
4
|
+
commandEndEvent,
|
|
5
|
+
type CommandEvent,
|
|
6
|
+
v1ReadyEvent,
|
|
7
|
+
} from '@elementor/editor-v1-adapters';
|
|
8
|
+
|
|
9
|
+
export type ColorScheme = 'auto' | 'dark' | 'light';
|
|
10
|
+
|
|
11
|
+
export type ExtendedWindow = Window & {
|
|
12
|
+
elementor: {
|
|
13
|
+
getPreferences: ( key: 'ui_theme' ) => ColorScheme;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export function useColorScheme() {
|
|
18
|
+
const [ colorScheme, setColorScheme ] = useState< ColorScheme >( () => getV1ColorScheme() );
|
|
19
|
+
|
|
20
|
+
useEffect( () => {
|
|
21
|
+
return listenTo( v1ReadyEvent(), () => setColorScheme( getV1ColorScheme() ) );
|
|
22
|
+
}, [] );
|
|
23
|
+
|
|
24
|
+
useEffect( () => {
|
|
25
|
+
return listenTo( commandEndEvent( 'document/elements/settings' ), ( e ) => {
|
|
26
|
+
const event = e as CommandEvent< {
|
|
27
|
+
settings: {
|
|
28
|
+
ui_theme?: ColorScheme;
|
|
29
|
+
};
|
|
30
|
+
} >;
|
|
31
|
+
|
|
32
|
+
// The User-Preferences settings object has a key named `ui_theme` that controls the color scheme.
|
|
33
|
+
const isColorScheme = event.args?.settings && 'ui_theme' in event.args.settings;
|
|
34
|
+
|
|
35
|
+
if ( isColorScheme ) {
|
|
36
|
+
setColorScheme( getV1ColorScheme() );
|
|
37
|
+
}
|
|
38
|
+
} );
|
|
39
|
+
}, [] );
|
|
40
|
+
|
|
41
|
+
return colorScheme;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function getV1ColorScheme() {
|
|
45
|
+
return ( window as unknown as ExtendedWindow ).elementor?.getPreferences?.( 'ui_theme' ) || 'auto';
|
|
46
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
export { EllipsisWithTooltip } from './components/ellipsis-with-tooltip';
|
|
3
3
|
export { EditableField } from './components/editable-field';
|
|
4
4
|
export { IntroductionModal } from './components/introduction-modal';
|
|
5
|
+
export { default as ThemeProvider } from './components/theme-provider';
|
|
5
6
|
export { MenuListItem } from './components/menu-item';
|
|
7
|
+
export { InfoTipCard } from './components/infotip-card';
|
|
6
8
|
|
|
7
9
|
// hooks
|
|
8
10
|
export { useEditable } from './hooks/use-editable';
|