@elementor/editor-controls 3.33.0-112 → 3.33.0-113
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 +43 -3
- package/dist/index.d.ts +43 -3
- package/dist/index.js +213 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +223 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +14 -14
- package/src/bound-prop-context/prop-context.tsx +4 -0
- package/src/components/repeater.tsx +22 -12
- package/src/index.ts +1 -0
package/dist/index.d.mts
CHANGED
|
@@ -144,12 +144,12 @@ declare const NumberControl: ControlComponent<({ placeholder: labelPlaceholder,
|
|
|
144
144
|
}) => React$1.JSX.Element>;
|
|
145
145
|
|
|
146
146
|
type MultiSizePropValue = Record<PropKey, SizePropValue>;
|
|
147
|
-
type Item = {
|
|
147
|
+
type Item$1 = {
|
|
148
148
|
icon: ReactNode;
|
|
149
149
|
label: string;
|
|
150
150
|
bind: PropKey;
|
|
151
151
|
};
|
|
152
|
-
type EqualUnequalItems = [Item, Item, Item, Item];
|
|
152
|
+
type EqualUnequalItems = [Item$1, Item$1, Item$1, Item$1];
|
|
153
153
|
type Props$2<TMultiPropType extends string, TPropValue extends MultiSizePropValue> = {
|
|
154
154
|
label: string;
|
|
155
155
|
icon: ReactNode;
|
|
@@ -324,6 +324,42 @@ type CssEditorProps = {
|
|
|
324
324
|
};
|
|
325
325
|
declare const CssEditor: ({ value, onChange }: CssEditorProps) => React$1.JSX.Element;
|
|
326
326
|
|
|
327
|
+
type AnchorEl = HTMLElement | null;
|
|
328
|
+
type Item<T> = {
|
|
329
|
+
disabled?: boolean;
|
|
330
|
+
} & T;
|
|
331
|
+
type CollectionPropUtil<T> = PropTypeUtil<PropKey, T[]>;
|
|
332
|
+
type RepeaterItemContentProps<T> = {
|
|
333
|
+
anchorEl: AnchorEl;
|
|
334
|
+
bind: PropKey;
|
|
335
|
+
value: T;
|
|
336
|
+
collectionPropUtil?: CollectionPropUtil<T>;
|
|
337
|
+
};
|
|
338
|
+
type RepeaterItemContent<T> = React$1.ComponentType<RepeaterItemContentProps<T>>;
|
|
339
|
+
type RepeaterProps<T> = {
|
|
340
|
+
label: string;
|
|
341
|
+
values?: T[];
|
|
342
|
+
addToBottom?: boolean;
|
|
343
|
+
openOnAdd?: boolean;
|
|
344
|
+
setValues: (newValue: T[]) => void;
|
|
345
|
+
disabled?: boolean;
|
|
346
|
+
itemSettings: {
|
|
347
|
+
initialValues: T;
|
|
348
|
+
Label: React$1.ComponentType<{
|
|
349
|
+
value: T;
|
|
350
|
+
}>;
|
|
351
|
+
Icon: React$1.ComponentType<{
|
|
352
|
+
value: T;
|
|
353
|
+
}>;
|
|
354
|
+
Content: RepeaterItemContent<T>;
|
|
355
|
+
};
|
|
356
|
+
showDuplicate?: boolean;
|
|
357
|
+
showToggle?: boolean;
|
|
358
|
+
isSortable?: boolean;
|
|
359
|
+
collectionPropUtil?: CollectionPropUtil<T>;
|
|
360
|
+
};
|
|
361
|
+
declare const Repeater: <T>({ label, itemSettings, disabled, openOnAdd, addToBottom, values: repeaterValues, setValues: setRepeaterValues, showDuplicate, showToggle, isSortable, collectionPropUtil, }: RepeaterProps<Item<T>>) => React$1.JSX.Element;
|
|
362
|
+
|
|
327
363
|
type AnyComponentType = ComponentType<any>;
|
|
328
364
|
declare const brandSymbol: unique symbol;
|
|
329
365
|
type ControlComponent<TComponent extends AnyComponentType = AnyComponentType> = TComponent & {
|
|
@@ -345,6 +381,10 @@ declare const useControlActions: () => ControlActionsContext;
|
|
|
345
381
|
type SetValueMeta = {
|
|
346
382
|
bind?: PropKey;
|
|
347
383
|
validation?: (value: PropValue) => boolean;
|
|
384
|
+
action?: {
|
|
385
|
+
type: string;
|
|
386
|
+
payload?: Record<string, unknown>;
|
|
387
|
+
};
|
|
348
388
|
};
|
|
349
389
|
type SetValue<T> = (value: T, options?: CreateOptions, meta?: SetValueMeta) => void;
|
|
350
390
|
type PropContext<T extends PropValue, P extends PropType> = {
|
|
@@ -451,4 +491,4 @@ type UseInternalStateOptions<TValue> = {
|
|
|
451
491
|
};
|
|
452
492
|
declare const useSyncExternalState: <TValue>({ external, setExternal, persistWhen, fallback, }: UseInternalStateOptions<TValue>) => readonly [TValue, (setter: ((value: TValue) => TValue) | TValue, options?: CreateOptions, meta?: SetValueMeta) => void];
|
|
453
493
|
|
|
454
|
-
export { type AngleUnit, AspectRatioControl, BackgroundControl, BoxShadowRepeaterControl, ColorControl, type ControlActionsItems, ControlActionsProvider, ControlAdornments, ControlAdornmentsProvider, type ControlComponent, ControlFormLabel, ControlReplacementsProvider, ControlToggleButtonGroup, CssEditor, type EqualUnequalItems, EqualUnequalSizesControl, type ExtendedOption, FilterRepeaterControl, type FontCategory, FontFamilyControl, GapControl, ImageControl, ItemSelector, KeyValueControl, type LengthUnit, LinkControl, LinkedDimensionsControl, NumberControl, PopoverContent, PositionControl, PropKeyProvider, PropProvider, type PropProviderProps, RepeatableControl, SelectControl, type SetValue, SizeControl, StrokeControl, SvgMediaControl, SwitchControl, TextAreaControl, TextControl, type TimeUnit, type ToggleButtonGroupItem, ToggleControl, type ToggleControlProps, TransformBaseControl, TransformRepeaterControl, TransitionRepeaterControl, type Unit, UrlControl, createControl, createControlReplacementsRegistry, enqueueFont, injectIntoRepeaterHeaderActions, injectIntoRepeaterItemActions, injectIntoRepeaterItemIcon, injectIntoRepeaterItemLabel, transitionProperties, transitionsItemsList, useBoundProp, useControlActions, useFloatingActionsBar, useSyncExternalState };
|
|
494
|
+
export { type AngleUnit, AspectRatioControl, BackgroundControl, BoxShadowRepeaterControl, ColorControl, type ControlActionsItems, ControlActionsProvider, ControlAdornments, ControlAdornmentsProvider, type ControlComponent, ControlFormLabel, ControlReplacementsProvider, ControlToggleButtonGroup, CssEditor, type EqualUnequalItems, EqualUnequalSizesControl, type ExtendedOption, FilterRepeaterControl, type FontCategory, FontFamilyControl, GapControl, ImageControl, ItemSelector, KeyValueControl, type LengthUnit, LinkControl, LinkedDimensionsControl, NumberControl, PopoverContent, PositionControl, PropKeyProvider, PropProvider, type PropProviderProps, RepeatableControl, Repeater, SelectControl, type SetValue, SizeControl, StrokeControl, SvgMediaControl, SwitchControl, TextAreaControl, TextControl, type TimeUnit, type ToggleButtonGroupItem, ToggleControl, type ToggleControlProps, TransformBaseControl, TransformRepeaterControl, TransitionRepeaterControl, type Unit, UrlControl, createControl, createControlReplacementsRegistry, enqueueFont, injectIntoRepeaterHeaderActions, injectIntoRepeaterItemActions, injectIntoRepeaterItemIcon, injectIntoRepeaterItemLabel, transitionProperties, transitionsItemsList, useBoundProp, useControlActions, useFloatingActionsBar, useSyncExternalState };
|
package/dist/index.d.ts
CHANGED
|
@@ -144,12 +144,12 @@ declare const NumberControl: ControlComponent<({ placeholder: labelPlaceholder,
|
|
|
144
144
|
}) => React$1.JSX.Element>;
|
|
145
145
|
|
|
146
146
|
type MultiSizePropValue = Record<PropKey, SizePropValue>;
|
|
147
|
-
type Item = {
|
|
147
|
+
type Item$1 = {
|
|
148
148
|
icon: ReactNode;
|
|
149
149
|
label: string;
|
|
150
150
|
bind: PropKey;
|
|
151
151
|
};
|
|
152
|
-
type EqualUnequalItems = [Item, Item, Item, Item];
|
|
152
|
+
type EqualUnequalItems = [Item$1, Item$1, Item$1, Item$1];
|
|
153
153
|
type Props$2<TMultiPropType extends string, TPropValue extends MultiSizePropValue> = {
|
|
154
154
|
label: string;
|
|
155
155
|
icon: ReactNode;
|
|
@@ -324,6 +324,42 @@ type CssEditorProps = {
|
|
|
324
324
|
};
|
|
325
325
|
declare const CssEditor: ({ value, onChange }: CssEditorProps) => React$1.JSX.Element;
|
|
326
326
|
|
|
327
|
+
type AnchorEl = HTMLElement | null;
|
|
328
|
+
type Item<T> = {
|
|
329
|
+
disabled?: boolean;
|
|
330
|
+
} & T;
|
|
331
|
+
type CollectionPropUtil<T> = PropTypeUtil<PropKey, T[]>;
|
|
332
|
+
type RepeaterItemContentProps<T> = {
|
|
333
|
+
anchorEl: AnchorEl;
|
|
334
|
+
bind: PropKey;
|
|
335
|
+
value: T;
|
|
336
|
+
collectionPropUtil?: CollectionPropUtil<T>;
|
|
337
|
+
};
|
|
338
|
+
type RepeaterItemContent<T> = React$1.ComponentType<RepeaterItemContentProps<T>>;
|
|
339
|
+
type RepeaterProps<T> = {
|
|
340
|
+
label: string;
|
|
341
|
+
values?: T[];
|
|
342
|
+
addToBottom?: boolean;
|
|
343
|
+
openOnAdd?: boolean;
|
|
344
|
+
setValues: (newValue: T[]) => void;
|
|
345
|
+
disabled?: boolean;
|
|
346
|
+
itemSettings: {
|
|
347
|
+
initialValues: T;
|
|
348
|
+
Label: React$1.ComponentType<{
|
|
349
|
+
value: T;
|
|
350
|
+
}>;
|
|
351
|
+
Icon: React$1.ComponentType<{
|
|
352
|
+
value: T;
|
|
353
|
+
}>;
|
|
354
|
+
Content: RepeaterItemContent<T>;
|
|
355
|
+
};
|
|
356
|
+
showDuplicate?: boolean;
|
|
357
|
+
showToggle?: boolean;
|
|
358
|
+
isSortable?: boolean;
|
|
359
|
+
collectionPropUtil?: CollectionPropUtil<T>;
|
|
360
|
+
};
|
|
361
|
+
declare const Repeater: <T>({ label, itemSettings, disabled, openOnAdd, addToBottom, values: repeaterValues, setValues: setRepeaterValues, showDuplicate, showToggle, isSortable, collectionPropUtil, }: RepeaterProps<Item<T>>) => React$1.JSX.Element;
|
|
362
|
+
|
|
327
363
|
type AnyComponentType = ComponentType<any>;
|
|
328
364
|
declare const brandSymbol: unique symbol;
|
|
329
365
|
type ControlComponent<TComponent extends AnyComponentType = AnyComponentType> = TComponent & {
|
|
@@ -345,6 +381,10 @@ declare const useControlActions: () => ControlActionsContext;
|
|
|
345
381
|
type SetValueMeta = {
|
|
346
382
|
bind?: PropKey;
|
|
347
383
|
validation?: (value: PropValue) => boolean;
|
|
384
|
+
action?: {
|
|
385
|
+
type: string;
|
|
386
|
+
payload?: Record<string, unknown>;
|
|
387
|
+
};
|
|
348
388
|
};
|
|
349
389
|
type SetValue<T> = (value: T, options?: CreateOptions, meta?: SetValueMeta) => void;
|
|
350
390
|
type PropContext<T extends PropValue, P extends PropType> = {
|
|
@@ -451,4 +491,4 @@ type UseInternalStateOptions<TValue> = {
|
|
|
451
491
|
};
|
|
452
492
|
declare const useSyncExternalState: <TValue>({ external, setExternal, persistWhen, fallback, }: UseInternalStateOptions<TValue>) => readonly [TValue, (setter: ((value: TValue) => TValue) | TValue, options?: CreateOptions, meta?: SetValueMeta) => void];
|
|
453
493
|
|
|
454
|
-
export { type AngleUnit, AspectRatioControl, BackgroundControl, BoxShadowRepeaterControl, ColorControl, type ControlActionsItems, ControlActionsProvider, ControlAdornments, ControlAdornmentsProvider, type ControlComponent, ControlFormLabel, ControlReplacementsProvider, ControlToggleButtonGroup, CssEditor, type EqualUnequalItems, EqualUnequalSizesControl, type ExtendedOption, FilterRepeaterControl, type FontCategory, FontFamilyControl, GapControl, ImageControl, ItemSelector, KeyValueControl, type LengthUnit, LinkControl, LinkedDimensionsControl, NumberControl, PopoverContent, PositionControl, PropKeyProvider, PropProvider, type PropProviderProps, RepeatableControl, SelectControl, type SetValue, SizeControl, StrokeControl, SvgMediaControl, SwitchControl, TextAreaControl, TextControl, type TimeUnit, type ToggleButtonGroupItem, ToggleControl, type ToggleControlProps, TransformBaseControl, TransformRepeaterControl, TransitionRepeaterControl, type Unit, UrlControl, createControl, createControlReplacementsRegistry, enqueueFont, injectIntoRepeaterHeaderActions, injectIntoRepeaterItemActions, injectIntoRepeaterItemIcon, injectIntoRepeaterItemLabel, transitionProperties, transitionsItemsList, useBoundProp, useControlActions, useFloatingActionsBar, useSyncExternalState };
|
|
494
|
+
export { type AngleUnit, AspectRatioControl, BackgroundControl, BoxShadowRepeaterControl, ColorControl, type ControlActionsItems, ControlActionsProvider, ControlAdornments, ControlAdornmentsProvider, type ControlComponent, ControlFormLabel, ControlReplacementsProvider, ControlToggleButtonGroup, CssEditor, type EqualUnequalItems, EqualUnequalSizesControl, type ExtendedOption, FilterRepeaterControl, type FontCategory, FontFamilyControl, GapControl, ImageControl, ItemSelector, KeyValueControl, type LengthUnit, LinkControl, LinkedDimensionsControl, NumberControl, PopoverContent, PositionControl, PropKeyProvider, PropProvider, type PropProviderProps, RepeatableControl, Repeater, SelectControl, type SetValue, SizeControl, StrokeControl, SvgMediaControl, SwitchControl, TextAreaControl, TextControl, type TimeUnit, type ToggleButtonGroupItem, ToggleControl, type ToggleControlProps, TransformBaseControl, TransformRepeaterControl, TransitionRepeaterControl, type Unit, UrlControl, createControl, createControlReplacementsRegistry, enqueueFont, injectIntoRepeaterHeaderActions, injectIntoRepeaterItemActions, injectIntoRepeaterItemIcon, injectIntoRepeaterItemLabel, transitionProperties, transitionsItemsList, useBoundProp, useControlActions, useFloatingActionsBar, useSyncExternalState };
|
package/dist/index.js
CHANGED
|
@@ -56,6 +56,7 @@ __export(index_exports, {
|
|
|
56
56
|
PropKeyProvider: () => PropKeyProvider,
|
|
57
57
|
PropProvider: () => PropProvider,
|
|
58
58
|
RepeatableControl: () => RepeatableControl,
|
|
59
|
+
Repeater: () => Repeater3,
|
|
59
60
|
SelectControl: () => SelectControl,
|
|
60
61
|
SizeControl: () => SizeControl,
|
|
61
62
|
StrokeControl: () => StrokeControl,
|
|
@@ -5687,6 +5688,217 @@ var CssEditor = ({ value, onChange }) => {
|
|
|
5687
5688
|
}
|
|
5688
5689
|
));
|
|
5689
5690
|
};
|
|
5691
|
+
|
|
5692
|
+
// src/components/repeater.tsx
|
|
5693
|
+
var React93 = __toESM(require("react"));
|
|
5694
|
+
var import_react48 = require("react");
|
|
5695
|
+
var import_icons32 = require("@elementor/icons");
|
|
5696
|
+
var import_ui81 = require("@elementor/ui");
|
|
5697
|
+
var import_i18n49 = require("@wordpress/i18n");
|
|
5698
|
+
var SIZE9 = "tiny";
|
|
5699
|
+
var EMPTY_OPEN_ITEM2 = -1;
|
|
5700
|
+
var Repeater3 = ({
|
|
5701
|
+
label,
|
|
5702
|
+
itemSettings,
|
|
5703
|
+
disabled = false,
|
|
5704
|
+
openOnAdd = false,
|
|
5705
|
+
addToBottom = false,
|
|
5706
|
+
values: repeaterValues = [],
|
|
5707
|
+
setValues: setRepeaterValues,
|
|
5708
|
+
showDuplicate = true,
|
|
5709
|
+
showToggle = true,
|
|
5710
|
+
isSortable = true,
|
|
5711
|
+
collectionPropUtil
|
|
5712
|
+
}) => {
|
|
5713
|
+
const [openItem, setOpenItem] = (0, import_react48.useState)(EMPTY_OPEN_ITEM2);
|
|
5714
|
+
const [items2, setItems] = useSyncExternalState({
|
|
5715
|
+
external: repeaterValues,
|
|
5716
|
+
// @ts-expect-error - as long as persistWhen => true, value will never be null
|
|
5717
|
+
setExternal: setRepeaterValues,
|
|
5718
|
+
persistWhen: () => true
|
|
5719
|
+
});
|
|
5720
|
+
const [uniqueKeys, setUniqueKeys] = (0, import_react48.useState)(items2.map((_, index) => index));
|
|
5721
|
+
const generateNextKey = (source) => {
|
|
5722
|
+
return 1 + Math.max(0, ...source);
|
|
5723
|
+
};
|
|
5724
|
+
const addRepeaterItem = () => {
|
|
5725
|
+
const newItem = structuredClone(itemSettings.initialValues);
|
|
5726
|
+
const newKey = generateNextKey(uniqueKeys);
|
|
5727
|
+
if (addToBottom) {
|
|
5728
|
+
setItems([...items2, newItem], void 0, { action: { type: "add" } });
|
|
5729
|
+
setUniqueKeys([...uniqueKeys, newKey]);
|
|
5730
|
+
} else {
|
|
5731
|
+
setItems([newItem, ...items2], void 0, { action: { type: "add" } });
|
|
5732
|
+
setUniqueKeys([newKey, ...uniqueKeys]);
|
|
5733
|
+
}
|
|
5734
|
+
if (openOnAdd) {
|
|
5735
|
+
setOpenItem(newKey);
|
|
5736
|
+
}
|
|
5737
|
+
};
|
|
5738
|
+
const duplicateRepeaterItem = (index) => {
|
|
5739
|
+
const newItem = structuredClone(items2[index]);
|
|
5740
|
+
const newKey = generateNextKey(uniqueKeys);
|
|
5741
|
+
const atPosition = 1 + index;
|
|
5742
|
+
setItems([...items2.slice(0, atPosition), newItem, ...items2.slice(atPosition)], void 0, {
|
|
5743
|
+
action: { type: "duplicate" }
|
|
5744
|
+
});
|
|
5745
|
+
setUniqueKeys([...uniqueKeys.slice(0, atPosition), newKey, ...uniqueKeys.slice(atPosition)]);
|
|
5746
|
+
};
|
|
5747
|
+
const removeRepeaterItem = (index) => {
|
|
5748
|
+
setUniqueKeys(
|
|
5749
|
+
uniqueKeys.filter((_, pos) => {
|
|
5750
|
+
return pos !== index;
|
|
5751
|
+
})
|
|
5752
|
+
);
|
|
5753
|
+
setItems(
|
|
5754
|
+
items2.filter((_, pos) => {
|
|
5755
|
+
return pos !== index;
|
|
5756
|
+
}),
|
|
5757
|
+
void 0,
|
|
5758
|
+
{ action: { type: "remove" } }
|
|
5759
|
+
);
|
|
5760
|
+
};
|
|
5761
|
+
const toggleDisableRepeaterItem = (index) => {
|
|
5762
|
+
setItems(
|
|
5763
|
+
items2.map((value, pos) => {
|
|
5764
|
+
if (pos === index) {
|
|
5765
|
+
const { disabled: propDisabled, ...rest } = value;
|
|
5766
|
+
return { ...rest, ...propDisabled ? {} : { disabled: true } };
|
|
5767
|
+
}
|
|
5768
|
+
return value;
|
|
5769
|
+
}),
|
|
5770
|
+
void 0,
|
|
5771
|
+
{ action: { type: "toggle-disable" } }
|
|
5772
|
+
);
|
|
5773
|
+
};
|
|
5774
|
+
const onChangeOrder = (reorderedKeys, meta) => {
|
|
5775
|
+
setUniqueKeys(reorderedKeys);
|
|
5776
|
+
setItems(
|
|
5777
|
+
(prevItems) => {
|
|
5778
|
+
return reorderedKeys.map((keyValue) => {
|
|
5779
|
+
const index = uniqueKeys.indexOf(keyValue);
|
|
5780
|
+
return prevItems[index];
|
|
5781
|
+
});
|
|
5782
|
+
},
|
|
5783
|
+
void 0,
|
|
5784
|
+
{ action: { type: "reorder", payload: { ...meta } } }
|
|
5785
|
+
);
|
|
5786
|
+
};
|
|
5787
|
+
return /* @__PURE__ */ React93.createElement(SectionContent, null, /* @__PURE__ */ React93.createElement(
|
|
5788
|
+
import_ui81.Stack,
|
|
5789
|
+
{
|
|
5790
|
+
direction: "row",
|
|
5791
|
+
justifyContent: "start",
|
|
5792
|
+
alignItems: "center",
|
|
5793
|
+
gap: 1,
|
|
5794
|
+
sx: { marginInlineEnd: -0.75 }
|
|
5795
|
+
},
|
|
5796
|
+
/* @__PURE__ */ React93.createElement(import_ui81.Typography, { component: "label", variant: "caption", color: "text.secondary" }, label),
|
|
5797
|
+
/* @__PURE__ */ React93.createElement(ControlAdornments, null),
|
|
5798
|
+
/* @__PURE__ */ React93.createElement(
|
|
5799
|
+
import_ui81.IconButton,
|
|
5800
|
+
{
|
|
5801
|
+
size: SIZE9,
|
|
5802
|
+
sx: { ml: "auto" },
|
|
5803
|
+
disabled,
|
|
5804
|
+
onClick: addRepeaterItem,
|
|
5805
|
+
"aria-label": (0, import_i18n49.__)("Add item", "elementor")
|
|
5806
|
+
},
|
|
5807
|
+
/* @__PURE__ */ React93.createElement(import_icons32.PlusIcon, { fontSize: SIZE9 })
|
|
5808
|
+
)
|
|
5809
|
+
), 0 < uniqueKeys.length && /* @__PURE__ */ React93.createElement(SortableProvider, { value: uniqueKeys, onChange: onChangeOrder }, uniqueKeys.map((key, index) => {
|
|
5810
|
+
const value = items2[index];
|
|
5811
|
+
if (!value) {
|
|
5812
|
+
return null;
|
|
5813
|
+
}
|
|
5814
|
+
return /* @__PURE__ */ React93.createElement(SortableItem, { id: key, key: `sortable-${key}`, disabled: !isSortable }, /* @__PURE__ */ React93.createElement(
|
|
5815
|
+
RepeaterItem,
|
|
5816
|
+
{
|
|
5817
|
+
disabled,
|
|
5818
|
+
propDisabled: value?.disabled,
|
|
5819
|
+
label: /* @__PURE__ */ React93.createElement(RepeaterItemLabelSlot, { value }, /* @__PURE__ */ React93.createElement(itemSettings.Label, { value })),
|
|
5820
|
+
startIcon: /* @__PURE__ */ React93.createElement(RepeaterItemIconSlot, { value }, /* @__PURE__ */ React93.createElement(itemSettings.Icon, { value })),
|
|
5821
|
+
removeItem: () => removeRepeaterItem(index),
|
|
5822
|
+
duplicateItem: () => duplicateRepeaterItem(index),
|
|
5823
|
+
toggleDisableItem: () => toggleDisableRepeaterItem(index),
|
|
5824
|
+
openOnMount: openOnAdd && openItem === key,
|
|
5825
|
+
onOpen: () => setOpenItem(EMPTY_OPEN_ITEM2),
|
|
5826
|
+
showDuplicate,
|
|
5827
|
+
showToggle,
|
|
5828
|
+
collectionPropUtil
|
|
5829
|
+
},
|
|
5830
|
+
(props) => /* @__PURE__ */ React93.createElement(itemSettings.Content, { ...props, value, bind: String(index) })
|
|
5831
|
+
));
|
|
5832
|
+
})));
|
|
5833
|
+
};
|
|
5834
|
+
var RepeaterItem = ({
|
|
5835
|
+
label,
|
|
5836
|
+
propDisabled,
|
|
5837
|
+
startIcon,
|
|
5838
|
+
children,
|
|
5839
|
+
removeItem,
|
|
5840
|
+
duplicateItem,
|
|
5841
|
+
toggleDisableItem,
|
|
5842
|
+
openOnMount,
|
|
5843
|
+
onOpen,
|
|
5844
|
+
showDuplicate,
|
|
5845
|
+
showToggle,
|
|
5846
|
+
disabled,
|
|
5847
|
+
collectionPropUtil
|
|
5848
|
+
}) => {
|
|
5849
|
+
const [anchorEl, setAnchorEl] = (0, import_react48.useState)(null);
|
|
5850
|
+
const { popoverState, popoverProps, ref, setRef } = usePopover(openOnMount, onOpen);
|
|
5851
|
+
const duplicateLabel = (0, import_i18n49.__)("Duplicate", "elementor");
|
|
5852
|
+
const toggleLabel = propDisabled ? (0, import_i18n49.__)("Show", "elementor") : (0, import_i18n49.__)("Hide", "elementor");
|
|
5853
|
+
const removeLabel = (0, import_i18n49.__)("Remove", "elementor");
|
|
5854
|
+
return /* @__PURE__ */ React93.createElement(React93.Fragment, null, /* @__PURE__ */ React93.createElement(
|
|
5855
|
+
import_ui81.UnstableTag,
|
|
5856
|
+
{
|
|
5857
|
+
disabled,
|
|
5858
|
+
label,
|
|
5859
|
+
showActionsOnHover: true,
|
|
5860
|
+
fullWidth: true,
|
|
5861
|
+
ref: setRef,
|
|
5862
|
+
variant: "outlined",
|
|
5863
|
+
"aria-label": (0, import_i18n49.__)("Open item", "elementor"),
|
|
5864
|
+
...(0, import_ui81.bindTrigger)(popoverState),
|
|
5865
|
+
startIcon,
|
|
5866
|
+
actions: /* @__PURE__ */ React93.createElement(React93.Fragment, null, showDuplicate && /* @__PURE__ */ React93.createElement(import_ui81.Tooltip, { title: duplicateLabel, placement: "top" }, /* @__PURE__ */ React93.createElement(import_ui81.IconButton, { size: SIZE9, onClick: duplicateItem, "aria-label": duplicateLabel }, /* @__PURE__ */ React93.createElement(import_icons32.CopyIcon, { fontSize: SIZE9 }))), showToggle && /* @__PURE__ */ React93.createElement(import_ui81.Tooltip, { title: toggleLabel, placement: "top" }, /* @__PURE__ */ React93.createElement(import_ui81.IconButton, { size: SIZE9, onClick: toggleDisableItem, "aria-label": toggleLabel }, propDisabled ? /* @__PURE__ */ React93.createElement(import_icons32.EyeOffIcon, { fontSize: SIZE9 }) : /* @__PURE__ */ React93.createElement(import_icons32.EyeIcon, { fontSize: SIZE9 }))), /* @__PURE__ */ React93.createElement(import_ui81.Tooltip, { title: removeLabel, placement: "top" }, /* @__PURE__ */ React93.createElement(import_ui81.IconButton, { size: SIZE9, onClick: removeItem, "aria-label": removeLabel }, /* @__PURE__ */ React93.createElement(import_icons32.XIcon, { fontSize: SIZE9 }))))
|
|
5867
|
+
}
|
|
5868
|
+
), /* @__PURE__ */ React93.createElement(
|
|
5869
|
+
import_ui81.Popover,
|
|
5870
|
+
{
|
|
5871
|
+
disablePortal: true,
|
|
5872
|
+
slotProps: {
|
|
5873
|
+
paper: {
|
|
5874
|
+
ref: setAnchorEl,
|
|
5875
|
+
sx: { mt: 0.5, width: ref?.getBoundingClientRect().width }
|
|
5876
|
+
}
|
|
5877
|
+
},
|
|
5878
|
+
anchorOrigin: { vertical: "bottom", horizontal: "left" },
|
|
5879
|
+
...popoverProps,
|
|
5880
|
+
anchorEl: ref
|
|
5881
|
+
},
|
|
5882
|
+
/* @__PURE__ */ React93.createElement(import_ui81.Box, null, children({ anchorEl, collectionPropUtil }))
|
|
5883
|
+
));
|
|
5884
|
+
};
|
|
5885
|
+
var usePopover = (openOnMount, onOpen) => {
|
|
5886
|
+
const [ref, setRef] = (0, import_react48.useState)(null);
|
|
5887
|
+
const popoverState = (0, import_ui81.usePopupState)({ variant: "popover" });
|
|
5888
|
+
const popoverProps = (0, import_ui81.bindPopover)(popoverState);
|
|
5889
|
+
(0, import_react48.useEffect)(() => {
|
|
5890
|
+
if (openOnMount && ref) {
|
|
5891
|
+
popoverState.open(ref);
|
|
5892
|
+
onOpen?.();
|
|
5893
|
+
}
|
|
5894
|
+
}, [ref]);
|
|
5895
|
+
return {
|
|
5896
|
+
popoverState,
|
|
5897
|
+
ref,
|
|
5898
|
+
setRef,
|
|
5899
|
+
popoverProps
|
|
5900
|
+
};
|
|
5901
|
+
};
|
|
5690
5902
|
// Annotate the CommonJS export names for ESM import in node:
|
|
5691
5903
|
0 && (module.exports = {
|
|
5692
5904
|
AspectRatioControl,
|
|
@@ -5715,6 +5927,7 @@ var CssEditor = ({ value, onChange }) => {
|
|
|
5715
5927
|
PropKeyProvider,
|
|
5716
5928
|
PropProvider,
|
|
5717
5929
|
RepeatableControl,
|
|
5930
|
+
Repeater,
|
|
5718
5931
|
SelectControl,
|
|
5719
5932
|
SizeControl,
|
|
5720
5933
|
StrokeControl,
|