@elementor/editor-controls 0.8.0 → 0.10.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.
Files changed (32) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/dist/index.d.mts +37 -25
  3. package/dist/index.d.ts +37 -25
  4. package/dist/index.js +609 -289
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.mjs +583 -254
  7. package/dist/index.mjs.map +1 -1
  8. package/package.json +11 -6
  9. package/src/bound-prop-context/prop-key-context.tsx +1 -1
  10. package/src/components/repeater.tsx +10 -4
  11. package/src/components/text-field-inner-selection.tsx +2 -2
  12. package/src/control-actions/control-actions-context.tsx +1 -1
  13. package/src/control-actions/control-actions.tsx +1 -1
  14. package/src/controls/autocomplete-control.tsx +99 -80
  15. package/src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-attachment.tsx +3 -3
  16. package/src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-position.tsx +72 -8
  17. package/src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-repeat.tsx +1 -1
  18. package/src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-size.tsx +71 -11
  19. package/src/controls/background-control/background-overlay/background-overlay-repeater-control.tsx +92 -46
  20. package/src/controls/background-control/background-overlay/types.ts +22 -0
  21. package/src/controls/background-control/background-overlay/use-background-tabs-history.ts +62 -0
  22. package/src/controls/box-shadow-repeater-control.tsx +1 -1
  23. package/src/controls/image-control.tsx +26 -22
  24. package/src/controls/image-media-control.tsx +1 -1
  25. package/src/controls/link-control.tsx +134 -17
  26. package/src/controls/size-control.tsx +1 -1
  27. package/src/controls/stroke-control.tsx +1 -1
  28. package/src/controls/svg-media-control.tsx +107 -0
  29. package/src/create-control-replacement.tsx +2 -2
  30. package/src/env.ts +5 -0
  31. package/src/index.ts +2 -1
  32. package/src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-resolution.tsx +0 -27
package/CHANGELOG.md CHANGED
@@ -1,5 +1,54 @@
1
1
  # @elementor/editor-controls
2
2
 
3
+ ## 0.10.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 87fa083: Preserve background repeater value history when switching tabs.
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [6b064c5]
12
+ - @elementor/editor-props@0.9.1
13
+
14
+ ## 0.9.0
15
+
16
+ ### Minor Changes
17
+
18
+ - c9133d7: Add background image overlay custom size
19
+ - 86863c1: Changed link control to use query instead of autocomplete
20
+ - 910044c: update `@elementor/icons` and `@elementor/ui` packages.
21
+ - 9a41a86: Added condition to hide select control for tag bind when link is enabled
22
+ - 9de8ba7: Updated icon in background repeater image overlay size control
23
+ - 0953b40: Background image overlay resolution canvas connection
24
+ - 6680c92: added svg widget
25
+ - 15c964f: Add background image overlay custom position
26
+ - 5caf78d: update `@elementor/ui` package.
27
+ - 625448d: Added tests for background image overlay
28
+ - c162e6c: Update '@elementor/icons' version
29
+ - d39b70b: Add a new repeater item to top by default.
30
+ - 9cc8def: Updated image upload control text
31
+ - fbf6203: Added select button for SVG control and updated component style
32
+ - ceb1211: remove extra padding from popover header
33
+
34
+ ### Patch Changes
35
+
36
+ - 9fd9bae: align background image overlay repeat and attachment controls.
37
+ - da38fa9: Remove unused exports and add missing dependencies.
38
+ - 35f9714: Add default background image to background overlay repeater
39
+ - 2bf6b34: fix, add file type to the image name in the background overlay
40
+ - b4a6ac6: refactor the call to editor controls env, to avoid parsing env before it's initialized
41
+ - e76d970: Added SVG upload text
42
+ - baee3f3: Adjust gap
43
+ - Updated dependencies [c9133d7]
44
+ - Updated dependencies [86863c1]
45
+ - Updated dependencies [da38fa9]
46
+ - Updated dependencies [9ca4eab]
47
+ - Updated dependencies [15c964f]
48
+ - @elementor/editor-props@0.9.0
49
+ - @elementor/utils@0.3.1
50
+ - @elementor/wp-media@0.4.1
51
+
3
52
  ## 0.8.0
4
53
 
5
54
  ### Minor Changes
package/dist/index.d.mts CHANGED
@@ -1,38 +1,38 @@
1
1
  import * as React from 'react';
