@elementor/editor-editing-panel 0.15.0 → 0.17.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.
- package/CHANGELOG.md +42 -0
- package/dist/index.js +751 -120
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +769 -111
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -6
- package/src/components/style-sections/position-section/position-section.tsx +15 -0
- package/src/components/style-sections/position-section/z-index-control.tsx +16 -0
- package/src/components/style-sections/size-section.tsx +9 -12
- package/src/components/style-sections/spacing-section/linked-dimensions-control.tsx +140 -0
- package/src/components/style-sections/spacing-section/spacing-section.tsx +22 -0
- package/src/components/style-sections/typography-section/letter-spacing-control.tsx +16 -0
- package/src/components/style-sections/typography-section/text-alignment-control.tsx +43 -0
- package/src/components/style-sections/typography-section/text-color-control.tsx +16 -0
- package/src/components/style-sections/typography-section/transform-control.tsx +23 -0
- package/src/components/style-sections/typography-section/typography-section.tsx +17 -1
- package/src/components/style-sections/typography-section/word-spacing-control.tsx +16 -0
- package/src/components/style-tab.tsx +29 -5
- package/src/contexts/style-context.tsx +8 -2
- package/src/controls/components/control-toggle-button-group.tsx +59 -0
- package/src/controls/components/text-field-inner-selection.tsx +79 -0
- package/src/controls/control-types/color-control.tsx +24 -0
- package/src/controls/control-types/number-control.tsx +25 -0
- package/src/controls/control-types/size-control.tsx +20 -34
- package/src/controls/control-types/toggle-control.tsx +25 -0
- package/src/controls/hooks/use-style-control.ts +2 -1
- package/src/controls/settings-control.tsx +1 -1
- package/src/dynamics/components/dynamic-selection-control.tsx +181 -0
- package/src/dynamics/components/dynamic-selection.tsx +155 -0
- package/src/dynamics/dynamic-control.tsx +42 -0
- package/src/dynamics/hooks/use-dynamic-tag.ts +10 -0
- package/src/{hooks/use-dynamic-tags-config.ts → dynamics/hooks/use-prop-dynamic-tags.ts} +6 -5
- package/src/dynamics/hooks/use-prop-value-history.ts +26 -0
- package/src/dynamics/init.ts +10 -0
- package/src/{sync → dynamics/sync}/get-atomic-dynamic-tags.ts +1 -1
- package/src/{sync → dynamics/sync}/get-elementor-config.ts +1 -1
- package/src/dynamics/types.ts +32 -0
- package/src/dynamics/utils.ts +9 -0
- package/src/init.ts +4 -0
- package/src/props/is-transformable.ts +14 -0
- package/src/sync/types.ts +0 -13
- package/src/sync/update-style.ts +2 -2
- 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
|
|
68
|
-
var
|
|
67
|
+
var React37 = __toESM(require("react"));
|
|
68
|
+
var import_i18n18 = 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
|
|
153
|
-
var
|
|
154
|
-
var
|
|
152
|
+
var import_ui22 = require("@elementor/ui");
|
|
153
|
+
var React36 = __toESM(require("react"));
|
|
154
|
+
var import_i18n17 = require("@wordpress/i18n");
|
|
155
155
|
|
|
156
156
|
// src/components/settings-tab.tsx
|
|
157
|
-
var
|
|
158
|
-
var
|
|
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
|
|
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
|
|
337
|
-
var
|
|
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: options3,
|
|
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(options3[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) }, options3.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 = (
|
|
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__ */
|
|
406
|
-
|
|
456
|
+
return /* @__PURE__ */ React10.createElement(
|
|
457
|
+
TextFieldInnerSelection,
|
|
407
458
|
{
|
|
408
|
-
|
|
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
|
-
)
|
|
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
|
|
431
|
-
var
|
|
432
|
-
var SelectControl = ({ options }) => {
|
|
470
|
+
var React11 = __toESM(require("react"));
|
|
471
|
+
var import_ui9 = require("@elementor/ui");
|
|
472
|
+
var SelectControl = ({ options: options3 }) => {
|
|
433
473
|
const { value, setValue } = useControl();
|
|
434
474
|
const handleChange = (event) => {
|
|
435
475
|
setValue(event.target.value);
|
|
436
476
|
};
|
|
437
|
-
return /* @__PURE__ */
|
|
477
|
+
return /* @__PURE__ */ React11.createElement(import_ui9.Select, { size: "tiny", value: value ?? "", onChange: handleChange }, options3.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__ */
|
|
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__ */
|
|
510
|
+
return /* @__PURE__ */ React13.createElement(import_ui10.Stack, null, elementType.controls.map(({ type, value }, index) => {
|
|
471
511
|
if (type === "control") {
|
|
472
|
-
return /* @__PURE__ */
|
|
512
|
+
return /* @__PURE__ */ React13.createElement(Control2, { key: value.bind, control: value });
|
|
473
513
|
}
|
|
474
514
|
if (type === "section") {
|
|
475
|
-
return /* @__PURE__ */
|
|
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__ */
|
|
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__ */
|
|
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
|
|
533
|
+
var React35 = __toESM(require("react"));
|
|
494
534
|
|
|
495
535
|
// src/contexts/style-context.tsx
|
|
496
|
-
var
|
|
497
|
-
var
|
|
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,
|
|
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__ */
|
|
543
|
+
return /* @__PURE__ */ React14.createElement(Context2.Provider, { value: { selectedStyleDef, selectedMeta, selectedClassesProp } }, children);
|
|
504
544
|
}
|
|
505
545
|
function useStyleContext() {
|
|
506
|
-
const context = (0,
|
|
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
|
|
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
|
|
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
|
|
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__ */
|
|
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
|
|
656
|
+
var import_i18n2 = require("@wordpress/i18n");
|
|
649
657
|
var SizeSection = () => {
|
|
650
|
-
return /* @__PURE__ */ React16.createElement(AccordionSection, { title: (0,
|
|
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
|
|
658
|
-
var
|
|
665
|
+
var React29 = __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
|
|
664
|
-
var
|
|
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,
|
|
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(
|
|
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(
|
|
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(
|
|
704
|
+
/* @__PURE__ */ React17.createElement(import_icons2.UnderlineIcon, { fontSize: buttonSize })
|
|
697
705
|
)));
|
|
698
706
|
};
|
|
699
707
|
var ShorthandControl = ({
|
|
@@ -722,46 +730,367 @@ var ToggleButton = ({ onChange, ...props }) => {
|
|
|
722
730
|
};
|
|
723
731
|
|
|
724
732
|
// src/components/style-sections/typography-section/typography-section.tsx
|
|
725
|
-
var
|
|
733
|
+
var import_i18n12 = 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
|
|
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,
|
|
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
|
|
744
|
+
var import_i18n5 = require("@wordpress/i18n");
|
|
737
745
|
var fontWeightOptions = [
|
|
738
|
-
{ label: (0,
|
|
739
|
-
{ label: (0,
|
|
740
|
-
{ label: (0,
|
|
741
|
-
{ label: (0,
|
|
742
|
-
{ label: (0,
|
|
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,
|
|
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: options3 }) => {
|
|
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: options3,
|
|
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 })));
|
|
883
|
+
};
|
|
884
|
+
|
|
885
|
+
// src/components/style-sections/typography-section/text-alignment-control.tsx
|
|
886
|
+
var React28 = __toESM(require("react"));
|
|
887
|
+
var import_icons5 = require("@elementor/icons");
|
|
888
|
+
var import_i18n11 = require("@wordpress/i18n");
|
|
889
|
+
var options2 = [
|
|
890
|
+
{
|
|
891
|
+
value: "left",
|
|
892
|
+
label: (0, import_i18n11.__)("Left", "elementor"),
|
|
893
|
+
icon: import_icons5.AlignLeftIcon
|
|
894
|
+
},
|
|
895
|
+
{
|
|
896
|
+
value: "center",
|
|
897
|
+
label: (0, import_i18n11.__)("Center", "elementor"),
|
|
898
|
+
icon: import_icons5.AlignCenterIcon
|
|
899
|
+
},
|
|
900
|
+
{
|
|
901
|
+
value: "right",
|
|
902
|
+
label: (0, import_i18n11.__)("Right", "elementor"),
|
|
903
|
+
icon: import_icons5.AlignRightIcon
|
|
904
|
+
},
|
|
905
|
+
{
|
|
906
|
+
value: "justify",
|
|
907
|
+
label: (0, import_i18n11.__)("Justify", "elementor"),
|
|
908
|
+
icon: import_icons5.AlignJustifiedIcon
|
|
909
|
+
}
|
|
910
|
+
];
|
|
911
|
+
var TextAlignmentControl = () => {
|
|
912
|
+
return /* @__PURE__ */ React28.createElement(ControlContainer, null, /* @__PURE__ */ React28.createElement(StyleControl.Label, null, (0, import_i18n11.__)("Alignment", "elementor")), /* @__PURE__ */ React28.createElement(StyleControl, { bind: "text-align" }, /* @__PURE__ */ React28.createElement(ToggleControl, { options: options2 })));
|
|
746
913
|
};
|
|
747
914
|
|
|
748
915
|
// src/components/style-sections/typography-section/typography-section.tsx
|
|
749
916
|
var TypographySection = () => {
|
|
750
|
-
return /* @__PURE__ */
|
|
917
|
+
return /* @__PURE__ */ React29.createElement(AccordionSection, { title: (0, import_i18n12.__)("Typography", "elementor") }, /* @__PURE__ */ React29.createElement(import_ui16.Stack, { gap: 1.5 }, /* @__PURE__ */ React29.createElement(FontWeightControl, null), /* @__PURE__ */ React29.createElement(FontSizeControl, null), /* @__PURE__ */ React29.createElement(import_ui16.Divider, null), /* @__PURE__ */ React29.createElement(TextColorControl, null), /* @__PURE__ */ React29.createElement(CollapsibleContent, null, /* @__PURE__ */ React29.createElement(import_ui16.Stack, { gap: 1.5, sx: { pt: 1.5 } }, /* @__PURE__ */ React29.createElement(LetterSpacingControl, null), /* @__PURE__ */ React29.createElement(WordSpacingControl, null), /* @__PURE__ */ React29.createElement(import_ui16.Divider, null), /* @__PURE__ */ React29.createElement(TextAlignmentControl, null), /* @__PURE__ */ React29.createElement(TextStyleControl, null), /* @__PURE__ */ React29.createElement(TransformControl, null)))));
|
|
918
|
+
};
|
|
919
|
+
|
|
920
|
+
// src/components/style-sections/position-section/position-section.tsx
|
|
921
|
+
var React32 = __toESM(require("react"));
|
|
922
|
+
var import_ui18 = require("@elementor/ui");
|
|
923
|
+
|
|
924
|
+
// src/components/style-sections/position-section/z-index-control.tsx
|
|
925
|
+
var React31 = __toESM(require("react"));
|
|
926
|
+
var import_i18n13 = require("@wordpress/i18n");
|
|
927
|
+
|
|
928
|
+
// src/controls/control-types/number-control.tsx
|
|
929
|
+
var React30 = __toESM(require("react"));
|
|
930
|
+
var import_ui17 = require("@elementor/ui");
|
|
931
|
+
var isEmptyOrNaN = (value) => value === void 0 || value === "" || Number.isNaN(Number(value));
|
|
932
|
+
var NumberControl = ({ placeholder }) => {
|
|
933
|
+
const { value, setValue } = useControl();
|
|
934
|
+
const handleChange = (event) => {
|
|
935
|
+
const eventValue = event.target.value;
|
|
936
|
+
setValue(isEmptyOrNaN(eventValue) ? void 0 : Number(eventValue));
|
|
937
|
+
};
|
|
938
|
+
return /* @__PURE__ */ React30.createElement(
|
|
939
|
+
import_ui17.TextField,
|
|
940
|
+
{
|
|
941
|
+
size: "tiny",
|
|
942
|
+
type: "number",
|
|
943
|
+
value: isEmptyOrNaN(value) ? "" : value,
|
|
944
|
+
onChange: handleChange,
|
|
945
|
+
placeholder
|
|
946
|
+
}
|
|
947
|
+
);
|
|
948
|
+
};
|
|
949
|
+
|
|
950
|
+
// src/components/style-sections/position-section/z-index-control.tsx
|
|
951
|
+
var ZIndexControl = () => {
|
|
952
|
+
return /* @__PURE__ */ React31.createElement(StyleControl, { bind: "zIndex" }, /* @__PURE__ */ React31.createElement(ControlContainer, null, /* @__PURE__ */ React31.createElement(StyleControl.Label, null, (0, import_i18n13.__)("Z-Index", "elementor")), /* @__PURE__ */ React31.createElement(NumberControl, null)));
|
|
953
|
+
};
|
|
954
|
+
|
|
955
|
+
// src/components/style-sections/position-section/position-section.tsx
|
|
956
|
+
var import_i18n14 = require("@wordpress/i18n");
|
|
957
|
+
var PositionSection = () => {
|
|
958
|
+
return /* @__PURE__ */ React32.createElement(AccordionSection, { title: (0, import_i18n14.__)("Position", "elementor") }, /* @__PURE__ */ React32.createElement(import_ui18.Stack, { gap: 1.5 }, /* @__PURE__ */ React32.createElement(ZIndexControl, null)));
|
|
959
|
+
};
|
|
960
|
+
|
|
961
|
+
// src/components/style-sections/spacing-section/spacing-section.tsx
|
|
962
|
+
var React34 = __toESM(require("react"));
|
|
963
|
+
var import_ui20 = require("@elementor/ui");
|
|
964
|
+
var import_i18n16 = require("@wordpress/i18n");
|
|
965
|
+
|
|
966
|
+
// src/components/style-sections/spacing-section/linked-dimensions-control.tsx
|
|
967
|
+
var React33 = __toESM(require("react"));
|
|
968
|
+
var import_ui19 = require("@elementor/ui");
|
|
969
|
+
var import_icons6 = require("@elementor/icons");
|
|
970
|
+
var import_i18n15 = require("@wordpress/i18n");
|
|
971
|
+
var LinkedDimensionsControl = ({ label }) => {
|
|
972
|
+
const { value, setValue } = useControl();
|
|
973
|
+
const { top, right, bottom, left, isLinked = false } = value?.value || {};
|
|
974
|
+
const setLinkedValue = (position, newValue) => {
|
|
975
|
+
const updatedValue = {
|
|
976
|
+
isLinked,
|
|
977
|
+
top: isLinked ? newValue : top,
|
|
978
|
+
right: isLinked ? newValue : right,
|
|
979
|
+
bottom: isLinked ? newValue : bottom,
|
|
980
|
+
left: isLinked ? newValue : left,
|
|
981
|
+
[position]: newValue
|
|
982
|
+
};
|
|
983
|
+
setValue({
|
|
984
|
+
$$type: "linked-dimensions",
|
|
985
|
+
value: updatedValue
|
|
986
|
+
});
|
|
987
|
+
};
|
|
988
|
+
const toggleLinked = () => {
|
|
989
|
+
const updatedValue = {
|
|
990
|
+
isLinked: !isLinked,
|
|
991
|
+
top,
|
|
992
|
+
right: !isLinked ? top : right,
|
|
993
|
+
bottom: !isLinked ? top : bottom,
|
|
994
|
+
left: !isLinked ? top : left
|
|
995
|
+
};
|
|
996
|
+
setValue({
|
|
997
|
+
$$type: "linked-dimensions",
|
|
998
|
+
value: updatedValue
|
|
999
|
+
});
|
|
1000
|
+
};
|
|
1001
|
+
const LinkedIcon = isLinked ? import_icons6.LinkIcon : import_icons6.DetachIcon;
|
|
1002
|
+
return /* @__PURE__ */ React33.createElement(React33.Fragment, null, /* @__PURE__ */ React33.createElement(import_ui19.Stack, { direction: "row", gap: 2 }, /* @__PURE__ */ React33.createElement(ControlLabel, null, label), /* @__PURE__ */ React33.createElement(
|
|
1003
|
+
import_ui19.ToggleButton,
|
|
1004
|
+
{
|
|
1005
|
+
"aria-label": (0, import_i18n15.__)("Link Inputs", "elementor"),
|
|
1006
|
+
size: "tiny",
|
|
1007
|
+
value: "check",
|
|
1008
|
+
selected: isLinked,
|
|
1009
|
+
sx: { marginLeft: "auto" },
|
|
1010
|
+
onChange: toggleLinked
|
|
1011
|
+
},
|
|
1012
|
+
/* @__PURE__ */ React33.createElement(LinkedIcon, { fontSize: "tiny" })
|
|
1013
|
+
)), /* @__PURE__ */ React33.createElement(import_ui19.Stack, { direction: "row", gap: 2 }, /* @__PURE__ */ React33.createElement(ControlContainer, { direction: "column" }, /* @__PURE__ */ React33.createElement(ControlLabel, null, (0, import_i18n15.__)("Top", "elementor")), /* @__PURE__ */ React33.createElement(
|
|
1014
|
+
Control4,
|
|
1015
|
+
{
|
|
1016
|
+
bind: "top",
|
|
1017
|
+
value: top,
|
|
1018
|
+
setValue: setLinkedValue,
|
|
1019
|
+
startIcon: /* @__PURE__ */ React33.createElement(import_icons6.SideTopIcon, { fontSize: "tiny" })
|
|
1020
|
+
}
|
|
1021
|
+
)), /* @__PURE__ */ React33.createElement(ControlContainer, { direction: "column" }, /* @__PURE__ */ React33.createElement(ControlLabel, null, (0, import_i18n15.__)("Right", "elementor")), /* @__PURE__ */ React33.createElement(
|
|
1022
|
+
Control4,
|
|
1023
|
+
{
|
|
1024
|
+
bind: "right",
|
|
1025
|
+
value: right,
|
|
1026
|
+
setValue: setLinkedValue,
|
|
1027
|
+
startIcon: /* @__PURE__ */ React33.createElement(import_icons6.SideRightIcon, { fontSize: "tiny" })
|
|
1028
|
+
}
|
|
1029
|
+
))), /* @__PURE__ */ React33.createElement(import_ui19.Stack, { direction: "row", gap: 2 }, /* @__PURE__ */ React33.createElement(ControlContainer, { direction: "column" }, /* @__PURE__ */ React33.createElement(ControlLabel, null, (0, import_i18n15.__)("Bottom", "elementor")), /* @__PURE__ */ React33.createElement(
|
|
1030
|
+
Control4,
|
|
1031
|
+
{
|
|
1032
|
+
bind: "bottom",
|
|
1033
|
+
value: bottom,
|
|
1034
|
+
setValue: setLinkedValue,
|
|
1035
|
+
startIcon: /* @__PURE__ */ React33.createElement(import_icons6.SideBottomIcon, { fontSize: "tiny" })
|
|
1036
|
+
}
|
|
1037
|
+
)), /* @__PURE__ */ React33.createElement(ControlContainer, { direction: "column" }, /* @__PURE__ */ React33.createElement(ControlLabel, null, (0, import_i18n15.__)("Left", "elementor")), /* @__PURE__ */ React33.createElement(
|
|
1038
|
+
Control4,
|
|
1039
|
+
{
|
|
1040
|
+
bind: "left",
|
|
1041
|
+
value: left,
|
|
1042
|
+
setValue: setLinkedValue,
|
|
1043
|
+
startIcon: /* @__PURE__ */ React33.createElement(import_icons6.SideLeftIcon, { fontSize: "tiny" })
|
|
1044
|
+
}
|
|
1045
|
+
))));
|
|
1046
|
+
};
|
|
1047
|
+
var Control4 = ({
|
|
1048
|
+
bind,
|
|
1049
|
+
startIcon,
|
|
1050
|
+
value,
|
|
1051
|
+
setValue
|
|
1052
|
+
}) => /* @__PURE__ */ React33.createElement(
|
|
1053
|
+
ControlContext.Provider,
|
|
1054
|
+
{
|
|
1055
|
+
value: {
|
|
1056
|
+
bind,
|
|
1057
|
+
setValue: (newValue) => setValue(bind, newValue),
|
|
1058
|
+
value
|
|
1059
|
+
}
|
|
1060
|
+
},
|
|
1061
|
+
/* @__PURE__ */ React33.createElement(SizeControl, { startIcon })
|
|
1062
|
+
);
|
|
1063
|
+
|
|
1064
|
+
// src/components/style-sections/spacing-section/spacing-section.tsx
|
|
1065
|
+
var SpacingSection = () => {
|
|
1066
|
+
return /* @__PURE__ */ React34.createElement(AccordionSection, { title: (0, import_i18n16.__)("Spacing", "elementor") }, /* @__PURE__ */ React34.createElement(import_ui20.Stack, { gap: 1.5 }, /* @__PURE__ */ React34.createElement(StyleControl, { bind: "padding" }, /* @__PURE__ */ React34.createElement(LinkedDimensionsControl, { label: (0, import_i18n16.__)("Padding", "elementor") })), /* @__PURE__ */ React34.createElement(import_ui20.Divider, null), /* @__PURE__ */ React34.createElement(StyleControl, { bind: "margin" }, /* @__PURE__ */ React34.createElement(LinkedDimensionsControl, { label: (0, import_i18n16.__)("Margin", "elementor") }))));
|
|
751
1067
|
};
|
|
752
1068
|
|
|
753
1069
|
// src/components/style-tab.tsx
|
|
1070
|
+
var CLASSES_PROP_KEY = "classes";
|
|
754
1071
|
var StyleTab = () => {
|
|
1072
|
+
const styleDefinition = useStyleDefinition();
|
|
1073
|
+
const classesProp = useClassesProp();
|
|
1074
|
+
return /* @__PURE__ */ React35.createElement(StyleContext, { selectedStyleDef: styleDefinition, selectedClassesProp: classesProp }, /* @__PURE__ */ React35.createElement(import_ui21.Stack, null, /* @__PURE__ */ React35.createElement(SizeSection, null), /* @__PURE__ */ React35.createElement(PositionSection, null), /* @__PURE__ */ React35.createElement(TypographySection, null), /* @__PURE__ */ React35.createElement(SpacingSection, null)));
|
|
1075
|
+
};
|
|
1076
|
+
function useClassesProp() {
|
|
1077
|
+
const { elementType } = useElementContext();
|
|
1078
|
+
const prop = Object.entries(elementType.propsSchema).find(([, { type }]) => type.key === CLASSES_PROP_KEY);
|
|
1079
|
+
if (!prop) {
|
|
1080
|
+
throw new Error("Element does not have a classes prop");
|
|
1081
|
+
}
|
|
1082
|
+
return prop[0];
|
|
1083
|
+
}
|
|
1084
|
+
function useStyleDefinition() {
|
|
755
1085
|
const { element } = useElementContext();
|
|
756
1086
|
const elementStyles = useElementStyles(element.id);
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
};
|
|
1087
|
+
return Object.values(elementStyles || {})[0] ?? null;
|
|
1088
|
+
}
|
|
760
1089
|
|
|
761
1090
|
// src/components/editing-panel-tabs.tsx
|
|
762
1091
|
var EditingPanelTabs = () => {
|
|
763
|
-
const { getTabProps, getTabPanelProps, getTabsProps } = (0,
|
|
764
|
-
return /* @__PURE__ */
|
|
1092
|
+
const { getTabProps, getTabPanelProps, getTabsProps } = (0, import_ui22.useTabs)("settings");
|
|
1093
|
+
return /* @__PURE__ */ React36.createElement(import_ui22.Stack, { direction: "column", sx: { width: "100%" } }, /* @__PURE__ */ React36.createElement(import_ui22.Tabs, { variant: "fullWidth", indicatorColor: "secondary", textColor: "inherit", ...getTabsProps() }, /* @__PURE__ */ React36.createElement(import_ui22.Tab, { label: (0, import_i18n17.__)("General", "elementor"), ...getTabProps("settings") }), /* @__PURE__ */ React36.createElement(import_ui22.Tab, { label: (0, import_i18n17.__)("Style", "elementor"), ...getTabProps("style") })), /* @__PURE__ */ React36.createElement(import_ui22.TabPanel, { ...getTabPanelProps("settings"), disablePadding: true }, /* @__PURE__ */ React36.createElement(SettingsTab, null)), /* @__PURE__ */ React36.createElement(import_ui22.TabPanel, { ...getTabPanelProps("style"), disablePadding: true }, /* @__PURE__ */ React36.createElement(StyleTab, null)));
|
|
765
1094
|
};
|
|
766
1095
|
|
|
767
1096
|
// src/components/editing-panel.tsx
|
|
@@ -772,8 +1101,8 @@ var EditingPanel = () => {
|
|
|
772
1101
|
if (elements.length !== 1 || !elementType) {
|
|
773
1102
|
return null;
|
|
774
1103
|
}
|
|
775
|
-
const panelTitle = (0,
|
|
776
|
-
return /* @__PURE__ */
|
|
1104
|
+
const panelTitle = (0, import_i18n18.__)("Edit %s", "elementor").replace("%s", elementType.title);
|
|
1105
|
+
return /* @__PURE__ */ React37.createElement(import_editor_panels.Panel, null, /* @__PURE__ */ React37.createElement(import_editor_panels.PanelHeader, null, /* @__PURE__ */ React37.createElement(import_editor_panels.PanelHeaderTitle, null, panelTitle)), /* @__PURE__ */ React37.createElement(import_editor_panels.PanelBody, null, /* @__PURE__ */ React37.createElement(ElementContext, { element: selectedElement, elementType }, /* @__PURE__ */ React37.createElement(EditingPanelTabs, null))));
|
|
777
1106
|
};
|
|
778
1107
|
|
|
779
1108
|
// src/panel.ts
|
|
@@ -796,11 +1125,11 @@ var shouldUseV2Panel = () => {
|
|
|
796
1125
|
};
|
|
797
1126
|
|
|
798
1127
|
// src/hooks/use-open-editor-panel.ts
|
|
799
|
-
var
|
|
1128
|
+
var import_react8 = require("react");
|
|
800
1129
|
var import_editor_v1_adapters8 = require("@elementor/editor-v1-adapters");
|
|
801
1130
|
var useOpenEditorPanel = () => {
|
|
802
1131
|
const { open } = usePanelActions();
|
|
803
|
-
(0,
|
|
1132
|
+
(0, import_react8.useEffect)(() => {
|
|
804
1133
|
return (0, import_editor_v1_adapters8.__privateListenTo)((0, import_editor_v1_adapters8.commandStartEvent)("panel/editor/open"), () => {
|
|
805
1134
|
if (shouldUseV2Panel()) {
|
|
806
1135
|
open();
|
|
@@ -818,13 +1147,315 @@ var EditingPanelHooks = () => {
|
|
|
818
1147
|
// src/init.ts
|
|
819
1148
|
var import_editor_panels3 = require("@elementor/editor-panels");
|
|
820
1149
|
var import_editor_v1_adapters9 = require("@elementor/editor-v1-adapters");
|
|
821
|
-
|
|
1150
|
+
|
|
1151
|
+
// src/dynamics/components/dynamic-selection-control.tsx
|
|
1152
|
+
var React40 = __toESM(require("react"));
|
|
1153
|
+
var import_react12 = require("react");
|
|
1154
|
+
|
|
1155
|
+
// src/dynamics/dynamic-control.tsx
|
|
1156
|
+
var React38 = __toESM(require("react"));
|
|
1157
|
+
|
|
1158
|
+
// src/dynamics/hooks/use-prop-dynamic-tags.ts
|
|
1159
|
+
var import_react9 = require("react");
|
|
1160
|
+
|
|
1161
|
+
// src/dynamics/sync/get-elementor-config.ts
|
|
1162
|
+
var getElementorConfig = () => {
|
|
1163
|
+
const extendedWindow = window;
|
|
1164
|
+
return extendedWindow.elementor?.config ?? {};
|
|
1165
|
+
};
|
|
1166
|
+
|
|
1167
|
+
// src/dynamics/sync/get-atomic-dynamic-tags.ts
|
|
1168
|
+
var getAtomicDynamicTags = () => {
|
|
1169
|
+
const { atomicDynamicTags } = getElementorConfig();
|
|
1170
|
+
if (!atomicDynamicTags) {
|
|
1171
|
+
return null;
|
|
1172
|
+
}
|
|
1173
|
+
return {
|
|
1174
|
+
tags: atomicDynamicTags.tags,
|
|
1175
|
+
groups: atomicDynamicTags.groups
|
|
1176
|
+
};
|
|
1177
|
+
};
|
|
1178
|
+
|
|
1179
|
+
// src/props/is-transformable.ts
|
|
1180
|
+
var import_schema = require("@elementor/schema");
|
|
1181
|
+
var transformableSchema = import_schema.z.object({
|
|
1182
|
+
$$type: import_schema.z.string(),
|
|
1183
|
+
value: import_schema.z.any()
|
|
1184
|
+
});
|
|
1185
|
+
var isTransformable = (value) => {
|
|
1186
|
+
return transformableSchema.safeParse(value).success;
|
|
1187
|
+
};
|
|
1188
|
+
|
|
1189
|
+
// src/dynamics/utils.ts
|
|
1190
|
+
var isDynamicType = (prop) => prop.key === "dynamic";
|
|
1191
|
+
var isDynamicPropValue = (prop) => {
|
|
1192
|
+
return isTransformable(prop) && prop.$$type === "dynamic";
|
|
1193
|
+
};
|
|
1194
|
+
|
|
1195
|
+
// src/dynamics/hooks/use-prop-dynamic-tags.ts
|
|
1196
|
+
var usePropDynamicTags = (propName) => {
|
|
1197
|
+
let categories = [];
|
|
1198
|
+
const { elementType } = useElementContext();
|
|
1199
|
+
const propSchema = elementType.propsSchema?.[propName];
|
|
1200
|
+
if (propSchema) {
|
|
1201
|
+
const propDynamicType = propSchema.additional_types.find(isDynamicType);
|
|
1202
|
+
categories = propDynamicType?.settings.categories || [];
|
|
1203
|
+
}
|
|
1204
|
+
return (0, import_react9.useMemo)(() => getDynamicTagsByCategories(categories), [categories.join()]);
|
|
1205
|
+
};
|
|
1206
|
+
var getDynamicTagsByCategories = (categories) => {
|
|
1207
|
+
const dynamicTags = getAtomicDynamicTags();
|
|
1208
|
+
if (!categories.length || !dynamicTags?.tags) {
|
|
1209
|
+
return [];
|
|
1210
|
+
}
|
|
1211
|
+
const _categories = new Set(categories);
|
|
1212
|
+
return Object.values(dynamicTags.tags).filter(
|
|
1213
|
+
(dynamicTag) => dynamicTag.categories.some((category) => _categories.has(category))
|
|
1214
|
+
);
|
|
1215
|
+
};
|
|
1216
|
+
|
|
1217
|
+
// src/dynamics/hooks/use-dynamic-tag.ts
|
|
1218
|
+
var import_react10 = require("react");
|
|
1219
|
+
var useDynamicTag = (propName, tagName) => {
|
|
1220
|
+
const dynamicTags = usePropDynamicTags(propName);
|
|
1221
|
+
return (0, import_react10.useMemo)(() => dynamicTags.find((tag) => tag.name === tagName) ?? null, [dynamicTags, tagName]);
|
|
1222
|
+
};
|
|
1223
|
+
|
|
1224
|
+
// src/dynamics/dynamic-control.tsx
|
|
1225
|
+
var DynamicControl = ({ bind, children }) => {
|
|
1226
|
+
const { value, setValue, bind: propName } = useControl();
|
|
1227
|
+
const { name = "", settings } = value?.value ?? {};
|
|
1228
|
+
const dynamicTag = useDynamicTag(propName, name);
|
|
1229
|
+
if (!dynamicTag) {
|
|
1230
|
+
throw new Error(`Dynamic tag ${name} not found`);
|
|
1231
|
+
}
|
|
1232
|
+
const defaultValue = dynamicTag.props_schema[bind]?.type.default;
|
|
1233
|
+
const dynamicValue = settings?.[bind] ?? defaultValue;
|
|
1234
|
+
const setDynamicValue = (newValue) => {
|
|
1235
|
+
setValue({
|
|
1236
|
+
$$type: "dynamic",
|
|
1237
|
+
value: {
|
|
1238
|
+
name,
|
|
1239
|
+
settings: {
|
|
1240
|
+
...settings,
|
|
1241
|
+
[bind]: newValue
|
|
1242
|
+
}
|
|
1243
|
+
}
|
|
1244
|
+
});
|
|
1245
|
+
};
|
|
1246
|
+
return /* @__PURE__ */ React38.createElement(ControlContext.Provider, { value: { setValue: setDynamicValue, value: dynamicValue, bind } }, children);
|
|
1247
|
+
};
|
|
1248
|
+
|
|
1249
|
+
// src/dynamics/components/dynamic-selection-control.tsx
|
|
1250
|
+
var import_icons8 = require("@elementor/icons");
|
|
1251
|
+
|
|
1252
|
+
// src/dynamics/components/dynamic-selection.tsx
|
|
1253
|
+
var React39 = __toESM(require("react"));
|
|
1254
|
+
var import_react11 = require("react");
|
|
1255
|
+
var import_icons7 = require("@elementor/icons");
|
|
1256
|
+
var import_ui23 = require("@elementor/ui");
|
|
1257
|
+
var import_i18n19 = require("@wordpress/i18n");
|
|
1258
|
+
|
|
1259
|
+
// src/dynamics/hooks/use-prop-value-history.ts
|
|
1260
|
+
var PROPS_VALUES_HISTORY_KEY = "elementor/dynamic/non-dynamic-values-history";
|
|
1261
|
+
var usePropValueHistory = (path) => {
|
|
1262
|
+
const valuesHistory = getValues();
|
|
1263
|
+
const { element } = useElementContext();
|
|
1264
|
+
const key = `${element.id}-${path}`;
|
|
1265
|
+
const value = valuesHistory[key] ?? null;
|
|
1266
|
+
const setValue = (newValue) => {
|
|
1267
|
+
setValues({ ...valuesHistory, [key]: newValue });
|
|
1268
|
+
};
|
|
1269
|
+
return [value, setValue];
|
|
1270
|
+
};
|
|
1271
|
+
var getValues = () => {
|
|
1272
|
+
return JSON.parse(sessionStorage.getItem(PROPS_VALUES_HISTORY_KEY) || "{}");
|
|
1273
|
+
};
|
|
1274
|
+
var setValues = (values) => {
|
|
1275
|
+
sessionStorage.setItem(PROPS_VALUES_HISTORY_KEY, JSON.stringify(values));
|
|
1276
|
+
};
|
|
1277
|
+
|
|
1278
|
+
// src/dynamics/components/dynamic-selection.tsx
|
|
1279
|
+
var SIZE = "tiny";
|
|
1280
|
+
var DynamicSelection = ({ onSelect }) => {
|
|
1281
|
+
const [searchValue, setSearchValue] = (0, import_react11.useState)("");
|
|
1282
|
+
const { groups: dynamicGroups } = getAtomicDynamicTags() || {};
|
|
1283
|
+
const { bind, value: currentValue, setValue } = useControl();
|
|
1284
|
+
const [, updatePropValueHistory] = usePropValueHistory(bind);
|
|
1285
|
+
const isCurrentValueDynamic = isDynamicPropValue(currentValue);
|
|
1286
|
+
const options3 = useFilteredOptions(bind, searchValue);
|
|
1287
|
+
const handleSearch = (event) => {
|
|
1288
|
+
setSearchValue(event.target.value);
|
|
1289
|
+
};
|
|
1290
|
+
const handleSetDynamicTag = (value) => {
|
|
1291
|
+
if (!isCurrentValueDynamic) {
|
|
1292
|
+
updatePropValueHistory(currentValue);
|
|
1293
|
+
}
|
|
1294
|
+
setValue({ $$type: "dynamic", value: { name: value } });
|
|
1295
|
+
onSelect?.();
|
|
1296
|
+
};
|
|
1297
|
+
return /* @__PURE__ */ React39.createElement(import_ui23.Stack, null, /* @__PURE__ */ React39.createElement(import_ui23.Box, { px: 1.5, pb: 1 }, /* @__PURE__ */ React39.createElement(
|
|
1298
|
+
import_ui23.TextField,
|
|
1299
|
+
{
|
|
1300
|
+
fullWidth: true,
|
|
1301
|
+
size: SIZE,
|
|
1302
|
+
value: searchValue,
|
|
1303
|
+
onChange: handleSearch,
|
|
1304
|
+
placeholder: (0, import_i18n19.__)("Search dynamic tag", "elementor"),
|
|
1305
|
+
InputProps: {
|
|
1306
|
+
startAdornment: /* @__PURE__ */ React39.createElement(import_ui23.InputAdornment, { position: "start" }, /* @__PURE__ */ React39.createElement(import_icons7.SearchIcon, { fontSize: SIZE }))
|
|
1307
|
+
}
|
|
1308
|
+
}
|
|
1309
|
+
)), /* @__PURE__ */ React39.createElement(import_ui23.Divider, null), /* @__PURE__ */ React39.createElement(import_ui23.Box, { sx: { overflowY: "auto", height: 260, width: 220 } }, options3.length > 0 ? /* @__PURE__ */ React39.createElement(import_ui23.MenuList, { role: "listbox", tabIndex: 0 }, options3.map(([category, items], index) => /* @__PURE__ */ React39.createElement(import_react11.Fragment, { key: index }, /* @__PURE__ */ React39.createElement(import_ui23.ListSubheader, { sx: { typography: "caption", color: "text.tertiary" } }, dynamicGroups?.[category]?.title || category), items.map(({ value, label: tagLabel }) => {
|
|
1310
|
+
const isSelected = isCurrentValueDynamic && value === currentValue?.value?.name;
|
|
1311
|
+
return /* @__PURE__ */ React39.createElement(
|
|
1312
|
+
import_ui23.MenuItem,
|
|
1313
|
+
{
|
|
1314
|
+
key: value,
|
|
1315
|
+
selected: isSelected,
|
|
1316
|
+
autoFocus: isSelected,
|
|
1317
|
+
sx: { typography: "caption" },
|
|
1318
|
+
onClick: () => handleSetDynamicTag(value)
|
|
1319
|
+
},
|
|
1320
|
+
tagLabel
|
|
1321
|
+
);
|
|
1322
|
+
})))) : /* @__PURE__ */ React39.createElement(import_ui23.Stack, { alignItems: "center", p: 2.5, gap: 1.5 }, /* @__PURE__ */ React39.createElement(import_icons7.PhotoIcon, { fontSize: "large" }), /* @__PURE__ */ React39.createElement(import_ui23.Typography, { align: "center", variant: "caption", color: "text.secondary" }, (0, import_i18n19.__)("Sorry, nothing matched", "elementor"), /* @__PURE__ */ React39.createElement("br", null), "\u201C", searchValue, "\u201D."), /* @__PURE__ */ React39.createElement(import_ui23.Typography, { align: "center", variant: "caption", color: "text.secondary" }, /* @__PURE__ */ React39.createElement(
|
|
1323
|
+
import_ui23.Link,
|
|
1324
|
+
{
|
|
1325
|
+
color: "secondary",
|
|
1326
|
+
variant: "caption",
|
|
1327
|
+
component: "button",
|
|
1328
|
+
onClick: () => setSearchValue("")
|
|
1329
|
+
},
|
|
1330
|
+
(0, import_i18n19.__)("Clear the filters", "elementor")
|
|
1331
|
+
), "\xA0", (0, import_i18n19.__)("and try again.", "elementor")))));
|
|
1332
|
+
};
|
|
1333
|
+
var useFilteredOptions = (bind, searchValue) => {
|
|
1334
|
+
const dynamicTags = usePropDynamicTags(bind);
|
|
1335
|
+
const options3 = dynamicTags.reduce((categories, { name, label, group }) => {
|
|
1336
|
+
const isVisible = label.toLowerCase().includes(searchValue.trim().toLowerCase());
|
|
1337
|
+
if (!isVisible) {
|
|
1338
|
+
return categories;
|
|
1339
|
+
}
|
|
1340
|
+
if (!categories.has(group)) {
|
|
1341
|
+
categories.set(group, []);
|
|
1342
|
+
}
|
|
1343
|
+
categories.get(group)?.push({ label, value: name });
|
|
1344
|
+
return categories;
|
|
1345
|
+
}, /* @__PURE__ */ new Map());
|
|
1346
|
+
return [...options3];
|
|
1347
|
+
};
|
|
1348
|
+
|
|
1349
|
+
// src/dynamics/components/dynamic-selection-control.tsx
|
|
1350
|
+
var import_ui24 = require("@elementor/ui");
|
|
1351
|
+
var import_i18n20 = require("@wordpress/i18n");
|
|
1352
|
+
var SIZE2 = "tiny";
|
|
1353
|
+
var DynamicSelectionControl = () => {
|
|
1354
|
+
const { bind, value, setValue } = useControl();
|
|
1355
|
+
const [propValueFromHistory] = usePropValueHistory(bind);
|
|
1356
|
+
const { name: tagName = "" } = value?.value || {};
|
|
1357
|
+
const selectionPopoverId = (0, import_react12.useId)();
|
|
1358
|
+
const selectionPopoverState = (0, import_ui24.usePopupState)({ variant: "popover", popupId: selectionPopoverId });
|
|
1359
|
+
const dynamicTag = useDynamicTag(bind, tagName);
|
|
1360
|
+
const removeDynamicTag = () => {
|
|
1361
|
+
setValue(propValueFromHistory ?? null);
|
|
1362
|
+
};
|
|
1363
|
+
if (!dynamicTag) {
|
|
1364
|
+
throw new Error(`Dynamic tag ${tagName} not found`);
|
|
1365
|
+
}
|
|
1366
|
+
return /* @__PURE__ */ React40.createElement(import_ui24.Box, { sx: { width: "100%" } }, /* @__PURE__ */ React40.createElement(
|
|
1367
|
+
import_ui24.UnstableTag,
|
|
1368
|
+
{
|
|
1369
|
+
fullWidth: true,
|
|
1370
|
+
showActionsOnHover: true,
|
|
1371
|
+
label: dynamicTag.label,
|
|
1372
|
+
startIcon: /* @__PURE__ */ React40.createElement(import_icons8.DatabaseIcon, { fontSize: SIZE2 }),
|
|
1373
|
+
...(0, import_ui24.bindTrigger)(selectionPopoverState),
|
|
1374
|
+
actions: /* @__PURE__ */ React40.createElement(React40.Fragment, null, /* @__PURE__ */ React40.createElement(DynamicSettingsPopover, { dynamicTag }), /* @__PURE__ */ React40.createElement(
|
|
1375
|
+
import_ui24.IconButton,
|
|
1376
|
+
{
|
|
1377
|
+
size: SIZE2,
|
|
1378
|
+
onClick: removeDynamicTag,
|
|
1379
|
+
"aria-label": (0, import_i18n20.__)("Remove dynamic value", "elementor")
|
|
1380
|
+
},
|
|
1381
|
+
/* @__PURE__ */ React40.createElement(import_icons8.XIcon, { fontSize: SIZE2 })
|
|
1382
|
+
))
|
|
1383
|
+
}
|
|
1384
|
+
), /* @__PURE__ */ React40.createElement(
|
|
1385
|
+
import_ui24.Popover,
|
|
1386
|
+
{
|
|
1387
|
+
disablePortal: true,
|
|
1388
|
+
disableScrollLock: true,
|
|
1389
|
+
anchorOrigin: { vertical: "bottom", horizontal: "left" },
|
|
1390
|
+
...(0, import_ui24.bindPopover)(selectionPopoverState)
|
|
1391
|
+
},
|
|
1392
|
+
/* @__PURE__ */ React40.createElement(import_ui24.Stack, null, /* @__PURE__ */ React40.createElement(import_ui24.Stack, { direction: "row", alignItems: "center", pl: 1.5, pr: 0.5, py: 1.5 }, /* @__PURE__ */ React40.createElement(import_icons8.DatabaseIcon, { fontSize: SIZE2, sx: { mr: 0.5 } }), /* @__PURE__ */ React40.createElement(import_ui24.Typography, { variant: "subtitle2" }, (0, import_i18n20.__)("Dynamic Tags", "elementor")), /* @__PURE__ */ React40.createElement(import_ui24.IconButton, { size: SIZE2, sx: { ml: "auto" }, onClick: selectionPopoverState.close }, /* @__PURE__ */ React40.createElement(import_icons8.XIcon, { fontSize: SIZE2 }))), /* @__PURE__ */ React40.createElement(DynamicSelection, { onSelect: selectionPopoverState.close }))
|
|
1393
|
+
));
|
|
1394
|
+
};
|
|
1395
|
+
var DynamicSettingsPopover = ({ dynamicTag }) => {
|
|
1396
|
+
const popupId = (0, import_react12.useId)();
|
|
1397
|
+
const settingsPopupState = (0, import_ui24.usePopupState)({ variant: "popover", popupId });
|
|
1398
|
+
const hasDynamicSettings = !!dynamicTag.atomic_controls.length;
|
|
1399
|
+
if (!hasDynamicSettings) {
|
|
1400
|
+
return null;
|
|
1401
|
+
}
|
|
1402
|
+
return /* @__PURE__ */ React40.createElement(React40.Fragment, null, /* @__PURE__ */ React40.createElement(
|
|
1403
|
+
import_ui24.IconButton,
|
|
1404
|
+
{
|
|
1405
|
+
size: SIZE2,
|
|
1406
|
+
...(0, import_ui24.bindTrigger)(settingsPopupState),
|
|
1407
|
+
"aria-label": (0, import_i18n20.__)("Settings", "elementor")
|
|
1408
|
+
},
|
|
1409
|
+
/* @__PURE__ */ React40.createElement(import_icons8.SettingsIcon, { fontSize: SIZE2 })
|
|
1410
|
+
), /* @__PURE__ */ React40.createElement(
|
|
1411
|
+
import_ui24.Popover,
|
|
1412
|
+
{
|
|
1413
|
+
disableScrollLock: true,
|
|
1414
|
+
anchorOrigin: { vertical: "bottom", horizontal: "center" },
|
|
1415
|
+
...(0, import_ui24.bindPopover)(settingsPopupState)
|
|
1416
|
+
},
|
|
1417
|
+
/* @__PURE__ */ React40.createElement(import_ui24.Paper, { component: import_ui24.Stack, sx: { minHeight: "300px", width: "220px" } }, /* @__PURE__ */ React40.createElement(import_ui24.Stack, { direction: "row", alignItems: "center", px: 1.5, pt: 2, pb: 1 }, /* @__PURE__ */ React40.createElement(import_icons8.DatabaseIcon, { fontSize: SIZE2, sx: { mr: 0.5 } }), /* @__PURE__ */ React40.createElement(import_ui24.Typography, { variant: "subtitle2" }, dynamicTag.label), /* @__PURE__ */ React40.createElement(import_ui24.IconButton, { sx: { ml: "auto" }, size: SIZE2, onClick: settingsPopupState.close }, /* @__PURE__ */ React40.createElement(import_icons8.XIcon, { fontSize: SIZE2 }))), /* @__PURE__ */ React40.createElement(DynamicSettings, { controls: dynamicTag.atomic_controls }))
|
|
1418
|
+
));
|
|
1419
|
+
};
|
|
1420
|
+
var DynamicSettings = ({ controls }) => {
|
|
1421
|
+
const tabs = controls.filter(({ type }) => type === "section");
|
|
1422
|
+
const { getTabsProps, getTabProps, getTabPanelProps } = (0, import_ui24.useTabs)(0);
|
|
1423
|
+
if (!tabs.length) {
|
|
1424
|
+
return null;
|
|
1425
|
+
}
|
|
1426
|
+
return /* @__PURE__ */ React40.createElement(React40.Fragment, null, /* @__PURE__ */ React40.createElement(import_ui24.Tabs, { indicatorColor: "secondary", textColor: "secondary", ...getTabsProps() }, tabs.map(({ value }, index) => /* @__PURE__ */ React40.createElement(import_ui24.Tab, { key: index, label: value.label, sx: { px: 1, py: 0.5 }, ...getTabProps(index) }))), /* @__PURE__ */ React40.createElement(import_ui24.Divider, null), tabs.map(({ value }, index) => {
|
|
1427
|
+
return /* @__PURE__ */ React40.createElement(import_ui24.TabPanel, { key: index, sx: { flexGrow: 1 }, ...getTabPanelProps(index) }, /* @__PURE__ */ React40.createElement(import_ui24.Stack, { gap: 1, px: 2 }, value.items.map((item) => {
|
|
1428
|
+
if (item.type === "control") {
|
|
1429
|
+
return /* @__PURE__ */ React40.createElement(Control5, { key: item.value.bind, control: item.value });
|
|
1430
|
+
}
|
|
1431
|
+
return null;
|
|
1432
|
+
})));
|
|
1433
|
+
}));
|
|
1434
|
+
};
|
|
1435
|
+
var Control5 = ({ control }) => {
|
|
1436
|
+
if (!getControlByType(control.type)) {
|
|
1437
|
+
return null;
|
|
1438
|
+
}
|
|
1439
|
+
return /* @__PURE__ */ React40.createElement(DynamicControl, { bind: control.bind }, control.label ? /* @__PURE__ */ React40.createElement(ControlLabel, null, control.label) : null, /* @__PURE__ */ React40.createElement(Control, { type: control.type, props: control.props }));
|
|
1440
|
+
};
|
|
1441
|
+
|
|
1442
|
+
// src/dynamics/init.ts
|
|
1443
|
+
var init = () => {
|
|
1444
|
+
replaceControl({
|
|
1445
|
+
component: DynamicSelectionControl,
|
|
1446
|
+
condition: ({ value }) => isDynamicPropValue(value)
|
|
1447
|
+
});
|
|
1448
|
+
};
|
|
1449
|
+
|
|
1450
|
+
// src/init.ts
|
|
1451
|
+
function init2() {
|
|
822
1452
|
(0, import_editor_panels3.__registerPanel)(panel);
|
|
823
1453
|
blockV1Panel();
|
|
824
1454
|
(0, import_editor.injectIntoLogic)({
|
|
825
1455
|
id: "editing-panel-hooks",
|
|
826
1456
|
component: EditingPanelHooks
|
|
827
1457
|
});
|
|
1458
|
+
init();
|
|
828
1459
|
}
|
|
829
1460
|
var blockV1Panel = () => {
|
|
830
1461
|
(0, import_editor_v1_adapters9.__privateBlockDataCommand)({
|
|
@@ -834,7 +1465,7 @@ var blockV1Panel = () => {
|
|
|
834
1465
|
};
|
|
835
1466
|
|
|
836
1467
|
// src/index.ts
|
|
837
|
-
|
|
1468
|
+
init2();
|
|
838
1469
|
// Annotate the CommonJS export names for ESM import in node:
|
|
839
1470
|
0 && (module.exports = {
|
|
840
1471
|
replaceControl,
|