@elementor/editor-controls 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -0
- package/dist/index.d.mts +66 -38
- package/dist/index.d.ts +66 -38
- package/dist/index.js +224 -140
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +246 -176
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -7
- package/src/components/font-family-selector.tsx +23 -164
- package/src/components/repeater.tsx +24 -10
- package/src/controls/key-value-control.tsx +99 -0
- package/src/controls/position-control.tsx +109 -0
- package/src/controls/repeatable-control.tsx +89 -0
- package/src/controls/size-control.tsx +8 -6
- package/src/hooks/use-repeatable-control-context.ts +24 -0
- package/src/index.ts +3 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# @elementor/editor-controls
|
|
2
2
|
|
|
3
|
+
## 1.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 9ccd243: Opacity control is added to the style tab
|
|
8
|
+
- 17b73ab: Update `@elementor/ui` version.
|
|
9
|
+
- aa176b8: Create a KeyValue Control
|
|
10
|
+
- 3daa1c9: Extract font family content list to a standalone component inside the Editor UI package.
|
|
11
|
+
- 40d00c2: Implement the Popover Menu List inside the Dynamic Tags and the Variables.
|
|
12
|
+
- d5e9011: Implement the Popover Search component inside the Dynamic Tags, Font Families and the Variables.
|
|
13
|
+
- 30a6d95: Added repeatable control type
|
|
14
|
+
- f37c325: Extract the popover scrollable content box to a standalone component inside the Editor UI package.
|
|
15
|
+
- 20d04f2: Added object position custom control
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies [da0c4ca]
|
|
20
|
+
- Updated dependencies [17b73ab]
|
|
21
|
+
- Updated dependencies [7a4178f]
|
|
22
|
+
- Updated dependencies [8e18905]
|
|
23
|
+
- Updated dependencies [3daa1c9]
|
|
24
|
+
- Updated dependencies [40d00c2]
|
|
25
|
+
- Updated dependencies [d5e9011]
|
|
26
|
+
- Updated dependencies [f37c325]
|
|
27
|
+
- Updated dependencies [20d04f2]
|
|
28
|
+
- @elementor/editor-ui@0.12.0
|
|
29
|
+
- @elementor/editor-props@0.14.0
|
|
30
|
+
- @elementor/editor-elements@0.8.6
|
|
31
|
+
|
|
3
32
|
## 1.0.0
|
|
4
33
|
|
|
5
34
|
### Major Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
1
|
+
import * as React$1 from 'react';
|
|
2
2
|
import { MutableRefObject, ReactNode, ComponentType, PropsWithChildren } from 'react';
|
|
3
3
|
import { StringPropValue, PropTypeUtil, PropValue, PropKey, SizePropValue, PropType, CreateOptions } from '@elementor/editor-props';
|
|
4
|
-
import { UnstableColorFieldProps, ToggleButtonProps, StackProps, FormLabelProps } from '@elementor/ui';
|
|
4
|
+
import { UnstableColorFieldProps, ToggleButtonProps, StackProps, SxProps, Theme, FormLabelProps } from '@elementor/ui';
|
|
5
5
|
import * as _elementor_locations from '@elementor/locations';
|
|
6
6
|
|
|
7
7
|
type ImageControlProps = {
|
|
@@ -12,16 +12,16 @@ type ImageControlProps = {
|
|
|
12
12
|
resolutionLabel?: string;
|
|
13
13
|
showMode?: 'all' | 'media' | 'sizes';
|
|
14
14
|
};
|
|
15
|
-
declare const ImageControl: ControlComponent<({ sizes, resolutionLabel, showMode }: ImageControlProps) => React.JSX.Element>;
|
|
15
|
+
declare const ImageControl: ControlComponent<({ sizes, resolutionLabel, showMode }: ImageControlProps) => React$1.JSX.Element>;
|
|
16
16
|
|
|
17
17
|
declare const TextControl: ControlComponent<({ placeholder }: {
|
|
18
18
|
placeholder?: string;
|
|
19
|
-
}) => React.JSX.Element>;
|
|
19
|
+
}) => React$1.JSX.Element>;
|
|
20
20
|
|
|
21
21
|
type Props$6 = {
|
|
22
22
|
placeholder?: string;
|
|
23
23
|
};
|
|
24
|
-
declare const TextAreaControl: ControlComponent<({ placeholder }: Props$6) => React.JSX.Element>;
|
|
24
|
+
declare const TextAreaControl: ControlComponent<({ placeholder }: Props$6) => React$1.JSX.Element>;
|
|
25
25
|
|
|
26
26
|
declare const defaultUnits: readonly ["px", "%", "em", "rem", "vw", "vh"];
|
|
27
27
|
declare const defaultExtendedOptions: readonly ["auto", "custom"];
|
|
@@ -30,17 +30,18 @@ type ExtendedOption = (typeof defaultExtendedOptions)[number];
|
|
|
30
30
|
|
|
31
31
|
type SizeControlProps = {
|
|
32
32
|
placeholder?: string;
|
|
33
|
-
startIcon?: React.ReactNode;
|
|
33
|
+
startIcon?: React$1.ReactNode;
|
|
34
34
|
units?: Unit[];
|
|
35
35
|
extendedOptions?: ExtendedOption[];
|
|
36
36
|
disableCustom?: boolean;
|
|
37
37
|
anchorRef?: MutableRefObject<HTMLElement | undefined>;
|
|
38
|
+
defaultUnit?: Unit;
|
|
38
39
|
};
|
|
39
|
-
declare const SizeControl: ControlComponent<(props: SizeControlProps) => React.JSX.Element>;
|
|
40
|
+
declare const SizeControl: ControlComponent<(props: SizeControlProps) => React$1.JSX.Element>;
|
|
40
41
|
|
|
41
|
-
declare const StrokeControl: ControlComponent<() => React.JSX.Element>;
|
|
42
|
+
declare const StrokeControl: ControlComponent<() => React$1.JSX.Element>;
|
|
42
43
|
|
|
43
|
-
declare const BoxShadowRepeaterControl: ControlComponent<() => React.JSX.Element>;
|
|
44
|
+
declare const BoxShadowRepeaterControl: ControlComponent<() => React$1.JSX.Element>;
|
|
44
45
|
|
|
45
46
|
type Props$5 = {
|
|
46
47
|
options: Array<{
|
|
@@ -50,13 +51,13 @@ type Props$5 = {
|
|
|
50
51
|
}>;
|
|
51
52
|
onChange?: (newValue: string | null, previousValue: string | null | undefined) => void;
|
|
52
53
|
};
|
|
53
|
-
declare const SelectControl: ControlComponent<({ options, onChange }: Props$5) => React.JSX.Element>;
|
|
54
|
+
declare const SelectControl: ControlComponent<({ options, onChange }: Props$5) => React$1.JSX.Element>;
|
|
54
55
|
|
|
55
56
|
type Props$4 = Partial<Omit<UnstableColorFieldProps, 'value' | 'onChange'>> & {
|
|
56
57
|
propTypeUtil?: PropTypeUtil<string, string>;
|
|
57
58
|
anchorEl?: HTMLElement | null;
|
|
58
59
|
};
|
|
59
|
-
declare const ColorControl: ControlComponent<({ propTypeUtil, anchorEl, slotProps, ...props }: Props$4) => React.JSX.Element>;
|
|
60
|
+
declare const ColorControl: ControlComponent<({ propTypeUtil, anchorEl, slotProps, ...props }: Props$4) => React$1.JSX.Element>;
|
|
60
61
|
|
|
61
62
|
type RenderContentProps = {
|
|
62
63
|
size: ToggleButtonProps['size'];
|
|
@@ -64,7 +65,7 @@ type RenderContentProps = {
|
|
|
64
65
|
type ToggleButtonGroupItem<TValue> = {
|
|
65
66
|
value: TValue;
|
|
66
67
|
label: string;
|
|
67
|
-
renderContent: ({ size }: RenderContentProps) => React.ReactNode;
|
|
68
|
+
renderContent: ({ size }: RenderContentProps) => React$1.ReactNode;
|
|
68
69
|
showTooltip?: boolean;
|
|
69
70
|
};
|
|
70
71
|
type ExclusiveValue<TValue> = TValue;
|
|
@@ -85,7 +86,7 @@ type Props$3<TValue> = {
|
|
|
85
86
|
value: ExclusiveValue<TValue>;
|
|
86
87
|
onChange: (value: ExclusiveValue<TValue>) => void;
|
|
87
88
|
});
|
|
88
|
-
declare const ControlToggleButtonGroup: <TValue>({ justify, size, value, onChange, items, maxItems, exclusive, fullWidth, disabled, }: Props$3<TValue>) => React.JSX.Element;
|
|
89
|
+
declare const ControlToggleButtonGroup: <TValue>({ justify, size, value, onChange, items, maxItems, exclusive, fullWidth, disabled, }: Props$3<TValue>) => React$1.JSX.Element;
|
|
89
90
|
|
|
90
91
|
type ToggleControlProps<T extends PropValue> = {
|
|
91
92
|
options: Array<ToggleButtonGroupItem<T> & {
|
|
@@ -96,7 +97,7 @@ type ToggleControlProps<T extends PropValue> = {
|
|
|
96
97
|
exclusive?: boolean;
|
|
97
98
|
maxItems?: number;
|
|
98
99
|
};
|
|
99
|
-
declare const ToggleControl: ControlComponent<({ options, fullWidth, size, exclusive, maxItems, }: ToggleControlProps<StringPropValue["value"]>) => React.JSX.Element>;
|
|
100
|
+
declare const ToggleControl: ControlComponent<({ options, fullWidth, size, exclusive, maxItems, }: ToggleControlProps<StringPropValue["value"]>) => React$1.JSX.Element>;
|
|
100
101
|
|
|
101
102
|
declare const NumberControl: ControlComponent<({ placeholder, max, min, step, shouldForceInt, }: {
|
|
102
103
|
placeholder?: string;
|
|
@@ -104,7 +105,7 @@ declare const NumberControl: ControlComponent<({ placeholder, max, min, step, sh
|
|
|
104
105
|
min?: number;
|
|
105
106
|
step?: number;
|
|
106
107
|
shouldForceInt?: boolean;
|
|
107
|
-
}) => React.JSX.Element>;
|
|
108
|
+
}) => React$1.JSX.Element>;
|
|
108
109
|
|
|
109
110
|
type MultiSizePropValue = Record<PropKey, SizePropValue>;
|
|
110
111
|
type Item = {
|
|
@@ -120,13 +121,13 @@ type Props$2<TMultiPropType extends string, TPropValue extends MultiSizePropValu
|
|
|
120
121
|
items: EqualUnequalItems;
|
|
121
122
|
multiSizePropTypeUtil: PropTypeUtil<TMultiPropType, TPropValue>;
|
|
122
123
|
};
|
|
123
|
-
declare function EqualUnequalSizesControl<TMultiPropType extends string, TPropValue extends MultiSizePropValue>({ label, icon, tooltipLabel, items, multiSizePropTypeUtil, }: Props$2<TMultiPropType, TPropValue>): React.JSX.Element;
|
|
124
|
+
declare function EqualUnequalSizesControl<TMultiPropType extends string, TPropValue extends MultiSizePropValue>({ label, icon, tooltipLabel, items, multiSizePropTypeUtil, }: Props$2<TMultiPropType, TPropValue>): React$1.JSX.Element;
|
|
124
125
|
|
|
125
126
|
declare const LinkedDimensionsControl: ControlComponent<({ label, isSiteRtl, extendedOptions, }: {
|
|
126
127
|
label: string;
|
|
127
128
|
isSiteRtl?: boolean;
|
|
128
129
|
extendedOptions?: ExtendedOption[];
|
|
129
|
-
}) => React.JSX.Element>;
|
|
130
|
+
}) => React$1.JSX.Element>;
|
|
130
131
|
|
|
131
132
|
type FontCategory = {
|
|
132
133
|
label: string;
|
|
@@ -135,11 +136,11 @@ type FontCategory = {
|
|
|
135
136
|
type FontFamilyControlProps = {
|
|
136
137
|
fontFamilies: FontCategory[];
|
|
137
138
|
};
|
|
138
|
-
declare const FontFamilyControl: ControlComponent<({ fontFamilies }: FontFamilyControlProps) => React.JSX.Element>;
|
|
139
|
+
declare const FontFamilyControl: ControlComponent<({ fontFamilies }: FontFamilyControlProps) => React$1.JSX.Element>;
|
|
139
140
|
|
|
140
141
|
declare const UrlControl: ControlComponent<({ placeholder }: {
|
|
141
142
|
placeholder?: string;
|
|
142
|
-
}) => React.JSX.Element>;
|
|
143
|
+
}) => React$1.JSX.Element>;
|
|
143
144
|
|
|
144
145
|
type ControlProps<TControlProps = unknown> = TControlProps & {
|
|
145
146
|
context: {
|
|
@@ -156,23 +157,50 @@ type Props$1 = ControlProps<{
|
|
|
156
157
|
minInputLength?: number;
|
|
157
158
|
placeholder?: string;
|
|
158
159
|
}>;
|
|
159
|
-
declare const LinkControl: ControlComponent<(props: Props$1) => React.JSX.Element>;
|
|
160
|
+
declare const LinkControl: ControlComponent<(props: Props$1) => React$1.JSX.Element>;
|
|
160
161
|
|
|
161
162
|
declare const GapControl: ControlComponent<({ label }: {
|
|
162
163
|
label: string;
|
|
163
|
-
}) => React.JSX.Element>;
|
|
164
|
+
}) => React$1.JSX.Element>;
|
|
164
165
|
|
|
165
166
|
declare const AspectRatioControl: ControlComponent<({ label }: {
|
|
166
167
|
label: string;
|
|
167
|
-
}) => React.JSX.Element>;
|
|
168
|
+
}) => React$1.JSX.Element>;
|
|
168
169
|
|
|
169
|
-
declare const SvgMediaControl: ControlComponent<() => React.JSX.Element>;
|
|
170
|
+
declare const SvgMediaControl: ControlComponent<() => React$1.JSX.Element>;
|
|
170
171
|
|
|
171
|
-
declare const BackgroundControl: ControlComponent<() => React.JSX.Element>;
|
|
172
|
+
declare const BackgroundControl: ControlComponent<() => React$1.JSX.Element>;
|
|
172
173
|
|
|
173
|
-
declare const SwitchControl: ControlComponent<() => React.JSX.Element>;
|
|
174
|
+
declare const SwitchControl: ControlComponent<() => React$1.JSX.Element>;
|
|
174
175
|
|
|
175
|
-
|
|
176
|
+
type ChildControlConfig = {
|
|
177
|
+
component: React.ComponentType;
|
|
178
|
+
props?: Record<string, unknown>;
|
|
179
|
+
propTypeUtil: PropTypeUtil<string, any>;
|
|
180
|
+
label?: string;
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
type RepeatableControlProps = {
|
|
184
|
+
label: string;
|
|
185
|
+
childControlConfig: ChildControlConfig;
|
|
186
|
+
showDuplicate?: boolean;
|
|
187
|
+
showToggle?: boolean;
|
|
188
|
+
};
|
|
189
|
+
declare const RepeatableControl: ControlComponent<({ label, childControlConfig, showDuplicate, showToggle }: RepeatableControlProps) => React$1.JSX.Element | null>;
|
|
190
|
+
|
|
191
|
+
type KeyValueControlProps = {
|
|
192
|
+
keyName?: string;
|
|
193
|
+
valueName?: string;
|
|
194
|
+
sx?: SxProps<Theme>;
|
|
195
|
+
regexKey?: string;
|
|
196
|
+
regexValue?: string;
|
|
197
|
+
validationErrorMessage?: string;
|
|
198
|
+
};
|
|
199
|
+
declare const KeyValueControl: ControlComponent<(props?: KeyValueControlProps) => React$1.JSX.Element>;
|
|
200
|
+
|
|
201
|
+
declare const PositionControl: () => React$1.JSX.Element;
|
|
202
|
+
|
|
203
|
+
declare const ControlFormLabel: (props: FormLabelProps) => React$1.JSX.Element;
|
|
176
204
|
|
|
177
205
|
type FontFamilySelectorProps = {
|
|
178
206
|
fontFamilies: FontCategory[];
|
|
@@ -180,7 +208,7 @@ type FontFamilySelectorProps = {
|
|
|
180
208
|
onFontFamilyChange: (fontFamily: string) => void;
|
|
181
209
|
onClose: () => void;
|
|
182
210
|
};
|
|
183
|
-
declare const FontFamilySelector: ({ fontFamilies, fontFamily, onFontFamilyChange, onClose, }: FontFamilySelectorProps) => React.JSX.Element;
|
|
211
|
+
declare const FontFamilySelector: ({ fontFamilies, fontFamily, onFontFamilyChange, onClose, }: FontFamilySelectorProps) => React$1.JSX.Element;
|
|
184
212
|
|
|
185
213
|
type AnyComponentType = ComponentType<any>;
|
|
186
214
|
declare const brandSymbol: unique symbol;
|
|
@@ -190,13 +218,13 @@ type ControlComponent<TComponent extends AnyComponentType = AnyComponentType> =
|
|
|
190
218
|
|
|
191
219
|
type ControlActionsItems = Array<{
|
|
192
220
|
id: string;
|
|
193
|
-
MenuItem: React.ComponentType;
|
|
221
|
+
MenuItem: React$1.ComponentType;
|
|
194
222
|
}>;
|
|
195
223
|
type ControlActionsContext = {
|
|
196
224
|
items: ControlActionsItems;
|
|
197
225
|
};
|
|
198
226
|
type ControlActionsProviderProps = PropsWithChildren<ControlActionsContext>;
|
|
199
|
-
declare const ControlActionsProvider: ({ children, items }: ControlActionsProviderProps) => React.JSX.Element;
|
|
227
|
+
declare const ControlActionsProvider: ({ children, items }: ControlActionsProviderProps) => React$1.JSX.Element;
|
|
200
228
|
declare const useControlActions: () => ControlActionsContext;
|
|
201
229
|
|
|
202
230
|
type SetValueMeta = {
|
|
@@ -210,9 +238,9 @@ type PropContext<T extends PropValue, P extends PropType> = {
|
|
|
210
238
|
placeholder?: T;
|
|
211
239
|
disabled?: boolean;
|
|
212
240
|
};
|
|
213
|
-
declare const PropContext: React.Context<PropContext<PropValue, PropType> | null>;
|
|
214
|
-
type PropProviderProps<T extends PropValue, P extends PropType> = React.PropsWithChildren<PropContext<T, P>>;
|
|
215
|
-
declare const PropProvider: <T extends PropValue, P extends PropType>({ children, value, setValue, propType, placeholder, disabled, }: PropProviderProps<T, P>) => React.JSX.Element;
|
|
241
|
+
declare const PropContext: React$1.Context<PropContext<PropValue, PropType> | null>;
|
|
242
|
+
type PropProviderProps<T extends PropValue, P extends PropType> = React$1.PropsWithChildren<PropContext<T, P>>;
|
|
243
|
+
declare const PropProvider: <T extends PropValue, P extends PropType>({ children, value, setValue, propType, placeholder, disabled, }: PropProviderProps<T, P>) => React$1.JSX.Element;
|
|
216
244
|
|
|
217
245
|
type PropKeyContextValue<T, P> = {
|
|
218
246
|
bind: PropKey;
|
|
@@ -223,10 +251,10 @@ type PropKeyContextValue<T, P> = {
|
|
|
223
251
|
path: PropKey[];
|
|
224
252
|
disabled?: boolean;
|
|
225
253
|
};
|
|
226
|
-
type PropKeyProviderProps = React.PropsWithChildren<{
|
|
254
|
+
type PropKeyProviderProps = React$1.PropsWithChildren<{
|
|
227
255
|
bind: PropKey;
|
|
228
256
|
}>;
|
|
229
|
-
declare const PropKeyProvider: ({ children, bind }: PropKeyProviderProps) => React.JSX.Element;
|
|
257
|
+
declare const PropKeyProvider: ({ children, bind }: PropKeyProviderProps) => React$1.JSX.Element;
|
|
230
258
|
|
|
231
259
|
type UseBoundProp<TValue extends PropValue> = {
|
|
232
260
|
bind: PropKey;
|
|
@@ -251,7 +279,7 @@ type ConditionArgs = {
|
|
|
251
279
|
type Props = PropsWithChildren<{
|
|
252
280
|
replacements: ControlReplacement[];
|
|
253
281
|
}>;
|
|
254
|
-
declare const ControlReplacementsProvider: ({ replacements, children }: Props) => React.JSX.Element;
|
|
282
|
+
declare const ControlReplacementsProvider: ({ replacements, children }: Props) => React$1.JSX.Element;
|
|
255
283
|
declare const createControlReplacementsRegistry: () => {
|
|
256
284
|
registerControlReplacement: (replacement: ControlReplacement) => void;
|
|
257
285
|
getControlReplacements: () => ControlReplacement[];
|
|
@@ -265,9 +293,9 @@ type ControlAdornmentsContext = {
|
|
|
265
293
|
items?: ControlAdornmentsItems;
|
|
266
294
|
};
|
|
267
295
|
type ControlAdornmentsProviderProps = PropsWithChildren<ControlAdornmentsContext>;
|
|
268
|
-
declare const ControlAdornmentsProvider: ({ children, items }: ControlAdornmentsProviderProps) => React.JSX.Element;
|
|
296
|
+
declare const ControlAdornmentsProvider: ({ children, items }: ControlAdornmentsProviderProps) => React$1.JSX.Element;
|
|
269
297
|
|
|
270
|
-
declare function ControlAdornments(): React.JSX.Element | null;
|
|
298
|
+
declare function ControlAdornments(): React$1.JSX.Element | null;
|
|
271
299
|
|
|
272
300
|
declare const injectIntoRepeaterItemIcon: (args: _elementor_locations.ReplaceableInjectArgs<{
|
|
273
301
|
value: PropValue;
|
|
@@ -284,4 +312,4 @@ type UseInternalStateOptions<TValue> = {
|
|
|
284
312
|
};
|
|
285
313
|
declare const useSyncExternalState: <TValue>({ external, setExternal, persistWhen, fallback, }: UseInternalStateOptions<TValue>) => readonly [TValue, (setter: ((value: TValue) => TValue) | TValue) => void];
|
|
286
314
|
|
|
287
|
-
export { AspectRatioControl, BackgroundControl, BoxShadowRepeaterControl, ColorControl, type ControlActionsItems, ControlActionsProvider, ControlAdornments, ControlAdornmentsProvider, type ControlComponent, ControlFormLabel, ControlReplacementsProvider, ControlToggleButtonGroup, type EqualUnequalItems, EqualUnequalSizesControl, type ExtendedOption, type FontCategory, FontFamilyControl, FontFamilySelector, GapControl, ImageControl, LinkControl, LinkedDimensionsControl, NumberControl, PropKeyProvider, PropProvider, type PropProviderProps, SelectControl, type SetValue, SizeControl, StrokeControl, SvgMediaControl, SwitchControl, TextAreaControl, TextControl, type ToggleButtonGroupItem, ToggleControl, type ToggleControlProps, UrlControl, createControlReplacementsRegistry, injectIntoRepeaterItemIcon, injectIntoRepeaterItemLabel, useBoundProp, useControlActions, useSyncExternalState };
|
|
315
|
+
export { AspectRatioControl, BackgroundControl, BoxShadowRepeaterControl, ColorControl, type ControlActionsItems, ControlActionsProvider, ControlAdornments, ControlAdornmentsProvider, type ControlComponent, ControlFormLabel, ControlReplacementsProvider, ControlToggleButtonGroup, type EqualUnequalItems, EqualUnequalSizesControl, type ExtendedOption, type FontCategory, FontFamilyControl, FontFamilySelector, GapControl, ImageControl, KeyValueControl, LinkControl, LinkedDimensionsControl, NumberControl, PositionControl, PropKeyProvider, PropProvider, type PropProviderProps, RepeatableControl, SelectControl, type SetValue, SizeControl, StrokeControl, SvgMediaControl, SwitchControl, TextAreaControl, TextControl, type ToggleButtonGroupItem, ToggleControl, type ToggleControlProps, UrlControl, createControlReplacementsRegistry, injectIntoRepeaterItemIcon, injectIntoRepeaterItemLabel, useBoundProp, useControlActions, useSyncExternalState };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
1
|
+
import * as React$1 from 'react';
|
|
2
2
|
import { MutableRefObject, ReactNode, ComponentType, PropsWithChildren } from 'react';
|
|
3
3
|
import { StringPropValue, PropTypeUtil, PropValue, PropKey, SizePropValue, PropType, CreateOptions } from '@elementor/editor-props';
|
|
4
|
-
import { UnstableColorFieldProps, ToggleButtonProps, StackProps, FormLabelProps } from '@elementor/ui';
|
|
4
|
+
import { UnstableColorFieldProps, ToggleButtonProps, StackProps, SxProps, Theme, FormLabelProps } from '@elementor/ui';
|
|
5
5
|
import * as _elementor_locations from '@elementor/locations';
|
|
6
6
|
|
|
7
7
|
type ImageControlProps = {
|
|
@@ -12,16 +12,16 @@ type ImageControlProps = {
|
|
|
12
12
|
resolutionLabel?: string;
|
|
13
13
|
showMode?: 'all' | 'media' | 'sizes';
|
|
14
14
|
};
|
|
15
|
-
declare const ImageControl: ControlComponent<({ sizes, resolutionLabel, showMode }: ImageControlProps) => React.JSX.Element>;
|
|
15
|
+
declare const ImageControl: ControlComponent<({ sizes, resolutionLabel, showMode }: ImageControlProps) => React$1.JSX.Element>;
|
|
16
16
|
|
|
17
17
|
declare const TextControl: ControlComponent<({ placeholder }: {
|
|
18
18
|
placeholder?: string;
|
|
19
|
-
}) => React.JSX.Element>;
|
|
19
|
+
}) => React$1.JSX.Element>;
|
|
20
20
|
|
|
21
21
|
type Props$6 = {
|
|
22
22
|
placeholder?: string;
|
|
23
23
|
};
|
|
24
|
-
declare const TextAreaControl: ControlComponent<({ placeholder }: Props$6) => React.JSX.Element>;
|
|
24
|
+
declare const TextAreaControl: ControlComponent<({ placeholder }: Props$6) => React$1.JSX.Element>;
|
|
25
25
|
|
|
26
26
|
declare const defaultUnits: readonly ["px", "%", "em", "rem", "vw", "vh"];
|
|
27
27
|
declare const defaultExtendedOptions: readonly ["auto", "custom"];
|
|
@@ -30,17 +30,18 @@ type ExtendedOption = (typeof defaultExtendedOptions)[number];
|
|
|
30
30
|
|
|
31
31
|
type SizeControlProps = {
|
|
32
32
|
placeholder?: string;
|
|
33
|
-
startIcon?: React.ReactNode;
|
|
33
|
+
startIcon?: React$1.ReactNode;
|
|
34
34
|
units?: Unit[];
|
|
35
35
|
extendedOptions?: ExtendedOption[];
|
|
36
36
|
disableCustom?: boolean;
|
|
37
37
|
anchorRef?: MutableRefObject<HTMLElement | undefined>;
|
|
38
|
+
defaultUnit?: Unit;
|
|
38
39
|
};
|
|
39
|
-
declare const SizeControl: ControlComponent<(props: SizeControlProps) => React.JSX.Element>;
|
|
40
|
+
declare const SizeControl: ControlComponent<(props: SizeControlProps) => React$1.JSX.Element>;
|
|
40
41
|
|
|
41
|
-
declare const StrokeControl: ControlComponent<() => React.JSX.Element>;
|
|
42
|
+
declare const StrokeControl: ControlComponent<() => React$1.JSX.Element>;
|
|
42
43
|
|
|
43
|
-
declare const BoxShadowRepeaterControl: ControlComponent<() => React.JSX.Element>;
|
|
44
|
+
declare const BoxShadowRepeaterControl: ControlComponent<() => React$1.JSX.Element>;
|
|
44
45
|
|
|
45
46
|
type Props$5 = {
|
|
46
47
|
options: Array<{
|
|
@@ -50,13 +51,13 @@ type Props$5 = {
|
|
|
50
51
|
}>;
|
|
51
52
|
onChange?: (newValue: string | null, previousValue: string | null | undefined) => void;
|
|
52
53
|
};
|
|
53
|
-
declare const SelectControl: ControlComponent<({ options, onChange }: Props$5) => React.JSX.Element>;
|
|
54
|
+
declare const SelectControl: ControlComponent<({ options, onChange }: Props$5) => React$1.JSX.Element>;
|
|
54
55
|
|
|
55
56
|
type Props$4 = Partial<Omit<UnstableColorFieldProps, 'value' | 'onChange'>> & {
|
|
56
57
|
propTypeUtil?: PropTypeUtil<string, string>;
|
|
57
58
|
anchorEl?: HTMLElement | null;
|
|
58
59
|
};
|
|
59
|
-
declare const ColorControl: ControlComponent<({ propTypeUtil, anchorEl, slotProps, ...props }: Props$4) => React.JSX.Element>;
|
|
60
|
+
declare const ColorControl: ControlComponent<({ propTypeUtil, anchorEl, slotProps, ...props }: Props$4) => React$1.JSX.Element>;
|
|
60
61
|
|
|
61
62
|
type RenderContentProps = {
|
|
62
63
|
size: ToggleButtonProps['size'];
|
|
@@ -64,7 +65,7 @@ type RenderContentProps = {
|
|
|
64
65
|
type ToggleButtonGroupItem<TValue> = {
|
|
65
66
|
value: TValue;
|
|
66
67
|
label: string;
|
|
67
|
-
renderContent: ({ size }: RenderContentProps) => React.ReactNode;
|
|
68
|
+
renderContent: ({ size }: RenderContentProps) => React$1.ReactNode;
|
|
68
69
|
showTooltip?: boolean;
|
|
69
70
|
};
|
|
70
71
|
type ExclusiveValue<TValue> = TValue;
|
|
@@ -85,7 +86,7 @@ type Props$3<TValue> = {
|
|
|
85
86
|
value: ExclusiveValue<TValue>;
|
|
86
87
|
onChange: (value: ExclusiveValue<TValue>) => void;
|
|
87
88
|
});
|
|
88
|
-
declare const ControlToggleButtonGroup: <TValue>({ justify, size, value, onChange, items, maxItems, exclusive, fullWidth, disabled, }: Props$3<TValue>) => React.JSX.Element;
|
|
89
|
+
declare const ControlToggleButtonGroup: <TValue>({ justify, size, value, onChange, items, maxItems, exclusive, fullWidth, disabled, }: Props$3<TValue>) => React$1.JSX.Element;
|
|
89
90
|
|
|
90
91
|
type ToggleControlProps<T extends PropValue> = {
|
|
91
92
|
options: Array<ToggleButtonGroupItem<T> & {
|
|
@@ -96,7 +97,7 @@ type ToggleControlProps<T extends PropValue> = {
|
|
|
96
97
|
exclusive?: boolean;
|
|
97
98
|
maxItems?: number;
|
|
98
99
|
};
|
|
99
|
-
declare const ToggleControl: ControlComponent<({ options, fullWidth, size, exclusive, maxItems, }: ToggleControlProps<StringPropValue["value"]>) => React.JSX.Element>;
|
|
100
|
+
declare const ToggleControl: ControlComponent<({ options, fullWidth, size, exclusive, maxItems, }: ToggleControlProps<StringPropValue["value"]>) => React$1.JSX.Element>;
|
|
100
101
|
|
|
101
102
|
declare const NumberControl: ControlComponent<({ placeholder, max, min, step, shouldForceInt, }: {
|
|
102
103
|
placeholder?: string;
|
|
@@ -104,7 +105,7 @@ declare const NumberControl: ControlComponent<({ placeholder, max, min, step, sh
|
|
|
104
105
|
min?: number;
|
|
105
106
|
step?: number;
|
|
106
107
|
shouldForceInt?: boolean;
|
|
107
|
-
}) => React.JSX.Element>;
|
|
108
|
+
}) => React$1.JSX.Element>;
|
|
108
109
|
|
|
109
110
|
type MultiSizePropValue = Record<PropKey, SizePropValue>;
|
|
110
111
|
type Item = {
|
|
@@ -120,13 +121,13 @@ type Props$2<TMultiPropType extends string, TPropValue extends MultiSizePropValu
|
|
|
120
121
|
items: EqualUnequalItems;
|
|
121
122
|
multiSizePropTypeUtil: PropTypeUtil<TMultiPropType, TPropValue>;
|
|
122
123
|
};
|
|
123
|
-
declare function EqualUnequalSizesControl<TMultiPropType extends string, TPropValue extends MultiSizePropValue>({ label, icon, tooltipLabel, items, multiSizePropTypeUtil, }: Props$2<TMultiPropType, TPropValue>): React.JSX.Element;
|
|
124
|
+
declare function EqualUnequalSizesControl<TMultiPropType extends string, TPropValue extends MultiSizePropValue>({ label, icon, tooltipLabel, items, multiSizePropTypeUtil, }: Props$2<TMultiPropType, TPropValue>): React$1.JSX.Element;
|
|
124
125
|
|
|
125
126
|
declare const LinkedDimensionsControl: ControlComponent<({ label, isSiteRtl, extendedOptions, }: {
|
|
126
127
|
label: string;
|
|
127
128
|
isSiteRtl?: boolean;
|
|
128
129
|
extendedOptions?: ExtendedOption[];
|
|
129
|
-
}) => React.JSX.Element>;
|
|
130
|
+
}) => React$1.JSX.Element>;
|
|
130
131
|
|
|
131
132
|
type FontCategory = {
|
|
132
133
|
label: string;
|
|
@@ -135,11 +136,11 @@ type FontCategory = {
|
|
|
135
136
|
type FontFamilyControlProps = {
|
|
136
137
|
fontFamilies: FontCategory[];
|
|
137
138
|
};
|
|
138
|
-
declare const FontFamilyControl: ControlComponent<({ fontFamilies }: FontFamilyControlProps) => React.JSX.Element>;
|
|
139
|
+
declare const FontFamilyControl: ControlComponent<({ fontFamilies }: FontFamilyControlProps) => React$1.JSX.Element>;
|
|
139
140
|
|
|
140
141
|
declare const UrlControl: ControlComponent<({ placeholder }: {
|
|
141
142
|
placeholder?: string;
|
|
142
|
-
}) => React.JSX.Element>;
|
|
143
|
+
}) => React$1.JSX.Element>;
|
|
143
144
|
|
|
144
145
|
type ControlProps<TControlProps = unknown> = TControlProps & {
|
|
145
146
|
context: {
|
|
@@ -156,23 +157,50 @@ type Props$1 = ControlProps<{
|
|
|
156
157
|
minInputLength?: number;
|
|
157
158
|
placeholder?: string;
|
|
158
159
|
}>;
|
|
159
|
-
declare const LinkControl: ControlComponent<(props: Props$1) => React.JSX.Element>;
|
|
160
|
+
declare const LinkControl: ControlComponent<(props: Props$1) => React$1.JSX.Element>;
|
|
160
161
|
|
|
161
162
|
declare const GapControl: ControlComponent<({ label }: {
|
|
162
163
|
label: string;
|
|
163
|
-
}) => React.JSX.Element>;
|
|
164
|
+
}) => React$1.JSX.Element>;
|
|
164
165
|
|
|
165
166
|
declare const AspectRatioControl: ControlComponent<({ label }: {
|
|
166
167
|
label: string;
|
|
167
|
-
}) => React.JSX.Element>;
|
|
168
|
+
}) => React$1.JSX.Element>;
|
|
168
169
|
|
|
169
|
-
declare const SvgMediaControl: ControlComponent<() => React.JSX.Element>;
|
|
170
|
+
declare const SvgMediaControl: ControlComponent<() => React$1.JSX.Element>;
|
|
170
171
|
|
|
171
|
-
declare const BackgroundControl: ControlComponent<() => React.JSX.Element>;
|
|
172
|
+
declare const BackgroundControl: ControlComponent<() => React$1.JSX.Element>;
|
|
172
173
|
|
|
173
|
-
declare const SwitchControl: ControlComponent<() => React.JSX.Element>;
|
|
174
|
+
declare const SwitchControl: ControlComponent<() => React$1.JSX.Element>;
|
|
174
175
|
|
|
175
|
-
|
|
176
|
+
type ChildControlConfig = {
|
|
177
|
+
component: React.ComponentType;
|
|
178
|
+
props?: Record<string, unknown>;
|
|
179
|
+
propTypeUtil: PropTypeUtil<string, any>;
|
|
180
|
+
label?: string;
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
type RepeatableControlProps = {
|
|
184
|
+
label: string;
|
|
185
|
+
childControlConfig: ChildControlConfig;
|
|
186
|
+
showDuplicate?: boolean;
|
|
187
|
+
showToggle?: boolean;
|
|
188
|
+
};
|
|
189
|
+
declare const RepeatableControl: ControlComponent<({ label, childControlConfig, showDuplicate, showToggle }: RepeatableControlProps) => React$1.JSX.Element | null>;
|
|
190
|
+
|
|
191
|
+
type KeyValueControlProps = {
|
|
192
|
+
keyName?: string;
|
|
193
|
+
valueName?: string;
|
|
194
|
+
sx?: SxProps<Theme>;
|
|
195
|
+
regexKey?: string;
|
|
196
|
+
regexValue?: string;
|
|
197
|
+
validationErrorMessage?: string;
|
|
198
|
+
};
|
|
199
|
+
declare const KeyValueControl: ControlComponent<(props?: KeyValueControlProps) => React$1.JSX.Element>;
|
|
200
|
+
|
|
201
|
+
declare const PositionControl: () => React$1.JSX.Element;
|
|
202
|
+
|
|
203
|
+
declare const ControlFormLabel: (props: FormLabelProps) => React$1.JSX.Element;
|
|
176
204
|
|
|
177
205
|
type FontFamilySelectorProps = {
|
|
178
206
|
fontFamilies: FontCategory[];
|
|
@@ -180,7 +208,7 @@ type FontFamilySelectorProps = {
|
|
|
180
208
|
onFontFamilyChange: (fontFamily: string) => void;
|
|
181
209
|
onClose: () => void;
|
|
182
210
|
};
|
|
183
|
-
declare const FontFamilySelector: ({ fontFamilies, fontFamily, onFontFamilyChange, onClose, }: FontFamilySelectorProps) => React.JSX.Element;
|
|
211
|
+
declare const FontFamilySelector: ({ fontFamilies, fontFamily, onFontFamilyChange, onClose, }: FontFamilySelectorProps) => React$1.JSX.Element;
|
|
184
212
|
|
|
185
213
|
type AnyComponentType = ComponentType<any>;
|
|
186
214
|
declare const brandSymbol: unique symbol;
|
|
@@ -190,13 +218,13 @@ type ControlComponent<TComponent extends AnyComponentType = AnyComponentType> =
|
|
|
190
218
|
|
|
191
219
|
type ControlActionsItems = Array<{
|
|
192
220
|
id: string;
|
|
193
|
-
MenuItem: React.ComponentType;
|
|
221
|
+
MenuItem: React$1.ComponentType;
|
|
194
222
|
}>;
|
|
195
223
|
type ControlActionsContext = {
|
|
196
224
|
items: ControlActionsItems;
|
|
197
225
|
};
|
|
198
226
|
type ControlActionsProviderProps = PropsWithChildren<ControlActionsContext>;
|
|
199
|
-
declare const ControlActionsProvider: ({ children, items }: ControlActionsProviderProps) => React.JSX.Element;
|
|
227
|
+
declare const ControlActionsProvider: ({ children, items }: ControlActionsProviderProps) => React$1.JSX.Element;
|
|
200
228
|
declare const useControlActions: () => ControlActionsContext;
|
|
201
229
|
|
|
202
230
|
type SetValueMeta = {
|
|
@@ -210,9 +238,9 @@ type PropContext<T extends PropValue, P extends PropType> = {
|
|
|
210
238
|
placeholder?: T;
|
|
211
239
|
disabled?: boolean;
|
|
212
240
|
};
|
|
213
|
-
declare const PropContext: React.Context<PropContext<PropValue, PropType> | null>;
|
|
214
|
-
type PropProviderProps<T extends PropValue, P extends PropType> = React.PropsWithChildren<PropContext<T, P>>;
|
|
215
|
-
declare const PropProvider: <T extends PropValue, P extends PropType>({ children, value, setValue, propType, placeholder, disabled, }: PropProviderProps<T, P>) => React.JSX.Element;
|
|
241
|
+
declare const PropContext: React$1.Context<PropContext<PropValue, PropType> | null>;
|
|
242
|
+
type PropProviderProps<T extends PropValue, P extends PropType> = React$1.PropsWithChildren<PropContext<T, P>>;
|
|
243
|
+
declare const PropProvider: <T extends PropValue, P extends PropType>({ children, value, setValue, propType, placeholder, disabled, }: PropProviderProps<T, P>) => React$1.JSX.Element;
|
|
216
244
|
|
|
217
245
|
type PropKeyContextValue<T, P> = {
|
|
218
246
|
bind: PropKey;
|
|
@@ -223,10 +251,10 @@ type PropKeyContextValue<T, P> = {
|
|
|
223
251
|
path: PropKey[];
|
|
224
252
|
disabled?: boolean;
|
|
225
253
|
};
|
|
226
|
-
type PropKeyProviderProps = React.PropsWithChildren<{
|
|
254
|
+
type PropKeyProviderProps = React$1.PropsWithChildren<{
|
|
227
255
|
bind: PropKey;
|
|
228
256
|
}>;
|
|
229
|
-
declare const PropKeyProvider: ({ children, bind }: PropKeyProviderProps) => React.JSX.Element;
|
|
257
|
+
declare const PropKeyProvider: ({ children, bind }: PropKeyProviderProps) => React$1.JSX.Element;
|
|
230
258
|
|
|
231
259
|
type UseBoundProp<TValue extends PropValue> = {
|
|
232
260
|
bind: PropKey;
|
|
@@ -251,7 +279,7 @@ type ConditionArgs = {
|
|
|
251
279
|
type Props = PropsWithChildren<{
|
|
252
280
|
replacements: ControlReplacement[];
|
|
253
281
|
}>;
|
|
254
|
-
declare const ControlReplacementsProvider: ({ replacements, children }: Props) => React.JSX.Element;
|
|
282
|
+
declare const ControlReplacementsProvider: ({ replacements, children }: Props) => React$1.JSX.Element;
|
|
255
283
|
declare const createControlReplacementsRegistry: () => {
|
|
256
284
|
registerControlReplacement: (replacement: ControlReplacement) => void;
|
|
257
285
|
getControlReplacements: () => ControlReplacement[];
|
|
@@ -265,9 +293,9 @@ type ControlAdornmentsContext = {
|
|
|
265
293
|
items?: ControlAdornmentsItems;
|
|
266
294
|
};
|
|
267
295
|
type ControlAdornmentsProviderProps = PropsWithChildren<ControlAdornmentsContext>;
|
|
268
|
-
declare const ControlAdornmentsProvider: ({ children, items }: ControlAdornmentsProviderProps) => React.JSX.Element;
|
|
296
|
+
declare const ControlAdornmentsProvider: ({ children, items }: ControlAdornmentsProviderProps) => React$1.JSX.Element;
|
|
269
297
|
|
|
270
|
-
declare function ControlAdornments(): React.JSX.Element | null;
|
|
298
|
+
declare function ControlAdornments(): React$1.JSX.Element | null;
|
|
271
299
|
|
|
272
300
|
declare const injectIntoRepeaterItemIcon: (args: _elementor_locations.ReplaceableInjectArgs<{
|
|
273
301
|
value: PropValue;
|
|
@@ -284,4 +312,4 @@ type UseInternalStateOptions<TValue> = {
|
|
|
284
312
|
};
|
|
285
313
|
declare const useSyncExternalState: <TValue>({ external, setExternal, persistWhen, fallback, }: UseInternalStateOptions<TValue>) => readonly [TValue, (setter: ((value: TValue) => TValue) | TValue) => void];
|
|
286
314
|
|
|
287
|
-
export { AspectRatioControl, BackgroundControl, BoxShadowRepeaterControl, ColorControl, type ControlActionsItems, ControlActionsProvider, ControlAdornments, ControlAdornmentsProvider, type ControlComponent, ControlFormLabel, ControlReplacementsProvider, ControlToggleButtonGroup, type EqualUnequalItems, EqualUnequalSizesControl, type ExtendedOption, type FontCategory, FontFamilyControl, FontFamilySelector, GapControl, ImageControl, LinkControl, LinkedDimensionsControl, NumberControl, PropKeyProvider, PropProvider, type PropProviderProps, SelectControl, type SetValue, SizeControl, StrokeControl, SvgMediaControl, SwitchControl, TextAreaControl, TextControl, type ToggleButtonGroupItem, ToggleControl, type ToggleControlProps, UrlControl, createControlReplacementsRegistry, injectIntoRepeaterItemIcon, injectIntoRepeaterItemLabel, useBoundProp, useControlActions, useSyncExternalState };
|
|
315
|
+
export { AspectRatioControl, BackgroundControl, BoxShadowRepeaterControl, ColorControl, type ControlActionsItems, ControlActionsProvider, ControlAdornments, ControlAdornmentsProvider, type ControlComponent, ControlFormLabel, ControlReplacementsProvider, ControlToggleButtonGroup, type EqualUnequalItems, EqualUnequalSizesControl, type ExtendedOption, type FontCategory, FontFamilyControl, FontFamilySelector, GapControl, ImageControl, KeyValueControl, LinkControl, LinkedDimensionsControl, NumberControl, PositionControl, PropKeyProvider, PropProvider, type PropProviderProps, RepeatableControl, SelectControl, type SetValue, SizeControl, StrokeControl, SvgMediaControl, SwitchControl, TextAreaControl, TextControl, type ToggleButtonGroupItem, ToggleControl, type ToggleControlProps, UrlControl, createControlReplacementsRegistry, injectIntoRepeaterItemIcon, injectIntoRepeaterItemLabel, useBoundProp, useControlActions, useSyncExternalState };
|