@elementor/editor-controls 0.8.0 → 0.9.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 (30) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/dist/index.d.mts +37 -25
  3. package/dist/index.d.ts +37 -25
  4. package/dist/index.js +558 -274
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.mjs +529 -239
  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 +107 -33
  20. package/src/controls/box-shadow-repeater-control.tsx +1 -1
  21. package/src/controls/image-control.tsx +26 -22
  22. package/src/controls/image-media-control.tsx +1 -1
  23. package/src/controls/link-control.tsx +134 -17
  24. package/src/controls/size-control.tsx +1 -1
  25. package/src/controls/stroke-control.tsx +1 -1
  26. package/src/controls/svg-media-control.tsx +107 -0
  27. package/src/create-control-replacement.tsx +2 -2
  28. package/src/env.ts +5 -0
  29. package/src/index.ts +2 -1
  30. package/src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-resolution.tsx +0 -27
package/CHANGELOG.md CHANGED
@@ -1,5 +1,43 @@
1
1
  # @elementor/editor-controls
2
2
 
3
+ ## 0.9.0
4
+
5
+ ### Minor Changes
6
+
7
+ - c9133d7: Add background image overlay custom size
8
+ - 86863c1: Changed link control to use query instead of autocomplete
9
+ - 910044c: update `@elementor/icons` and `@elementor/ui` packages.
10
+ - 9a41a86: Added condition to hide select control for tag bind when link is enabled
11
+ - 9de8ba7: Updated icon in background repeater image overlay size control
12
+ - 0953b40: Background image overlay resolution canvas connection
13
+ - 6680c92: added svg widget
14
+ - 15c964f: Add background image overlay custom position
15
+ - 5caf78d: update `@elementor/ui` package.
16
+ - 625448d: Added tests for background image overlay
17
+ - c162e6c: Update '@elementor/icons' version
18
+ - d39b70b: Add a new repeater item to top by default.
19
+ - 9cc8def: Updated image upload control text
20
+ - fbf6203: Added select button for SVG control and updated component style
21
+ - ceb1211: remove extra padding from popover header
22
+
23
+ ### Patch Changes
24
+
25
+ - 9fd9bae: align background image overlay repeat and attachment controls.
26
+ - da38fa9: Remove unused exports and add missing dependencies.
27
+ - 35f9714: Add default background image to background overlay repeater
28
+ - 2bf6b34: fix, add file type to the image name in the background overlay
29
+ - b4a6ac6: refactor the call to editor controls env, to avoid parsing env before it's initialized
30
+ - e76d970: Added SVG upload text
31
+ - baee3f3: Adjust gap
32
+ - Updated dependencies [c9133d7]
33
+ - Updated dependencies [86863c1]
34
+ - Updated dependencies [da38fa9]
35
+ - Updated dependencies [9ca4eab]
36
+ - Updated dependencies [15c964f]
37
+ - @elementor/editor-props@0.9.0
38
+ - @elementor/utils@0.3.1
39
+ - @elementor/wp-media@0.4.1
40
+
3
41
  ## 0.8.0
4
42
 
5
43
  ### 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 };