@elementor/editor-controls 0.26.0 → 0.28.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 +26 -0
- package/dist/index.d.mts +27 -23
- package/dist/index.d.ts +27 -23
- package/dist/index.js +38 -37
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +40 -39
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
- package/src/control-replacements.tsx +49 -0
- package/src/controls/equal-unequal-sizes-control.tsx +0 -1
- package/src/controls/image-control.tsx +19 -14
- package/src/controls/link-control.tsx +17 -6
- package/src/create-control.tsx +3 -18
- package/src/index.ts +1 -1
- package/src/create-control-replacement.tsx +0 -54
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @elementor/editor-controls
|
|
2
2
|
|
|
3
|
+
## 0.28.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- f4deb05: Remove divider in Link Control and change Image Control showcases
|
|
8
|
+
- 9e7a3ee: Set Link Control label default empty string
|
|
9
|
+
- baf662e: Fixed when opening and closing link collapsible, publish will not activate
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- ca016cc: Elementor ui update to version 1.34.2, elementor icons update to 1.40.1
|
|
14
|
+
- Updated dependencies [ca016cc]
|
|
15
|
+
- @elementor/editor-ui@0.8.1
|
|
16
|
+
|
|
17
|
+
## 0.27.0
|
|
18
|
+
|
|
19
|
+
### Minor Changes
|
|
20
|
+
|
|
21
|
+
- 093b7ca: Add support for multiple control replacements
|
|
22
|
+
- 10cbbe9: update `@elementor/ui` version
|
|
23
|
+
|
|
24
|
+
### Patch Changes
|
|
25
|
+
|
|
26
|
+
- Updated dependencies [10cbbe9]
|
|
27
|
+
- @elementor/editor-ui@0.8.0
|
|
28
|
+
|
|
3
29
|
## 0.26.0
|
|
4
30
|
|
|
5
31
|
### Minor Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -9,17 +9,18 @@ type ImageControlProps = {
|
|
|
9
9
|
value: string;
|
|
10
10
|
}[];
|
|
11
11
|
resolutionLabel?: string;
|
|
12
|
+
showMode?: 'all' | 'media' | 'sizes';
|
|
12
13
|
};
|
|
13
|
-
declare const ImageControl: ControlComponent<({ sizes, resolutionLabel }: ImageControlProps) => React.JSX.Element>;
|
|
14
|
+
declare const ImageControl: ControlComponent<({ sizes, resolutionLabel, showMode }: ImageControlProps) => React.JSX.Element>;
|
|
14
15
|
|
|
15
16
|
declare const TextControl: ControlComponent<({ placeholder }: {
|
|
16
17
|
placeholder?: string;
|
|
17
18
|
}) => React.JSX.Element>;
|
|
18
19
|
|
|
19
|
-
type Props$
|
|
20
|
+
type Props$6 = {
|
|
20
21
|
placeholder?: string;
|
|
21
22
|
};
|
|
22
|
-
declare const TextAreaControl: ControlComponent<({ placeholder }: Props$
|
|
23
|
+
declare const TextAreaControl: ControlComponent<({ placeholder }: Props$6) => React.JSX.Element>;
|
|
23
24
|
|
|
24
25
|
type ExtendedValue = 'auto';
|
|
25
26
|
type Unit = 'px' | '%' | 'em' | 'rem' | 'vw' | 'vh';
|
|
@@ -35,7 +36,7 @@ declare const StrokeControl: ControlComponent<() => React.JSX.Element>;
|
|
|
35
36
|
|
|
36
37
|
declare const BoxShadowRepeaterControl: ControlComponent<() => React.JSX.Element>;
|
|
37
38
|
|
|
38
|
-
type Props$
|
|
39
|
+
type Props$5 = {
|
|
39
40
|
options: Array<{
|
|
40
41
|
label: string;
|
|
41
42
|
value: StringPropValue['value'];
|
|
@@ -43,12 +44,12 @@ type Props$4 = {
|
|
|
43
44
|
}>;
|
|
44
45
|
onChange?: (newValue: string | null, previousValue: string | null | undefined) => void;
|
|
45
46
|
};
|
|
46
|
-
declare const SelectControl: ControlComponent<({ options, onChange }: Props$
|
|
47
|
+
declare const SelectControl: ControlComponent<({ options, onChange }: Props$5) => React.JSX.Element>;
|
|
47
48
|
|
|
48
|
-
type Props$
|
|
49
|
+
type Props$4 = Partial<Omit<UnstableColorFieldProps, 'value' | 'onChange'>> & {
|
|
49
50
|
propTypeUtil?: PropTypeUtil<string, string>;
|
|
50
51
|
};
|
|
51
|
-
declare const ColorControl: ControlComponent<({ propTypeUtil, ...props }: Props$
|
|
52
|
+
declare const ColorControl: ControlComponent<({ propTypeUtil, ...props }: Props$4) => React.JSX.Element>;
|
|
52
53
|
|
|
53
54
|
type RenderContentProps = {
|
|
54
55
|
size: ToggleButtonProps['size'];
|
|
@@ -61,7 +62,7 @@ type ToggleButtonGroupItem<TValue> = {
|
|
|
61
62
|
};
|
|
62
63
|
type ExclusiveValue<TValue> = TValue;
|
|
63
64
|
type NonExclusiveValue<TValue> = TValue[];
|
|
64
|
-
type Props$
|
|
65
|
+
type Props$3<TValue> = {
|
|
65
66
|
justify?: StackProps['justifyContent'];
|
|
66
67
|
size?: ToggleButtonProps['size'];
|
|
67
68
|
items: ToggleButtonGroupItem<TValue | null>[];
|
|
@@ -75,7 +76,7 @@ type Props$2<TValue> = {
|
|
|
75
76
|
value: ExclusiveValue<TValue>;
|
|
76
77
|
onChange: (value: ExclusiveValue<TValue>) => void;
|
|
77
78
|
});
|
|
78
|
-
declare const ControlToggleButtonGroup: <TValue>({ justify, size, value, onChange, items, exclusive, fullWidth, }: Props$
|
|
79
|
+
declare const ControlToggleButtonGroup: <TValue>({ justify, size, value, onChange, items, exclusive, fullWidth, }: Props$3<TValue>) => React.JSX.Element;
|
|
79
80
|
|
|
80
81
|
type ToggleControlProps<T extends PropValue> = {
|
|
81
82
|
options: Array<ToggleButtonGroupItem<T> & {
|
|
@@ -102,14 +103,14 @@ type Item = {
|
|
|
102
103
|
bind: PropKey;
|
|
103
104
|
};
|
|
104
105
|
type EqualUnequalItems = [Item, Item, Item, Item];
|
|
105
|
-
type Props$
|
|
106
|
+
type Props$2<TMultiPropType extends string, TPropValue extends MultiSizePropValue> = {
|
|
106
107
|
label: string;
|
|
107
108
|
icon: ReactNode;
|
|
108
109
|
tooltipLabel: string;
|
|
109
110
|
items: EqualUnequalItems;
|
|
110
111
|
multiSizePropTypeUtil: PropTypeUtil<TMultiPropType, TPropValue>;
|
|
111
112
|
};
|
|
112
|
-
declare function EqualUnequalSizesControl<TMultiPropType extends string, TPropValue extends MultiSizePropValue>({ label, icon, tooltipLabel, items, multiSizePropTypeUtil, }: Props$
|
|
113
|
+
declare function EqualUnequalSizesControl<TMultiPropType extends string, TPropValue extends MultiSizePropValue>({ label, icon, tooltipLabel, items, multiSizePropTypeUtil, }: Props$2<TMultiPropType, TPropValue>): React.JSX.Element;
|
|
113
114
|
|
|
114
115
|
declare const LinkedDimensionsControl: ControlComponent<({ label, isSiteRtl, extendedValues, }: {
|
|
115
116
|
label: string;
|
|
@@ -136,7 +137,7 @@ type ControlProps<TControlProps = unknown> = TControlProps & {
|
|
|
136
137
|
};
|
|
137
138
|
};
|
|
138
139
|
|
|
139
|
-
type Props = ControlProps<{
|
|
140
|
+
type Props$1 = ControlProps<{
|
|
140
141
|
queryOptions: {
|
|
141
142
|
requestParams: Record<string, unknown>;
|
|
142
143
|
endpoint: string;
|
|
@@ -145,7 +146,7 @@ type Props = ControlProps<{
|
|
|
145
146
|
minInputLength?: number;
|
|
146
147
|
placeholder?: string;
|
|
147
148
|
}>;
|
|
148
|
-
declare const LinkControl: ControlComponent<(props: Props) => React.JSX.Element>;
|
|
149
|
+
declare const LinkControl: ControlComponent<(props: Props$1) => React.JSX.Element>;
|
|
149
150
|
|
|
150
151
|
declare const GapControl: ControlComponent<({ label }: {
|
|
151
152
|
label: string;
|
|
@@ -215,17 +216,20 @@ type UseBoundProp<TValue extends PropValue> = {
|
|
|
215
216
|
declare function useBoundProp<T extends PropValue = PropValue>(): PropKeyContextValue<T, PropType>;
|
|
216
217
|
declare function useBoundProp<TKey extends string, TValue extends PropValue>(propTypeUtil: PropTypeUtil<TKey, TValue>): UseBoundProp<TValue>;
|
|
217
218
|
|
|
218
|
-
type
|
|
219
|
-
value: PropValue;
|
|
220
|
-
};
|
|
221
|
-
type CreateControlReplacement = {
|
|
219
|
+
type ControlReplacement = {
|
|
222
220
|
component: ComponentType;
|
|
223
|
-
condition: ({ value }:
|
|
221
|
+
condition: ({ value }: ConditionArgs) => boolean;
|
|
224
222
|
};
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
223
|
+
type ConditionArgs = {
|
|
224
|
+
value: PropValue;
|
|
225
|
+
};
|
|
226
|
+
type Props = PropsWithChildren<{
|
|
227
|
+
replacements: ControlReplacement[];
|
|
228
|
+
}>;
|
|
229
|
+
declare const ControlReplacementsProvider: ({ replacements, children }: Props) => React.JSX.Element;
|
|
230
|
+
declare const createControlReplacementsRegistry: () => {
|
|
231
|
+
registerControlReplacement: (replacement: ControlReplacement) => void;
|
|
232
|
+
getControlReplacements: () => ControlReplacement[];
|
|
229
233
|
};
|
|
230
234
|
|
|
231
235
|
type ControlAdornmentsItems = Array<{
|
|
@@ -248,4 +252,4 @@ type UseInternalStateOptions<TValue> = {
|
|
|
248
252
|
};
|
|
249
253
|
declare const useSyncExternalState: <TValue>({ external, setExternal, persistWhen, fallback, }: UseInternalStateOptions<TValue>) => readonly [TValue, (setter: ((value: TValue) => TValue) | TValue) => void];
|
|
250
254
|
|
|
251
|
-
export { BackgroundControl, BoxShadowRepeaterControl, ColorControl, type ControlActionsItems, ControlActionsProvider, ControlAdornments, ControlAdornmentsProvider, type ControlComponent, ControlFormLabel,
|
|
255
|
+
export { BackgroundControl, BoxShadowRepeaterControl, ColorControl, type ControlActionsItems, ControlActionsProvider, ControlAdornments, ControlAdornmentsProvider, type ControlComponent, ControlFormLabel, ControlReplacementsProvider, ControlToggleButtonGroup, type EqualUnequalItems, EqualUnequalSizesControl, type ExtendedValue, type FontCategory, FontFamilyControl, GapControl, ImageControl, LinkControl, LinkedDimensionsControl, NumberControl, PropKeyProvider, PropProvider, type PropProviderProps, SelectControl, type SetValue, SizeControl, StrokeControl, SvgMediaControl, TextAreaControl, TextControl, type ToggleButtonGroupItem, ToggleControl, type ToggleControlProps, UrlControl, createControlReplacementsRegistry, useBoundProp, useControlActions, useSyncExternalState };
|
package/dist/index.d.ts
CHANGED
|
@@ -9,17 +9,18 @@ type ImageControlProps = {
|
|
|
9
9
|
value: string;
|
|
10
10
|
}[];
|
|
11
11
|
resolutionLabel?: string;
|
|
12
|
+
showMode?: 'all' | 'media' | 'sizes';
|
|
12
13
|
};
|
|
13
|
-
declare const ImageControl: ControlComponent<({ sizes, resolutionLabel }: ImageControlProps) => React.JSX.Element>;
|
|
14
|
+
declare const ImageControl: ControlComponent<({ sizes, resolutionLabel, showMode }: ImageControlProps) => React.JSX.Element>;
|
|
14
15
|
|
|
15
16
|
declare const TextControl: ControlComponent<({ placeholder }: {
|
|
16
17
|
placeholder?: string;
|
|
17
18
|
}) => React.JSX.Element>;
|
|
18
19
|
|
|
19
|
-
type Props$
|
|
20
|
+
type Props$6 = {
|
|
20
21
|
placeholder?: string;
|
|
21
22
|
};
|
|
22
|
-
declare const TextAreaControl: ControlComponent<({ placeholder }: Props$
|
|
23
|
+
declare const TextAreaControl: ControlComponent<({ placeholder }: Props$6) => React.JSX.Element>;
|
|
23
24
|
|
|
24
25
|
type ExtendedValue = 'auto';
|
|
25
26
|
type Unit = 'px' | '%' | 'em' | 'rem' | 'vw' | 'vh';
|
|
@@ -35,7 +36,7 @@ declare const StrokeControl: ControlComponent<() => React.JSX.Element>;
|
|
|
35
36
|
|
|
36
37
|
declare const BoxShadowRepeaterControl: ControlComponent<() => React.JSX.Element>;
|
|
37
38
|
|
|
38
|
-
type Props$
|
|
39
|
+
type Props$5 = {
|
|
39
40
|
options: Array<{
|
|
40
41
|
label: string;
|
|
41
42
|
value: StringPropValue['value'];
|
|
@@ -43,12 +44,12 @@ type Props$4 = {
|
|
|
43
44
|
}>;
|
|
44
45
|
onChange?: (newValue: string | null, previousValue: string | null | undefined) => void;
|
|
45
46
|
};
|
|
46
|
-
declare const SelectControl: ControlComponent<({ options, onChange }: Props$
|
|
47
|
+
declare const SelectControl: ControlComponent<({ options, onChange }: Props$5) => React.JSX.Element>;
|
|
47
48
|
|
|
48
|
-
type Props$
|
|
49
|
+
type Props$4 = Partial<Omit<UnstableColorFieldProps, 'value' | 'onChange'>> & {
|
|
49
50
|
propTypeUtil?: PropTypeUtil<string, string>;
|
|
50
51
|
};
|
|
51
|
-
declare const ColorControl: ControlComponent<({ propTypeUtil, ...props }: Props$
|
|
52
|
+
declare const ColorControl: ControlComponent<({ propTypeUtil, ...props }: Props$4) => React.JSX.Element>;
|
|
52
53
|
|
|
53
54
|
type RenderContentProps = {
|
|
54
55
|
size: ToggleButtonProps['size'];
|
|
@@ -61,7 +62,7 @@ type ToggleButtonGroupItem<TValue> = {
|
|
|
61
62
|
};
|
|
62
63
|
type ExclusiveValue<TValue> = TValue;
|
|
63
64
|
type NonExclusiveValue<TValue> = TValue[];
|
|
64
|
-
type Props$
|
|
65
|
+
type Props$3<TValue> = {
|
|
65
66
|
justify?: StackProps['justifyContent'];
|
|
66
67
|
size?: ToggleButtonProps['size'];
|
|
67
68
|
items: ToggleButtonGroupItem<TValue | null>[];
|
|
@@ -75,7 +76,7 @@ type Props$2<TValue> = {
|
|
|
75
76
|
value: ExclusiveValue<TValue>;
|
|
76
77
|
onChange: (value: ExclusiveValue<TValue>) => void;
|
|
77
78
|
});
|
|
78
|
-
declare const ControlToggleButtonGroup: <TValue>({ justify, size, value, onChange, items, exclusive, fullWidth, }: Props$
|
|
79
|
+
declare const ControlToggleButtonGroup: <TValue>({ justify, size, value, onChange, items, exclusive, fullWidth, }: Props$3<TValue>) => React.JSX.Element;
|
|
79
80
|
|
|
80
81
|
type ToggleControlProps<T extends PropValue> = {
|
|
81
82
|
options: Array<ToggleButtonGroupItem<T> & {
|
|
@@ -102,14 +103,14 @@ type Item = {
|
|
|
102
103
|
bind: PropKey;
|
|
103
104
|
};
|
|
104
105
|
type EqualUnequalItems = [Item, Item, Item, Item];
|
|
105
|
-
type Props$
|
|
106
|
+
type Props$2<TMultiPropType extends string, TPropValue extends MultiSizePropValue> = {
|
|
106
107
|
label: string;
|
|
107
108
|
icon: ReactNode;
|
|
108
109
|
tooltipLabel: string;
|
|
109
110
|
items: EqualUnequalItems;
|
|
110
111
|
multiSizePropTypeUtil: PropTypeUtil<TMultiPropType, TPropValue>;
|
|
111
112
|
};
|
|
112
|
-
declare function EqualUnequalSizesControl<TMultiPropType extends string, TPropValue extends MultiSizePropValue>({ label, icon, tooltipLabel, items, multiSizePropTypeUtil, }: Props$
|
|
113
|
+
declare function EqualUnequalSizesControl<TMultiPropType extends string, TPropValue extends MultiSizePropValue>({ label, icon, tooltipLabel, items, multiSizePropTypeUtil, }: Props$2<TMultiPropType, TPropValue>): React.JSX.Element;
|
|
113
114
|
|
|
114
115
|
declare const LinkedDimensionsControl: ControlComponent<({ label, isSiteRtl, extendedValues, }: {
|
|
115
116
|
label: string;
|
|
@@ -136,7 +137,7 @@ type ControlProps<TControlProps = unknown> = TControlProps & {
|
|
|
136
137
|
};
|
|
137
138
|
};
|
|
138
139
|
|
|
139
|
-
type Props = ControlProps<{
|
|
140
|
+
type Props$1 = ControlProps<{
|
|
140
141
|
queryOptions: {
|
|
141
142
|
requestParams: Record<string, unknown>;
|
|
142
143
|
endpoint: string;
|
|
@@ -145,7 +146,7 @@ type Props = ControlProps<{
|
|
|
145
146
|
minInputLength?: number;
|
|
146
147
|
placeholder?: string;
|
|
147
148
|
}>;
|
|
148
|
-
declare const LinkControl: ControlComponent<(props: Props) => React.JSX.Element>;
|
|
149
|
+
declare const LinkControl: ControlComponent<(props: Props$1) => React.JSX.Element>;
|
|
149
150
|
|
|
150
151
|
declare const GapControl: ControlComponent<({ label }: {
|
|
151
152
|
label: string;
|
|
@@ -215,17 +216,20 @@ type UseBoundProp<TValue extends PropValue> = {
|
|
|
215
216
|
declare function useBoundProp<T extends PropValue = PropValue>(): PropKeyContextValue<T, PropType>;
|
|
216
217
|
declare function useBoundProp<TKey extends string, TValue extends PropValue>(propTypeUtil: PropTypeUtil<TKey, TValue>): UseBoundProp<TValue>;
|
|
217
218
|
|
|
218
|
-
type
|
|
219
|
-
value: PropValue;
|
|
220
|
-
};
|
|
221
|
-
type CreateControlReplacement = {
|
|
219
|
+
type ControlReplacement = {
|
|
222
220
|
component: ComponentType;
|
|
223
|
-
condition: ({ value }:
|
|
221
|
+
condition: ({ value }: ConditionArgs) => boolean;
|
|
224
222
|
};
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
223
|
+
type ConditionArgs = {
|
|
224
|
+
value: PropValue;
|
|
225
|
+
};
|
|
226
|
+
type Props = PropsWithChildren<{
|
|
227
|
+
replacements: ControlReplacement[];
|
|
228
|
+
}>;
|
|
229
|
+
declare const ControlReplacementsProvider: ({ replacements, children }: Props) => React.JSX.Element;
|
|
230
|
+
declare const createControlReplacementsRegistry: () => {
|
|
231
|
+
registerControlReplacement: (replacement: ControlReplacement) => void;
|
|
232
|
+
getControlReplacements: () => ControlReplacement[];
|
|
229
233
|
};
|
|
230
234
|
|
|
231
235
|
type ControlAdornmentsItems = Array<{
|
|
@@ -248,4 +252,4 @@ type UseInternalStateOptions<TValue> = {
|
|
|
248
252
|
};
|
|
249
253
|
declare const useSyncExternalState: <TValue>({ external, setExternal, persistWhen, fallback, }: UseInternalStateOptions<TValue>) => readonly [TValue, (setter: ((value: TValue) => TValue) | TValue) => void];
|
|
250
254
|
|
|
251
|
-
export { BackgroundControl, BoxShadowRepeaterControl, ColorControl, type ControlActionsItems, ControlActionsProvider, ControlAdornments, ControlAdornmentsProvider, type ControlComponent, ControlFormLabel,
|
|
255
|
+
export { BackgroundControl, BoxShadowRepeaterControl, ColorControl, type ControlActionsItems, ControlActionsProvider, ControlAdornments, ControlAdornmentsProvider, type ControlComponent, ControlFormLabel, ControlReplacementsProvider, ControlToggleButtonGroup, type EqualUnequalItems, EqualUnequalSizesControl, type ExtendedValue, type FontCategory, FontFamilyControl, GapControl, ImageControl, LinkControl, LinkedDimensionsControl, NumberControl, PropKeyProvider, PropProvider, type PropProviderProps, SelectControl, type SetValue, SizeControl, StrokeControl, SvgMediaControl, TextAreaControl, TextControl, type ToggleButtonGroupItem, ToggleControl, type ToggleControlProps, UrlControl, createControlReplacementsRegistry, useBoundProp, useControlActions, useSyncExternalState };
|
package/dist/index.js
CHANGED
|
@@ -37,7 +37,7 @@ __export(index_exports, {
|
|
|
37
37
|
ControlAdornments: () => ControlAdornments,
|
|
38
38
|
ControlAdornmentsProvider: () => ControlAdornmentsProvider,
|
|
39
39
|
ControlFormLabel: () => ControlFormLabel,
|
|
40
|
-
|
|
40
|
+
ControlReplacementsProvider: () => ControlReplacementsProvider,
|
|
41
41
|
ControlToggleButtonGroup: () => ControlToggleButtonGroup,
|
|
42
42
|
EqualUnequalSizesControl: () => EqualUnequalSizesControl,
|
|
43
43
|
FontFamilyControl: () => FontFamilyControl,
|
|
@@ -56,7 +56,7 @@ __export(index_exports, {
|
|
|
56
56
|
TextControl: () => TextControl,
|
|
57
57
|
ToggleControl: () => ToggleControl,
|
|
58
58
|
UrlControl: () => UrlControl,
|
|
59
|
-
|
|
59
|
+
createControlReplacementsRegistry: () => createControlReplacementsRegistry,
|
|
60
60
|
useBoundProp: () => useBoundProp,
|
|
61
61
|
useControlActions: () => useControlActions,
|
|
62
62
|
useSyncExternalState: () => useSyncExternalState
|
|
@@ -258,46 +258,39 @@ var ControlFormLabel = ({ children }) => {
|
|
|
258
258
|
var React5 = __toESM(require("react"));
|
|
259
259
|
var import_ui2 = require("@elementor/ui");
|
|
260
260
|
|
|
261
|
-
// src/
|
|
261
|
+
// src/control-replacements.tsx
|
|
262
262
|
var React4 = __toESM(require("react"));
|
|
263
263
|
var import_react4 = require("react");
|
|
264
|
-
var ControlReplacementContext = (0, import_react4.createContext)(
|
|
265
|
-
var
|
|
266
|
-
|
|
267
|
-
condition,
|
|
268
|
-
children
|
|
269
|
-
}) => {
|
|
270
|
-
return /* @__PURE__ */ React4.createElement(ControlReplacementContext.Provider, { value: { component, condition } }, children);
|
|
264
|
+
var ControlReplacementContext = (0, import_react4.createContext)([]);
|
|
265
|
+
var ControlReplacementsProvider = ({ replacements, children }) => {
|
|
266
|
+
return /* @__PURE__ */ React4.createElement(ControlReplacementContext.Provider, { value: replacements }, children);
|
|
271
267
|
};
|
|
272
|
-
var useControlReplacement = () => {
|
|
268
|
+
var useControlReplacement = (OriginalComponent) => {
|
|
273
269
|
const { value } = useBoundProp();
|
|
274
|
-
const
|
|
275
|
-
let shouldReplace = false;
|
|
270
|
+
const replacements = (0, import_react4.useContext)(ControlReplacementContext);
|
|
276
271
|
try {
|
|
277
|
-
|
|
272
|
+
const replacement = replacements.find((r) => r.condition({ value }));
|
|
273
|
+
return replacement?.component ?? OriginalComponent;
|
|
278
274
|
} catch {
|
|
275
|
+
return OriginalComponent;
|
|
279
276
|
}
|
|
280
|
-
return shouldReplace ? controlReplacement?.component : void 0;
|
|
281
277
|
};
|
|
282
|
-
var
|
|
283
|
-
|
|
284
|
-
function
|
|
285
|
-
|
|
278
|
+
var createControlReplacementsRegistry = () => {
|
|
279
|
+
const controlReplacements = [];
|
|
280
|
+
function registerControlReplacement(replacement) {
|
|
281
|
+
controlReplacements.push(replacement);
|
|
286
282
|
}
|
|
287
|
-
function
|
|
288
|
-
return
|
|
283
|
+
function getControlReplacements() {
|
|
284
|
+
return controlReplacements;
|
|
289
285
|
}
|
|
290
|
-
return {
|
|
286
|
+
return { registerControlReplacement, getControlReplacements };
|
|
291
287
|
};
|
|
292
288
|
|
|
293
289
|
// src/create-control.tsx
|
|
294
290
|
var brandSymbol = Symbol("control");
|
|
295
|
-
function createControl(
|
|
291
|
+
function createControl(Control5) {
|
|
296
292
|
return (props) => {
|
|
297
|
-
const
|
|
298
|
-
if (ControlReplacement && supportsReplacements) {
|
|
299
|
-
return /* @__PURE__ */ React5.createElement(import_ui2.ErrorBoundary, { fallback: null }, /* @__PURE__ */ React5.createElement(ControlReplacement, { ...props }));
|
|
300
|
-
}
|
|
293
|
+
const Component = useControlReplacement(Control5);
|
|
301
294
|
return /* @__PURE__ */ React5.createElement(import_ui2.ErrorBoundary, { fallback: null }, /* @__PURE__ */ React5.createElement(Component, { ...props }));
|
|
302
295
|
};
|
|
303
296
|
}
|
|
@@ -453,11 +446,11 @@ var SelectControl = createControl(({ options, onChange }) => {
|
|
|
453
446
|
|
|
454
447
|
// src/controls/image-control.tsx
|
|
455
448
|
var ImageControl = createControl(
|
|
456
|
-
({ sizes, resolutionLabel = (0, import_i18n2.__)("Image resolution", "elementor") }) => {
|
|
449
|
+
({ sizes, resolutionLabel = (0, import_i18n2.__)("Image resolution", "elementor"), showMode = "all" }) => {
|
|
457
450
|
const propContext = useBoundProp(import_editor_props3.imagePropTypeUtil);
|
|
458
451
|
const { data: allowSvgUpload } = useUnfilteredFilesUpload();
|
|
459
452
|
const mediaTypes = allowSvgUpload ? ["image", "svg"] : ["image"];
|
|
460
|
-
return /* @__PURE__ */ React10.createElement(PropProvider, { ...propContext }, /* @__PURE__ */ React10.createElement(import_ui6.Stack, { gap: 1.5 }, /* @__PURE__ */ React10.createElement(PropKeyProvider, { bind: "src" }, /* @__PURE__ */ React10.createElement(ControlFormLabel, null, " ", (0, import_i18n2.__)("Image", "elementor"), " "), /* @__PURE__ */ React10.createElement(ImageMediaControl, { mediaTypes })), /* @__PURE__ */ React10.createElement(PropKeyProvider, { bind: "size" }, /* @__PURE__ */ React10.createElement(import_ui6.Grid, { container: true, gap: 1.5, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React10.createElement(import_ui6.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React10.createElement(ControlFormLabel, null, " ", resolutionLabel, " ")), /* @__PURE__ */ React10.createElement(import_ui6.Grid, { item: true, xs: 6, sx: { overflow: "hidden" } }, /* @__PURE__ */ React10.createElement(SelectControl, { options: sizes }))))));
|
|
453
|
+
return /* @__PURE__ */ React10.createElement(PropProvider, { ...propContext }, /* @__PURE__ */ React10.createElement(import_ui6.Stack, { gap: 1.5 }, ["all", "media"].includes(showMode) ? /* @__PURE__ */ React10.createElement(PropKeyProvider, { bind: "src" }, /* @__PURE__ */ React10.createElement(ControlFormLabel, null, " ", (0, import_i18n2.__)("Image", "elementor"), " "), /* @__PURE__ */ React10.createElement(ImageMediaControl, { mediaTypes })) : null, ["all", "sizes"].includes(showMode) ? /* @__PURE__ */ React10.createElement(PropKeyProvider, { bind: "size" }, /* @__PURE__ */ React10.createElement(import_ui6.Grid, { container: true, gap: 1.5, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React10.createElement(import_ui6.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React10.createElement(ControlFormLabel, null, " ", resolutionLabel, " ")), /* @__PURE__ */ React10.createElement(import_ui6.Grid, { item: true, xs: 6, sx: { overflow: "hidden" } }, /* @__PURE__ */ React10.createElement(SelectControl, { options: sizes })))) : null));
|
|
461
454
|
}
|
|
462
455
|
);
|
|
463
456
|
|
|
@@ -1369,7 +1362,6 @@ function EqualUnequalSizesControl({
|
|
|
1369
1362
|
},
|
|
1370
1363
|
...(0, import_ui22.bindPopover)(popupState),
|
|
1371
1364
|
slotProps: {
|
|
1372
|
-
// eslint-disable-next-line react-compiler/react-compiler
|
|
1373
1365
|
paper: { sx: { mt: 0.5, width: controlRef.current?.getBoundingClientRect().width } }
|
|
1374
1366
|
}
|
|
1375
1367
|
},
|
|
@@ -1887,9 +1879,18 @@ var LinkControl = createControl((props) => {
|
|
|
1887
1879
|
if (linkInLinkRestriction.shouldRestrict && !isActive) {
|
|
1888
1880
|
return;
|
|
1889
1881
|
}
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1882
|
+
const newState = !isActive;
|
|
1883
|
+
setIsActive(newState);
|
|
1884
|
+
if (!newState && value !== null) {
|
|
1885
|
+
setValue(null);
|
|
1886
|
+
}
|
|
1887
|
+
if (newState && linkSessionValue?.value) {
|
|
1888
|
+
setValue(linkSessionValue.value);
|
|
1889
|
+
}
|
|
1890
|
+
setLinkSessionValue({
|
|
1891
|
+
value: newState ? value : linkSessionValue?.value,
|
|
1892
|
+
meta: { isEnabled: newState }
|
|
1893
|
+
});
|
|
1893
1894
|
};
|
|
1894
1895
|
const onOptionChange = (newValue) => {
|
|
1895
1896
|
const valueToSave = newValue ? {
|
|
@@ -1904,7 +1905,7 @@ var LinkControl = createControl((props) => {
|
|
|
1904
1905
|
const valueToSave = newValue ? {
|
|
1905
1906
|
...value,
|
|
1906
1907
|
destination: import_editor_props16.urlPropTypeUtil.create(newValue),
|
|
1907
|
-
label:
|
|
1908
|
+
label: import_editor_props16.stringPropTypeUtil.create("")
|
|
1908
1909
|
} : null;
|
|
1909
1910
|
onSaveNewValue(valueToSave);
|
|
1910
1911
|
updateOptions(newValue);
|
|
@@ -1929,7 +1930,7 @@ var LinkControl = createControl((props) => {
|
|
|
1929
1930
|
),
|
|
1930
1931
|
[endpoint]
|
|
1931
1932
|
);
|
|
1932
|
-
return /* @__PURE__ */ React34.createElement(PropProvider, { ...propContext, value, setValue }, /* @__PURE__ */ React34.createElement(import_ui27.Stack, { gap: 1.5 }, /* @__PURE__ */ React34.createElement(
|
|
1933
|
+
return /* @__PURE__ */ React34.createElement(PropProvider, { ...propContext, value, setValue }, /* @__PURE__ */ React34.createElement(import_ui27.Stack, { gap: 1.5 }, /* @__PURE__ */ React34.createElement(
|
|
1933
1934
|
import_ui27.Stack,
|
|
1934
1935
|
{
|
|
1935
1936
|
direction: "row",
|
|
@@ -2765,7 +2766,7 @@ var BackgroundControl = createControl(() => {
|
|
|
2765
2766
|
ControlAdornments,
|
|
2766
2767
|
ControlAdornmentsProvider,
|
|
2767
2768
|
ControlFormLabel,
|
|
2768
|
-
|
|
2769
|
+
ControlReplacementsProvider,
|
|
2769
2770
|
ControlToggleButtonGroup,
|
|
2770
2771
|
EqualUnequalSizesControl,
|
|
2771
2772
|
FontFamilyControl,
|
|
@@ -2784,7 +2785,7 @@ var BackgroundControl = createControl(() => {
|
|
|
2784
2785
|
TextControl,
|
|
2785
2786
|
ToggleControl,
|
|
2786
2787
|
UrlControl,
|
|
2787
|
-
|
|
2788
|
+
createControlReplacementsRegistry,
|
|
2788
2789
|
useBoundProp,
|
|
2789
2790
|
useControlActions,
|
|
2790
2791
|
useSyncExternalState
|