@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.mjs
CHANGED
|
@@ -27,8 +27,8 @@ function useControl(defaultValue) {
|
|
|
27
27
|
import { __createPanel as createPanel } from "@elementor/editor-panels";
|
|
28
28
|
|
|
29
29
|
// src/components/editing-panel.tsx
|
|
30
|
-
import * as
|
|
31
|
-
import { __ as
|
|
30
|
+
import * as React37 from "react";
|
|
31
|
+
import { __ as __18 } from "@wordpress/i18n";
|
|
32
32
|
|
|
33
33
|
// src/hooks/use-selected-elements.ts
|
|
34
34
|
import { __privateUseListenTo as useListenTo, commandEndEvent } from "@elementor/editor-v1-adapters";
|
|
@@ -112,13 +112,13 @@ function useElementContext() {
|
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
// src/components/editing-panel-tabs.tsx
|
|
115
|
-
import { Stack as
|
|
116
|
-
import * as
|
|
117
|
-
import { __ as
|
|
115
|
+
import { Stack as Stack11, Tabs, Tab, TabPanel, useTabs } from "@elementor/ui";
|
|
116
|
+
import * as React36 from "react";
|
|
117
|
+
import { __ as __17 } from "@wordpress/i18n";
|
|
118
118
|
|
|
119
119
|
// src/components/settings-tab.tsx
|
|
120
|
-
import * as
|
|
121
|
-
import { Stack as
|
|
120
|
+
import * as React13 from "react";
|
|
121
|
+
import { Stack as Stack3 } from "@elementor/ui";
|
|
122
122
|
|
|
123
123
|
// src/controls/settings-control.tsx
|
|
124
124
|
import * as React4 from "react";
|
|
@@ -184,7 +184,7 @@ var ControlContainer = (props) => /* @__PURE__ */ React3.createElement(StyledSta
|
|
|
184
184
|
// src/controls/settings-control.tsx
|
|
185
185
|
var SettingsControlProvider = ({ bind, children }) => {
|
|
186
186
|
const { element, elementType } = useElementContext();
|
|
187
|
-
const defaultValue = elementType.propsSchema[bind]?.default;
|
|
187
|
+
const defaultValue = elementType.propsSchema[bind]?.type.default;
|
|
188
188
|
const settingsValue = useWidgetSettings({ id: element.id, bind });
|
|
189
189
|
const value = settingsValue ?? defaultValue ?? null;
|
|
190
190
|
const setValue = (newValue) => {
|
|
@@ -212,7 +212,7 @@ var AccordionSection = ({ title, children }) => {
|
|
|
212
212
|
};
|
|
213
213
|
|
|
214
214
|
// src/controls/control.tsx
|
|
215
|
-
import * as
|
|
215
|
+
import * as React12 from "react";
|
|
216
216
|
import { createError } from "@elementor/utils";
|
|
217
217
|
|
|
218
218
|
// src/controls/control-types/image-control.tsx
|
|
@@ -296,8 +296,8 @@ var TextAreaControl = ({ placeholder }) => {
|
|
|
296
296
|
};
|
|
297
297
|
|
|
298
298
|
// src/controls/control-types/size-control.tsx
|
|
299
|
-
import * as
|
|
300
|
-
import {
|
|
299
|
+
import * as React10 from "react";
|
|
300
|
+
import { InputAdornment as InputAdornment2 } from "@elementor/ui";
|
|
301
301
|
|
|
302
302
|
// src/controls/hooks/use-sync-external-state.tsx
|
|
303
303
|
import { useEffect, useState } from "react";
|
|
@@ -332,9 +332,61 @@ var useSyncExternalState = ({
|
|
|
332
332
|
return [internal, setInternalValue];
|
|
333
333
|
};
|
|
334
334
|
|
|
335
|
+
// src/controls/components/text-field-inner-selection.tsx
|
|
336
|
+
import * as React9 from "react";
|
|
337
|
+
import { bindMenu, bindTrigger, Button as Button2, InputAdornment, Menu, MenuItem, TextField as TextField3, usePopupState } from "@elementor/ui";
|
|
338
|
+
import { useId as useId2 } from "react";
|
|
339
|
+
var TextFieldInnerSelection = ({
|
|
340
|
+
placeholder,
|
|
341
|
+
type,
|
|
342
|
+
value,
|
|
343
|
+
onChange,
|
|
344
|
+
endAdornment,
|
|
345
|
+
startAdornment
|
|
346
|
+
}) => {
|
|
347
|
+
return /* @__PURE__ */ React9.createElement(
|
|
348
|
+
TextField3,
|
|
349
|
+
{
|
|
350
|
+
size: "tiny",
|
|
351
|
+
type,
|
|
352
|
+
value,
|
|
353
|
+
onChange,
|
|
354
|
+
placeholder,
|
|
355
|
+
InputProps: {
|
|
356
|
+
endAdornment,
|
|
357
|
+
startAdornment
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
);
|
|
361
|
+
};
|
|
362
|
+
var SelectionEndAdornment = ({
|
|
363
|
+
options: options3,
|
|
364
|
+
onClick,
|
|
365
|
+
value
|
|
366
|
+
}) => {
|
|
367
|
+
const popupState = usePopupState({
|
|
368
|
+
variant: "popover",
|
|
369
|
+
popupId: useId2()
|
|
370
|
+
});
|
|
371
|
+
const handleMenuItemClick = (index) => {
|
|
372
|
+
onClick(options3[index]);
|
|
373
|
+
popupState.close();
|
|
374
|
+
};
|
|
375
|
+
return /* @__PURE__ */ React9.createElement(InputAdornment, { position: "end" }, /* @__PURE__ */ React9.createElement(
|
|
376
|
+
Button2,
|
|
377
|
+
{
|
|
378
|
+
size: "small",
|
|
379
|
+
color: "inherit",
|
|
380
|
+
sx: { font: "inherit", minWidth: "initial" },
|
|
381
|
+
...bindTrigger(popupState)
|
|
382
|
+
},
|
|
383
|
+
value.toUpperCase()
|
|
384
|
+
), /* @__PURE__ */ React9.createElement(Menu, { MenuListProps: { dense: true }, ...bindMenu(popupState) }, options3.map((option, index) => /* @__PURE__ */ React9.createElement(MenuItem, { key: option, onClick: () => handleMenuItemClick(index) }, option.toUpperCase()))));
|
|
385
|
+
};
|
|
386
|
+
|
|
335
387
|
// src/controls/control-types/size-control.tsx
|
|
336
388
|
var defaultUnits = ["px", "%", "em", "rem", "vw"];
|
|
337
|
-
var SizeControl = ({ units = defaultUnits, placeholder }) => {
|
|
389
|
+
var SizeControl = ({ units = defaultUnits, placeholder, startIcon }) => {
|
|
338
390
|
const { value, setValue } = useControl();
|
|
339
391
|
const [state, setState] = useSyncExternalState({
|
|
340
392
|
external: value,
|
|
@@ -345,8 +397,7 @@ var SizeControl = ({ units = defaultUnits, placeholder }) => {
|
|
|
345
397
|
value: { unit: controlValue?.value.unit || "px", size: NaN }
|
|
346
398
|
})
|
|
347
399
|
});
|
|
348
|
-
const handleUnitChange = (
|
|
349
|
-
const unit = event.target.value;
|
|
400
|
+
const handleUnitChange = (unit) => {
|
|
350
401
|
setState((prev) => ({
|
|
351
402
|
...prev,
|
|
352
403
|
value: {
|
|
@@ -365,39 +416,28 @@ var SizeControl = ({ units = defaultUnits, placeholder }) => {
|
|
|
365
416
|
}
|
|
366
417
|
}));
|
|
367
418
|
};
|
|
368
|
-
return /* @__PURE__ */
|
|
369
|
-
|
|
419
|
+
return /* @__PURE__ */ React10.createElement(
|
|
420
|
+
TextFieldInnerSelection,
|
|
370
421
|
{
|
|
371
|
-
|
|
422
|
+
endAdornment: /* @__PURE__ */ React10.createElement(SelectionEndAdornment, { options: units, onClick: handleUnitChange, value: state.value.unit }),
|
|
423
|
+
placeholder,
|
|
424
|
+
startAdornment: startIcon ?? /* @__PURE__ */ React10.createElement(InputAdornment2, { position: "start" }, startIcon),
|
|
372
425
|
type: "number",
|
|
373
426
|
value: Number.isNaN(state.value.size) ? "" : state.value.size,
|
|
374
|
-
onChange: handleSizeChange
|
|
375
|
-
placeholder
|
|
427
|
+
onChange: handleSizeChange
|
|
376
428
|
}
|
|
377
|
-
)
|
|
378
|
-
Select,
|
|
379
|
-
{
|
|
380
|
-
size: "tiny",
|
|
381
|
-
value: state.value.unit,
|
|
382
|
-
onChange: handleUnitChange,
|
|
383
|
-
MenuProps: {
|
|
384
|
-
anchorOrigin: { vertical: "bottom", horizontal: "right" },
|
|
385
|
-
transformOrigin: { vertical: "top", horizontal: "right" }
|
|
386
|
-
}
|
|
387
|
-
},
|
|
388
|
-
units.map((unit) => /* @__PURE__ */ React9.createElement(MenuItem, { key: unit, value: unit }, unit.toUpperCase()))
|
|
389
|
-
));
|
|
429
|
+
);
|
|
390
430
|
};
|
|
391
431
|
|
|
392
432
|
// src/controls/control-types/select-control.tsx
|
|
393
|
-
import * as
|
|
394
|
-
import { MenuItem as MenuItem2, Select
|
|
395
|
-
var SelectControl = ({ options }) => {
|
|
433
|
+
import * as React11 from "react";
|
|
434
|
+
import { MenuItem as MenuItem2, Select } from "@elementor/ui";
|
|
435
|
+
var SelectControl = ({ options: options3 }) => {
|
|
396
436
|
const { value, setValue } = useControl();
|
|
397
437
|
const handleChange = (event) => {
|
|
398
438
|
setValue(event.target.value);
|
|
399
439
|
};
|
|
400
|
-
return /* @__PURE__ */
|
|
440
|
+
return /* @__PURE__ */ React11.createElement(Select, { size: "tiny", value: value ?? "", onChange: handleChange }, options3.map(({ label, ...props }) => /* @__PURE__ */ React11.createElement(MenuItem2, { key: props.value, ...props }, label)));
|
|
401
441
|
};
|
|
402
442
|
|
|
403
443
|
// src/controls/controls-registry.tsx
|
|
@@ -424,20 +464,20 @@ var Control = ({ props, type }) => {
|
|
|
424
464
|
});
|
|
425
465
|
}
|
|
426
466
|
const ControlComponent = getControlReplacement({ value }) || ControlByType;
|
|
427
|
-
return /* @__PURE__ */
|
|
467
|
+
return /* @__PURE__ */ React12.createElement(ControlComponent, { ...props });
|
|
428
468
|
};
|
|
429
469
|
|
|
430
470
|
// src/components/settings-tab.tsx
|
|
431
471
|
var SettingsTab = () => {
|
|
432
472
|
const { elementType } = useElementContext();
|
|
433
|
-
return /* @__PURE__ */
|
|
473
|
+
return /* @__PURE__ */ React13.createElement(Stack3, null, elementType.controls.map(({ type, value }, index) => {
|
|
434
474
|
if (type === "control") {
|
|
435
|
-
return /* @__PURE__ */
|
|
475
|
+
return /* @__PURE__ */ React13.createElement(Control2, { key: value.bind, control: value });
|
|
436
476
|
}
|
|
437
477
|
if (type === "section") {
|
|
438
|
-
return /* @__PURE__ */
|
|
478
|
+
return /* @__PURE__ */ React13.createElement(AccordionSection, { key: type + "." + index, title: value.label }, value.items?.map((item) => {
|
|
439
479
|
if (item.type === "control") {
|
|
440
|
-
return /* @__PURE__ */
|
|
480
|
+
return /* @__PURE__ */ React13.createElement(Control2, { key: item.value.bind, control: item.value });
|
|
441
481
|
}
|
|
442
482
|
return null;
|
|
443
483
|
}));
|
|
@@ -449,21 +489,21 @@ var Control2 = ({ control }) => {
|
|
|
449
489
|
if (!getControlByType(control.type)) {
|
|
450
490
|
return null;
|
|
451
491
|
}
|
|
452
|
-
return /* @__PURE__ */
|
|
492
|
+
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 }));
|
|
453
493
|
};
|
|
454
494
|
|
|
455
495
|
// src/components/style-tab.tsx
|
|
456
|
-
import * as
|
|
496
|
+
import * as React35 from "react";
|
|
457
497
|
|
|
458
498
|
// src/contexts/style-context.tsx
|
|
459
|
-
import * as
|
|
499
|
+
import * as React14 from "react";
|
|
460
500
|
import { createContext as createContext3, useContext as useContext3 } from "react";
|
|
461
501
|
import { useActiveBreakpoint } from "@elementor/editor-responsive";
|
|
462
502
|
var Context2 = createContext3(null);
|
|
463
|
-
function StyleContext({ children, selectedStyleDef }) {
|
|
503
|
+
function StyleContext({ children, selectedStyleDef, selectedClassesProp }) {
|
|
464
504
|
const breakpoint = useActiveBreakpoint();
|
|
465
505
|
const selectedMeta = { breakpoint, state: null };
|
|
466
|
-
return /* @__PURE__ */
|
|
506
|
+
return /* @__PURE__ */ React14.createElement(Context2.Provider, { value: { selectedStyleDef, selectedMeta, selectedClassesProp } }, children);
|
|
467
507
|
}
|
|
468
508
|
function useStyleContext() {
|
|
469
509
|
const context = useContext3(Context2);
|
|
@@ -494,13 +534,13 @@ var useElementStyles = (elementID) => {
|
|
|
494
534
|
};
|
|
495
535
|
|
|
496
536
|
// src/components/style-tab.tsx
|
|
497
|
-
import { Stack as
|
|
537
|
+
import { Stack as Stack10 } from "@elementor/ui";
|
|
498
538
|
|
|
499
539
|
// src/components/style-sections/size-section.tsx
|
|
500
540
|
import * as React16 from "react";
|
|
501
541
|
|
|
502
542
|
// src/controls/style-control.tsx
|
|
503
|
-
import * as
|
|
543
|
+
import * as React15 from "react";
|
|
504
544
|
|
|
505
545
|
// src/hooks/use-element-style-prop.ts
|
|
506
546
|
import { commandEndEvent as commandEndEvent5, __privateUseListenTo as useListenTo5 } from "@elementor/editor-v1-adapters";
|
|
@@ -534,7 +574,7 @@ function getVariantByMeta(styleDef, meta) {
|
|
|
534
574
|
|
|
535
575
|
// src/sync/update-style.ts
|
|
536
576
|
import { __privateRunCommand as runCommand2 } from "@elementor/editor-v1-adapters";
|
|
537
|
-
var updateStyle = ({ elementID, styleDefID, meta, props, bind
|
|
577
|
+
var updateStyle = ({ elementID, styleDefID, meta, props, bind }) => {
|
|
538
578
|
const container = getContainer(elementID);
|
|
539
579
|
runCommand2("document/atomic-widgets/styles", {
|
|
540
580
|
container,
|
|
@@ -548,7 +588,7 @@ var updateStyle = ({ elementID, styleDefID, meta, props, bind = "classes" }) =>
|
|
|
548
588
|
// src/controls/hooks/use-style-control.ts
|
|
549
589
|
var useStyleControl = (propName) => {
|
|
550
590
|
const { element } = useElementContext();
|
|
551
|
-
const { selectedStyleDef, selectedMeta } = useStyleContext();
|
|
591
|
+
const { selectedStyleDef, selectedMeta, selectedClassesProp } = useStyleContext();
|
|
552
592
|
const value = useElementStyleProp({
|
|
553
593
|
elementID: element.id,
|
|
554
594
|
styleDefID: selectedStyleDef?.id,
|
|
@@ -560,7 +600,8 @@ var useStyleControl = (propName) => {
|
|
|
560
600
|
elementID: element.id,
|
|
561
601
|
styleDefID: selectedStyleDef?.id,
|
|
562
602
|
props: { [propName]: newValue },
|
|
563
|
-
meta: selectedMeta
|
|
603
|
+
meta: selectedMeta,
|
|
604
|
+
bind: selectedClassesProp
|
|
564
605
|
});
|
|
565
606
|
};
|
|
566
607
|
return [value, setValue];
|
|
@@ -569,68 +610,35 @@ var useStyleControl = (propName) => {
|
|
|
569
610
|
// src/controls/style-control.tsx
|
|
570
611
|
var StyleControl = ({ bind, children }) => {
|
|
571
612
|
const [value, setValue] = useStyleControl(bind);
|
|
572
|
-
return /* @__PURE__ */
|
|
613
|
+
return /* @__PURE__ */ React15.createElement(ControlContext.Provider, { value: { bind, value, setValue } }, children);
|
|
573
614
|
};
|
|
574
615
|
StyleControl.Label = ControlLabel;
|
|
575
616
|
|
|
576
|
-
// src/components/collapsible-content.tsx
|
|
577
|
-
import * as React15 from "react";
|
|
578
|
-
import { useState as useState2 } from "react";
|
|
579
|
-
import { ChevronDownIcon } from "@elementor/icons";
|
|
580
|
-
import { Button as Button2, Collapse, Stack as Stack5, styled as styled2 } from "@elementor/ui";
|
|
581
|
-
import { __ as __2 } from "@wordpress/i18n";
|
|
582
|
-
var CollapsibleContent = ({ children, defaultOpen = false }) => {
|
|
583
|
-
const [open, setOpen] = useState2(defaultOpen);
|
|
584
|
-
const handleToggle = () => {
|
|
585
|
-
setOpen((prevOpen) => !prevOpen);
|
|
586
|
-
};
|
|
587
|
-
return /* @__PURE__ */ React15.createElement(Stack5, { sx: { py: 0.5 } }, /* @__PURE__ */ React15.createElement(
|
|
588
|
-
Button2,
|
|
589
|
-
{
|
|
590
|
-
fullWidth: true,
|
|
591
|
-
size: "small",
|
|
592
|
-
color: "secondary",
|
|
593
|
-
variant: "outlined",
|
|
594
|
-
onClick: handleToggle,
|
|
595
|
-
endIcon: /* @__PURE__ */ React15.createElement(ChevronIcon, { open })
|
|
596
|
-
},
|
|
597
|
-
open ? __2("Show less", "elementor") : __2("Show more", "elementor")
|
|
598
|
-
), /* @__PURE__ */ React15.createElement(Collapse, { in: open, timeout: "auto" }, children));
|
|
599
|
-
};
|
|
600
|
-
var ChevronIcon = styled2(ChevronDownIcon, {
|
|
601
|
-
shouldForwardProp: (prop) => prop !== "open"
|
|
602
|
-
})(({ theme, open }) => ({
|
|
603
|
-
transform: open ? "rotate(180deg)" : "rotate(0)",
|
|
604
|
-
transition: theme.transitions.create("transform", {
|
|
605
|
-
duration: theme.transitions.duration.standard
|
|
606
|
-
})
|
|
607
|
-
}));
|
|
608
|
-
|
|
609
617
|
// src/components/style-sections/size-section.tsx
|
|
610
|
-
import { Stack as
|
|
611
|
-
import { __ as
|
|
618
|
+
import { Stack as Stack4 } from "@elementor/ui";
|
|
619
|
+
import { __ as __2 } from "@wordpress/i18n";
|
|
612
620
|
var SizeSection = () => {
|
|
613
|
-
return /* @__PURE__ */ React16.createElement(AccordionSection, { title:
|
|
621
|
+
return /* @__PURE__ */ React16.createElement(AccordionSection, { title: __2("Size", "elementor") }, /* @__PURE__ */ React16.createElement(Stack4, { gap: 1.5 }, /* @__PURE__ */ React16.createElement(Stack4, { direction: "row", gap: 2 }, /* @__PURE__ */ React16.createElement(Control3, { bind: "width", label: __2("Width", "elementor") }), /* @__PURE__ */ React16.createElement(Control3, { bind: "height", label: __2("Height", "elementor") })), /* @__PURE__ */ React16.createElement(Stack4, { gap: 1.5, sx: { pt: 1.5 } }, /* @__PURE__ */ React16.createElement(Stack4, { direction: "row", gap: 2 }, /* @__PURE__ */ React16.createElement(Control3, { bind: "minWidth", label: __2("Min. Width", "elementor") }), /* @__PURE__ */ React16.createElement(Control3, { bind: "minHeight", label: __2("Min. Height", "elementor") })), /* @__PURE__ */ React16.createElement(Stack4, { direction: "row", gap: 2 }, /* @__PURE__ */ React16.createElement(Control3, { bind: "maxWidth", label: __2("Max. Width", "elementor") }), /* @__PURE__ */ React16.createElement(Control3, { bind: "maxHeight", label: __2("Max. Height", "elementor") })))));
|
|
614
622
|
};
|
|
615
623
|
var Control3 = ({ label, bind }) => {
|
|
616
624
|
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" })));
|
|
617
625
|
};
|
|
618
626
|
|
|
619
627
|
// src/components/style-sections/typography-section/typography-section.tsx
|
|
620
|
-
import * as
|
|
621
|
-
import { Divider, Stack as
|
|
628
|
+
import * as React29 from "react";
|
|
629
|
+
import { Divider, Stack as Stack6 } from "@elementor/ui";
|
|
622
630
|
|
|
623
631
|
// src/components/style-sections/typography-section/text-style-control.tsx
|
|
624
632
|
import * as React17 from "react";
|
|
625
633
|
import { ToggleButton as ToggleButtonBase, ToggleButtonGroup } from "@elementor/ui";
|
|
626
634
|
import { ItalicIcon, StrikethroughIcon, UnderlineIcon } from "@elementor/icons";
|
|
627
|
-
import { __ as
|
|
635
|
+
import { __ as __3 } from "@wordpress/i18n";
|
|
628
636
|
var buttonSize = "tiny";
|
|
629
637
|
var TextStyleControl = () => {
|
|
630
638
|
const [fontStyle, setFontStyle] = useStyleControl("fontStyle");
|
|
631
639
|
const [textDecoration, setTextDecoration] = useStyleControl("textDecoration");
|
|
632
640
|
const formats = [fontStyle, ...(textDecoration || "").split(" ")];
|
|
633
|
-
return /* @__PURE__ */ React17.createElement(ControlContainer, null, /* @__PURE__ */ React17.createElement(ControlLabel, null,
|
|
641
|
+
return /* @__PURE__ */ React17.createElement(ControlContainer, null, /* @__PURE__ */ React17.createElement(ControlLabel, null, __3("Style", "elementor")), /* @__PURE__ */ React17.createElement(ToggleButtonGroup, { value: formats }, /* @__PURE__ */ React17.createElement(
|
|
634
642
|
ToggleButton,
|
|
635
643
|
{
|
|
636
644
|
value: "italic",
|
|
@@ -685,46 +693,367 @@ var ToggleButton = ({ onChange, ...props }) => {
|
|
|
685
693
|
};
|
|
686
694
|
|
|
687
695
|
// src/components/style-sections/typography-section/typography-section.tsx
|
|
688
|
-
import { __ as
|
|
696
|
+
import { __ as __12 } from "@wordpress/i18n";
|
|
689
697
|
|
|
690
698
|
// src/components/style-sections/typography-section/font-size-control.tsx
|
|
691
699
|
import * as React18 from "react";
|
|
692
|
-
import { __ as
|
|
700
|
+
import { __ as __4 } from "@wordpress/i18n";
|
|
693
701
|
var FontSizeControl = () => {
|
|
694
|
-
return /* @__PURE__ */ React18.createElement(StyleControl, { bind: "font-size" }, /* @__PURE__ */ React18.createElement(ControlContainer, null, /* @__PURE__ */ React18.createElement(StyleControl.Label, null,
|
|
702
|
+
return /* @__PURE__ */ React18.createElement(StyleControl, { bind: "font-size" }, /* @__PURE__ */ React18.createElement(ControlContainer, null, /* @__PURE__ */ React18.createElement(StyleControl.Label, null, __4("Font Size", "elementor")), /* @__PURE__ */ React18.createElement(SizeControl, null)));
|
|
695
703
|
};
|
|
696
704
|
|
|
697
705
|
// src/components/style-sections/typography-section/font-weight-control.tsx
|
|
698
706
|
import * as React19 from "react";
|
|
699
|
-
import { __ as
|
|
707
|
+
import { __ as __5 } from "@wordpress/i18n";
|
|
700
708
|
var fontWeightOptions = [
|
|
701
|
-
{ label:
|
|
702
|
-
{ label:
|
|
703
|
-
{ label:
|
|
704
|
-
{ label:
|
|
705
|
-
{ label:
|
|
709
|
+
{ label: __5("Light - 400", "elementor"), value: 400 },
|
|
710
|
+
{ label: __5("Regular - 500", "elementor"), value: 500 },
|
|
711
|
+
{ label: __5("Semi Bold - 600", "elementor"), value: 600 },
|
|
712
|
+
{ label: __5("Bold - 700", "elementor"), value: 700 },
|
|
713
|
+
{ label: __5("Black - 900", "elementor"), value: 900 }
|
|
706
714
|
];
|
|
707
715
|
var FontWeightControl = () => {
|
|
708
|
-
return /* @__PURE__ */ React19.createElement(StyleControl, { bind: "fontWeight" }, /* @__PURE__ */ React19.createElement(ControlContainer, null, /* @__PURE__ */ React19.createElement(StyleControl.Label, null,
|
|
716
|
+
return /* @__PURE__ */ React19.createElement(StyleControl, { bind: "fontWeight" }, /* @__PURE__ */ React19.createElement(ControlContainer, null, /* @__PURE__ */ React19.createElement(StyleControl.Label, null, __5("Font Weight", "elementor")), /* @__PURE__ */ React19.createElement(SelectControl, { options: fontWeightOptions })));
|
|
717
|
+
};
|
|
718
|
+
|
|
719
|
+
// src/components/style-sections/typography-section/text-color-control.tsx
|
|
720
|
+
import * as React21 from "react";
|
|
721
|
+
import { __ as __6 } from "@wordpress/i18n";
|
|
722
|
+
|
|
723
|
+
// src/controls/control-types/color-control.tsx
|
|
724
|
+
import * as React20 from "react";
|
|
725
|
+
import { UnstableColorPicker } from "@elementor/ui";
|
|
726
|
+
var ColorControl = () => {
|
|
727
|
+
const { value, setValue } = useControl();
|
|
728
|
+
const handleChange = debounce((selectedColor) => {
|
|
729
|
+
setValue(selectedColor);
|
|
730
|
+
});
|
|
731
|
+
return /* @__PURE__ */ React20.createElement(UnstableColorPicker, { value, onChange: handleChange });
|
|
732
|
+
};
|
|
733
|
+
var debounce = (func, wait = 300) => {
|
|
734
|
+
let timer;
|
|
735
|
+
return (...args) => {
|
|
736
|
+
clearTimeout(timer);
|
|
737
|
+
timer = setTimeout(() => func(...args), wait);
|
|
738
|
+
};
|
|
739
|
+
};
|
|
740
|
+
|
|
741
|
+
// src/components/style-sections/typography-section/text-color-control.tsx
|
|
742
|
+
var TextColorControl = () => {
|
|
743
|
+
return /* @__PURE__ */ React21.createElement(StyleControl, { bind: "color" }, /* @__PURE__ */ React21.createElement(ControlContainer, null, /* @__PURE__ */ React21.createElement(StyleControl.Label, null, __6("Text Color", "elementor")), /* @__PURE__ */ React21.createElement(ColorControl, null)));
|
|
744
|
+
};
|
|
745
|
+
|
|
746
|
+
// src/components/style-sections/typography-section/letter-spacing-control.tsx
|
|
747
|
+
import * as React22 from "react";
|
|
748
|
+
import { __ as __7 } from "@wordpress/i18n";
|
|
749
|
+
var LetterSpacingControl = () => {
|
|
750
|
+
return /* @__PURE__ */ React22.createElement(StyleControl, { bind: "letter-spacing" }, /* @__PURE__ */ React22.createElement(ControlContainer, null, /* @__PURE__ */ React22.createElement(StyleControl.Label, null, __7("Letter Spacing", "elementor")), /* @__PURE__ */ React22.createElement(SizeControl, null)));
|
|
751
|
+
};
|
|
752
|
+
|
|
753
|
+
// src/components/style-sections/typography-section/word-spacing-control.tsx
|
|
754
|
+
import * as React23 from "react";
|
|
755
|
+
import { __ as __8 } from "@wordpress/i18n";
|
|
756
|
+
var WordSpacingControl = () => {
|
|
757
|
+
return /* @__PURE__ */ React23.createElement(StyleControl, { bind: "word-spacing" }, /* @__PURE__ */ React23.createElement(ControlContainer, null, /* @__PURE__ */ React23.createElement(StyleControl.Label, null, __8("Word Spacing", "elementor")), /* @__PURE__ */ React23.createElement(SizeControl, null)));
|
|
758
|
+
};
|
|
759
|
+
|
|
760
|
+
// src/components/collapsible-content.tsx
|
|
761
|
+
import * as React24 from "react";
|
|
762
|
+
import { useState as useState2 } from "react";
|
|
763
|
+
import { ChevronDownIcon } from "@elementor/icons";
|
|
764
|
+
import { Button as Button3, Collapse, Stack as Stack5, styled as styled2 } from "@elementor/ui";
|
|
765
|
+
import { __ as __9 } from "@wordpress/i18n";
|
|
766
|
+
var CollapsibleContent = ({ children, defaultOpen = false }) => {
|
|
767
|
+
const [open, setOpen] = useState2(defaultOpen);
|
|
768
|
+
const handleToggle = () => {
|
|
769
|
+
setOpen((prevOpen) => !prevOpen);
|
|
770
|
+
};
|
|
771
|
+
return /* @__PURE__ */ React24.createElement(Stack5, { sx: { py: 0.5 } }, /* @__PURE__ */ React24.createElement(
|
|
772
|
+
Button3,
|
|
773
|
+
{
|
|
774
|
+
fullWidth: true,
|
|
775
|
+
size: "small",
|
|
776
|
+
color: "secondary",
|
|
777
|
+
variant: "outlined",
|
|
778
|
+
onClick: handleToggle,
|
|
779
|
+
endIcon: /* @__PURE__ */ React24.createElement(ChevronIcon, { open })
|
|
780
|
+
},
|
|
781
|
+
open ? __9("Show less", "elementor") : __9("Show more", "elementor")
|
|
782
|
+
), /* @__PURE__ */ React24.createElement(Collapse, { in: open, timeout: "auto" }, children));
|
|
783
|
+
};
|
|
784
|
+
var ChevronIcon = styled2(ChevronDownIcon, {
|
|
785
|
+
shouldForwardProp: (prop) => prop !== "open"
|
|
786
|
+
})(({ theme, open }) => ({
|
|
787
|
+
transform: open ? "rotate(180deg)" : "rotate(0)",
|
|
788
|
+
transition: theme.transitions.create("transform", {
|
|
789
|
+
duration: theme.transitions.duration.standard
|
|
790
|
+
})
|
|
791
|
+
}));
|
|
792
|
+
|
|
793
|
+
// src/components/style-sections/typography-section/transform-control.tsx
|
|
794
|
+
import * as React27 from "react";
|
|
795
|
+
import { __ as __10 } from "@wordpress/i18n";
|
|
796
|
+
|
|
797
|
+
// src/controls/control-types/toggle-control.tsx
|
|
798
|
+
import * as React26 from "react";
|
|
799
|
+
|
|
800
|
+
// src/controls/components/control-toggle-button-group.tsx
|
|
801
|
+
import * as React25 from "react";
|
|
802
|
+
import { styled as styled3, ToggleButton as ToggleButton2, ToggleButtonGroup as ToggleButtonGroup2 } from "@elementor/ui";
|
|
803
|
+
var StyledToggleButtonGroup = styled3(ToggleButtonGroup2)`
|
|
804
|
+
${({ justify }) => `justify-content: ${justify};`}
|
|
805
|
+
`;
|
|
806
|
+
var ControlToggleButtonGroup = ({
|
|
807
|
+
justify = "end",
|
|
808
|
+
size = "tiny",
|
|
809
|
+
value,
|
|
810
|
+
onChange,
|
|
811
|
+
items,
|
|
812
|
+
exclusive = false
|
|
813
|
+
}) => {
|
|
814
|
+
const handleChange = (_, newValue) => {
|
|
815
|
+
onChange(newValue);
|
|
816
|
+
};
|
|
817
|
+
return /* @__PURE__ */ React25.createElement(StyledToggleButtonGroup, { justify, value, onChange: handleChange, exclusive }, items.map(({ label, value: buttonValue, icon: Icon }) => /* @__PURE__ */ React25.createElement(ToggleButton2, { key: buttonValue, value: buttonValue, "aria-label": label, size }, /* @__PURE__ */ React25.createElement(Icon, { fontSize: size }))));
|
|
818
|
+
};
|
|
819
|
+
|
|
820
|
+
// src/controls/control-types/toggle-control.tsx
|
|
821
|
+
var ToggleControl = ({ options: options3 }) => {
|
|
822
|
+
const { value, setValue } = useControl();
|
|
823
|
+
const handleToggle = (option) => {
|
|
824
|
+
setValue(option || void 0);
|
|
825
|
+
};
|
|
826
|
+
return /* @__PURE__ */ React26.createElement(
|
|
827
|
+
ControlToggleButtonGroup,
|
|
828
|
+
{
|
|
829
|
+
items: options3,
|
|
830
|
+
value: value || null,
|
|
831
|
+
onChange: handleToggle,
|
|
832
|
+
exclusive: true
|
|
833
|
+
}
|
|
834
|
+
);
|
|
835
|
+
};
|
|
836
|
+
|
|
837
|
+
// src/components/style-sections/typography-section/transform-control.tsx
|
|
838
|
+
import { LetterCaseIcon, LetterCaseLowerIcon, LetterCaseUpperIcon } from "@elementor/icons";
|
|
839
|
+
var options = [
|
|
840
|
+
{ value: "capitalize", label: __10("Capitalize", "elementor"), icon: LetterCaseIcon },
|
|
841
|
+
{ value: "uppercase", label: __10("Uppercase", "elementor"), icon: LetterCaseUpperIcon },
|
|
842
|
+
{ value: "lowercase", label: __10("Lowercase", "elementor"), icon: LetterCaseLowerIcon }
|
|
843
|
+
];
|
|
844
|
+
var TransformControl = () => {
|
|
845
|
+
return /* @__PURE__ */ React27.createElement(ControlContainer, null, /* @__PURE__ */ React27.createElement(StyleControl.Label, null, __10("Transform", "elementor")), /* @__PURE__ */ React27.createElement(StyleControl, { bind: "text-transform" }, /* @__PURE__ */ React27.createElement(ToggleControl, { options })));
|
|
846
|
+
};
|
|
847
|
+
|
|
848
|
+
// src/components/style-sections/typography-section/text-alignment-control.tsx
|
|
849
|
+
import * as React28 from "react";
|
|
850
|
+
import { AlignLeftIcon, AlignCenterIcon, AlignRightIcon, AlignJustifiedIcon } from "@elementor/icons";
|
|
851
|
+
import { __ as __11 } from "@wordpress/i18n";
|
|
852
|
+
var options2 = [
|
|
853
|
+
{
|
|
854
|
+
value: "left",
|
|
855
|
+
label: __11("Left", "elementor"),
|
|
856
|
+
icon: AlignLeftIcon
|
|
857
|
+
},
|
|
858
|
+
{
|
|
859
|
+
value: "center",
|
|
860
|
+
label: __11("Center", "elementor"),
|
|
861
|
+
icon: AlignCenterIcon
|
|
862
|
+
},
|
|
863
|
+
{
|
|
864
|
+
value: "right",
|
|
865
|
+
label: __11("Right", "elementor"),
|
|
866
|
+
icon: AlignRightIcon
|
|
867
|
+
},
|
|
868
|
+
{
|
|
869
|
+
value: "justify",
|
|
870
|
+
label: __11("Justify", "elementor"),
|
|
871
|
+
icon: AlignJustifiedIcon
|
|
872
|
+
}
|
|
873
|
+
];
|
|
874
|
+
var TextAlignmentControl = () => {
|
|
875
|
+
return /* @__PURE__ */ React28.createElement(ControlContainer, null, /* @__PURE__ */ React28.createElement(StyleControl.Label, null, __11("Alignment", "elementor")), /* @__PURE__ */ React28.createElement(StyleControl, { bind: "text-align" }, /* @__PURE__ */ React28.createElement(ToggleControl, { options: options2 })));
|
|
709
876
|
};
|
|
710
877
|
|
|
711
878
|
// src/components/style-sections/typography-section/typography-section.tsx
|
|
712
879
|
var TypographySection = () => {
|
|
713
|
-
return /* @__PURE__ */
|
|
880
|
+
return /* @__PURE__ */ React29.createElement(AccordionSection, { title: __12("Typography", "elementor") }, /* @__PURE__ */ React29.createElement(Stack6, { gap: 1.5 }, /* @__PURE__ */ React29.createElement(FontWeightControl, null), /* @__PURE__ */ React29.createElement(FontSizeControl, null), /* @__PURE__ */ React29.createElement(Divider, null), /* @__PURE__ */ React29.createElement(TextColorControl, null), /* @__PURE__ */ React29.createElement(CollapsibleContent, null, /* @__PURE__ */ React29.createElement(Stack6, { gap: 1.5, sx: { pt: 1.5 } }, /* @__PURE__ */ React29.createElement(LetterSpacingControl, null), /* @__PURE__ */ React29.createElement(WordSpacingControl, null), /* @__PURE__ */ React29.createElement(Divider, null), /* @__PURE__ */ React29.createElement(TextAlignmentControl, null), /* @__PURE__ */ React29.createElement(TextStyleControl, null), /* @__PURE__ */ React29.createElement(TransformControl, null)))));
|
|
881
|
+
};
|
|
882
|
+
|
|
883
|
+
// src/components/style-sections/position-section/position-section.tsx
|
|
884
|
+
import * as React32 from "react";
|
|
885
|
+
import { Stack as Stack7 } from "@elementor/ui";
|
|
886
|
+
|
|
887
|
+
// src/components/style-sections/position-section/z-index-control.tsx
|
|
888
|
+
import * as React31 from "react";
|
|
889
|
+
import { __ as __13 } from "@wordpress/i18n";
|
|
890
|
+
|
|
891
|
+
// src/controls/control-types/number-control.tsx
|
|
892
|
+
import * as React30 from "react";
|
|
893
|
+
import { TextField as TextField4 } from "@elementor/ui";
|
|
894
|
+
var isEmptyOrNaN = (value) => value === void 0 || value === "" || Number.isNaN(Number(value));
|
|
895
|
+
var NumberControl = ({ placeholder }) => {
|
|
896
|
+
const { value, setValue } = useControl();
|
|
897
|
+
const handleChange = (event) => {
|
|
898
|
+
const eventValue = event.target.value;
|
|
899
|
+
setValue(isEmptyOrNaN(eventValue) ? void 0 : Number(eventValue));
|
|
900
|
+
};
|
|
901
|
+
return /* @__PURE__ */ React30.createElement(
|
|
902
|
+
TextField4,
|
|
903
|
+
{
|
|
904
|
+
size: "tiny",
|
|
905
|
+
type: "number",
|
|
906
|
+
value: isEmptyOrNaN(value) ? "" : value,
|
|
907
|
+
onChange: handleChange,
|
|
908
|
+
placeholder
|
|
909
|
+
}
|
|
910
|
+
);
|
|
911
|
+
};
|
|
912
|
+
|
|
913
|
+
// src/components/style-sections/position-section/z-index-control.tsx
|
|
914
|
+
var ZIndexControl = () => {
|
|
915
|
+
return /* @__PURE__ */ React31.createElement(StyleControl, { bind: "zIndex" }, /* @__PURE__ */ React31.createElement(ControlContainer, null, /* @__PURE__ */ React31.createElement(StyleControl.Label, null, __13("Z-Index", "elementor")), /* @__PURE__ */ React31.createElement(NumberControl, null)));
|
|
916
|
+
};
|
|
917
|
+
|
|
918
|
+
// src/components/style-sections/position-section/position-section.tsx
|
|
919
|
+
import { __ as __14 } from "@wordpress/i18n";
|
|
920
|
+
var PositionSection = () => {
|
|
921
|
+
return /* @__PURE__ */ React32.createElement(AccordionSection, { title: __14("Position", "elementor") }, /* @__PURE__ */ React32.createElement(Stack7, { gap: 1.5 }, /* @__PURE__ */ React32.createElement(ZIndexControl, null)));
|
|
922
|
+
};
|
|
923
|
+
|
|
924
|
+
// src/components/style-sections/spacing-section/spacing-section.tsx
|
|
925
|
+
import * as React34 from "react";
|
|
926
|
+
import { Divider as Divider2, Stack as Stack9 } from "@elementor/ui";
|
|
927
|
+
import { __ as __16 } from "@wordpress/i18n";
|
|
928
|
+
|
|
929
|
+
// src/components/style-sections/spacing-section/linked-dimensions-control.tsx
|
|
930
|
+
import * as React33 from "react";
|
|
931
|
+
import { Stack as Stack8, ToggleButton as ToggleButton3 } from "@elementor/ui";
|
|
932
|
+
import { DetachIcon, LinkIcon, SideBottomIcon, SideLeftIcon, SideRightIcon, SideTopIcon } from "@elementor/icons";
|
|
933
|
+
import { __ as __15 } from "@wordpress/i18n";
|
|
934
|
+
var LinkedDimensionsControl = ({ label }) => {
|
|
935
|
+
const { value, setValue } = useControl();
|
|
936
|
+
const { top, right, bottom, left, isLinked = false } = value?.value || {};
|
|
937
|
+
const setLinkedValue = (position, newValue) => {
|
|
938
|
+
const updatedValue = {
|
|
939
|
+
isLinked,
|
|
940
|
+
top: isLinked ? newValue : top,
|
|
941
|
+
right: isLinked ? newValue : right,
|
|
942
|
+
bottom: isLinked ? newValue : bottom,
|
|
943
|
+
left: isLinked ? newValue : left,
|
|
944
|
+
[position]: newValue
|
|
945
|
+
};
|
|
946
|
+
setValue({
|
|
947
|
+
$$type: "linked-dimensions",
|
|
948
|
+
value: updatedValue
|
|
949
|
+
});
|
|
950
|
+
};
|
|
951
|
+
const toggleLinked = () => {
|
|
952
|
+
const updatedValue = {
|
|
953
|
+
isLinked: !isLinked,
|
|
954
|
+
top,
|
|
955
|
+
right: !isLinked ? top : right,
|
|
956
|
+
bottom: !isLinked ? top : bottom,
|
|
957
|
+
left: !isLinked ? top : left
|
|
958
|
+
};
|
|
959
|
+
setValue({
|
|
960
|
+
$$type: "linked-dimensions",
|
|
961
|
+
value: updatedValue
|
|
962
|
+
});
|
|
963
|
+
};
|
|
964
|
+
const LinkedIcon = isLinked ? LinkIcon : DetachIcon;
|
|
965
|
+
return /* @__PURE__ */ React33.createElement(React33.Fragment, null, /* @__PURE__ */ React33.createElement(Stack8, { direction: "row", gap: 2 }, /* @__PURE__ */ React33.createElement(ControlLabel, null, label), /* @__PURE__ */ React33.createElement(
|
|
966
|
+
ToggleButton3,
|
|
967
|
+
{
|
|
968
|
+
"aria-label": __15("Link Inputs", "elementor"),
|
|
969
|
+
size: "tiny",
|
|
970
|
+
value: "check",
|
|
971
|
+
selected: isLinked,
|
|
972
|
+
sx: { marginLeft: "auto" },
|
|
973
|
+
onChange: toggleLinked
|
|
974
|
+
},
|
|
975
|
+
/* @__PURE__ */ React33.createElement(LinkedIcon, { fontSize: "tiny" })
|
|
976
|
+
)), /* @__PURE__ */ React33.createElement(Stack8, { direction: "row", gap: 2 }, /* @__PURE__ */ React33.createElement(ControlContainer, { direction: "column" }, /* @__PURE__ */ React33.createElement(ControlLabel, null, __15("Top", "elementor")), /* @__PURE__ */ React33.createElement(
|
|
977
|
+
Control4,
|
|
978
|
+
{
|
|
979
|
+
bind: "top",
|
|
980
|
+
value: top,
|
|
981
|
+
setValue: setLinkedValue,
|
|
982
|
+
startIcon: /* @__PURE__ */ React33.createElement(SideTopIcon, { fontSize: "tiny" })
|
|
983
|
+
}
|
|
984
|
+
)), /* @__PURE__ */ React33.createElement(ControlContainer, { direction: "column" }, /* @__PURE__ */ React33.createElement(ControlLabel, null, __15("Right", "elementor")), /* @__PURE__ */ React33.createElement(
|
|
985
|
+
Control4,
|
|
986
|
+
{
|
|
987
|
+
bind: "right",
|
|
988
|
+
value: right,
|
|
989
|
+
setValue: setLinkedValue,
|
|
990
|
+
startIcon: /* @__PURE__ */ React33.createElement(SideRightIcon, { fontSize: "tiny" })
|
|
991
|
+
}
|
|
992
|
+
))), /* @__PURE__ */ React33.createElement(Stack8, { direction: "row", gap: 2 }, /* @__PURE__ */ React33.createElement(ControlContainer, { direction: "column" }, /* @__PURE__ */ React33.createElement(ControlLabel, null, __15("Bottom", "elementor")), /* @__PURE__ */ React33.createElement(
|
|
993
|
+
Control4,
|
|
994
|
+
{
|
|
995
|
+
bind: "bottom",
|
|
996
|
+
value: bottom,
|
|
997
|
+
setValue: setLinkedValue,
|
|
998
|
+
startIcon: /* @__PURE__ */ React33.createElement(SideBottomIcon, { fontSize: "tiny" })
|
|
999
|
+
}
|
|
1000
|
+
)), /* @__PURE__ */ React33.createElement(ControlContainer, { direction: "column" }, /* @__PURE__ */ React33.createElement(ControlLabel, null, __15("Left", "elementor")), /* @__PURE__ */ React33.createElement(
|
|
1001
|
+
Control4,
|
|
1002
|
+
{
|
|
1003
|
+
bind: "left",
|
|
1004
|
+
value: left,
|
|
1005
|
+
setValue: setLinkedValue,
|
|
1006
|
+
startIcon: /* @__PURE__ */ React33.createElement(SideLeftIcon, { fontSize: "tiny" })
|
|
1007
|
+
}
|
|
1008
|
+
))));
|
|
1009
|
+
};
|
|
1010
|
+
var Control4 = ({
|
|
1011
|
+
bind,
|
|
1012
|
+
startIcon,
|
|
1013
|
+
value,
|
|
1014
|
+
setValue
|
|
1015
|
+
}) => /* @__PURE__ */ React33.createElement(
|
|
1016
|
+
ControlContext.Provider,
|
|
1017
|
+
{
|
|
1018
|
+
value: {
|
|
1019
|
+
bind,
|
|
1020
|
+
setValue: (newValue) => setValue(bind, newValue),
|
|
1021
|
+
value
|
|
1022
|
+
}
|
|
1023
|
+
},
|
|
1024
|
+
/* @__PURE__ */ React33.createElement(SizeControl, { startIcon })
|
|
1025
|
+
);
|
|
1026
|
+
|
|
1027
|
+
// src/components/style-sections/spacing-section/spacing-section.tsx
|
|
1028
|
+
var SpacingSection = () => {
|
|
1029
|
+
return /* @__PURE__ */ React34.createElement(AccordionSection, { title: __16("Spacing", "elementor") }, /* @__PURE__ */ React34.createElement(Stack9, { gap: 1.5 }, /* @__PURE__ */ React34.createElement(StyleControl, { bind: "padding" }, /* @__PURE__ */ React34.createElement(LinkedDimensionsControl, { label: __16("Padding", "elementor") })), /* @__PURE__ */ React34.createElement(Divider2, null), /* @__PURE__ */ React34.createElement(StyleControl, { bind: "margin" }, /* @__PURE__ */ React34.createElement(LinkedDimensionsControl, { label: __16("Margin", "elementor") }))));
|
|
714
1030
|
};
|
|
715
1031
|
|
|
716
1032
|
// src/components/style-tab.tsx
|
|
1033
|
+
var CLASSES_PROP_KEY = "classes";
|
|
717
1034
|
var StyleTab = () => {
|
|
1035
|
+
const styleDefinition = useStyleDefinition();
|
|
1036
|
+
const classesProp = useClassesProp();
|
|
1037
|
+
return /* @__PURE__ */ React35.createElement(StyleContext, { selectedStyleDef: styleDefinition, selectedClassesProp: classesProp }, /* @__PURE__ */ React35.createElement(Stack10, null, /* @__PURE__ */ React35.createElement(SizeSection, null), /* @__PURE__ */ React35.createElement(PositionSection, null), /* @__PURE__ */ React35.createElement(TypographySection, null), /* @__PURE__ */ React35.createElement(SpacingSection, null)));
|
|
1038
|
+
};
|
|
1039
|
+
function useClassesProp() {
|
|
1040
|
+
const { elementType } = useElementContext();
|
|
1041
|
+
const prop = Object.entries(elementType.propsSchema).find(([, { type }]) => type.key === CLASSES_PROP_KEY);
|
|
1042
|
+
if (!prop) {
|
|
1043
|
+
throw new Error("Element does not have a classes prop");
|
|
1044
|
+
}
|
|
1045
|
+
return prop[0];
|
|
1046
|
+
}
|
|
1047
|
+
function useStyleDefinition() {
|
|
718
1048
|
const { element } = useElementContext();
|
|
719
1049
|
const elementStyles = useElementStyles(element.id);
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
};
|
|
1050
|
+
return Object.values(elementStyles || {})[0] ?? null;
|
|
1051
|
+
}
|
|
723
1052
|
|
|
724
1053
|
// src/components/editing-panel-tabs.tsx
|
|
725
1054
|
var EditingPanelTabs = () => {
|
|
726
1055
|
const { getTabProps, getTabPanelProps, getTabsProps } = useTabs("settings");
|
|
727
|
-
return /* @__PURE__ */
|
|
1056
|
+
return /* @__PURE__ */ React36.createElement(Stack11, { direction: "column", sx: { width: "100%" } }, /* @__PURE__ */ React36.createElement(Tabs, { variant: "fullWidth", indicatorColor: "secondary", textColor: "inherit", ...getTabsProps() }, /* @__PURE__ */ React36.createElement(Tab, { label: __17("General", "elementor"), ...getTabProps("settings") }), /* @__PURE__ */ React36.createElement(Tab, { label: __17("Style", "elementor"), ...getTabProps("style") })), /* @__PURE__ */ React36.createElement(TabPanel, { ...getTabPanelProps("settings"), disablePadding: true }, /* @__PURE__ */ React36.createElement(SettingsTab, null)), /* @__PURE__ */ React36.createElement(TabPanel, { ...getTabPanelProps("style"), disablePadding: true }, /* @__PURE__ */ React36.createElement(StyleTab, null)));
|
|
728
1057
|
};
|
|
729
1058
|
|
|
730
1059
|
// src/components/editing-panel.tsx
|
|
@@ -735,8 +1064,8 @@ var EditingPanel = () => {
|
|
|
735
1064
|
if (elements.length !== 1 || !elementType) {
|
|
736
1065
|
return null;
|
|
737
1066
|
}
|
|
738
|
-
const panelTitle =
|
|
739
|
-
return /* @__PURE__ */
|
|
1067
|
+
const panelTitle = __18("Edit %s", "elementor").replace("%s", elementType.title);
|
|
1068
|
+
return /* @__PURE__ */ React37.createElement(Panel, null, /* @__PURE__ */ React37.createElement(PanelHeader, null, /* @__PURE__ */ React37.createElement(PanelHeaderTitle, null, panelTitle)), /* @__PURE__ */ React37.createElement(PanelBody, null, /* @__PURE__ */ React37.createElement(ElementContext, { element: selectedElement, elementType }, /* @__PURE__ */ React37.createElement(EditingPanelTabs, null))));
|
|
740
1069
|
};
|
|
741
1070
|
|
|
742
1071
|
// src/panel.ts
|
|
@@ -781,13 +1110,342 @@ var EditingPanelHooks = () => {
|
|
|
781
1110
|
// src/init.ts
|
|
782
1111
|
import { __registerPanel as registerPanel } from "@elementor/editor-panels";
|
|
783
1112
|
import { __privateBlockDataCommand as blockDataCommand } from "@elementor/editor-v1-adapters";
|
|
784
|
-
|
|
1113
|
+
|
|
1114
|
+
// src/dynamics/components/dynamic-selection-control.tsx
|
|
1115
|
+
import * as React40 from "react";
|
|
1116
|
+
import { useId as useId3 } from "react";
|
|
1117
|
+
|
|
1118
|
+
// src/dynamics/dynamic-control.tsx
|
|
1119
|
+
import * as React38 from "react";
|
|
1120
|
+
|
|
1121
|
+
// src/dynamics/hooks/use-prop-dynamic-tags.ts
|
|
1122
|
+
import { useMemo } from "react";
|
|
1123
|
+
|
|
1124
|
+
// src/dynamics/sync/get-elementor-config.ts
|
|
1125
|
+
var getElementorConfig = () => {
|
|
1126
|
+
const extendedWindow = window;
|
|
1127
|
+
return extendedWindow.elementor?.config ?? {};
|
|
1128
|
+
};
|
|
1129
|
+
|
|
1130
|
+
// src/dynamics/sync/get-atomic-dynamic-tags.ts
|
|
1131
|
+
var getAtomicDynamicTags = () => {
|
|
1132
|
+
const { atomicDynamicTags } = getElementorConfig();
|
|
1133
|
+
if (!atomicDynamicTags) {
|
|
1134
|
+
return null;
|
|
1135
|
+
}
|
|
1136
|
+
return {
|
|
1137
|
+
tags: atomicDynamicTags.tags,
|
|
1138
|
+
groups: atomicDynamicTags.groups
|
|
1139
|
+
};
|
|
1140
|
+
};
|
|
1141
|
+
|
|
1142
|
+
// src/props/is-transformable.ts
|
|
1143
|
+
import { z } from "@elementor/schema";
|
|
1144
|
+
var transformableSchema = z.object({
|
|
1145
|
+
$$type: z.string(),
|
|
1146
|
+
value: z.any()
|
|
1147
|
+
});
|
|
1148
|
+
var isTransformable = (value) => {
|
|
1149
|
+
return transformableSchema.safeParse(value).success;
|
|
1150
|
+
};
|
|
1151
|
+
|
|
1152
|
+
// src/dynamics/utils.ts
|
|
1153
|
+
var isDynamicType = (prop) => prop.key === "dynamic";
|
|
1154
|
+
var isDynamicPropValue = (prop) => {
|
|
1155
|
+
return isTransformable(prop) && prop.$$type === "dynamic";
|
|
1156
|
+
};
|
|
1157
|
+
|
|
1158
|
+
// src/dynamics/hooks/use-prop-dynamic-tags.ts
|
|
1159
|
+
var usePropDynamicTags = (propName) => {
|
|
1160
|
+
let categories = [];
|
|
1161
|
+
const { elementType } = useElementContext();
|
|
1162
|
+
const propSchema = elementType.propsSchema?.[propName];
|
|
1163
|
+
if (propSchema) {
|
|
1164
|
+
const propDynamicType = propSchema.additional_types.find(isDynamicType);
|
|
1165
|
+
categories = propDynamicType?.settings.categories || [];
|
|
1166
|
+
}
|
|
1167
|
+
return useMemo(() => getDynamicTagsByCategories(categories), [categories.join()]);
|
|
1168
|
+
};
|
|
1169
|
+
var getDynamicTagsByCategories = (categories) => {
|
|
1170
|
+
const dynamicTags = getAtomicDynamicTags();
|
|
1171
|
+
if (!categories.length || !dynamicTags?.tags) {
|
|
1172
|
+
return [];
|
|
1173
|
+
}
|
|
1174
|
+
const _categories = new Set(categories);
|
|
1175
|
+
return Object.values(dynamicTags.tags).filter(
|
|
1176
|
+
(dynamicTag) => dynamicTag.categories.some((category) => _categories.has(category))
|
|
1177
|
+
);
|
|
1178
|
+
};
|
|
1179
|
+
|
|
1180
|
+
// src/dynamics/hooks/use-dynamic-tag.ts
|
|
1181
|
+
import { useMemo as useMemo2 } from "react";
|
|
1182
|
+
var useDynamicTag = (propName, tagName) => {
|
|
1183
|
+
const dynamicTags = usePropDynamicTags(propName);
|
|
1184
|
+
return useMemo2(() => dynamicTags.find((tag) => tag.name === tagName) ?? null, [dynamicTags, tagName]);
|
|
1185
|
+
};
|
|
1186
|
+
|
|
1187
|
+
// src/dynamics/dynamic-control.tsx
|
|
1188
|
+
var DynamicControl = ({ bind, children }) => {
|
|
1189
|
+
const { value, setValue, bind: propName } = useControl();
|
|
1190
|
+
const { name = "", settings } = value?.value ?? {};
|
|
1191
|
+
const dynamicTag = useDynamicTag(propName, name);
|
|
1192
|
+
if (!dynamicTag) {
|
|
1193
|
+
throw new Error(`Dynamic tag ${name} not found`);
|
|
1194
|
+
}
|
|
1195
|
+
const defaultValue = dynamicTag.props_schema[bind]?.type.default;
|
|
1196
|
+
const dynamicValue = settings?.[bind] ?? defaultValue;
|
|
1197
|
+
const setDynamicValue = (newValue) => {
|
|
1198
|
+
setValue({
|
|
1199
|
+
$$type: "dynamic",
|
|
1200
|
+
value: {
|
|
1201
|
+
name,
|
|
1202
|
+
settings: {
|
|
1203
|
+
...settings,
|
|
1204
|
+
[bind]: newValue
|
|
1205
|
+
}
|
|
1206
|
+
}
|
|
1207
|
+
});
|
|
1208
|
+
};
|
|
1209
|
+
return /* @__PURE__ */ React38.createElement(ControlContext.Provider, { value: { setValue: setDynamicValue, value: dynamicValue, bind } }, children);
|
|
1210
|
+
};
|
|
1211
|
+
|
|
1212
|
+
// src/dynamics/components/dynamic-selection-control.tsx
|
|
1213
|
+
import { DatabaseIcon, SettingsIcon, XIcon } from "@elementor/icons";
|
|
1214
|
+
|
|
1215
|
+
// src/dynamics/components/dynamic-selection.tsx
|
|
1216
|
+
import * as React39 from "react";
|
|
1217
|
+
import { useState as useState3, Fragment as Fragment2 } from "react";
|
|
1218
|
+
import { SearchIcon, PhotoIcon } from "@elementor/icons";
|
|
1219
|
+
import {
|
|
1220
|
+
Box,
|
|
1221
|
+
Divider as Divider3,
|
|
1222
|
+
InputAdornment as InputAdornment3,
|
|
1223
|
+
Link,
|
|
1224
|
+
ListSubheader,
|
|
1225
|
+
MenuItem as MenuItem3,
|
|
1226
|
+
MenuList,
|
|
1227
|
+
Stack as Stack12,
|
|
1228
|
+
TextField as TextField5,
|
|
1229
|
+
Typography as Typography2
|
|
1230
|
+
} from "@elementor/ui";
|
|
1231
|
+
import { __ as __19 } from "@wordpress/i18n";
|
|
1232
|
+
|
|
1233
|
+
// src/dynamics/hooks/use-prop-value-history.ts
|
|
1234
|
+
var PROPS_VALUES_HISTORY_KEY = "elementor/dynamic/non-dynamic-values-history";
|
|
1235
|
+
var usePropValueHistory = (path) => {
|
|
1236
|
+
const valuesHistory = getValues();
|
|
1237
|
+
const { element } = useElementContext();
|
|
1238
|
+
const key = `${element.id}-${path}`;
|
|
1239
|
+
const value = valuesHistory[key] ?? null;
|
|
1240
|
+
const setValue = (newValue) => {
|
|
1241
|
+
setValues({ ...valuesHistory, [key]: newValue });
|
|
1242
|
+
};
|
|
1243
|
+
return [value, setValue];
|
|
1244
|
+
};
|
|
1245
|
+
var getValues = () => {
|
|
1246
|
+
return JSON.parse(sessionStorage.getItem(PROPS_VALUES_HISTORY_KEY) || "{}");
|
|
1247
|
+
};
|
|
1248
|
+
var setValues = (values) => {
|
|
1249
|
+
sessionStorage.setItem(PROPS_VALUES_HISTORY_KEY, JSON.stringify(values));
|
|
1250
|
+
};
|
|
1251
|
+
|
|
1252
|
+
// src/dynamics/components/dynamic-selection.tsx
|
|
1253
|
+
var SIZE = "tiny";
|
|
1254
|
+
var DynamicSelection = ({ onSelect }) => {
|
|
1255
|
+
const [searchValue, setSearchValue] = useState3("");
|
|
1256
|
+
const { groups: dynamicGroups } = getAtomicDynamicTags() || {};
|
|
1257
|
+
const { bind, value: currentValue, setValue } = useControl();
|
|
1258
|
+
const [, updatePropValueHistory] = usePropValueHistory(bind);
|
|
1259
|
+
const isCurrentValueDynamic = isDynamicPropValue(currentValue);
|
|
1260
|
+
const options3 = useFilteredOptions(bind, searchValue);
|
|
1261
|
+
const handleSearch = (event) => {
|
|
1262
|
+
setSearchValue(event.target.value);
|
|
1263
|
+
};
|
|
1264
|
+
const handleSetDynamicTag = (value) => {
|
|
1265
|
+
if (!isCurrentValueDynamic) {
|
|
1266
|
+
updatePropValueHistory(currentValue);
|
|
1267
|
+
}
|
|
1268
|
+
setValue({ $$type: "dynamic", value: { name: value } });
|
|
1269
|
+
onSelect?.();
|
|
1270
|
+
};
|
|
1271
|
+
return /* @__PURE__ */ React39.createElement(Stack12, null, /* @__PURE__ */ React39.createElement(Box, { px: 1.5, pb: 1 }, /* @__PURE__ */ React39.createElement(
|
|
1272
|
+
TextField5,
|
|
1273
|
+
{
|
|
1274
|
+
fullWidth: true,
|
|
1275
|
+
size: SIZE,
|
|
1276
|
+
value: searchValue,
|
|
1277
|
+
onChange: handleSearch,
|
|
1278
|
+
placeholder: __19("Search dynamic tag", "elementor"),
|
|
1279
|
+
InputProps: {
|
|
1280
|
+
startAdornment: /* @__PURE__ */ React39.createElement(InputAdornment3, { position: "start" }, /* @__PURE__ */ React39.createElement(SearchIcon, { fontSize: SIZE }))
|
|
1281
|
+
}
|
|
1282
|
+
}
|
|
1283
|
+
)), /* @__PURE__ */ React39.createElement(Divider3, null), /* @__PURE__ */ React39.createElement(Box, { sx: { overflowY: "auto", height: 260, width: 220 } }, options3.length > 0 ? /* @__PURE__ */ React39.createElement(MenuList, { role: "listbox", tabIndex: 0 }, options3.map(([category, items], index) => /* @__PURE__ */ React39.createElement(Fragment2, { key: index }, /* @__PURE__ */ React39.createElement(ListSubheader, { sx: { typography: "caption", color: "text.tertiary" } }, dynamicGroups?.[category]?.title || category), items.map(({ value, label: tagLabel }) => {
|
|
1284
|
+
const isSelected = isCurrentValueDynamic && value === currentValue?.value?.name;
|
|
1285
|
+
return /* @__PURE__ */ React39.createElement(
|
|
1286
|
+
MenuItem3,
|
|
1287
|
+
{
|
|
1288
|
+
key: value,
|
|
1289
|
+
selected: isSelected,
|
|
1290
|
+
autoFocus: isSelected,
|
|
1291
|
+
sx: { typography: "caption" },
|
|
1292
|
+
onClick: () => handleSetDynamicTag(value)
|
|
1293
|
+
},
|
|
1294
|
+
tagLabel
|
|
1295
|
+
);
|
|
1296
|
+
})))) : /* @__PURE__ */ React39.createElement(Stack12, { alignItems: "center", p: 2.5, gap: 1.5 }, /* @__PURE__ */ React39.createElement(PhotoIcon, { fontSize: "large" }), /* @__PURE__ */ React39.createElement(Typography2, { align: "center", variant: "caption", color: "text.secondary" }, __19("Sorry, nothing matched", "elementor"), /* @__PURE__ */ React39.createElement("br", null), "\u201C", searchValue, "\u201D."), /* @__PURE__ */ React39.createElement(Typography2, { align: "center", variant: "caption", color: "text.secondary" }, /* @__PURE__ */ React39.createElement(
|
|
1297
|
+
Link,
|
|
1298
|
+
{
|
|
1299
|
+
color: "secondary",
|
|
1300
|
+
variant: "caption",
|
|
1301
|
+
component: "button",
|
|
1302
|
+
onClick: () => setSearchValue("")
|
|
1303
|
+
},
|
|
1304
|
+
__19("Clear the filters", "elementor")
|
|
1305
|
+
), "\xA0", __19("and try again.", "elementor")))));
|
|
1306
|
+
};
|
|
1307
|
+
var useFilteredOptions = (bind, searchValue) => {
|
|
1308
|
+
const dynamicTags = usePropDynamicTags(bind);
|
|
1309
|
+
const options3 = dynamicTags.reduce((categories, { name, label, group }) => {
|
|
1310
|
+
const isVisible = label.toLowerCase().includes(searchValue.trim().toLowerCase());
|
|
1311
|
+
if (!isVisible) {
|
|
1312
|
+
return categories;
|
|
1313
|
+
}
|
|
1314
|
+
if (!categories.has(group)) {
|
|
1315
|
+
categories.set(group, []);
|
|
1316
|
+
}
|
|
1317
|
+
categories.get(group)?.push({ label, value: name });
|
|
1318
|
+
return categories;
|
|
1319
|
+
}, /* @__PURE__ */ new Map());
|
|
1320
|
+
return [...options3];
|
|
1321
|
+
};
|
|
1322
|
+
|
|
1323
|
+
// src/dynamics/components/dynamic-selection-control.tsx
|
|
1324
|
+
import {
|
|
1325
|
+
bindPopover,
|
|
1326
|
+
bindTrigger as bindTrigger2,
|
|
1327
|
+
Box as Box2,
|
|
1328
|
+
IconButton,
|
|
1329
|
+
Paper,
|
|
1330
|
+
Popover,
|
|
1331
|
+
Stack as Stack13,
|
|
1332
|
+
Typography as Typography3,
|
|
1333
|
+
UnstableTag as Tag,
|
|
1334
|
+
usePopupState as usePopupState2,
|
|
1335
|
+
Tabs as Tabs2,
|
|
1336
|
+
Divider as Divider4,
|
|
1337
|
+
useTabs as useTabs2,
|
|
1338
|
+
Tab as Tab2,
|
|
1339
|
+
TabPanel as TabPanel2
|
|
1340
|
+
} from "@elementor/ui";
|
|
1341
|
+
import { __ as __20 } from "@wordpress/i18n";
|
|
1342
|
+
var SIZE2 = "tiny";
|
|
1343
|
+
var DynamicSelectionControl = () => {
|
|
1344
|
+
const { bind, value, setValue } = useControl();
|
|
1345
|
+
const [propValueFromHistory] = usePropValueHistory(bind);
|
|
1346
|
+
const { name: tagName = "" } = value?.value || {};
|
|
1347
|
+
const selectionPopoverId = useId3();
|
|
1348
|
+
const selectionPopoverState = usePopupState2({ variant: "popover", popupId: selectionPopoverId });
|
|
1349
|
+
const dynamicTag = useDynamicTag(bind, tagName);
|
|
1350
|
+
const removeDynamicTag = () => {
|
|
1351
|
+
setValue(propValueFromHistory ?? null);
|
|
1352
|
+
};
|
|
1353
|
+
if (!dynamicTag) {
|
|
1354
|
+
throw new Error(`Dynamic tag ${tagName} not found`);
|
|
1355
|
+
}
|
|
1356
|
+
return /* @__PURE__ */ React40.createElement(Box2, { sx: { width: "100%" } }, /* @__PURE__ */ React40.createElement(
|
|
1357
|
+
Tag,
|
|
1358
|
+
{
|
|
1359
|
+
fullWidth: true,
|
|
1360
|
+
showActionsOnHover: true,
|
|
1361
|
+
label: dynamicTag.label,
|
|
1362
|
+
startIcon: /* @__PURE__ */ React40.createElement(DatabaseIcon, { fontSize: SIZE2 }),
|
|
1363
|
+
...bindTrigger2(selectionPopoverState),
|
|
1364
|
+
actions: /* @__PURE__ */ React40.createElement(React40.Fragment, null, /* @__PURE__ */ React40.createElement(DynamicSettingsPopover, { dynamicTag }), /* @__PURE__ */ React40.createElement(
|
|
1365
|
+
IconButton,
|
|
1366
|
+
{
|
|
1367
|
+
size: SIZE2,
|
|
1368
|
+
onClick: removeDynamicTag,
|
|
1369
|
+
"aria-label": __20("Remove dynamic value", "elementor")
|
|
1370
|
+
},
|
|
1371
|
+
/* @__PURE__ */ React40.createElement(XIcon, { fontSize: SIZE2 })
|
|
1372
|
+
))
|
|
1373
|
+
}
|
|
1374
|
+
), /* @__PURE__ */ React40.createElement(
|
|
1375
|
+
Popover,
|
|
1376
|
+
{
|
|
1377
|
+
disablePortal: true,
|
|
1378
|
+
disableScrollLock: true,
|
|
1379
|
+
anchorOrigin: { vertical: "bottom", horizontal: "left" },
|
|
1380
|
+
...bindPopover(selectionPopoverState)
|
|
1381
|
+
},
|
|
1382
|
+
/* @__PURE__ */ React40.createElement(Stack13, null, /* @__PURE__ */ React40.createElement(Stack13, { direction: "row", alignItems: "center", pl: 1.5, pr: 0.5, py: 1.5 }, /* @__PURE__ */ React40.createElement(DatabaseIcon, { fontSize: SIZE2, sx: { mr: 0.5 } }), /* @__PURE__ */ React40.createElement(Typography3, { variant: "subtitle2" }, __20("Dynamic Tags", "elementor")), /* @__PURE__ */ React40.createElement(IconButton, { size: SIZE2, sx: { ml: "auto" }, onClick: selectionPopoverState.close }, /* @__PURE__ */ React40.createElement(XIcon, { fontSize: SIZE2 }))), /* @__PURE__ */ React40.createElement(DynamicSelection, { onSelect: selectionPopoverState.close }))
|
|
1383
|
+
));
|
|
1384
|
+
};
|
|
1385
|
+
var DynamicSettingsPopover = ({ dynamicTag }) => {
|
|
1386
|
+
const popupId = useId3();
|
|
1387
|
+
const settingsPopupState = usePopupState2({ variant: "popover", popupId });
|
|
1388
|
+
const hasDynamicSettings = !!dynamicTag.atomic_controls.length;
|
|
1389
|
+
if (!hasDynamicSettings) {
|
|
1390
|
+
return null;
|
|
1391
|
+
}
|
|
1392
|
+
return /* @__PURE__ */ React40.createElement(React40.Fragment, null, /* @__PURE__ */ React40.createElement(
|
|
1393
|
+
IconButton,
|
|
1394
|
+
{
|
|
1395
|
+
size: SIZE2,
|
|
1396
|
+
...bindTrigger2(settingsPopupState),
|
|
1397
|
+
"aria-label": __20("Settings", "elementor")
|
|
1398
|
+
},
|
|
1399
|
+
/* @__PURE__ */ React40.createElement(SettingsIcon, { fontSize: SIZE2 })
|
|
1400
|
+
), /* @__PURE__ */ React40.createElement(
|
|
1401
|
+
Popover,
|
|
1402
|
+
{
|
|
1403
|
+
disableScrollLock: true,
|
|
1404
|
+
anchorOrigin: { vertical: "bottom", horizontal: "center" },
|
|
1405
|
+
...bindPopover(settingsPopupState)
|
|
1406
|
+
},
|
|
1407
|
+
/* @__PURE__ */ React40.createElement(Paper, { component: Stack13, sx: { minHeight: "300px", width: "220px" } }, /* @__PURE__ */ React40.createElement(Stack13, { direction: "row", alignItems: "center", px: 1.5, pt: 2, pb: 1 }, /* @__PURE__ */ React40.createElement(DatabaseIcon, { fontSize: SIZE2, sx: { mr: 0.5 } }), /* @__PURE__ */ React40.createElement(Typography3, { variant: "subtitle2" }, dynamicTag.label), /* @__PURE__ */ React40.createElement(IconButton, { sx: { ml: "auto" }, size: SIZE2, onClick: settingsPopupState.close }, /* @__PURE__ */ React40.createElement(XIcon, { fontSize: SIZE2 }))), /* @__PURE__ */ React40.createElement(DynamicSettings, { controls: dynamicTag.atomic_controls }))
|
|
1408
|
+
));
|
|
1409
|
+
};
|
|
1410
|
+
var DynamicSettings = ({ controls }) => {
|
|
1411
|
+
const tabs = controls.filter(({ type }) => type === "section");
|
|
1412
|
+
const { getTabsProps, getTabProps, getTabPanelProps } = useTabs2(0);
|
|
1413
|
+
if (!tabs.length) {
|
|
1414
|
+
return null;
|
|
1415
|
+
}
|
|
1416
|
+
return /* @__PURE__ */ React40.createElement(React40.Fragment, null, /* @__PURE__ */ React40.createElement(Tabs2, { indicatorColor: "secondary", textColor: "secondary", ...getTabsProps() }, tabs.map(({ value }, index) => /* @__PURE__ */ React40.createElement(Tab2, { key: index, label: value.label, sx: { px: 1, py: 0.5 }, ...getTabProps(index) }))), /* @__PURE__ */ React40.createElement(Divider4, null), tabs.map(({ value }, index) => {
|
|
1417
|
+
return /* @__PURE__ */ React40.createElement(TabPanel2, { key: index, sx: { flexGrow: 1 }, ...getTabPanelProps(index) }, /* @__PURE__ */ React40.createElement(Stack13, { gap: 1, px: 2 }, value.items.map((item) => {
|
|
1418
|
+
if (item.type === "control") {
|
|
1419
|
+
return /* @__PURE__ */ React40.createElement(Control5, { key: item.value.bind, control: item.value });
|
|
1420
|
+
}
|
|
1421
|
+
return null;
|
|
1422
|
+
})));
|
|
1423
|
+
}));
|
|
1424
|
+
};
|
|
1425
|
+
var Control5 = ({ control }) => {
|
|
1426
|
+
if (!getControlByType(control.type)) {
|
|
1427
|
+
return null;
|
|
1428
|
+
}
|
|
1429
|
+
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 }));
|
|
1430
|
+
};
|
|
1431
|
+
|
|
1432
|
+
// src/dynamics/init.ts
|
|
1433
|
+
var init = () => {
|
|
1434
|
+
replaceControl({
|
|
1435
|
+
component: DynamicSelectionControl,
|
|
1436
|
+
condition: ({ value }) => isDynamicPropValue(value)
|
|
1437
|
+
});
|
|
1438
|
+
};
|
|
1439
|
+
|
|
1440
|
+
// src/init.ts
|
|
1441
|
+
function init2() {
|
|
785
1442
|
registerPanel(panel);
|
|
786
1443
|
blockV1Panel();
|
|
787
1444
|
injectIntoLogic({
|
|
788
1445
|
id: "editing-panel-hooks",
|
|
789
1446
|
component: EditingPanelHooks
|
|
790
1447
|
});
|
|
1448
|
+
init();
|
|
791
1449
|
}
|
|
792
1450
|
var blockV1Panel = () => {
|
|
793
1451
|
blockDataCommand({
|
|
@@ -797,7 +1455,7 @@ var blockV1Panel = () => {
|
|
|
797
1455
|
};
|
|
798
1456
|
|
|
799
1457
|
// src/index.ts
|
|
800
|
-
|
|
1458
|
+
init2();
|
|
801
1459
|
export {
|
|
802
1460
|
replaceControl,
|
|
803
1461
|
useControl
|