@elementor/editor-editing-panel 0.19.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.
Files changed (139) hide show
  1. package/CHANGELOG.md +97 -0
  2. package/dist/index.d.mts +10 -36
  3. package/dist/index.d.ts +10 -36
  4. package/dist/index.js +1256 -1445
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.mjs +1311 -1482
  7. package/dist/index.mjs.map +1 -1
  8. package/package.json +15 -14
  9. package/src/components/add-or-remove-content.tsx +42 -0
  10. package/src/components/collapse-icon.tsx +12 -0
  11. package/src/components/collapsible-content.tsx +5 -14
  12. package/src/components/collapsible-field.tsx +36 -0
  13. package/src/components/css-class-selector-section.tsx +76 -0
  14. package/src/components/editing-panel-hooks.tsx +2 -0
  15. package/src/components/editing-panel-tabs.tsx +23 -13
  16. package/src/components/editing-panel.tsx +21 -21
  17. package/src/components/multi-combobox/index.ts +3 -0
  18. package/src/components/multi-combobox/multi-combobox.tsx +120 -0
  19. package/src/components/multi-combobox/types.ts +26 -0
  20. package/src/components/multi-combobox/use-combobox-actions.ts +62 -0
  21. package/src/components/section.tsx +37 -0
  22. package/src/components/sections-list.tsx +6 -0
  23. package/src/components/settings-tab.tsx +17 -16
  24. package/src/components/style-sections/background-section/background-color-field.tsx +21 -0
  25. package/src/components/style-sections/background-section/background-section.tsx +10 -8
  26. package/src/components/style-sections/border-section/border-color-field.tsx +21 -0
  27. package/src/components/style-sections/border-section/border-field.tsx +48 -0
  28. package/src/components/style-sections/border-section/border-radius-field.tsx +49 -0
  29. package/src/components/style-sections/border-section/border-section.tsx +13 -0
  30. package/src/components/style-sections/border-section/border-style-field.tsx +32 -0
  31. package/src/components/style-sections/border-section/border-width-field.tsx +43 -0
  32. package/src/components/style-sections/effects-section/effects-section.tsx +8 -11
  33. package/src/components/style-sections/layout-section/display-field.tsx +32 -0
  34. package/src/components/style-sections/layout-section/justify-content-field.tsx +82 -0
  35. package/src/components/style-sections/layout-section/layout-section.tsx +17 -0
  36. package/src/components/style-sections/layout-section/utils/rotate-flex-icon.ts +12 -0
  37. package/src/components/style-sections/position-section/dimensions-field.tsx +46 -0
  38. package/src/components/style-sections/position-section/position-field.tsx +28 -0
  39. package/src/components/style-sections/position-section/position-section.tsx +51 -8
  40. package/src/components/style-sections/position-section/z-index-field.tsx +21 -0
  41. package/src/components/style-sections/size-section/overflow-field.tsx +45 -0
  42. package/src/components/style-sections/size-section/size-section.tsx +62 -0
  43. package/src/components/style-sections/spacing-section/spacing-section.tsx +12 -14
  44. package/src/components/style-sections/typography-section/font-family-field.tsx +40 -0
  45. package/src/components/style-sections/typography-section/font-size-field.tsx +21 -0
  46. package/src/components/style-sections/typography-section/{font-weight-control.tsx → font-weight-field.tsx} +9 -8
  47. package/src/components/style-sections/typography-section/letter-spacing-field.tsx +21 -0
  48. package/src/components/style-sections/typography-section/text-alignment-field.tsx +47 -0
  49. package/src/components/style-sections/typography-section/text-color-field.tsx +21 -0
  50. package/src/components/style-sections/typography-section/{text-direction-control.tsx → text-direction-field.tsx} +12 -12
  51. package/src/components/style-sections/typography-section/text-stroke-field.tsx +16 -0
  52. package/src/components/style-sections/typography-section/{text-style-control.tsx → text-style-field.tsx} +9 -8
  53. package/src/components/style-sections/typography-section/transform-field.tsx +40 -0
  54. package/src/components/style-sections/typography-section/typography-section.tsx +31 -30
  55. package/src/components/style-sections/typography-section/word-spacing-field.tsx +21 -0
  56. package/src/components/style-tab.tsx +82 -29
  57. package/src/contexts/classes-prop-context.tsx +24 -0
  58. package/src/{controls/providers/element-provider.tsx → contexts/element-context.tsx} +3 -7
  59. package/src/contexts/style-context.tsx +10 -23
  60. package/src/control-replacement.tsx +1 -1
  61. package/src/{controls/control-actions/control-actions-menu.ts → controls-actions.ts} +2 -1
  62. package/src/{controls/components → controls-registry}/control-type-container.tsx +3 -2
  63. package/src/{controls → controls-registry}/control.tsx +2 -1
  64. package/src/{controls → controls-registry}/controls-registry.tsx +8 -6
  65. package/src/controls-registry/settings-field.tsx +36 -0
  66. package/src/controls-registry/styles-field.tsx +20 -0
  67. package/src/dynamics/components/dynamic-selection-control.tsx +18 -17
  68. package/src/dynamics/components/dynamic-selection.tsx +10 -9
  69. package/src/dynamics/dynamic-control.tsx +7 -6
  70. package/src/dynamics/hooks/use-dynamic-tag.ts +3 -2
  71. package/src/dynamics/hooks/use-prop-dynamic-action.tsx +7 -6
  72. package/src/dynamics/hooks/use-prop-dynamic-tags.ts +3 -2
  73. package/src/dynamics/init.ts +3 -3
  74. package/src/dynamics/sync/get-elementor-config.ts +1 -1
  75. package/src/dynamics/types.ts +2 -2
  76. package/src/dynamics/utils.ts +3 -3
  77. package/src/hooks/use-close-editor-panel.ts +23 -0
  78. package/src/hooks/use-direction.ts +13 -0
  79. package/src/hooks/use-open-editor-panel.ts +4 -3
  80. package/src/hooks/use-prop-value-history.ts +45 -0
  81. package/src/hooks/use-style-prop-history.ts +75 -0
  82. package/src/hooks/use-styles-field.ts +51 -0
  83. package/src/index.ts +2 -3
  84. package/src/init.ts +5 -4
  85. package/src/panel.ts +1 -0
  86. package/src/{controls/control-actions/actions/popover-action.tsx → popover-action.tsx} +2 -2
  87. package/src/sync/enqueue-font.ts +7 -0
  88. package/src/sync/get-elementor-config.ts +7 -0
  89. package/src/sync/{should-use-v2-panel.ts → is-atomic-widget-selected.ts} +2 -3
  90. package/src/sync/types.ts +20 -21
  91. package/src/components/accordion-section.tsx +0 -25
  92. package/src/components/control-label.tsx +0 -10
  93. package/src/components/style-sections/background-section/background-color-control.tsx +0 -20
  94. package/src/components/style-sections/effects-section/box-shadow-repeater.tsx +0 -224
  95. package/src/components/style-sections/position-section/z-index-control.tsx +0 -20
  96. package/src/components/style-sections/size-section.tsx +0 -49
  97. package/src/components/style-sections/spacing-section/linked-dimensions-control.tsx +0 -155
  98. package/src/components/style-sections/typography-section/font-size-control.tsx +0 -20
  99. package/src/components/style-sections/typography-section/letter-spacing-control.tsx +0 -20
  100. package/src/components/style-sections/typography-section/text-alignment-control.tsx +0 -47
  101. package/src/components/style-sections/typography-section/text-color-control.tsx +0 -20
  102. package/src/components/style-sections/typography-section/transform-control.tsx +0 -25
  103. package/src/components/style-sections/typography-section/word-spacing-control.tsx +0 -20
  104. package/src/controls/components/control-toggle-button-group.tsx +0 -59
  105. package/src/controls/components/repeater.tsx +0 -197
  106. package/src/controls/components/text-field-inner-selection.tsx +0 -79
  107. package/src/controls/control-actions/control-actions.tsx +0 -43
  108. package/src/controls/control-context.tsx +0 -22
  109. package/src/controls/control-replacement.ts +0 -34
  110. package/src/controls/control-types/color-control.tsx +0 -27
  111. package/src/controls/control-types/image-control.tsx +0 -66
  112. package/src/controls/control-types/image-media-control.tsx +0 -73
  113. package/src/controls/control-types/number-control.tsx +0 -29
  114. package/src/controls/control-types/select-control.tsx +0 -30
  115. package/src/controls/control-types/size-control.tsx +0 -71
  116. package/src/controls/control-types/text-area-control.tsx +0 -31
  117. package/src/controls/control-types/text-control.tsx +0 -17
  118. package/src/controls/control-types/toggle-control.tsx +0 -26
  119. package/src/controls/create-control-replacement.tsx +0 -53
  120. package/src/controls/create-control.tsx +0 -40
  121. package/src/controls/hooks/use-style-control.ts +0 -29
  122. package/src/controls/hooks/use-sync-external-state.tsx +0 -51
  123. package/src/controls/hooks/use-widget-settings.ts +0 -16
  124. package/src/controls/props/is-transformable.ts +0 -13
  125. package/src/controls/props/types.ts +0 -51
  126. package/src/controls/settings-control.tsx +0 -37
  127. package/src/controls/style-control.tsx +0 -20
  128. package/src/controls/sync/get-container.ts +0 -8
  129. package/src/controls/sync/update-settings.ts +0 -14
  130. package/src/controls/types.ts +0 -39
  131. package/src/dynamics/hooks/use-prop-value-history.ts +0 -26
  132. package/src/hooks/use-element-style-prop.ts +0 -46
  133. package/src/hooks/use-element-styles.ts +0 -13
  134. package/src/hooks/use-element-type.ts +0 -33
  135. package/src/hooks/use-selected-elements.ts +0 -9
  136. package/src/sync/get-element-styles.ts +0 -9
  137. package/src/sync/get-selected-elements.ts +0 -21
  138. package/src/sync/get-widgets-cache.ts +0 -7
  139. package/src/sync/update-style.ts +0 -25
package/dist/index.js CHANGED
@@ -30,65 +30,60 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/index.ts
31
31
  var src_exports = {};
32
32
  __export(src_exports, {
33
- controlActionsMenu: () => controlActionsMenu,
34
33
  replaceControl: () => replaceControl,
35
- useControl: () => useControl
34
+ useBoundProp: () => import_editor_controls38.useBoundProp
36
35
  });
37
36
  module.exports = __toCommonJS(src_exports);
37
+ var import_editor_controls38 = require("@elementor/editor-controls");
38
38
 
39
- // src/controls/create-control-replacement.tsx
40
- var React = __toESM(require("react"));
41
- var import_react2 = require("react");
39
+ // src/control-replacement.tsx
40
+ var import_editor_controls = require("@elementor/editor-controls");
41
+ var { replaceControl, getControlReplacement } = (0, import_editor_controls.createControlReplacement)();
42
+
43
+ // src/init.ts
44
+ var import_editor = require("@elementor/editor");
45
+ var import_editor_panels3 = require("@elementor/editor-panels");
46
+ var import_editor_v1_adapters3 = require("@elementor/editor-v1-adapters");
47
+
48
+ // src/hooks/use-close-editor-panel.ts
49
+ var import_react14 = require("react");
50
+ var import_editor_elements8 = require("@elementor/editor-elements");
51
+ var import_editor_v1_adapters = require("@elementor/editor-v1-adapters");
52
+
53
+ // src/panel.ts
54
+ var import_editor_panels2 = require("@elementor/editor-panels");
55
+
56
+ // src/components/editing-panel.tsx
57
+ var React51 = __toESM(require("react"));
58
+ var import_editor_controls33 = require("@elementor/editor-controls");
59
+ var import_editor_elements6 = require("@elementor/editor-elements");
60
+ var import_editor_panels = require("@elementor/editor-panels");
61
+ var import_ui43 = require("@elementor/ui");
62
+ var import_i18n31 = require("@wordpress/i18n");
42
63
 
43
- // src/controls/control-context.tsx
64
+ // src/contexts/element-context.tsx
65
+ var React = __toESM(require("react"));
44
66
  var import_react = require("react");
