@elementor/editor-editing-panel 0.17.0 → 0.19.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 (81) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/dist/index.d.mts +28 -10
  3. package/dist/index.d.ts +28 -10
  4. package/dist/index.js +941 -398
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.mjs +918 -366
  7. package/dist/index.mjs.map +1 -1
  8. package/package.json +8 -7
  9. package/src/components/editing-panel-error-fallback.tsx +12 -0
  10. package/src/components/editing-panel.tsx +23 -12
  11. package/src/components/settings-tab.tsx +8 -5
  12. package/src/components/style-sections/background-section/background-color-control.tsx +20 -0
  13. package/src/components/style-sections/background-section/background-section.tsx +15 -0
  14. package/src/components/style-sections/effects-section/box-shadow-repeater.tsx +224 -0
  15. package/src/components/style-sections/effects-section/effects-section.tsx +18 -0
  16. package/src/components/style-sections/position-section/z-index-control.tsx +11 -7
  17. package/src/components/style-sections/size-section.tsx +23 -20
  18. package/src/components/style-sections/spacing-section/linked-dimensions-control.tsx +62 -47
  19. package/src/components/style-sections/typography-section/font-size-control.tsx +10 -6
  20. package/src/components/style-sections/typography-section/font-weight-control.tsx +16 -12
  21. package/src/components/style-sections/typography-section/letter-spacing-control.tsx +10 -6
  22. package/src/components/style-sections/typography-section/text-alignment-control.tsx +12 -8
  23. package/src/components/style-sections/typography-section/text-color-control.tsx +10 -6
  24. package/src/components/style-sections/typography-section/text-direction-control.tsx +37 -0
  25. package/src/components/style-sections/typography-section/text-style-control.tsx +37 -34
  26. package/src/components/style-sections/typography-section/transform-control.tsx +14 -12
  27. package/src/components/style-sections/typography-section/typography-section.tsx +2 -0
  28. package/src/components/style-sections/typography-section/word-spacing-control.tsx +10 -6
  29. package/src/components/style-tab.tsx +10 -4
  30. package/src/control-replacement.tsx +3 -0
  31. package/src/controls/components/control-type-container.tsx +28 -0
  32. package/src/controls/components/repeater.tsx +197 -0
  33. package/src/controls/components/text-field-inner-selection.tsx +2 -2
  34. package/src/controls/control-actions/actions/popover-action.tsx +58 -0
  35. package/src/controls/control-actions/control-actions-menu.ts +8 -0
  36. package/src/controls/control-actions/control-actions.tsx +43 -0
  37. package/src/controls/control-context.tsx +1 -1
  38. package/src/controls/control-replacement.ts +16 -8
  39. package/src/controls/control-types/color-control.tsx +21 -18
  40. package/src/controls/control-types/image-control.tsx +56 -59
  41. package/src/controls/control-types/image-media-control.tsx +73 -0
  42. package/src/controls/control-types/number-control.tsx +13 -9
  43. package/src/controls/control-types/select-control.tsx +14 -10
  44. package/src/controls/control-types/size-control.tsx +18 -14
  45. package/src/controls/control-types/text-area-control.tsx +15 -11
  46. package/src/controls/control-types/text-control.tsx +9 -3
  47. package/src/controls/control-types/toggle-control.tsx +4 -3
  48. package/src/controls/control.tsx +1 -7
  49. package/src/controls/controls-registry.tsx +19 -10
  50. package/src/controls/create-control-replacement.tsx +53 -0
  51. package/src/controls/create-control.tsx +40 -0
  52. package/src/controls/hooks/use-style-control.ts +3 -3
  53. package/src/{hooks → controls/hooks}/use-widget-settings.ts +1 -1
  54. package/src/{props → controls/props}/is-transformable.ts +1 -2
  55. package/src/controls/props/types.ts +51 -0
  56. package/src/{contexts/element-context.tsx → controls/providers/element-provider.tsx} +4 -4
  57. package/src/controls/settings-control.tsx +7 -14
  58. package/src/controls/style-control.tsx +1 -1
  59. package/src/{sync → controls/sync}/get-container.ts +1 -1
  60. package/src/{sync → controls/sync}/update-settings.ts +1 -1
  61. package/src/controls/types.ts +39 -0
  62. package/src/dynamics/components/dynamic-selection-control.tsx +2 -2
  63. package/src/dynamics/components/dynamic-selection.tsx +6 -6
  64. package/src/dynamics/dynamic-control.tsx +2 -2
  65. package/src/dynamics/hooks/use-dynamic-tag.ts +2 -2
  66. package/src/dynamics/hooks/use-prop-dynamic-action.tsx +23 -0
  67. package/src/dynamics/hooks/use-prop-dynamic-tags.ts +7 -7
  68. package/src/dynamics/hooks/use-prop-value-history.ts +3 -3
  69. package/src/dynamics/init.ts +10 -1
  70. package/src/dynamics/types.ts +7 -3
  71. package/src/dynamics/utils.ts +17 -4
  72. package/src/hooks/use-element-style-prop.ts +3 -2
  73. package/src/hooks/use-element-styles.ts +1 -1
  74. package/src/hooks/use-element-type.ts +1 -1
  75. package/src/index.ts +3 -1
  76. package/src/sync/get-element-styles.ts +2 -2
  77. package/src/sync/get-selected-elements.ts +1 -1
  78. package/src/sync/types.ts +2 -1
  79. package/src/sync/update-style.ts +3 -2
  80. package/src/controls/components/control-container.tsx +0 -18
  81. package/src/types.ts +0 -68
