@elementor/editor-ui 3.33.0-156 → 3.33.0-158
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.d.mts +15 -11
- package/dist/index.d.ts +15 -11
- package/dist/index.js +68 -64
- package/dist/index.mjs +63 -55
- package/package.json +2 -2
- package/src/components/menu-item.tsx +20 -6
- package/src/components/popover/index.ts +0 -1
- package/src/components/{popover/search.tsx → search-field.tsx} +1 -1
- package/src/index.ts +2 -0
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React$1 from 'react';
|
|
2
2
|
import { ReactNode, PropsWithChildren, ReactElement } from 'react';
|
|
3
|
-
import { MenuItemProps, AlertProps, InfotipProps, MenuList, DialogProps, DialogContentTextProps } from '@elementor/ui';
|
|
3
|
+
import { MenuItemProps, MenuItemTextProps, TypographyProps, AlertProps, InfotipProps, MenuList, DialogProps, DialogContentTextProps } from '@elementor/ui';
|
|
4
4
|
import * as _emotion_styled from '@emotion/styled';
|
|
5
5
|
|
|
6
6
|
type EllipsisWithTooltipProps<T extends React$1.ElementType> = {
|
|
@@ -23,7 +23,11 @@ declare function ThemeProvider({ children }: {
|
|
|
23
23
|
children: React$1.ReactNode;
|
|
24
24
|
}): React$1.JSX.Element;
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
type MenuListItemProps = MenuItemProps & {
|
|
27
|
+
menuItemTextProps?: MenuItemTextProps;
|
|
28
|
+
primaryTypographyProps?: TypographyProps;
|
|
29
|
+
};
|
|
30
|
+
declare const MenuListItem: ({ children, menuItemTextProps, primaryTypographyProps, ...props }: MenuListItemProps) => React$1.JSX.Element;
|
|
27
31
|
declare const MenuItemInfotip: React$1.ForwardRefExoticComponent<{
|
|
28
32
|
showInfoTip?: boolean;
|
|
29
33
|
children: React$1.ReactNode;
|
|
@@ -67,6 +71,14 @@ type DialogContent = {
|
|
|
67
71
|
declare const openDialog: ({ component }: DialogContent) => void;
|
|
68
72
|
declare const closeDialog: () => void;
|
|
69
73
|
|
|
74
|
+
type Props = {
|
|
75
|
+
value: string;
|
|
76
|
+
onSearch: (search: string) => void;
|
|
77
|
+
placeholder: string;
|
|
78
|
+
id?: string;
|
|
79
|
+
};
|
|
80
|
+
declare const SearchField: ({ value, onSearch, placeholder, id }: Props) => React$1.JSX.Element;
|
|
81
|
+
|
|
70
82
|
type PopoverBodyProps = PropsWithChildren<{
|
|
71
83
|
height?: number | 'auto';
|
|
72
84
|
width?: number;
|
|
@@ -111,14 +123,6 @@ declare const StyledMenuList: _emotion_styled.StyledComponent<any, {}, {
|
|
|
111
123
|
ref?: React$1.Ref<any> | undefined;
|
|
112
124
|
}>;
|
|
113
125
|
|
|
114
|
-
type Props = {
|
|
115
|
-
value: string;
|
|
116
|
-
onSearch: (search: string) => void;
|
|
117
|
-
placeholder: string;
|
|
118
|
-
id?: string;
|
|
119
|
-
};
|
|
120
|
-
declare const PopoverSearch: ({ value, onSearch, placeholder, id }: Props) => React$1.JSX.Element;
|
|
121
|
-
|
|
122
126
|
declare const SaveChangesDialog: {
|
|
123
127
|
({ children, onClose }: Pick<DialogProps, "children" | "onClose">): React$1.JSX.Element;
|
|
124
128
|
Title: ({ children, onClose }: React$1.PropsWithChildren & {
|
|
@@ -171,4 +175,4 @@ declare const useEditable: ({ value, onSubmit, validation, onClick, onError }: U
|
|
|
171
175
|
};
|
|
172
176
|
};
|
|
173
177
|
|
|
174
|
-
export { EditableField, EllipsisWithTooltip, GlobalDialog, ITEM_HEIGHT, InfoAlert, InfoTipCard, IntroductionModal, MenuItemInfotip, MenuListItem, PopoverBody, PopoverHeader, PopoverMenuList, type PopoverMenuListProps,
|
|
178
|
+
export { EditableField, EllipsisWithTooltip, GlobalDialog, ITEM_HEIGHT, InfoAlert, InfoTipCard, IntroductionModal, MenuItemInfotip, MenuListItem, PopoverBody, PopoverHeader, PopoverMenuList, type PopoverMenuListProps, SaveChangesDialog, SearchField, StyledMenuList, ThemeProvider, type VirtualizedItem, WarningInfotip, closeDialog, openDialog, useDialog, useEditable };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React$1 from 'react';
|
|
2
2
|
import { ReactNode, PropsWithChildren, ReactElement } from 'react';
|
|
3
|
-
import { MenuItemProps, AlertProps, InfotipProps, MenuList, DialogProps, DialogContentTextProps } from '@elementor/ui';
|
|
3
|
+
import { MenuItemProps, MenuItemTextProps, TypographyProps, AlertProps, InfotipProps, MenuList, DialogProps, DialogContentTextProps } from '@elementor/ui';
|
|
4
4
|
import * as _emotion_styled from '@emotion/styled';
|
|
5
5
|
|
|
6
6
|
type EllipsisWithTooltipProps<T extends React$1.ElementType> = {
|
|
@@ -23,7 +23,11 @@ declare function ThemeProvider({ children }: {
|
|
|
23
23
|
children: React$1.ReactNode;
|
|
24
24
|
}): React$1.JSX.Element;
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
type MenuListItemProps = MenuItemProps & {
|
|
27
|
+
menuItemTextProps?: MenuItemTextProps;
|
|
28
|
+
primaryTypographyProps?: TypographyProps;
|
|
29
|
+
};
|
|
30
|
+
declare const MenuListItem: ({ children, menuItemTextProps, primaryTypographyProps, ...props }: MenuListItemProps) => React$1.JSX.Element;
|
|
27
31
|
declare const MenuItemInfotip: React$1.ForwardRefExoticComponent<{
|
|
28
32
|
showInfoTip?: boolean;
|
|
29
33
|
children: React$1.ReactNode;
|
|
@@ -67,6 +71,14 @@ type DialogContent = {
|
|
|
67
71
|
declare const openDialog: ({ component }: DialogContent) => void;
|
|
68
72
|
declare const closeDialog: () => void;
|
|
69
73
|
|
|
74
|
+
type Props = {
|
|
75
|
+
value: string;
|
|
76
|
+
onSearch: (search: string) => void;
|
|
77
|
+
placeholder: string;
|
|
78
|
+
id?: string;
|
|
79
|
+
};
|
|
80
|
+
declare const SearchField: ({ value, onSearch, placeholder, id }: Props) => React$1.JSX.Element;
|
|
81
|
+
|
|
70
82
|
type PopoverBodyProps = PropsWithChildren<{
|
|
71
83
|
height?: number | 'auto';
|
|
72
84
|
width?: number;
|
|
@@ -111,14 +123,6 @@ declare const StyledMenuList: _emotion_styled.StyledComponent<any, {}, {
|
|
|
111
123
|
ref?: React$1.Ref<any> | undefined;
|
|
112
124
|
}>;
|
|
113
125
|
|
|
114
|
-
type Props = {
|
|
115
|
-
value: string;
|
|
116
|
-
onSearch: (search: string) => void;
|
|
117
|
-
placeholder: string;
|
|
118
|
-
id?: string;
|
|
119
|
-
};
|
|
120
|
-
declare const PopoverSearch: ({ value, onSearch, placeholder, id }: Props) => React$1.JSX.Element;
|
|
121
|
-
|
|
122
126
|
declare const SaveChangesDialog: {
|
|
123
127
|
({ children, onClose }: Pick<DialogProps, "children" | "onClose">): React$1.JSX.Element;
|
|
124
128
|
Title: ({ children, onClose }: React$1.PropsWithChildren & {
|
|
@@ -171,4 +175,4 @@ declare const useEditable: ({ value, onSubmit, validation, onClick, onError }: U
|
|
|
171
175
|
};
|
|
172
176
|
};
|
|
173
177
|
|
|
174
|
-
export { EditableField, EllipsisWithTooltip, GlobalDialog, ITEM_HEIGHT, InfoAlert, InfoTipCard, IntroductionModal, MenuItemInfotip, MenuListItem, PopoverBody, PopoverHeader, PopoverMenuList, type PopoverMenuListProps,
|
|
178
|
+
export { EditableField, EllipsisWithTooltip, GlobalDialog, ITEM_HEIGHT, InfoAlert, InfoTipCard, IntroductionModal, MenuItemInfotip, MenuListItem, PopoverBody, PopoverHeader, PopoverMenuList, type PopoverMenuListProps, SaveChangesDialog, SearchField, StyledMenuList, ThemeProvider, type VirtualizedItem, WarningInfotip, closeDialog, openDialog, useDialog, useEditable };
|
package/dist/index.js
CHANGED
|
@@ -42,8 +42,8 @@ __export(index_exports, {
|
|
|
42
42
|
PopoverBody: () => PopoverBody,
|
|
43
43
|
PopoverHeader: () => PopoverHeader,
|
|
44
44
|
PopoverMenuList: () => PopoverMenuList,
|
|
45
|
-
PopoverSearch: () => PopoverSearch,
|
|
46
45
|
SaveChangesDialog: () => SaveChangesDialog,
|
|
46
|
+
SearchField: () => SearchField,
|
|
47
47
|
StyledMenuList: () => StyledMenuList,
|
|
48
48
|
ThemeProvider: () => ThemeProvider,
|
|
49
49
|
WarningInfotip: () => WarningInfotip,
|
|
@@ -213,7 +213,12 @@ var InfoAlert = (props) => /* @__PURE__ */ React5.createElement(
|
|
|
213
213
|
);
|
|
214
214
|
|
|
215
215
|
// src/components/menu-item.tsx
|
|
216
|
-
var MenuListItem = ({
|
|
216
|
+
var MenuListItem = ({
|
|
217
|
+
children,
|
|
218
|
+
menuItemTextProps,
|
|
219
|
+
primaryTypographyProps = { variant: "caption" },
|
|
220
|
+
...props
|
|
221
|
+
}) => {
|
|
217
222
|
return /* @__PURE__ */ React6.createElement(
|
|
218
223
|
import_ui6.MenuItem,
|
|
219
224
|
{
|
|
@@ -227,9 +232,8 @@ var MenuListItem = ({ children, ...props }) => {
|
|
|
227
232
|
import_ui6.MenuItemText,
|
|
228
233
|
{
|
|
229
234
|
primary: children,
|
|
230
|
-
primaryTypographyProps
|
|
231
|
-
|
|
232
|
-
}
|
|
235
|
+
primaryTypographyProps,
|
|
236
|
+
...menuItemTextProps
|
|
233
237
|
}
|
|
234
238
|
)
|
|
235
239
|
);
|
|
@@ -346,15 +350,50 @@ var GlobalDialog = () => {
|
|
|
346
350
|
return /* @__PURE__ */ React9.createElement(ThemeProvider, null, /* @__PURE__ */ React9.createElement(import_ui9.Dialog, { role: "dialog", open: true, onClose: closeDialog, maxWidth: "sm", fullWidth: true }, content.component));
|
|
347
351
|
};
|
|
348
352
|
|
|
349
|
-
// src/components/
|
|
353
|
+
// src/components/search-field.tsx
|
|
350
354
|
var React10 = __toESM(require("react"));
|
|
355
|
+
var import_react8 = require("react");
|
|
356
|
+
var import_icons2 = require("@elementor/icons");
|
|
351
357
|
var import_ui10 = require("@elementor/ui");
|
|
358
|
+
var import_i18n2 = require("@wordpress/i18n");
|
|
359
|
+
var SIZE = "tiny";
|
|
360
|
+
var SearchField = ({ value, onSearch, placeholder, id }) => {
|
|
361
|
+
const inputRef = (0, import_react8.useRef)(null);
|
|
362
|
+
const handleClear = () => {
|
|
363
|
+
onSearch("");
|
|
364
|
+
inputRef.current?.focus();
|
|
365
|
+
};
|
|
366
|
+
const handleInputChange = (event) => {
|
|
367
|
+
onSearch(event.target.value);
|
|
368
|
+
};
|
|
369
|
+
return /* @__PURE__ */ React10.createElement(import_ui10.Box, { sx: { px: 2, pb: 1.5 } }, /* @__PURE__ */ React10.createElement(
|
|
370
|
+
import_ui10.TextField,
|
|
371
|
+
{
|
|
372
|
+
autoFocus: true,
|
|
373
|
+
fullWidth: true,
|
|
374
|
+
id,
|
|
375
|
+
size: SIZE,
|
|
376
|
+
value,
|
|
377
|
+
inputRef,
|
|
378
|
+
onChange: handleInputChange,
|
|
379
|
+
placeholder,
|
|
380
|
+
InputProps: {
|
|
381
|
+
startAdornment: /* @__PURE__ */ React10.createElement(import_ui10.InputAdornment, { position: "start" }, /* @__PURE__ */ React10.createElement(import_icons2.SearchIcon, { fontSize: SIZE })),
|
|
382
|
+
endAdornment: value && /* @__PURE__ */ React10.createElement(import_ui10.IconButton, { size: SIZE, onClick: handleClear, "aria-label": (0, import_i18n2.__)("Clear", "elementor") }, /* @__PURE__ */ React10.createElement(import_icons2.XIcon, { color: "action", fontSize: SIZE }))
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
));
|
|
386
|
+
};
|
|
387
|
+
|
|
388
|
+
// src/components/popover/body.tsx
|
|
389
|
+
var React11 = __toESM(require("react"));
|
|
390
|
+
var import_ui11 = require("@elementor/ui");
|
|
352
391
|
var SECTION_PADDING_INLINE = 32;
|
|
353
392
|
var DEFAULT_POPOVER_HEIGHT = 348;
|
|
354
393
|
var FALLBACK_POPOVER_WIDTH = 220;
|
|
355
394
|
var PopoverBody = ({ children, height = DEFAULT_POPOVER_HEIGHT, width, id }) => {
|
|
356
|
-
return /* @__PURE__ */
|
|
357
|
-
|
|
395
|
+
return /* @__PURE__ */ React11.createElement(
|
|
396
|
+
import_ui11.Box,
|
|
358
397
|
{
|
|
359
398
|
display: "flex",
|
|
360
399
|
flexDirection: "column",
|
|
@@ -371,9 +410,9 @@ var PopoverBody = ({ children, height = DEFAULT_POPOVER_HEIGHT, width, id }) =>
|
|
|
371
410
|
};
|
|
372
411
|
|
|
373
412
|
// src/components/popover/header.tsx
|
|
374
|
-
var
|
|
375
|
-
var
|
|
376
|
-
var
|
|
413
|
+
var React12 = __toESM(require("react"));
|
|
414
|
+
var import_ui12 = require("@elementor/ui");
|
|
415
|
+
var SIZE2 = "tiny";
|
|
377
416
|
var PopoverHeader = ({ title, onClose, icon, actions }) => {
|
|
378
417
|
const paddingAndSizing = {
|
|
379
418
|
pl: 2,
|
|
@@ -381,23 +420,23 @@ var PopoverHeader = ({ title, onClose, icon, actions }) => {
|
|
|
381
420
|
py: 1.5,
|
|
382
421
|
maxHeight: 36
|
|
383
422
|
};
|
|
384
|
-
return /* @__PURE__ */
|
|
423
|
+
return /* @__PURE__ */ React12.createElement(import_ui12.Stack, { direction: "row", alignItems: "center", ...paddingAndSizing, sx: { columnGap: 0.5 } }, icon, /* @__PURE__ */ React12.createElement(import_ui12.Typography, { variant: "subtitle2", sx: { fontSize: "12px", mt: 0.25 } }, title), /* @__PURE__ */ React12.createElement(import_ui12.Stack, { direction: "row", sx: { ml: "auto" } }, actions, /* @__PURE__ */ React12.createElement(import_ui12.CloseButton, { slotProps: { icon: { fontSize: SIZE2 } }, sx: { ml: "auto" }, onClick: onClose })));
|
|
385
424
|
};
|
|
386
425
|
|
|
387
426
|
// src/components/popover/menu-list.tsx
|
|
388
|
-
var
|
|
389
|
-
var
|
|
390
|
-
var
|
|
427
|
+
var React13 = __toESM(require("react"));
|
|
428
|
+
var import_react11 = require("react");
|
|
429
|
+
var import_ui13 = require("@elementor/ui");
|
|
391
430
|
var import_react_virtual = require("@tanstack/react-virtual");
|
|
392
431
|
|
|
393
432
|
// src/hooks/use-scroll-to-selected.ts
|
|
394
|
-
var
|
|
433
|
+
var import_react9 = require("react");
|
|
395
434
|
var useScrollToSelected = ({
|
|
396
435
|
selectedValue,
|
|
397
436
|
items,
|
|
398
437
|
virtualizer
|
|
399
438
|
}) => {
|
|
400
|
-
(0,
|
|
439
|
+
(0, import_react9.useEffect)(() => {
|
|
401
440
|
if (!selectedValue || items.length === 0) {
|
|
402
441
|
return;
|
|
403
442
|
}
|
|
@@ -409,10 +448,10 @@ var useScrollToSelected = ({
|
|
|
409
448
|
};
|
|
410
449
|
|
|
411
450
|
// src/hooks/use-scroll-top.ts
|
|
412
|
-
var
|
|
451
|
+
var import_react10 = require("react");
|
|
413
452
|
var useScrollTop = ({ containerRef }) => {
|
|
414
|
-
const [scrollTop, setScrollTop] = (0,
|
|
415
|
-
(0,
|
|
453
|
+
const [scrollTop, setScrollTop] = (0, import_react10.useState)(0);
|
|
454
|
+
(0, import_react10.useEffect)(() => {
|
|
416
455
|
const container = containerRef.current;
|
|
417
456
|
if (!container) {
|
|
418
457
|
return;
|
|
@@ -451,10 +490,10 @@ var PopoverMenuList = ({
|
|
|
451
490
|
noResultsComponent,
|
|
452
491
|
menuListTemplate: CustomMenuList
|
|
453
492
|
}) => {
|
|
454
|
-
const containerRef = (0,
|
|
493
|
+
const containerRef = (0, import_react11.useRef)(null);
|
|
455
494
|
const scrollTop = useScrollTop({ containerRef });
|
|
456
495
|
const MenuListComponent = CustomMenuList || StyledMenuList;
|
|
457
|
-
const stickyIndices = (0,
|
|
496
|
+
const stickyIndices = (0, import_react11.useMemo)(
|
|
458
497
|
() => items.reduce((categoryIndices, item, index) => {
|
|
459
498
|
if (item.type === "category") {
|
|
460
499
|
categoryIndices.push(index);
|
|
@@ -486,7 +525,7 @@ var PopoverMenuList = ({
|
|
|
486
525
|
});
|
|
487
526
|
useScrollToSelected({ selectedValue, items, virtualizer });
|
|
488
527
|
const virtualItems = virtualizer.getVirtualItems();
|
|
489
|
-
return /* @__PURE__ */
|
|
528
|
+
return /* @__PURE__ */ React13.createElement(import_ui13.Box, { ref: containerRef, sx: { height: "100%", overflowY: "auto" } }, items.length === 0 && noResultsComponent ? noResultsComponent : /* @__PURE__ */ React13.createElement(
|
|
490
529
|
MenuListComponent,
|
|
491
530
|
{
|
|
492
531
|
role: "listbox",
|
|
@@ -504,8 +543,8 @@ var PopoverMenuList = ({
|
|
|
504
543
|
}
|
|
505
544
|
if (item.type === "category") {
|
|
506
545
|
const shouldStick = virtualRow.start + MENU_LIST_PADDING_TOP <= scrollTop;
|
|
507
|
-
return /* @__PURE__ */
|
|
508
|
-
|
|
546
|
+
return /* @__PURE__ */ React13.createElement(
|
|
547
|
+
import_ui13.MenuSubheader,
|
|
509
548
|
{
|
|
510
549
|
key: virtualRow.key,
|
|
511
550
|
style: shouldStick ? {} : menuSubHeaderAbsoluteStyling(virtualRow.start),
|
|
@@ -515,8 +554,8 @@ var PopoverMenuList = ({
|
|
|
515
554
|
);
|
|
516
555
|
}
|
|
517
556
|
const isDisabled = item.disabled;
|
|
518
|
-
return /* @__PURE__ */
|
|
519
|
-
|
|
557
|
+
return /* @__PURE__ */ React13.createElement(
|
|
558
|
+
import_ui13.ListItem,
|
|
520
559
|
{
|
|
521
560
|
key: virtualRow.key,
|
|
522
561
|
role: "option",
|
|
@@ -554,7 +593,7 @@ var PopoverMenuList = ({
|
|
|
554
593
|
})
|
|
555
594
|
));
|
|
556
595
|
};
|
|
557
|
-
var StyledMenuList = (0,
|
|
596
|
+
var StyledMenuList = (0, import_ui13.styled)(import_ui13.MenuList)(({ theme }) => ({
|
|
558
597
|
"& > li": {
|
|
559
598
|
height: ITEM_HEIGHT,
|
|
560
599
|
width: "100%",
|
|
@@ -584,41 +623,6 @@ var StyledMenuList = (0, import_ui12.styled)(import_ui12.MenuList)(({ theme }) =
|
|
|
584
623
|
position: "relative"
|
|
585
624
|
}));
|
|
586
625
|
|
|
587
|
-
// src/components/popover/search.tsx
|
|
588
|
-
var React13 = __toESM(require("react"));
|
|
589
|
-
var import_react11 = require("react");
|
|
590
|
-
var import_icons2 = require("@elementor/icons");
|
|
591
|
-
var import_ui13 = require("@elementor/ui");
|
|
592
|
-
var import_i18n2 = require("@wordpress/i18n");
|
|
593
|
-
var SIZE2 = "tiny";
|
|
594
|
-
var PopoverSearch = ({ value, onSearch, placeholder, id }) => {
|
|
595
|
-
const inputRef = (0, import_react11.useRef)(null);
|
|
596
|
-
const handleClear = () => {
|
|
597
|
-
onSearch("");
|
|
598
|
-
inputRef.current?.focus();
|
|
599
|
-
};
|
|
600
|
-
const handleInputChange = (event) => {
|
|
601
|
-
onSearch(event.target.value);
|
|
602
|
-
};
|
|
603
|
-
return /* @__PURE__ */ React13.createElement(import_ui13.Box, { sx: { px: 2, pb: 1.5 } }, /* @__PURE__ */ React13.createElement(
|
|
604
|
-
import_ui13.TextField,
|
|
605
|
-
{
|
|
606
|
-
autoFocus: true,
|
|
607
|
-
fullWidth: true,
|
|
608
|
-
id,
|
|
609
|
-
size: SIZE2,
|
|
610
|
-
value,
|
|
611
|
-
inputRef,
|
|
612
|
-
onChange: handleInputChange,
|
|
613
|
-
placeholder,
|
|
614
|
-
InputProps: {
|
|
615
|
-
startAdornment: /* @__PURE__ */ React13.createElement(import_ui13.InputAdornment, { position: "start" }, /* @__PURE__ */ React13.createElement(import_icons2.SearchIcon, { fontSize: SIZE2 })),
|
|
616
|
-
endAdornment: value && /* @__PURE__ */ React13.createElement(import_ui13.IconButton, { size: SIZE2, onClick: handleClear, "aria-label": (0, import_i18n2.__)("Clear", "elementor") }, /* @__PURE__ */ React13.createElement(import_icons2.XIcon, { color: "action", fontSize: SIZE2 }))
|
|
617
|
-
}
|
|
618
|
-
}
|
|
619
|
-
));
|
|
620
|
-
};
|
|
621
|
-
|
|
622
626
|
// src/components/save-changes-dialog.tsx
|
|
623
627
|
var React14 = __toESM(require("react"));
|
|
624
628
|
var import_react12 = require("react");
|
|
@@ -770,8 +774,8 @@ var selectAll = (el) => {
|
|
|
770
774
|
PopoverBody,
|
|
771
775
|
PopoverHeader,
|
|
772
776
|
PopoverMenuList,
|
|
773
|
-
PopoverSearch,
|
|
774
777
|
SaveChangesDialog,
|
|
778
|
+
SearchField,
|
|
775
779
|
StyledMenuList,
|
|
776
780
|
ThemeProvider,
|
|
777
781
|
WarningInfotip,
|
package/dist/index.mjs
CHANGED
|
@@ -152,7 +152,11 @@ function ThemeProvider({ children }) {
|
|
|
152
152
|
// src/components/menu-item.tsx
|
|
153
153
|
import * as React6 from "react";
|
|
154
154
|
import { forwardRef as forwardRef4 } from "react";
|
|
155
|
-
import {
|
|
155
|
+
import {
|
|
156
|
+
Infotip,
|
|
157
|
+
MenuItem,
|
|
158
|
+
MenuItemText
|
|
159
|
+
} from "@elementor/ui";
|
|
156
160
|
|
|
157
161
|
// src/components/info-alert.tsx
|
|
158
162
|
import * as React5 from "react";
|
|
@@ -171,7 +175,12 @@ var InfoAlert = (props) => /* @__PURE__ */ React5.createElement(
|
|
|
171
175
|
);
|
|
172
176
|
|
|
173
177
|
// src/components/menu-item.tsx
|
|
174
|
-
var MenuListItem = ({
|
|
178
|
+
var MenuListItem = ({
|
|
179
|
+
children,
|
|
180
|
+
menuItemTextProps,
|
|
181
|
+
primaryTypographyProps = { variant: "caption" },
|
|
182
|
+
...props
|
|
183
|
+
}) => {
|
|
175
184
|
return /* @__PURE__ */ React6.createElement(
|
|
176
185
|
MenuItem,
|
|
177
186
|
{
|
|
@@ -185,9 +194,8 @@ var MenuListItem = ({ children, ...props }) => {
|
|
|
185
194
|
MenuItemText,
|
|
186
195
|
{
|
|
187
196
|
primary: children,
|
|
188
|
-
primaryTypographyProps
|
|
189
|
-
|
|
190
|
-
}
|
|
197
|
+
primaryTypographyProps,
|
|
198
|
+
...menuItemTextProps
|
|
191
199
|
}
|
|
192
200
|
)
|
|
193
201
|
);
|
|
@@ -304,15 +312,50 @@ var GlobalDialog = () => {
|
|
|
304
312
|
return /* @__PURE__ */ React9.createElement(ThemeProvider, null, /* @__PURE__ */ React9.createElement(Dialog2, { role: "dialog", open: true, onClose: closeDialog, maxWidth: "sm", fullWidth: true }, content.component));
|
|
305
313
|
};
|
|
306
314
|
|
|
307
|
-
// src/components/
|
|
315
|
+
// src/components/search-field.tsx
|
|
308
316
|
import * as React10 from "react";
|
|
309
|
-
import {
|
|
317
|
+
import { useRef } from "react";
|
|
318
|
+
import { SearchIcon, XIcon } from "@elementor/icons";
|
|
319
|
+
import { Box as Box4, IconButton, InputAdornment, TextField } from "@elementor/ui";
|
|
320
|
+
import { __ as __2 } from "@wordpress/i18n";
|
|
321
|
+
var SIZE = "tiny";
|
|
322
|
+
var SearchField = ({ value, onSearch, placeholder, id }) => {
|
|
323
|
+
const inputRef = useRef(null);
|
|
324
|
+
const handleClear = () => {
|
|
325
|
+
onSearch("");
|
|
326
|
+
inputRef.current?.focus();
|
|
327
|
+
};
|
|
328
|
+
const handleInputChange = (event) => {
|
|
329
|
+
onSearch(event.target.value);
|
|
330
|
+
};
|
|
331
|
+
return /* @__PURE__ */ React10.createElement(Box4, { sx: { px: 2, pb: 1.5 } }, /* @__PURE__ */ React10.createElement(
|
|
332
|
+
TextField,
|
|
333
|
+
{
|
|
334
|
+
autoFocus: true,
|
|
335
|
+
fullWidth: true,
|
|
336
|
+
id,
|
|
337
|
+
size: SIZE,
|
|
338
|
+
value,
|
|
339
|
+
inputRef,
|
|
340
|
+
onChange: handleInputChange,
|
|
341
|
+
placeholder,
|
|
342
|
+
InputProps: {
|
|
343
|
+
startAdornment: /* @__PURE__ */ React10.createElement(InputAdornment, { position: "start" }, /* @__PURE__ */ React10.createElement(SearchIcon, { fontSize: SIZE })),
|
|
344
|
+
endAdornment: value && /* @__PURE__ */ React10.createElement(IconButton, { size: SIZE, onClick: handleClear, "aria-label": __2("Clear", "elementor") }, /* @__PURE__ */ React10.createElement(XIcon, { color: "action", fontSize: SIZE }))
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
));
|
|
348
|
+
};
|
|
349
|
+
|
|
350
|
+
// src/components/popover/body.tsx
|
|
351
|
+
import * as React11 from "react";
|
|
352
|
+
import { Box as Box5 } from "@elementor/ui";
|
|
310
353
|
var SECTION_PADDING_INLINE = 32;
|
|
311
354
|
var DEFAULT_POPOVER_HEIGHT = 348;
|
|
312
355
|
var FALLBACK_POPOVER_WIDTH = 220;
|
|
313
356
|
var PopoverBody = ({ children, height = DEFAULT_POPOVER_HEIGHT, width, id }) => {
|
|
314
|
-
return /* @__PURE__ */
|
|
315
|
-
|
|
357
|
+
return /* @__PURE__ */ React11.createElement(
|
|
358
|
+
Box5,
|
|
316
359
|
{
|
|
317
360
|
display: "flex",
|
|
318
361
|
flexDirection: "column",
|
|
@@ -329,9 +372,9 @@ var PopoverBody = ({ children, height = DEFAULT_POPOVER_HEIGHT, width, id }) =>
|
|
|
329
372
|
};
|
|
330
373
|
|
|
331
374
|
// src/components/popover/header.tsx
|
|
332
|
-
import * as
|
|
375
|
+
import * as React12 from "react";
|
|
333
376
|
import { CloseButton, Stack, Typography as Typography3 } from "@elementor/ui";
|
|
334
|
-
var
|
|
377
|
+
var SIZE2 = "tiny";
|
|
335
378
|
var PopoverHeader = ({ title, onClose, icon, actions }) => {
|
|
336
379
|
const paddingAndSizing = {
|
|
337
380
|
pl: 2,
|
|
@@ -339,13 +382,13 @@ var PopoverHeader = ({ title, onClose, icon, actions }) => {
|
|
|
339
382
|
py: 1.5,
|
|
340
383
|
maxHeight: 36
|
|
341
384
|
};
|
|
342
|
-
return /* @__PURE__ */
|
|
385
|
+
return /* @__PURE__ */ React12.createElement(Stack, { direction: "row", alignItems: "center", ...paddingAndSizing, sx: { columnGap: 0.5 } }, icon, /* @__PURE__ */ React12.createElement(Typography3, { variant: "subtitle2", sx: { fontSize: "12px", mt: 0.25 } }, title), /* @__PURE__ */ React12.createElement(Stack, { direction: "row", sx: { ml: "auto" } }, actions, /* @__PURE__ */ React12.createElement(CloseButton, { slotProps: { icon: { fontSize: SIZE2 } }, sx: { ml: "auto" }, onClick: onClose })));
|
|
343
386
|
};
|
|
344
387
|
|
|
345
388
|
// src/components/popover/menu-list.tsx
|
|
346
|
-
import * as
|
|
347
|
-
import { useMemo, useRef } from "react";
|
|
348
|
-
import { Box as
|
|
389
|
+
import * as React13 from "react";
|
|
390
|
+
import { useMemo, useRef as useRef2 } from "react";
|
|
391
|
+
import { Box as Box6, ListItem, MenuList, MenuSubheader, styled as styled2 } from "@elementor/ui";
|
|
349
392
|
import { useVirtualizer } from "@tanstack/react-virtual";
|
|
350
393
|
|
|
351
394
|
// src/hooks/use-scroll-to-selected.ts
|
|
@@ -409,7 +452,7 @@ var PopoverMenuList = ({
|
|
|
409
452
|
noResultsComponent,
|
|
410
453
|
menuListTemplate: CustomMenuList
|
|
411
454
|
}) => {
|
|
412
|
-
const containerRef =
|
|
455
|
+
const containerRef = useRef2(null);
|
|
413
456
|
const scrollTop = useScrollTop({ containerRef });
|
|
414
457
|
const MenuListComponent = CustomMenuList || StyledMenuList;
|
|
415
458
|
const stickyIndices = useMemo(
|
|
@@ -444,7 +487,7 @@ var PopoverMenuList = ({
|
|
|
444
487
|
});
|
|
445
488
|
useScrollToSelected({ selectedValue, items, virtualizer });
|
|
446
489
|
const virtualItems = virtualizer.getVirtualItems();
|
|
447
|
-
return /* @__PURE__ */
|
|
490
|
+
return /* @__PURE__ */ React13.createElement(Box6, { ref: containerRef, sx: { height: "100%", overflowY: "auto" } }, items.length === 0 && noResultsComponent ? noResultsComponent : /* @__PURE__ */ React13.createElement(
|
|
448
491
|
MenuListComponent,
|
|
449
492
|
{
|
|
450
493
|
role: "listbox",
|
|
@@ -462,7 +505,7 @@ var PopoverMenuList = ({
|
|
|
462
505
|
}
|
|
463
506
|
if (item.type === "category") {
|
|
464
507
|
const shouldStick = virtualRow.start + MENU_LIST_PADDING_TOP <= scrollTop;
|
|
465
|
-
return /* @__PURE__ */
|
|
508
|
+
return /* @__PURE__ */ React13.createElement(
|
|
466
509
|
MenuSubheader,
|
|
467
510
|
{
|
|
468
511
|
key: virtualRow.key,
|
|
@@ -473,7 +516,7 @@ var PopoverMenuList = ({
|
|
|
473
516
|
);
|
|
474
517
|
}
|
|
475
518
|
const isDisabled = item.disabled;
|
|
476
|
-
return /* @__PURE__ */
|
|
519
|
+
return /* @__PURE__ */ React13.createElement(
|
|
477
520
|
ListItem,
|
|
478
521
|
{
|
|
479
522
|
key: virtualRow.key,
|
|
@@ -542,41 +585,6 @@ var StyledMenuList = styled2(MenuList)(({ theme }) => ({
|
|
|
542
585
|
position: "relative"
|
|
543
586
|
}));
|
|
544
587
|
|
|
545
|
-
// src/components/popover/search.tsx
|
|
546
|
-
import * as React13 from "react";
|
|
547
|
-
import { useRef as useRef2 } from "react";
|
|
548
|
-
import { SearchIcon, XIcon } from "@elementor/icons";
|
|
549
|
-
import { Box as Box6, IconButton, InputAdornment, TextField } from "@elementor/ui";
|
|
550
|
-
import { __ as __2 } from "@wordpress/i18n";
|
|
551
|
-
var SIZE2 = "tiny";
|
|
552
|
-
var PopoverSearch = ({ value, onSearch, placeholder, id }) => {
|
|
553
|
-
const inputRef = useRef2(null);
|
|
554
|
-
const handleClear = () => {
|
|
555
|
-
onSearch("");
|
|
556
|
-
inputRef.current?.focus();
|
|
557
|
-
};
|
|
558
|
-
const handleInputChange = (event) => {
|
|
559
|
-
onSearch(event.target.value);
|
|
560
|
-
};
|
|
561
|
-
return /* @__PURE__ */ React13.createElement(Box6, { sx: { px: 2, pb: 1.5 } }, /* @__PURE__ */ React13.createElement(
|
|
562
|
-
TextField,
|
|
563
|
-
{
|
|
564
|
-
autoFocus: true,
|
|
565
|
-
fullWidth: true,
|
|
566
|
-
id,
|
|
567
|
-
size: SIZE2,
|
|
568
|
-
value,
|
|
569
|
-
inputRef,
|
|
570
|
-
onChange: handleInputChange,
|
|
571
|
-
placeholder,
|
|
572
|
-
InputProps: {
|
|
573
|
-
startAdornment: /* @__PURE__ */ React13.createElement(InputAdornment, { position: "start" }, /* @__PURE__ */ React13.createElement(SearchIcon, { fontSize: SIZE2 })),
|
|
574
|
-
endAdornment: value && /* @__PURE__ */ React13.createElement(IconButton, { size: SIZE2, onClick: handleClear, "aria-label": __2("Clear", "elementor") }, /* @__PURE__ */ React13.createElement(XIcon, { color: "action", fontSize: SIZE2 }))
|
|
575
|
-
}
|
|
576
|
-
}
|
|
577
|
-
));
|
|
578
|
-
};
|
|
579
|
-
|
|
580
588
|
// src/components/save-changes-dialog.tsx
|
|
581
589
|
import * as React14 from "react";
|
|
582
590
|
import { useState as useState6 } from "react";
|
|
@@ -736,8 +744,8 @@ export {
|
|
|
736
744
|
PopoverBody,
|
|
737
745
|
PopoverHeader,
|
|
738
746
|
PopoverMenuList,
|
|
739
|
-
PopoverSearch,
|
|
740
747
|
SaveChangesDialog,
|
|
748
|
+
SearchField,
|
|
741
749
|
StyledMenuList,
|
|
742
750
|
ThemeProvider,
|
|
743
751
|
WarningInfotip,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elementor/editor-ui",
|
|
3
3
|
"description": "Elementor Editor UI",
|
|
4
|
-
"version": "3.33.0-
|
|
4
|
+
"version": "3.33.0-158",
|
|
5
5
|
"private": false,
|
|
6
6
|
"author": "Elementor Team",
|
|
7
7
|
"homepage": "https://elementor.com/",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"react-dom": "^18.3.1"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@elementor/editor-v1-adapters": "3.33.0-
|
|
40
|
+
"@elementor/editor-v1-adapters": "3.33.0-158",
|
|
41
41
|
"@elementor/icons": "1.46.0",
|
|
42
42
|
"@elementor/ui": "1.36.12",
|
|
43
43
|
"@tanstack/react-virtual": "^3.13.3",
|
|
@@ -1,10 +1,25 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
Infotip,
|
|
5
|
+
MenuItem,
|
|
6
|
+
type MenuItemProps,
|
|
7
|
+
MenuItemText,
|
|
8
|
+
type MenuItemTextProps,
|
|
9
|
+
type TypographyProps,
|
|
10
|
+
} from '@elementor/ui';
|
|
4
11
|
|
|
5
12
|
import { InfoAlert } from './info-alert';
|
|
6
|
-
|
|
7
|
-
|
|
13
|
+
type MenuListItemProps = MenuItemProps & {
|
|
14
|
+
menuItemTextProps?: MenuItemTextProps;
|
|
15
|
+
primaryTypographyProps?: TypographyProps;
|
|
16
|
+
};
|
|
17
|
+
export const MenuListItem = ( {
|
|
18
|
+
children,
|
|
19
|
+
menuItemTextProps,
|
|
20
|
+
primaryTypographyProps = { variant: 'caption' },
|
|
21
|
+
...props
|
|
22
|
+
}: MenuListItemProps ) => {
|
|
8
23
|
return (
|
|
9
24
|
<MenuItem
|
|
10
25
|
dense
|
|
@@ -15,9 +30,8 @@ export const MenuListItem = ( { children, ...props }: MenuItemProps ) => {
|
|
|
15
30
|
>
|
|
16
31
|
<MenuItemText
|
|
17
32
|
primary={ children }
|
|
18
|
-
primaryTypographyProps={
|
|
19
|
-
|
|
20
|
-
} }
|
|
33
|
+
primaryTypographyProps={ primaryTypographyProps }
|
|
34
|
+
{ ...menuItemTextProps }
|
|
21
35
|
/>
|
|
22
36
|
</MenuItem>
|
|
23
37
|
);
|
|
@@ -2,4 +2,3 @@ export { PopoverBody } from './body';
|
|
|
2
2
|
export { PopoverHeader } from './header';
|
|
3
3
|
export { ITEM_HEIGHT, PopoverMenuList, StyledMenuList } from './menu-list';
|
|
4
4
|
export type { PopoverMenuListProps, VirtualizedItem } from './menu-list';
|
|
5
|
-
export { PopoverSearch } from './search';
|
|
@@ -13,7 +13,7 @@ type Props = {
|
|
|
13
13
|
id?: string;
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
export const
|
|
16
|
+
export const SearchField = ( { value, onSearch, placeholder, id }: Props ) => {
|
|
17
17
|
const inputRef = useRef< HTMLInputElement | null >( null );
|
|
18
18
|
|
|
19
19
|
const handleClear = () => {
|
package/src/index.ts
CHANGED
|
@@ -8,6 +8,8 @@ export { InfoTipCard } from './components/infotip-card';
|
|
|
8
8
|
export { InfoAlert } from './components/info-alert';
|
|
9
9
|
export { WarningInfotip } from './components/warning-infotip';
|
|
10
10
|
export { GlobalDialog, openDialog, closeDialog } from './components/global-dialog';
|
|
11
|
+
export { SearchField } from './components/search-field';
|
|
12
|
+
|
|
11
13
|
export * from './components/popover';
|
|
12
14
|
export * from './components/save-changes-dialog';
|
|
13
15
|
|