45
- var ControlContext = (0, import_react.createContext)(null);
46
- function useControl(defaultValue) {
47
- const controlContext = (0, import_react.useContext)(ControlContext);
48
- if (!controlContext) {
49
- throw new Error("useControl must be used within a ControlContext");
50
- }
51
- return { ...controlContext, value: controlContext.value ?? defaultValue };
67
+ var Context = (0, import_react.createContext)(null);
68
+ function ElementProvider({ children, element, elementType }) {
69
+ return /* @__PURE__ */ React.createElement(Context.Provider, { value: { element, elementType } }, children);
52
70
  }
53
-
54
- // src/controls/create-control-replacement.tsx
55
- var ControlReplacementContext = (0, import_react2.createContext)(void 0);
56
- var ControlReplacementProvider = ({
57
- component,
58
- condition,
59
- children
60
- }) => {
61
- return /* @__PURE__ */ React.createElement(ControlReplacementContext.Provider, { value: { component, condition } }, children);
62
- };
63
- var useControlReplacement = () => {
64
- const { value } = useControl();
65
- const controlReplacement = (0, import_react2.useContext)(ControlReplacementContext);
66
- let shouldReplace = false;
67
- try {
68
- shouldReplace = !!controlReplacement?.condition({ value }) && !!controlReplacement.component;
69
- } catch {
70
- }
71
- return shouldReplace ? controlReplacement?.component : void 0;
72
- };
73
- var createControlReplacement = () => {
74
- let controlReplacement;
75
- function replaceControl2({ component, condition }) {
76
- controlReplacement = { component, condition };
77
- }
78
- function getControlReplacement2() {
79
- return controlReplacement;
71
+ function useElement() {
72
+ const context = (0, import_react.useContext)(Context);
73
+ if (!context) {
74
+ throw new Error("useElement must be used within a ElementProvider");
80
75
  }
81
- return { replaceControl: replaceControl2, getControlReplacement: getControlReplacement2 };
82
- };
76
+ return context;
77
+ }
83
78
 
84
- // src/control-replacement.tsx
85
- var { replaceControl, getControlReplacement } = createControlReplacement();
79
+ // src/controls-actions.ts
80
+ var import_menus = require("@elementor/menus");
86
81
 
87
- // src/controls/control-actions/actions/popover-action.tsx
82
+ // src/popover-action.tsx
88
83
  var React2 = __toESM(require("react"));
89
- var import_ui = require("@elementor/ui");
90
- var import_react3 = require("react");
84
+ var import_react2 = require("react");
91
85
  var import_icons = require("@elementor/icons");
86
+ var import_ui = require("@elementor/ui");
92
87
  var SIZE = "tiny";
93
88
  function PopoverAction({
94
89
  title,
@@ -96,7 +91,7 @@ function PopoverAction({
96
91
  icon: Icon,
97
92
  popoverContent: PopoverContent
98
93
  }) {
99
- const id = (0, import_react3.useId)();
94
+ const id = (0, import_react2.useId)();
100
95
  const popupState = (0, import_ui.usePopupState)({
101
96
  variant: "popover",
102
97
  popupId: `elementor-popover-action-${id}`
@@ -120,503 +115,47 @@ function PopoverAction({
120
115
  ));
121
116
  }
122
117
 
123
- // src/controls/control-actions/control-actions-menu.ts
124
- var import_menus = require("@elementor/menus");
118
+ // src/controls-actions.ts
125
119
  var controlActionsMenu = (0, import_menus.createMenu)({
126
120
  components: {
127
121
  PopoverAction
128
122
  }
129
123
  });
130
124
 
131
- // src/panel.ts
132
- var import_editor_panels2 = require("@elementor/editor-panels");
133
-
134
- // src/components/editing-panel.tsx
135
- var React49 = __toESM(require("react"));
136
- var import_i18n25 = require("@wordpress/i18n");
137
-
138
- // src/hooks/use-selected-elements.ts
139
- var import_editor_v1_adapters = require("@elementor/editor-v1-adapters");
140
-
141
- // src/sync/get-selected-elements.ts
142
- function getSelectedElements() {
143
- const extendedWindow = window;
144
- const selectedElements = extendedWindow.elementor?.selection?.getElements?.() ?? [];
145
- return selectedElements.reduce((acc, el) => {
146
- const type = el.model.get("widgetType") || el.model.get("elType");
147
- if (type) {
148
- acc.push({
149
- id: el.model.get("id"),
150
- type
151
- });
152
- }
153
- return acc;
154
- }, []);
155
- }
156
-
157
- // src/hooks/use-selected-elements.ts
158
- function useSelectedElements() {
159
- return (0, import_editor_v1_adapters.__privateUseListenTo)(
160
- [(0, import_editor_v1_adapters.commandEndEvent)("document/elements/select"), (0, import_editor_v1_adapters.commandEndEvent)("document/elements/deselect")],
161
- () => getSelectedElements()
162
- );
163
- }
164
-
165
- // src/components/editing-panel.tsx
166
- var import_editor_panels = require("@elementor/editor-panels");
167
-
168
- // src/controls/providers/element-provider.tsx
125
+ // src/components/editing-panel-error-fallback.tsx
169
126
  var React3 = __toESM(require("react"));
170
- var import_react4 = require("react");
171
- var Context = (0, import_react4.createContext)(null);
172
- function ElementProvider({ children, element, elementType }) {
173
- return /* @__PURE__ */ React3.createElement(Context.Provider, { value: { element, elementType } }, children);
174
- }
175
- function useElement() {
176
- const context = (0, import_react4.useContext)(Context);
177
- if (!context) {
178
- throw new Error("useElement must be used within a ElementProvider");
179
- }
180
- return context;
181
- }
182
-
183
- // src/hooks/use-element-type.ts
184
- var import_editor_v1_adapters2 = require("@elementor/editor-v1-adapters");
185
-
186
- // src/sync/get-widgets-cache.ts
187
- function getWidgetsCache() {
188
- const extendedWindow = window;
189
- return extendedWindow?.elementor?.widgetsCache || null;
190
- }
191
-
192
- // src/hooks/use-element-type.ts
193
- function useElementType(type) {
194
- return (0, import_editor_v1_adapters2.__privateUseListenTo)(
195
- (0, import_editor_v1_adapters2.commandEndEvent)("editor/documents/load"),
196
- () => {
197
- if (!type) {
198
- return null;
199
- }
200
- const widgetsCache = getWidgetsCache();
201
- const elementType = widgetsCache?.[type];
202
- if (!elementType?.atomic_controls) {
203
- return null;
204
- }
205
- if (!elementType?.atomic_props_schema) {
206
- return null;
207
- }
208
- return {
209
- key: type,
210
- controls: elementType.atomic_controls,
211
- propsSchema: elementType.atomic_props_schema,
212
- title: elementType.title
213
- };
214
- },
215
- [type]
216
- );
127
+ var import_ui2 = require("@elementor/ui");
128
+ function EditorPanelErrorFallback() {
129
+ return /* @__PURE__ */ React3.createElement(import_ui2.Box, { role: "alert", sx: { minHeight: "100%", p: 2 } }, /* @__PURE__ */ React3.createElement(import_ui2.Alert, { severity: "error", sx: { mb: 2, maxWidth: 400, textAlign: "center" } }, /* @__PURE__ */ React3.createElement("strong", null, "Something went wrong")));
217
130
  }
218
131
 
219
132
  // src/components/editing-panel-tabs.tsx
220
- var import_ui40 = require("@elementor/ui");
221
- var React47 = __toESM(require("react"));
222
- var import_i18n24 = require("@wordpress/i18n");
133
+ var React50 = __toESM(require("react"));
134
+ var import_react13 = require("react");
135
+ var import_ui42 = require("@elementor/ui");
136
+ var import_i18n30 = require("@wordpress/i18n");
223
137
 
224
138
  // src/components/settings-tab.tsx
225
- var React18 = __toESM(require("react"));
226
- var import_ui14 = require("@elementor/ui");
227
-
228
- // src/controls/settings-control.tsx
229
- var React5 = __toESM(require("react"));
230
-
231
- // src/controls/hooks/use-widget-settings.ts
232
- var import_editor_v1_adapters3 = require("@elementor/editor-v1-adapters");
233
-
234
- // src/controls/sync/get-container.ts
235
- function getContainer(id) {
236
- const extendedWindow = window;
237
- const container = extendedWindow.elementor?.getContainer?.(id);
238
- return container ?? null;
239
- }
240
-
241
- // src/controls/hooks/use-widget-settings.ts
242
- var useWidgetSettings = ({ id, bind }) => {
243
- return (0, import_editor_v1_adapters3.__privateUseListenTo)(
244
- (0, import_editor_v1_adapters3.commandEndEvent)("document/elements/settings"),
245
- () => {
246
- const container = getContainer(id);
247
- const value = container?.settings?.get(bind) ?? null;
248
- return value;
249
- },
250
- [id, bind]
251
- );
252
- };
253
-
254
- // src/controls/sync/update-settings.ts
255
- var import_editor_v1_adapters4 = require("@elementor/editor-v1-adapters");
256
- var updateSettings = ({ id, props }) => {
257
- const container = getContainer(id);
258
- (0, import_editor_v1_adapters4.__privateRunCommand)("document/elements/settings", {
259
- container,
260
- settings: {
261
- ...props
262
- }
263
- });
264
- };
139
+ var React9 = __toESM(require("react"));
140
+ var import_editor_controls4 = require("@elementor/editor-controls");
265
141
 
266
- // src/components/control-label.tsx
142
+ // src/controls-registry/control.tsx
267
143
  var React4 = __toESM(require("react"));
268
- var import_ui2 = require("@elementor/ui");
269
- var ControlLabel = ({ children }) => {
270
- return /* @__PURE__ */ React4.createElement(import_ui2.Typography, { component: "label", variant: "caption", color: "text.secondary" }, children);
271
- };
272
-
273
- // src/controls/settings-control.tsx
274
- var SettingsControl = ({ bind, children }) => {
275
- const { element, elementType } = useElement();
276
- const defaultValue = elementType.propsSchema[bind]?.default;
277
- const settingsValue = useWidgetSettings({ id: element.id, bind });
278
- const value = settingsValue ?? defaultValue ?? null;
279
- const setValue = (newValue) => {
280
- updateSettings({
281
- id: element.id,
282
- props: {
283
- [bind]: newValue
284
- }
285
- });
286
- };
287
- return /* @__PURE__ */ React5.createElement(ControlContext.Provider, { value: { setValue, value, bind } }, children);
288
- };
289
- SettingsControl.Label = ControlLabel;
290
-
291
- // src/components/accordion-section.tsx
292
- var React6 = __toESM(require("react"));
293
- var import_react5 = require("react");
294
- var import_ui3 = require("@elementor/ui");
295
- var AccordionSection = ({ title, children }) => {
296
- const uid = (0, import_react5.useId)();
297
- const labelId = `label-${uid}`;
298
- const contentId = `content-${uid}`;
299
- return /* @__PURE__ */ React6.createElement(import_ui3.Accordion, { disableGutters: true, defaultExpanded: true }, /* @__PURE__ */ React6.createElement(import_ui3.AccordionSummary, { "aria-controls": contentId, id: labelId }, /* @__PURE__ */ React6.createElement(import_ui3.AccordionSummaryText, { primaryTypographyProps: { variant: "caption" } }, title)), /* @__PURE__ */ React6.createElement(import_ui3.AccordionDetails, { id: contentId, "aria-labelledby": labelId }, /* @__PURE__ */ React6.createElement(import_ui3.Stack, { gap: 2.5 }, children)));
300
- };
301
-
302
- // src/controls/control.tsx
303
- var React16 = __toESM(require("react"));
304
144
  var import_utils = require("@elementor/utils");
305
145
 
306
- // src/controls/control-types/image-control.tsx
307
- var React11 = __toESM(require("react"));
308
- var import_ui8 = require("@elementor/ui");
309
- var import_i18n2 = require("@wordpress/i18n");
310
-
311
- // src/controls/control-types/image-media-control.tsx
312
- var React9 = __toESM(require("react"));
313
- var import_ui6 = require("@elementor/ui");
314
- var import_icons2 = require("@elementor/icons");
315
- var import_wp_media = require("@elementor/wp-media");
316
- var import_i18n = require("@wordpress/i18n");
317
-
318
- // src/controls/control-actions/control-actions.tsx
319
- var React7 = __toESM(require("react"));
320
- var import_ui4 = require("@elementor/ui");
321
- var { useMenuItems } = controlActionsMenu;
322
- var FloatingBar = (0, import_ui4.styled)(import_ui4.UnstableFloatingActionBar)`
323
- & .MuiPaper-root:empty {
324
- display: none;
325
- }
326
-
327
- // this is for a fix which would be added later on - to force the width externally
328
- width: 100%;
329
- & > :first-of-type {
330
- width: 100%;
331
- }
332
- `;
333
- function ControlActions({ fullWidth = false, children }) {
334
- const items = useMenuItems().default;
335
- if (items.length === 0) {
336
- return children;
337
- }
338
- return /* @__PURE__ */ React7.createElement(
339
- FloatingBar,
340
- {
341
- actions: items.map(({ MenuItem: MenuItem4, id }) => /* @__PURE__ */ React7.createElement(MenuItem4, { key: id })),
342
- sx: fullWidth ? { width: "100%" } : void 0
343
- },
344
- children
345
- );
346
- }
347
-
348
- // src/controls/create-control.tsx
349
- var React8 = __toESM(require("react"));
350
- var import_ui5 = require("@elementor/ui");
351
- var brandSymbol = Symbol("control");
352
- function createControl(Component, { supportsReplacements = true } = {}) {
353
- return (props) => {
354
- const ControlReplacement = useControlReplacement();
355
- if (ControlReplacement && supportsReplacements) {
356
- return /* @__PURE__ */ React8.createElement(import_ui5.ErrorBoundary, { fallback: null }, /* @__PURE__ */ React8.createElement(ControlReplacement, { ...props }));
357
- }
358
- return /* @__PURE__ */ React8.createElement(import_ui5.ErrorBoundary, { fallback: null }, /* @__PURE__ */ React8.createElement(Component, { ...props }));
359
- };
360
- }
361
-
362
- // src/controls/control-types/image-media-control.tsx
363
- var ImageMediaControl = createControl(() => {
364
- const { value, setValue } = useControl();
365
- const { id, url } = value?.value ?? {};
366
- const { data: attachment } = (0, import_wp_media.useWpMediaAttachment)(id?.value || null);
367
- const src = attachment?.url ?? url;
368
- const { open } = (0, import_wp_media.useWpMediaFrame)({
369
- types: ["image"],
370
- multiple: false,
371
- selected: id?.value || null,
372
- onSelect: (selectedAttachment) => {
373
- setValue({
374
- $$type: "image-src",
375
- value: {
376
- id: {
377
- $$type: "image-attachment-id",
378
- value: selectedAttachment.id
379
- },
380
- url: null
381
- }
382
- });
383
- }
384
- });
385
- return /* @__PURE__ */ React9.createElement(import_ui6.Card, { variant: "outlined" }, /* @__PURE__ */ React9.createElement(import_ui6.CardMedia, { image: src, sx: { height: 150 } }), /* @__PURE__ */ React9.createElement(import_ui6.CardOverlay, null, /* @__PURE__ */ React9.createElement(ControlActions, null, /* @__PURE__ */ React9.createElement(import_ui6.Stack, { gap: 0.5 }, /* @__PURE__ */ React9.createElement(
386
- import_ui6.Button,
387
- {
388
- size: "tiny",
389
- color: "inherit",
390
- variant: "outlined",
391
- onClick: () => open({ mode: "browse" })
392
- },
393
- (0, import_i18n.__)("Select Image", "elementor")
394
- ), /* @__PURE__ */ React9.createElement(
395
- import_ui6.Button,
396
- {
397
- size: "tiny",
398
- variant: "text",
399
- color: "inherit",
400
- startIcon: /* @__PURE__ */ React9.createElement(import_icons2.UploadIcon, null),
401
- onClick: () => open({ mode: "upload" })
402
- },
403
- (0, import_i18n.__)("Upload Image", "elementor")
404
- )))));
405
- });
406
-
407
- // src/controls/control-types/select-control.tsx
408
- var React10 = __toESM(require("react"));
409
- var import_ui7 = require("@elementor/ui");
410
- var SelectControl = createControl(({ options: options4 }) => {
411
- const { value, setValue } = useControl();
412
- const handleChange = (event) => {
413
- setValue(event.target.value);
414
- };
415
- return /* @__PURE__ */ React10.createElement(ControlActions, null, /* @__PURE__ */ React10.createElement(import_ui7.Select, { size: "tiny", value: value ?? "", onChange: handleChange }, options4.map(({ label, ...props }) => /* @__PURE__ */ React10.createElement(import_ui7.MenuItem, { key: props.value, ...props }, label))));
416
- });
417
-
418
- // src/controls/control-types/image-control.tsx
419
- var ImageControl = createControl((props) => {
420
- const { value, setValue } = useControl();
421
- const { src, size } = value?.value || {};
422
- const setImageSrc = (newValue) => {
423
- setValue({
424
- $$type: "image",
425
- value: {
426
- src: newValue,
427
- size
428
- }
429
- });
430
- };
431
- const setImageSize = (newValue) => {
432
- setValue({
433
- $$type: "image",
434
- value: {
435
- src,
436
- size: newValue
437
- }
438
- });
439
- };
440
- return /* @__PURE__ */ React11.createElement(import_ui8.Stack, { gap: 2 }, /* @__PURE__ */ React11.createElement(ControlContext.Provider, { value: { setValue: setImageSrc, value: src, bind: "src" } }, /* @__PURE__ */ React11.createElement(ImageMediaControl, null)), /* @__PURE__ */ React11.createElement(ControlContext.Provider, { value: { setValue: setImageSize, value: size, bind: "size" } }, /* @__PURE__ */ React11.createElement(import_ui8.Grid, { container: true, spacing: 1, alignItems: "center" }, /* @__PURE__ */ React11.createElement(import_ui8.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React11.createElement(SettingsControl.Label, null, " ", (0, import_i18n2.__)("Image Resolution", "elementor"))), /* @__PURE__ */ React11.createElement(import_ui8.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React11.createElement(SelectControl, { options: props.sizes })))));
441
- });
442
-
443
- // src/controls/control-types/text-control.tsx
444
- var React12 = __toESM(require("react"));
445
- var import_ui9 = require("@elementor/ui");
446
- var TextControl = createControl(({ placeholder }) => {
447
- const { value, setValue } = useControl("");
448
- const handleChange = (event) => setValue(event.target.value);
449
- return /* @__PURE__ */ React12.createElement(ControlActions, { fullWidth: true }, /* @__PURE__ */ React12.createElement(import_ui9.TextField, { type: "text", size: "tiny", value, onChange: handleChange, placeholder }));
450
- });
451
-
452
- // src/controls/control-types/text-area-control.tsx
453
- var React13 = __toESM(require("react"));
454
- var import_ui10 = require("@elementor/ui");
455
- var TextAreaControl = createControl(({ placeholder }) => {
456
- const { value, setValue } = useControl();
457
- const handleChange = (event) => {
458
- setValue(event.target.value);
459
- };
460
- return /* @__PURE__ */ React13.createElement(ControlActions, { fullWidth: true }, /* @__PURE__ */ React13.createElement(
461
- import_ui10.TextField,
462
- {
463
- size: "tiny",
464
- multiline: true,
465
- fullWidth: true,
466
- rows: 5,
467
- value,
468
- onChange: handleChange,
469
- placeholder
470
- }
471
- ));
472
- });
473
-
474
- // src/controls/control-types/size-control.tsx
475
- var React15 = __toESM(require("react"));
476
- var import_ui12 = require("@elementor/ui");
477
-
478
- // src/controls/hooks/use-sync-external-state.tsx
479
- var import_react6 = require("react");
480
- var useSyncExternalState = ({
481
- external,
482
- setExternal,
483
- persistWhen,
484
- fallback
485
- }) => {
486
- function toExternal(internalValue) {
487
- if (persistWhen(internalValue)) {
488
- return internalValue;
489
- }
490
- return void 0;
491
- }
492
- function toInternal(externalValue, internalValue) {
493
- if (!externalValue) {
494
- return fallback(internalValue);
495
- }
496
- return externalValue;
497
- }
498
- const [internal, setInternal] = (0, import_react6.useState)(toInternal(external, void 0));
499
- (0, import_react6.useEffect)(() => {
500
- setInternal((prevInternal) => toInternal(external, prevInternal));
501
- }, [external]);
502
- const setInternalValue = (setter) => {
503
- const setterFn = typeof setter === "function" ? setter : () => setter;
504
- const updated = setterFn(internal);
505
- setInternal(updated);
506
- setExternal(toExternal(updated));
507
- };
508
- return [internal, setInternalValue];
509
- };
510
-
511
- // src/controls/components/text-field-inner-selection.tsx
512
- var React14 = __toESM(require("react"));
513
- var import_react7 = require("react");
514
- var import_ui11 = require("@elementor/ui");
515
- var TextFieldInnerSelection = ({
516
- placeholder,
517
- type,
518
- value,
519
- onChange,
520
- endAdornment,
521
- startAdornment
522
- }) => {
523
- return /* @__PURE__ */ React14.createElement(
524
- import_ui11.TextField,
525
- {
526
- size: "tiny",
527
- type,
528
- value,
529
- onChange,
530
- placeholder,
531
- InputProps: {
532
- endAdornment,
533
- startAdornment
534
- }
535
- }
536
- );
537
- };
538
- var SelectionEndAdornment = ({
539
- options: options4,
540
- onClick,
541
- value
542
- }) => {
543
- const popupState = (0, import_ui11.usePopupState)({
544
- variant: "popover",
545
- popupId: (0, import_react7.useId)()
546
- });
547
- const handleMenuItemClick = (index) => {
548
- onClick(options4[index]);
549
- popupState.close();
550
- };
551
- return /* @__PURE__ */ React14.createElement(import_ui11.InputAdornment, { position: "end" }, /* @__PURE__ */ React14.createElement(
552
- import_ui11.Button,
553
- {
554
- size: "small",
555
- color: "inherit",
556
- sx: { font: "inherit", minWidth: "initial" },
557
- ...(0, import_ui11.bindTrigger)(popupState)
558
- },
559
- value.toUpperCase()
560
- ), /* @__PURE__ */ React14.createElement(import_ui11.Menu, { MenuListProps: { dense: true }, ...(0, import_ui11.bindMenu)(popupState) }, options4.map((option, index) => /* @__PURE__ */ React14.createElement(import_ui11.MenuItem, { key: option, onClick: () => handleMenuItemClick(index) }, option.toUpperCase()))));
561
- };
562
-
563
- // src/controls/control-types/size-control.tsx
564
- var defaultUnits = ["px", "%", "em", "rem", "vw"];
565
- var SizeControl = createControl(({ units = defaultUnits, placeholder, startIcon }) => {
566
- const { value, setValue } = useControl();
567
- const [state, setState] = useSyncExternalState({
568
- external: value,
569
- setExternal: setValue,
570
- persistWhen: (controlValue) => !!controlValue?.value.size || controlValue?.value.size === 0,
571
- fallback: (controlValue) => ({
572
- $$type: "size",
573
- value: { unit: controlValue?.value.unit || "px", size: NaN }
574
- })
575
- });
576
- const handleUnitChange = (unit) => {
577
- setState((prev) => ({
578
- ...prev,
579
- value: {
580
- ...prev.value,
581
- unit
582
- }
583
- }));
584
- };
585
- const handleSizeChange = (event) => {
586
- const { value: size } = event.target;
587
- setState((prev) => ({
588
- ...prev,
589
- value: {
590
- ...prev.value,
591
- size: size || size === "0" ? parseFloat(size) : NaN
592
- }
593
- }));
594
- };
595
- return /* @__PURE__ */ React15.createElement(ControlActions, null, /* @__PURE__ */ React15.createElement(
596
- TextFieldInnerSelection,
597
- {
598
- endAdornment: /* @__PURE__ */ React15.createElement(SelectionEndAdornment, { options: units, onClick: handleUnitChange, value: state.value.unit }),
599
- placeholder,
600
- startAdornment: startIcon ?? /* @__PURE__ */ React15.createElement(import_ui12.InputAdornment, { position: "start" }, startIcon),
601
- type: "number",
602
- value: Number.isNaN(state.value.size) ? "" : state.value.size,
603
- onChange: handleSizeChange
604
- }
605
- ));
606
- });
607
-
608
- // src/controls/controls-registry.tsx
146
+ // src/controls-registry/controls-registry.tsx
147
+ var import_editor_controls2 = require("@elementor/editor-controls");
609
148
  var controlTypes = {
610
- image: { component: ImageControl, layout: "full" },
611
- text: { component: TextControl, layout: "two-columns" },
612
- textarea: { component: TextAreaControl, layout: "full" },
613
- size: { component: SizeControl, layout: "two-columns" },
614
- select: { component: SelectControl, layout: "two-columns" }
149
+ image: { component: import_editor_controls2.ImageControl, layout: "full" },
150
+ text: { component: import_editor_controls2.TextControl, layout: "two-columns" },
151
+ textarea: { component: import_editor_controls2.TextAreaControl, layout: "full" },
152
+ size: { component: import_editor_controls2.SizeControl, layout: "two-columns" },
153
+ select: { component: import_editor_controls2.SelectControl, layout: "two-columns" }
615
154
  };
616
155
  var getControlByType = (type) => controlTypes[type]?.component;
617
156
  var getLayoutByType = (type) => controlTypes[type].layout;
618
157
 
619
- // src/controls/control.tsx
158
+ // src/controls-registry/control.tsx
620
159
  var ControlTypeError = (0, import_utils.createError)({
621
160
  code: "CONTROL_TYPE_NOT_FOUND",
622
161
  message: `Control type not found.`
@@ -628,20 +167,20 @@ var Control = ({ props, type }) => {
628
167
  context: { type }
629
168
  });
630
169
  }
631
- return /* @__PURE__ */ React16.createElement(ControlByType, { ...props });
170
+ return /* @__PURE__ */ React4.createElement(ControlByType, { ...props });
632
171
  };
633
172
 
634
- // src/controls/components/control-type-container.tsx
635
- var React17 = __toESM(require("react"));
636
- var import_ui13 = require("@elementor/ui");
173
+ // src/controls-registry/control-type-container.tsx
174
+ var React5 = __toESM(require("react"));
175
+ var import_ui3 = require("@elementor/ui");
637
176
  var ControlTypeContainer = ({
638
177
  controlType,
639
178
  children
640
179
  }) => {
641
180
  const layout = getLayoutByType(controlType);
642
- return /* @__PURE__ */ React17.createElement(StyledContainer, { layout }, children);
181
+ return /* @__PURE__ */ React5.createElement(StyledContainer, { layout }, children);
643
182
  };
644
- var StyledContainer = (0, import_ui13.styled)(import_ui13.Box, {
183
+ var StyledContainer = (0, import_ui3.styled)(import_ui3.Box, {
645
184
  shouldForwardProp: (prop) => !["layout"].includes(prop)
646
185
  })(({ layout, theme }) => ({
647
186
  display: "grid",
@@ -656,17 +195,79 @@ var getGridLayout = (layout) => ({
656
195
  }[layout]
657
196
  });
658
197
 
659
- // src/components/settings-tab.tsx
660
- var SettingsTab = () => {
198
+ // src/controls-registry/settings-field.tsx
199
+ var React6 = __toESM(require("react"));
200
+ var import_editor_controls3 = require("@elementor/editor-controls");
201
+ var import_editor_elements = require("@elementor/editor-elements");
202
+ var SettingsField = ({ bind, children }) => {
203
+ const { element, elementType } = useElement();
204
+ const defaultValue = elementType.propsSchema[bind]?.default;
205
+ const settingsValue = (0, import_editor_elements.useElementSetting)(element.id, bind);
206
+ const value = settingsValue ?? defaultValue ?? null;
207
+ const setValue = (newValue) => {
208
+ (0, import_editor_elements.updateSettings)({
209
+ id: element.id,
210
+ props: {
211
+ [bind]: newValue
212
+ }
213
+ });
214
+ };
215
+ return /* @__PURE__ */ React6.createElement(import_editor_controls3.BoundPropProvider, { setValue, value, bind }, children);
216
+ };
217
+
218
+ // src/components/section.tsx
219
+ var React7 = __toESM(require("react"));
220
+ var import_react3 = require("react");
221
+ var import_ui5 = require("@elementor/ui");
222
+
223
+ // src/components/collapse-icon.tsx
224
+ var import_icons2 = require("@elementor/icons");
225
+ var import_ui4 = require("@elementor/ui");
226
+ var CollapseIcon = (0, import_ui4.styled)(import_icons2.ChevronDownIcon, {
227
+ shouldForwardProp: (prop) => prop !== "open"
228
+ })(({ theme, open }) => ({
229
+ transform: open ? "rotate(180deg)" : "rotate(0deg)",
230
+ transition: theme.transitions.create("transform", {
231
+ duration: theme.transitions.duration.standard
232
+ })
233
+ }));
234
+
235
+ // src/components/section.tsx
236
+ function Section({ title, children, defaultExpanded = false }) {
237
+ const [isOpen, setIsOpen] = (0, import_react3.useState)(!!defaultExpanded);
238
+ const id = (0, import_react3.useId)();
239
+ const labelId = `label-${id}`;
240
+ const contentId = `content-${id}`;
241
+ return /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement(
242
+ import_ui5.ListItemButton,
243
+ {
244
+ id: labelId,
245
+ "aria-controls": contentId,
246
+ onClick: () => setIsOpen((prev) => !prev)
247
+ },
248
+ /* @__PURE__ */ React7.createElement(import_ui5.ListItemText, { secondary: title }),
249
+ /* @__PURE__ */ React7.createElement(CollapseIcon, { open: isOpen, color: "secondary" })
250
+ ), /* @__PURE__ */ React7.createElement(import_ui5.Collapse, { id: contentId, "aria-labelledby": labelId, in: isOpen, timeout: "auto", unmountOnExit: true }, /* @__PURE__ */ React7.createElement(import_ui5.Stack, { gap: 2.5, p: 2 }, children)), /* @__PURE__ */ React7.createElement(import_ui5.Divider, null));
251
+ }
252
+
253
+ // src/components/sections-list.tsx
254
+ var React8 = __toESM(require("react"));
255
+ var import_ui6 = require("@elementor/ui");
256
+ function SectionsList(props) {
257
+ return /* @__PURE__ */ React8.createElement(import_ui6.List, { disablePadding: true, component: "div", ...props });
258
+ }
259
+
260
+ // src/components/settings-tab.tsx
261
+ var SettingsTab = () => {
661
262
  const { elementType } = useElement();
662
- return /* @__PURE__ */ React18.createElement(import_ui14.Stack, null, elementType.controls.map(({ type, value }, index) => {
263
+ return /* @__PURE__ */ React9.createElement(SectionsList, null, elementType.controls.map(({ type, value }, index) => {
663
264
  if (type === "control") {
664
- return /* @__PURE__ */ React18.createElement(Control2, { key: value.bind, control: value });
265
+ return /* @__PURE__ */ React9.createElement(Control2, { key: value.bind, control: value });
665
266
  }
666
267
  if (type === "section") {
667
- return /* @__PURE__ */ React18.createElement(AccordionSection, { key: type + "." + index, title: value.label }, value.items?.map((item) => {
268
+ return /* @__PURE__ */ React9.createElement(Section, { title: value.label, key: type + "." + index, defaultExpanded: true }, value.items?.map((item) => {
668
269
  if (item.type === "control") {
669
- return /* @__PURE__ */ React18.createElement(Control2, { key: item.value.bind, control: item.value });
270
+ return /* @__PURE__ */ React9.createElement(Control2, { key: item.value.bind, control: item.value });
670
271
  }
671
272
  return null;
672
273
  }));
@@ -678,899 +279,1137 @@ var Control2 = ({ control }) => {
678
279
  if (!getControlByType(control.type)) {
679
280
  return null;
680
281
  }
681
- return /* @__PURE__ */ React18.createElement(SettingsControl, { bind: control.bind }, /* @__PURE__ */ React18.createElement(ControlTypeContainer, { controlType: control.type }, control.label ? /* @__PURE__ */ React18.createElement(SettingsControl.Label, null, control.label) : null, /* @__PURE__ */ React18.createElement(Control, { type: control.type, props: control.props })));
282
+ return /* @__PURE__ */ React9.createElement(SettingsField, { bind: control.bind }, /* @__PURE__ */ React9.createElement(ControlTypeContainer, { controlType: control.type }, control.label ? /* @__PURE__ */ React9.createElement(import_editor_controls4.ControlLabel, null, control.label) : null, /* @__PURE__ */ React9.createElement(Control, { type: control.type, props: control.props })));
682
283
  };
683
284
 
684
285
  // src/components/style-tab.tsx
685
- var React46 = __toESM(require("react"));
286
+ var React49 = __toESM(require("react"));
287
+ var import_react12 = require("react");
288
+ var import_editor_elements5 = require("@elementor/editor-elements");
289
+ var import_editor_responsive = require("@elementor/editor-responsive");
290
+ var import_editor_styles = require("@elementor/editor-styles");
291
+ var import_ui41 = require("@elementor/ui");
292
+ var import_i18n29 = require("@wordpress/i18n");
293
+
294
+ // src/contexts/classes-prop-context.tsx
295
+ var React10 = __toESM(require("react"));
296
+ var import_react4 = require("react");
297
+ var Context2 = (0, import_react4.createContext)(null);
298
+ function ClassesPropProvider({ children, prop }) {
299
+ return /* @__PURE__ */ React10.createElement(Context2.Provider, { value: { prop } }, children);
300
+ }
301
+ function useClassesProp() {
302
+ const context = (0, import_react4.useContext)(Context2);
303
+ if (!context) {
304
+ throw new Error("useClassesProp must be used within a ClassesPropProvider");
305
+ }
306
+ return context.prop;
307
+ }
686
308
 
687
309
  // src/contexts/style-context.tsx
688
- var React19 = __toESM(require("react"));
689
- var import_react8 = require("react");
690
- var import_editor_responsive = require("@elementor/editor-responsive");
691
- var Context2 = (0, import_react8.createContext)(null);
692
- function StyleContext({ children, selectedStyleDef, selectedClassesProp }) {
693
- const breakpoint = (0, import_editor_responsive.useActiveBreakpoint)();
694
- const selectedMeta = { breakpoint, state: null };
695
- return /* @__PURE__ */ React19.createElement(Context2.Provider, { value: { selectedStyleDef, selectedMeta, selectedClassesProp } }, children);
310
+ var React11 = __toESM(require("react"));
311
+ var import_react5 = require("react");
312
+ var Context3 = (0, import_react5.createContext)(null);
313
+ function StyleProvider({ children, id, setId, meta }) {
314
+ return /* @__PURE__ */ React11.createElement(Context3.Provider, { value: { id, setId, meta } }, children);
696
315
  }
697
- function useStyleContext() {
698
- const context = (0, import_react8.useContext)(Context2);
316
+ function useStyle() {
317
+ const context = (0, import_react5.useContext)(Context3);
699
318
  if (!context) {
700
- throw new Error("UseStyleContext must be used within a StyleContextProvider");
319
+ throw new Error("useStyle must be used within a StyleProvider");
701
320
  }
702
321
  return context;
703
322
  }
704
323
 
705
- // src/hooks/use-element-styles.ts
706
- var import_editor_v1_adapters5 = require("@elementor/editor-v1-adapters");
707
-
708
- // src/sync/get-element-styles.ts
709
- var getElementStyles = (elementID) => {
710
- const container = getContainer(elementID);
711
- return container?.model.get("styles") || null;
712
- };
713
-
714
- // src/hooks/use-element-styles.ts
715
- var useElementStyles = (elementID) => {
716
- return (0, import_editor_v1_adapters5.__privateUseListenTo)(
717
- (0, import_editor_v1_adapters5.commandEndEvent)("document/atomic-widgets/styles"),
718
- () => {
719
- return getElementStyles(elementID);
720
- },
721
- [elementID]
722
- );
723
- };
724
-
725
- // src/components/style-tab.tsx
726
- var import_ui39 = require("@elementor/ui");
324
+ // src/components/css-class-selector-section.tsx
325
+ var React13 = __toESM(require("react"));
326
+ var import_editor_elements2 = require("@elementor/editor-elements");
327
+ var import_ui9 = require("@elementor/ui");
328
+ var import_i18n = require("@wordpress/i18n");
727
329
 
728
- // src/components/style-sections/size-section.tsx
729
- var React21 = __toESM(require("react"));
330
+ // src/components/multi-combobox/multi-combobox.tsx
331
+ var React12 = __toESM(require("react"));
332
+ var import_ui8 = require("@elementor/ui");
730
333
 
731
- // src/controls/style-control.tsx
732
- var React20 = __toESM(require("react"));
334
+ // src/components/multi-combobox/use-combobox-actions.ts
335
+ var import_ui7 = require("@elementor/ui");
336
+ var useComboboxActions = (applied, actions, optionsLabel, onApply) => ({
337
+ action: {
338
+ is: (opt) => !!opt.action,
339
+ getLabel: (option) => option.action.getLabel(option.label),
340
+ groupBy: (option) => option.action.groupLabel,
341
+ onChange: ({ action, label }) => action?.apply(label),
342
+ getFilteredActions: (optionList, params) => {
343
+ const actionGroups = Object.values(actions);
344
+ return actionGroups.reduce((groups, group) => {
345
+ const actionOptions = group.actions.reduce((groupActions, action) => {
346
+ const shouldShowAction = action.condition(optionList, params.inputValue);
347
+ if (shouldShowAction) {
348
+ const actionOption = createActionOption(group.label, action, params.inputValue);
349
+ groupActions.unshift(actionOption);
350
+ }
351
+ return groupActions;
352
+ }, []);
353
+ return [...groups, ...actionOptions];
354
+ }, []);
355
+ }
356
+ },
357
+ option: {
358
+ is: (opt) => !("action" in opt),
359
+ getLabel: (option) => option.label,
360
+ groupBy: () => optionsLabel ?? "",
361
+ onChange: (optionValues) => onApply?.(optionValues),
362
+ getFilteredOptions: (optionList, params) => {
363
+ const appliedValues = applied.map((option) => option.value);
364
+ const optionsWithoutApplied = optionList.filter((option) => !appliedValues.includes(option.value));
365
+ return filter(optionsWithoutApplied, params);
366
+ }
367
+ }
368
+ });
369
+ var filter = (0, import_ui7.createFilterOptions)();
370
+ var createActionOption = (groupLabel, action, inputValue) => ({
371
+ value: "",
372
+ label: inputValue,
373
+ action: {
374
+ groupLabel,
375
+ apply: action.apply,
376
+ getLabel: action.getLabel
377
+ }
378
+ });
733
379
 
734
- // src/hooks/use-element-style-prop.ts
735
- var import_editor_v1_adapters6 = require("@elementor/editor-v1-adapters");
736
- var useElementStyleProp = ({
737
- elementID,
738
- styleDefID,
739
- meta,
740
- propName
380
+ // src/components/multi-combobox/multi-combobox.tsx
381
+ var MultiCombobox = ({
382
+ actions = {},
383
+ selected,
384
+ options: options5,
385
+ optionsLabel,
386
+ onApply,
387
+ onCreate,
388
+ ...props
741
389
  }) => {
742
- return (0, import_editor_v1_adapters6.__privateUseListenTo)(
743
- (0, import_editor_v1_adapters6.commandEndEvent)("document/atomic-widgets/styles"),
744
- () => {
745
- if (!styleDefID) {
746
- return null;
747
- }
748
- const styleDef = getElementStyles(elementID)?.[styleDefID];
749
- if (!styleDef) {
750
- return null;
751
- }
752
- const variant = getVariantByMeta(styleDef, meta);
753
- return variant?.props[propName] ?? null;
754
- },
755
- [elementID, styleDefID, propName, meta]
390
+ const { action: actionProps, option: optionProps } = useComboboxActions(selected, actions, optionsLabel, onApply);
391
+ const handleSelectOption = (values) => {
392
+ const action = values.find((value) => actionProps.is(value));
393
+ if (action) {
394
+ return actionProps.onChange(action);
395
+ }
396
+ return optionProps.onChange(values);
397
+ };
398
+ const handleCreateOption = (values) => {
399
+ const value = values.find((option) => typeof option === "string");
400
+ onCreate?.(value);
401
+ };
402
+ return /* @__PURE__ */ React12.createElement(
403
+ import_ui8.Autocomplete,
404
+ {
405
+ ...props,
406
+ freeSolo: true,
407
+ multiple: true,
408
+ clearOnBlur: true,
409
+ selectOnFocus: true,
410
+ disableClearable: true,
411
+ handleHomeEndKeys: true,
412
+ value: selected,
413
+ options: options5,
414
+ renderGroup,
415
+ renderInput: (params) => /* @__PURE__ */ React12.createElement(import_ui8.TextField, { ...params }),
416
+ getLimitTagsText: (more) => /* @__PURE__ */ React12.createElement(import_ui8.Chip, { size: "tiny", variant: "standard", label: `+${more}`, clickable: true }),
417
+ onChange: (_, values, reason) => {
418
+ if (reason === "selectOption") {
419
+ return handleSelectOption(values);
420
+ }
421
+ if (reason === "createOption") {
422
+ return handleCreateOption(values);
423
+ }
424
+ onApply?.(values);
425
+ },
426
+ getOptionLabel: (option) => {
427
+ if (optionProps.is(option)) {
428
+ return optionProps.getLabel(option);
429
+ }
430
+ return actionProps.getLabel(option) ?? "";
431
+ },
432
+ filterOptions: (optionList, params) => {
433
+ const filteredoptions = optionProps.getFilteredOptions(optionList, params);
434
+ const actionOptions = actionProps.getFilteredActions(optionList, params);
435
+ return [...actionOptions, ...filteredoptions];
436
+ },
437
+ groupBy: (option) => (optionProps.is(option) ? optionProps.groupBy() : actionProps.groupBy(option)) ?? ""
438
+ }
756
439
  );
757
440
  };
758
- function getVariantByMeta(styleDef, meta) {
759
- return styleDef.variants.find((variant) => {
760
- return variant.meta.breakpoint === meta.breakpoint && variant.meta.state === meta.state;
761
- });
441
+ var renderGroup = (params) => /* @__PURE__ */ React12.createElement(Group, { key: params.key }, /* @__PURE__ */ React12.createElement(GroupHeader, null, params.group), /* @__PURE__ */ React12.createElement(GroupItems, null, params.children));
442
+ var Group = (0, import_ui8.styled)("li")`
443
+ &:not( :last-of-type ) {
444
+ border-bottom: 1px solid ${({ theme }) => theme.palette.divider};
445
+ }
446
+ `;
447
+ var GroupHeader = (0, import_ui8.styled)(import_ui8.Box)(({ theme }) => ({
448
+ position: "sticky",
449
+ top: "-8px",
450
+ padding: theme.spacing(1, 2),
451
+ color: theme.palette.text.tertiary
452
+ }));
453
+ var GroupItems = (0, import_ui8.styled)("ul")`
454
+ padding: 0;
455
+ `;
456
+
457
+ // src/components/css-class-selector-section.tsx
458
+ var ID = "elementor-css-class-selector";
459
+ var TAGS_LIMIT = 8;
460
+ function CssClassSelectorSection() {
461
+ const options5 = useOptions();
462
+ const { id: activeId, setId: setActiveId } = useStyle();
463
+ const appliedIds = useAppliedClassesIds();
464
+ const applied = options5.filter((option) => appliedIds.includes(option.value));
465
+ const active = options5.find((option) => option.value === activeId) || null;
466
+ return /* @__PURE__ */ React13.createElement(import_ui9.Stack, { gap: 1, p: 2 }, /* @__PURE__ */ React13.createElement(import_ui9.Typography, { component: "label", variant: "caption", htmlFor: ID }, (0, import_i18n.__)("CSS Classes", "elementor")), /* @__PURE__ */ React13.createElement(
467
+ MultiCombobox,
468
+ {
469
+ id: ID,
470
+ size: "tiny",
471
+ options: options5,
472
+ selected: applied,
473
+ limitTags: TAGS_LIMIT,
474
+ optionsLabel: (0, import_i18n.__)("Global CSS Classes", "elementor"),
475
+ renderTags: (tagValue, getTagProps) => tagValue.map((option, index) => {
476
+ const chipProps = getTagProps({ index });
477
+ return /* @__PURE__ */ React13.createElement(
478
+ import_ui9.Chip,
479
+ {
480
+ ...chipProps,
481
+ key: chipProps.key,
482
+ size: "small",
483
+ label: option.label,
484
+ variant: option.value === active?.value ? "filled" : "standard",
485
+ color: option.color ?? "default",
486
+ onClick: () => setActiveId(option.value),
487
+ onDelete: null
488
+ }
489
+ );
490
+ })
491
+ }
492
+ ));
493
+ }
494
+ function useAppliedClassesIds() {
495
+ const { element } = useElement();
496
+ const currentClassesProp = useClassesProp();
497
+ return (0, import_editor_elements2.useElementSetting)(element.id, currentClassesProp)?.value || [];
498
+ }
499
+ function useOptions() {
500
+ const { element } = useElement();
501
+ const styleDefs = (0, import_editor_elements2.useElementStyles)(element.id);
502
+ return Object.values(styleDefs).map((styleDef) => ({
503
+ label: styleDef.label,
504
+ value: styleDef.id,
505
+ color: "primary"
506
+ }));
762
507
  }
763
508
 
764
- // src/sync/update-style.ts
765
- var import_editor_v1_adapters7 = require("@elementor/editor-v1-adapters");
766
- var updateStyle = ({ elementID, styleDefID, meta, props, bind }) => {
767
- const container = getContainer(elementID);
768
- (0, import_editor_v1_adapters7.__privateRunCommand)("document/atomic-widgets/styles", {
769
- container,
770
- styleDefID,
771
- bind,
772
- meta,
773
- props
774
- });
775
- };
509
+ // src/components/style-sections/background-section/background-section.tsx
510
+ var React16 = __toESM(require("react"));
511
+ var import_editor_controls7 = require("@elementor/editor-controls");
512
+ var import_ui11 = require("@elementor/ui");
776
513
 
777
- // src/controls/hooks/use-style-control.ts
778
- var useStyleControl = (propName) => {
514
+ // src/controls-registry/styles-field.tsx
515
+ var React14 = __toESM(require("react"));
516
+ var import_editor_controls5 = require("@elementor/editor-controls");
517
+
518
+ // src/hooks/use-styles-field.ts
519
+ var import_react6 = require("react");
520
+ var import_editor_elements3 = require("@elementor/editor-elements");
521
+ var useStylesField = (propName) => {
779
522
  const { element } = useElement();
780
- const { selectedStyleDef, selectedMeta, selectedClassesProp } = useStyleContext();
781
- const value = useElementStyleProp({
523
+ const { id, meta } = useStyle();
524
+ const classesProp = useClassesProp();
525
+ const previousValue = (0, import_react6.useRef)(null);
526
+ const onChangeCallbacks = (0, import_react6.useRef)(/* @__PURE__ */ new Set());
527
+ const value = (0, import_editor_elements3.useElementStyleProp)({
782
528
  elementID: element.id,
783
- styleDefID: selectedStyleDef?.id,
784
- meta: selectedMeta,
529
+ styleDefID: id,
530
+ meta,
785
531
  propName
786
532
  });
787
533
  const setValue = (newValue) => {
788
- updateStyle({
534
+ (0, import_editor_elements3.updateStyle)({
789
535
  elementID: element.id,
790
- styleDefID: selectedStyleDef?.id,
536
+ styleDefID: id,
791
537
  props: { [propName]: newValue },
792
- meta: selectedMeta,
793
- bind: selectedClassesProp
538
+ meta,
539
+ bind: classesProp
794
540
  });
795
541
  };
796
- return [value, setValue];
542
+ const registerChangeListener = (callback) => {
543
+ onChangeCallbacks.current.add(callback);
544
+ };
545
+ (0, import_react6.useEffect)(() => {
546
+ onChangeCallbacks.current.forEach((cb) => {
547
+ cb(value, previousValue.current);
548
+ });
549
+ previousValue.current = value;
550
+ }, [value]);
551
+ return [value, setValue, registerChangeListener];
797
552
  };
798
553
 
799
- // src/controls/style-control.tsx
800
- var StyleControl = ({ bind, children }) => {
801
- const [value, setValue] = useStyleControl(bind);
802
- return /* @__PURE__ */ React20.createElement(ControlContext.Provider, { value: { bind, value, setValue } }, children);
554
+ // src/controls-registry/styles-field.tsx
555
+ var StylesField = ({ bind, children }) => {
556
+ const [value, setValue] = useStylesField(bind);
557
+ return /* @__PURE__ */ React14.createElement(import_editor_controls5.BoundPropProvider, { setValue, value, bind }, children);
803
558
  };
804
- StyleControl.Label = ControlLabel;
805
559
 
806
- // src/components/style-sections/size-section.tsx
807
- var import_ui15 = require("@elementor/ui");
808
- var import_i18n3 = require("@wordpress/i18n");
809
- var SizeSection = () => {
810
- return /* @__PURE__ */ React21.createElement(AccordionSection, { title: (0, import_i18n3.__)("Size", "elementor") }, /* @__PURE__ */ React21.createElement(import_ui15.Stack, { gap: 1.5 }, /* @__PURE__ */ React21.createElement(import_ui15.Grid, { container: true, spacing: 2 }, /* @__PURE__ */ React21.createElement(Control3, { bind: "width", label: (0, import_i18n3.__)("Width", "elementor") }), /* @__PURE__ */ React21.createElement(Control3, { bind: "height", label: (0, import_i18n3.__)("Height", "elementor") })), /* @__PURE__ */ React21.createElement(import_ui15.Grid, { container: true, spacing: 2 }, /* @__PURE__ */ React21.createElement(Control3, { bind: "min-width", label: (0, import_i18n3.__)("Min. Width", "elementor") }), /* @__PURE__ */ React21.createElement(Control3, { bind: "min-height", label: (0, import_i18n3.__)("Min. Height", "elementor") })), /* @__PURE__ */ React21.createElement(import_ui15.Grid, { container: true, spacing: 2 }, /* @__PURE__ */ React21.createElement(Control3, { bind: "max-width", label: (0, import_i18n3.__)("Max. Width", "elementor") }), /* @__PURE__ */ React21.createElement(Control3, { bind: "max-height", label: (0, import_i18n3.__)("Max. Height", "elementor") }))));
560
+ // src/components/style-sections/background-section/background-color-field.tsx
561
+ var React15 = __toESM(require("react"));
562
+ var import_editor_controls6 = require("@elementor/editor-controls");
563
+ var import_ui10 = require("@elementor/ui");
564
+ var import_i18n2 = require("@wordpress/i18n");
565
+ var BackgroundColorField = () => {
566
+ return /* @__PURE__ */ React15.createElement(StylesField, { bind: "background-color" }, /* @__PURE__ */ React15.createElement(import_ui10.Grid, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React15.createElement(import_ui10.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React15.createElement(import_editor_controls6.ControlLabel, null, (0, import_i18n2.__)("Color", "elementor"))), /* @__PURE__ */ React15.createElement(import_ui10.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React15.createElement(import_editor_controls6.ColorControl, null))));
811
567
  };
812
- var Control3 = ({ label, bind }) => {
813
- return /* @__PURE__ */ React21.createElement(import_ui15.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React21.createElement(StyleControl, { bind }, /* @__PURE__ */ React21.createElement(import_ui15.Grid, { container: true, spacing: 1, alignItems: "center" }, /* @__PURE__ */ React21.createElement(import_ui15.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React21.createElement(StyleControl.Label, null, label)), /* @__PURE__ */ React21.createElement(import_ui15.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React21.createElement(Control, { type: "size" })))));
568
+
569
+ // src/components/style-sections/background-section/background-section.tsx
570
+ var BackgroundSection = () => {
571
+ return /* @__PURE__ */ React16.createElement(import_ui11.Stack, { gap: 1.5 }, /* @__PURE__ */ React16.createElement(StylesField, { bind: "background-image" }, /* @__PURE__ */ React16.createElement(import_editor_controls7.BackgroundOverlayRepeaterControl, null)), /* @__PURE__ */ React16.createElement(BackgroundColorField, null));
814
572
  };
815
573
 
816
- // src/components/style-sections/typography-section/typography-section.tsx
817
- var React35 = __toESM(require("react"));
818
- var import_ui28 = require("@elementor/ui");
574
+ // src/components/style-sections/border-section/border-section.tsx
575
+ var React23 = __toESM(require("react"));
576
+ var import_ui15 = require("@elementor/ui");
819
577
 
820
- // src/components/style-sections/typography-section/text-style-control.tsx
821
- var React22 = __toESM(require("react"));
822
- var import_i18n4 = require("@wordpress/i18n");
823
- var import_ui16 = require("@elementor/ui");
578
+ // src/components/style-sections/border-section/border-field.tsx
579
+ var React21 = __toESM(require("react"));
580
+ var import_i18n6 = require("@wordpress/i18n");
581
+
582
+ // src/components/add-or-remove-content.tsx
583
+ var React17 = __toESM(require("react"));
584
+ var import_editor_controls8 = require("@elementor/editor-controls");
824
585
  var import_icons3 = require("@elementor/icons");
825
- var buttonSize = "tiny";
826
- var TextStyleControl = () => {
827
- const [fontStyle, setFontStyle] = useStyleControl("font-style");
828
- const [textDecoration, setTextDecoration] = useStyleControl("text-decoration");
829
- const formats = [fontStyle, ...(textDecoration || "").split(" ")];
830
- return /* @__PURE__ */ React22.createElement(import_ui16.Grid, { container: true, spacing: 1, alignItems: "center" }, /* @__PURE__ */ React22.createElement(import_ui16.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React22.createElement(ControlLabel, null, (0, import_i18n4.__)("Style", "elementor"))), /* @__PURE__ */ React22.createElement(import_ui16.Grid, { item: true, xs: 6, display: "flex", justifyContent: "end" }, /* @__PURE__ */ React22.createElement(import_ui16.ToggleButtonGroup, { value: formats }, /* @__PURE__ */ React22.createElement(
831
- ToggleButton,
832
- {
833
- value: "italic",
834
- onChange: (v) => setFontStyle(fontStyle === v ? null : v),
835
- "aria-label": "italic",
836
- sx: { marginLeft: "auto" }
837
- },
838
- /* @__PURE__ */ React22.createElement(import_icons3.ItalicIcon, { fontSize: buttonSize })
839
- ), /* @__PURE__ */ React22.createElement(
840
- ShorthandControl,
841
- {
842
- value: "line-through",
843
- currentValues: textDecoration || "",
844
- updateValues: setTextDecoration,
845
- "aria-label": "line-through"
846
- },
847
- /* @__PURE__ */ React22.createElement(import_icons3.StrikethroughIcon, { fontSize: buttonSize })
848
- ), /* @__PURE__ */ React22.createElement(
849
- ShorthandControl,
586
+ var import_ui12 = require("@elementor/ui");
587
+ var SIZE2 = "tiny";
588
+ var AddOrRemoveContent = ({ isAdded, label, onAdd, onRemove, children }) => {
589
+ return /* @__PURE__ */ React17.createElement(import_ui12.Stack, { gap: 1.5 }, /* @__PURE__ */ React17.createElement(
590
+ import_ui12.Stack,
850
591
  {
851
- value: "underline",
852
- currentValues: textDecoration || "",
853
- updateValues: setTextDecoration,
854
- "aria-label": "underline"
592
+ direction: "row",
593
+ sx: {
594
+ justifyContent: "space-between",
595
+ alignItems: "center"
596
+ }
855
597
  },
856
- /* @__PURE__ */ React22.createElement(import_icons3.UnderlineIcon, { fontSize: buttonSize })
857
- ))));
598
+ /* @__PURE__ */ React17.createElement(import_editor_controls8.ControlLabel, null, label),
599
+ isAdded ? /* @__PURE__ */ React17.createElement(import_ui12.IconButton, { size: SIZE2, onClick: onRemove }, /* @__PURE__ */ React17.createElement(import_icons3.MinusIcon, { fontSize: SIZE2 })) : /* @__PURE__ */ React17.createElement(import_ui12.IconButton, { size: SIZE2, onClick: onAdd }, /* @__PURE__ */ React17.createElement(import_icons3.PlusIcon, { fontSize: SIZE2 }))
600
+ ), /* @__PURE__ */ React17.createElement(import_ui12.Collapse, { in: isAdded, unmountOnExit: true }, /* @__PURE__ */ React17.createElement(import_ui12.Stack, { gap: 1.5 }, children)));
858
601
  };
859
- var ShorthandControl = ({
860
- children,
861
- value,
862
- currentValues,
863
- updateValues,
864
- "aria-label": ariaLabel
865
- }) => {
866
- const valuesArr = currentValues.split(" ").filter(Boolean);
867
- const selected = valuesArr.includes(value);
868
- const toggleValue = (newValue) => {
869
- if (selected) {
870
- updateValues(valuesArr.filter((v) => v !== newValue).join(" ") || null);
871
- } else {
872
- updateValues([...valuesArr, newValue].join(" "));
873
- }
874
- };
875
- return /* @__PURE__ */ React22.createElement(ToggleButton, { value, onChange: toggleValue, selected, "aria-label": ariaLabel }, children);
876
- };
877
- var ToggleButton = ({ onChange, ...props }) => {
878
- const handleChange = (_e, newValue) => {
879
- onChange(newValue);
880
- };
881
- return /* @__PURE__ */ React22.createElement(import_ui16.ToggleButton, { ...props, onChange: handleChange, size: buttonSize });
602
+
603
+ // src/components/style-sections/border-section/border-color-field.tsx
604
+ var React18 = __toESM(require("react"));
605
+ var import_editor_controls9 = require("@elementor/editor-controls");
606
+ var import_ui13 = require("@elementor/ui");
607
+ var import_i18n3 = require("@wordpress/i18n");
608
+ var BorderColorField = () => {
609
+ return /* @__PURE__ */ React18.createElement(StylesField, { bind: "border-color" }, /* @__PURE__ */ React18.createElement(import_ui13.Grid, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React18.createElement(import_ui13.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React18.createElement(import_editor_controls9.ControlLabel, null, (0, import_i18n3.__)("Border Color", "elementor"))), /* @__PURE__ */ React18.createElement(import_ui13.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React18.createElement(import_editor_controls9.ColorControl, null))));
882
610
  };
883
611
 
884
- // src/components/style-sections/typography-section/typography-section.tsx
885
- var import_i18n14 = require("@wordpress/i18n");
612
+ // src/components/style-sections/border-section/border-style-field.tsx
613
+ var React19 = __toESM(require("react"));
614
+ var import_editor_controls10 = require("@elementor/editor-controls");
615
+ var import_ui14 = require("@elementor/ui");
616
+ var import_i18n4 = require("@wordpress/i18n");
617
+ var borderStyles = [
618
+ { value: "none", label: (0, import_i18n4.__)("None", "elementor") },
619
+ { value: "solid", label: (0, import_i18n4.__)("Solid", "elementor") },
620
+ { value: "dashed", label: (0, import_i18n4.__)("Dashed", "elementor") },
621
+ { value: "dotted", label: (0, import_i18n4.__)("Dotted", "elementor") },
622
+ { value: "double", label: (0, import_i18n4.__)("Double", "elementor") },
623
+ { value: "groove", label: (0, import_i18n4.__)("Groove", "elementor") },
624
+ { value: "ridge", label: (0, import_i18n4.__)("Ridge", "elementor") },
625
+ { value: "inset", label: (0, import_i18n4.__)("Inset", "elementor") },
626
+ { value: "outset", label: (0, import_i18n4.__)("Outset", "elementor") }
627
+ ];
628
+ var BorderStyleField = () => {
629
+ return /* @__PURE__ */ React19.createElement(StylesField, { bind: "border-style" }, /* @__PURE__ */ React19.createElement(import_ui14.Grid, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React19.createElement(import_ui14.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React19.createElement(import_editor_controls10.ControlLabel, null, (0, import_i18n4.__)("Border Type", "elementor"))), /* @__PURE__ */ React19.createElement(import_ui14.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React19.createElement(import_editor_controls10.SelectControl, { options: borderStyles }))));
630
+ };
886
631
 
887
- // src/components/style-sections/typography-section/font-size-control.tsx
888
- var React23 = __toESM(require("react"));
632
+ // src/components/style-sections/border-section/border-width-field.tsx
633
+ var React20 = __toESM(require("react"));
634
+ var import_editor_controls11 = require("@elementor/editor-controls");
635
+ var import_icons4 = require("@elementor/icons");
889
636
  var import_i18n5 = require("@wordpress/i18n");
890
- var import_ui17 = require("@elementor/ui");
891
- var FontSizeControl = () => {
892
- return /* @__PURE__ */ React23.createElement(StyleControl, { bind: "font-size" }, /* @__PURE__ */ React23.createElement(import_ui17.Grid, { container: true, spacing: 1, alignItems: "center" }, /* @__PURE__ */ React23.createElement(import_ui17.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React23.createElement(StyleControl.Label, null, (0, import_i18n5.__)("Font Size", "elementor"))), /* @__PURE__ */ React23.createElement(import_ui17.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React23.createElement(SizeControl, null))));
637
+ var edges = [
638
+ {
639
+ label: (0, import_i18n5.__)("Top", "elementor"),
640
+ icon: /* @__PURE__ */ React20.createElement(import_icons4.SideTopIcon, { fontSize: "tiny" }),
641
+ bind: "top"
642
+ },
643
+ {
644
+ label: (0, import_i18n5.__)("Right", "elementor"),
645
+ icon: /* @__PURE__ */ React20.createElement(import_icons4.SideRightIcon, { fontSize: "tiny" }),
646
+ bind: "right"
647
+ },
648
+ {
649
+ label: (0, import_i18n5.__)("Bottom", "elementor"),
650
+ icon: /* @__PURE__ */ React20.createElement(import_icons4.SideBottomIcon, { fontSize: "tiny" }),
651
+ bind: "bottom"
652
+ },
653
+ {
654
+ label: (0, import_i18n5.__)("Left", "elementor"),
655
+ icon: /* @__PURE__ */ React20.createElement(import_icons4.SideLeftIcon, { fontSize: "tiny" }),
656
+ bind: "left"
657
+ }
658
+ ];
659
+ var BorderWidthField = () => {
660
+ return /* @__PURE__ */ React20.createElement(StylesField, { bind: "border-width" }, /* @__PURE__ */ React20.createElement(
661
+ import_editor_controls11.EqualUnequalSizesControl,
662
+ {
663
+ label: (0, import_i18n5.__)("Border Width", "elementor"),
664
+ icon: /* @__PURE__ */ React20.createElement(import_icons4.SideAllIcon, { fontSize: "tiny" }),
665
+ items: edges,
666
+ multiSizeType: "border-width"
667
+ }
668
+ ));
893
669
  };
894
670
 
895
- // src/components/style-sections/typography-section/font-weight-control.tsx
896
- var React24 = __toESM(require("react"));
897
- var import_i18n6 = require("@wordpress/i18n");
898
- var import_ui18 = require("@elementor/ui");
899
- var fontWeightOptions = [
900
- { label: (0, import_i18n6.__)("Light - 400", "elementor"), value: "400" },
901
- { label: (0, import_i18n6.__)("Regular - 500", "elementor"), value: "500" },
902
- { label: (0, import_i18n6.__)("Semi Bold - 600", "elementor"), value: "600" },
903
- { label: (0, import_i18n6.__)("Bold - 700", "elementor"), value: "700" },
904
- { label: (0, import_i18n6.__)("Black - 900", "elementor"), value: "900" }
905
- ];
906
- var FontWeightControl = () => {
907
- return /* @__PURE__ */ React24.createElement(StyleControl, { bind: "font-weight" }, /* @__PURE__ */ React24.createElement(import_ui18.Grid, { container: true, spacing: 1, alignItems: "center" }, /* @__PURE__ */ React24.createElement(import_ui18.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React24.createElement(StyleControl.Label, null, (0, import_i18n6.__)("Font Weight", "elementor"))), /* @__PURE__ */ React24.createElement(import_ui18.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React24.createElement(SelectControl, { options: fontWeightOptions }))));
671
+ // src/components/style-sections/border-section/border-field.tsx
672
+ var initialSize = { $$type: "size", value: { size: 1, unit: "px" } };
673
+ var initialBorderWidth = {
674
+ $$type: "border-width",
675
+ value: { top: initialSize, right: initialSize, bottom: initialSize, left: initialSize }
676
+ };
677
+ var initialBorderColor = { $$type: "color", value: "#000000" };
678
+ var initialBorderStyle = "solid";
679
+ var BorderField = () => {
680
+ const [borderWidth, setBorderWidth] = useStylesField("border-width");
681
+ const [borderColor, setBorderColor] = useStylesField("border-color");
682
+ const [borderStyle, setBorderStyle] = useStylesField("border-style");
683
+ const addBorder = () => {
684
+ setBorderWidth(initialBorderWidth);
685
+ setBorderColor(initialBorderColor);
686
+ setBorderStyle(initialBorderStyle);
687
+ };
688
+ const removeBorder = () => {
689
+ setBorderWidth(null);
690
+ setBorderColor(null);
691
+ setBorderStyle(null);
692
+ };
693
+ const hasBorder = Boolean(borderWidth || borderColor || borderStyle);
694
+ return /* @__PURE__ */ React21.createElement(
695
+ AddOrRemoveContent,
696
+ {
697
+ label: (0, import_i18n6.__)("Border", "elementor"),
698
+ isAdded: hasBorder,
699
+ onAdd: addBorder,
700
+ onRemove: removeBorder
701
+ },
702
+ /* @__PURE__ */ React21.createElement(BorderWidthField, null),
703
+ /* @__PURE__ */ React21.createElement(BorderColorField, null),
704
+ /* @__PURE__ */ React21.createElement(BorderStyleField, null)
705
+ );
908
706
  };
909
707
 
910
- // src/components/style-sections/typography-section/text-color-control.tsx
911
- var React26 = __toESM(require("react"));
708
+ // src/components/style-sections/border-section/border-radius-field.tsx
709
+ var React22 = __toESM(require("react"));
710
+ var import_editor_controls12 = require("@elementor/editor-controls");
711
+ var import_icons5 = require("@elementor/icons");
912
712
  var import_i18n7 = require("@wordpress/i18n");
913
- var import_ui20 = require("@elementor/ui");
914
-
915
- // src/controls/control-types/color-control.tsx
916
- var React25 = __toESM(require("react"));
917
- var import_ui19 = require("@elementor/ui");
918
- var ColorControl = createControl(
919
- (props) => {
920
- const { value, setValue } = useControl();
921
- const handleChange = (selectedColor) => {
922
- setValue({
923
- $$type: "color",
924
- value: selectedColor
925
- });
926
- };
927
- return /* @__PURE__ */ React25.createElement(ControlActions, null, /* @__PURE__ */ React25.createElement(import_ui19.UnstableColorPicker, { size: "tiny", ...props, value: value?.value, onChange: handleChange }));
713
+ var corners = [
714
+ {
715
+ label: (0, import_i18n7.__)("Top Left", "elementor"),
716
+ icon: /* @__PURE__ */ React22.createElement(import_icons5.RadiusTopLeftIcon, { fontSize: "tiny" }),
717
+ bind: "top-left"
718
+ },
719
+ {
720
+ label: (0, import_i18n7.__)("Top Right", "elementor"),
721
+ icon: /* @__PURE__ */ React22.createElement(import_icons5.RadiusTopRightIcon, { fontSize: "tiny" }),
722
+ bind: "top-right"
723
+ },
724
+ {
725
+ label: (0, import_i18n7.__)("Bottom Right", "elementor"),
726
+ icon: /* @__PURE__ */ React22.createElement(import_icons5.RadiusBottomRightIcon, { fontSize: "tiny" }),
727
+ bind: "bottom-right"
728
+ },
729
+ {
730
+ label: (0, import_i18n7.__)("Bottom Left", "elementor"),
731
+ icon: /* @__PURE__ */ React22.createElement(import_icons5.RadiusBottomLeftIcon, { fontSize: "tiny" }),
732
+ bind: "bottom-left"
928
733
  }
929
- );
734
+ ];
735
+ var BorderRadiusField = () => {
736
+ return /* @__PURE__ */ React22.createElement(StylesField, { bind: "border-radius" }, /* @__PURE__ */ React22.createElement(
737
+ import_editor_controls12.EqualUnequalSizesControl,
738
+ {
739
+ label: (0, import_i18n7.__)("Border Radius", "elementor"),
740
+ icon: /* @__PURE__ */ React22.createElement(import_icons5.BorderCornersIcon, { fontSize: "tiny" }),
741
+ items: corners,
742
+ multiSizeType: "border-radius"
743
+ }
744
+ ));
745
+ };
746
+
747
+ // src/components/style-sections/border-section/border-section.tsx
748
+ var BorderSection = () => /* @__PURE__ */ React23.createElement(import_ui15.Stack, { gap: 1.5 }, /* @__PURE__ */ React23.createElement(BorderRadiusField, null), /* @__PURE__ */ React23.createElement(import_ui15.Divider, null), /* @__PURE__ */ React23.createElement(BorderField, null));
930
749
 
931
- // src/components/style-sections/typography-section/text-color-control.tsx
932
- var TextColorControl = () => {
933
- return /* @__PURE__ */ React26.createElement(StyleControl, { bind: "color" }, /* @__PURE__ */ React26.createElement(import_ui20.Grid, { container: true, spacing: 1, alignItems: "center" }, /* @__PURE__ */ React26.createElement(import_ui20.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React26.createElement(StyleControl.Label, null, (0, import_i18n7.__)("Text Color", "elementor"))), /* @__PURE__ */ React26.createElement(import_ui20.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React26.createElement(ColorControl, null))));
750
+ // src/components/style-sections/effects-section/effects-section.tsx
751
+ var React24 = __toESM(require("react"));
752
+ var import_editor_controls13 = require("@elementor/editor-controls");
753
+ var import_ui16 = require("@elementor/ui");
754
+ var EffectsSection = () => {
755
+ return /* @__PURE__ */ React24.createElement(import_ui16.Stack, { gap: 1.5 }, /* @__PURE__ */ React24.createElement(StylesField, { bind: "box-shadow" }, /* @__PURE__ */ React24.createElement(import_editor_controls13.BoxShadowRepeaterControl, null)));
934
756
  };
935
757
 
936
- // src/components/style-sections/typography-section/letter-spacing-control.tsx
758
+ // src/components/style-sections/layout-section/layout-section.tsx
937
759
  var React27 = __toESM(require("react"));
760
+ var import_ui20 = require("@elementor/ui");
761
+
762
+ // src/components/style-sections/layout-section/display-field.tsx
763
+ var React25 = __toESM(require("react"));
764
+ var import_editor_controls14 = require("@elementor/editor-controls");
765
+ var import_ui17 = require("@elementor/ui");
938
766
  var import_i18n8 = require("@wordpress/i18n");
939
- var import_ui21 = require("@elementor/ui");
940
- var LetterSpacingControl = () => {
941
- return /* @__PURE__ */ React27.createElement(StyleControl, { bind: "letter-spacing" }, /* @__PURE__ */ React27.createElement(import_ui21.Grid, { container: true, spacing: 1, alignItems: "center" }, /* @__PURE__ */ React27.createElement(import_ui21.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React27.createElement(StyleControl.Label, null, (0, import_i18n8.__)("Letter Spacing", "elementor"))), /* @__PURE__ */ React27.createElement(import_ui21.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React27.createElement(SizeControl, null))));
767
+ var DisplayField = () => {
768
+ const options5 = [
769
+ {
770
+ value: "block",
771
+ renderContent: () => (0, import_i18n8.__)("Block", "elementor"),
772
+ label: (0, import_i18n8.__)("Block", "elementor")
773
+ },
774
+ {
775
+ value: "flex",
776
+ renderContent: () => (0, import_i18n8.__)("Flex", "elementor"),
777
+ label: (0, import_i18n8.__)("Flex", "elementor")
778
+ }
779
+ ];
780
+ return /* @__PURE__ */ React25.createElement(StylesField, { bind: "display" }, /* @__PURE__ */ React25.createElement(import_ui17.Stack, { gap: 1 }, /* @__PURE__ */ React25.createElement(import_editor_controls14.ControlLabel, null, (0, import_i18n8.__)("Display", "elementor")), /* @__PURE__ */ React25.createElement(import_editor_controls14.ToggleControl, { options: options5, fullWidth: true })));
942
781
  };
943
782
 
944
- // src/components/style-sections/typography-section/word-spacing-control.tsx
945
- var React28 = __toESM(require("react"));
783
+ // src/components/style-sections/layout-section/justify-content-field.tsx
784
+ var React26 = __toESM(require("react"));
785
+ var import_editor_controls15 = require("@elementor/editor-controls");
786
+ var import_icons6 = require("@elementor/icons");
787
+ var import_ui19 = require("@elementor/ui");
946
788
  var import_i18n9 = require("@wordpress/i18n");
947
- var import_ui22 = require("@elementor/ui");
948
- var WordSpacingControl = () => {
949
- return /* @__PURE__ */ React28.createElement(StyleControl, { bind: "word-spacing" }, /* @__PURE__ */ React28.createElement(import_ui22.Grid, { container: true, spacing: 1, alignItems: "center" }, /* @__PURE__ */ React28.createElement(import_ui22.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React28.createElement(StyleControl.Label, null, (0, import_i18n9.__)("Word Spacing", "elementor"))), /* @__PURE__ */ React28.createElement(import_ui22.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React28.createElement(SizeControl, null))));
950
- };
951
789
 
952
- // src/components/collapsible-content.tsx
953
- var React29 = __toESM(require("react"));
954
- var import_react9 = require("react");
955
- var import_icons4 = require("@elementor/icons");
956
- var import_ui23 = require("@elementor/ui");
957
- var import_i18n10 = require("@wordpress/i18n");
958
- var CollapsibleContent = ({ children, defaultOpen = false }) => {
959
- const [open, setOpen] = (0, import_react9.useState)(defaultOpen);
960
- const handleToggle = () => {
961
- setOpen((prevOpen) => !prevOpen);
790
+ // src/hooks/use-direction.ts
791
+ var import_ui18 = require("@elementor/ui");
792
+ function useDirection() {
793
+ const theme = (0, import_ui18.useTheme)(), extendedWindow = window;
794
+ const isUiRtl = "rtl" === theme.direction, isSiteRtl = !!extendedWindow.elementorFrontend?.config?.is_rtl;
795
+ return { isSiteRtl, isUiRtl };
796
+ }
797
+
798
+ // src/components/style-sections/layout-section/utils/rotate-flex-icon.ts
799
+ function rotateFlexIcon(direction = "row", initValue) {
800
+ const rotationIndexMap = {
801
+ row: 0,
802
+ column: 1,
803
+ "row-reverse": 2,
804
+ "column-reverse": 3
962
805
  };
963
- return /* @__PURE__ */ React29.createElement(import_ui23.Stack, { sx: { py: 0.5 } }, /* @__PURE__ */ React29.createElement(
964
- import_ui23.Button,
806
+ const rotationIndex = initValue + (rotationIndexMap[direction || "row"] ?? 0);
807
+ return `rotate(calc(90deg * ${rotationIndex}))`;
808
+ }
809
+
810
+ // src/components/style-sections/layout-section/justify-content-field.tsx
811
+ var JustifyContentField = () => {
812
+ const [direction] = useStylesField("flex-direction");
813
+ const { isUiRtl, isSiteRtl } = useDirection(), sx = { transform: rotateFlexIcon(direction, -1) }, shouldReverseOrder = isSiteRtl !== isUiRtl;
814
+ const StartIcon = isSiteRtl ? import_icons6.JustifyBottomIcon : import_icons6.JustifyTopIcon, EndIcon = isSiteRtl ? import_icons6.JustifyTopIcon : import_icons6.JustifyBottomIcon;
815
+ const options5 = [
965
816
  {
966
- fullWidth: true,
967
- size: "small",
968
- color: "secondary",
969
- variant: "outlined",
970
- onClick: handleToggle,
971
- endIcon: /* @__PURE__ */ React29.createElement(ChevronIcon, { open })
817
+ value: "start",
818
+ label: (0, import_i18n9.__)("Start", "elementor"),
819
+ renderContent: ({ size }) => /* @__PURE__ */ React26.createElement(StartIcon, { fontSize: size, sx }),
820
+ showTooltip: true
972
821
  },
973
- open ? (0, import_i18n10.__)("Show less", "elementor") : (0, import_i18n10.__)("Show more", "elementor")
974
- ), /* @__PURE__ */ React29.createElement(import_ui23.Collapse, { in: open, timeout: "auto" }, children));
822
+ {
823
+ value: "center",
824
+ label: (0, import_i18n9.__)("Center", "elementor"),
825
+ renderContent: ({ size }) => /* @__PURE__ */ React26.createElement(import_icons6.JustifyCenterIcon, { fontSize: size, sx }),
826
+ showTooltip: true
827
+ },
828
+ {
829
+ value: "end",
830
+ label: (0, import_i18n9.__)("End", "elementor"),
831
+ renderContent: ({ size }) => /* @__PURE__ */ React26.createElement(EndIcon, { fontSize: size, sx }),
832
+ showTooltip: true
833
+ },
834
+ {
835
+ value: "space-between",
836
+ label: (0, import_i18n9.__)("Space Between", "elementor"),
837
+ renderContent: ({ size }) => /* @__PURE__ */ React26.createElement(import_icons6.JustifySpaceBetweenVerticalIcon, { fontSize: size, sx }),
838
+ showTooltip: true
839
+ },
840
+ {
841
+ value: "space-around",
842
+ label: (0, import_i18n9.__)("Space Around", "elementor"),
843
+ renderContent: ({ size }) => /* @__PURE__ */ React26.createElement(import_icons6.JustifySpaceAroundVerticalIcon, { fontSize: size, sx }),
844
+ showTooltip: true
845
+ },
846
+ {
847
+ value: "space-evenly",
848
+ label: (0, import_i18n9.__)("Space Evenly", "elementor"),
849
+ renderContent: ({ size }) => /* @__PURE__ */ React26.createElement(import_icons6.JustifyDistributeVerticalIcon, { fontSize: size, sx }),
850
+ showTooltip: true
851
+ }
852
+ ];
853
+ if (shouldReverseOrder) {
854
+ options5.reverse();
855
+ }
856
+ return /* @__PURE__ */ React26.createElement(StylesField, { bind: "justify-content" }, /* @__PURE__ */ React26.createElement(import_ui19.Stack, { gap: 1 }, /* @__PURE__ */ React26.createElement(import_editor_controls15.ControlLabel, null, (0, import_i18n9.__)("Justify Content", "elementor")), /* @__PURE__ */ React26.createElement(import_editor_controls15.ToggleControl, { options: options5, fullWidth: true })));
975
857
  };
976
- var ChevronIcon = (0, import_ui23.styled)(import_icons4.ChevronDownIcon, {
977
- shouldForwardProp: (prop) => prop !== "open"
978
- })(({ theme, open }) => ({
979
- transform: open ? "rotate(180deg)" : "rotate(0)",
980
- transition: theme.transitions.create("transform", {
981
- duration: theme.transitions.duration.standard
982
- })
983
- }));
984
858
 
985
- // src/components/style-sections/typography-section/transform-control.tsx
986
- var React32 = __toESM(require("react"));
987
- var import_i18n11 = require("@wordpress/i18n");
988
- var import_ui25 = require("@elementor/ui");
989
- var import_icons5 = require("@elementor/icons");
859
+ // src/components/style-sections/layout-section/layout-section.tsx
860
+ var LayoutSection = () => {
861
+ const [display] = useStylesField("display");
862
+ return /* @__PURE__ */ React27.createElement(import_ui20.Stack, { gap: 2 }, /* @__PURE__ */ React27.createElement(DisplayField, null), "flex" === display && /* @__PURE__ */ React27.createElement(JustifyContentField, null));
863
+ };
990
864
 
991
- // src/controls/control-types/toggle-control.tsx
865
+ // src/components/style-sections/position-section/position-section.tsx
992
866
  var React31 = __toESM(require("react"));
993
-
994
- // src/controls/components/control-toggle-button-group.tsx
995
- var React30 = __toESM(require("react"));
867
+ var import_react9 = require("react");
996
868
  var import_ui24 = require("@elementor/ui");
997
- var StyledToggleButtonGroup = (0, import_ui24.styled)(import_ui24.ToggleButtonGroup)`
998
- ${({ justify }) => `justify-content: ${justify};`}
999
- `;
1000
- var ControlToggleButtonGroup = ({
1001
- justify = "end",
1002
- size = "tiny",
1003
- value,
1004
- onChange,
1005
- items,
1006
- exclusive = false
1007
- }) => {
1008
- const handleChange = (_, newValue) => {
1009
- onChange(newValue);
1010
- };
1011
- return /* @__PURE__ */ React30.createElement(StyledToggleButtonGroup, { justify, value, onChange: handleChange, exclusive }, items.map(({ label, value: buttonValue, icon: Icon }) => /* @__PURE__ */ React30.createElement(import_ui24.ToggleButton, { key: buttonValue, value: buttonValue, "aria-label": label, size }, /* @__PURE__ */ React30.createElement(Icon, { fontSize: size }))));
869
+
870
+ // src/hooks/use-style-prop-history.ts
871
+ var import_react8 = require("react");
872
+ var import_editor_elements4 = require("@elementor/editor-elements");
873
+
874
+ // src/hooks/use-prop-value-history.ts
875
+ var import_react7 = require("react");
876
+ var import_utils2 = require("@elementor/utils");
877
+ var PROPS_VALUES_HISTORY_PREFIX = "elementor/editor-editing-panel/prop-value-history";
878
+ var usePropValueHistory = () => {
879
+ const { element } = useElement();
880
+ const elementKey = `${PROPS_VALUES_HISTORY_PREFIX}/${element.id}`;
881
+ const getElementPropsHistory = (0, import_react7.useCallback)(() => {
882
+ return (0, import_utils2.getSessionStorageItem)(elementKey);
883
+ }, [elementKey]);
884
+ const getPropValue = (0, import_react7.useCallback)(
885
+ (propKey) => {
886
+ const elementPropValues = getElementPropsHistory();
887
+ return elementPropValues?.[propKey] ?? null;
888
+ },
889
+ [getElementPropsHistory]
890
+ );
891
+ const setPropValue = (0, import_react7.useCallback)(
892
+ (propKey, propValue) => {
893
+ const elementPropValues = getElementPropsHistory();
894
+ const updatedElementPropValues = { ...elementPropValues, [propKey]: propValue };
895
+ (0, import_utils2.setSessionStorageItem)(elementKey, updatedElementPropValues);
896
+ },
897
+ [getElementPropsHistory, elementKey]
898
+ );
899
+ const removeProp = (0, import_react7.useCallback)(
900
+ (propKey) => {
901
+ const elementPropValues = getElementPropsHistory();
902
+ const updatedElementPropValues = Object.fromEntries(
903
+ Object.entries(elementPropValues || {}).filter(([key]) => key !== propKey)
904
+ );
905
+ (0, import_utils2.setSessionStorageItem)(elementKey, updatedElementPropValues);
906
+ },
907
+ [getElementPropsHistory, elementKey]
908
+ );
909
+ return (0, import_react7.useMemo)(() => ({ getPropValue, setPropValue, removeProp }), [getPropValue, removeProp, setPropValue]);
1012
910
  };
1013
911
 
1014
- // src/controls/control-types/toggle-control.tsx
1015
- var ToggleControl = createControl(({ options: options4 }) => {
1016
- const { value, setValue } = useControl();
1017
- const handleToggle = (option) => {
1018
- setValue(option || void 0);
1019
- };
1020
- return /* @__PURE__ */ React31.createElement(
1021
- ControlToggleButtonGroup,
1022
- {
1023
- items: options4,
1024
- value: value || null,
1025
- onChange: handleToggle,
1026
- exclusive: true
912
+ // src/hooks/use-style-prop-history.ts
913
+ var useStylePropsHistory = (props) => {
914
+ const { element } = useElement();
915
+ const { id: styleDefID, meta } = useStyle();
916
+ const { getPropValue, setPropValue, removeProp } = usePropValueHistory();
917
+ const styleDef = (0, import_editor_elements4.getElementStyles)(element.id)?.[styleDefID];
918
+ const styleVariant = styleDef ? (0, import_editor_elements4.getVariantByMeta)(styleDef, meta) : null;
919
+ const styleVariantPath = `${styleDefID}-${styleVariant?.meta.breakpoint}-${styleVariant?.meta.state}`;
920
+ const saveStylePropsHistory = (0, import_react8.useCallback)(() => {
921
+ props.forEach((propKey) => {
922
+ const propValue = styleVariant?.props[propKey];
923
+ if (propValue) {
924
+ const propPath = `${styleVariantPath}-${propKey}`;
925
+ setPropValue(propPath, propValue);
926
+ }
927
+ });
928
+ }, [props, setPropValue, styleVariant?.props, styleVariantPath]);
929
+ const updateStylePropsFromHistory = (0, import_react8.useCallback)(() => {
930
+ const propValuesFromHistory = props.reduce((allProps, currentPropKey) => {
931
+ const propPath = `${styleVariantPath}-${currentPropKey}`;
932
+ const propHistory = getPropValue(propPath);
933
+ if (propHistory) {
934
+ removeProp(propPath);
935
+ return { ...allProps, [currentPropKey]: propHistory };
936
+ }
937
+ return allProps;
938
+ }, {});
939
+ if (Object.keys(propValuesFromHistory).length) {
940
+ (0, import_editor_elements4.updateStyle)({
941
+ elementID: element.id,
942
+ styleDefID,
943
+ meta,
944
+ props: propValuesFromHistory,
945
+ bind: "classes"
946
+ });
1027
947
  }
948
+ }, [element.id, getPropValue, meta, props, removeProp, styleDefID, styleVariantPath]);
949
+ const clearCurrentStyleProps = (0, import_react8.useCallback)(() => {
950
+ const resetValues = props.reduce(
951
+ (allProps, currentPropKey) => ({
952
+ ...allProps,
953
+ [currentPropKey]: void 0
954
+ }),
955
+ {}
956
+ );
957
+ (0, import_editor_elements4.updateStyle)({
958
+ elementID: element.id,
959
+ styleDefID,
960
+ meta,
961
+ props: resetValues,
962
+ bind: "classes"
963
+ });
964
+ }, [element.id, meta, props, styleDefID]);
965
+ return (0, import_react8.useMemo)(
966
+ () => ({ saveStylePropsHistory, updateStylePropsFromHistory, clearCurrentStyleProps }),
967
+ [saveStylePropsHistory, updateStylePropsFromHistory, clearCurrentStyleProps]
1028
968
  );
1029
- });
969
+ };
1030
970
 
1031
- // src/components/style-sections/typography-section/transform-control.tsx
1032
- var options = [
1033
- { value: "capitalize", label: (0, import_i18n11.__)("Capitalize", "elementor"), icon: import_icons5.LetterCaseIcon },
1034
- { value: "uppercase", label: (0, import_i18n11.__)("Uppercase", "elementor"), icon: import_icons5.LetterCaseUpperIcon },
1035
- { value: "lowercase", label: (0, import_i18n11.__)("Lowercase", "elementor"), icon: import_icons5.LetterCaseLowerIcon }
971
+ // src/components/style-sections/position-section/dimensions-field.tsx
972
+ var React28 = __toESM(require("react"));
973
+ var import_editor_controls16 = require("@elementor/editor-controls");
974
+ var import_icons7 = require("@elementor/icons");
975
+ var import_ui21 = require("@elementor/ui");
976
+ var import_i18n10 = require("@wordpress/i18n");
977
+ var sideIcons = {
978
+ left: /* @__PURE__ */ React28.createElement(import_icons7.SideLeftIcon, { fontSize: "tiny" }),
979
+ right: /* @__PURE__ */ React28.createElement(import_icons7.SideRightIcon, { fontSize: "tiny" }),
980
+ top: /* @__PURE__ */ React28.createElement(import_icons7.SideTopIcon, { fontSize: "tiny" }),
981
+ bottom: /* @__PURE__ */ React28.createElement(import_icons7.SideBottomIcon, { fontSize: "tiny" })
982
+ };
983
+ var DimensionsField = () => {
984
+ return /* @__PURE__ */ React28.createElement(React28.Fragment, null, /* @__PURE__ */ React28.createElement(import_ui21.Stack, { direction: "row", gap: 2, flexWrap: "nowrap" }, /* @__PURE__ */ React28.createElement(DimensionField, { side: "top", label: (0, import_i18n10.__)("Top", "elementor") }), /* @__PURE__ */ React28.createElement(DimensionField, { side: "right", label: (0, import_i18n10.__)("Right", "elementor") })), /* @__PURE__ */ React28.createElement(import_ui21.Stack, { direction: "row", gap: 2, flexWrap: "nowrap" }, /* @__PURE__ */ React28.createElement(DimensionField, { side: "bottom", label: (0, import_i18n10.__)("Bottom", "elementor") }), /* @__PURE__ */ React28.createElement(DimensionField, { side: "left", label: (0, import_i18n10.__)("Left", "elementor") })));
985
+ };
986
+ var DimensionField = ({ side, label }) => {
987
+ return /* @__PURE__ */ React28.createElement(import_ui21.Grid, { container: true, gap: 1, alignItems: "center" }, /* @__PURE__ */ React28.createElement(import_ui21.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React28.createElement(import_editor_controls16.ControlLabel, null, label)), /* @__PURE__ */ React28.createElement(import_ui21.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React28.createElement(StylesField, { bind: side }, /* @__PURE__ */ React28.createElement(import_editor_controls16.SizeControl, { startIcon: sideIcons[side] }))));
988
+ };
989
+
990
+ // src/components/style-sections/position-section/position-field.tsx
991
+ var React29 = __toESM(require("react"));
992
+ var import_editor_controls17 = require("@elementor/editor-controls");
993
+ var import_ui22 = require("@elementor/ui");
994
+ var import_i18n11 = require("@wordpress/i18n");
995
+ var positionOptions = [
996
+ { label: (0, import_i18n11.__)("Static", "elementor"), value: "static" },
997
+ { label: (0, import_i18n11.__)("Relative", "elementor"), value: "relative" },
998
+ { label: (0, import_i18n11.__)("Absolute", "elementor"), value: "absolute" },
999
+ { label: (0, import_i18n11.__)("Fixed", "elementor"), value: "fixed" }
1036
1000
  ];
1037
- var TransformControl = () => /* @__PURE__ */ React32.createElement(StyleControl, { bind: "text-transform" }, /* @__PURE__ */ React32.createElement(import_ui25.Grid, { container: true, spacing: 1, alignItems: "center" }, /* @__PURE__ */ React32.createElement(import_ui25.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React32.createElement(StyleControl.Label, null, (0, import_i18n11.__)("Transform", "elementor"))), /* @__PURE__ */ React32.createElement(import_ui25.Grid, { item: true, xs: 6, display: "flex", justifyContent: "end" }, /* @__PURE__ */ React32.createElement(ToggleControl, { options }))));
1001
+ var PositionField = () => {
1002
+ return /* @__PURE__ */ React29.createElement(StylesField, { bind: "position" }, /* @__PURE__ */ React29.createElement(import_ui22.Grid, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React29.createElement(import_ui22.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React29.createElement(import_editor_controls17.ControlLabel, null, (0, import_i18n11.__)("Position", "elementor"))), /* @__PURE__ */ React29.createElement(import_ui22.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React29.createElement(import_editor_controls17.SelectControl, { options: positionOptions }))));
1003
+ };
1038
1004
 
1039
- // src/components/style-sections/typography-section/text-alignment-control.tsx
1040
- var React33 = __toESM(require("react"));
1005
+ // src/components/style-sections/position-section/z-index-field.tsx
1006
+ var React30 = __toESM(require("react"));
1007
+ var import_editor_controls18 = require("@elementor/editor-controls");
1008
+ var import_ui23 = require("@elementor/ui");
1041
1009
  var import_i18n12 = require("@wordpress/i18n");
1010
+ var ZIndexField = () => {
1011
+ return /* @__PURE__ */ React30.createElement(StylesField, { bind: "z-index" }, /* @__PURE__ */ React30.createElement(import_ui23.Grid, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React30.createElement(import_ui23.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React30.createElement(import_editor_controls18.ControlLabel, null, (0, import_i18n12.__)("Z-Index", "elementor"))), /* @__PURE__ */ React30.createElement(import_ui23.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React30.createElement(import_editor_controls18.NumberControl, null))));
1012
+ };
1013
+
1014
+ // src/components/style-sections/position-section/position-section.tsx
1015
+ var dimensionsPropKeys = ["top", "bottom", "left", "right"];
1016
+ var PositionSection = () => {
1017
+ const [positionValue] = useStylesField("position");
1018
+ usePositionChangeHandler();
1019
+ const isNotStatic = positionValue && positionValue !== "static";
1020
+ return /* @__PURE__ */ React31.createElement(import_ui24.Stack, { gap: 1.5 }, /* @__PURE__ */ React31.createElement(PositionField, null), isNotStatic ? /* @__PURE__ */ React31.createElement(React31.Fragment, null, /* @__PURE__ */ React31.createElement(DimensionsField, null), /* @__PURE__ */ React31.createElement(ZIndexField, null)) : null);
1021
+ };
1022
+ var usePositionChangeHandler = () => {
1023
+ const dimensionsHistory = useStylePropsHistory(dimensionsPropKeys);
1024
+ const onPositionChange = (0, import_react9.useCallback)(
1025
+ (newPositionValue, previousPosition) => {
1026
+ if (!dimensionsHistory) {
1027
+ return;
1028
+ }
1029
+ const { saveStylePropsHistory, updateStylePropsFromHistory, clearCurrentStyleProps } = dimensionsHistory;
1030
+ if (newPositionValue === "static") {
1031
+ saveStylePropsHistory();
1032
+ clearCurrentStyleProps();
1033
+ } else if (previousPosition === "static") {
1034
+ updateStylePropsFromHistory();
1035
+ }
1036
+ previousPosition = newPositionValue;
1037
+ },
1038
+ [dimensionsHistory]
1039
+ );
1040
+ const [, , registerChangeListener] = useStylesField("position");
1041
+ registerChangeListener?.(onPositionChange);
1042
+ };
1043
+
1044
+ // src/components/style-sections/size-section/size-section.tsx
1045
+ var React33 = __toESM(require("react"));
1046
+ var import_editor_controls20 = require("@elementor/editor-controls");
1042
1047
  var import_ui26 = require("@elementor/ui");
1043
- var import_icons6 = require("@elementor/icons");
1044
- var options2 = [
1045
- {
1046
- value: "left",
1047
- label: (0, import_i18n12.__)("Left", "elementor"),
1048
- icon: import_icons6.AlignLeftIcon
1049
- },
1048
+ var import_i18n14 = require("@wordpress/i18n");
1049
+
1050
+ // src/components/style-sections/size-section/overflow-field.tsx
1051
+ var React32 = __toESM(require("react"));
1052
+ var import_editor_controls19 = require("@elementor/editor-controls");
1053
+ var import_icons8 = require("@elementor/icons");
1054
+ var import_ui25 = require("@elementor/ui");
1055
+ var import_i18n13 = require("@wordpress/i18n");
1056
+ var options = [
1050
1057
  {
1051
- value: "center",
1052
- label: (0, import_i18n12.__)("Center", "elementor"),
1053
- icon: import_icons6.AlignCenterIcon
1058
+ value: "visible",
1059
+ label: (0, import_i18n13.__)("Visible", "elementor"),
1060
+ renderContent: ({ size }) => /* @__PURE__ */ React32.createElement(import_icons8.EyeIcon, { fontSize: size }),
1061
+ showTooltip: true
1054
1062
  },
1055
1063
  {
1056
- value: "right",
1057
- label: (0, import_i18n12.__)("Right", "elementor"),
1058
- icon: import_icons6.AlignRightIcon
1064
+ value: "hidden",
1065
+ label: (0, import_i18n13.__)("Hidden", "elementor"),
1066
+ renderContent: ({ size }) => /* @__PURE__ */ React32.createElement(import_icons8.EyeOffIcon, { fontSize: size }),
1067
+ showTooltip: true
1059
1068
  },
1060
1069
  {
1061
- value: "justify",
1062
- label: (0, import_i18n12.__)("Justify", "elementor"),
1063
- icon: import_icons6.AlignJustifiedIcon
1070
+ value: "auto",
1071
+ label: (0, import_i18n13.__)("Auto", "elementor"),
1072
+ renderContent: ({ size }) => /* @__PURE__ */ React32.createElement(import_icons8.ExpandBottomIcon, { fontSize: size }),
1073
+ showTooltip: true
1064
1074
  }
1065
1075
  ];
1066
- var TextAlignmentControl = () => {
1067
- return /* @__PURE__ */ React33.createElement(StyleControl, { bind: "text-align" }, /* @__PURE__ */ React33.createElement(import_ui26.Grid, { container: true, spacing: 1, alignItems: "center" }, /* @__PURE__ */ React33.createElement(import_ui26.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React33.createElement(StyleControl.Label, null, (0, import_i18n12.__)("Alignment", "elementor"))), /* @__PURE__ */ React33.createElement(import_ui26.Grid, { item: true, xs: 6, display: "flex", justifyContent: "end" }, /* @__PURE__ */ React33.createElement(ToggleControl, { options: options2 }))));
1076
+ var OverflowField = () => {
1077
+ return /* @__PURE__ */ React32.createElement(StylesField, { bind: "overflow" }, /* @__PURE__ */ React32.createElement(import_ui25.Grid, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React32.createElement(import_ui25.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React32.createElement(import_editor_controls19.ControlLabel, null, (0, import_i18n13.__)("Overflow", "elementor"))), /* @__PURE__ */ React32.createElement(import_ui25.Grid, { item: true, xs: 6, sx: { display: "flex", justifyContent: "flex-end" } }, /* @__PURE__ */ React32.createElement(import_editor_controls19.ToggleControl, { options }))));
1068
1078
  };
1069
1079
 
1070
- // src/components/style-sections/typography-section/text-direction-control.tsx
1080
+ // src/components/style-sections/size-section/size-section.tsx
1081
+ var SizeSection = () => {
1082
+ return /* @__PURE__ */ React33.createElement(import_ui26.Stack, { gap: 1.5 }, /* @__PURE__ */ React33.createElement(import_ui26.Grid, { container: true, gap: 2, flexWrap: "nowrap" }, /* @__PURE__ */ React33.createElement(import_ui26.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React33.createElement(SizeField, { bind: "width", label: (0, import_i18n14.__)("Width", "elementor") })), /* @__PURE__ */ React33.createElement(import_ui26.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React33.createElement(SizeField, { bind: "height", label: (0, import_i18n14.__)("Height", "elementor") }))), /* @__PURE__ */ React33.createElement(import_ui26.Grid, { container: true, gap: 2, flexWrap: "nowrap" }, /* @__PURE__ */ React33.createElement(import_ui26.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React33.createElement(SizeField, { bind: "min-width", label: (0, import_i18n14.__)("Min. Width", "elementor") })), /* @__PURE__ */ React33.createElement(import_ui26.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React33.createElement(SizeField, { bind: "min-height", label: (0, import_i18n14.__)("Min. Height", "elementor") }))), /* @__PURE__ */ React33.createElement(import_ui26.Grid, { container: true, gap: 2, flexWrap: "nowrap" }, /* @__PURE__ */ React33.createElement(import_ui26.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React33.createElement(SizeField, { bind: "max-width", label: (0, import_i18n14.__)("Max. Width", "elementor") })), /* @__PURE__ */ React33.createElement(import_ui26.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React33.createElement(SizeField, { bind: "max-height", label: (0, import_i18n14.__)("Max. Height", "elementor") }))), /* @__PURE__ */ React33.createElement(import_ui26.Divider, null), /* @__PURE__ */ React33.createElement(import_ui26.Stack, null, /* @__PURE__ */ React33.createElement(OverflowField, null)));
1083
+ };
1084
+ var SizeField = ({ label, bind }) => {
1085
+ return /* @__PURE__ */ React33.createElement(StylesField, { bind }, /* @__PURE__ */ React33.createElement(import_ui26.Grid, { container: true, gap: 1, alignItems: "center" }, /* @__PURE__ */ React33.createElement(import_ui26.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React33.createElement(import_editor_controls20.ControlLabel, null, label)), /* @__PURE__ */ React33.createElement(import_ui26.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React33.createElement(import_editor_controls20.SizeControl, null))));
1086
+ };
1087
+
1088
+ // src/components/style-sections/spacing-section/spacing-section.tsx
1071
1089
  var React34 = __toESM(require("react"));
1072
- var import_i18n13 = require("@wordpress/i18n");
1090
+ var import_editor_controls21 = require("@elementor/editor-controls");
1073
1091
  var import_ui27 = require("@elementor/ui");
1074
- var import_icons7 = require("@elementor/icons");
1075
- var options3 = [
1076
- {
1077
- value: "ltr",
1078
- label: (0, import_i18n13.__)("Left to Right", "elementor"),
1079
- icon: import_icons7.TextDirectionLtrIcon
1080
- },
1081
- {
1082
- value: "rtl",
1083
- label: (0, import_i18n13.__)("Right to Left", "elementor"),
1084
- icon: import_icons7.TextDirectionRtlIcon
1085
- }
1086
- ];
1087
- var TextDirectionControl = () => {
1088
- return /* @__PURE__ */ React34.createElement(StyleControl, { bind: "direction" }, /* @__PURE__ */ React34.createElement(import_ui27.Grid, { container: true, spacing: 1, alignItems: "center" }, /* @__PURE__ */ React34.createElement(import_ui27.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React34.createElement(StyleControl.Label, null, (0, import_i18n13.__)("Direction", "elementor"))), /* @__PURE__ */ React34.createElement(import_ui27.Grid, { item: true, xs: 6, display: "flex", justifyContent: "end" }, /* @__PURE__ */ React34.createElement(ToggleControl, { options: options3 }))));
1092
+ var import_i18n15 = require("@wordpress/i18n");
1093
+ var SpacingSection = () => {
1094
+ return /* @__PURE__ */ React34.createElement(import_ui27.Stack, { gap: 1.5 }, /* @__PURE__ */ React34.createElement(StylesField, { bind: "padding" }, /* @__PURE__ */ React34.createElement(import_editor_controls21.LinkedDimensionsControl, { label: (0, import_i18n15.__)("Padding", "elementor") })), /* @__PURE__ */ React34.createElement(import_ui27.Divider, null), /* @__PURE__ */ React34.createElement(StylesField, { bind: "margin" }, /* @__PURE__ */ React34.createElement(import_editor_controls21.LinkedDimensionsControl, { label: (0, import_i18n15.__)("Margin", "elementor") })));
1089
1095
  };
1090
1096
 
1091
1097
  // src/components/style-sections/typography-section/typography-section.tsx
1092
- var TypographySection = () => {
1093
- return /* @__PURE__ */ React35.createElement(AccordionSection, { title: (0, import_i18n14.__)("Typography", "elementor") }, /* @__PURE__ */ React35.createElement(import_ui28.Stack, { gap: 1.5 }, /* @__PURE__ */ React35.createElement(FontWeightControl, null), /* @__PURE__ */ React35.createElement(FontSizeControl, null), /* @__PURE__ */ React35.createElement(import_ui28.Divider, null), /* @__PURE__ */ React35.createElement(TextColorControl, null), /* @__PURE__ */ React35.createElement(CollapsibleContent, null, /* @__PURE__ */ React35.createElement(import_ui28.Stack, { gap: 1.5, sx: { pt: 1.5 } }, /* @__PURE__ */ React35.createElement(LetterSpacingControl, null), /* @__PURE__ */ React35.createElement(WordSpacingControl, null), /* @__PURE__ */ React35.createElement(import_ui28.Divider, null), /* @__PURE__ */ React35.createElement(TextAlignmentControl, null), /* @__PURE__ */ React35.createElement(TextStyleControl, null), /* @__PURE__ */ React35.createElement(TransformControl, null), /* @__PURE__ */ React35.createElement(TextDirectionControl, null)))));
1094
- };
1095
-
1096
- // src/components/style-sections/position-section/position-section.tsx
1097
- var React38 = __toESM(require("react"));
1098
- var import_ui31 = require("@elementor/ui");
1098
+ var React48 = __toESM(require("react"));
1099
+ var import_ui40 = require("@elementor/ui");
1099
1100
 
1100
- // src/components/style-sections/position-section/z-index-control.tsx
1101
- var React37 = __toESM(require("react"));
1102
- var import_i18n15 = require("@wordpress/i18n");
1103
- var import_ui30 = require("@elementor/ui");
1101
+ // src/components/collapsible-content.tsx
1102
+ var React35 = __toESM(require("react"));
1103
+ var import_react10 = require("react");
1104
+ var import_ui28 = require("@elementor/ui");
1105
+ var import_i18n16 = require("@wordpress/i18n");
1106
+ var CollapsibleContent = ({ children, defaultOpen = false }) => {
1107
+ const [open, setOpen] = (0, import_react10.useState)(defaultOpen);
1108
+ const handleToggle = () => {
1109
+ setOpen((prevOpen) => !prevOpen);
1110
+ };
1111
+ return /* @__PURE__ */ React35.createElement(import_ui28.Stack, { sx: { py: 0.5 } }, /* @__PURE__ */ React35.createElement(
1112
+ import_ui28.Button,
1113
+ {
1114
+ fullWidth: true,
1115
+ size: "small",
1116
+ color: "secondary",
1117
+ variant: "outlined",
1118
+ onClick: handleToggle,
1119
+ endIcon: /* @__PURE__ */ React35.createElement(CollapseIcon, { open })
1120
+ },
1121
+ open ? (0, import_i18n16.__)("Show less", "elementor") : (0, import_i18n16.__)("Show more", "elementor")
1122
+ ), /* @__PURE__ */ React35.createElement(import_ui28.Collapse, { in: open, timeout: "auto", unmountOnExit: true }, children));
1123
+ };
1104
1124
 
1105
- // src/controls/control-types/number-control.tsx
1125
+ // src/components/style-sections/typography-section/font-family-field.tsx
1106
1126
  var React36 = __toESM(require("react"));
1127
+ var import_editor_controls22 = require("@elementor/editor-controls");
1107
1128
  var import_ui29 = require("@elementor/ui");
1108
- var isEmptyOrNaN = (value) => value === void 0 || value === "" || Number.isNaN(Number(value));
1109
- var NumberControl = createControl(({ placeholder }) => {
1110
- const { value, setValue } = useControl();
1111
- const handleChange = (event) => {
1112
- const eventValue = event.target.value;
1113
- setValue(isEmptyOrNaN(eventValue) ? void 0 : Number(eventValue));
1114
- };
1115
- return /* @__PURE__ */ React36.createElement(ControlActions, null, /* @__PURE__ */ React36.createElement(
1116
- import_ui29.TextField,
1117
- {
1118
- size: "tiny",
1119
- type: "number",
1120
- value: isEmptyOrNaN(value) ? "" : value,
1121
- onChange: handleChange,
1122
- placeholder
1123
- }
1124
- ));
1125
- });
1129
+ var import_i18n17 = require("@wordpress/i18n");
1126
1130
 
1127
- // src/components/style-sections/position-section/z-index-control.tsx
1128
- var ZIndexControl = () => {
1129
- return /* @__PURE__ */ React37.createElement(StyleControl, { bind: "z-index" }, /* @__PURE__ */ React37.createElement(import_ui30.Grid, { container: true, spacing: 1, alignItems: "center" }, /* @__PURE__ */ React37.createElement(import_ui30.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React37.createElement(StyleControl.Label, null, (0, import_i18n15.__)("Z-Index", "elementor"))), /* @__PURE__ */ React37.createElement(import_ui30.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React37.createElement(NumberControl, null))));
1131
+ // src/sync/get-elementor-config.ts
1132
+ var getElementorConfig = () => {
1133
+ const extendedWindow = window;
1134
+ return extendedWindow.elementor?.config ?? {};
1130
1135
  };
1131
1136
 
1132
- // src/components/style-sections/position-section/position-section.tsx
1133
- var import_i18n16 = require("@wordpress/i18n");
1134
- var PositionSection = () => {
1135
- return /* @__PURE__ */ React38.createElement(AccordionSection, { title: (0, import_i18n16.__)("Position", "elementor") }, /* @__PURE__ */ React38.createElement(import_ui31.Stack, { gap: 1.5 }, /* @__PURE__ */ React38.createElement(ZIndexControl, null)));
1137
+ // src/components/style-sections/typography-section/font-family-field.tsx
1138
+ var FontFamilyField = () => {
1139
+ const fontFamilies = getFontFamilies();
1140
+ if (!fontFamilies) {
1141
+ return null;
1142
+ }
1143
+ return /* @__PURE__ */ React36.createElement(StylesField, { bind: "font-family" }, /* @__PURE__ */ React36.createElement(import_ui29.Grid, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React36.createElement(import_ui29.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React36.createElement(import_editor_controls22.ControlLabel, null, (0, import_i18n17.__)("Font Family", "elementor"))), /* @__PURE__ */ React36.createElement(import_ui29.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React36.createElement(import_editor_controls22.FontFamilyControl, { fontFamilies }))));
1144
+ };
1145
+ var getFontFamilies = () => {
1146
+ const { controls } = getElementorConfig();
1147
+ const options5 = controls?.font?.options;
1148
+ if (!options5) {
1149
+ return null;
1150
+ }
1151
+ return options5;
1136
1152
  };
1137
1153
 
1138
- // src/components/style-sections/spacing-section/spacing-section.tsx
1139
- var React40 = __toESM(require("react"));
1140
- var import_ui33 = require("@elementor/ui");
1154
+ // src/components/style-sections/typography-section/font-size-field.tsx
1155
+ var React37 = __toESM(require("react"));
1156
+ var import_editor_controls23 = require("@elementor/editor-controls");
1157
+ var import_ui30 = require("@elementor/ui");
1141
1158
  var import_i18n18 = require("@wordpress/i18n");
1159
+ var FontSizeField = () => {
1160
+ return /* @__PURE__ */ React37.createElement(StylesField, { bind: "font-size" }, /* @__PURE__ */ React37.createElement(import_ui30.Grid, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React37.createElement(import_ui30.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React37.createElement(import_editor_controls23.ControlLabel, null, (0, import_i18n18.__)("Font Size", "elementor"))), /* @__PURE__ */ React37.createElement(import_ui30.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React37.createElement(import_editor_controls23.SizeControl, null))));
1161
+ };
1162
+
1163
+ // src/components/style-sections/typography-section/font-weight-field.tsx
1164
+ var React38 = __toESM(require("react"));
1165
+ var import_editor_controls24 = require("@elementor/editor-controls");
1166
+ var import_ui31 = require("@elementor/ui");
1167
+ var import_i18n19 = require("@wordpress/i18n");
1168
+ var fontWeightOptions = [
1169
+ { label: (0, import_i18n19.__)("Light - 400", "elementor"), value: "400" },
1170
+ { label: (0, import_i18n19.__)("Regular - 500", "elementor"), value: "500" },
1171
+ { label: (0, import_i18n19.__)("Semi Bold - 600", "elementor"), value: "600" },
1172
+ { label: (0, import_i18n19.__)("Bold - 700", "elementor"), value: "700" },
1173
+ { label: (0, import_i18n19.__)("Black - 900", "elementor"), value: "900" }
1174
+ ];
1175
+ var FontWeightField = () => {
1176
+ return /* @__PURE__ */ React38.createElement(StylesField, { bind: "font-weight" }, /* @__PURE__ */ React38.createElement(import_ui31.Grid, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React38.createElement(import_ui31.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React38.createElement(import_editor_controls24.ControlLabel, null, (0, import_i18n19.__)("Font Weight", "elementor"))), /* @__PURE__ */ React38.createElement(import_ui31.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React38.createElement(import_editor_controls24.SelectControl, { options: fontWeightOptions }))));
1177
+ };
1142
1178
 
1143
- // src/components/style-sections/spacing-section/linked-dimensions-control.tsx
1179
+ // src/components/style-sections/typography-section/letter-spacing-field.tsx
1144
1180
  var React39 = __toESM(require("react"));
1145
- var import_i18n17 = require("@wordpress/i18n");
1181
+ var import_editor_controls25 = require("@elementor/editor-controls");
1146
1182
  var import_ui32 = require("@elementor/ui");
1147
- var import_icons8 = require("@elementor/icons");
1148
- var LinkedDimensionsControl = ({ label }) => {
1149
- const { value, setValue } = useControl();
1150
- const { top, right, bottom, left, isLinked = true } = value?.value || {};
1151
- const setLinkedValue = (position, newValue) => {
1152
- const updatedValue = {
1153
- isLinked,
1154
- top: isLinked ? newValue : top,
1155
- right: isLinked ? newValue : right,
1156
- bottom: isLinked ? newValue : bottom,
1157
- left: isLinked ? newValue : left,
1158
- [position]: newValue
1159
- };
1160
- setValue({
1161
- $$type: "linked-dimensions",
1162
- value: updatedValue
1163
- });
1164
- };
1165
- const toggleLinked = () => {
1166
- const updatedValue = {
1167
- isLinked: !isLinked,
1168
- top,
1169
- right: !isLinked ? top : right,
1170
- bottom: !isLinked ? top : bottom,
1171
- left: !isLinked ? top : left
1172
- };
1173
- setValue({
1174
- $$type: "linked-dimensions",
1175
- value: updatedValue
1176
- });
1177
- };
1178
- const LinkedIcon = isLinked ? import_icons8.LinkIcon : import_icons8.DetachIcon;
1179
- return /* @__PURE__ */ React39.createElement(React39.Fragment, null, /* @__PURE__ */ React39.createElement(import_ui32.Stack, { direction: "row", gap: 2 }, /* @__PURE__ */ React39.createElement(ControlLabel, null, label), /* @__PURE__ */ React39.createElement(
1180
- import_ui32.ToggleButton,
1181
- {
1182
- "aria-label": (0, import_i18n17.__)("Link Inputs", "elementor"),
1183
- size: "tiny",
1184
- value: "check",
1185
- selected: isLinked,
1186
- sx: { marginLeft: "auto" },
1187
- onChange: toggleLinked
1188
- },
1189
- /* @__PURE__ */ React39.createElement(LinkedIcon, { fontSize: "tiny" })
1190
- )), /* @__PURE__ */ React39.createElement(import_ui32.Stack, { direction: "row", gap: 2 }, /* @__PURE__ */ React39.createElement(import_ui32.Grid, { container: true, spacing: 1, alignItems: "center" }, /* @__PURE__ */ React39.createElement(import_ui32.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React39.createElement(ControlLabel, null, (0, import_i18n17.__)("Top", "elementor"))), /* @__PURE__ */ React39.createElement(import_ui32.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React39.createElement(
1191
- Control4,
1192
- {
1193
- bind: "top",
1194
- value: top,
1195
- setValue: setLinkedValue,
1196
- startIcon: /* @__PURE__ */ React39.createElement(import_icons8.SideTopIcon, { fontSize: "tiny" })
1197
- }
1198
- ))), /* @__PURE__ */ React39.createElement(import_ui32.Grid, { container: true, spacing: 1, alignItems: "center" }, /* @__PURE__ */ React39.createElement(import_ui32.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React39.createElement(ControlLabel, null, (0, import_i18n17.__)("Right", "elementor"))), /* @__PURE__ */ React39.createElement(import_ui32.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React39.createElement(
1199
- Control4,
1200
- {
1201
- bind: "right",
1202
- value: right,
1203
- setValue: setLinkedValue,
1204
- startIcon: /* @__PURE__ */ React39.createElement(import_icons8.SideRightIcon, { fontSize: "tiny" })
1205
- }
1206
- )))), /* @__PURE__ */ React39.createElement(import_ui32.Stack, { direction: "row", gap: 2 }, /* @__PURE__ */ React39.createElement(import_ui32.Grid, { container: true, spacing: 1, alignItems: "center" }, /* @__PURE__ */ React39.createElement(import_ui32.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React39.createElement(ControlLabel, null, (0, import_i18n17.__)("Bottom", "elementor"))), /* @__PURE__ */ React39.createElement(import_ui32.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React39.createElement(
1207
- Control4,
1208
- {
1209
- bind: "bottom",
1210
- value: bottom,
1211
- setValue: setLinkedValue,
1212
- startIcon: /* @__PURE__ */ React39.createElement(import_icons8.SideBottomIcon, { fontSize: "tiny" })
1213
- }
1214
- ))), /* @__PURE__ */ React39.createElement(import_ui32.Grid, { container: true, spacing: 1, alignItems: "center" }, /* @__PURE__ */ React39.createElement(import_ui32.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React39.createElement(ControlLabel, null, (0, import_i18n17.__)("Left", "elementor"))), /* @__PURE__ */ React39.createElement(import_ui32.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React39.createElement(
1215
- Control4,
1216
- {
1217
- bind: "left",
1218
- value: left,
1219
- setValue: setLinkedValue,
1220
- startIcon: /* @__PURE__ */ React39.createElement(import_icons8.SideLeftIcon, { fontSize: "tiny" })
1221
- }
1222
- )))));
1183
+ var import_i18n20 = require("@wordpress/i18n");
1184
+ var LetterSpacingField = () => {
1185
+ return /* @__PURE__ */ React39.createElement(StylesField, { bind: "letter-spacing" }, /* @__PURE__ */ React39.createElement(import_ui32.Grid, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React39.createElement(import_ui32.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React39.createElement(import_editor_controls25.ControlLabel, null, (0, import_i18n20.__)("Letter Spacing", "elementor"))), /* @__PURE__ */ React39.createElement(import_ui32.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React39.createElement(import_editor_controls25.SizeControl, null))));
1223
1186
  };
1224
- var Control4 = ({
1225
- bind,
1226
- startIcon,
1227
- value,
1228
- setValue
1229
- }) => /* @__PURE__ */ React39.createElement(
1230
- ControlContext.Provider,
1187
+
1188
+ // src/components/style-sections/typography-section/text-alignment-field.tsx
1189
+ var React40 = __toESM(require("react"));
1190
+ var import_editor_controls26 = require("@elementor/editor-controls");
1191
+ var import_icons9 = require("@elementor/icons");
1192
+ var import_ui33 = require("@elementor/ui");
1193
+ var import_i18n21 = require("@wordpress/i18n");
1194
+ var options2 = [
1231
1195
  {
1232
- value: {
1233
- bind,
1234
- setValue: (newValue) => setValue(bind, newValue),
1235
- value
1236
- }
1196
+ value: "left",
1197
+ label: (0, import_i18n21.__)("Left", "elementor"),
1198
+ renderContent: ({ size }) => /* @__PURE__ */ React40.createElement(import_icons9.AlignLeftIcon, { fontSize: size })
1237
1199
  },
1238
- /* @__PURE__ */ React39.createElement(SizeControl, { startIcon })
1239
- );
1240
-
1241
- // src/components/style-sections/spacing-section/spacing-section.tsx
1242
- var SpacingSection = () => {
1243
- return /* @__PURE__ */ React40.createElement(AccordionSection, { title: (0, import_i18n18.__)("Spacing", "elementor") }, /* @__PURE__ */ React40.createElement(import_ui33.Stack, { gap: 1.5 }, /* @__PURE__ */ React40.createElement(StyleControl, { bind: "padding" }, /* @__PURE__ */ React40.createElement(LinkedDimensionsControl, { label: (0, import_i18n18.__)("Padding", "elementor") })), /* @__PURE__ */ React40.createElement(import_ui33.Divider, null), /* @__PURE__ */ React40.createElement(StyleControl, { bind: "margin" }, /* @__PURE__ */ React40.createElement(LinkedDimensionsControl, { label: (0, import_i18n18.__)("Margin", "elementor") }))));
1200
+ {
1201
+ value: "center",
1202
+ label: (0, import_i18n21.__)("Center", "elementor"),
1203
+ renderContent: ({ size }) => /* @__PURE__ */ React40.createElement(import_icons9.AlignCenterIcon, { fontSize: size })
1204
+ },
1205
+ {
1206
+ value: "right",
1207
+ label: (0, import_i18n21.__)("Right", "elementor"),
1208
+ renderContent: ({ size }) => /* @__PURE__ */ React40.createElement(import_icons9.AlignRightIcon, { fontSize: size })
1209
+ },
1210
+ {
1211
+ value: "justify",
1212
+ label: (0, import_i18n21.__)("Justify", "elementor"),
1213
+ renderContent: ({ size }) => /* @__PURE__ */ React40.createElement(import_icons9.AlignJustifiedIcon, { fontSize: size })
1214
+ }
1215
+ ];
1216
+ var TextAlignmentField = () => {
1217
+ return /* @__PURE__ */ React40.createElement(StylesField, { bind: "text-align" }, /* @__PURE__ */ React40.createElement(import_ui33.Grid, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React40.createElement(import_ui33.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React40.createElement(import_editor_controls26.ControlLabel, null, (0, import_i18n21.__)("Alignment", "elementor"))), /* @__PURE__ */ React40.createElement(import_ui33.Grid, { item: true, xs: 6, display: "flex", justifyContent: "end" }, /* @__PURE__ */ React40.createElement(import_editor_controls26.ToggleControl, { options: options2 }))));
1244
1218
  };
1245
1219
 
1246
- // src/components/style-sections/effects-section/effects-section.tsx
1247
- var React43 = __toESM(require("react"));
1248
- var import_i18n21 = require("@wordpress/i18n");
1249
- var import_ui36 = require("@elementor/ui");
1220
+ // src/components/style-sections/typography-section/text-color-field.tsx
1221
+ var React41 = __toESM(require("react"));
1222
+ var import_editor_controls27 = require("@elementor/editor-controls");
1223
+ var import_ui34 = require("@elementor/ui");
1224
+ var import_i18n22 = require("@wordpress/i18n");
1225
+ var TextColorField = () => {
1226
+ return /* @__PURE__ */ React41.createElement(StylesField, { bind: "color" }, /* @__PURE__ */ React41.createElement(import_ui34.Grid, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React41.createElement(import_ui34.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React41.createElement(import_editor_controls27.ControlLabel, null, (0, import_i18n22.__)("Text Color", "elementor"))), /* @__PURE__ */ React41.createElement(import_ui34.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React41.createElement(import_editor_controls27.ColorControl, null))));
1227
+ };
1250
1228
 
1251
- // src/components/style-sections/effects-section/box-shadow-repeater.tsx
1229
+ // src/components/style-sections/typography-section/text-direction-field.tsx
1252
1230
  var React42 = __toESM(require("react"));
1253
- var import_i18n20 = require("@wordpress/i18n");
1231
+ var import_editor_controls28 = require("@elementor/editor-controls");
1232
+ var import_icons10 = require("@elementor/icons");
1254
1233
  var import_ui35 = require("@elementor/ui");
1234
+ var import_i18n23 = require("@wordpress/i18n");
1235
+ var options3 = [
1236
+ {
1237
+ value: "ltr",
1238
+ label: (0, import_i18n23.__)("Left to Right", "elementor"),
1239
+ renderContent: ({ size }) => /* @__PURE__ */ React42.createElement(import_icons10.TextDirectionLtrIcon, { fontSize: size })
1240
+ },
1241
+ {
1242
+ value: "rtl",
1243
+ label: (0, import_i18n23.__)("Right to Left", "elementor"),
1244
+ renderContent: ({ size }) => /* @__PURE__ */ React42.createElement(import_icons10.TextDirectionRtlIcon, { fontSize: size })
1245
+ }
1246
+ ];
1247
+ var TextDirectionField = () => {
1248
+ return /* @__PURE__ */ React42.createElement(StylesField, { bind: "direction" }, /* @__PURE__ */ React42.createElement(import_ui35.Grid, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React42.createElement(import_ui35.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React42.createElement(import_editor_controls28.ControlLabel, null, (0, import_i18n23.__)("Direction", "elementor"))), /* @__PURE__ */ React42.createElement(import_ui35.Grid, { item: true, xs: 6, display: "flex", justifyContent: "end" }, /* @__PURE__ */ React42.createElement(import_editor_controls28.ToggleControl, { options: options3 }))));
1249
+ };
1255
1250
 
1256
- // src/controls/components/repeater.tsx
1257
- var React41 = __toESM(require("react"));
1258
- var import_react10 = require("react");
1259
- var import_i18n19 = require("@wordpress/i18n");
1260
- var import_icons9 = require("@elementor/icons");
1261
- var import_ui34 = require("@elementor/ui");
1262
- var SIZE2 = "tiny";
1263
- var Repeater = ({
1264
- label,
1265
- itemSettings,
1266
- values: repeaterValues = [],
1267
- setValues: setRepeaterValues
1268
- }) => {
1269
- const addRepeaterItem = () => {
1270
- const newItem = structuredClone(itemSettings.initialValues);
1271
- setRepeaterValues([...repeaterValues, newItem]);
1272
- };
1273
- const duplicateRepeaterItem = (index) => {
1274
- setRepeaterValues([
1275
- ...repeaterValues.slice(0, index),
1276
- structuredClone(repeaterValues[index]),
1277
- ...repeaterValues.slice(index)
1278
- ]);
1279
- };
1280
- const removeRepeaterItem = (index) => {
1281
- setRepeaterValues(repeaterValues.filter((_, i) => i !== index));
1282
- };
1283
- const toggleDisableRepeaterItem = (index) => {
1284
- setRepeaterValues(
1285
- repeaterValues.map((value, i) => {
1286
- if (i === index) {
1287
- const { disabled, ...rest } = value;
1288
- return { ...rest, ...disabled ? {} : { disabled: true } };
1289
- }
1290
- return value;
1291
- })
1292
- );
1251
+ // src/components/style-sections/typography-section/text-stroke-field.tsx
1252
+ var React44 = __toESM(require("react"));
1253
+ var import_editor_controls29 = require("@elementor/editor-controls");
1254
+ var import_i18n25 = require("@wordpress/i18n");
1255
+
1256
+ // src/components/collapsible-field.tsx
1257
+ var React43 = __toESM(require("react"));
1258
+ var import_react11 = require("react");
1259
+ var import_icons11 = require("@elementor/icons");
1260
+ var import_ui36 = require("@elementor/ui");
1261
+ var import_i18n24 = require("@wordpress/i18n");
1262
+ var CollapsibleField = ({ label, children, defaultOpen = false }) => {
1263
+ const [open, setOpen] = (0, import_react11.useState)(defaultOpen);
1264
+ const handleToggle = () => {
1265
+ setOpen((prevOpen) => !prevOpen);
1293
1266
  };
1294
- return /* @__PURE__ */ React41.createElement(import_ui34.Stack, null, /* @__PURE__ */ React41.createElement(import_ui34.Stack, { direction: "row", justifyContent: "space-between", sx: { py: 0.5 } }, /* @__PURE__ */ React41.createElement(import_ui34.Typography, { component: "label", variant: "caption", color: "text.secondary" }, label), /* @__PURE__ */ React41.createElement(import_ui34.IconButton, { size: SIZE2, onClick: addRepeaterItem, "aria-label": (0, import_i18n19.__)("Add item", "elementor") }, /* @__PURE__ */ React41.createElement(import_icons9.PlusIcon, { fontSize: SIZE2 }))), /* @__PURE__ */ React41.createElement(import_ui34.Stack, { gap: 1 }, repeaterValues.map((value, index) => /* @__PURE__ */ React41.createElement(
1295
- RepeaterItem,
1296
- {
1297
- key: index,
1298
- disabled: value.disabled,
1299
- label: /* @__PURE__ */ React41.createElement(itemSettings.Label, { value }),
1300
- startIcon: /* @__PURE__ */ React41.createElement(itemSettings.Icon, { value }),
1301
- removeItem: () => removeRepeaterItem(index),
1302
- duplicateItem: () => duplicateRepeaterItem(index),
1303
- toggleDisableItem: () => toggleDisableRepeaterItem(index)
1304
- },
1305
- (props) => /* @__PURE__ */ React41.createElement(
1306
- itemSettings.Content,
1307
- {
1308
- ...props,
1309
- value,
1310
- setValue: (newValue) => setRepeaterValues(
1311
- repeaterValues.map((item, i) => i === index ? newValue : item)
1312
- )
1313
- }
1314
- )
1315
- ))));
1316
- };
1317
- var RepeaterItem = ({
1318
- label,
1319
- disabled,
1320
- startIcon,
1321
- children,
1322
- removeItem,
1323
- duplicateItem,
1324
- toggleDisableItem
1325
- }) => {
1326
- const popupId = (0, import_react10.useId)();
1327
- const tagRef = (0, import_react10.useRef)(null);
1328
- const [anchorEl, setAnchorEl] = (0, import_react10.useState)(null);
1329
- const popoverState = (0, import_ui34.usePopupState)({ popupId, variant: "popover" });
1330
- const popoverProps = (0, import_ui34.bindPopover)(popoverState);
1331
- return /* @__PURE__ */ React41.createElement(React41.Fragment, null, /* @__PURE__ */ React41.createElement(
1332
- import_ui34.UnstableTag,
1333
- {
1334
- ref: tagRef,
1335
- label,
1336
- showActionsOnHover: true,
1337
- variant: "outlined",
1338
- "aria-label": (0, import_i18n19.__)("Open item", "elementor"),
1339
- ...(0, import_ui34.bindTrigger)(popoverState),
1340
- startIcon,
1341
- actions: /* @__PURE__ */ React41.createElement(React41.Fragment, null, /* @__PURE__ */ React41.createElement(
1342
- import_ui34.IconButton,
1343
- {
1344
- size: SIZE2,
1345
- onClick: duplicateItem,
1346
- "aria-label": (0, import_i18n19.__)("Duplicate item", "elementor")
1347
- },
1348
- /* @__PURE__ */ React41.createElement(import_icons9.CopyIcon, { fontSize: SIZE2 })
1349
- ), /* @__PURE__ */ React41.createElement(
1350
- import_ui34.IconButton,
1351
- {
1352
- size: SIZE2,
1353
- onClick: toggleDisableItem,
1354
- "aria-label": disabled ? (0, import_i18n19.__)("Enable item", "elementor") : (0, import_i18n19.__)("Disable item", "elementor")
1355
- },
1356
- disabled ? /* @__PURE__ */ React41.createElement(import_icons9.EyeOffIcon, { fontSize: SIZE2 }) : /* @__PURE__ */ React41.createElement(import_icons9.EyeIcon, { fontSize: SIZE2 })
1357
- ), /* @__PURE__ */ React41.createElement(
1358
- import_ui34.IconButton,
1359
- {
1360
- size: SIZE2,
1361
- onClick: removeItem,
1362
- "aria-label": (0, import_i18n19.__)("Remove item", "elementor")
1363
- },
1364
- /* @__PURE__ */ React41.createElement(import_icons9.XIcon, { fontSize: SIZE2 })
1365
- ))
1366
- }
1367
- ), /* @__PURE__ */ React41.createElement(
1368
- import_ui34.Popover,
1267
+ return /* @__PURE__ */ React43.createElement(import_ui36.Stack, { gap: 1.5 }, /* @__PURE__ */ React43.createElement(import_ui36.Stack, { direction: "row", justifyContent: "space-between", alignItems: "center", sx: { py: 0.5 } }, label, /* @__PURE__ */ React43.createElement(
1268
+ import_ui36.IconButton,
1369
1269
  {
1370
- disablePortal: true,
1371
- slotProps: {
1372
- paper: { ref: setAnchorEl, sx: { width: tagRef.current?.getBoundingClientRect().width } }
1373
- },
1374
- anchorOrigin: { vertical: "bottom", horizontal: "left" },
1375
- ...popoverProps
1270
+ onClick: handleToggle,
1271
+ size: "tiny",
1272
+ "aria-label": open ? (0, import_i18n24.__)("Close", "elementor") : (0, import_i18n24.__)("Expand", "elementor")
1376
1273
  },
1377
- /* @__PURE__ */ React41.createElement(import_ui34.Box, { p: 2 }, children({ anchorEl }))
1378
- ));
1274
+ open ? /* @__PURE__ */ React43.createElement(import_icons11.MinusIcon, { fontSize: "tiny" }) : /* @__PURE__ */ React43.createElement(import_icons11.PlusIcon, { fontSize: "tiny" })
1275
+ )), /* @__PURE__ */ React43.createElement(import_ui36.Collapse, { in: open, unmountOnExit: true }, children));
1379
1276
  };
1380
1277
 
1381
- // src/components/style-sections/effects-section/box-shadow-repeater.tsx
1382
- var BoxShadowRepeater = () => {
1383
- const { value, setValue } = useControl();
1384
- const boxShadowValues = value?.value;
1385
- const setBoxShadow = (newValue) => {
1386
- setValue({
1387
- $$type: "box-shadow",
1388
- value: newValue
1389
- });
1390
- };
1391
- return /* @__PURE__ */ React42.createElement(
1392
- Repeater,
1393
- {
1394
- values: boxShadowValues,
1395
- setValues: setBoxShadow,
1396
- label: (0, import_i18n20.__)("Box shadow", "elementor"),
1397
- itemSettings: {
1398
- Icon: ItemIcon,
1399
- Label: ItemLabel,
1400
- Content: ItemContent,
1401
- initialValues: initialShadow
1402
- }
1403
- }
1404
- );
1278
+ // src/components/style-sections/typography-section/text-stroke-field.tsx
1279
+ var TextStrokeField = () => {
1280
+ return /* @__PURE__ */ React44.createElement(StylesField, { bind: "-webkit-text-stroke" }, /* @__PURE__ */ React44.createElement(CollapsibleField, { label: /* @__PURE__ */ React44.createElement(import_editor_controls29.ControlLabel, null, (0, import_i18n25.__)("Text Stroke", "elementor")) }, /* @__PURE__ */ React44.createElement(import_editor_controls29.StrokeControl, null)));
1405
1281
  };
1406
- var ItemIcon = ({ value }) => /* @__PURE__ */ React42.createElement(import_ui35.UnstableColorIndicator, { size: "inherit", component: "span", value: value.value.color.value });
1407
- var ItemContent = ({
1408
- anchorEl,
1409
- value,
1410
- setValue
1411
- }) => {
1412
- const setShadow = (newValue) => {
1413
- setValue({
1414
- $$type: "shadow",
1415
- value: newValue
1416
- });
1417
- };
1418
- return /* @__PURE__ */ React42.createElement(import_ui35.Stack, { gap: 1.5 }, /* @__PURE__ */ React42.createElement(import_ui35.Grid, { container: true, spacing: 1 }, /* @__PURE__ */ React42.createElement(
1419
- Control5,
1420
- {
1421
- bind: "color",
1422
- value: value.value.color,
1423
- label: (0, import_i18n20.__)("Color", "elementor"),
1424
- setValue: (v) => setShadow({ ...value.value, color: v })
1425
- },
1426
- /* @__PURE__ */ React42.createElement(
1427
- ColorControl,
1428
- {
1429
- anchorEl,
1430
- anchorOrigin: {
1431
- vertical: "top",
1432
- horizontal: "right"
1433
- },
1434
- transformOrigin: {
1435
- vertical: "top",
1436
- horizontal: -10
1437
- }
1438
- }
1439
- )
1440
- ), /* @__PURE__ */ React42.createElement(
1441
- Control5,
1442
- {
1443
- bind: "position",
1444
- value: value.value.position,
1445
- label: (0, import_i18n20.__)("Position", "elementor"),
1446
- setValue: (v) => setShadow({ ...value.value, position: v })
1447
- },
1448
- /* @__PURE__ */ React42.createElement(
1449
- SelectControl,
1450
- {
1451
- options: [
1452
- { label: "Inset", value: "inset" },
1453
- { label: "Outset", value: "outset" }
1454
- ]
1455
- }
1456
- )
1457
- )), /* @__PURE__ */ React42.createElement(import_ui35.Grid, { container: true, spacing: 1 }, /* @__PURE__ */ React42.createElement(
1458
- Control5,
1459
- {
1460
- bind: "hOffset",
1461
- label: (0, import_i18n20.__)("Horizontal", "elementor"),
1462
- value: value.value.hOffset,
1463
- setValue: (v) => setShadow({ ...value.value, hOffset: v })
1464
- },
1465
- /* @__PURE__ */ React42.createElement(SizeControl, null)
1466
- ), /* @__PURE__ */ React42.createElement(
1467
- Control5,
1282
+
1283
+ // src/components/style-sections/typography-section/text-style-field.tsx
1284
+ var React45 = __toESM(require("react"));
1285
+ var import_editor_controls30 = require("@elementor/editor-controls");
1286
+ var import_icons12 = require("@elementor/icons");
1287
+ var import_ui37 = require("@elementor/ui");
1288
+ var import_i18n26 = require("@wordpress/i18n");
1289
+ var buttonSize = "tiny";
1290
+ var TextStyleField = () => {
1291
+ const [fontStyle, setFontStyle] = useStylesField("font-style");
1292
+ const [textDecoration, setTextDecoration] = useStylesField("text-decoration");
1293
+ const formats = [fontStyle, ...(textDecoration || "").split(" ")];
1294
+ return /* @__PURE__ */ React45.createElement(import_ui37.Grid, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React45.createElement(import_ui37.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React45.createElement(import_editor_controls30.ControlLabel, null, (0, import_i18n26.__)("Style", "elementor"))), /* @__PURE__ */ React45.createElement(import_ui37.Grid, { item: true, xs: 6, display: "flex", justifyContent: "end" }, /* @__PURE__ */ React45.createElement(import_ui37.ToggleButtonGroup, { value: formats }, /* @__PURE__ */ React45.createElement(
1295
+ ToggleButton,
1468
1296
  {
1469
- label: (0, import_i18n20.__)("Vertical", "elementor"),
1470
- bind: "vOffset",
1471
- value: value.value.vOffset,
1472
- setValue: (v) => setShadow({ ...value.value, vOffset: v })
1297
+ value: "italic",
1298
+ onChange: (v) => setFontStyle(fontStyle === v ? null : v),
1299
+ "aria-label": "italic",
1300
+ sx: { marginLeft: "auto" }
1473
1301
  },
1474
- /* @__PURE__ */ React42.createElement(SizeControl, null)
1475
- )), /* @__PURE__ */ React42.createElement(import_ui35.Grid, { container: true, spacing: 1 }, /* @__PURE__ */ React42.createElement(
1476
- Control5,
1302
+ /* @__PURE__ */ React45.createElement(import_icons12.ItalicIcon, { fontSize: buttonSize })
1303
+ ), /* @__PURE__ */ React45.createElement(
1304
+ ShorthandControl,
1477
1305
  {
1478
- bind: "blur",
1479
- value: value.value.blur,
1480
- label: (0, import_i18n20.__)("Blur", "elementor"),
1481
- setValue: (v) => setShadow({ ...value.value, blur: v })
1306
+ value: "line-through",
1307
+ currentValues: textDecoration || "",
1308
+ updateValues: setTextDecoration,
1309
+ "aria-label": "line-through"
1482
1310
  },
1483
- /* @__PURE__ */ React42.createElement(SizeControl, null)
1484
- ), /* @__PURE__ */ React42.createElement(
1485
- Control5,
1311
+ /* @__PURE__ */ React45.createElement(import_icons12.StrikethroughIcon, { fontSize: buttonSize })
1312
+ ), /* @__PURE__ */ React45.createElement(
1313
+ ShorthandControl,
1486
1314
  {
1487
- bind: "spread",
1488
- label: (0, import_i18n20.__)("Spread", "elementor"),
1489
- value: value.value.spread,
1490
- setValue: (v) => setShadow({ ...value.value, spread: v })
1315
+ value: "underline",
1316
+ currentValues: textDecoration || "",
1317
+ updateValues: setTextDecoration,
1318
+ "aria-label": "underline"
1491
1319
  },
1492
- /* @__PURE__ */ React42.createElement(SizeControl, null)
1493
- )));
1320
+ /* @__PURE__ */ React45.createElement(import_icons12.UnderlineIcon, { fontSize: buttonSize })
1321
+ ))));
1494
1322
  };
1495
- var Control5 = ({
1323
+ var ShorthandControl = ({
1324
+ children,
1496
1325
  value,
1497
- setValue,
1498
- label,
1499
- bind,
1500
- children
1501
- }) => /* @__PURE__ */ React42.createElement(ControlContext.Provider, { value: { value, setValue, bind } }, /* @__PURE__ */ React42.createElement(import_ui35.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React42.createElement(import_ui35.Grid, { container: true, spacing: 1, alignItems: "center" }, /* @__PURE__ */ React42.createElement(import_ui35.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React42.createElement(ControlLabel, null, label)), /* @__PURE__ */ React42.createElement(import_ui35.Grid, { item: true, xs: 12 }, children))));
1502
- var ItemLabel = ({ value }) => {
1503
- const { position, hOffset, vOffset, blur, spread } = value.value;
1504
- const { size: hOffsetSize, unit: hOffsetUnit } = hOffset.value;
1505
- const { size: vOffsetSize, unit: vOffsetUnit } = vOffset.value;
1506
- const { size: blurSize, unit: blurUnit } = blur.value;
1507
- const { size: spreadSize, unit: spreadUnit } = spread.value;
1508
- const sizes = [
1509
- hOffsetSize + hOffsetUnit,
1510
- vOffsetSize + vOffsetUnit,
1511
- blurSize + blurUnit,
1512
- spreadSize + spreadUnit
1513
- ].join(" ");
1514
- return /* @__PURE__ */ React42.createElement("span", { style: { textTransform: "capitalize" } }, position, ": ", sizes);
1515
- };
1516
- var initialShadow = {
1517
- $$type: "shadow",
1518
- value: {
1519
- hOffset: {
1520
- $$type: "size",
1521
- value: { unit: "px", size: 0 }
1522
- },
1523
- vOffset: {
1524
- $$type: "size",
1525
- value: { unit: "px", size: 0 }
1526
- },
1527
- blur: {
1528
- $$type: "size",
1529
- value: { unit: "px", size: 0 }
1530
- },
1531
- spread: {
1532
- $$type: "size",
1533
- value: { unit: "px", size: 0 }
1534
- },
1535
- color: {
1536
- $$type: "color",
1537
- value: "rgba(0, 0, 0, 0)"
1538
- },
1539
- position: "inset"
1540
- }
1326
+ currentValues,
1327
+ updateValues,
1328
+ "aria-label": ariaLabel
1329
+ }) => {
1330
+ const valuesArr = currentValues.split(" ").filter(Boolean);
1331
+ const selected = valuesArr.includes(value);
1332
+ const toggleValue = (newValue) => {
1333
+ if (selected) {
1334
+ updateValues(valuesArr.filter((v) => v !== newValue).join(" ") || null);
1335
+ } else {
1336
+ updateValues([...valuesArr, newValue].join(" "));
1337
+ }
1338
+ };
1339
+ return /* @__PURE__ */ React45.createElement(ToggleButton, { value, onChange: toggleValue, selected, "aria-label": ariaLabel }, children);
1541
1340
  };
1542
-
1543
- // src/components/style-sections/effects-section/effects-section.tsx
1544
- var EffectsSection = () => {
1545
- return /* @__PURE__ */ React43.createElement(AccordionSection, { title: (0, import_i18n21.__)("Effects", "elementor") }, /* @__PURE__ */ React43.createElement(import_ui36.Stack, { gap: 1.5 }, /* @__PURE__ */ React43.createElement(StyleControl, { bind: "box-shadow" }, /* @__PURE__ */ React43.createElement(BoxShadowRepeater, null))));
1341
+ var ToggleButton = ({ onChange, ...props }) => {
1342
+ const handleChange = (_e, newValue) => {
1343
+ onChange(newValue);
1344
+ };
1345
+ return /* @__PURE__ */ React45.createElement(import_ui37.ToggleButton, { ...props, onChange: handleChange, size: buttonSize });
1546
1346
  };
1547
1347
 
1548
- // src/components/style-sections/background-section/background-section.tsx
1549
- var React45 = __toESM(require("react"));
1550
- var import_i18n23 = require("@wordpress/i18n");
1348
+ // src/components/style-sections/typography-section/transform-field.tsx
1349
+ var React46 = __toESM(require("react"));
1350
+ var import_editor_controls31 = require("@elementor/editor-controls");
1351
+ var import_icons13 = require("@elementor/icons");
1551
1352
  var import_ui38 = require("@elementor/ui");
1353
+ var import_i18n27 = require("@wordpress/i18n");
1354
+ var options4 = [
1355
+ {
1356
+ value: "capitalize",
1357
+ label: (0, import_i18n27.__)("Capitalize", "elementor"),
1358
+ renderContent: ({ size }) => /* @__PURE__ */ React46.createElement(import_icons13.LetterCaseIcon, { fontSize: size })
1359
+ },
1360
+ {
1361
+ value: "uppercase",
1362
+ label: (0, import_i18n27.__)("Uppercase", "elementor"),
1363
+ renderContent: ({ size }) => /* @__PURE__ */ React46.createElement(import_icons13.LetterCaseUpperIcon, { fontSize: size })
1364
+ },
1365
+ {
1366
+ value: "lowercase",
1367
+ label: (0, import_i18n27.__)("Lowercase", "elementor"),
1368
+ renderContent: ({ size }) => /* @__PURE__ */ React46.createElement(import_icons13.LetterCaseLowerIcon, { fontSize: size })
1369
+ }
1370
+ ];
1371
+ var TransformField = () => /* @__PURE__ */ React46.createElement(StylesField, { bind: "text-transform" }, /* @__PURE__ */ React46.createElement(import_ui38.Grid, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React46.createElement(import_ui38.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React46.createElement(import_editor_controls31.ControlLabel, null, (0, import_i18n27.__)("Transform", "elementor"))), /* @__PURE__ */ React46.createElement(import_ui38.Grid, { item: true, xs: 6, display: "flex", justifyContent: "end" }, /* @__PURE__ */ React46.createElement(import_editor_controls31.ToggleControl, { options: options4 }))));
1552
1372
 
1553
- // src/components/style-sections/background-section/background-color-control.tsx
1554
- var React44 = __toESM(require("react"));
1555
- var import_i18n22 = require("@wordpress/i18n");
1556
- var import_ui37 = require("@elementor/ui");
1557
- var BackgroundColorControl = () => {
1558
- return /* @__PURE__ */ React44.createElement(StyleControl, { bind: "background-color" }, /* @__PURE__ */ React44.createElement(import_ui37.Grid, { container: true, spacing: 1, alignItems: "center" }, /* @__PURE__ */ React44.createElement(import_ui37.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React44.createElement(StyleControl.Label, null, (0, import_i18n22.__)("Color", "elementor"))), /* @__PURE__ */ React44.createElement(import_ui37.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React44.createElement(ColorControl, null))));
1373
+ // src/components/style-sections/typography-section/word-spacing-field.tsx
1374
+ var React47 = __toESM(require("react"));
1375
+ var import_editor_controls32 = require("@elementor/editor-controls");
1376
+ var import_ui39 = require("@elementor/ui");
1377
+ var import_i18n28 = require("@wordpress/i18n");
1378
+ var WordSpacingField = () => {
1379
+ return /* @__PURE__ */ React47.createElement(StylesField, { bind: "word-spacing" }, /* @__PURE__ */ React47.createElement(import_ui39.Grid, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React47.createElement(import_ui39.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React47.createElement(import_editor_controls32.ControlLabel, null, (0, import_i18n28.__)("Word Spacing", "elementor"))), /* @__PURE__ */ React47.createElement(import_ui39.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React47.createElement(import_editor_controls32.SizeControl, null))));
1559
1380
  };
1560
1381
 
1561
- // src/components/style-sections/background-section/background-section.tsx
1562
- var BackgroundSection = () => {
1563
- return /* @__PURE__ */ React45.createElement(AccordionSection, { title: (0, import_i18n23.__)("Background", "elementor") }, /* @__PURE__ */ React45.createElement(import_ui38.Stack, { gap: 1.5 }, /* @__PURE__ */ React45.createElement(BackgroundColorControl, null)));
1382
+ // src/components/style-sections/typography-section/typography-section.tsx
1383
+ var TypographySection = () => {
1384
+ return /* @__PURE__ */ React48.createElement(import_ui40.Stack, { gap: 1.5 }, /* @__PURE__ */ React48.createElement(FontFamilyField, null), /* @__PURE__ */ React48.createElement(FontWeightField, null), /* @__PURE__ */ React48.createElement(FontSizeField, null), /* @__PURE__ */ React48.createElement(import_ui40.Divider, null), /* @__PURE__ */ React48.createElement(TextColorField, null), /* @__PURE__ */ React48.createElement(CollapsibleContent, null, /* @__PURE__ */ React48.createElement(import_ui40.Stack, { gap: 1.5, sx: { pt: 1.5 } }, /* @__PURE__ */ React48.createElement(LetterSpacingField, null), /* @__PURE__ */ React48.createElement(WordSpacingField, null), /* @__PURE__ */ React48.createElement(import_ui40.Divider, null), /* @__PURE__ */ React48.createElement(TextAlignmentField, null), /* @__PURE__ */ React48.createElement(TextStyleField, null), /* @__PURE__ */ React48.createElement(TransformField, null), /* @__PURE__ */ React48.createElement(TextDirectionField, null), /* @__PURE__ */ React48.createElement(TextStrokeField, null))));
1564
1385
  };
1565
1386
 
1566
1387
  // src/components/style-tab.tsx
1567
1388
  var CLASSES_PROP_KEY = "classes";
1568
1389
  var StyleTab = () => {
1569
- const styleDefinition = useStyleDefinition();
1570
- const classesProp = useClassesProp();
1571
- return /* @__PURE__ */ React46.createElement(StyleContext, { selectedStyleDef: styleDefinition, selectedClassesProp: classesProp }, /* @__PURE__ */ React46.createElement(import_ui39.Stack, null, /* @__PURE__ */ React46.createElement(SizeSection, null), /* @__PURE__ */ React46.createElement(PositionSection, null), /* @__PURE__ */ React46.createElement(TypographySection, null), /* @__PURE__ */ React46.createElement(BackgroundSection, null), /* @__PURE__ */ React46.createElement(SpacingSection, null), /* @__PURE__ */ React46.createElement(EffectsSection, null)));
1390
+ const currentClassesProp = useCurrentClassesProp();
1391
+ const [activeStyleDefId, setActiveStyleDefId] = useActiveStyleDefId(currentClassesProp);
1392
+ const breakpoint = (0, import_editor_responsive.useActiveBreakpoint)();
1393
+ return /* @__PURE__ */ React49.createElement(ClassesPropProvider, { prop: currentClassesProp }, /* @__PURE__ */ React49.createElement(StyleProvider, { meta: { breakpoint, state: null }, id: activeStyleDefId, setId: setActiveStyleDefId }, /* @__PURE__ */ React49.createElement(CssClassSelectorSection, null), /* @__PURE__ */ React49.createElement(import_ui41.Divider, null), /* @__PURE__ */ React49.createElement(SectionsList, null, /* @__PURE__ */ React49.createElement(Section, { title: (0, import_i18n29.__)("Layout", "elementor") }, /* @__PURE__ */ React49.createElement(LayoutSection, null)), /* @__PURE__ */ React49.createElement(Section, { title: (0, import_i18n29.__)("Spacing", "elementor") }, /* @__PURE__ */ React49.createElement(SpacingSection, null)), /* @__PURE__ */ React49.createElement(Section, { title: (0, import_i18n29.__)("Size", "elementor") }, /* @__PURE__ */ React49.createElement(SizeSection, null)), /* @__PURE__ */ React49.createElement(Section, { title: (0, import_i18n29.__)("Position", "elementor") }, /* @__PURE__ */ React49.createElement(PositionSection, null)), /* @__PURE__ */ React49.createElement(Section, { title: (0, import_i18n29.__)("Typography", "elementor") }, /* @__PURE__ */ React49.createElement(TypographySection, null)), /* @__PURE__ */ React49.createElement(Section, { title: (0, import_i18n29.__)("Background", "elementor") }, /* @__PURE__ */ React49.createElement(BackgroundSection, null)), /* @__PURE__ */ React49.createElement(Section, { title: (0, import_i18n29.__)("Border", "elementor") }, /* @__PURE__ */ React49.createElement(BorderSection, null)), /* @__PURE__ */ React49.createElement(Section, { title: (0, import_i18n29.__)("Effects", "elementor") }, /* @__PURE__ */ React49.createElement(EffectsSection, null)))));
1572
1394
  };
1573
- function useClassesProp() {
1395
+ function useActiveStyleDefId(currentClassesProp) {
1396
+ const [activeStyledDefId, setActiveStyledDefId] = (0, import_react12.useState)(null);
1397
+ const fallback = useFirstElementStyleDef(currentClassesProp);
1398
+ const newId = useGeneratedId();
1399
+ return [activeStyledDefId || fallback?.id || newId, setActiveStyledDefId];
1400
+ }
1401
+ function useFirstElementStyleDef(currentClassesProp) {
1402
+ const { element } = useElement();
1403
+ const classesIds = (0, import_editor_elements5.useElementSetting)(element.id, currentClassesProp)?.value || [];
1404
+ const stylesDefs = (0, import_editor_elements5.useElementStyles)(element.id);
1405
+ return Object.values(stylesDefs).find((styleDef) => classesIds.includes(styleDef.id));
1406
+ }
1407
+ function useGeneratedId() {
1408
+ const { element } = useElement();
1409
+ const stylesDefs = (0, import_editor_elements5.useElementStyles)(element.id);
1410
+ return (0, import_editor_styles.generateId)(`e-${element.id}-`, Object.keys(stylesDefs));
1411
+ }
1412
+ function useCurrentClassesProp() {
1574
1413
  const { elementType } = useElement();
1575
1414
  const prop = Object.entries(elementType.propsSchema).find(
1576
1415
  ([, propType]) => propType.kind === "array" && propType.key === CLASSES_PROP_KEY
@@ -1580,39 +1419,29 @@ function useClassesProp() {
1580
1419
  }
1581
1420
  return prop[0];
1582
1421
  }
1583
- function useStyleDefinition() {
1584
- const { element } = useElement();
1585
- const elementStyles = useElementStyles(element.id);
1586
- return Object.values(elementStyles || {})[0] ?? null;
1587
- }
1588
1422
 
1589
1423
  // src/components/editing-panel-tabs.tsx
1590
1424
  var EditingPanelTabs = () => {
1591
- const { getTabProps, getTabPanelProps, getTabsProps } = (0, import_ui40.useTabs)("settings");
1592
- return /* @__PURE__ */ React47.createElement(import_ui40.Stack, { direction: "column", sx: { width: "100%" } }, /* @__PURE__ */ React47.createElement(import_ui40.Tabs, { variant: "fullWidth", indicatorColor: "secondary", textColor: "inherit", ...getTabsProps() }, /* @__PURE__ */ React47.createElement(import_ui40.Tab, { label: (0, import_i18n24.__)("General", "elementor"), ...getTabProps("settings") }), /* @__PURE__ */ React47.createElement(import_ui40.Tab, { label: (0, import_i18n24.__)("Style", "elementor"), ...getTabProps("style") })), /* @__PURE__ */ React47.createElement(import_ui40.TabPanel, { ...getTabPanelProps("settings"), disablePadding: true }, /* @__PURE__ */ React47.createElement(SettingsTab, null)), /* @__PURE__ */ React47.createElement(import_ui40.TabPanel, { ...getTabPanelProps("style"), disablePadding: true }, /* @__PURE__ */ React47.createElement(StyleTab, null)));
1425
+ const { element } = useElement();
1426
+ const { getTabProps, getTabPanelProps, getTabsProps } = (0, import_ui42.useTabs)("settings");
1427
+ return (
1428
+ // When switching between elements, the local states should be reset. We are using key to rerender the tabs.
1429
+ // Reference: https://react.dev/learn/preserving-and-resetting-state#resetting-a-form-with-a-key
1430
+ /* @__PURE__ */ React50.createElement(import_react13.Fragment, { key: element.id }, /* @__PURE__ */ React50.createElement(import_ui42.Stack, { direction: "column", sx: { width: "100%" } }, /* @__PURE__ */ React50.createElement(import_ui42.Tabs, { variant: "fullWidth", indicatorColor: "secondary", textColor: "inherit", ...getTabsProps() }, /* @__PURE__ */ React50.createElement(import_ui42.Tab, { label: (0, import_i18n30.__)("General", "elementor"), ...getTabProps("settings") }), /* @__PURE__ */ React50.createElement(import_ui42.Tab, { label: (0, import_i18n30.__)("Style", "elementor"), ...getTabProps("style") })), /* @__PURE__ */ React50.createElement(import_ui42.Divider, null), /* @__PURE__ */ React50.createElement(import_ui42.TabPanel, { ...getTabPanelProps("settings"), disablePadding: true }, /* @__PURE__ */ React50.createElement(SettingsTab, null)), /* @__PURE__ */ React50.createElement(import_ui42.TabPanel, { ...getTabPanelProps("style"), disablePadding: true }, /* @__PURE__ */ React50.createElement(StyleTab, null))))
1431
+ );
1593
1432
  };
1594
1433
 
1595
1434
  // src/components/editing-panel.tsx
1596
- var import_ui42 = require("@elementor/ui");
1597
-
1598
- // src/components/editing-panel-error-fallback.tsx
1599
- var React48 = __toESM(require("react"));
1600
- var import_ui41 = require("@elementor/ui");
1601
- function EditorPanelErrorFallback() {
1602
- return /* @__PURE__ */ React48.createElement(import_ui41.Box, { role: "alert", sx: { minHeight: "100%", p: 2 } }, /* @__PURE__ */ React48.createElement(import_ui41.Alert, { severity: "error", sx: { mb: 2, maxWidth: 400, textAlign: "center" } }, /* @__PURE__ */ React48.createElement("strong", null, "Something went wrong")));
1603
- }
1604
-
1605
- // src/components/editing-panel.tsx
1435
+ var { useMenuItems } = controlActionsMenu;
1606
1436
  var EditingPanel = () => {
1607
- const elements = useSelectedElements();
1608
- const [selectedElement] = elements;
1609
- const elementType = useElementType(selectedElement?.type);
1610
- if (elements.length !== 1 || !elementType) {
1437
+ const { element, elementType } = (0, import_editor_elements6.useSelectedElement)();
1438
+ const controlReplacement = getControlReplacement();
1439
+ const menuItems = useMenuItems().default;
1440
+ if (!element || !elementType) {
1611
1441
  return null;
1612
1442
  }
1613
- const controlReplacement = getControlReplacement();
1614
- const panelTitle = (0, import_i18n25.__)("Edit %s", "elementor").replace("%s", elementType.title);
1615
- return /* @__PURE__ */ React49.createElement(import_ui42.ErrorBoundary, { fallback: /* @__PURE__ */ React49.createElement(EditorPanelErrorFallback, null) }, /* @__PURE__ */ React49.createElement(import_editor_panels.Panel, null, /* @__PURE__ */ React49.createElement(import_editor_panels.PanelHeader, null, /* @__PURE__ */ React49.createElement(import_editor_panels.PanelHeaderTitle, null, panelTitle)), /* @__PURE__ */ React49.createElement(import_editor_panels.PanelBody, null, /* @__PURE__ */ React49.createElement(ControlReplacementProvider, { ...controlReplacement }, /* @__PURE__ */ React49.createElement(ElementProvider, { element: selectedElement, elementType }, /* @__PURE__ */ React49.createElement(EditingPanelTabs, null))))));
1443
+ const panelTitle = (0, import_i18n31.__)("Edit %s", "elementor").replace("%s", elementType.title);
1444
+ return /* @__PURE__ */ React51.createElement(import_ui43.ErrorBoundary, { fallback: /* @__PURE__ */ React51.createElement(EditorPanelErrorFallback, null) }, /* @__PURE__ */ React51.createElement(import_editor_panels.Panel, null, /* @__PURE__ */ React51.createElement(import_editor_panels.PanelHeader, null, /* @__PURE__ */ React51.createElement(import_editor_panels.PanelHeaderTitle, null, panelTitle)), /* @__PURE__ */ React51.createElement(import_editor_panels.PanelBody, null, /* @__PURE__ */ React51.createElement(import_editor_controls33.ControlActionsProvider, { items: menuItems }, /* @__PURE__ */ React51.createElement(import_editor_controls33.ControlReplacementProvider, { ...controlReplacement }, /* @__PURE__ */ React51.createElement(ElementProvider, { element, elementType }, /* @__PURE__ */ React51.createElement(EditingPanelTabs, null)))))));
1616
1445
  };
1617
1446
 
1618
1447
  // src/panel.ts
@@ -1621,27 +1450,40 @@ var { panel, usePanelActions, usePanelStatus } = (0, import_editor_panels2.__cre
1621
1450
  component: EditingPanel
1622
1451
  });
1623
1452
 
1624
- // src/init.ts
1625
- var import_editor = require("@elementor/editor");
1626
-
1627
- // src/sync/should-use-v2-panel.ts
1628
- var shouldUseV2Panel = () => {
1629
- const selectedElements = getSelectedElements();
1630
- const widgetCache = getWidgetsCache();
1453
+ // src/sync/is-atomic-widget-selected.ts
1454
+ var import_editor_elements7 = require("@elementor/editor-elements");
1455
+ var isAtomicWidgetSelected = () => {
1456
+ const selectedElements = (0, import_editor_elements7.getSelectedElements)();
1457
+ const widgetCache = (0, import_editor_elements7.getWidgetsCache)();
1631
1458
  if (selectedElements.length !== 1) {
1632
1459
  return false;
1633
1460
  }
1634
1461
  return !!widgetCache?.[selectedElements[0].type]?.atomic_controls;
1635
1462
  };
1636
1463
 
1464
+ // src/hooks/use-close-editor-panel.ts
1465
+ var useCloseEditorPanel = () => {
1466
+ const { close } = usePanelActions();
1467
+ return (0, import_react14.useEffect)(() => {
1468
+ return (0, import_editor_v1_adapters.__privateListenTo)((0, import_editor_v1_adapters.commandStartEvent)("document/elements/delete"), (e) => {
1469
+ const selectedElement = (0, import_editor_elements8.getSelectedElements)()[0];
1470
+ const { container: deletedContainer } = e?.args;
1471
+ const isSelectedElementInDeletedContainer = deletedContainer && selectedElement && (0, import_editor_elements8.isElementInContainer)(selectedElement, deletedContainer);
1472
+ if (isSelectedElementInDeletedContainer && isAtomicWidgetSelected()) {
1473
+ close();
1474
+ }
1475
+ });
1476
+ }, []);
1477
+ };
1478
+
1637
1479
  // src/hooks/use-open-editor-panel.ts
1638
- var import_react11 = require("react");
1639
- var import_editor_v1_adapters8 = require("@elementor/editor-v1-adapters");
1480
+ var import_react15 = require("react");
1481
+ var import_editor_v1_adapters2 = require("@elementor/editor-v1-adapters");
1640
1482
  var useOpenEditorPanel = () => {
1641
1483
  const { open } = usePanelActions();
1642
- (0, import_react11.useEffect)(() => {
1643
- return (0, import_editor_v1_adapters8.__privateListenTo)((0, import_editor_v1_adapters8.commandStartEvent)("panel/editor/open"), () => {
1644
- if (shouldUseV2Panel()) {
1484
+ (0, import_react15.useEffect)(() => {
1485
+ return (0, import_editor_v1_adapters2.__privateListenTo)((0, import_editor_v1_adapters2.commandStartEvent)("panel/editor/open"), () => {
1486
+ if (isAtomicWidgetSelected()) {
1645
1487
  open();
1646
1488
  }
1647
1489
  });
@@ -1651,35 +1493,37 @@ var useOpenEditorPanel = () => {
1651
1493
  // src/components/editing-panel-hooks.tsx
1652
1494
  var EditingPanelHooks = () => {
1653
1495
  useOpenEditorPanel();
1496
+ useCloseEditorPanel();
1654
1497
  return null;
1655
1498
  };
1656
1499
 
1657
- // src/init.ts
1658
- var import_editor_panels3 = require("@elementor/editor-panels");
1659
- var import_editor_v1_adapters9 = require("@elementor/editor-v1-adapters");
1660
-
1661
1500
  // src/dynamics/components/dynamic-selection-control.tsx
1662
- var React52 = __toESM(require("react"));
1663
- var import_react15 = require("react");
1501
+ var React54 = __toESM(require("react"));
1502
+ var import_react19 = require("react");
1503
+ var import_editor_controls36 = require("@elementor/editor-controls");
1504
+ var import_icons15 = require("@elementor/icons");
1505
+ var import_ui45 = require("@elementor/ui");
1506
+ var import_i18n33 = require("@wordpress/i18n");
1664
1507
 
1665
1508
  // src/dynamics/dynamic-control.tsx
1666
- var React50 = __toESM(require("react"));
1509
+ var React52 = __toESM(require("react"));
1510
+ var import_editor_controls34 = require("@elementor/editor-controls");
1667
1511
 
1668
1512
  // src/dynamics/hooks/use-dynamic-tag.ts
1669
- var import_react13 = require("react");
1513
+ var import_react17 = require("react");
1670
1514
 
1671
1515
  // src/dynamics/hooks/use-prop-dynamic-tags.ts
1672
- var import_react12 = require("react");
1516
+ var import_react16 = require("react");
1673
1517
 
1674
1518
  // src/dynamics/sync/get-elementor-config.ts
1675
- var getElementorConfig = () => {
1519
+ var getElementorConfig2 = () => {
1676
1520
  const extendedWindow = window;
1677
1521
  return extendedWindow.elementor?.config ?? {};
1678
1522
  };
1679
1523
 
1680
1524
  // src/dynamics/sync/get-atomic-dynamic-tags.ts
1681
1525
  var getAtomicDynamicTags = () => {
1682
- const { atomicDynamicTags } = getElementorConfig();
1526
+ const { atomicDynamicTags } = getElementorConfig2();
1683
1527
  if (!atomicDynamicTags) {
1684
1528
  return null;
1685
1529
  }
@@ -1689,17 +1533,8 @@ var getAtomicDynamicTags = () => {
1689
1533
  };
1690
1534
  };
1691
1535
 
1692
- // src/controls/props/is-transformable.ts
1693
- var import_schema = require("@elementor/schema");
1694
- var transformableSchema = import_schema.z.object({
1695
- $$type: import_schema.z.string(),
1696
- value: import_schema.z.any()
1697
- });
1698
- var isTransformable = (value) => {
1699
- return transformableSchema.safeParse(value).success;
1700
- };
1701
-
1702
1536
  // src/dynamics/utils.ts
1537
+ var import_editor_props = require("@elementor/editor-props");
1703
1538
  var DYNAMIC_PROP_TYPE_KEY = "dynamic";
1704
1539
  var isDynamicPropType = (prop) => prop.key === DYNAMIC_PROP_TYPE_KEY;
1705
1540
  var getDynamicPropType = (propType) => {
@@ -1707,7 +1542,7 @@ var getDynamicPropType = (propType) => {
1707
1542
  return dynamicPropType && isDynamicPropType(dynamicPropType) ? dynamicPropType : null;
1708
1543
  };
1709
1544
  var isDynamicPropValue = (prop) => {
1710
- return isTransformable(prop) && prop.$$type === DYNAMIC_PROP_TYPE_KEY;
1545
+ return (0, import_editor_props.isTransformable)(prop) && prop.$$type === DYNAMIC_PROP_TYPE_KEY;
1711
1546
  };
1712
1547
  var supportsDynamic = (propType) => {
1713
1548
  return !!getDynamicPropType(propType);
@@ -1722,7 +1557,7 @@ var usePropDynamicTags = (propName) => {
1722
1557
  const propDynamicType = getDynamicPropType(propType);
1723
1558
  categories = propDynamicType?.settings.categories || [];
1724
1559
  }
1725
- return (0, import_react12.useMemo)(() => getDynamicTagsByCategories(categories), [categories.join()]);
1560
+ return (0, import_react16.useMemo)(() => getDynamicTagsByCategories(categories), [categories.join()]);
1726
1561
  };
1727
1562
  var getDynamicTagsByCategories = (categories) => {
1728
1563
  const dynamicTags = getAtomicDynamicTags();
@@ -1738,12 +1573,12 @@ var getDynamicTagsByCategories = (categories) => {
1738
1573
  // src/dynamics/hooks/use-dynamic-tag.ts
1739
1574
  var useDynamicTag = (propName, tagName) => {
1740
1575
  const dynamicTags = usePropDynamicTags(propName);
1741
- return (0, import_react13.useMemo)(() => dynamicTags.find((tag) => tag.name === tagName) ?? null, [dynamicTags, tagName]);
1576
+ return (0, import_react17.useMemo)(() => dynamicTags.find((tag) => tag.name === tagName) ?? null, [dynamicTags, tagName]);
1742
1577
  };
1743
1578
 
1744
1579
  // src/dynamics/dynamic-control.tsx
1745
1580
  var DynamicControl = ({ bind, children }) => {
1746
- const { value, setValue, bind: propName } = useControl();
1581
+ const { value, setValue, bind: propName } = (0, import_editor_controls34.useBoundProp)();
1747
1582
  const { name = "", settings } = value?.value ?? {};
1748
1583
  const dynamicTag = useDynamicTag(propName, name);
1749
1584
  if (!dynamicTag) {
@@ -1763,73 +1598,50 @@ var DynamicControl = ({ bind, children }) => {
1763
1598
  }
1764
1599
  });
1765
1600
  };
1766
- return /* @__PURE__ */ React50.createElement(ControlContext.Provider, { value: { setValue: setDynamicValue, value: dynamicValue, bind } }, children);
1767
- };
1768
-
1769
- // src/dynamics/components/dynamic-selection-control.tsx
1770
- var import_icons11 = require("@elementor/icons");
1771
-
1772
- // src/dynamics/components/dynamic-selection.tsx
1773
- var React51 = __toESM(require("react"));
1774
- var import_react14 = require("react");
1775
- var import_icons10 = require("@elementor/icons");
1776
- var import_ui43 = require("@elementor/ui");
1777
- var import_i18n26 = require("@wordpress/i18n");
1778
-
1779
- // src/dynamics/hooks/use-prop-value-history.ts
1780
- var PROPS_VALUES_HISTORY_KEY = "elementor/dynamic/non-dynamic-values-history";
1781
- var usePropValueHistory = (path) => {
1782
- const valuesHistory = getValues();
1783
- const { element } = useElement();
1784
- const key = `${element.id}-${path}`;
1785
- const value = valuesHistory[key] ?? null;
1786
- const setValue = (newValue) => {
1787
- setValues({ ...valuesHistory, [key]: newValue });
1788
- };
1789
- return [value, setValue];
1790
- };
1791
- var getValues = () => {
1792
- return JSON.parse(sessionStorage.getItem(PROPS_VALUES_HISTORY_KEY) || "{}");
1793
- };
1794
- var setValues = (values) => {
1795
- sessionStorage.setItem(PROPS_VALUES_HISTORY_KEY, JSON.stringify(values));
1601
+ return /* @__PURE__ */ React52.createElement(import_editor_controls34.BoundPropProvider, { setValue: setDynamicValue, value: dynamicValue, bind }, children);
1796
1602
  };
1797
1603
 
1798
1604
  // src/dynamics/components/dynamic-selection.tsx
1605
+ var React53 = __toESM(require("react"));
1606
+ var import_react18 = require("react");
1607
+ var import_editor_controls35 = require("@elementor/editor-controls");
1608
+ var import_icons14 = require("@elementor/icons");
1609
+ var import_ui44 = require("@elementor/ui");
1610
+ var import_i18n32 = require("@wordpress/i18n");
1799
1611
  var SIZE3 = "tiny";
1800
1612
  var DynamicSelection = ({ onSelect }) => {
1801
- const [searchValue, setSearchValue] = (0, import_react14.useState)("");
1613
+ const [searchValue, setSearchValue] = (0, import_react18.useState)("");
1802
1614
  const { groups: dynamicGroups } = getAtomicDynamicTags() || {};
1803
- const { bind, value: currentValue, setValue } = useControl();
1804
- const [, updatePropValueHistory] = usePropValueHistory(bind);
1615
+ const { bind, value: currentValue, setValue } = (0, import_editor_controls35.useBoundProp)();
1616
+ const { setPropValue: updatePropValueHistory } = usePropValueHistory();
1805
1617
  const isCurrentValueDynamic = isDynamicPropValue(currentValue);
1806
- const options4 = useFilteredOptions(bind, searchValue);
1618
+ const options5 = useFilteredOptions(bind, searchValue);
1807
1619
  const handleSearch = (event) => {
1808
1620
  setSearchValue(event.target.value);
1809
1621
  };
1810
1622
  const handleSetDynamicTag = (value) => {
1811
1623
  if (!isCurrentValueDynamic) {
1812
- updatePropValueHistory(currentValue);
1624
+ updatePropValueHistory(bind, currentValue);
1813
1625
  }
1814
1626
  setValue({ $$type: "dynamic", value: { name: value, settings: {} } });
1815
1627
  onSelect?.();
1816
1628
  };
1817
- return /* @__PURE__ */ React51.createElement(import_ui43.Stack, null, /* @__PURE__ */ React51.createElement(import_ui43.Box, { px: 1.5, pb: 1 }, /* @__PURE__ */ React51.createElement(
1818
- import_ui43.TextField,
1629
+ return /* @__PURE__ */ React53.createElement(import_ui44.Stack, null, /* @__PURE__ */ React53.createElement(import_ui44.Box, { px: 1.5, pb: 1 }, /* @__PURE__ */ React53.createElement(
1630
+ import_ui44.TextField,
1819
1631
  {
1820
1632
  fullWidth: true,
1821
1633
  size: SIZE3,
1822
1634
  value: searchValue,
1823
1635
  onChange: handleSearch,
1824
- placeholder: (0, import_i18n26.__)("Search dynamic tag", "elementor"),
1636
+ placeholder: (0, import_i18n32.__)("Search dynamic tag", "elementor"),
1825
1637
  InputProps: {
1826
- startAdornment: /* @__PURE__ */ React51.createElement(import_ui43.InputAdornment, { position: "start" }, /* @__PURE__ */ React51.createElement(import_icons10.SearchIcon, { fontSize: SIZE3 }))
1638
+ startAdornment: /* @__PURE__ */ React53.createElement(import_ui44.InputAdornment, { position: "start" }, /* @__PURE__ */ React53.createElement(import_icons14.SearchIcon, { fontSize: SIZE3 }))
1827
1639
  }
1828
1640
  }
1829
- )), /* @__PURE__ */ React51.createElement(import_ui43.Divider, null), /* @__PURE__ */ React51.createElement(import_ui43.Box, { sx: { overflowY: "auto", height: 260, width: 220 } }, options4.length > 0 ? /* @__PURE__ */ React51.createElement(import_ui43.MenuList, { role: "listbox", tabIndex: 0 }, options4.map(([category, items], index) => /* @__PURE__ */ React51.createElement(import_react14.Fragment, { key: index }, /* @__PURE__ */ React51.createElement(import_ui43.ListSubheader, { sx: { typography: "caption", color: "text.tertiary" } }, dynamicGroups?.[category]?.title || category), items.map(({ value, label: tagLabel }) => {
1641
+ )), /* @__PURE__ */ React53.createElement(import_ui44.Divider, null), /* @__PURE__ */ React53.createElement(import_ui44.Box, { sx: { overflowY: "auto", height: 260, width: 220 } }, options5.length > 0 ? /* @__PURE__ */ React53.createElement(import_ui44.MenuList, { role: "listbox", tabIndex: 0 }, options5.map(([category, items], index) => /* @__PURE__ */ React53.createElement(import_react18.Fragment, { key: index }, /* @__PURE__ */ React53.createElement(import_ui44.ListSubheader, { sx: { typography: "caption", color: "text.tertiary" } }, dynamicGroups?.[category]?.title || category), items.map(({ value, label: tagLabel }) => {
1830
1642
  const isSelected = isCurrentValueDynamic && value === currentValue?.value?.name;
1831
- return /* @__PURE__ */ React51.createElement(
1832
- import_ui43.MenuItem,
1643
+ return /* @__PURE__ */ React53.createElement(
1644
+ import_ui44.MenuItem,
1833
1645
  {
1834
1646
  key: value,
1835
1647
  selected: isSelected,
@@ -1839,20 +1651,20 @@ var DynamicSelection = ({ onSelect }) => {
1839
1651
  },
1840
1652
  tagLabel
1841
1653
  );
1842
- })))) : /* @__PURE__ */ React51.createElement(import_ui43.Stack, { alignItems: "center", p: 2.5, gap: 1.5 }, /* @__PURE__ */ React51.createElement(import_icons10.PhotoIcon, { fontSize: "large" }), /* @__PURE__ */ React51.createElement(import_ui43.Typography, { align: "center", variant: "caption", color: "text.secondary" }, (0, import_i18n26.__)("Sorry, nothing matched", "elementor"), /* @__PURE__ */ React51.createElement("br", null), "\u201C", searchValue, "\u201D."), /* @__PURE__ */ React51.createElement(import_ui43.Typography, { align: "center", variant: "caption", color: "text.secondary" }, /* @__PURE__ */ React51.createElement(
1843
- import_ui43.Link,
1654
+ })))) : /* @__PURE__ */ React53.createElement(import_ui44.Stack, { alignItems: "center", p: 2.5, gap: 1.5 }, /* @__PURE__ */ React53.createElement(import_icons14.PhotoIcon, { fontSize: "large" }), /* @__PURE__ */ React53.createElement(import_ui44.Typography, { align: "center", variant: "caption", color: "text.secondary" }, (0, import_i18n32.__)("Sorry, nothing matched", "elementor"), /* @__PURE__ */ React53.createElement("br", null), "\u201C", searchValue, "\u201D."), /* @__PURE__ */ React53.createElement(import_ui44.Typography, { align: "center", variant: "caption", color: "text.secondary" }, /* @__PURE__ */ React53.createElement(
1655
+ import_ui44.Link,
1844
1656
  {
1845
1657
  color: "secondary",
1846
1658
  variant: "caption",
1847
1659
  component: "button",
1848
1660
  onClick: () => setSearchValue("")
1849
1661
  },
1850
- (0, import_i18n26.__)("Clear the filters", "elementor")
1851
- ), "\xA0", (0, import_i18n26.__)("and try again.", "elementor")))));
1662
+ (0, import_i18n32.__)("Clear the filters", "elementor")
1663
+ ), "\xA0", (0, import_i18n32.__)("and try again.", "elementor")))));
1852
1664
  };
1853
1665
  var useFilteredOptions = (bind, searchValue) => {
1854
1666
  const dynamicTags = usePropDynamicTags(bind);
1855
- const options4 = dynamicTags.reduce((categories, { name, label, group }) => {
1667
+ const options5 = dynamicTags.reduce((categories, { name, label, group }) => {
1856
1668
  const isVisible = label.toLowerCase().includes(searchValue.trim().toLowerCase());
1857
1669
  if (!isVisible) {
1858
1670
  return categories;
@@ -1863,116 +1675,116 @@ var useFilteredOptions = (bind, searchValue) => {
1863
1675
  categories.get(group)?.push({ label, value: name });
1864
1676
  return categories;
1865
1677
  }, /* @__PURE__ */ new Map());
1866
- return [...options4];
1678
+ return [...options5];
1867
1679
  };
1868
1680
 
1869
1681
  // src/dynamics/components/dynamic-selection-control.tsx
1870
- var import_ui44 = require("@elementor/ui");
1871
- var import_i18n27 = require("@wordpress/i18n");
1872
1682
  var SIZE4 = "tiny";
1873
1683
  var DynamicSelectionControl = () => {
1874
- const { bind, value, setValue } = useControl();
1875
- const [propValueFromHistory] = usePropValueHistory(bind);
1684
+ const { bind, value, setValue } = (0, import_editor_controls36.useBoundProp)();
1685
+ const { getPropValue: getPropValueFromHistory } = usePropValueHistory();
1876
1686
  const { name: tagName = "" } = value?.value || {};
1877
- const selectionPopoverId = (0, import_react15.useId)();
1878
- const selectionPopoverState = (0, import_ui44.usePopupState)({ variant: "popover", popupId: selectionPopoverId });
1687
+ const selectionPopoverId = (0, import_react19.useId)();
1688
+ const selectionPopoverState = (0, import_ui45.usePopupState)({ variant: "popover", popupId: selectionPopoverId });
1879
1689
  const dynamicTag = useDynamicTag(bind, tagName);
1880
1690
  const removeDynamicTag = () => {
1881
- setValue(propValueFromHistory ?? null);
1691
+ const propValue = getPropValueFromHistory(bind);
1692
+ setValue(propValue ?? null);
1882
1693
  };
1883
1694
  if (!dynamicTag) {
1884
1695
  throw new Error(`Dynamic tag ${tagName} not found`);
1885
1696
  }
1886
- return /* @__PURE__ */ React52.createElement(import_ui44.Box, null, /* @__PURE__ */ React52.createElement(
1887
- import_ui44.UnstableTag,
1697
+ return /* @__PURE__ */ React54.createElement(import_ui45.Box, null, /* @__PURE__ */ React54.createElement(
1698
+ import_ui45.UnstableTag,
1888
1699
  {
1889
1700
  fullWidth: true,
1890
1701
  showActionsOnHover: true,
1891
1702
  label: dynamicTag.label,
1892
- startIcon: /* @__PURE__ */ React52.createElement(import_icons11.DatabaseIcon, { fontSize: SIZE4 }),
1893
- ...(0, import_ui44.bindTrigger)(selectionPopoverState),
1894
- actions: /* @__PURE__ */ React52.createElement(React52.Fragment, null, /* @__PURE__ */ React52.createElement(DynamicSettingsPopover, { dynamicTag }), /* @__PURE__ */ React52.createElement(
1895
- import_ui44.IconButton,
1703
+ startIcon: /* @__PURE__ */ React54.createElement(import_icons15.DatabaseIcon, { fontSize: SIZE4 }),
1704
+ ...(0, import_ui45.bindTrigger)(selectionPopoverState),
1705
+ actions: /* @__PURE__ */ React54.createElement(React54.Fragment, null, /* @__PURE__ */ React54.createElement(DynamicSettingsPopover, { dynamicTag }), /* @__PURE__ */ React54.createElement(
1706
+ import_ui45.IconButton,
1896
1707
  {
1897
1708
  size: SIZE4,
1898
1709
  onClick: removeDynamicTag,
1899
- "aria-label": (0, import_i18n27.__)("Remove dynamic value", "elementor")
1710
+ "aria-label": (0, import_i18n33.__)("Remove dynamic value", "elementor")
1900
1711
  },
1901
- /* @__PURE__ */ React52.createElement(import_icons11.XIcon, { fontSize: SIZE4 })
1712
+ /* @__PURE__ */ React54.createElement(import_icons15.XIcon, { fontSize: SIZE4 })
1902
1713
  ))
1903
1714
  }
1904
- ), /* @__PURE__ */ React52.createElement(
1905
- import_ui44.Popover,
1715
+ ), /* @__PURE__ */ React54.createElement(
1716
+ import_ui45.Popover,
1906
1717
  {
1907
1718
  disablePortal: true,
1908
1719
  disableScrollLock: true,
1909
1720
  anchorOrigin: { vertical: "bottom", horizontal: "left" },
1910
- ...(0, import_ui44.bindPopover)(selectionPopoverState)
1721
+ ...(0, import_ui45.bindPopover)(selectionPopoverState)
1911
1722
  },
1912
- /* @__PURE__ */ React52.createElement(import_ui44.Stack, null, /* @__PURE__ */ React52.createElement(import_ui44.Stack, { direction: "row", alignItems: "center", pl: 1.5, pr: 0.5, py: 1.5 }, /* @__PURE__ */ React52.createElement(import_icons11.DatabaseIcon, { fontSize: SIZE4, sx: { mr: 0.5 } }), /* @__PURE__ */ React52.createElement(import_ui44.Typography, { variant: "subtitle2" }, (0, import_i18n27.__)("Dynamic Tags", "elementor")), /* @__PURE__ */ React52.createElement(import_ui44.IconButton, { size: SIZE4, sx: { ml: "auto" }, onClick: selectionPopoverState.close }, /* @__PURE__ */ React52.createElement(import_icons11.XIcon, { fontSize: SIZE4 }))), /* @__PURE__ */ React52.createElement(DynamicSelection, { onSelect: selectionPopoverState.close }))
1723
+ /* @__PURE__ */ React54.createElement(import_ui45.Stack, null, /* @__PURE__ */ React54.createElement(import_ui45.Stack, { direction: "row", alignItems: "center", pl: 1.5, pr: 0.5, py: 1.5 }, /* @__PURE__ */ React54.createElement(import_icons15.DatabaseIcon, { fontSize: SIZE4, sx: { mr: 0.5 } }), /* @__PURE__ */ React54.createElement(import_ui45.Typography, { variant: "subtitle2" }, (0, import_i18n33.__)("Dynamic Tags", "elementor")), /* @__PURE__ */ React54.createElement(import_ui45.IconButton, { size: SIZE4, sx: { ml: "auto" }, onClick: selectionPopoverState.close }, /* @__PURE__ */ React54.createElement(import_icons15.XIcon, { fontSize: SIZE4 }))), /* @__PURE__ */ React54.createElement(DynamicSelection, { onSelect: selectionPopoverState.close }))
1913
1724
  ));
1914
1725
  };
1915
1726
  var DynamicSettingsPopover = ({ dynamicTag }) => {
1916
- const popupId = (0, import_react15.useId)();
1917
- const settingsPopupState = (0, import_ui44.usePopupState)({ variant: "popover", popupId });
1727
+ const popupId = (0, import_react19.useId)();
1728
+ const settingsPopupState = (0, import_ui45.usePopupState)({ variant: "popover", popupId });
1918
1729
  const hasDynamicSettings = !!dynamicTag.atomic_controls.length;
1919
1730
  if (!hasDynamicSettings) {
1920
1731
  return null;
1921
1732
  }
1922
- return /* @__PURE__ */ React52.createElement(React52.Fragment, null, /* @__PURE__ */ React52.createElement(
1923
- import_ui44.IconButton,
1733
+ return /* @__PURE__ */ React54.createElement(React54.Fragment, null, /* @__PURE__ */ React54.createElement(
1734
+ import_ui45.IconButton,
1924
1735
  {
1925
1736
  size: SIZE4,
1926
- ...(0, import_ui44.bindTrigger)(settingsPopupState),
1927
- "aria-label": (0, import_i18n27.__)("Settings", "elementor")
1737
+ ...(0, import_ui45.bindTrigger)(settingsPopupState),
1738
+ "aria-label": (0, import_i18n33.__)("Settings", "elementor")
1928
1739
  },
1929
- /* @__PURE__ */ React52.createElement(import_icons11.SettingsIcon, { fontSize: SIZE4 })
1930
- ), /* @__PURE__ */ React52.createElement(
1931
- import_ui44.Popover,
1740
+ /* @__PURE__ */ React54.createElement(import_icons15.SettingsIcon, { fontSize: SIZE4 })
1741
+ ), /* @__PURE__ */ React54.createElement(
1742
+ import_ui45.Popover,
1932
1743
  {
1933
1744
  disableScrollLock: true,
1934
1745
  anchorOrigin: { vertical: "bottom", horizontal: "center" },
1935
- ...(0, import_ui44.bindPopover)(settingsPopupState)
1746
+ ...(0, import_ui45.bindPopover)(settingsPopupState)
1936
1747
  },
1937
- /* @__PURE__ */ React52.createElement(import_ui44.Paper, { component: import_ui44.Stack, sx: { minHeight: "300px", width: "220px" } }, /* @__PURE__ */ React52.createElement(import_ui44.Stack, { direction: "row", alignItems: "center", px: 1.5, pt: 2, pb: 1 }, /* @__PURE__ */ React52.createElement(import_icons11.DatabaseIcon, { fontSize: SIZE4, sx: { mr: 0.5 } }), /* @__PURE__ */ React52.createElement(import_ui44.Typography, { variant: "subtitle2" }, dynamicTag.label), /* @__PURE__ */ React52.createElement(import_ui44.IconButton, { sx: { ml: "auto" }, size: SIZE4, onClick: settingsPopupState.close }, /* @__PURE__ */ React52.createElement(import_icons11.XIcon, { fontSize: SIZE4 }))), /* @__PURE__ */ React52.createElement(DynamicSettings, { controls: dynamicTag.atomic_controls }))
1748
+ /* @__PURE__ */ React54.createElement(import_ui45.Paper, { component: import_ui45.Stack, sx: { minHeight: "300px", width: "220px" } }, /* @__PURE__ */ React54.createElement(import_ui45.Stack, { direction: "row", alignItems: "center", px: 1.5, pt: 2, pb: 1 }, /* @__PURE__ */ React54.createElement(import_icons15.DatabaseIcon, { fontSize: SIZE4, sx: { mr: 0.5 } }), /* @__PURE__ */ React54.createElement(import_ui45.Typography, { variant: "subtitle2" }, dynamicTag.label), /* @__PURE__ */ React54.createElement(import_ui45.IconButton, { sx: { ml: "auto" }, size: SIZE4, onClick: settingsPopupState.close }, /* @__PURE__ */ React54.createElement(import_icons15.XIcon, { fontSize: SIZE4 }))), /* @__PURE__ */ React54.createElement(DynamicSettings, { controls: dynamicTag.atomic_controls }))
1938
1749
  ));
1939
1750
  };
1940
1751
  var DynamicSettings = ({ controls }) => {
1941
1752
  const tabs = controls.filter(({ type }) => type === "section");
1942
- const { getTabsProps, getTabProps, getTabPanelProps } = (0, import_ui44.useTabs)(0);
1753
+ const { getTabsProps, getTabProps, getTabPanelProps } = (0, import_ui45.useTabs)(0);
1943
1754
  if (!tabs.length) {
1944
1755
  return null;
1945
1756
  }
1946
- return /* @__PURE__ */ React52.createElement(React52.Fragment, null, /* @__PURE__ */ React52.createElement(import_ui44.Tabs, { indicatorColor: "secondary", textColor: "secondary", ...getTabsProps() }, tabs.map(({ value }, index) => /* @__PURE__ */ React52.createElement(import_ui44.Tab, { key: index, label: value.label, sx: { px: 1, py: 0.5 }, ...getTabProps(index) }))), /* @__PURE__ */ React52.createElement(import_ui44.Divider, null), tabs.map(({ value }, index) => {
1947
- return /* @__PURE__ */ React52.createElement(import_ui44.TabPanel, { key: index, sx: { flexGrow: 1 }, ...getTabPanelProps(index) }, /* @__PURE__ */ React52.createElement(import_ui44.Stack, { gap: 1, px: 2 }, value.items.map((item) => {
1757
+ return /* @__PURE__ */ React54.createElement(React54.Fragment, null, /* @__PURE__ */ React54.createElement(import_ui45.Tabs, { indicatorColor: "secondary", textColor: "secondary", ...getTabsProps() }, tabs.map(({ value }, index) => /* @__PURE__ */ React54.createElement(import_ui45.Tab, { key: index, label: value.label, sx: { px: 1, py: 0.5 }, ...getTabProps(index) }))), /* @__PURE__ */ React54.createElement(import_ui45.Divider, null), tabs.map(({ value }, index) => {
1758
+ return /* @__PURE__ */ React54.createElement(import_ui45.TabPanel, { key: index, sx: { flexGrow: 1 }, ...getTabPanelProps(index) }, /* @__PURE__ */ React54.createElement(import_ui45.Stack, { gap: 1, px: 2 }, value.items.map((item) => {
1948
1759
  if (item.type === "control") {
1949
- return /* @__PURE__ */ React52.createElement(Control6, { key: item.value.bind, control: item.value });
1760
+ return /* @__PURE__ */ React54.createElement(Control3, { key: item.value.bind, control: item.value });
1950
1761
  }
1951
1762
  return null;
1952
1763
  })));
1953
1764
  }));
1954
1765
  };
1955
- var Control6 = ({ control }) => {
1766
+ var Control3 = ({ control }) => {
1956
1767
  if (!getControlByType(control.type)) {
1957
1768
  return null;
1958
1769
  }
1959
- return /* @__PURE__ */ React52.createElement(DynamicControl, { bind: control.bind }, control.label ? /* @__PURE__ */ React52.createElement(ControlLabel, null, control.label) : null, /* @__PURE__ */ React52.createElement(Control, { type: control.type, props: control.props }));
1770
+ return /* @__PURE__ */ React54.createElement(DynamicControl, { bind: control.bind }, control.label ? /* @__PURE__ */ React54.createElement(import_editor_controls36.ControlLabel, null, control.label) : null, /* @__PURE__ */ React54.createElement(Control, { type: control.type, props: control.props }));
1960
1771
  };
1961
1772
 
1962
1773
  // src/dynamics/hooks/use-prop-dynamic-action.tsx
1963
- var React53 = __toESM(require("react"));
1964
- var import_icons12 = require("@elementor/icons");
1965
- var import_i18n28 = require("@wordpress/i18n");
1774
+ var React55 = __toESM(require("react"));
1775
+ var import_editor_controls37 = require("@elementor/editor-controls");
1776
+ var import_icons16 = require("@elementor/icons");
1777
+ var import_i18n34 = require("@wordpress/i18n");
1966
1778
  var usePropDynamicAction = () => {
1967
- const { bind } = useControl();
1779
+ const { bind } = (0, import_editor_controls37.useBoundProp)();
1968
1780
  const { elementType } = useElement();
1969
1781
  const propType = elementType.propsSchema[bind];
1970
1782
  const visible = !!propType && supportsDynamic(propType);
1971
1783
  return {
1972
1784
  visible,
1973
- icon: import_icons12.DatabaseIcon,
1974
- title: (0, import_i18n28.__)("Dynamic Tags", "elementor"),
1975
- popoverContent: ({ closePopover }) => /* @__PURE__ */ React53.createElement(DynamicSelection, { onSelect: closePopover })
1785
+ icon: import_icons16.DatabaseIcon,
1786
+ title: (0, import_i18n34.__)("Dynamic Tags", "elementor"),
1787
+ popoverContent: ({ closePopover }) => /* @__PURE__ */ React55.createElement(DynamicSelection, { onSelect: closePopover })
1976
1788
  };
1977
1789
  };
1978
1790
 
@@ -2000,9 +1812,9 @@ function init2() {
2000
1812
  init();
2001
1813
  }
2002
1814
  var blockV1Panel = () => {
2003
- (0, import_editor_v1_adapters9.__privateBlockDataCommand)({
1815
+ (0, import_editor_v1_adapters3.__privateBlockDataCommand)({
2004
1816
  command: "panel/editor/open",
2005
- condition: shouldUseV2Panel
1817
+ condition: isAtomicWidgetSelected
2006
1818
  });
2007
1819
  };
2008
1820
 
@@ -2010,8 +1822,7 @@ var blockV1Panel = () => {
2010
1822
  init2();
2011
1823
  // Annotate the CommonJS export names for ESM import in node:
2012
1824
  0 && (module.exports = {
2013
- controlActionsMenu,
2014
1825
  replaceControl,
2015
- useControl
1826
+ useBoundProp
2016
1827
  });
2017
1828
  //# sourceMappingURL=index.js.map