package/CHANGELOG.md CHANGED
@@ -1,5 +1,50 @@
1
1
  # Change Log
2
2
 
3
+ ## 0.19.0
4
+
5
+ ### Minor Changes
6
+
7
+ - e5a2a79: Add error handling
8
+ - 08bc1c0: Moved the element provider and types into controls
9
+ - d68e4df: Add background section with background-color control
10
+
11
+ ### Patch Changes
12
+
13
+ - a4b1789: Add `CreateControlReplacement` util
14
+ - b9d3b21: Fix typography section controls alignment
15
+
16
+ ## 0.18.0
17
+
18
+ ### Minor Changes
19
+
20
+ - c1f4bcb: Added `TextDirectionControl`
21
+ - 1206fbd: Added support for inner props in `ImageControl`
22
+ - 8bbc145: Update `@elementor/icons` version
23
+ - b7dca9f: Update `@elementor/icons` version
24
+ - aa24b6f: Render settings control layout by type
25
+ - 701fc35: Updated color picker version
26
+ - 4d27f27: Added controls repeater, and box shadow control.
27
+ - 9a77872: adding control floating bar
28
+ - 28620a5: added registration of dynamic tag item to control actions
29
+ - d1b6297: Use Grid components to render style controls layout.
30
+
31
+ ### Patch Changes
32
+
33
+ - 97e6534: Changed bind name format and added color prop type
34
+ - 68e3a30: apply control replacement on the control component
35
+
36
+ create a function to wrap each control to allow general solutions for each control
37
+
38
+ - 20e9aeb: Adjusting `prop-types` to fit the new structure
39
+ - 8a50411: change linked dimensions control default value
40
+ - Updated dependencies [1206fbd]
41
+ - Updated dependencies [97e6534]
42
+ - Updated dependencies [701fc35]
43
+ - @elementor/wp-media@0.2.0
44
+ - @elementor/editor-style@0.4.1
45
+ - @elementor/editor-panels@0.8.0
46
+ - @elementor/editor@0.15.0
47
+
3
48
  ## 0.17.0
4
49
 
5
50
  ### Minor Changes
package/dist/index.d.mts CHANGED
@@ -1,30 +1,48 @@
1
- import * as react from 'react';
1
+ import * as React from 'react';
2
+ import { ElementType, ComponentType } from 'react';
3
+ import * as _elementor_menus from '@elementor/menus';
4
+
5
+ type PopoverActionProps = {
6
+ title: string;
7
+ visible?: boolean;
8
+ icon: ElementType;
9
+ popoverContent: ComponentType<{
10
+ closePopover: () => void;
11
+ }>;
12
+ };
13
+ declare function PopoverAction({ title, visible, icon: Icon, popoverContent: PopoverContent, }: PopoverActionProps): React.JSX.Element | null;
2
14
 
3
15
  type MaybeArray<T> = T | T[];
