@elementor/editor-editing-panel 0.15.0 → 0.16.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 (41) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/dist/index.js +693 -120
  3. package/dist/index.js.map +1 -1
  4. package/dist/index.mjs +711 -111
  5. package/dist/index.mjs.map +1 -1
  6. package/package.json +7 -6
  7. package/src/components/style-sections/position-section/position-section.tsx +15 -0
  8. package/src/components/style-sections/position-section/z-index-control.tsx +16 -0
  9. package/src/components/style-sections/size-section.tsx +9 -12
  10. package/src/components/style-sections/spacing-section/linked-dimensions-control.tsx +140 -0
  11. package/src/components/style-sections/spacing-section/spacing-section.tsx +22 -0
  12. package/src/components/style-sections/typography-section/letter-spacing-control.tsx +16 -0
  13. package/src/components/style-sections/typography-section/text-color-control.tsx +16 -0
  14. package/src/components/style-sections/typography-section/transform-control.tsx +23 -0
  15. package/src/components/style-sections/typography-section/typography-section.tsx +15 -1
  16. package/src/components/style-sections/typography-section/word-spacing-control.tsx +16 -0
  17. package/src/components/style-tab.tsx +29 -5
  18. package/src/contexts/style-context.tsx +8 -2
  19. package/src/controls/components/control-toggle-button-group.tsx +59 -0
  20. package/src/controls/components/text-field-inner-selection.tsx +79 -0
  21. package/src/controls/control-types/color-control.tsx +24 -0
  22. package/src/controls/control-types/number-control.tsx +25 -0
  23. package/src/controls/control-types/size-control.tsx +20 -34
  24. package/src/controls/control-types/toggle-control.tsx +25 -0
  25. package/src/controls/hooks/use-style-control.ts +2 -1
  26. package/src/controls/settings-control.tsx +1 -1
  27. package/src/dynamics/components/dynamic-selection-control.tsx +180 -0
  28. package/src/dynamics/components/dynamic-selection.tsx +144 -0
  29. package/src/dynamics/dynamic-control.tsx +42 -0
  30. package/src/dynamics/hooks/use-dynamic-tag.ts +10 -0
  31. package/src/{hooks/use-dynamic-tags-config.ts → dynamics/hooks/use-prop-dynamic-tags.ts} +6 -5
  32. package/src/dynamics/init.ts +10 -0
  33. package/src/{sync → dynamics/sync}/get-atomic-dynamic-tags.ts +1 -1
  34. package/src/{sync → dynamics/sync}/get-elementor-config.ts +1 -1
  35. package/src/dynamics/types.ts +32 -0
  36. package/src/dynamics/utils.ts +9 -0
  37. package/src/init.ts +4 -0
  38. package/src/props/is-transformable.ts +14 -0
  39. package/src/sync/types.ts +0 -13
  40. package/src/sync/update-style.ts +2 -2
  41. package/src/types.ts +9 -6