2
- import { ComponentType, ReactNode, PropsWithChildren } from 'react';
3
- import { urlPropTypeUtil, stringPropTypeUtil, StringPropValue, PropTypeUtil, PropValue, PropKey, SizePropValue, CreateOptions, PropType } from '@elementor/editor-props';
2
+ import { ReactNode, ComponentType, PropsWithChildren } from 'react';
3
+ import { PropTypeUtil, StringPropValue, PropValue, PropKey, SizePropValue, PropType, CreateOptions } from '@elementor/editor-props';
4
4
  import { UnstableColorFieldProps, ToggleButtonProps, StackProps } from '@elementor/ui';
5
5
 
6
- type AnyComponentType = ComponentType<any>;
7
- declare const brandSymbol: unique symbol;
8
- type ControlComponent<TComponent extends AnyComponentType = AnyComponentType> = TComponent & {
9
- [brandSymbol]: true;
10
- };
11
-
12
- type ImageControlProps = {
13
- sizes: {
14
- label: string;
15
- value: string;
16
- }[];
17
- };
18
- declare const ImageControl: ControlComponent<(props: ImageControlProps) => React.JSX.Element>;
19
-
20
- type Option = {
6
+ type FlatOption = {
7
+ id: string;
21
8
  label: string;
22
9
  groupLabel?: never;
23
10
  };
24
- type GroupedOption = {
11
+ type CategorizedOption = {
12
+ id: string;
25
13
  label: string;
26
14
  groupLabel: string;
27
15
  };
28
- type Props$6 = {
29
- options: Record<string, Option> | Record<string, GroupedOption>;
16
+ type Props$6<TOptionKey extends string, TCustomKey extends string = ''> = {
17
+ options: FlatOption[] | CategorizedOption[];
18
+ optionRestrictedPropTypeUtil: PropTypeUtil<TOptionKey, number | null>;
19
+ onOptionChangeCallback?: (newValue: number | null) => void;
20
+ onTextChangeCallback?: (newValue: string | null) => void;
30
21
  allowCustomValues?: boolean;
31
22
  placeholder?: string;
32
- propType?: typeof urlPropTypeUtil | typeof stringPropTypeUtil;
33
23
  minInputLength?: number;
24
+ customValue?: TCustomKey;
34
25
  };
35
- declare const AutocompleteControl: ControlComponent<({ options, placeholder, allowCustomValues, propType, minInputLength, }: Props$6) => React.JSX.Element>;
26
+ declare const AutocompleteControl: ControlComponent<(<TOptionKey extends string, TCustomKey extends string>(props: Props$6<TOptionKey, TCustomKey>) => React.JSX.Element)>;
27
+
28
+ type ImageControlProps = {
29
+ sizes: {
30
+ label: string;
31
+ value: string;
32
+ }[];
33
+ resolutionLabel?: string;
34
+ };
35
+ declare const ImageControl: ControlComponent<({ sizes, resolutionLabel }: ImageControlProps) => React.JSX.Element>;
36
36
 
37
37
  declare const TextControl: ControlComponent<({ placeholder }: {
38
38
  placeholder?: string;
@@ -138,22 +138,34 @@ declare const UrlControl: ControlComponent<({ placeholder }: {
138
138
  }) => React.JSX.Element>;
139
139
 
140
140
  type Props = {
141
- options?: Record<string, Option> | Record<string, GroupedOption>;
141
+ queryOptions: {
142
+ requestParams: object;
143
+ endpoint: string;
144
+ };
142
145
  allowCustomValues?: boolean;
146
+ minInputLength?: number;
143
147
  placeholder?: string;
144
148
  };
145
- declare const LinkControl: ControlComponent<(props?: Props) => React.JSX.Element>;
149
+ declare const LinkControl: ControlComponent<(props: Props) => React.JSX.Element>;
146
150
 
147
151
  declare const GapControl: ControlComponent<({ label }: {
148
152
  label: string;
149
153
  }) => React.JSX.Element>;
150
154
 
155
+ declare const SvgMediaControl: ControlComponent<() => React.JSX.Element>;
156
+
151
157
  declare const BackgroundControl: ControlComponent<() => React.JSX.Element>;
152
158
 
153
159
  declare const ControlLabel: ({ children }: {
154
160
  children: React.ReactNode;
155
161
  }) => React.JSX.Element;
156
162
 
163
+ type AnyComponentType = ComponentType<any>;
164
+ declare const brandSymbol: unique symbol;
165
+ type ControlComponent<TComponent extends AnyComponentType = AnyComponentType> = TComponent & {
166
+ [brandSymbol]: true;
167
+ };
168
+
157
169
  type ControlActionsItems = Array<{
158
170
  id: string;
159
171
  MenuItem: React.ComponentType;
@@ -221,4 +233,4 @@ type UseInternalStateOptions<TValue> = {
221
233
  };
222
234
  declare const useSyncExternalState: <TValue>({ external, setExternal, persistWhen, fallback, }: UseInternalStateOptions<TValue>) => readonly [TValue, (setter: ((value: TValue) => TValue) | TValue) => void];
223
235
 
224
- export { AutocompleteControl, BackgroundControl, BoxShadowRepeaterControl, ColorControl, type ControlActionsItems, ControlActionsProvider, type ControlComponent, ControlLabel, ControlReplacementProvider, ControlToggleButtonGroup, type EqualUnequalItems, EqualUnequalSizesControl, FontFamilyControl, GapControl, ImageControl, LinkControl, LinkedDimensionsControl, NumberControl, PropKeyProvider, PropProvider, type PropProviderProps, SelectControl, type SetValue, SizeControl, StrokeControl, TextAreaControl, TextControl, type ToggleButtonGroupItem, ToggleControl, UrlControl, createControlReplacement, useBoundProp, useControlActions, useSyncExternalState };
236
+ export { AutocompleteControl, BackgroundControl, BoxShadowRepeaterControl, ColorControl, type ControlActionsItems, ControlActionsProvider, type ControlComponent, ControlLabel, ControlReplacementProvider, ControlToggleButtonGroup, type EqualUnequalItems, EqualUnequalSizesControl, FontFamilyControl, GapControl, ImageControl, LinkControl, LinkedDimensionsControl, NumberControl, PropKeyProvider, PropProvider, type PropProviderProps, SelectControl, type SetValue, SizeControl, StrokeControl, SvgMediaControl, TextAreaControl, TextControl, type ToggleButtonGroupItem, ToggleControl, UrlControl, createControlReplacement, useBoundProp, useControlActions, useSyncExternalState };
package/dist/index.d.ts CHANGED
@@ -1,38 +1,38 @@
1
1
  import * as React from 'react';
2
- import { ComponentType, ReactNode, PropsWithChildren } from 'react';
3
- import { urlPropTypeUtil, stringPropTypeUtil, StringPropValue, PropTypeUtil, PropValue, PropKey, SizePropValue, CreateOptions, PropType } from '@elementor/editor-props';
2
+ import { ReactNode, ComponentType, PropsWithChildren } from 'react';
3
+ import { PropTypeUtil, StringPropValue, PropValue, PropKey, SizePropValue, PropType, CreateOptions } from '@elementor/editor-props';
4
4
  import { UnstableColorFieldProps, ToggleButtonProps, StackProps } from '@elementor/ui';
5
5
 
6
- type AnyComponentType = ComponentType<any>;
7
- declare const brandSymbol: unique symbol;
8
- type ControlComponent<TComponent extends AnyComponentType = AnyComponentType> = TComponent & {
9
- [brandSymbol]: true;
10
- };
11
-
12
- type ImageControlProps = {
13
- sizes: {
14
- label: string;
15
- value: string;
16
- }[];
17
- };
18
- declare const ImageControl: ControlComponent<(props: ImageControlProps) => React.JSX.Element>;
19
-
20
- type Option = {
6
+ type FlatOption = {
7
+ id: string;
21
8
  label: string;
22
9
  groupLabel?: never;
23
10
  };
24
- type GroupedOption = {
11
+ type CategorizedOption = {
12
+ id: string;
25
13
  label: string;
26
14
  groupLabel: string;
27
15
  };
28
- type Props$6 = {
29
- options: Record<string, Option> | Record<string, GroupedOption>;
16
+ type Props$6<TOptionKey extends string, TCustomKey extends string = ''> = {
17
+ options: FlatOption[] | CategorizedOption[];
18
+ optionRestrictedPropTypeUtil: PropTypeUtil<TOptionKey, number | null>;
19
+ onOptionChangeCallback?: (newValue: number | null) => void;
20
+ onTextChangeCallback?: (newValue: string | null) => void;
30
21
  allowCustomValues?: boolean;
31
22
  placeholder?: string;
32
- propType?: typeof urlPropTypeUtil | typeof stringPropTypeUtil;
33
23
  minInputLength?: number;
24
+ customValue?: TCustomKey;
34
25
  };
35
- declare const AutocompleteControl: ControlComponent<({ options, placeholder, allowCustomValues, propType, minInputLength, }: Props$6) => React.JSX.Element>;
26
+ declare const AutocompleteControl: ControlComponent<(<TOptionKey extends string, TCustomKey extends string>(props: Props$6<TOptionKey, TCustomKey>) => React.JSX.Element)>;
27
+
28
+ type ImageControlProps = {
29
+ sizes: {
30
+ label: string;
31
+ value: string;
32
+ }[];
33
+ resolutionLabel?: string;
34
+ };
35
+ declare const ImageControl: ControlComponent<({ sizes, resolutionLabel }: ImageControlProps) => React.JSX.Element>;
36
36
 
37
37
  declare const TextControl: ControlComponent<({ placeholder }: {
38
38
  placeholder?: string;
@@ -138,22 +138,34 @@ declare const UrlControl: ControlComponent<({ placeholder }: {
138
138
  }) => React.JSX.Element>;
139
139
 
140
140
  type Props = {
141
- options?: Record<string, Option> | Record<string, GroupedOption>;
141
+ queryOptions: {
142
+ requestParams: object;
143
+ endpoint: string;
144
+ };
142
145
  allowCustomValues?: boolean;
146
+ minInputLength?: number;
143
147
  placeholder?: string;
144
148
  };
145
- declare const LinkControl: ControlComponent<(props?: Props) => React.JSX.Element>;
149
+ declare const LinkControl: ControlComponent<(props: Props) => React.JSX.Element>;
146
150
 
147
151
  declare const GapControl: ControlComponent<({ label }: {
148
152
  label: string;
149
153
  }) => React.JSX.Element>;
150
154
 
155
+ declare const SvgMediaControl: ControlComponent<() => React.JSX.Element>;
156
+
151
157
  declare const BackgroundControl: ControlComponent<() => React.JSX.Element>;
152
158
 
153
159
  declare const ControlLabel: ({ children }: {
154
160
  children: React.ReactNode;
155
161
  }) => React.JSX.Element;
156
162
 
163
+ type AnyComponentType = ComponentType<any>;
164
+ declare const brandSymbol: unique symbol;
165
+ type ControlComponent<TComponent extends AnyComponentType = AnyComponentType> = TComponent & {
166
+ [brandSymbol]: true;
167
+ };
168
+
157
169
  type ControlActionsItems = Array<{
158
170
  id: string;
159
171
  MenuItem: React.ComponentType;
@@ -221,4 +233,4 @@ type UseInternalStateOptions<TValue> = {
221
233
  };
222
234
  declare const useSyncExternalState: <TValue>({ external, setExternal, persistWhen, fallback, }: UseInternalStateOptions<TValue>) => readonly [TValue, (setter: ((value: TValue) => TValue) | TValue) => void];
223
235
 
224
- export { AutocompleteControl, BackgroundControl, BoxShadowRepeaterControl, ColorControl, type ControlActionsItems, ControlActionsProvider, type ControlComponent, ControlLabel, ControlReplacementProvider, ControlToggleButtonGroup, type EqualUnequalItems, EqualUnequalSizesControl, FontFamilyControl, GapControl, ImageControl, LinkControl, LinkedDimensionsControl, NumberControl, PropKeyProvider, PropProvider, type PropProviderProps, SelectControl, type SetValue, SizeControl, StrokeControl, TextAreaControl, TextControl, type ToggleButtonGroupItem, ToggleControl, UrlControl, createControlReplacement, useBoundProp, useControlActions, useSyncExternalState };
236
+ export { AutocompleteControl, BackgroundControl, BoxShadowRepeaterControl, ColorControl, type ControlActionsItems, ControlActionsProvider, type ControlComponent, ControlLabel, ControlReplacementProvider, ControlToggleButtonGroup, type EqualUnequalItems, EqualUnequalSizesControl, FontFamilyControl, GapControl, ImageControl, LinkControl, LinkedDimensionsControl, NumberControl, PropKeyProvider, PropProvider, type PropProviderProps, SelectControl, type SetValue, SizeControl, StrokeControl, SvgMediaControl, TextAreaControl, TextControl, type ToggleButtonGroupItem, ToggleControl, UrlControl, createControlReplacement, useBoundProp, useControlActions, useSyncExternalState };