4
- type TransformablePropValue<T = unknown> = {
5
- $$type: string;
6
- value: T;
16
+ type TransformablePropValue<Type extends string, Value = unknown> = {
17
+ $$type: Type;
18
+ value: Value;
19
+ disabled?: boolean;
7
20
  };
8
21
  type PlainPropValue = MaybeArray<string | number | boolean | object | null | undefined>;
9
- type PropValue = PlainPropValue | TransformablePropValue;
22
+ type PropValue = PlainPropValue | TransformablePropValue<string>;
10
23
  type PropKey = string;
11
24
 
12
25
  type ReplaceWhenParams = {
13
26
  value: PropValue;
14
27
  };
15
- type ControlReplacement = {
16
- component: React.ComponentType;
28
+ type CreateControlReplacement = {
29
+ component: ComponentType;
17
30
  condition: ({ value }: ReplaceWhenParams) => boolean;
18
31
  };
19
- declare const replaceControl: ({ component, condition }: ControlReplacement) => void;
32
+
33
+ declare const replaceControl: ({ component, condition }: CreateControlReplacement) => void;
20
34
 
21
35
  type ControlContext<T extends PropValue> = {
22
36
  bind: PropKey;
23
37
  setValue: (value: T | undefined) => void;
24
38
  value: T | undefined;
25
39
  };
26
- declare const ControlContext: react.Context<ControlContext<PropValue> | null>;
40
+ declare const ControlContext: React.Context<ControlContext<PropValue> | null>;
27
41
  declare function useControl<T extends PropValue>(): ControlContext<T | undefined>;
28
42
  declare function useControl<T extends PropValue>(defaultValue: T): ControlContext<T>;
29
43
 
30
- export { replaceControl, useControl };
44
+ declare const controlActionsMenu: _elementor_menus.Menu<{
45
+ PopoverAction: typeof PopoverAction;
46
+ }, "default">;
47
+
48
+ export { type PopoverActionProps, controlActionsMenu, replaceControl, useControl };
package/dist/index.d.ts CHANGED
@@ -1,30 +1,48 @@
1
- import * as react from 'react';
1
+ import * as React from 'react';
2
+ import { ElementType, ComponentType } from 'react';
3
+ import * as _elementor_menus from '@elementor/menus';
4
+
5
+ type PopoverActionProps = {
6
+ title: string;
7
+ visible?: boolean;
8
+ icon: ElementType;
9
+ popoverContent: ComponentType<{
10
+ closePopover: () => void;
11
+ }>;
12
+ };
13
+ declare function PopoverAction({ title, visible, icon: Icon, popoverContent: PopoverContent, }: PopoverActionProps): React.JSX.Element | null;
2
14
 
3
15
  type MaybeArray<T> = T | T[];
4
- type TransformablePropValue<T = unknown> = {
5
- $$type: string;
6
- value: T;
16
+ type TransformablePropValue<Type extends string, Value = unknown> = {
17
+ $$type: Type;
18
+ value: Value;
19
+ disabled?: boolean;
7
20
  };
8
21
  type PlainPropValue = MaybeArray<string | number | boolean | object | null | undefined>;
9
- type PropValue = PlainPropValue | TransformablePropValue;
22
+ type PropValue = PlainPropValue | TransformablePropValue<string>;
10
23
  type PropKey = string;
11
24
 
12
25
  type ReplaceWhenParams = {
13
26
  value: PropValue;
14
27
  };
15
- type ControlReplacement = {
16
- component: React.ComponentType;
28
+ type CreateControlReplacement = {
29
+ component: ComponentType;
17
30
  condition: ({ value }: ReplaceWhenParams) => boolean;
18
31
  };
19
- declare const replaceControl: ({ component, condition }: ControlReplacement) => void;
32
+
33
+ declare const replaceControl: ({ component, condition }: CreateControlReplacement) => void;
20
34
 
21
35
  type ControlContext<T extends PropValue> = {
22
36
  bind: PropKey;
23
37
  setValue: (value: T | undefined) => void;
24
38
  value: T | undefined;
25
39
  };
26
- declare const ControlContext: react.Context<ControlContext<PropValue> | null>;
40
+ declare const ControlContext: React.Context<ControlContext<PropValue> | null>;
27
41
  declare function useControl<T extends PropValue>(): ControlContext<T | undefined>;
28
42
  declare function useControl<T extends PropValue>(defaultValue: T): ControlContext<T>;
29
43
 
30
- export { replaceControl, useControl };
44
+ declare const controlActionsMenu: _elementor_menus.Menu<{
45
+ PopoverAction: typeof PopoverAction;
46
+ }, "default">;
47
+
48
+ export { type PopoverActionProps, controlActionsMenu, replaceControl, useControl };