package/dist/index.js CHANGED
@@ -64,8 +64,8 @@ function useControl(defaultValue) {
64
64
  var import_editor_panels2 = require("@elementor/editor-panels");
65
65
 
66
66
  // src/components/editing-panel.tsx
67
- var React23 = __toESM(require("react"));
68
- var import_i18n9 = require("@wordpress/i18n");
67
+ var React36 = __toESM(require("react"));
68
+ var import_i18n17 = require("@wordpress/i18n");
69
69
 
70
70
  // src/hooks/use-selected-elements.ts
71
71
  var import_editor_v1_adapters = require("@elementor/editor-v1-adapters");
@@ -149,13 +149,13 @@ function useElementContext() {
149
149
  }
150
150
 
151
151
  // src/components/editing-panel-tabs.tsx
152
- var import_ui15 = require("@elementor/ui");
153
- var React22 = __toESM(require("react"));
154
- var import_i18n8 = require("@wordpress/i18n");
152
+ var import_ui22 = require("@elementor/ui");
153
+ var React35 = __toESM(require("react"));
154
+ var import_i18n16 = require("@wordpress/i18n");
155
155
 
156
156
  // src/components/settings-tab.tsx
157
- var React12 = __toESM(require("react"));
158
- var import_ui9 = require("@elementor/ui");
157
+ var React13 = __toESM(require("react"));
158
+ var import_ui10 = require("@elementor/ui");
159
159
 
160
160
  // src/controls/settings-control.tsx
161
161
  var React4 = __toESM(require("react"));
@@ -221,7 +221,7 @@ var ControlContainer = (props) => /* @__PURE__ */ React3.createElement(StyledSta
221
221
  // src/controls/settings-control.tsx
222
222
  var SettingsControlProvider = ({ bind, children }) => {
223
223
  const { element, elementType } = useElementContext();
224
- const defaultValue = elementType.propsSchema[bind]?.default;
224
+ const defaultValue = elementType.propsSchema[bind]?.type.default;
225
225
  const settingsValue = useWidgetSettings({ id: element.id, bind });
226
226
  const value = settingsValue ?? defaultValue ?? null;
227
227
  const setValue = (newValue) => {
@@ -249,7 +249,7 @@ var AccordionSection = ({ title, children }) => {
249
249
  };
250
250
 
251
251
  // src/controls/control.tsx
252
- var React11 = __toESM(require("react"));
252
+ var React12 = __toESM(require("react"));
253
253
  var import_utils = require("@elementor/utils");
254
254
 
255
255
  // src/controls/control-types/image-control.tsx
@@ -333,8 +333,8 @@ var TextAreaControl = ({ placeholder }) => {
333
333
  };
334
334
 
335
335
  // src/controls/control-types/size-control.tsx
336
- var React9 = __toESM(require("react"));
337
- var import_ui7 = require("@elementor/ui");
336
+ var React10 = __toESM(require("react"));
337
+ var import_ui8 = require("@elementor/ui");
338
338
 
339
339
  // src/controls/hooks/use-sync-external-state.tsx
340
340
  var import_react4 = require("react");
@@ -369,9 +369,61 @@ var useSyncExternalState = ({
369
369
  return [internal, setInternalValue];
370
370
  };
371
371
 
372
+ // src/controls/components/text-field-inner-selection.tsx
373
+ var React9 = __toESM(require("react"));
374
+ var import_ui7 = require("@elementor/ui");
375
+ var import_react5 = require("react");
376
+ var TextFieldInnerSelection = ({
377
+ placeholder,
378
+ type,
379
+ value,
380
+ onChange,
381
+ endAdornment,
382
+ startAdornment
383
+ }) => {
384
+ return /* @__PURE__ */ React9.createElement(
385
+ import_ui7.TextField,
386
+ {
387
+ size: "tiny",
388
+ type,
389
+ value,
390
+ onChange,
391
+ placeholder,
392
+ InputProps: {
393
+ endAdornment,
394
+ startAdornment
395
+ }
396
+ }
397
+ );
398
+ };
399
+ var SelectionEndAdornment = ({
400
+ options: options2,
401
+ onClick,
402
+ value
403
+ }) => {
404
+ const popupState = (0, import_ui7.usePopupState)({
405
+ variant: "popover",
406
+ popupId: (0, import_react5.useId)()
407
+ });
408
+ const handleMenuItemClick = (index) => {
409
+ onClick(options2[index]);
410
+ popupState.close();
411
+ };
412
+ return /* @__PURE__ */ React9.createElement(import_ui7.InputAdornment, { position: "end" }, /* @__PURE__ */ React9.createElement(
413
+ import_ui7.Button,
414
+ {
415
+ size: "small",
416
+ color: "inherit",
417
+ sx: { font: "inherit", minWidth: "initial" },
418
+ ...(0, import_ui7.bindTrigger)(popupState)
419
+ },
420
+ value.toUpperCase()
421
+ ), /* @__PURE__ */ React9.createElement(import_ui7.Menu, { MenuListProps: { dense: true }, ...(0, import_ui7.bindMenu)(popupState) }, options2.map((option, index) => /* @__PURE__ */ React9.createElement(import_ui7.MenuItem, { key: option, onClick: () => handleMenuItemClick(index) }, option.toUpperCase()))));
422
+ };
423
+
372
424
  // src/controls/control-types/size-control.tsx
373
425
  var defaultUnits = ["px", "%", "em", "rem", "vw"];
374
- var SizeControl = ({ units = defaultUnits, placeholder }) => {
426
+ var SizeControl = ({ units = defaultUnits, placeholder, startIcon }) => {
375
427
  const { value, setValue } = useControl();
376
428
  const [state, setState] = useSyncExternalState({
377
429
  external: value,
@@ -382,8 +434,7 @@ var SizeControl = ({ units = defaultUnits, placeholder }) => {
382
434
  value: { unit: controlValue?.value.unit || "px", size: NaN }
383
435
  })
384
436
  });
385
- const handleUnitChange = (event) => {
386
- const unit = event.target.value;
437
+ const handleUnitChange = (unit) => {
387
438
  setState((prev) => ({
388
439
  ...prev,
389
440
  value: {
@@ -402,39 +453,28 @@ var SizeControl = ({ units = defaultUnits, placeholder }) => {
402
453
  }
403
454
  }));
404
455
  };
405
- return /* @__PURE__ */ React9.createElement(import_ui7.Stack, { direction: "row" }, /* @__PURE__ */ React9.createElement(
406
- import_ui7.TextField,
456
+ return /* @__PURE__ */ React10.createElement(
457
+ TextFieldInnerSelection,
407
458
  {
408
- size: "tiny",
459
+ endAdornment: /* @__PURE__ */ React10.createElement(SelectionEndAdornment, { options: units, onClick: handleUnitChange, value: state.value.unit }),
460
+ placeholder,
461
+ startAdornment: startIcon ?? /* @__PURE__ */ React10.createElement(import_ui8.InputAdornment, { position: "start" }, startIcon),
409
462
  type: "number",
410
463
  value: Number.isNaN(state.value.size) ? "" : state.value.size,
411
- onChange: handleSizeChange,
412
- placeholder
464
+ onChange: handleSizeChange
413
465
  }
414
- ), /* @__PURE__ */ React9.createElement(
415
- import_ui7.Select,
416
- {
417
- size: "tiny",
418
- value: state.value.unit,
419
- onChange: handleUnitChange,
420
- MenuProps: {
421
- anchorOrigin: { vertical: "bottom", horizontal: "right" },
422
- transformOrigin: { vertical: "top", horizontal: "right" }
423
- }
424
- },
425
- units.map((unit) => /* @__PURE__ */ React9.createElement(import_ui7.MenuItem, { key: unit, value: unit }, unit.toUpperCase()))
426
- ));
466
+ );
427
467
  };
428
468
 
429
469
  // src/controls/control-types/select-control.tsx
430
- var React10 = __toESM(require("react"));
431
- var import_ui8 = require("@elementor/ui");
432
- var SelectControl = ({ options }) => {
470
+ var React11 = __toESM(require("react"));
471
+ var import_ui9 = require("@elementor/ui");
472
+ var SelectControl = ({ options: options2 }) => {
433
473
  const { value, setValue } = useControl();
434
474
  const handleChange = (event) => {
435
475
  setValue(event.target.value);
436
476
  };
437
- return /* @__PURE__ */ React10.createElement(import_ui8.Select, { size: "tiny", value: value ?? "", onChange: handleChange }, options.map(({ label, ...props }) => /* @__PURE__ */ React10.createElement(import_ui8.MenuItem, { key: props.value, ...props }, label)));
477
+ return /* @__PURE__ */ React11.createElement(import_ui9.Select, { size: "tiny", value: value ?? "", onChange: handleChange }, options2.map(({ label, ...props }) => /* @__PURE__ */ React11.createElement(import_ui9.MenuItem, { key: props.value, ...props }, label)));
438
478
  };
439
479
 
440
480
  // src/controls/controls-registry.tsx
@@ -461,20 +501,20 @@ var Control = ({ props, type }) => {
461
501
  });
462
502
  }
463
503
  const ControlComponent = getControlReplacement({ value }) || ControlByType;
464
- return /* @__PURE__ */ React11.createElement(ControlComponent, { ...props });
504
+ return /* @__PURE__ */ React12.createElement(ControlComponent, { ...props });
465
505
  };
466
506
 
467
507
  // src/components/settings-tab.tsx
468
508
  var SettingsTab = () => {
469
509
  const { elementType } = useElementContext();
470
- return /* @__PURE__ */ React12.createElement(import_ui9.Stack, null, elementType.controls.map(({ type, value }, index) => {
510
+ return /* @__PURE__ */ React13.createElement(import_ui10.Stack, null, elementType.controls.map(({ type, value }, index) => {
471
511
  if (type === "control") {
472
- return /* @__PURE__ */ React12.createElement(Control2, { key: value.bind, control: value });
512
+ return /* @__PURE__ */ React13.createElement(Control2, { key: value.bind, control: value });
473
513
  }
474
514
  if (type === "section") {
475
- return /* @__PURE__ */ React12.createElement(AccordionSection, { key: type + "." + index, title: value.label }, value.items?.map((item) => {
515
+ return /* @__PURE__ */ React13.createElement(AccordionSection, { key: type + "." + index, title: value.label }, value.items?.map((item) => {
476
516
  if (item.type === "control") {
477
- return /* @__PURE__ */ React12.createElement(Control2, { key: item.value.bind, control: item.value });
517
+ return /* @__PURE__ */ React13.createElement(Control2, { key: item.value.bind, control: item.value });
478
518
  }
479
519
  return null;
480
520
  }));
@@ -486,24 +526,24 @@ var Control2 = ({ control }) => {
486
526
  if (!getControlByType(control.type)) {
487
527
  return null;
488
528
  }
489
- return /* @__PURE__ */ React12.createElement(SettingsControl, { bind: control.bind }, control.label ? /* @__PURE__ */ React12.createElement(SettingsControl.Label, null, control.label) : null, /* @__PURE__ */ React12.createElement(Control, { type: control.type, props: control.props }));
529
+ return /* @__PURE__ */ React13.createElement(SettingsControl, { bind: control.bind }, control.label ? /* @__PURE__ */ React13.createElement(SettingsControl.Label, null, control.label) : null, /* @__PURE__ */ React13.createElement(Control, { type: control.type, props: control.props }));
490
530
  };
491
531
 
492
532
  // src/components/style-tab.tsx
493
- var React21 = __toESM(require("react"));
533
+ var React34 = __toESM(require("react"));
494
534
 
495
535
  // src/contexts/style-context.tsx
496
- var React13 = __toESM(require("react"));
497
- var import_react5 = require("react");
536
+ var React14 = __toESM(require("react"));
537
+ var import_react6 = require("react");
498
538
  var import_editor_responsive = require("@elementor/editor-responsive");
499
- var Context2 = (0, import_react5.createContext)(null);
500
- function StyleContext({ children, selectedStyleDef }) {
539
+ var Context2 = (0, import_react6.createContext)(null);
540
+ function StyleContext({ children, selectedStyleDef, selectedClassesProp }) {
501
541
  const breakpoint = (0, import_editor_responsive.useActiveBreakpoint)();
502
542
  const selectedMeta = { breakpoint, state: null };
503
- return /* @__PURE__ */ React13.createElement(Context2.Provider, { value: { selectedStyleDef, selectedMeta } }, children);
543
+ return /* @__PURE__ */ React14.createElement(Context2.Provider, { value: { selectedStyleDef, selectedMeta, selectedClassesProp } }, children);
504
544
  }
505
545
  function useStyleContext() {
506
- const context = (0, import_react5.useContext)(Context2);
546
+ const context = (0, import_react6.useContext)(Context2);
507
547
  if (!context) {
508
548
  throw new Error("UseStyleContext must be used within a StyleContextProvider");
509
549
  }
@@ -531,13 +571,13 @@ var useElementStyles = (elementID) => {
531
571
  };
532
572
 
533
573
  // src/components/style-tab.tsx
534
- var import_ui14 = require("@elementor/ui");
574
+ var import_ui21 = require("@elementor/ui");
535
575
 
536
576
  // src/components/style-sections/size-section.tsx
537
577
  var React16 = __toESM(require("react"));
538
578
 
539
579
  // src/controls/style-control.tsx
540
- var React14 = __toESM(require("react"));
580
+ var React15 = __toESM(require("react"));
541
581
 
542
582
  // src/hooks/use-element-style-prop.ts
543
583
  var import_editor_v1_adapters6 = require("@elementor/editor-v1-adapters");
@@ -571,7 +611,7 @@ function getVariantByMeta(styleDef, meta) {
571
611
 
572
612
  // src/sync/update-style.ts
573
613
  var import_editor_v1_adapters7 = require("@elementor/editor-v1-adapters");
574
- var updateStyle = ({ elementID, styleDefID, meta, props, bind = "classes" }) => {
614
+ var updateStyle = ({ elementID, styleDefID, meta, props, bind }) => {
575
615
  const container = getContainer(elementID);
576
616
  (0, import_editor_v1_adapters7.__privateRunCommand)("document/atomic-widgets/styles", {
577
617
  container,
@@ -585,7 +625,7 @@ var updateStyle = ({ elementID, styleDefID, meta, props, bind = "classes" }) =>
585
625
  // src/controls/hooks/use-style-control.ts
586
626
  var useStyleControl = (propName) => {
587
627
  const { element } = useElementContext();
588
- const { selectedStyleDef, selectedMeta } = useStyleContext();
628
+ const { selectedStyleDef, selectedMeta, selectedClassesProp } = useStyleContext();
589
629
  const value = useElementStyleProp({
590
630
  elementID: element.id,
591
631
  styleDefID: selectedStyleDef?.id,
@@ -597,7 +637,8 @@ var useStyleControl = (propName) => {
597
637
  elementID: element.id,
598
638
  styleDefID: selectedStyleDef?.id,
599
639
  props: { [propName]: newValue },
600
- meta: selectedMeta
640
+ meta: selectedMeta,
641
+ bind: selectedClassesProp
601
642
  });
602
643
  };
603
644
  return [value, setValue];
@@ -606,68 +647,35 @@ var useStyleControl = (propName) => {
606
647
  // src/controls/style-control.tsx
607
648
  var StyleControl = ({ bind, children }) => {
608
649
  const [value, setValue] = useStyleControl(bind);
609
- return /* @__PURE__ */ React14.createElement(ControlContext.Provider, { value: { bind, value, setValue } }, children);
650
+ return /* @__PURE__ */ React15.createElement(ControlContext.Provider, { value: { bind, value, setValue } }, children);
610
651
  };
611
652
  StyleControl.Label = ControlLabel;
612
653
 
613
- // src/components/collapsible-content.tsx
614
- var React15 = __toESM(require("react"));
615
- var import_react6 = require("react");
616
- var import_icons2 = require("@elementor/icons");
617
- var import_ui10 = require("@elementor/ui");
618
- var import_i18n2 = require("@wordpress/i18n");
619
- var CollapsibleContent = ({ children, defaultOpen = false }) => {
620
- const [open, setOpen] = (0, import_react6.useState)(defaultOpen);
621
- const handleToggle = () => {
622
- setOpen((prevOpen) => !prevOpen);
623
- };
624
- return /* @__PURE__ */ React15.createElement(import_ui10.Stack, { sx: { py: 0.5 } }, /* @__PURE__ */ React15.createElement(
625
- import_ui10.Button,
626
- {
627
- fullWidth: true,
628
- size: "small",
629
- color: "secondary",
630
- variant: "outlined",
631
- onClick: handleToggle,
632
- endIcon: /* @__PURE__ */ React15.createElement(ChevronIcon, { open })
633
- },
634
- open ? (0, import_i18n2.__)("Show less", "elementor") : (0, import_i18n2.__)("Show more", "elementor")
635
- ), /* @__PURE__ */ React15.createElement(import_ui10.Collapse, { in: open, timeout: "auto" }, children));
636
- };
637
- var ChevronIcon = (0, import_ui10.styled)(import_icons2.ChevronDownIcon, {
638
- shouldForwardProp: (prop) => prop !== "open"
639
- })(({ theme, open }) => ({
640
- transform: open ? "rotate(180deg)" : "rotate(0)",
641
- transition: theme.transitions.create("transform", {
642
- duration: theme.transitions.duration.standard
643
- })
644
- }));
645
-
646
654
  // src/components/style-sections/size-section.tsx
647
655
  var import_ui11 = require("@elementor/ui");
648
- var import_i18n3 = require("@wordpress/i18n");
656
+ var import_i18n2 = require("@wordpress/i18n");
649
657
  var SizeSection = () => {
650
- return /* @__PURE__ */ React16.createElement(AccordionSection, { title: (0, import_i18n3.__)("Size", "elementor") }, /* @__PURE__ */ React16.createElement(import_ui11.Stack, { gap: 1.5 }, /* @__PURE__ */ React16.createElement(import_ui11.Stack, { direction: "row", gap: 2 }, /* @__PURE__ */ React16.createElement(Control3, { bind: "width", label: (0, import_i18n3.__)("Width", "elementor") }), /* @__PURE__ */ React16.createElement(Control3, { bind: "height", label: (0, import_i18n3.__)("Height", "elementor") })), /* @__PURE__ */ React16.createElement(CollapsibleContent, null, /* @__PURE__ */ React16.createElement(import_ui11.Stack, { gap: 1.5, sx: { pt: 1.5 } }, /* @__PURE__ */ React16.createElement(import_ui11.Stack, { direction: "row", gap: 2 }, /* @__PURE__ */ React16.createElement(Control3, { bind: "minWidth", label: (0, import_i18n3.__)("Min. Width", "elementor") }), /* @__PURE__ */ React16.createElement(Control3, { bind: "minHeight", label: (0, import_i18n3.__)("Min. Height", "elementor") })), /* @__PURE__ */ React16.createElement(import_ui11.Stack, { direction: "row", gap: 2 }, /* @__PURE__ */ React16.createElement(Control3, { bind: "maxWidth", label: (0, import_i18n3.__)("Max. Width", "elementor") }), /* @__PURE__ */ React16.createElement(Control3, { bind: "maxHeight", label: (0, import_i18n3.__)("Max. Height", "elementor") }))))));
658
+ return /* @__PURE__ */ React16.createElement(AccordionSection, { title: (0, import_i18n2.__)("Size", "elementor") }, /* @__PURE__ */ React16.createElement(import_ui11.Stack, { gap: 1.5 }, /* @__PURE__ */ React16.createElement(import_ui11.Stack, { direction: "row", gap: 2 }, /* @__PURE__ */ React16.createElement(Control3, { bind: "width", label: (0, import_i18n2.__)("Width", "elementor") }), /* @__PURE__ */ React16.createElement(Control3, { bind: "height", label: (0, import_i18n2.__)("Height", "elementor") })), /* @__PURE__ */ React16.createElement(import_ui11.Stack, { gap: 1.5, sx: { pt: 1.5 } }, /* @__PURE__ */ React16.createElement(import_ui11.Stack, { direction: "row", gap: 2 }, /* @__PURE__ */ React16.createElement(Control3, { bind: "minWidth", label: (0, import_i18n2.__)("Min. Width", "elementor") }), /* @__PURE__ */ React16.createElement(Control3, { bind: "minHeight", label: (0, import_i18n2.__)("Min. Height", "elementor") })), /* @__PURE__ */ React16.createElement(import_ui11.Stack, { direction: "row", gap: 2 }, /* @__PURE__ */ React16.createElement(Control3, { bind: "maxWidth", label: (0, import_i18n2.__)("Max. Width", "elementor") }), /* @__PURE__ */ React16.createElement(Control3, { bind: "maxHeight", label: (0, import_i18n2.__)("Max. Height", "elementor") })))));
651
659
  };
652
660
  var Control3 = ({ label, bind }) => {
653
661
  return /* @__PURE__ */ React16.createElement(StyleControl, { bind }, /* @__PURE__ */ React16.createElement(ControlContainer, { direction: "column" }, /* @__PURE__ */ React16.createElement(StyleControl.Label, null, label), /* @__PURE__ */ React16.createElement(Control, { type: "size" })));
654
662
  };
655
663
 
656
664
  // src/components/style-sections/typography-section/typography-section.tsx
657
- var React20 = __toESM(require("react"));
658
- var import_ui13 = require("@elementor/ui");
665
+ var React28 = __toESM(require("react"));
666
+ var import_ui16 = require("@elementor/ui");
659
667
 
660
668
  // src/components/style-sections/typography-section/text-style-control.tsx
661
669
  var React17 = __toESM(require("react"));
662
670
  var import_ui12 = require("@elementor/ui");
663
- var import_icons3 = require("@elementor/icons");
664
- var import_i18n4 = require("@wordpress/i18n");
671
+ var import_icons2 = require("@elementor/icons");
672
+ var import_i18n3 = require("@wordpress/i18n");
665
673
  var buttonSize = "tiny";
666
674
  var TextStyleControl = () => {
667
675
  const [fontStyle, setFontStyle] = useStyleControl("fontStyle");
668
676
  const [textDecoration, setTextDecoration] = useStyleControl("textDecoration");
669
677
  const formats = [fontStyle, ...(textDecoration || "").split(" ")];
670
- return /* @__PURE__ */ React17.createElement(ControlContainer, null, /* @__PURE__ */ React17.createElement(ControlLabel, null, (0, import_i18n4.__)("Style", "elementor")), /* @__PURE__ */ React17.createElement(import_ui12.ToggleButtonGroup, { value: formats }, /* @__PURE__ */ React17.createElement(
678
+ return /* @__PURE__ */ React17.createElement(ControlContainer, null, /* @__PURE__ */ React17.createElement(ControlLabel, null, (0, import_i18n3.__)("Style", "elementor")), /* @__PURE__ */ React17.createElement(import_ui12.ToggleButtonGroup, { value: formats }, /* @__PURE__ */ React17.createElement(
671
679
  ToggleButton,
672
680
  {
673
681
  value: "italic",
@@ -675,7 +683,7 @@ var TextStyleControl = () => {
675
683
  "aria-label": "italic",
676
684
  sx: { marginLeft: "auto" }
677
685
  },
678
- /* @__PURE__ */ React17.createElement(import_icons3.ItalicIcon, { fontSize: buttonSize })
686
+ /* @__PURE__ */ React17.createElement(import_icons2.ItalicIcon, { fontSize: buttonSize })
679
687
  ), /* @__PURE__ */ React17.createElement(
680
688
  ShorthandControl,
681
689
  {
@@ -684,7 +692,7 @@ var TextStyleControl = () => {
684
692
  updateValues: setTextDecoration,
685
693
  "aria-label": "line-through"
686
694
  },
687
- /* @__PURE__ */ React17.createElement(import_icons3.StrikethroughIcon, { fontSize: buttonSize })
695
+ /* @__PURE__ */ React17.createElement(import_icons2.StrikethroughIcon, { fontSize: buttonSize })
688
696
  ), /* @__PURE__ */ React17.createElement(
689
697
  ShorthandControl,
690
698
  {
@@ -693,7 +701,7 @@ var TextStyleControl = () => {
693
701
  updateValues: setTextDecoration,
694
702
  "aria-label": "underline"
695
703
  },
696
- /* @__PURE__ */ React17.createElement(import_icons3.UnderlineIcon, { fontSize: buttonSize })
704
+ /* @__PURE__ */ React17.createElement(import_icons2.UnderlineIcon, { fontSize: buttonSize })
697
705
  )));
698
706
  };
699
707
  var ShorthandControl = ({
@@ -722,46 +730,337 @@ var ToggleButton = ({ onChange, ...props }) => {
722
730
  };
723
731
 
724
732
  // src/components/style-sections/typography-section/typography-section.tsx
725
- var import_i18n7 = require("@wordpress/i18n");
733
+ var import_i18n11 = require("@wordpress/i18n");
726
734
 
727
735
  // src/components/style-sections/typography-section/font-size-control.tsx
728
736
  var React18 = __toESM(require("react"));
729
- var import_i18n5 = require("@wordpress/i18n");
737
+ var import_i18n4 = require("@wordpress/i18n");
730
738
  var FontSizeControl = () => {
731
- return /* @__PURE__ */ React18.createElement(StyleControl, { bind: "font-size" }, /* @__PURE__ */ React18.createElement(ControlContainer, null, /* @__PURE__ */ React18.createElement(StyleControl.Label, null, (0, import_i18n5.__)("Font Size", "elementor")), /* @__PURE__ */ React18.createElement(SizeControl, null)));
739
+ return /* @__PURE__ */ React18.createElement(StyleControl, { bind: "font-size" }, /* @__PURE__ */ React18.createElement(ControlContainer, null, /* @__PURE__ */ React18.createElement(StyleControl.Label, null, (0, import_i18n4.__)("Font Size", "elementor")), /* @__PURE__ */ React18.createElement(SizeControl, null)));
732
740
  };
733
741
 
734
742
  // src/components/style-sections/typography-section/font-weight-control.tsx
735
743
  var React19 = __toESM(require("react"));
736
- var import_i18n6 = require("@wordpress/i18n");
744
+ var import_i18n5 = require("@wordpress/i18n");
737
745
  var fontWeightOptions = [
738
- { label: (0, import_i18n6.__)("Light - 400", "elementor"), value: 400 },
739
- { label: (0, import_i18n6.__)("Regular - 500", "elementor"), value: 500 },
740
- { label: (0, import_i18n6.__)("Semi Bold - 600", "elementor"), value: 600 },
741
- { label: (0, import_i18n6.__)("Bold - 700", "elementor"), value: 700 },
742
- { label: (0, import_i18n6.__)("Black - 900", "elementor"), value: 900 }
746
+ { label: (0, import_i18n5.__)("Light - 400", "elementor"), value: 400 },
747
+ { label: (0, import_i18n5.__)("Regular - 500", "elementor"), value: 500 },
748
+ { label: (0, import_i18n5.__)("Semi Bold - 600", "elementor"), value: 600 },
749
+ { label: (0, import_i18n5.__)("Bold - 700", "elementor"), value: 700 },
750
+ { label: (0, import_i18n5.__)("Black - 900", "elementor"), value: 900 }
743
751
  ];
744
752
  var FontWeightControl = () => {
745
- return /* @__PURE__ */ React19.createElement(StyleControl, { bind: "fontWeight" }, /* @__PURE__ */ React19.createElement(ControlContainer, null, /* @__PURE__ */ React19.createElement(StyleControl.Label, null, (0, import_i18n6.__)("Font Weight", "elementor")), /* @__PURE__ */ React19.createElement(SelectControl, { options: fontWeightOptions })));
753
+ return /* @__PURE__ */ React19.createElement(StyleControl, { bind: "fontWeight" }, /* @__PURE__ */ React19.createElement(ControlContainer, null, /* @__PURE__ */ React19.createElement(StyleControl.Label, null, (0, import_i18n5.__)("Font Weight", "elementor")), /* @__PURE__ */ React19.createElement(SelectControl, { options: fontWeightOptions })));
754
+ };
755
+
756
+ // src/components/style-sections/typography-section/text-color-control.tsx
757
+ var React21 = __toESM(require("react"));
758
+ var import_i18n6 = require("@wordpress/i18n");
759
+
760
+ // src/controls/control-types/color-control.tsx
761
+ var React20 = __toESM(require("react"));
762
+ var import_ui13 = require("@elementor/ui");
763
+ var ColorControl = () => {
764
+ const { value, setValue } = useControl();
765
+ const handleChange = debounce((selectedColor) => {
766
+ setValue(selectedColor);
767
+ });
768
+ return /* @__PURE__ */ React20.createElement(import_ui13.UnstableColorPicker, { value, onChange: handleChange });
769
+ };
770
+ var debounce = (func, wait = 300) => {
771
+ let timer;
772
+ return (...args) => {
773
+ clearTimeout(timer);
774
+ timer = setTimeout(() => func(...args), wait);
775
+ };
776
+ };
777
+
778
+ // src/components/style-sections/typography-section/text-color-control.tsx
779
+ var TextColorControl = () => {
780
+ return /* @__PURE__ */ React21.createElement(StyleControl, { bind: "color" }, /* @__PURE__ */ React21.createElement(ControlContainer, null, /* @__PURE__ */ React21.createElement(StyleControl.Label, null, (0, import_i18n6.__)("Text Color", "elementor")), /* @__PURE__ */ React21.createElement(ColorControl, null)));
781
+ };
782
+
783
+ // src/components/style-sections/typography-section/letter-spacing-control.tsx
784
+ var React22 = __toESM(require("react"));
785
+ var import_i18n7 = require("@wordpress/i18n");
786
+ var LetterSpacingControl = () => {
787
+ return /* @__PURE__ */ React22.createElement(StyleControl, { bind: "letter-spacing" }, /* @__PURE__ */ React22.createElement(ControlContainer, null, /* @__PURE__ */ React22.createElement(StyleControl.Label, null, (0, import_i18n7.__)("Letter Spacing", "elementor")), /* @__PURE__ */ React22.createElement(SizeControl, null)));
788
+ };
789
+
790
+ // src/components/style-sections/typography-section/word-spacing-control.tsx
791
+ var React23 = __toESM(require("react"));
792
+ var import_i18n8 = require("@wordpress/i18n");
793
+ var WordSpacingControl = () => {
794
+ return /* @__PURE__ */ React23.createElement(StyleControl, { bind: "word-spacing" }, /* @__PURE__ */ React23.createElement(ControlContainer, null, /* @__PURE__ */ React23.createElement(StyleControl.Label, null, (0, import_i18n8.__)("Word Spacing", "elementor")), /* @__PURE__ */ React23.createElement(SizeControl, null)));
795
+ };
796
+
797
+ // src/components/collapsible-content.tsx
798
+ var React24 = __toESM(require("react"));
799
+ var import_react7 = require("react");
800
+ var import_icons3 = require("@elementor/icons");
801
+ var import_ui14 = require("@elementor/ui");
802
+ var import_i18n9 = require("@wordpress/i18n");
803
+ var CollapsibleContent = ({ children, defaultOpen = false }) => {
804
+ const [open, setOpen] = (0, import_react7.useState)(defaultOpen);
805
+ const handleToggle = () => {
806
+ setOpen((prevOpen) => !prevOpen);
807
+ };
808
+ return /* @__PURE__ */ React24.createElement(import_ui14.Stack, { sx: { py: 0.5 } }, /* @__PURE__ */ React24.createElement(
809
+ import_ui14.Button,
810
+ {
811
+ fullWidth: true,
812
+ size: "small",
813
+ color: "secondary",
814
+ variant: "outlined",
815
+ onClick: handleToggle,
816
+ endIcon: /* @__PURE__ */ React24.createElement(ChevronIcon, { open })
817
+ },
818
+ open ? (0, import_i18n9.__)("Show less", "elementor") : (0, import_i18n9.__)("Show more", "elementor")
819
+ ), /* @__PURE__ */ React24.createElement(import_ui14.Collapse, { in: open, timeout: "auto" }, children));
820
+ };
821
+ var ChevronIcon = (0, import_ui14.styled)(import_icons3.ChevronDownIcon, {
822
+ shouldForwardProp: (prop) => prop !== "open"
823
+ })(({ theme, open }) => ({
824
+ transform: open ? "rotate(180deg)" : "rotate(0)",
825
+ transition: theme.transitions.create("transform", {
826
+ duration: theme.transitions.duration.standard
827
+ })
828
+ }));
829
+
830
+ // src/components/style-sections/typography-section/transform-control.tsx
831
+ var React27 = __toESM(require("react"));
832
+ var import_i18n10 = require("@wordpress/i18n");
833
+
834
+ // src/controls/control-types/toggle-control.tsx
835
+ var React26 = __toESM(require("react"));
836
+
837
+ // src/controls/components/control-toggle-button-group.tsx
838
+ var React25 = __toESM(require("react"));
839
+ var import_ui15 = require("@elementor/ui");
840
+ var StyledToggleButtonGroup = (0, import_ui15.styled)(import_ui15.ToggleButtonGroup)`
841
+ ${({ justify }) => `justify-content: ${justify};`}
842
+ `;
843
+ var ControlToggleButtonGroup = ({
844
+ justify = "end",
845
+ size = "tiny",
846
+ value,
847
+ onChange,
848
+ items,
849
+ exclusive = false
850
+ }) => {
851
+ const handleChange = (_, newValue) => {
852
+ onChange(newValue);
853
+ };
854
+ return /* @__PURE__ */ React25.createElement(StyledToggleButtonGroup, { justify, value, onChange: handleChange, exclusive }, items.map(({ label, value: buttonValue, icon: Icon }) => /* @__PURE__ */ React25.createElement(import_ui15.ToggleButton, { key: buttonValue, value: buttonValue, "aria-label": label, size }, /* @__PURE__ */ React25.createElement(Icon, { fontSize: size }))));
855
+ };
856
+
857
+ // src/controls/control-types/toggle-control.tsx
858
+ var ToggleControl = ({ options: options2 }) => {
859
+ const { value, setValue } = useControl();
860
+ const handleToggle = (option) => {
861
+ setValue(option || void 0);
862
+ };
863
+ return /* @__PURE__ */ React26.createElement(
864
+ ControlToggleButtonGroup,
865
+ {
866
+ items: options2,
867
+ value: value || null,
868
+ onChange: handleToggle,
869
+ exclusive: true
870
+ }
871
+ );
872
+ };
873
+
874
+ // src/components/style-sections/typography-section/transform-control.tsx
875
+ var import_icons4 = require("@elementor/icons");
876
+ var options = [
877
+ { value: "capitalize", label: (0, import_i18n10.__)("Capitalize", "elementor"), icon: import_icons4.LetterCaseIcon },
878
+ { value: "uppercase", label: (0, import_i18n10.__)("Uppercase", "elementor"), icon: import_icons4.LetterCaseUpperIcon },
879
+ { value: "lowercase", label: (0, import_i18n10.__)("Lowercase", "elementor"), icon: import_icons4.LetterCaseLowerIcon }
880
+ ];
881
+ var TransformControl = () => {
882
+ return /* @__PURE__ */ React27.createElement(ControlContainer, null, /* @__PURE__ */ React27.createElement(StyleControl.Label, null, (0, import_i18n10.__)("Transform", "elementor")), /* @__PURE__ */ React27.createElement(StyleControl, { bind: "text-transform" }, /* @__PURE__ */ React27.createElement(ToggleControl, { options })));
746
883
  };
747
884
 
748
885
  // src/components/style-sections/typography-section/typography-section.tsx
749
886
  var TypographySection = () => {
750
- return /* @__PURE__ */ React20.createElement(AccordionSection, { title: (0, import_i18n7.__)("Typography", "elementor") }, /* @__PURE__ */ React20.createElement(import_ui13.Stack, { gap: 1.5 }, /* @__PURE__ */ React20.createElement(FontWeightControl, null), /* @__PURE__ */ React20.createElement(FontSizeControl, null), /* @__PURE__ */ React20.createElement(import_ui13.Divider, null), /* @__PURE__ */ React20.createElement(TextStyleControl, null)));
887
+ return /* @__PURE__ */ React28.createElement(AccordionSection, { title: (0, import_i18n11.__)("Typography", "elementor") }, /* @__PURE__ */ React28.createElement(import_ui16.Stack, { gap: 1.5 }, /* @__PURE__ */ React28.createElement(FontWeightControl, null), /* @__PURE__ */ React28.createElement(FontSizeControl, null), /* @__PURE__ */ React28.createElement(import_ui16.Divider, null), /* @__PURE__ */ React28.createElement(TextColorControl, null), /* @__PURE__ */ React28.createElement(CollapsibleContent, null, /* @__PURE__ */ React28.createElement(import_ui16.Stack, { gap: 1.5, sx: { pt: 1.5 } }, /* @__PURE__ */ React28.createElement(LetterSpacingControl, null), /* @__PURE__ */ React28.createElement(WordSpacingControl, null), /* @__PURE__ */ React28.createElement(import_ui16.Divider, null), /* @__PURE__ */ React28.createElement(TextStyleControl, null), /* @__PURE__ */ React28.createElement(TransformControl, null)))));
888
+ };
889
+
890
+ // src/components/style-sections/position-section/position-section.tsx
891
+ var React31 = __toESM(require("react"));
892
+ var import_ui18 = require("@elementor/ui");
893
+
894
+ // src/components/style-sections/position-section/z-index-control.tsx
895
+ var React30 = __toESM(require("react"));
896
+ var import_i18n12 = require("@wordpress/i18n");
897
+
898
+ // src/controls/control-types/number-control.tsx
899
+ var React29 = __toESM(require("react"));
900
+ var import_ui17 = require("@elementor/ui");
901
+ var isEmptyOrNaN = (value) => value === void 0 || value === "" || Number.isNaN(Number(value));
902
+ var NumberControl = ({ placeholder }) => {
903
+ const { value, setValue } = useControl();
904
+ const handleChange = (event) => {
905
+ const eventValue = event.target.value;
906
+ setValue(isEmptyOrNaN(eventValue) ? void 0 : Number(eventValue));
907
+ };
908
+ return /* @__PURE__ */ React29.createElement(
909
+ import_ui17.TextField,
910
+ {
911
+ size: "tiny",
912
+ type: "number",
913
+ value: isEmptyOrNaN(value) ? "" : value,
914
+ onChange: handleChange,
915
+ placeholder
916
+ }
917
+ );
918
+ };
919
+
920
+ // src/components/style-sections/position-section/z-index-control.tsx
921
+ var ZIndexControl = () => {
922
+ return /* @__PURE__ */ React30.createElement(StyleControl, { bind: "zIndex" }, /* @__PURE__ */ React30.createElement(ControlContainer, null, /* @__PURE__ */ React30.createElement(StyleControl.Label, null, (0, import_i18n12.__)("Z-Index", "elementor")), /* @__PURE__ */ React30.createElement(NumberControl, null)));
923
+ };
924
+
925
+ // src/components/style-sections/position-section/position-section.tsx
926
+ var import_i18n13 = require("@wordpress/i18n");
927
+ var PositionSection = () => {
928
+ return /* @__PURE__ */ React31.createElement(AccordionSection, { title: (0, import_i18n13.__)("Position", "elementor") }, /* @__PURE__ */ React31.createElement(import_ui18.Stack, { gap: 1.5 }, /* @__PURE__ */ React31.createElement(ZIndexControl, null)));
929
+ };
930
+
931
+ // src/components/style-sections/spacing-section/spacing-section.tsx
932
+ var React33 = __toESM(require("react"));
933
+ var import_ui20 = require("@elementor/ui");
934
+ var import_i18n15 = require("@wordpress/i18n");
935
+
936
+ // src/components/style-sections/spacing-section/linked-dimensions-control.tsx
937
+ var React32 = __toESM(require("react"));
938
+ var import_ui19 = require("@elementor/ui");
939
+ var import_icons5 = require("@elementor/icons");
940
+ var import_i18n14 = require("@wordpress/i18n");
941
+ var LinkedDimensionsControl = ({ label }) => {
942
+ const { value, setValue } = useControl();
943
+ const { top, right, bottom, left, isLinked = false } = value?.value || {};
944
+ const setLinkedValue = (position, newValue) => {
945
+ const updatedValue = {
946
+ isLinked,
947
+ top: isLinked ? newValue : top,
948
+ right: isLinked ? newValue : right,
949
+ bottom: isLinked ? newValue : bottom,
950
+ left: isLinked ? newValue : left,
951
+ [position]: newValue
952
+ };
953
+ setValue({
954
+ $$type: "linked-dimensions",
955
+ value: updatedValue
956
+ });
957
+ };
958
+ const toggleLinked = () => {
959
+ const updatedValue = {
960
+ isLinked: !isLinked,
961
+ top,
962
+ right: !isLinked ? top : right,
963
+ bottom: !isLinked ? top : bottom,
964
+ left: !isLinked ? top : left
965
+ };
966
+ setValue({
967
+ $$type: "linked-dimensions",
968
+ value: updatedValue
969
+ });
970
+ };
971
+ const LinkedIcon = isLinked ? import_icons5.LinkIcon : import_icons5.DetachIcon;
972
+ return /* @__PURE__ */ React32.createElement(React32.Fragment, null, /* @__PURE__ */ React32.createElement(import_ui19.Stack, { direction: "row", gap: 2 }, /* @__PURE__ */ React32.createElement(ControlLabel, null, label), /* @__PURE__ */ React32.createElement(
973
+ import_ui19.ToggleButton,
974
+ {
975
+ "aria-label": (0, import_i18n14.__)("Link Inputs", "elementor"),
976
+ size: "tiny",
977
+ value: "check",
978
+ selected: isLinked,
979
+ sx: { marginLeft: "auto" },
980
+ onChange: toggleLinked
981
+ },
982
+ /* @__PURE__ */ React32.createElement(LinkedIcon, { fontSize: "tiny" })
983
+ )), /* @__PURE__ */ React32.createElement(import_ui19.Stack, { direction: "row", gap: 2 }, /* @__PURE__ */ React32.createElement(ControlContainer, { direction: "column" }, /* @__PURE__ */ React32.createElement(ControlLabel, null, (0, import_i18n14.__)("Top", "elementor")), /* @__PURE__ */ React32.createElement(
984
+ Control4,
985
+ {
986
+ bind: "top",
987
+ value: top,
988
+ setValue: setLinkedValue,
989
+ startIcon: /* @__PURE__ */ React32.createElement(import_icons5.SideTopIcon, { fontSize: "tiny" })
990
+ }
991
+ )), /* @__PURE__ */ React32.createElement(ControlContainer, { direction: "column" }, /* @__PURE__ */ React32.createElement(ControlLabel, null, (0, import_i18n14.__)("Right", "elementor")), /* @__PURE__ */ React32.createElement(
992
+ Control4,
993
+ {
994
+ bind: "right",
995
+ value: right,
996
+ setValue: setLinkedValue,
997
+ startIcon: /* @__PURE__ */ React32.createElement(import_icons5.SideRightIcon, { fontSize: "tiny" })
998
+ }
999
+ ))), /* @__PURE__ */ React32.createElement(import_ui19.Stack, { direction: "row", gap: 2 }, /* @__PURE__ */ React32.createElement(ControlContainer, { direction: "column" }, /* @__PURE__ */ React32.createElement(ControlLabel, null, (0, import_i18n14.__)("Bottom", "elementor")), /* @__PURE__ */ React32.createElement(
1000
+ Control4,
1001
+ {
1002
+ bind: "bottom",
1003
+ value: bottom,
1004
+ setValue: setLinkedValue,
1005
+ startIcon: /* @__PURE__ */ React32.createElement(import_icons5.SideBottomIcon, { fontSize: "tiny" })
1006
+ }
1007
+ )), /* @__PURE__ */ React32.createElement(ControlContainer, { direction: "column" }, /* @__PURE__ */ React32.createElement(ControlLabel, null, (0, import_i18n14.__)("Left", "elementor")), /* @__PURE__ */ React32.createElement(
1008
+ Control4,
1009
+ {
1010
+ bind: "left",
1011
+ value: left,
1012
+ setValue: setLinkedValue,
1013
+ startIcon: /* @__PURE__ */ React32.createElement(import_icons5.SideLeftIcon, { fontSize: "tiny" })
1014
+ }
1015
+ ))));
1016
+ };
1017
+ var Control4 = ({
1018
+ bind,
1019
+ startIcon,
1020
+ value,
1021
+ setValue
1022
+ }) => /* @__PURE__ */ React32.createElement(
1023
+ ControlContext.Provider,
1024
+ {
1025
+ value: {
1026
+ bind,
1027
+ setValue: (newValue) => setValue(bind, newValue),
1028
+ value
1029
+ }
1030
+ },
1031
+ /* @__PURE__ */ React32.createElement(SizeControl, { startIcon })
1032
+ );
1033
+
1034
+ // src/components/style-sections/spacing-section/spacing-section.tsx
1035
+ var SpacingSection = () => {
1036
+ return /* @__PURE__ */ React33.createElement(AccordionSection, { title: (0, import_i18n15.__)("Spacing", "elementor") }, /* @__PURE__ */ React33.createElement(import_ui20.Stack, { gap: 1.5 }, /* @__PURE__ */ React33.createElement(StyleControl, { bind: "padding" }, /* @__PURE__ */ React33.createElement(LinkedDimensionsControl, { label: (0, import_i18n15.__)("Padding", "elementor") })), /* @__PURE__ */ React33.createElement(import_ui20.Divider, null), /* @__PURE__ */ React33.createElement(StyleControl, { bind: "margin" }, /* @__PURE__ */ React33.createElement(LinkedDimensionsControl, { label: (0, import_i18n15.__)("Margin", "elementor") }))));
751
1037
  };
752
1038
 
753
1039
  // src/components/style-tab.tsx
1040
+ var CLASSES_PROP_KEY = "classes";
754
1041
  var StyleTab = () => {
1042
+ const styleDefinition = useStyleDefinition();
1043
+ const classesProp = useClassesProp();
1044
+ return /* @__PURE__ */ React34.createElement(StyleContext, { selectedStyleDef: styleDefinition, selectedClassesProp: classesProp }, /* @__PURE__ */ React34.createElement(import_ui21.Stack, null, /* @__PURE__ */ React34.createElement(SizeSection, null), /* @__PURE__ */ React34.createElement(PositionSection, null), /* @__PURE__ */ React34.createElement(TypographySection, null), /* @__PURE__ */ React34.createElement(SpacingSection, null)));
1045
+ };
1046
+ function useClassesProp() {
1047
+ const { elementType } = useElementContext();
1048
+ const prop = Object.entries(elementType.propsSchema).find(([, { type }]) => type.key === CLASSES_PROP_KEY);
1049
+ if (!prop) {
1050
+ throw new Error("Element does not have a classes prop");
1051
+ }
1052
+ return prop[0];
1053
+ }
1054
+ function useStyleDefinition() {
755
1055
  const { element } = useElementContext();
756
1056
  const elementStyles = useElementStyles(element.id);
757
- const [selectedStyleDef = null] = Object.values(elementStyles || {});
758
- return /* @__PURE__ */ React21.createElement(StyleContext, { selectedStyleDef }, /* @__PURE__ */ React21.createElement(import_ui14.Stack, null, /* @__PURE__ */ React21.createElement(SizeSection, null), /* @__PURE__ */ React21.createElement(TypographySection, null)));
759
- };
1057
+ return Object.values(elementStyles || {})[0] ?? null;
1058
+ }
760
1059
 
761
1060
  // src/components/editing-panel-tabs.tsx
762
1061
  var EditingPanelTabs = () => {
763
- const { getTabProps, getTabPanelProps, getTabsProps } = (0, import_ui15.useTabs)("settings");
764
- return /* @__PURE__ */ React22.createElement(import_ui15.Stack, { direction: "column", sx: { width: "100%" } }, /* @__PURE__ */ React22.createElement(import_ui15.Tabs, { variant: "fullWidth", indicatorColor: "secondary", textColor: "inherit", ...getTabsProps() }, /* @__PURE__ */ React22.createElement(import_ui15.Tab, { label: (0, import_i18n8.__)("General", "elementor"), ...getTabProps("settings") }), /* @__PURE__ */ React22.createElement(import_ui15.Tab, { label: (0, import_i18n8.__)("Style", "elementor"), ...getTabProps("style") })), /* @__PURE__ */ React22.createElement(import_ui15.TabPanel, { ...getTabPanelProps("settings"), disablePadding: true }, /* @__PURE__ */ React22.createElement(SettingsTab, null)), /* @__PURE__ */ React22.createElement(import_ui15.TabPanel, { ...getTabPanelProps("style"), disablePadding: true }, /* @__PURE__ */ React22.createElement(StyleTab, null)));
1062
+ const { getTabProps, getTabPanelProps, getTabsProps } = (0, import_ui22.useTabs)("settings");
1063
+ return /* @__PURE__ */ React35.createElement(import_ui22.Stack, { direction: "column", sx: { width: "100%" } }, /* @__PURE__ */ React35.createElement(import_ui22.Tabs, { variant: "fullWidth", indicatorColor: "secondary", textColor: "inherit", ...getTabsProps() }, /* @__PURE__ */ React35.createElement(import_ui22.Tab, { label: (0, import_i18n16.__)("General", "elementor"), ...getTabProps("settings") }), /* @__PURE__ */ React35.createElement(import_ui22.Tab, { label: (0, import_i18n16.__)("Style", "elementor"), ...getTabProps("style") })), /* @__PURE__ */ React35.createElement(import_ui22.TabPanel, { ...getTabPanelProps("settings"), disablePadding: true }, /* @__PURE__ */ React35.createElement(SettingsTab, null)), /* @__PURE__ */ React35.createElement(import_ui22.TabPanel, { ...getTabPanelProps("style"), disablePadding: true }, /* @__PURE__ */ React35.createElement(StyleTab, null)));
765
1064
  };
766
1065
 
767
1066
  // src/components/editing-panel.tsx
@@ -772,8 +1071,8 @@ var EditingPanel = () => {
772
1071
  if (elements.length !== 1 || !elementType) {
773
1072
  return null;
774
1073
  }
775
- const panelTitle = (0, import_i18n9.__)("Edit %s", "elementor").replace("%s", elementType.title);
776
- return /* @__PURE__ */ React23.createElement(import_editor_panels.Panel, null, /* @__PURE__ */ React23.createElement(import_editor_panels.PanelHeader, null, /* @__PURE__ */ React23.createElement(import_editor_panels.PanelHeaderTitle, null, panelTitle)), /* @__PURE__ */ React23.createElement(import_editor_panels.PanelBody, null, /* @__PURE__ */ React23.createElement(ElementContext, { element: selectedElement, elementType }, /* @__PURE__ */ React23.createElement(EditingPanelTabs, null))));
1074
+ const panelTitle = (0, import_i18n17.__)("Edit %s", "elementor").replace("%s", elementType.title);
1075
+ return /* @__PURE__ */ React36.createElement(import_editor_panels.Panel, null, /* @__PURE__ */ React36.createElement(import_editor_panels.PanelHeader, null, /* @__PURE__ */ React36.createElement(import_editor_panels.PanelHeaderTitle, null, panelTitle)), /* @__PURE__ */ React36.createElement(import_editor_panels.PanelBody, null, /* @__PURE__ */ React36.createElement(ElementContext, { element: selectedElement, elementType }, /* @__PURE__ */ React36.createElement(EditingPanelTabs, null))));
777
1076
  };
778
1077
 
779
1078
  // src/panel.ts
@@ -796,11 +1095,11 @@ var shouldUseV2Panel = () => {
796
1095
  };
797
1096
 
798
1097
  // src/hooks/use-open-editor-panel.ts
799
- var import_react7 = require("react");
1098
+ var import_react8 = require("react");
800
1099
  var import_editor_v1_adapters8 = require("@elementor/editor-v1-adapters");
801
1100
  var useOpenEditorPanel = () => {
802
1101
  const { open } = usePanelActions();
803
- (0, import_react7.useEffect)(() => {
1102
+ (0, import_react8.useEffect)(() => {
804
1103
  return (0, import_editor_v1_adapters8.__privateListenTo)((0, import_editor_v1_adapters8.commandStartEvent)("panel/editor/open"), () => {
805
1104
  if (shouldUseV2Panel()) {
806
1105
  open();
@@ -818,13 +1117,287 @@ var EditingPanelHooks = () => {
818
1117
  // src/init.ts
819
1118
  var import_editor_panels3 = require("@elementor/editor-panels");
820
1119
  var import_editor_v1_adapters9 = require("@elementor/editor-v1-adapters");
821
- function init() {
1120
+
1121
+ // src/dynamics/components/dynamic-selection-control.tsx
1122
+ var React39 = __toESM(require("react"));
1123
+ var import_react12 = require("react");
1124
+
1125
+ // src/dynamics/dynamic-control.tsx
1126
+ var React37 = __toESM(require("react"));
1127
+
1128
+ // src/dynamics/hooks/use-prop-dynamic-tags.ts
1129
+ var import_react9 = require("react");
1130
+
1131
+ // src/dynamics/sync/get-elementor-config.ts
1132
+ var getElementorConfig = () => {
1133
+ const extendedWindow = window;
1134
+ return extendedWindow.elementor?.config ?? {};
1135
+ };
1136
+
1137
+ // src/dynamics/sync/get-atomic-dynamic-tags.ts
1138
+ var getAtomicDynamicTags = () => {
1139
+ const { atomicDynamicTags } = getElementorConfig();
1140
+ if (!atomicDynamicTags) {
1141
+ return null;
1142
+ }
1143
+ return {
1144
+ tags: atomicDynamicTags.tags,
1145
+ groups: atomicDynamicTags.groups
1146
+ };
1147
+ };
1148
+
1149
+ // src/props/is-transformable.ts
1150
+ var import_schema = require("@elementor/schema");
1151
+ var transformableSchema = import_schema.z.object({
1152
+ $$type: import_schema.z.string(),
1153
+ value: import_schema.z.any()
1154
+ });
1155
+ var isTransformable = (value) => {
1156
+ return transformableSchema.safeParse(value).success;
1157
+ };
1158
+
1159
+ // src/dynamics/utils.ts
1160
+ var isDynamicType = (prop) => prop.key === "dynamic";
1161
+ var isDynamicPropValue = (prop) => {
1162
+ return isTransformable(prop) && prop.$$type === "dynamic";
1163
+ };
1164
+
1165
+ // src/dynamics/hooks/use-prop-dynamic-tags.ts
1166
+ var usePropDynamicTags = (propName) => {
1167
+ let categories = [];
1168
+ const { elementType } = useElementContext();
1169
+ const propSchema = elementType.propsSchema?.[propName];
1170
+ if (propSchema) {
1171
+ const propDynamicType = propSchema.additional_types.find(isDynamicType);
1172
+ categories = propDynamicType?.settings.categories || [];
1173
+ }
1174
+ return (0, import_react9.useMemo)(() => getDynamicTagsByCategories(categories), [categories.join()]);
1175
+ };
1176
+ var getDynamicTagsByCategories = (categories) => {
1177
+ const dynamicTags = getAtomicDynamicTags();
1178
+ if (!categories.length || !dynamicTags?.tags) {
1179
+ return [];
1180
+ }
1181
+ const _categories = new Set(categories);
1182
+ return Object.values(dynamicTags.tags).filter(
1183
+ (dynamicTag) => dynamicTag.categories.some((category) => _categories.has(category))
1184
+ );
1185
+ };
1186
+
1187
+ // src/dynamics/hooks/use-dynamic-tag.ts
1188
+ var import_react10 = require("react");
1189
+ var useDynamicTag = (propName, tagName) => {
1190
+ const dynamicTags = usePropDynamicTags(propName);
1191
+ return (0, import_react10.useMemo)(() => dynamicTags.find((tag) => tag.name === tagName) ?? null, [dynamicTags, tagName]);
1192
+ };
1193
+
1194
+ // src/dynamics/dynamic-control.tsx
1195
+ var DynamicControl = ({ bind, children }) => {
1196
+ const { value, setValue, bind: propName } = useControl();
1197
+ const { name = "", settings } = value?.value ?? {};
1198
+ const dynamicTag = useDynamicTag(propName, name);
1199
+ if (!dynamicTag) {
1200
+ throw new Error(`Dynamic tag ${name} not found`);
1201
+ }
1202
+ const defaultValue = dynamicTag.props_schema[bind]?.type.default;
1203
+ const dynamicValue = settings?.[bind] ?? defaultValue;
1204
+ const setDynamicValue = (newValue) => {
1205
+ setValue({
1206
+ $$type: "dynamic",
1207
+ value: {
1208
+ name,
1209
+ settings: {
1210
+ ...settings,
1211
+ [bind]: newValue
1212
+ }
1213
+ }
1214
+ });
1215
+ };
1216
+ return /* @__PURE__ */ React37.createElement(ControlContext.Provider, { value: { setValue: setDynamicValue, value: dynamicValue, bind } }, children);
1217
+ };
1218
+
1219
+ // src/dynamics/components/dynamic-selection-control.tsx
1220
+ var import_icons7 = require("@elementor/icons");
1221
+
1222
+ // src/dynamics/components/dynamic-selection.tsx
1223
+ var React38 = __toESM(require("react"));
1224
+ var import_react11 = require("react");
1225
+ var import_icons6 = require("@elementor/icons");
1226
+ var import_ui23 = require("@elementor/ui");
1227
+ var import_i18n18 = require("@wordpress/i18n");
1228
+ var SIZE = "tiny";
1229
+ var DynamicSelection = ({ onSelect }) => {
1230
+ const [searchValue, setSearchValue] = (0, import_react11.useState)("");
1231
+ const { groups: dynamicGroups } = getAtomicDynamicTags() || {};
1232
+ const { bind, value: dynamicValue, setValue } = useControl();
1233
+ const options2 = useFilteredOptions(bind, searchValue);
1234
+ const handleSearch = (event) => {
1235
+ setSearchValue(event.target.value);
1236
+ };
1237
+ return /* @__PURE__ */ React38.createElement(import_ui23.Stack, null, /* @__PURE__ */ React38.createElement(import_ui23.Box, { px: 1.5, pb: 1 }, /* @__PURE__ */ React38.createElement(
1238
+ import_ui23.TextField,
1239
+ {
1240
+ fullWidth: true,
1241
+ size: SIZE,
1242
+ value: searchValue,
1243
+ onChange: handleSearch,
1244
+ placeholder: (0, import_i18n18.__)("Search dynamic tag", "elementor"),
1245
+ InputProps: {
1246
+ startAdornment: /* @__PURE__ */ React38.createElement(import_ui23.InputAdornment, { position: "start" }, /* @__PURE__ */ React38.createElement(import_icons6.SearchIcon, { fontSize: SIZE }))
1247
+ }
1248
+ }
1249
+ )), /* @__PURE__ */ React38.createElement(import_ui23.Divider, null), /* @__PURE__ */ React38.createElement(import_ui23.Box, { sx: { overflowY: "auto", height: 260, width: 220 } }, options2.length > 0 ? /* @__PURE__ */ React38.createElement(import_ui23.MenuList, { role: "listbox", tabIndex: 0 }, options2.map(([category, items], index) => /* @__PURE__ */ React38.createElement(import_react11.Fragment, { key: index }, /* @__PURE__ */ React38.createElement(import_ui23.ListSubheader, { sx: { typography: "caption", color: "text.tertiary" } }, dynamicGroups?.[category]?.title || category), items.map(({ value, label: tagLabel }) => {
1250
+ const isSelected = value === dynamicValue?.value?.name;
1251
+ return /* @__PURE__ */ React38.createElement(
1252
+ import_ui23.MenuItem,
1253
+ {
1254
+ key: value,
1255
+ selected: isSelected,
1256
+ autoFocus: isSelected,
1257
+ sx: { typography: "caption" },
1258
+ onClick: () => {
1259
+ setValue({ $$type: "dynamic", value: { name: value } });
1260
+ onSelect?.();
1261
+ }
1262
+ },
1263
+ tagLabel
1264
+ );
1265
+ })))) : /* @__PURE__ */ React38.createElement(import_ui23.Stack, { alignItems: "center", p: 2.5, gap: 1.5 }, /* @__PURE__ */ React38.createElement(import_icons6.PhotoIcon, { fontSize: "large" }), /* @__PURE__ */ React38.createElement(import_ui23.Typography, { align: "center", variant: "caption", color: "text.secondary" }, (0, import_i18n18.__)("Sorry, nothing matched", "elementor"), /* @__PURE__ */ React38.createElement("br", null), "\u201C", searchValue, "\u201D."), /* @__PURE__ */ React38.createElement(import_ui23.Typography, { align: "center", variant: "caption", color: "text.secondary" }, /* @__PURE__ */ React38.createElement(
1266
+ import_ui23.Link,
1267
+ {
1268
+ color: "secondary",
1269
+ variant: "caption",
1270
+ component: "button",
1271
+ onClick: () => setSearchValue("")
1272
+ },
1273
+ (0, import_i18n18.__)("Clear the filters", "elementor")
1274
+ ), "\xA0", (0, import_i18n18.__)("and try again.", "elementor")))));
1275
+ };
1276
+ var useFilteredOptions = (bind, searchValue) => {
1277
+ const dynamicTags = usePropDynamicTags(bind);
1278
+ const options2 = dynamicTags.reduce((categories, { name, label, group }) => {
1279
+ const isVisible = label.toLowerCase().includes(searchValue.trim().toLowerCase());
1280
+ if (!isVisible) {
1281
+ return categories;
1282
+ }
1283
+ if (!categories.has(group)) {
1284
+ categories.set(group, []);
1285
+ }
1286
+ categories.get(group)?.push({ label, value: name });
1287
+ return categories;
1288
+ }, /* @__PURE__ */ new Map());
1289
+ return [...options2];
1290
+ };
1291
+
1292
+ // src/dynamics/components/dynamic-selection-control.tsx
1293
+ var import_ui24 = require("@elementor/ui");
1294
+ var import_i18n19 = require("@wordpress/i18n");
1295
+ var SIZE2 = "tiny";
1296
+ var DynamicSelectionControl = () => {
1297
+ const { bind, value, setValue } = useControl();
1298
+ const { name: tagName = "" } = value?.value || {};
1299
+ const selectionPopoverId = (0, import_react12.useId)();
1300
+ const selectionPopoverState = (0, import_ui24.usePopupState)({ variant: "popover", popupId: selectionPopoverId });
1301
+ const dynamicTag = useDynamicTag(bind, tagName);
1302
+ const removeDynamicTag = () => {
1303
+ setValue(null);
1304
+ };
1305
+ if (!dynamicTag) {
1306
+ throw new Error(`Dynamic tag ${tagName} not found`);
1307
+ }
1308
+ return /* @__PURE__ */ React39.createElement(import_ui24.Box, { sx: { width: "100%" } }, /* @__PURE__ */ React39.createElement(
1309
+ import_ui24.UnstableTag,
1310
+ {
1311
+ fullWidth: true,
1312
+ showActionsOnHover: true,
1313
+ label: dynamicTag.label,
1314
+ startIcon: /* @__PURE__ */ React39.createElement(import_icons7.DatabaseIcon, { fontSize: SIZE2 }),
1315
+ ...(0, import_ui24.bindTrigger)(selectionPopoverState),
1316
+ actions: /* @__PURE__ */ React39.createElement(React39.Fragment, null, /* @__PURE__ */ React39.createElement(DynamicSettingsPopover, { dynamicTag }), /* @__PURE__ */ React39.createElement(
1317
+ import_ui24.IconButton,
1318
+ {
1319
+ size: SIZE2,
1320
+ onClick: removeDynamicTag,
1321
+ "aria-label": (0, import_i18n19.__)("Remove dynamic value", "elementor")
1322
+ },
1323
+ /* @__PURE__ */ React39.createElement(import_icons7.XIcon, { fontSize: SIZE2 })
1324
+ ))
1325
+ }
1326
+ ), /* @__PURE__ */ React39.createElement(
1327
+ import_ui24.Popover,
1328
+ {
1329
+ disablePortal: true,
1330
+ disableScrollLock: true,
1331
+ anchorOrigin: { vertical: "bottom", horizontal: "left" },
1332
+ ...(0, import_ui24.bindPopover)(selectionPopoverState)
1333
+ },
1334
+ /* @__PURE__ */ React39.createElement(import_ui24.Stack, null, /* @__PURE__ */ React39.createElement(import_ui24.Stack, { direction: "row", alignItems: "center", pl: 1.5, pr: 0.5, py: 1.5 }, /* @__PURE__ */ React39.createElement(import_icons7.DatabaseIcon, { fontSize: SIZE2, sx: { mr: 0.5 } }), /* @__PURE__ */ React39.createElement(import_ui24.Typography, { variant: "subtitle2" }, (0, import_i18n19.__)("Dynamic Tags", "elementor")), /* @__PURE__ */ React39.createElement(import_ui24.IconButton, { size: SIZE2, sx: { ml: "auto" }, onClick: selectionPopoverState.close }, /* @__PURE__ */ React39.createElement(import_icons7.XIcon, { fontSize: SIZE2 }))), /* @__PURE__ */ React39.createElement(DynamicSelection, { onSelect: selectionPopoverState.close }))
1335
+ ));
1336
+ };
1337
+ var DynamicSettingsPopover = ({ dynamicTag }) => {
1338
+ const popupId = (0, import_react12.useId)();
1339
+ const settingsPopupState = (0, import_ui24.usePopupState)({ variant: "popover", popupId });
1340
+ const hasDynamicSettings = !!dynamicTag.atomic_controls.length;
1341
+ if (!hasDynamicSettings) {
1342
+ return null;
1343
+ }
1344
+ return /* @__PURE__ */ React39.createElement(React39.Fragment, null, /* @__PURE__ */ React39.createElement(
1345
+ import_ui24.IconButton,
1346
+ {
1347
+ size: SIZE2,
1348
+ ...(0, import_ui24.bindTrigger)(settingsPopupState),
1349
+ "aria-label": (0, import_i18n19.__)("Settings", "elementor")
1350
+ },
1351
+ /* @__PURE__ */ React39.createElement(import_icons7.SettingsIcon, { fontSize: SIZE2 })
1352
+ ), /* @__PURE__ */ React39.createElement(
1353
+ import_ui24.Popover,
1354
+ {
1355
+ disableScrollLock: true,
1356
+ anchorOrigin: { vertical: "bottom", horizontal: "center" },
1357
+ ...(0, import_ui24.bindPopover)(settingsPopupState)
1358
+ },
1359
+ /* @__PURE__ */ React39.createElement(import_ui24.Paper, { component: import_ui24.Stack, sx: { minHeight: "300px", width: "220px" } }, /* @__PURE__ */ React39.createElement(import_ui24.Stack, { direction: "row", alignItems: "center", px: 1.5, pt: 2, pb: 1 }, /* @__PURE__ */ React39.createElement(import_icons7.DatabaseIcon, { fontSize: SIZE2, sx: { mr: 0.5 } }), /* @__PURE__ */ React39.createElement(import_ui24.Typography, { variant: "subtitle2" }, dynamicTag.label), /* @__PURE__ */ React39.createElement(import_ui24.IconButton, { sx: { ml: "auto" }, size: SIZE2, onClick: settingsPopupState.close }, /* @__PURE__ */ React39.createElement(import_icons7.XIcon, { fontSize: SIZE2 }))), /* @__PURE__ */ React39.createElement(DynamicSettings, { controls: dynamicTag.atomic_controls }))
1360
+ ));
1361
+ };
1362
+ var DynamicSettings = ({ controls }) => {
1363
+ const tabs = controls.filter(({ type }) => type === "section");
1364
+ const { getTabsProps, getTabProps, getTabPanelProps } = (0, import_ui24.useTabs)(0);
1365
+ if (!tabs.length) {
1366
+ return null;
1367
+ }
1368
+ return /* @__PURE__ */ React39.createElement(React39.Fragment, null, /* @__PURE__ */ React39.createElement(import_ui24.Tabs, { indicatorColor: "secondary", textColor: "secondary", ...getTabsProps() }, tabs.map(({ value }, index) => /* @__PURE__ */ React39.createElement(import_ui24.Tab, { key: index, label: value.label, sx: { px: 1, py: 0.5 }, ...getTabProps(index) }))), /* @__PURE__ */ React39.createElement(import_ui24.Divider, null), tabs.map(({ value }, index) => {
1369
+ return /* @__PURE__ */ React39.createElement(import_ui24.TabPanel, { key: index, sx: { flexGrow: 1 }, ...getTabPanelProps(index) }, /* @__PURE__ */ React39.createElement(import_ui24.Stack, { gap: 1, px: 2 }, value.items.map((item) => {
1370
+ if (item.type === "control") {
1371
+ return /* @__PURE__ */ React39.createElement(Control5, { key: item.value.bind, control: item.value });
1372
+ }
1373
+ return null;
1374
+ })));
1375
+ }));
1376
+ };
1377
+ var Control5 = ({ control }) => {
1378
+ if (!getControlByType(control.type)) {
1379
+ return null;
1380
+ }
1381
+ return /* @__PURE__ */ React39.createElement(DynamicControl, { bind: control.bind }, control.label ? /* @__PURE__ */ React39.createElement(ControlLabel, null, control.label) : null, /* @__PURE__ */ React39.createElement(Control, { type: control.type, props: control.props }));
1382
+ };
1383
+
1384
+ // src/dynamics/init.ts
1385
+ var init = () => {
1386
+ replaceControl({
1387
+ component: DynamicSelectionControl,
1388
+ condition: ({ value }) => isDynamicPropValue(value)
1389
+ });
1390
+ };
1391
+
1392
+ // src/init.ts
1393
+ function init2() {
822
1394
  (0, import_editor_panels3.__registerPanel)(panel);
823
1395
  blockV1Panel();
824
1396
  (0, import_editor.injectIntoLogic)({
825
1397
  id: "editing-panel-hooks",
826
1398
  component: EditingPanelHooks
827
1399
  });
1400
+ init();
828
1401
  }
829
1402
  var blockV1Panel = () => {
830
1403
  (0, import_editor_v1_adapters9.__privateBlockDataCommand)({
@@ -834,7 +1407,7 @@ var blockV1Panel = () => {
834
1407
  };
835
1408
 
836
1409
  // src/index.ts
837
- init();
1410
+ init2();
838
1411
  // Annotate the CommonJS export names for ESM import in node:
839
1412
  0 && (module.exports = {
840
1413
  replaceControl,