@elementor/editor-editing-panel 1.24.0 → 1.28.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 +102 -0
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +448 -309
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +426 -287
- package/dist/index.mjs.map +1 -1
- package/package.json +11 -10
- package/src/components/css-classes/css-class-item.tsx +8 -10
- package/src/components/css-classes/css-class-menu.tsx +60 -12
- package/src/components/css-classes/css-class-selector.tsx +28 -27
- package/src/components/editing-panel-tabs.tsx +1 -8
- package/src/components/multi-combobox.tsx +3 -0
- package/src/components/style-indicator.tsx +23 -0
- package/src/components/style-sections/border-section/border-radius-field.tsx +4 -5
- package/src/components/style-sections/border-section/border-width-field.tsx +2 -3
- package/src/components/style-sections/layout-section/display-field.tsx +34 -28
- package/src/components/style-sections/layout-section/flex-size-field.tsx +28 -18
- package/src/components/style-sections/layout-section/layout-section.tsx +14 -2
- package/src/components/style-sections/typography-section/text-alignment-field.tsx +5 -6
- package/src/components/style-tab.tsx +2 -19
- package/src/contexts/style-context.tsx +2 -2
- package/src/controls-registry/control-type-container.tsx +2 -2
- package/src/controls-registry/styles-field.tsx +9 -2
- package/src/dynamics/dynamic-transformer.ts +61 -0
- package/src/dynamics/errors.ts +6 -0
- package/src/dynamics/init.ts +6 -0
- package/src/dynamics/types.ts +17 -0
- package/src/hooks/use-active-style-def-id.ts +36 -0
- package/src/hooks/use-styles-fields.ts +7 -7
- package/src/index.ts +1 -3
- package/src/init.ts +1 -1
- package/src/styles-inheritance/create-snapshots-manager.ts +16 -9
- package/src/styles-inheritance/create-styles-inheritance.ts +8 -4
- package/src/styles-inheritance/styles-inheritance-indicator.tsx +13 -31
- package/src/styles-inheritance/types.ts +7 -6
package/dist/index.mjs
CHANGED
|
@@ -10,14 +10,15 @@ import * as React7 from "react";
|
|
|
10
10
|
import { getElementSetting, updateElementSettings as updateElementSettings2, useElementSetting as useElementSetting2 } from "@elementor/editor-elements";
|
|
11
11
|
import { classesPropTypeUtil } from "@elementor/editor-props";
|
|
12
12
|
import {
|
|
13
|
-
|
|
13
|
+
isElementsStylesProvider as isElementsStylesProvider2,
|
|
14
14
|
stylesRepository as stylesRepository4,
|
|
15
15
|
useCreateActionsByProvider,
|
|
16
|
-
useProviders
|
|
16
|
+
useProviders,
|
|
17
|
+
validateStyleLabel as validateStyleLabel2
|
|
17
18
|
} from "@elementor/editor-styles-repository";
|
|
18
19
|
import { MapPinIcon } from "@elementor/icons";
|
|
19
20
|
import { createLocation } from "@elementor/locations";
|
|
20
|
-
import { Chip as Chip2,
|
|
21
|
+
import { Chip as Chip2, FormLabel, Stack as Stack3 } from "@elementor/ui";
|
|
21
22
|
import { __ as __3 } from "@wordpress/i18n";
|
|
22
23
|
|
|
23
24
|
// src/contexts/classes-prop-context.tsx
|
|
@@ -92,7 +93,7 @@ function useStyle() {
|
|
|
92
93
|
}
|
|
93
94
|
function getProviderByStyleId(styleId) {
|
|
94
95
|
const styleProvider = stylesRepository.getProviders().find((provider) => {
|
|
95
|
-
return provider.actions.
|
|
96
|
+
return provider.actions.all().find((style) => style.id === styleId);
|
|
96
97
|
});
|
|
97
98
|
return styleProvider ?? null;
|
|
98
99
|
}
|
|
@@ -112,6 +113,7 @@ function MultiCombobox({
|
|
|
112
113
|
selected,
|
|
113
114
|
options: options13,
|
|
114
115
|
onSelect,
|
|
116
|
+
placeholder,
|
|
115
117
|
...props
|
|
116
118
|
}) {
|
|
117
119
|
const filter = useFilterOptions();
|
|
@@ -134,6 +136,7 @@ function MultiCombobox({
|
|
|
134
136
|
TextField,
|
|
135
137
|
{
|
|
136
138
|
...params,
|
|
139
|
+
placeholder,
|
|
137
140
|
sx: (theme) => ({
|
|
138
141
|
".MuiAutocomplete-inputRoot.MuiInputBase-adornedStart": {
|
|
139
142
|
paddingLeft: theme.spacing(0.25),
|
|
@@ -230,13 +233,13 @@ function isAction(option) {
|
|
|
230
233
|
// src/components/css-classes/css-class-item.tsx
|
|
231
234
|
import * as React6 from "react";
|
|
232
235
|
import { useState as useState2 } from "react";
|
|
233
|
-
import { stylesRepository as stylesRepository3 } from "@elementor/editor-styles-repository";
|
|
236
|
+
import { stylesRepository as stylesRepository3, validateStyleLabel } from "@elementor/editor-styles-repository";
|
|
234
237
|
import { EditableField, EllipsisWithTooltip, useEditable } from "@elementor/editor-ui";
|
|
235
238
|
import { DotsVerticalIcon } from "@elementor/icons";
|
|
236
239
|
import {
|
|
237
240
|
bindTrigger,
|
|
238
241
|
Chip,
|
|
239
|
-
Stack,
|
|
242
|
+
Stack as Stack2,
|
|
240
243
|
Typography,
|
|
241
244
|
UnstableChipGroup,
|
|
242
245
|
usePopupState
|
|
@@ -245,9 +248,9 @@ import { __ as __2 } from "@wordpress/i18n";
|
|
|
245
248
|
|
|
246
249
|
// src/components/css-classes/css-class-menu.tsx
|
|
247
250
|
import * as React5 from "react";
|
|
248
|
-
import { stylesRepository as stylesRepository2 } from "@elementor/editor-styles-repository";
|
|
251
|
+
import { isElementsStylesProvider, stylesRepository as stylesRepository2 } from "@elementor/editor-styles-repository";
|
|
249
252
|
import { MenuListItem } from "@elementor/editor-ui";
|
|
250
|
-
import { bindMenu, Divider, Menu, MenuSubheader } from "@elementor/ui";
|
|
253
|
+
import { bindMenu, Divider, Menu, MenuSubheader, Stack } from "@elementor/ui";
|
|
251
254
|
import { __ } from "@wordpress/i18n";
|
|
252
255
|
|
|
253
256
|
// src/hooks/use-unapply-class.ts
|
|
@@ -272,16 +275,40 @@ var useUnapplyClass = (classId) => {
|
|
|
272
275
|
};
|
|
273
276
|
};
|
|
274
277
|
|
|
278
|
+
// src/components/style-indicator.tsx
|
|
279
|
+
import { styled as styled2 } from "@elementor/ui";
|
|
280
|
+
var StyleIndicator = styled2("div", {
|
|
281
|
+
shouldForwardProp: (prop) => prop !== "variant"
|
|
282
|
+
})`
|
|
283
|
+
width: 5px;
|
|
284
|
+
height: 5px;
|
|
285
|
+
border-radius: 50%;
|
|
286
|
+
background-color: ${({ theme, variant }) => {
|
|
287
|
+
switch (variant) {
|
|
288
|
+
case "overridden":
|
|
289
|
+
return theme.palette.warning.light;
|
|
290
|
+
case "global":
|
|
291
|
+
return theme.palette.global.dark;
|
|
292
|
+
case "local":
|
|
293
|
+
return theme.palette.accent.main;
|
|
294
|
+
default:
|
|
295
|
+
return theme.palette.text.disabled;
|
|
296
|
+
}
|
|
297
|
+
}};
|
|
298
|
+
`;
|
|
299
|
+
|
|
275
300
|
// src/components/css-classes/css-class-menu.tsx
|
|
276
301
|
var STATES = ["hover", "focus", "active"];
|
|
277
302
|
function CssClassMenu({ styleId, provider, popupState, handleRename, anchorEl }) {
|
|
303
|
+
const styledStates = useStyledStates(styleId);
|
|
304
|
+
const indicatorVariant = !provider || isElementsStylesProvider(provider) ? "local" : "global";
|
|
278
305
|
const handleKeyDown = (e) => {
|
|
279
306
|
e.stopPropagation();
|
|
280
307
|
};
|
|
281
308
|
return /* @__PURE__ */ React5.createElement(
|
|
282
309
|
Menu,
|
|
283
310
|
{
|
|
284
|
-
MenuListProps: { dense: true },
|
|
311
|
+
MenuListProps: { dense: true, sx: { minWidth: "160px" } },
|
|
285
312
|
...bindMenu(popupState),
|
|
286
313
|
anchorEl,
|
|
287
314
|
anchorOrigin: {
|
|
@@ -292,23 +319,51 @@ function CssClassMenu({ styleId, provider, popupState, handleRename, anchorEl })
|
|
|
292
319
|
horizontal: "left",
|
|
293
320
|
vertical: -4
|
|
294
321
|
},
|
|
295
|
-
onKeyDown: handleKeyDown
|
|
322
|
+
onKeyDown: handleKeyDown,
|
|
323
|
+
disableAutoFocusItem: true
|
|
296
324
|
},
|
|
297
325
|
getMenuItemsByProvider({ provider, styleId, handleRename, closeMenu: popupState.close }),
|
|
298
|
-
/* @__PURE__ */ React5.createElement(MenuSubheader, { sx: { typography: "caption", color: "text.secondary", pb: 0.5, pt: 1 } }, __("
|
|
299
|
-
/* @__PURE__ */ React5.createElement(
|
|
326
|
+
/* @__PURE__ */ React5.createElement(MenuSubheader, { sx: { typography: "caption", color: "text.secondary", pb: 0.5, pt: 1 } }, __("States", "elementor")),
|
|
327
|
+
/* @__PURE__ */ React5.createElement(
|
|
328
|
+
StateMenuItem,
|
|
329
|
+
{
|
|
330
|
+
key: "normal",
|
|
331
|
+
state: null,
|
|
332
|
+
styleId,
|
|
333
|
+
closeMenu: popupState.close,
|
|
334
|
+
isStyled: styledStates.normal,
|
|
335
|
+
indicatorVariant
|
|
336
|
+
}
|
|
337
|
+
),
|
|
300
338
|
STATES.map((state) => {
|
|
301
|
-
return /* @__PURE__ */ React5.createElement(
|
|
339
|
+
return /* @__PURE__ */ React5.createElement(
|
|
340
|
+
StateMenuItem,
|
|
341
|
+
{
|
|
342
|
+
key: state,
|
|
343
|
+
state,
|
|
344
|
+
styleId,
|
|
345
|
+
closeMenu: popupState.close,
|
|
346
|
+
isStyled: styledStates[state],
|
|
347
|
+
indicatorVariant
|
|
348
|
+
}
|
|
349
|
+
);
|
|
302
350
|
})
|
|
303
351
|
);
|
|
304
352
|
}
|
|
353
|
+
function useStyledStates(styleId) {
|
|
354
|
+
const { meta } = useStyle();
|
|
355
|
+
const styleDef = stylesRepository2.all().find((style) => style.id === styleId);
|
|
356
|
+
return Object.fromEntries(
|
|
357
|
+
styleDef?.variants.filter((variant) => meta.breakpoint === variant.meta.breakpoint).map((variant) => [variant.meta.state ?? "normal", true]) ?? []
|
|
358
|
+
);
|
|
359
|
+
}
|
|
305
360
|
function getMenuItemsByProvider({
|
|
306
361
|
provider,
|
|
307
362
|
styleId,
|
|
308
363
|
handleRename,
|
|
309
364
|
closeMenu
|
|
310
365
|
}) {
|
|
311
|
-
if (!styleId) {
|
|
366
|
+
if (!styleId || !provider) {
|
|
312
367
|
return [];
|
|
313
368
|
}
|
|
314
369
|
const providerInstance = stylesRepository2.getProviderByKey(provider);
|
|
@@ -324,7 +379,7 @@ function getMenuItemsByProvider({
|
|
|
324
379
|
MenuSubheader,
|
|
325
380
|
{
|
|
326
381
|
key: "provider-label",
|
|
327
|
-
sx: { typography: "caption", color: "text.secondary", pb: 0.5, pt: 1 }
|
|
382
|
+
sx: { typography: "caption", color: "text.secondary", pb: 0.5, pt: 1, textTransform: "capitalize" }
|
|
328
383
|
},
|
|
329
384
|
providerInstance?.labels?.singular
|
|
330
385
|
)
|
|
@@ -333,7 +388,14 @@ function getMenuItemsByProvider({
|
|
|
333
388
|
}
|
|
334
389
|
return actions;
|
|
335
390
|
}
|
|
336
|
-
function StateMenuItem({
|
|
391
|
+
function StateMenuItem({
|
|
392
|
+
state,
|
|
393
|
+
styleId,
|
|
394
|
+
closeMenu,
|
|
395
|
+
isStyled = false,
|
|
396
|
+
indicatorVariant,
|
|
397
|
+
...props
|
|
398
|
+
}) {
|
|
337
399
|
const { id: activeId, setId: setActiveId, setMetaState: setActiveMetaState, meta } = useStyle();
|
|
338
400
|
const { state: activeState } = meta;
|
|
339
401
|
const isActive = styleId === activeId;
|
|
@@ -352,7 +414,7 @@ function StateMenuItem({ state, styleId, closeMenu, ...props }) {
|
|
|
352
414
|
closeMenu();
|
|
353
415
|
}
|
|
354
416
|
},
|
|
355
|
-
|
|
417
|
+
/* @__PURE__ */ React5.createElement(Stack, { gap: 0.75, direction: "row", alignItems: "center" }, isStyled && /* @__PURE__ */ React5.createElement(StyleIndicator, { "aria-label": __("Has style", "elementor"), variant: indicatorVariant }), state ?? "normal")
|
|
356
418
|
);
|
|
357
419
|
}
|
|
358
420
|
function UnapplyClassMenuItem({ styleId, closeMenu, ...props }) {
|
|
@@ -391,8 +453,8 @@ function RenameClassMenuItem({
|
|
|
391
453
|
var CHIP_SIZE = "tiny";
|
|
392
454
|
function CssClassItem({
|
|
393
455
|
id,
|
|
394
|
-
label,
|
|
395
456
|
provider,
|
|
457
|
+
label,
|
|
396
458
|
isActive,
|
|
397
459
|
color: colorProp,
|
|
398
460
|
icon,
|
|
@@ -416,7 +478,7 @@ function CssClassItem({
|
|
|
416
478
|
validation: validateLabel
|
|
417
479
|
});
|
|
418
480
|
const color = error ? "error" : colorProp;
|
|
419
|
-
const providerActions = stylesRepository3.getProviderByKey(provider)?.actions;
|
|
481
|
+
const providerActions = provider ? stylesRepository3.getProviderByKey(provider)?.actions : null;
|
|
420
482
|
const allowRename = Boolean(providerActions?.update);
|
|
421
483
|
const isShowingState = isActive && meta.state;
|
|
422
484
|
return /* @__PURE__ */ React6.createElement(React6.Fragment, null, /* @__PURE__ */ React6.createElement(
|
|
@@ -465,7 +527,7 @@ function CssClassItem({
|
|
|
465
527
|
{
|
|
466
528
|
icon: isShowingState ? void 0 : /* @__PURE__ */ React6.createElement(DotsVerticalIcon, { fontSize: "tiny" }),
|
|
467
529
|
size: CHIP_SIZE,
|
|
468
|
-
label: isShowingState ? /* @__PURE__ */ React6.createElement(
|
|
530
|
+
label: isShowingState ? /* @__PURE__ */ React6.createElement(Stack2, { direction: "row", gap: 0.5, alignItems: "center" }, /* @__PURE__ */ React6.createElement(Typography, { variant: "inherit" }, meta.state), /* @__PURE__ */ React6.createElement(DotsVerticalIcon, { fontSize: "tiny" })) : void 0,
|
|
469
531
|
variant: "filled",
|
|
470
532
|
shape: "rounded",
|
|
471
533
|
color,
|
|
@@ -491,13 +553,11 @@ function CssClassItem({
|
|
|
491
553
|
));
|
|
492
554
|
}
|
|
493
555
|
var validateLabel = (newLabel) => {
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
if (stylesRepository3.isLabelExist(newLabel)) {
|
|
498
|
-
return __2("Existing name", "elementor");
|
|
556
|
+
const result = validateStyleLabel(newLabel);
|
|
557
|
+
if (result.isValid) {
|
|
558
|
+
return null;
|
|
499
559
|
}
|
|
500
|
-
return
|
|
560
|
+
return result.error;
|
|
501
561
|
};
|
|
502
562
|
|
|
503
563
|
// src/components/css-classes/css-class-selector.tsx
|
|
@@ -509,7 +569,7 @@ var EMPTY_OPTION = {
|
|
|
509
569
|
fixed: true,
|
|
510
570
|
color: "accent",
|
|
511
571
|
icon: /* @__PURE__ */ React7.createElement(MapPinIcon, null),
|
|
512
|
-
provider:
|
|
572
|
+
provider: null
|
|
513
573
|
};
|
|
514
574
|
var { Slot: ClassSelectorActionsSlot, inject: injectIntoClassSelectorActions } = createLocation();
|
|
515
575
|
function CssClassSelector() {
|
|
@@ -520,11 +580,13 @@ function CssClassSelector() {
|
|
|
520
580
|
const handleApply = useHandleApply(appliedIds, setAppliedIds);
|
|
521
581
|
const applied = useAppliedOptions(options13, appliedIds);
|
|
522
582
|
const active = applied.find((option) => option.value === activeId) ?? EMPTY_OPTION;
|
|
523
|
-
|
|
583
|
+
const showPlaceholder = applied.every(({ fixed }) => fixed);
|
|
584
|
+
return /* @__PURE__ */ React7.createElement(Stack3, { p: 2 }, /* @__PURE__ */ React7.createElement(Stack3, { direction: "row", gap: 1, alignItems: "center", justifyContent: "space-between" }, /* @__PURE__ */ React7.createElement(FormLabel, { htmlFor: ID, size: "small" }, __3("Classes", "elementor")), /* @__PURE__ */ React7.createElement(Stack3, { direction: "row", gap: 1 }, /* @__PURE__ */ React7.createElement(ClassSelectorActionsSlot, null))), /* @__PURE__ */ React7.createElement(
|
|
524
585
|
MultiCombobox,
|
|
525
586
|
{
|
|
526
587
|
id: ID,
|
|
527
588
|
size: "tiny",
|
|
589
|
+
placeholder: showPlaceholder ? __3("Type to search/add global classes", "elementor") : void 0,
|
|
528
590
|
options: options13,
|
|
529
591
|
selected: applied,
|
|
530
592
|
onSelect: handleApply,
|
|
@@ -560,6 +622,9 @@ function CssClassSelector() {
|
|
|
560
622
|
));
|
|
561
623
|
}
|
|
562
624
|
var updateClassByProvider = (provider, data) => {
|
|
625
|
+
if (!provider) {
|
|
626
|
+
return;
|
|
627
|
+
}
|
|
563
628
|
const providerInstance = stylesRepository4.getProviderByKey(provider);
|
|
564
629
|
if (!providerInstance) {
|
|
565
630
|
return;
|
|
@@ -570,8 +635,8 @@ function useOptions() {
|
|
|
570
635
|
const { element } = useElement();
|
|
571
636
|
const isProviderEditable = (provider) => !!provider.actions.updateProps;
|
|
572
637
|
return useProviders().filter(isProviderEditable).flatMap((provider) => {
|
|
573
|
-
const isElements = provider.
|
|
574
|
-
const styleDefs = provider.actions.
|
|
638
|
+
const isElements = isElementsStylesProvider2(provider.getKey());
|
|
639
|
+
const styleDefs = provider.actions.all({ elementId: element.id });
|
|
575
640
|
if (isElements && styleDefs.length === 0) {
|
|
576
641
|
return [EMPTY_OPTION];
|
|
577
642
|
}
|
|
@@ -582,8 +647,9 @@ function useOptions() {
|
|
|
582
647
|
fixed: isElements,
|
|
583
648
|
color: isElements ? "accent" : "global",
|
|
584
649
|
icon: isElements ? /* @__PURE__ */ React7.createElement(MapPinIcon, null) : null,
|
|
585
|
-
provider: provider.
|
|
586
|
-
|
|
650
|
+
provider: provider.getKey(),
|
|
651
|
+
// translators: %s is the plural label of the provider (e.g "Existing classes").
|
|
652
|
+
group: __3("Existing %s", "elementor").replace("%s", provider.labels?.plural ?? "")
|
|
587
653
|
};
|
|
588
654
|
});
|
|
589
655
|
});
|
|
@@ -595,10 +661,10 @@ function useCreateActions({
|
|
|
595
661
|
return useCreateActionsByProvider().map(([provider, create]) => {
|
|
596
662
|
return {
|
|
597
663
|
// translators: %s is the label of the new class.
|
|
598
|
-
label: (value) => __3('Create
|
|
599
|
-
// translators: %s is the singular label of css class provider (e.g "
|
|
600
|
-
group: __3("Create
|
|
601
|
-
condition: (_, inputValue) =>
|
|
664
|
+
label: (value) => __3('Create "%s"', "elementor").replace("%s", value),
|
|
665
|
+
// translators: %s is the singular label of css class provider (e.g "CSS Class").
|
|
666
|
+
group: __3("Create a new %s", "elementor").replace("%s", provider.labels?.singular ?? ""),
|
|
667
|
+
condition: (_, inputValue) => validateStyleLabel2(inputValue).isValid && !hasReachedLimit(provider),
|
|
602
668
|
apply: (label) => {
|
|
603
669
|
const createdId = create(label);
|
|
604
670
|
if (!createdId) {
|
|
@@ -611,18 +677,12 @@ function useCreateActions({
|
|
|
611
677
|
});
|
|
612
678
|
}
|
|
613
679
|
function hasReachedLimit(provider) {
|
|
614
|
-
|
|
615
|
-
return false;
|
|
616
|
-
}
|
|
617
|
-
return provider.actions.get().length >= provider.limit;
|
|
618
|
-
}
|
|
619
|
-
function isLabelValid(newLabel) {
|
|
620
|
-
return stylesRepository4.isLabelValid(newLabel) && !stylesRepository4.isLabelExist(newLabel);
|
|
680
|
+
return provider.actions.all().length >= provider.limit;
|
|
621
681
|
}
|
|
622
682
|
function useAppliedOptions(options13, appliedIds) {
|
|
623
683
|
const applied = options13.filter((option) => option.value && appliedIds.includes(option.value));
|
|
624
684
|
const hasElementsProviderStyleApplied = applied.some(
|
|
625
|
-
(option) => option.provider
|
|
685
|
+
(option) => option.provider && isElementsStylesProvider2(option.provider)
|
|
626
686
|
);
|
|
627
687
|
if (!hasElementsProviderStyleApplied) {
|
|
628
688
|
applied.unshift(EMPTY_OPTION);
|
|
@@ -693,7 +753,7 @@ import { createMenu } from "@elementor/menus";
|
|
|
693
753
|
import * as React8 from "react";
|
|
694
754
|
import { useId as useId2 } from "react";
|
|
695
755
|
import { XIcon } from "@elementor/icons";
|
|
696
|
-
import { bindPopover, bindToggle, IconButton, Popover, Stack as
|
|
756
|
+
import { bindPopover, bindToggle, IconButton, Popover, Stack as Stack4, Tooltip, Typography as Typography2, usePopupState as usePopupState2 } from "@elementor/ui";
|
|
697
757
|
var SIZE = "tiny";
|
|
698
758
|
function PopoverAction({
|
|
699
759
|
title,
|
|
@@ -720,7 +780,7 @@ function PopoverAction({
|
|
|
720
780
|
},
|
|
721
781
|
...bindPopover(popupState)
|
|
722
782
|
},
|
|
723
|
-
/* @__PURE__ */ React8.createElement(
|
|
783
|
+
/* @__PURE__ */ React8.createElement(Stack4, { direction: "row", alignItems: "center", pl: 1.5, pr: 0.5, py: 1.5 }, /* @__PURE__ */ React8.createElement(Icon, { fontSize: SIZE, sx: { mr: 0.5 } }), /* @__PURE__ */ React8.createElement(Typography2, { variant: "subtitle2" }, title), /* @__PURE__ */ React8.createElement(IconButton, { sx: { ml: "auto" }, size: SIZE, onClick: popupState.close }, /* @__PURE__ */ React8.createElement(XIcon, { fontSize: SIZE }))),
|
|
724
784
|
/* @__PURE__ */ React8.createElement(PopoverContent2, { closePopover: popupState.close })
|
|
725
785
|
));
|
|
726
786
|
}
|
|
@@ -742,7 +802,7 @@ function EditorPanelErrorFallback() {
|
|
|
742
802
|
// src/components/editing-panel-tabs.tsx
|
|
743
803
|
import * as React66 from "react";
|
|
744
804
|
import { Fragment as Fragment8 } from "react";
|
|
745
|
-
import { Divider as Divider5, Stack as
|
|
805
|
+
import { Divider as Divider5, Stack as Stack16, Tab, TabPanel, Tabs, useTabs } from "@elementor/ui";
|
|
746
806
|
import { __ as __44 } from "@wordpress/i18n";
|
|
747
807
|
|
|
748
808
|
// src/components/settings-tab.tsx
|
|
@@ -791,7 +851,7 @@ var Control = ({ props, type }) => {
|
|
|
791
851
|
|
|
792
852
|
// src/controls-registry/control-type-container.tsx
|
|
793
853
|
import * as React11 from "react";
|
|
794
|
-
import { Box as Box3, styled as
|
|
854
|
+
import { Box as Box3, styled as styled3 } from "@elementor/ui";
|
|
795
855
|
var ControlTypeContainer = ({
|
|
796
856
|
controlType,
|
|
797
857
|
children
|
|
@@ -799,7 +859,7 @@ var ControlTypeContainer = ({
|
|
|
799
859
|
const layout = getLayoutByType(controlType);
|
|
800
860
|
return /* @__PURE__ */ React11.createElement(StyledContainer, { layout }, children);
|
|
801
861
|
};
|
|
802
|
-
var StyledContainer =
|
|
862
|
+
var StyledContainer = styled3(Box3, {
|
|
803
863
|
shouldForwardProp: (prop) => !["layout"].includes(prop)
|
|
804
864
|
})(({ layout, theme }) => ({
|
|
805
865
|
display: "grid",
|
|
@@ -809,8 +869,8 @@ var StyledContainer = styled2(Box3, {
|
|
|
809
869
|
var getGridLayout = (layout) => ({
|
|
810
870
|
justifyContent: "space-between",
|
|
811
871
|
gridTemplateColumns: {
|
|
812
|
-
full: "1fr",
|
|
813
|
-
"two-columns": "repeat(2, 1fr)"
|
|
872
|
+
full: "minmax(0, 1fr)",
|
|
873
|
+
"two-columns": "repeat(2, minmax(0, 1fr))"
|
|
814
874
|
}[layout]
|
|
815
875
|
});
|
|
816
876
|
|
|
@@ -850,12 +910,12 @@ var SettingsField = ({ bind, children }) => {
|
|
|
850
910
|
// src/components/section.tsx
|
|
851
911
|
import * as React13 from "react";
|
|
852
912
|
import { useId as useId3, useState as useState3 } from "react";
|
|
853
|
-
import { Collapse, Divider as Divider2, ListItemButton, ListItemText, Stack as
|
|
913
|
+
import { Collapse, Divider as Divider2, ListItemButton, ListItemText, Stack as Stack5 } from "@elementor/ui";
|
|
854
914
|
|
|
855
915
|
// src/components/collapse-icon.tsx
|
|
856
916
|
import { ChevronDownIcon } from "@elementor/icons";
|
|
857
|
-
import { styled as
|
|
858
|
-
var CollapseIcon =
|
|
917
|
+
import { styled as styled4 } from "@elementor/ui";
|
|
918
|
+
var CollapseIcon = styled4(ChevronDownIcon, {
|
|
859
919
|
shouldForwardProp: (prop) => prop !== "open"
|
|
860
920
|
})(({ theme, open }) => ({
|
|
861
921
|
transform: open ? "rotate(180deg)" : "rotate(0deg)",
|
|
@@ -886,7 +946,7 @@ function Section({ title, children, defaultExpanded = false }) {
|
|
|
886
946
|
}
|
|
887
947
|
),
|
|
888
948
|
/* @__PURE__ */ React13.createElement(CollapseIcon, { open: isOpen, color: "secondary", fontSize: "tiny" })
|
|
889
|
-
), /* @__PURE__ */ React13.createElement(Collapse, { id: contentId, "aria-labelledby": labelId, in: isOpen, timeout: "auto", unmountOnExit: true }, /* @__PURE__ */ React13.createElement(
|
|
949
|
+
), /* @__PURE__ */ React13.createElement(Collapse, { id: contentId, "aria-labelledby": labelId, in: isOpen, timeout: "auto", unmountOnExit: true }, /* @__PURE__ */ React13.createElement(Stack5, { gap: 2.5, p: 2 }, children)), /* @__PURE__ */ React13.createElement(Divider2, null));
|
|
890
950
|
}
|
|
891
951
|
|
|
892
952
|
// src/components/sections-list.tsx
|
|
@@ -923,8 +983,7 @@ var Control2 = ({ control }) => {
|
|
|
923
983
|
|
|
924
984
|
// src/components/style-tab.tsx
|
|
925
985
|
import * as React65 from "react";
|
|
926
|
-
import { useState as
|
|
927
|
-
import { getElementStyles, useElementSetting as useElementSetting5 } from "@elementor/editor-elements";
|
|
986
|
+
import { useState as useState8 } from "react";
|
|
928
987
|
import { CLASSES_PROP_KEY } from "@elementor/editor-props";
|
|
929
988
|
import { useActiveBreakpoint } from "@elementor/editor-responsive";
|
|
930
989
|
import { SessionStorageProvider as SessionStorageProvider2 } from "@elementor/session";
|
|
@@ -947,6 +1006,9 @@ var useStylesRerender = () => {
|
|
|
947
1006
|
useEffect(() => provider?.subscribe(reRender), [provider]);
|
|
948
1007
|
};
|
|
949
1008
|
|
|
1009
|
+
// src/styles-inheritance/create-snapshots-manager.ts
|
|
1010
|
+
import { filterEmptyValues } from "@elementor/editor-props";
|
|
1011
|
+
|
|
950
1012
|
// src/styles-inheritance/utils.ts
|
|
951
1013
|
var DEFAULT_STATE = "normal";
|
|
952
1014
|
var DEFAULT_BREAKPOINT = "desktop";
|
|
@@ -1032,17 +1094,21 @@ function buildStateSnapshotSlot(styles, parentBreakpoint, currentBreakpoint, sta
|
|
|
1032
1094
|
}
|
|
1033
1095
|
function buildInitialSnapshotFromStyles(styles) {
|
|
1034
1096
|
const snapshot = {};
|
|
1035
|
-
styles.forEach((
|
|
1097
|
+
styles.forEach((styleData) => {
|
|
1036
1098
|
const {
|
|
1037
|
-
|
|
1038
|
-
} =
|
|
1099
|
+
variant: { props }
|
|
1100
|
+
} = styleData;
|
|
1039
1101
|
Object.entries(props).forEach(([key, value]) => {
|
|
1102
|
+
const filteredValue = filterEmptyValues(value);
|
|
1103
|
+
if (filteredValue === null) {
|
|
1104
|
+
return;
|
|
1105
|
+
}
|
|
1040
1106
|
if (!snapshot[key]) {
|
|
1041
1107
|
snapshot[key] = [];
|
|
1042
1108
|
}
|
|
1043
1109
|
const snapshotPropValue = {
|
|
1044
|
-
...
|
|
1045
|
-
value
|
|
1110
|
+
...styleData,
|
|
1111
|
+
value: filteredValue
|
|
1046
1112
|
};
|
|
1047
1113
|
snapshot[key].push(snapshotPropValue);
|
|
1048
1114
|
});
|
|
@@ -1074,8 +1140,9 @@ function createStylesInheritance(styleDefs, breakpointsRoot) {
|
|
|
1074
1140
|
function buildStyleVariantsByMetaMapping(styleDefs) {
|
|
1075
1141
|
const breakpointStateSlots = {};
|
|
1076
1142
|
styleDefs.forEach((styleDef) => {
|
|
1077
|
-
styleDef.
|
|
1078
|
-
|
|
1143
|
+
const provider = getProviderByStyleId(styleDef.id)?.getKey() ?? null;
|
|
1144
|
+
styleDef.variants.forEach((variant) => {
|
|
1145
|
+
const { meta } = variant;
|
|
1079
1146
|
const { state, breakpoint } = meta;
|
|
1080
1147
|
const breakpointKey = getBreakpointKey(breakpoint);
|
|
1081
1148
|
const stateKey = getStateKey(state);
|
|
@@ -1087,8 +1154,9 @@ function buildStyleVariantsByMetaMapping(styleDefs) {
|
|
|
1087
1154
|
breakpointNode[stateKey] = [];
|
|
1088
1155
|
}
|
|
1089
1156
|
breakpointNode[stateKey].push({
|
|
1090
|
-
|
|
1091
|
-
|
|
1157
|
+
style: styleDef,
|
|
1158
|
+
variant,
|
|
1159
|
+
provider
|
|
1092
1160
|
});
|
|
1093
1161
|
});
|
|
1094
1162
|
});
|
|
@@ -1137,6 +1205,30 @@ var useBaseStyles = () => {
|
|
|
1137
1205
|
return Object.values(widgetCache?.base_styles ?? {});
|
|
1138
1206
|
};
|
|
1139
1207
|
|
|
1208
|
+
// src/hooks/use-active-style-def-id.ts
|
|
1209
|
+
import { useState as useState4 } from "react";
|
|
1210
|
+
import { getElementStyles, useElementSetting as useElementSetting5 } from "@elementor/editor-elements";
|
|
1211
|
+
function useActiveStyleDefId(classProp) {
|
|
1212
|
+
const [activeStyledDefId, setActiveStyledDefId] = useState4(null);
|
|
1213
|
+
const appliedClassesIds = useAppliedClassesIds2(classProp)?.value || [];
|
|
1214
|
+
const fallback = useFirstAppliedClass(appliedClassesIds);
|
|
1215
|
+
const activeAndAppliedClassId = useActiveAndAppliedClassId(activeStyledDefId, appliedClassesIds);
|
|
1216
|
+
return [activeAndAppliedClassId || fallback?.id || null, setActiveStyledDefId];
|
|
1217
|
+
}
|
|
1218
|
+
function useFirstAppliedClass(appliedClassesIds) {
|
|
1219
|
+
const { element } = useElement();
|
|
1220
|
+
const stylesDefs = getElementStyles(element.id) ?? {};
|
|
1221
|
+
return Object.values(stylesDefs).find((styleDef) => appliedClassesIds.includes(styleDef.id));
|
|
1222
|
+
}
|
|
1223
|
+
function useAppliedClassesIds2(classProp) {
|
|
1224
|
+
const { element } = useElement();
|
|
1225
|
+
return useElementSetting5(element.id, classProp);
|
|
1226
|
+
}
|
|
1227
|
+
function useActiveAndAppliedClassId(id, appliedClassesIds) {
|
|
1228
|
+
const isClassApplied = !!id && appliedClassesIds.includes(id);
|
|
1229
|
+
return isClassApplied ? id : null;
|
|
1230
|
+
}
|
|
1231
|
+
|
|
1140
1232
|
// src/components/style-sections/background-section/background-section.tsx
|
|
1141
1233
|
import * as React19 from "react";
|
|
1142
1234
|
import { BackgroundControl } from "@elementor/editor-controls";
|
|
@@ -1154,7 +1246,7 @@ import {
|
|
|
1154
1246
|
getElementLabel
|
|
1155
1247
|
} from "@elementor/editor-elements";
|
|
1156
1248
|
import { getVariantByMeta } from "@elementor/editor-styles";
|
|
1157
|
-
import {
|
|
1249
|
+
import { ELEMENTS_STYLES_RESERVED_LABEL } from "@elementor/editor-styles-repository";
|
|
1158
1250
|
import { undoable } from "@elementor/editor-v1-adapters";
|
|
1159
1251
|
import { __ as __4 } from "@wordpress/i18n";
|
|
1160
1252
|
function useStylesFields(propNames) {
|
|
@@ -1195,9 +1287,9 @@ function getProps({ styleId, elementId, provider, meta, propNames }) {
|
|
|
1195
1287
|
if (!provider || !styleId) {
|
|
1196
1288
|
return null;
|
|
1197
1289
|
}
|
|
1198
|
-
const style = provider.actions.
|
|
1290
|
+
const style = provider.actions.get(styleId, { elementId });
|
|
1199
1291
|
if (!style) {
|
|
1200
|
-
throw new StyleNotFoundUnderProviderError({ context: { styleId, providerKey: provider.
|
|
1292
|
+
throw new StyleNotFoundUnderProviderError({ context: { styleId, providerKey: provider.getKey() } });
|
|
1201
1293
|
}
|
|
1202
1294
|
const variant = getVariantByMeta(style, meta);
|
|
1203
1295
|
return Object.fromEntries(
|
|
@@ -1211,7 +1303,7 @@ function useUndoableCreateElementStyle() {
|
|
|
1211
1303
|
do: (payload) => {
|
|
1212
1304
|
return createElementStyle({
|
|
1213
1305
|
...payload,
|
|
1214
|
-
label:
|
|
1306
|
+
label: ELEMENTS_STYLES_RESERVED_LABEL
|
|
1215
1307
|
});
|
|
1216
1308
|
},
|
|
1217
1309
|
undo: ({ elementId }, styleId) => {
|
|
@@ -1221,7 +1313,7 @@ function useUndoableCreateElementStyle() {
|
|
|
1221
1313
|
return createElementStyle({
|
|
1222
1314
|
...payload,
|
|
1223
1315
|
styleId,
|
|
1224
|
-
label:
|
|
1316
|
+
label: ELEMENTS_STYLES_RESERVED_LABEL
|
|
1225
1317
|
});
|
|
1226
1318
|
}
|
|
1227
1319
|
},
|
|
@@ -1239,10 +1331,10 @@ function useUndoableUpdateStyle() {
|
|
|
1239
1331
|
do: ({ elementId, styleId, provider, meta, props }) => {
|
|
1240
1332
|
if (!provider.actions.updateProps) {
|
|
1241
1333
|
throw new StylesProviderCannotUpdatePropsError({
|
|
1242
|
-
context: { providerKey: provider.
|
|
1334
|
+
context: { providerKey: provider.getKey() }
|
|
1243
1335
|
});
|
|
1244
1336
|
}
|
|
1245
|
-
const style = provider.actions.
|
|
1337
|
+
const style = provider.actions.get(styleId, { elementId });
|
|
1246
1338
|
const prevProps = getCurrentProps(style, meta);
|
|
1247
1339
|
provider.actions.updateProps(
|
|
1248
1340
|
{
|
|
@@ -1289,28 +1381,8 @@ function useStylesField(propName) {
|
|
|
1289
1381
|
// src/styles-inheritance/styles-inheritance-indicator.tsx
|
|
1290
1382
|
import * as React17 from "react";
|
|
1291
1383
|
import { useBoundProp } from "@elementor/editor-controls";
|
|
1292
|
-
import {
|
|
1293
|
-
import { styled as styled4 } from "@elementor/ui";
|
|
1384
|
+
import { ELEMENTS_BASE_STYLES_PROVIDER_KEY, isElementsStylesProvider as isElementsStylesProvider3 } from "@elementor/editor-styles-repository";
|
|
1294
1385
|
import { __ as __5 } from "@wordpress/i18n";
|
|
1295
|
-
var Circle = styled4("div", {
|
|
1296
|
-
shouldForwardProp: (prop) => prop !== "variant"
|
|
1297
|
-
})`
|
|
1298
|
-
width: 5px;
|
|
1299
|
-
height: 5px;
|
|
1300
|
-
border-radius: 50%;
|
|
1301
|
-
background-color: ${({ theme, variant }) => {
|
|
1302
|
-
switch (variant) {
|
|
1303
|
-
case "overridden":
|
|
1304
|
-
return theme.palette.warning.light;
|
|
1305
|
-
case "global-affects":
|
|
1306
|
-
return theme.palette.global.dark;
|
|
1307
|
-
case "local-affects":
|
|
1308
|
-
return theme.palette.primary.main;
|
|
1309
|
-
default:
|
|
1310
|
-
return theme.palette.text.disabled;
|
|
1311
|
-
}
|
|
1312
|
-
}};
|
|
1313
|
-
`;
|
|
1314
1386
|
var StylesInheritanceIndicator = () => {
|
|
1315
1387
|
const { value, path } = useBoundProp();
|
|
1316
1388
|
const { id: currentStyleId, provider: currentStyleProvider, meta: currentStyleMeta } = useStyle();
|
|
@@ -1319,35 +1391,39 @@ var StylesInheritanceIndicator = () => {
|
|
|
1319
1391
|
if (!inheritanceChain.length) {
|
|
1320
1392
|
return null;
|
|
1321
1393
|
}
|
|
1322
|
-
const [{
|
|
1323
|
-
|
|
1324
|
-
|
|
1394
|
+
const [{ style, variant, provider }] = inheritanceChain;
|
|
1395
|
+
if (provider === ELEMENTS_BASE_STYLES_PROVIDER_KEY) {
|
|
1396
|
+
return null;
|
|
1397
|
+
}
|
|
1398
|
+
const { breakpoint, state } = variant.meta;
|
|
1399
|
+
if (style.id === currentStyleId && breakpoint === currentStyleMeta.breakpoint && state === currentStyleMeta.state) {
|
|
1325
1400
|
return /* @__PURE__ */ React17.createElement(
|
|
1326
|
-
|
|
1401
|
+
StyleIndicator,
|
|
1327
1402
|
{
|
|
1328
1403
|
"aria-label": __5("This is the final value", "elementor"),
|
|
1329
|
-
variant: currentStyleProvider?.
|
|
1404
|
+
variant: isElementsStylesProvider3(currentStyleProvider?.getKey()) ? "local" : "global"
|
|
1330
1405
|
}
|
|
1331
1406
|
);
|
|
1332
1407
|
}
|
|
1333
1408
|
if (value !== null && value !== void 0) {
|
|
1334
1409
|
return /* @__PURE__ */ React17.createElement(
|
|
1335
|
-
|
|
1410
|
+
StyleIndicator,
|
|
1336
1411
|
{
|
|
1337
1412
|
"aria-label": __5("This value is overridden by another style", "elementor"),
|
|
1338
1413
|
variant: "overridden"
|
|
1339
1414
|
}
|
|
1340
1415
|
);
|
|
1341
1416
|
}
|
|
1342
|
-
return /* @__PURE__ */ React17.createElement(
|
|
1417
|
+
return /* @__PURE__ */ React17.createElement(StyleIndicator, { "aria-label": __5("This has value from another style", "elementor") });
|
|
1343
1418
|
};
|
|
1344
1419
|
|
|
1345
1420
|
// src/controls-registry/styles-field.tsx
|
|
1346
|
-
var StylesField = ({ bind, children }) => {
|
|
1421
|
+
var StylesField = ({ bind, placeholder, children }) => {
|
|
1347
1422
|
const [value, setValue] = useStylesField(bind);
|
|
1348
1423
|
const stylesSchema = getStylesSchema();
|
|
1349
1424
|
const propType = createTopLevelOjectType({ schema: stylesSchema });
|
|
1350
1425
|
const values = { [bind]: value };
|
|
1426
|
+
const placeholderValues = { [bind]: placeholder };
|
|
1351
1427
|
const setValues = (newValue) => {
|
|
1352
1428
|
setValue(newValue[bind]);
|
|
1353
1429
|
};
|
|
@@ -1361,7 +1437,16 @@ var StylesField = ({ bind, children }) => {
|
|
|
1361
1437
|
}
|
|
1362
1438
|
]
|
|
1363
1439
|
},
|
|
1364
|
-
/* @__PURE__ */ React18.createElement(
|
|
1440
|
+
/* @__PURE__ */ React18.createElement(
|
|
1441
|
+
PropProvider2,
|
|
1442
|
+
{
|
|
1443
|
+
propType,
|
|
1444
|
+
value: values,
|
|
1445
|
+
setValue: setValues,
|
|
1446
|
+
placeholder: placeholderValues
|
|
1447
|
+
},
|
|
1448
|
+
/* @__PURE__ */ React18.createElement(PropKeyProvider2, { bind }, children)
|
|
1449
|
+
)
|
|
1365
1450
|
);
|
|
1366
1451
|
};
|
|
1367
1452
|
|
|
@@ -1371,7 +1456,7 @@ var BackgroundSection = () => {
|
|
|
1371
1456
|
};
|
|
1372
1457
|
|
|
1373
1458
|
// src/components/style-sections/border-section/border-section.tsx
|
|
1374
|
-
import * as
|
|
1459
|
+
import * as React29 from "react";
|
|
1375
1460
|
|
|
1376
1461
|
// src/components/panel-divider.tsx
|
|
1377
1462
|
import * as React20 from "react";
|
|
@@ -1380,31 +1465,31 @@ var PanelDivider = () => /* @__PURE__ */ React20.createElement(Divider3, { sx: {
|
|
|
1380
1465
|
|
|
1381
1466
|
// src/components/section-content.tsx
|
|
1382
1467
|
import * as React21 from "react";
|
|
1383
|
-
import { Stack as
|
|
1384
|
-
var SectionContent = ({ gap = 2, sx, children }) => /* @__PURE__ */ React21.createElement(
|
|
1468
|
+
import { Stack as Stack6 } from "@elementor/ui";
|
|
1469
|
+
var SectionContent = ({ gap = 2, sx, children }) => /* @__PURE__ */ React21.createElement(Stack6, { gap, sx: { ...sx } }, children);
|
|
1385
1470
|
|
|
1386
1471
|
// src/components/style-sections/border-section/border-field.tsx
|
|
1387
|
-
import * as
|
|
1472
|
+
import * as React27 from "react";
|
|
1388
1473
|
import { __ as __9 } from "@wordpress/i18n";
|
|
1389
1474
|
|
|
1390
1475
|
// src/components/add-or-remove-content.tsx
|
|
1391
1476
|
import * as React23 from "react";
|
|
1392
1477
|
import { MinusIcon, PlusIcon } from "@elementor/icons";
|
|
1393
|
-
import { Collapse as Collapse2, IconButton as IconButton2, Stack as
|
|
1478
|
+
import { Collapse as Collapse2, IconButton as IconButton2, Stack as Stack8 } from "@elementor/ui";
|
|
1394
1479
|
|
|
1395
1480
|
// src/components/control-label.tsx
|
|
1396
1481
|
import * as React22 from "react";
|
|
1397
1482
|
import { ControlAdornments, ControlFormLabel as ControlFormLabel2 } from "@elementor/editor-controls";
|
|
1398
|
-
import { Stack as
|
|
1483
|
+
import { Stack as Stack7 } from "@elementor/ui";
|
|
1399
1484
|
var ControlLabel = ({ children }) => {
|
|
1400
|
-
return /* @__PURE__ */ React22.createElement(
|
|
1485
|
+
return /* @__PURE__ */ React22.createElement(Stack7, { direction: "row", alignItems: "center", justifyItems: "start", gap: 1 }, /* @__PURE__ */ React22.createElement(ControlFormLabel2, null, children), /* @__PURE__ */ React22.createElement(ControlAdornments, null));
|
|
1401
1486
|
};
|
|
1402
1487
|
|
|
1403
1488
|
// src/components/add-or-remove-content.tsx
|
|
1404
1489
|
var SIZE2 = "tiny";
|
|
1405
1490
|
var AddOrRemoveContent = ({ isAdded, label, onAdd, onRemove, children }) => {
|
|
1406
1491
|
return /* @__PURE__ */ React23.createElement(SectionContent, null, /* @__PURE__ */ React23.createElement(
|
|
1407
|
-
|
|
1492
|
+
Stack8,
|
|
1408
1493
|
{
|
|
1409
1494
|
direction: "row",
|
|
1410
1495
|
sx: {
|
|
@@ -1447,7 +1532,7 @@ var BorderStyleField = () => {
|
|
|
1447
1532
|
};
|
|
1448
1533
|
|
|
1449
1534
|
// src/components/style-sections/border-section/border-width-field.tsx
|
|
1450
|
-
import * as
|
|
1535
|
+
import * as React26 from "react";
|
|
1451
1536
|
import { EqualUnequalSizesControl } from "@elementor/editor-controls";
|
|
1452
1537
|
import { borderWidthPropTypeUtil } from "@elementor/editor-props";
|
|
1453
1538
|
import { SideAllIcon, SideBottomIcon, SideLeftIcon, SideRightIcon, SideTopIcon } from "@elementor/icons";
|
|
@@ -1462,82 +1547,39 @@ function useDirection() {
|
|
|
1462
1547
|
return { isSiteRtl, isUiRtl };
|
|
1463
1548
|
}
|
|
1464
1549
|
|
|
1465
|
-
// src/components/style-sections/layout-section/utils/rotated-icon.tsx
|
|
1466
|
-
import * as React26 from "react";
|
|
1467
|
-
import { useRef } from "react";
|
|
1468
|
-
import { useTheme as useTheme2 } from "@elementor/ui";
|
|
1469
|
-
var CLOCKWISE_ANGLES = {
|
|
1470
|
-
row: 0,
|
|
1471
|
-
column: 90,
|
|
1472
|
-
"row-reverse": 180,
|
|
1473
|
-
"column-reverse": 270
|
|
1474
|
-
};
|
|
1475
|
-
var COUNTER_CLOCKWISE_ANGLES = {
|
|
1476
|
-
row: 0,
|
|
1477
|
-
column: -90,
|
|
1478
|
-
"row-reverse": -180,
|
|
1479
|
-
"column-reverse": -270
|
|
1480
|
-
};
|
|
1481
|
-
var RotatedIcon = ({
|
|
1482
|
-
icon: Icon,
|
|
1483
|
-
size,
|
|
1484
|
-
isClockwise = true,
|
|
1485
|
-
offset = 0,
|
|
1486
|
-
disableRotationForReversed = false
|
|
1487
|
-
}) => {
|
|
1488
|
-
const rotate = useRef(useGetTargetAngle(isClockwise, offset, disableRotationForReversed));
|
|
1489
|
-
rotate.current = useGetTargetAngle(isClockwise, offset, disableRotationForReversed, rotate);
|
|
1490
|
-
return /* @__PURE__ */ React26.createElement(Icon, { fontSize: size, sx: { transition: ".3s", rotate: `${rotate.current}deg` } });
|
|
1491
|
-
};
|
|
1492
|
-
var useGetTargetAngle = (isClockwise, offset, disableRotationForReversed, existingRef) => {
|
|
1493
|
-
const [direction] = useStylesField("flex-direction");
|
|
1494
|
-
const isRtl = "rtl" === useTheme2().direction;
|
|
1495
|
-
const rotationMultiplier = isRtl ? -1 : 1;
|
|
1496
|
-
const angleMap = isClockwise ? CLOCKWISE_ANGLES : COUNTER_CLOCKWISE_ANGLES;
|
|
1497
|
-
const currentDirection = direction?.value || "row";
|
|
1498
|
-
const currentAngle = existingRef ? existingRef.current * rotationMultiplier : angleMap[currentDirection] + offset;
|
|
1499
|
-
const targetAngle = angleMap[currentDirection] + offset;
|
|
1500
|
-
const diffToTargetAngle = (targetAngle - currentAngle + 360) % 360;
|
|
1501
|
-
const formattedDiff = (diffToTargetAngle + 180) % 360 - 180;
|
|
1502
|
-
if (disableRotationForReversed && ["row-reverse", "column-reverse"].includes(currentDirection)) {
|
|
1503
|
-
return 0;
|
|
1504
|
-
}
|
|
1505
|
-
return (currentAngle + formattedDiff) * rotationMultiplier;
|
|
1506
|
-
};
|
|
1507
|
-
|
|
1508
1550
|
// src/components/style-sections/border-section/border-width-field.tsx
|
|
1509
1551
|
var InlineStartIcon = withDirection(SideRightIcon);
|
|
1510
1552
|
var InlineEndIcon = withDirection(SideLeftIcon);
|
|
1511
1553
|
var getEdges = (isSiteRtl) => [
|
|
1512
1554
|
{
|
|
1513
1555
|
label: __8("Top", "elementor"),
|
|
1514
|
-
icon: /* @__PURE__ */
|
|
1556
|
+
icon: /* @__PURE__ */ React26.createElement(SideTopIcon, { fontSize: "tiny" }),
|
|
1515
1557
|
bind: "block-start"
|
|
1516
1558
|
},
|
|
1517
1559
|
{
|
|
1518
1560
|
label: isSiteRtl ? __8("Left", "elementor") : __8("Right", "elementor"),
|
|
1519
|
-
icon: /* @__PURE__ */
|
|
1561
|
+
icon: /* @__PURE__ */ React26.createElement(InlineStartIcon, { fontSize: "tiny" }),
|
|
1520
1562
|
bind: "inline-end"
|
|
1521
1563
|
},
|
|
1522
1564
|
{
|
|
1523
1565
|
label: __8("Bottom", "elementor"),
|
|
1524
|
-
icon: /* @__PURE__ */
|
|
1566
|
+
icon: /* @__PURE__ */ React26.createElement(SideBottomIcon, { fontSize: "tiny" }),
|
|
1525
1567
|
bind: "block-end"
|
|
1526
1568
|
},
|
|
1527
1569
|
{
|
|
1528
1570
|
label: isSiteRtl ? __8("Right", "elementor") : __8("Left", "elementor"),
|
|
1529
|
-
icon: /* @__PURE__ */
|
|
1571
|
+
icon: /* @__PURE__ */ React26.createElement(InlineEndIcon, { fontSize: "tiny" }),
|
|
1530
1572
|
bind: "inline-start"
|
|
1531
1573
|
}
|
|
1532
1574
|
];
|
|
1533
1575
|
var BorderWidthField = () => {
|
|
1534
1576
|
const { isSiteRtl } = useDirection();
|
|
1535
|
-
return /* @__PURE__ */
|
|
1577
|
+
return /* @__PURE__ */ React26.createElement(StylesField, { bind: "border-width" }, /* @__PURE__ */ React26.createElement(
|
|
1536
1578
|
EqualUnequalSizesControl,
|
|
1537
1579
|
{
|
|
1538
1580
|
items: getEdges(isSiteRtl),
|
|
1539
1581
|
label: __8("Border width", "elementor"),
|
|
1540
|
-
icon: /* @__PURE__ */
|
|
1582
|
+
icon: /* @__PURE__ */ React26.createElement(SideAllIcon, { fontSize: "tiny" }),
|
|
1541
1583
|
tooltipLabel: __8("Adjust borders", "elementor"),
|
|
1542
1584
|
multiSizePropTypeUtil: borderWidthPropTypeUtil
|
|
1543
1585
|
}
|
|
@@ -1563,7 +1605,7 @@ var BorderField = () => {
|
|
|
1563
1605
|
});
|
|
1564
1606
|
};
|
|
1565
1607
|
const hasBorder = Object.values(border ?? {}).some(Boolean);
|
|
1566
|
-
return /* @__PURE__ */
|
|
1608
|
+
return /* @__PURE__ */ React27.createElement(
|
|
1567
1609
|
AddOrRemoveContent,
|
|
1568
1610
|
{
|
|
1569
1611
|
label: __9("Border", "elementor"),
|
|
@@ -1571,14 +1613,14 @@ var BorderField = () => {
|
|
|
1571
1613
|
onAdd: addBorder,
|
|
1572
1614
|
onRemove: removeBorder
|
|
1573
1615
|
},
|
|
1574
|
-
/* @__PURE__ */
|
|
1575
|
-
/* @__PURE__ */
|
|
1576
|
-
/* @__PURE__ */
|
|
1616
|
+
/* @__PURE__ */ React27.createElement(BorderWidthField, null),
|
|
1617
|
+
/* @__PURE__ */ React27.createElement(BorderColorField, null),
|
|
1618
|
+
/* @__PURE__ */ React27.createElement(BorderStyleField, null)
|
|
1577
1619
|
);
|
|
1578
1620
|
};
|
|
1579
1621
|
|
|
1580
1622
|
// src/components/style-sections/border-section/border-radius-field.tsx
|
|
1581
|
-
import * as
|
|
1623
|
+
import * as React28 from "react";
|
|
1582
1624
|
import { EqualUnequalSizesControl as EqualUnequalSizesControl2 } from "@elementor/editor-controls";
|
|
1583
1625
|
import { borderRadiusPropTypeUtil } from "@elementor/editor-props";
|
|
1584
1626
|
import {
|
|
@@ -1601,33 +1643,33 @@ var getEndEndLabel = (isSiteRtl) => isSiteRtl ? __10("Bottom left", "elementor")
|
|
|
1601
1643
|
var getCorners = (isSiteRtl) => [
|
|
1602
1644
|
{
|
|
1603
1645
|
label: getStartStartLabel(isSiteRtl),
|
|
1604
|
-
icon: /* @__PURE__ */
|
|
1646
|
+
icon: /* @__PURE__ */ React28.createElement(StartStartIcon, { fontSize: "tiny" }),
|
|
1605
1647
|
bind: "start-start"
|
|
1606
1648
|
},
|
|
1607
1649
|
{
|
|
1608
1650
|
label: getStartEndLabel(isSiteRtl),
|
|
1609
|
-
icon: /* @__PURE__ */
|
|
1651
|
+
icon: /* @__PURE__ */ React28.createElement(StartEndIcon, { fontSize: "tiny" }),
|
|
1610
1652
|
bind: "start-end"
|
|
1611
1653
|
},
|
|
1612
1654
|
{
|
|
1613
1655
|
label: getEndStartLabel(isSiteRtl),
|
|
1614
|
-
icon: /* @__PURE__ */
|
|
1656
|
+
icon: /* @__PURE__ */ React28.createElement(EndStartIcon, { fontSize: "tiny" }),
|
|
1615
1657
|
bind: "end-start"
|
|
1616
1658
|
},
|
|
1617
1659
|
{
|
|
1618
1660
|
label: getEndEndLabel(isSiteRtl),
|
|
1619
|
-
icon: /* @__PURE__ */
|
|
1661
|
+
icon: /* @__PURE__ */ React28.createElement(EndEndIcon, { fontSize: "tiny" }),
|
|
1620
1662
|
bind: "end-end"
|
|
1621
1663
|
}
|
|
1622
1664
|
];
|
|
1623
1665
|
var BorderRadiusField = () => {
|
|
1624
1666
|
const { isSiteRtl } = useDirection();
|
|
1625
|
-
return /* @__PURE__ */
|
|
1667
|
+
return /* @__PURE__ */ React28.createElement(StylesField, { bind: "border-radius" }, /* @__PURE__ */ React28.createElement(
|
|
1626
1668
|
EqualUnequalSizesControl2,
|
|
1627
1669
|
{
|
|
1628
1670
|
items: getCorners(isSiteRtl),
|
|
1629
1671
|
label: __10("Border radius", "elementor"),
|
|
1630
|
-
icon: /* @__PURE__ */
|
|
1672
|
+
icon: /* @__PURE__ */ React28.createElement(BorderCornersIcon, { fontSize: "tiny" }),
|
|
1631
1673
|
tooltipLabel: __10("Adjust corners", "elementor"),
|
|
1632
1674
|
multiSizePropTypeUtil: borderRadiusPropTypeUtil
|
|
1633
1675
|
}
|
|
@@ -1635,13 +1677,13 @@ var BorderRadiusField = () => {
|
|
|
1635
1677
|
};
|
|
1636
1678
|
|
|
1637
1679
|
// src/components/style-sections/border-section/border-section.tsx
|
|
1638
|
-
var BorderSection = () => /* @__PURE__ */
|
|
1680
|
+
var BorderSection = () => /* @__PURE__ */ React29.createElement(SectionContent, null, /* @__PURE__ */ React29.createElement(BorderRadiusField, null), /* @__PURE__ */ React29.createElement(PanelDivider, null), /* @__PURE__ */ React29.createElement(BorderField, null));
|
|
1639
1681
|
|
|
1640
1682
|
// src/components/style-sections/effects-section/effects-section.tsx
|
|
1641
|
-
import * as
|
|
1683
|
+
import * as React30 from "react";
|
|
1642
1684
|
import { BoxShadowRepeaterControl } from "@elementor/editor-controls";
|
|
1643
1685
|
var EffectsSection = () => {
|
|
1644
|
-
return /* @__PURE__ */
|
|
1686
|
+
return /* @__PURE__ */ React30.createElement(SectionContent, null, /* @__PURE__ */ React30.createElement(StylesField, { bind: "box-shadow" }, /* @__PURE__ */ React30.createElement(BoxShadowRepeaterControl, null)));
|
|
1645
1687
|
};
|
|
1646
1688
|
|
|
1647
1689
|
// src/components/style-sections/layout-section/layout-section.tsx
|
|
@@ -1686,8 +1728,53 @@ import {
|
|
|
1686
1728
|
JustifySpaceBetweenVerticalIcon as BetweenIcon,
|
|
1687
1729
|
JustifyTopIcon
|
|
1688
1730
|
} from "@elementor/icons";
|
|
1689
|
-
import { DirectionProvider, Stack as
|
|
1731
|
+
import { DirectionProvider, Stack as Stack9, ThemeProvider, withDirection as withDirection3 } from "@elementor/ui";
|
|
1690
1732
|
import { __ as __11 } from "@wordpress/i18n";
|
|
1733
|
+
|
|
1734
|
+
// src/components/style-sections/layout-section/utils/rotated-icon.tsx
|
|
1735
|
+
import * as React31 from "react";
|
|
1736
|
+
import { useRef } from "react";
|
|
1737
|
+
import { useTheme as useTheme2 } from "@elementor/ui";
|
|
1738
|
+
var CLOCKWISE_ANGLES = {
|
|
1739
|
+
row: 0,
|
|
1740
|
+
column: 90,
|
|
1741
|
+
"row-reverse": 180,
|
|
1742
|
+
"column-reverse": 270
|
|
1743
|
+
};
|
|
1744
|
+
var COUNTER_CLOCKWISE_ANGLES = {
|
|
1745
|
+
row: 0,
|
|
1746
|
+
column: -90,
|
|
1747
|
+
"row-reverse": -180,
|
|
1748
|
+
"column-reverse": -270
|
|
1749
|
+
};
|
|
1750
|
+
var RotatedIcon = ({
|
|
1751
|
+
icon: Icon,
|
|
1752
|
+
size,
|
|
1753
|
+
isClockwise = true,
|
|
1754
|
+
offset = 0,
|
|
1755
|
+
disableRotationForReversed = false
|
|
1756
|
+
}) => {
|
|
1757
|
+
const rotate = useRef(useGetTargetAngle(isClockwise, offset, disableRotationForReversed));
|
|
1758
|
+
rotate.current = useGetTargetAngle(isClockwise, offset, disableRotationForReversed, rotate);
|
|
1759
|
+
return /* @__PURE__ */ React31.createElement(Icon, { fontSize: size, sx: { transition: ".3s", rotate: `${rotate.current}deg` } });
|
|
1760
|
+
};
|
|
1761
|
+
var useGetTargetAngle = (isClockwise, offset, disableRotationForReversed, existingRef) => {
|
|
1762
|
+
const [direction] = useStylesField("flex-direction");
|
|
1763
|
+
const isRtl = "rtl" === useTheme2().direction;
|
|
1764
|
+
const rotationMultiplier = isRtl ? -1 : 1;
|
|
1765
|
+
const angleMap = isClockwise ? CLOCKWISE_ANGLES : COUNTER_CLOCKWISE_ANGLES;
|
|
1766
|
+
const currentDirection = direction?.value || "row";
|
|
1767
|
+
const currentAngle = existingRef ? existingRef.current * rotationMultiplier : angleMap[currentDirection] + offset;
|
|
1768
|
+
const targetAngle = angleMap[currentDirection] + offset;
|
|
1769
|
+
const diffToTargetAngle = (targetAngle - currentAngle + 360) % 360;
|
|
1770
|
+
const formattedDiff = (diffToTargetAngle + 180) % 360 - 180;
|
|
1771
|
+
if (disableRotationForReversed && ["row-reverse", "column-reverse"].includes(currentDirection)) {
|
|
1772
|
+
return 0;
|
|
1773
|
+
}
|
|
1774
|
+
return (currentAngle + formattedDiff) * rotationMultiplier;
|
|
1775
|
+
};
|
|
1776
|
+
|
|
1777
|
+
// src/components/style-sections/layout-section/align-content-field.tsx
|
|
1691
1778
|
var StartIcon = withDirection3(JustifyTopIcon);
|
|
1692
1779
|
var EndIcon = withDirection3(JustifyBottomIcon);
|
|
1693
1780
|
var iconProps = {
|
|
@@ -1735,7 +1822,7 @@ var options = [
|
|
|
1735
1822
|
];
|
|
1736
1823
|
var AlignContentField = () => {
|
|
1737
1824
|
const { isSiteRtl } = useDirection();
|
|
1738
|
-
return /* @__PURE__ */ React32.createElement(DirectionProvider, { rtl: isSiteRtl }, /* @__PURE__ */ React32.createElement(ThemeProvider, null, /* @__PURE__ */ React32.createElement(StylesField, { bind: "align-content" }, /* @__PURE__ */ React32.createElement(
|
|
1825
|
+
return /* @__PURE__ */ React32.createElement(DirectionProvider, { rtl: isSiteRtl }, /* @__PURE__ */ React32.createElement(ThemeProvider, null, /* @__PURE__ */ React32.createElement(StylesField, { bind: "align-content" }, /* @__PURE__ */ React32.createElement(Stack9, { gap: 1 }, /* @__PURE__ */ React32.createElement(ControlLabel, null, __11("Align content", "elementor")), /* @__PURE__ */ React32.createElement(ToggleControl, { options, fullWidth: true })))));
|
|
1739
1826
|
};
|
|
1740
1827
|
|
|
1741
1828
|
// src/components/style-sections/layout-section/align-items-field.tsx
|
|
@@ -1837,37 +1924,39 @@ var AlignSelfChild = () => {
|
|
|
1837
1924
|
// src/components/style-sections/layout-section/display-field.tsx
|
|
1838
1925
|
import * as React35 from "react";
|
|
1839
1926
|
import { ToggleControl as ToggleControl4 } from "@elementor/editor-controls";
|
|
1840
|
-
import { Stack as
|
|
1927
|
+
import { Stack as Stack10 } from "@elementor/ui";
|
|
1841
1928
|
import { __ as __14 } from "@wordpress/i18n";
|
|
1929
|
+
var displayFieldOptions = [
|
|
1930
|
+
{
|
|
1931
|
+
value: "block",
|
|
1932
|
+
renderContent: () => __14("Block", "elementor"),
|
|
1933
|
+
label: __14("Block", "elementor"),
|
|
1934
|
+
showTooltip: true
|
|
1935
|
+
},
|
|
1936
|
+
{
|
|
1937
|
+
value: "flex",
|
|
1938
|
+
renderContent: () => __14("Flex", "elementor"),
|
|
1939
|
+
label: __14("Flex", "elementor"),
|
|
1940
|
+
showTooltip: true
|
|
1941
|
+
},
|
|
1942
|
+
{
|
|
1943
|
+
value: "inline-block",
|
|
1944
|
+
renderContent: () => __14("In-blk", "elementor"),
|
|
1945
|
+
label: __14("Inline-block", "elementor"),
|
|
1946
|
+
showTooltip: true
|
|
1947
|
+
},
|
|
1948
|
+
{
|
|
1949
|
+
value: "inline-flex",
|
|
1950
|
+
renderContent: () => __14("In-flx", "elementor"),
|
|
1951
|
+
label: __14("Inline-flex", "elementor"),
|
|
1952
|
+
showTooltip: true
|
|
1953
|
+
}
|
|
1954
|
+
];
|
|
1842
1955
|
var DisplayField = () => {
|
|
1843
|
-
const
|
|
1844
|
-
|
|
1845
|
-
value: "block",
|
|
1846
|
-
renderContent: () => __14("Block", "elementor"),
|
|
1847
|
-
label: __14("Block", "elementor"),
|
|
1848
|
-
showTooltip: true
|
|
1849
|
-
},
|
|
1850
|
-
{
|
|
1851
|
-
value: "flex",
|
|
1852
|
-
renderContent: () => __14("Flex", "elementor"),
|
|
1853
|
-
label: __14("Flex", "elementor"),
|
|
1854
|
-
showTooltip: true
|
|
1855
|
-
},
|
|
1856
|
-
{
|
|
1857
|
-
value: "inline-block",
|
|
1858
|
-
renderContent: () => __14("In-blk", "elementor"),
|
|
1859
|
-
label: __14("Inline-block", "elementor"),
|
|
1860
|
-
showTooltip: true
|
|
1861
|
-
},
|
|
1862
|
-
{
|
|
1863
|
-
value: "inline-flex",
|
|
1864
|
-
renderContent: () => __14("In-flx", "elementor"),
|
|
1865
|
-
label: __14("Inline-flex", "elementor"),
|
|
1866
|
-
showTooltip: true
|
|
1867
|
-
}
|
|
1868
|
-
];
|
|
1869
|
-
return /* @__PURE__ */ React35.createElement(StylesField, { bind: "display" }, /* @__PURE__ */ React35.createElement(Stack9, { gap: 0.75 }, /* @__PURE__ */ React35.createElement(ControlLabel, null, __14("Display", "elementor")), /* @__PURE__ */ React35.createElement(ToggleControl4, { options: options13, fullWidth: true })));
|
|
1956
|
+
const placeholder = useDisplayPlaceholderValue();
|
|
1957
|
+
return /* @__PURE__ */ React35.createElement(StylesField, { bind: "display", placeholder }, /* @__PURE__ */ React35.createElement(Stack10, { gap: 0.75 }, /* @__PURE__ */ React35.createElement(ControlLabel, null, __14("Display", "elementor")), /* @__PURE__ */ React35.createElement(ToggleControl4, { options: displayFieldOptions, fullWidth: true })));
|
|
1870
1958
|
};
|
|
1959
|
+
var useDisplayPlaceholderValue = () => useStylesInheritanceField("display")[0]?.value ?? void 0;
|
|
1871
1960
|
|
|
1872
1961
|
// src/components/style-sections/layout-section/flex-direction-field.tsx
|
|
1873
1962
|
import * as React36 from "react";
|
|
@@ -1880,8 +1969,8 @@ var options4 = [
|
|
|
1880
1969
|
value: "row",
|
|
1881
1970
|
label: __15("Row", "elementor"),
|
|
1882
1971
|
renderContent: ({ size }) => {
|
|
1883
|
-
const
|
|
1884
|
-
return /* @__PURE__ */ React36.createElement(
|
|
1972
|
+
const StartIcon5 = withDirection6(ArrowRightIcon);
|
|
1973
|
+
return /* @__PURE__ */ React36.createElement(StartIcon5, { fontSize: size });
|
|
1885
1974
|
},
|
|
1886
1975
|
showTooltip: true
|
|
1887
1976
|
},
|
|
@@ -1895,8 +1984,8 @@ var options4 = [
|
|
|
1895
1984
|
value: "row-reverse",
|
|
1896
1985
|
label: __15("Reversed row", "elementor"),
|
|
1897
1986
|
renderContent: ({ size }) => {
|
|
1898
|
-
const
|
|
1899
|
-
return /* @__PURE__ */ React36.createElement(
|
|
1987
|
+
const EndIcon5 = withDirection6(ArrowLeftIcon);
|
|
1988
|
+
return /* @__PURE__ */ React36.createElement(EndIcon5, { fontSize: size });
|
|
1900
1989
|
},
|
|
1901
1990
|
showTooltip: true
|
|
1902
1991
|
},
|
|
@@ -1914,7 +2003,7 @@ var FlexDirectionField = () => {
|
|
|
1914
2003
|
|
|
1915
2004
|
// src/components/style-sections/layout-section/flex-order-field.tsx
|
|
1916
2005
|
import * as React37 from "react";
|
|
1917
|
-
import { useState as
|
|
2006
|
+
import { useState as useState5 } from "react";
|
|
1918
2007
|
import { ControlToggleButtonGroup, NumberControl } from "@elementor/editor-controls";
|
|
1919
2008
|
import { ArrowDownSmallIcon as ArrowDownSmallIcon2, ArrowUpSmallIcon as ArrowUpSmallIcon2, PencilIcon } from "@elementor/icons";
|
|
1920
2009
|
import { DirectionProvider as DirectionProvider5, Grid as Grid6, ThemeProvider as ThemeProvider5 } from "@elementor/ui";
|
|
@@ -1950,7 +2039,7 @@ var items = [
|
|
|
1950
2039
|
];
|
|
1951
2040
|
var FlexOrderField = () => {
|
|
1952
2041
|
const { isSiteRtl } = useDirection(), [order, setOrder] = useStylesField("order");
|
|
1953
|
-
const [groupControlValue, setGroupControlValue] =
|
|
2042
|
+
const [groupControlValue, setGroupControlValue] = useState5(getGroupControlValue(order?.value || null));
|
|
1954
2043
|
const handleToggleButtonChange = (group) => {
|
|
1955
2044
|
setGroupControlValue(group);
|
|
1956
2045
|
if (!group || group === CUSTOM) {
|
|
@@ -1988,14 +2077,15 @@ var getGroupControlValue = (order) => {
|
|
|
1988
2077
|
|
|
1989
2078
|
// src/components/style-sections/layout-section/flex-size-field.tsx
|
|
1990
2079
|
import * as React38 from "react";
|
|
1991
|
-
import { useMemo as useMemo2, useState as
|
|
2080
|
+
import { useMemo as useMemo2, useState as useState6 } from "react";
|
|
1992
2081
|
import {
|
|
1993
2082
|
ControlToggleButtonGroup as ControlToggleButtonGroup2,
|
|
1994
2083
|
NumberControl as NumberControl2,
|
|
1995
2084
|
SizeControl as SizeControl2
|
|
1996
2085
|
} from "@elementor/editor-controls";
|
|
2086
|
+
import { numberPropTypeUtil } from "@elementor/editor-props";
|
|
1997
2087
|
import { ExpandIcon, PencilIcon as PencilIcon2, ShrinkIcon } from "@elementor/icons";
|
|
1998
|
-
import { DirectionProvider as DirectionProvider6, Grid as Grid7, ThemeProvider as ThemeProvider6
|
|
2088
|
+
import { DirectionProvider as DirectionProvider6, Grid as Grid7, ThemeProvider as ThemeProvider6 } from "@elementor/ui";
|
|
1999
2089
|
import { __ as __17 } from "@wordpress/i18n";
|
|
2000
2090
|
var DEFAULT = 1;
|
|
2001
2091
|
var items2 = [
|
|
@@ -2019,26 +2109,37 @@ var items2 = [
|
|
|
2019
2109
|
}
|
|
2020
2110
|
];
|
|
2021
2111
|
var FlexSizeField = () => {
|
|
2022
|
-
const { isSiteRtl } = useDirection()
|
|
2023
|
-
const
|
|
2024
|
-
const
|
|
2112
|
+
const { isSiteRtl } = useDirection();
|
|
2113
|
+
const [fields, setFields] = useStylesFields(["flex-grow", "flex-shrink", "flex-basis"]);
|
|
2114
|
+
const grow = fields?.["flex-grow"]?.value || null;
|
|
2115
|
+
const shrink = fields?.["flex-shrink"]?.value || null;
|
|
2116
|
+
const basis = fields?.["flex-basis"]?.value || null;
|
|
2117
|
+
const currentGroup = useMemo2(() => getActiveGroup({ grow, shrink, basis }), [grow, shrink, basis]), [activeGroup, setActiveGroup] = useState6(currentGroup);
|
|
2025
2118
|
const onChangeGroup = (group = null) => {
|
|
2026
2119
|
setActiveGroup(group);
|
|
2027
|
-
setBasisField(null);
|
|
2028
2120
|
if (!group || group === "custom") {
|
|
2029
|
-
|
|
2030
|
-
|
|
2121
|
+
setFields({
|
|
2122
|
+
"flex-basis": null,
|
|
2123
|
+
"flex-grow": null,
|
|
2124
|
+
"flex-shrink": null
|
|
2125
|
+
});
|
|
2031
2126
|
return;
|
|
2032
2127
|
}
|
|
2033
2128
|
if (group === "flex-grow") {
|
|
2034
|
-
|
|
2035
|
-
|
|
2129
|
+
setFields({
|
|
2130
|
+
"flex-basis": null,
|
|
2131
|
+
"flex-grow": numberPropTypeUtil.create(DEFAULT),
|
|
2132
|
+
"flex-shrink": null
|
|
2133
|
+
});
|
|
2036
2134
|
return;
|
|
2037
2135
|
}
|
|
2038
|
-
|
|
2039
|
-
|
|
2136
|
+
setFields({
|
|
2137
|
+
"flex-basis": null,
|
|
2138
|
+
"flex-grow": null,
|
|
2139
|
+
"flex-shrink": numberPropTypeUtil.create(DEFAULT)
|
|
2140
|
+
});
|
|
2040
2141
|
};
|
|
2041
|
-
return /* @__PURE__ */ React38.createElement(DirectionProvider6, { rtl: isSiteRtl }, /* @__PURE__ */ React38.createElement(ThemeProvider6, null, /* @__PURE__ */ React38.createElement(SectionContent, null, /* @__PURE__ */ React38.createElement(
|
|
2142
|
+
return /* @__PURE__ */ React38.createElement(DirectionProvider6, { rtl: isSiteRtl }, /* @__PURE__ */ React38.createElement(ThemeProvider6, null, /* @__PURE__ */ React38.createElement(SectionContent, null, /* @__PURE__ */ React38.createElement(Grid7, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React38.createElement(Grid7, { item: true, xs: 6 }, /* @__PURE__ */ React38.createElement(StylesField, { bind: activeGroup ?? "" }, /* @__PURE__ */ React38.createElement(ControlLabel, null, __17("Size", "elementor")))), /* @__PURE__ */ React38.createElement(Grid7, { item: true, xs: 6, sx: { display: "flex", justifyContent: "end" } }, /* @__PURE__ */ React38.createElement(
|
|
2042
2143
|
ControlToggleButtonGroup2,
|
|
2043
2144
|
{
|
|
2044
2145
|
value: activeGroup,
|
|
@@ -2072,10 +2173,10 @@ var getActiveGroup = ({
|
|
|
2072
2173
|
// src/components/style-sections/layout-section/gap-control-field.tsx
|
|
2073
2174
|
import * as React39 from "react";
|
|
2074
2175
|
import { GapControl } from "@elementor/editor-controls";
|
|
2075
|
-
import { Stack as
|
|
2176
|
+
import { Stack as Stack11 } from "@elementor/ui";
|
|
2076
2177
|
import { __ as __18 } from "@wordpress/i18n";
|
|
2077
2178
|
var GapControlField = () => {
|
|
2078
|
-
return /* @__PURE__ */ React39.createElement(
|
|
2179
|
+
return /* @__PURE__ */ React39.createElement(Stack11, { gap: 1 }, /* @__PURE__ */ React39.createElement(StylesField, { bind: "gap" }, /* @__PURE__ */ React39.createElement(GapControl, { label: __18("Gaps", "elementor") })));
|
|
2079
2180
|
};
|
|
2080
2181
|
|
|
2081
2182
|
// src/components/style-sections/layout-section/justify-content-field.tsx
|
|
@@ -2089,7 +2190,7 @@ import {
|
|
|
2089
2190
|
JustifySpaceBetweenVerticalIcon as BetweenIcon2,
|
|
2090
2191
|
JustifyTopIcon as JustifyTopIcon2
|
|
2091
2192
|
} from "@elementor/icons";
|
|
2092
|
-
import { DirectionProvider as DirectionProvider7, Stack as
|
|
2193
|
+
import { DirectionProvider as DirectionProvider7, Stack as Stack12, ThemeProvider as ThemeProvider7, withDirection as withDirection7 } from "@elementor/ui";
|
|
2093
2194
|
import { __ as __19 } from "@wordpress/i18n";
|
|
2094
2195
|
var StartIcon4 = withDirection7(JustifyTopIcon2);
|
|
2095
2196
|
var EndIcon4 = withDirection7(JustifyBottomIcon2);
|
|
@@ -2137,7 +2238,7 @@ var options5 = [
|
|
|
2137
2238
|
];
|
|
2138
2239
|
var JustifyContentField = () => {
|
|
2139
2240
|
const { isSiteRtl } = useDirection();
|
|
2140
|
-
return /* @__PURE__ */ React40.createElement(DirectionProvider7, { rtl: isSiteRtl }, /* @__PURE__ */ React40.createElement(ThemeProvider7, null, /* @__PURE__ */ React40.createElement(StylesField, { bind: "justify-content" }, /* @__PURE__ */ React40.createElement(
|
|
2241
|
+
return /* @__PURE__ */ React40.createElement(DirectionProvider7, { rtl: isSiteRtl }, /* @__PURE__ */ React40.createElement(ThemeProvider7, null, /* @__PURE__ */ React40.createElement(StylesField, { bind: "justify-content" }, /* @__PURE__ */ React40.createElement(Stack12, { gap: 0.75 }, /* @__PURE__ */ React40.createElement(ControlLabel, null, __19("Justify content", "elementor")), /* @__PURE__ */ React40.createElement(ToggleControl6, { options: options5, fullWidth: true })))));
|
|
2141
2242
|
};
|
|
2142
2243
|
|
|
2143
2244
|
// src/components/style-sections/layout-section/wrap-field.tsx
|
|
@@ -2174,16 +2275,25 @@ var WrapField = () => {
|
|
|
2174
2275
|
// src/components/style-sections/layout-section/layout-section.tsx
|
|
2175
2276
|
var LayoutSection = () => {
|
|
2176
2277
|
const [display] = useStylesField("display");
|
|
2278
|
+
const displayPlaceholder = useDisplayPlaceholderValue();
|
|
2279
|
+
const isDisplayFlex = shouldDisplayFlexFields(display, displayPlaceholder);
|
|
2177
2280
|
const { element } = useElement();
|
|
2178
2281
|
const parent = useParentElement(element.id);
|
|
2179
2282
|
const parentStyle = useComputedStyle(parent?.id || null);
|
|
2180
|
-
return /* @__PURE__ */ React42.createElement(SectionContent, null, /* @__PURE__ */ React42.createElement(DisplayField, null),
|
|
2283
|
+
return /* @__PURE__ */ React42.createElement(SectionContent, null, /* @__PURE__ */ React42.createElement(DisplayField, null), isDisplayFlex && /* @__PURE__ */ React42.createElement(FlexFields, null), "flex" === parentStyle?.display && /* @__PURE__ */ React42.createElement(FlexChildFields, null));
|
|
2181
2284
|
};
|
|
2182
2285
|
var FlexFields = () => {
|
|
2183
2286
|
const [flexWrap] = useStylesField("flex-wrap");
|
|
2184
2287
|
return /* @__PURE__ */ React42.createElement(React42.Fragment, null, /* @__PURE__ */ React42.createElement(FlexDirectionField, null), /* @__PURE__ */ React42.createElement(JustifyContentField, null), /* @__PURE__ */ React42.createElement(AlignItemsField, null), /* @__PURE__ */ React42.createElement(PanelDivider, null), /* @__PURE__ */ React42.createElement(GapControlField, null), /* @__PURE__ */ React42.createElement(WrapField, null), ["wrap", "wrap-reverse"].includes(flexWrap?.value) && /* @__PURE__ */ React42.createElement(AlignContentField, null));
|
|
2185
2288
|
};
|
|
2186
2289
|
var FlexChildFields = () => /* @__PURE__ */ React42.createElement(React42.Fragment, null, /* @__PURE__ */ React42.createElement(PanelDivider, null), /* @__PURE__ */ React42.createElement(ControlFormLabel3, null, __21("Flex child", "elementor")), /* @__PURE__ */ React42.createElement(AlignSelfChild, null), /* @__PURE__ */ React42.createElement(FlexOrderField, null), /* @__PURE__ */ React42.createElement(FlexSizeField, null));
|
|
2290
|
+
var shouldDisplayFlexFields = (display, local) => {
|
|
2291
|
+
const value = display?.value ?? local?.value;
|
|
2292
|
+
if (!value) {
|
|
2293
|
+
return false;
|
|
2294
|
+
}
|
|
2295
|
+
return "flex" === value || "inline-flex" === value;
|
|
2296
|
+
};
|
|
2187
2297
|
|
|
2188
2298
|
// src/components/style-sections/position-section/position-section.tsx
|
|
2189
2299
|
import * as React46 from "react";
|
|
@@ -2193,7 +2303,7 @@ import { useSessionStorage } from "@elementor/session";
|
|
|
2193
2303
|
import * as React43 from "react";
|
|
2194
2304
|
import { SizeControl as SizeControl3 } from "@elementor/editor-controls";
|
|
2195
2305
|
import { SideBottomIcon as SideBottomIcon2, SideLeftIcon as SideLeftIcon2, SideRightIcon as SideRightIcon2, SideTopIcon as SideTopIcon2 } from "@elementor/icons";
|
|
2196
|
-
import { Grid as Grid9, Stack as
|
|
2306
|
+
import { Grid as Grid9, Stack as Stack13, withDirection as withDirection8 } from "@elementor/ui";
|
|
2197
2307
|
import { __ as __22 } from "@wordpress/i18n";
|
|
2198
2308
|
var InlineStartIcon2 = withDirection8(SideLeftIcon2);
|
|
2199
2309
|
var InlineEndIcon2 = withDirection8(SideRightIcon2);
|
|
@@ -2207,7 +2317,7 @@ var getInlineStartLabel = (isSiteRtl) => isSiteRtl ? __22("Right", "elementor")
|
|
|
2207
2317
|
var getInlineEndLabel = (isSiteRtl) => isSiteRtl ? __22("Left", "elementor") : __22("Right", "elementor");
|
|
2208
2318
|
var DimensionsField = () => {
|
|
2209
2319
|
const { isSiteRtl } = useDirection();
|
|
2210
|
-
return /* @__PURE__ */ React43.createElement(React43.Fragment, null, /* @__PURE__ */ React43.createElement(
|
|
2320
|
+
return /* @__PURE__ */ React43.createElement(React43.Fragment, null, /* @__PURE__ */ React43.createElement(Stack13, { direction: "row", gap: 2, flexWrap: "nowrap" }, /* @__PURE__ */ React43.createElement(DimensionField, { side: "inset-block-start", label: __22("Top", "elementor") }), /* @__PURE__ */ React43.createElement(DimensionField, { side: "inset-inline-end", label: getInlineEndLabel(isSiteRtl) })), /* @__PURE__ */ React43.createElement(Stack13, { direction: "row", gap: 2, flexWrap: "nowrap" }, /* @__PURE__ */ React43.createElement(DimensionField, { side: "inset-block-end", label: __22("Bottom", "elementor") }), /* @__PURE__ */ React43.createElement(DimensionField, { side: "inset-inline-start", label: getInlineStartLabel(isSiteRtl) })));
|
|
2211
2321
|
};
|
|
2212
2322
|
var DimensionField = ({ side, label }) => {
|
|
2213
2323
|
return /* @__PURE__ */ React43.createElement(Grid9, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React43.createElement(Grid9, { item: true, xs: 12 }, /* @__PURE__ */ React43.createElement(ControlLabel, null, label)), /* @__PURE__ */ React43.createElement(Grid9, { item: true, xs: 12 }, /* @__PURE__ */ React43.createElement(StylesField, { bind: side }, /* @__PURE__ */ React43.createElement(SizeControl3, { startIcon: sideIcons[side], extendedValues: ["auto"] }))));
|
|
@@ -2279,7 +2389,7 @@ var usePersistDimensions = () => {
|
|
|
2279
2389
|
// src/components/style-sections/size-section/size-section.tsx
|
|
2280
2390
|
import * as React48 from "react";
|
|
2281
2391
|
import { SizeControl as SizeControl4 } from "@elementor/editor-controls";
|
|
2282
|
-
import { Grid as Grid13, Stack as
|
|
2392
|
+
import { Grid as Grid13, Stack as Stack14 } from "@elementor/ui";
|
|
2283
2393
|
import { __ as __26 } from "@wordpress/i18n";
|
|
2284
2394
|
|
|
2285
2395
|
// src/components/style-sections/size-section/overflow-field.tsx
|
|
@@ -2328,7 +2438,7 @@ var SizeSection = () => {
|
|
|
2328
2438
|
label: __26("Min height", "elementor"),
|
|
2329
2439
|
extendedValues: ["auto"]
|
|
2330
2440
|
}
|
|
2331
|
-
))), /* @__PURE__ */ React48.createElement(Grid13, { container: true, gap: 2, flexWrap: "nowrap" }, /* @__PURE__ */ React48.createElement(Grid13, { item: true, xs: 6 }, /* @__PURE__ */ React48.createElement(SizeField, { bind: "max-width", label: __26("Max width", "elementor") })), /* @__PURE__ */ React48.createElement(Grid13, { item: true, xs: 6 }, /* @__PURE__ */ React48.createElement(SizeField, { bind: "max-height", label: __26("Max height", "elementor") }))), /* @__PURE__ */ React48.createElement(PanelDivider, null), /* @__PURE__ */ React48.createElement(
|
|
2441
|
+
))), /* @__PURE__ */ React48.createElement(Grid13, { container: true, gap: 2, flexWrap: "nowrap" }, /* @__PURE__ */ React48.createElement(Grid13, { item: true, xs: 6 }, /* @__PURE__ */ React48.createElement(SizeField, { bind: "max-width", label: __26("Max width", "elementor") })), /* @__PURE__ */ React48.createElement(Grid13, { item: true, xs: 6 }, /* @__PURE__ */ React48.createElement(SizeField, { bind: "max-height", label: __26("Max height", "elementor") }))), /* @__PURE__ */ React48.createElement(PanelDivider, null), /* @__PURE__ */ React48.createElement(Stack14, null, /* @__PURE__ */ React48.createElement(OverflowField, null)));
|
|
2332
2442
|
};
|
|
2333
2443
|
var SizeField = ({ label, bind, extendedValues }) => {
|
|
2334
2444
|
return /* @__PURE__ */ React48.createElement(StylesField, { bind }, /* @__PURE__ */ React48.createElement(Grid13, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React48.createElement(Grid13, { item: true, xs: 12 }, /* @__PURE__ */ React48.createElement(ControlLabel, null, label)), /* @__PURE__ */ React48.createElement(Grid13, { item: true, xs: 12 }, /* @__PURE__ */ React48.createElement(SizeControl4, { extendedValues }))));
|
|
@@ -2355,15 +2465,15 @@ import * as React64 from "react";
|
|
|
2355
2465
|
|
|
2356
2466
|
// src/components/collapsible-content.tsx
|
|
2357
2467
|
import * as React50 from "react";
|
|
2358
|
-
import { useState as
|
|
2359
|
-
import { Button, Collapse as Collapse3, Stack as
|
|
2468
|
+
import { useState as useState7 } from "react";
|
|
2469
|
+
import { Button, Collapse as Collapse3, Stack as Stack15 } from "@elementor/ui";
|
|
2360
2470
|
import { __ as __28 } from "@wordpress/i18n";
|
|
2361
2471
|
var CollapsibleContent = ({ children, defaultOpen = false }) => {
|
|
2362
|
-
const [open, setOpen] =
|
|
2472
|
+
const [open, setOpen] = useState7(defaultOpen);
|
|
2363
2473
|
const handleToggle = () => {
|
|
2364
2474
|
setOpen((prevOpen) => !prevOpen);
|
|
2365
2475
|
};
|
|
2366
|
-
return /* @__PURE__ */ React50.createElement(
|
|
2476
|
+
return /* @__PURE__ */ React50.createElement(Stack15, null, /* @__PURE__ */ React50.createElement(
|
|
2367
2477
|
Button,
|
|
2368
2478
|
{
|
|
2369
2479
|
fullWidth: true,
|
|
@@ -2513,13 +2623,13 @@ import { ToggleControl as ToggleControl10 } from "@elementor/editor-controls";
|
|
|
2513
2623
|
import { AlignCenterIcon, AlignJustifiedIcon, AlignLeftIcon, AlignRightIcon } from "@elementor/icons";
|
|
2514
2624
|
import { Grid as Grid20, withDirection as withDirection9 } from "@elementor/ui";
|
|
2515
2625
|
import { __ as __36 } from "@wordpress/i18n";
|
|
2516
|
-
var
|
|
2517
|
-
var
|
|
2626
|
+
var AlignStartIcon = withDirection9(AlignLeftIcon);
|
|
2627
|
+
var AlignEndIcon = withDirection9(AlignRightIcon);
|
|
2518
2628
|
var options9 = [
|
|
2519
2629
|
{
|
|
2520
2630
|
value: "start",
|
|
2521
2631
|
label: __36("Start", "elementor"),
|
|
2522
|
-
renderContent: () => /* @__PURE__ */ React57.createElement(
|
|
2632
|
+
renderContent: ({ size }) => /* @__PURE__ */ React57.createElement(AlignStartIcon, { fontSize: size }),
|
|
2523
2633
|
showTooltip: true
|
|
2524
2634
|
},
|
|
2525
2635
|
{
|
|
@@ -2531,7 +2641,7 @@ var options9 = [
|
|
|
2531
2641
|
{
|
|
2532
2642
|
value: "end",
|
|
2533
2643
|
label: __36("End", "elementor"),
|
|
2534
|
-
renderContent: () => /* @__PURE__ */ React57.createElement(
|
|
2644
|
+
renderContent: ({ size }) => /* @__PURE__ */ React57.createElement(AlignEndIcon, { fontSize: size }),
|
|
2535
2645
|
showTooltip: true
|
|
2536
2646
|
},
|
|
2537
2647
|
{
|
|
@@ -2542,7 +2652,7 @@ var options9 = [
|
|
|
2542
2652
|
}
|
|
2543
2653
|
];
|
|
2544
2654
|
var TextAlignmentField = () => {
|
|
2545
|
-
return /* @__PURE__ */ React57.createElement(StylesField, { bind: "text-align" }, /* @__PURE__ */ React57.createElement(Grid20, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React57.createElement(Grid20, { item: true, xs: 6 }, /* @__PURE__ */ React57.createElement(ControlLabel, null, __36("
|
|
2655
|
+
return /* @__PURE__ */ React57.createElement(StylesField, { bind: "text-align" }, /* @__PURE__ */ React57.createElement(Grid20, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React57.createElement(Grid20, { item: true, xs: 6 }, /* @__PURE__ */ React57.createElement(ControlLabel, null, __36("Text align", "elementor"))), /* @__PURE__ */ React57.createElement(Grid20, { item: true, xs: 6, display: "flex", justifyContent: "end" }, /* @__PURE__ */ React57.createElement(ToggleControl10, { options: options9 }))));
|
|
2546
2656
|
};
|
|
2547
2657
|
|
|
2548
2658
|
// src/components/style-sections/typography-section/text-color-field.tsx
|
|
@@ -2706,7 +2816,7 @@ var TypographySection = () => {
|
|
|
2706
2816
|
var StyleTab = () => {
|
|
2707
2817
|
const currentClassesProp = useCurrentClassesProp();
|
|
2708
2818
|
const [activeStyleDefId, setActiveStyleDefId] = useActiveStyleDefId(currentClassesProp);
|
|
2709
|
-
const [activeStyleState, setActiveStyleState] =
|
|
2819
|
+
const [activeStyleState, setActiveStyleState] = useState8(null);
|
|
2710
2820
|
const breakpoint = useActiveBreakpoint();
|
|
2711
2821
|
return /* @__PURE__ */ React65.createElement(ClassesPropProvider, { prop: currentClassesProp }, /* @__PURE__ */ React65.createElement(
|
|
2712
2822
|
StyleProvider,
|
|
@@ -2722,17 +2832,6 @@ var StyleTab = () => {
|
|
|
2722
2832
|
/* @__PURE__ */ React65.createElement(SessionStorageProvider2, { prefix: activeStyleDefId ?? "" }, /* @__PURE__ */ React65.createElement(StyleInheritanceProvider, null, /* @__PURE__ */ React65.createElement(CssClassSelector, null), /* @__PURE__ */ React65.createElement(Divider4, null), /* @__PURE__ */ React65.createElement(SectionsList, null, /* @__PURE__ */ React65.createElement(Section, { title: __43("Layout", "elementor") }, /* @__PURE__ */ React65.createElement(LayoutSection, null)), /* @__PURE__ */ React65.createElement(Section, { title: __43("Spacing", "elementor") }, /* @__PURE__ */ React65.createElement(SpacingSection, null)), /* @__PURE__ */ React65.createElement(Section, { title: __43("Size", "elementor") }, /* @__PURE__ */ React65.createElement(SizeSection, null)), /* @__PURE__ */ React65.createElement(Section, { title: __43("Position", "elementor") }, /* @__PURE__ */ React65.createElement(PositionSection, null)), /* @__PURE__ */ React65.createElement(Section, { title: __43("Typography", "elementor") }, /* @__PURE__ */ React65.createElement(TypographySection, null)), /* @__PURE__ */ React65.createElement(Section, { title: __43("Background", "elementor") }, /* @__PURE__ */ React65.createElement(BackgroundSection, null)), /* @__PURE__ */ React65.createElement(Section, { title: __43("Border", "elementor") }, /* @__PURE__ */ React65.createElement(BorderSection, null)), /* @__PURE__ */ React65.createElement(Section, { title: __43("Effects", "elementor") }, /* @__PURE__ */ React65.createElement(EffectsSection, null)))))
|
|
2723
2833
|
));
|
|
2724
2834
|
};
|
|
2725
|
-
function useActiveStyleDefId(currentClassesProp) {
|
|
2726
|
-
const [activeStyledDefId, setActiveStyledDefId] = useState7(null);
|
|
2727
|
-
const fallback = useFirstElementStyleDef(currentClassesProp);
|
|
2728
|
-
return [activeStyledDefId || fallback?.id || null, setActiveStyledDefId];
|
|
2729
|
-
}
|
|
2730
|
-
function useFirstElementStyleDef(currentClassesProp) {
|
|
2731
|
-
const { element } = useElement();
|
|
2732
|
-
const classesIds = useElementSetting5(element.id, currentClassesProp)?.value || [];
|
|
2733
|
-
const stylesDefs = getElementStyles(element.id) ?? {};
|
|
2734
|
-
return Object.values(stylesDefs).find((styleDef) => classesIds.includes(styleDef.id));
|
|
2735
|
-
}
|
|
2736
2835
|
function useCurrentClassesProp() {
|
|
2737
2836
|
const { elementType } = useElement();
|
|
2738
2837
|
const prop = Object.entries(elementType.propsSchema).find(
|
|
@@ -2751,19 +2850,7 @@ var EditingPanelTabs = () => {
|
|
|
2751
2850
|
return (
|
|
2752
2851
|
// When switching between elements, the local states should be reset. We are using key to rerender the tabs.
|
|
2753
2852
|
// Reference: https://react.dev/learn/preserving-and-resetting-state#resetting-a-form-with-a-key
|
|
2754
|
-
/* @__PURE__ */ React66.createElement(Fragment8, { key: element.id }, /* @__PURE__ */ React66.createElement(
|
|
2755
|
-
Tabs,
|
|
2756
|
-
{
|
|
2757
|
-
variant: "fullWidth",
|
|
2758
|
-
indicatorColor: "secondary",
|
|
2759
|
-
textColor: "inherit",
|
|
2760
|
-
size: "small",
|
|
2761
|
-
sx: { mt: 0.5 },
|
|
2762
|
-
...getTabsProps()
|
|
2763
|
-
},
|
|
2764
|
-
/* @__PURE__ */ React66.createElement(Tab, { label: __44("General", "elementor"), ...getTabProps("settings") }),
|
|
2765
|
-
/* @__PURE__ */ React66.createElement(Tab, { label: __44("Style", "elementor"), ...getTabProps("style") })
|
|
2766
|
-
), /* @__PURE__ */ React66.createElement(Divider5, null), /* @__PURE__ */ React66.createElement(TabPanel, { ...getTabPanelProps("settings"), disablePadding: true }, /* @__PURE__ */ React66.createElement(SettingsTab, null)), /* @__PURE__ */ React66.createElement(TabPanel, { ...getTabPanelProps("style"), disablePadding: true }, /* @__PURE__ */ React66.createElement(StyleTab, null))))
|
|
2853
|
+
/* @__PURE__ */ React66.createElement(Fragment8, { key: element.id }, /* @__PURE__ */ React66.createElement(Stack16, { direction: "column", sx: { width: "100%" } }, /* @__PURE__ */ React66.createElement(Tabs, { variant: "fullWidth", size: "small", sx: { mt: 0.5 }, ...getTabsProps() }, /* @__PURE__ */ React66.createElement(Tab, { label: __44("General", "elementor"), ...getTabProps("settings") }), /* @__PURE__ */ React66.createElement(Tab, { label: __44("Style", "elementor"), ...getTabProps("style") })), /* @__PURE__ */ React66.createElement(Divider5, null), /* @__PURE__ */ React66.createElement(TabPanel, { ...getTabPanelProps("settings"), disablePadding: true }, /* @__PURE__ */ React66.createElement(SettingsTab, null)), /* @__PURE__ */ React66.createElement(TabPanel, { ...getTabPanelProps("style"), disablePadding: true }, /* @__PURE__ */ React66.createElement(StyleTab, null))))
|
|
2767
2854
|
);
|
|
2768
2855
|
};
|
|
2769
2856
|
|
|
@@ -2825,6 +2912,9 @@ var EditingPanelHooks = () => {
|
|
|
2825
2912
|
return null;
|
|
2826
2913
|
};
|
|
2827
2914
|
|
|
2915
|
+
// src/dynamics/init.ts
|
|
2916
|
+
import { settingsTransformersRegistry, styleTransformersRegistry } from "@elementor/editor-canvas";
|
|
2917
|
+
|
|
2828
2918
|
// src/dynamics/components/dynamic-selection-control.tsx
|
|
2829
2919
|
import * as React71 from "react";
|
|
2830
2920
|
import { useId as useId4 } from "react";
|
|
@@ -2839,11 +2929,11 @@ import {
|
|
|
2839
2929
|
IconButton as IconButton3,
|
|
2840
2930
|
Paper,
|
|
2841
2931
|
Popover as Popover2,
|
|
2842
|
-
Stack as
|
|
2932
|
+
Stack as Stack19,
|
|
2843
2933
|
Tab as Tab2,
|
|
2844
2934
|
TabPanel as TabPanel2,
|
|
2845
2935
|
Tabs as Tabs2,
|
|
2846
|
-
Typography as
|
|
2936
|
+
Typography as Typography4,
|
|
2847
2937
|
UnstableTag as Tag,
|
|
2848
2938
|
usePopupState as usePopupState3,
|
|
2849
2939
|
useTabs as useTabs2
|
|
@@ -2852,8 +2942,8 @@ import { __ as __47 } from "@wordpress/i18n";
|
|
|
2852
2942
|
|
|
2853
2943
|
// src/components/popover-content.tsx
|
|
2854
2944
|
import * as React68 from "react";
|
|
2855
|
-
import { Stack as
|
|
2856
|
-
var PopoverContent = ({ alignItems, gap = 1.5, p, children }) => /* @__PURE__ */ React68.createElement(
|
|
2945
|
+
import { Stack as Stack17 } from "@elementor/ui";
|
|
2946
|
+
var PopoverContent = ({ alignItems, gap = 1.5, p, children }) => /* @__PURE__ */ React68.createElement(Stack17, { alignItems, gap, p }, children);
|
|
2857
2947
|
|
|
2858
2948
|
// src/hooks/use-persist-dynamic-value.ts
|
|
2859
2949
|
import { useSessionStorage as useSessionStorage2 } from "@elementor/session";
|
|
@@ -2971,7 +3061,7 @@ var DynamicControl = ({ bind, children }) => {
|
|
|
2971
3061
|
|
|
2972
3062
|
// src/dynamics/components/dynamic-selection.tsx
|
|
2973
3063
|
import * as React70 from "react";
|
|
2974
|
-
import { Fragment as Fragment9, useState as
|
|
3064
|
+
import { Fragment as Fragment9, useState as useState9 } from "react";
|
|
2975
3065
|
import { useBoundProp as useBoundProp4 } from "@elementor/editor-controls";
|
|
2976
3066
|
import { DatabaseIcon, SearchIcon } from "@elementor/icons";
|
|
2977
3067
|
import {
|
|
@@ -2982,14 +3072,14 @@ import {
|
|
|
2982
3072
|
MenuItem,
|
|
2983
3073
|
MenuList,
|
|
2984
3074
|
MenuSubheader as MenuSubheader2,
|
|
2985
|
-
Stack as
|
|
3075
|
+
Stack as Stack18,
|
|
2986
3076
|
TextField as TextField2,
|
|
2987
|
-
Typography as
|
|
3077
|
+
Typography as Typography3
|
|
2988
3078
|
} from "@elementor/ui";
|
|
2989
3079
|
import { __ as __46 } from "@wordpress/i18n";
|
|
2990
3080
|
var SIZE3 = "tiny";
|
|
2991
3081
|
var DynamicSelection = ({ onSelect }) => {
|
|
2992
|
-
const [searchValue, setSearchValue] =
|
|
3082
|
+
const [searchValue, setSearchValue] = useState9("");
|
|
2993
3083
|
const { groups: dynamicGroups } = getAtomicDynamicTags() || {};
|
|
2994
3084
|
const { value: anyValue } = useBoundProp4();
|
|
2995
3085
|
const { bind, value: dynamicValue, setValue } = useBoundProp4(dynamicPropTypeUtil);
|
|
@@ -3007,7 +3097,7 @@ var DynamicSelection = ({ onSelect }) => {
|
|
|
3007
3097
|
setValue({ name: value, settings: { label } });
|
|
3008
3098
|
onSelect?.();
|
|
3009
3099
|
};
|
|
3010
|
-
return /* @__PURE__ */ React70.createElement(
|
|
3100
|
+
return /* @__PURE__ */ React70.createElement(Stack18, null, hasNoDynamicTags ? /* @__PURE__ */ React70.createElement(NoDynamicTags, null) : /* @__PURE__ */ React70.createElement(Fragment9, null, /* @__PURE__ */ React70.createElement(Box4, { px: 1.5, pb: 1 }, /* @__PURE__ */ React70.createElement(
|
|
3011
3101
|
TextField2,
|
|
3012
3102
|
{
|
|
3013
3103
|
fullWidth: true,
|
|
@@ -3041,7 +3131,7 @@ var DynamicSelection = ({ onSelect }) => {
|
|
|
3041
3131
|
})))) : /* @__PURE__ */ React70.createElement(NoResults, { searchValue, onClear: () => setSearchValue("") }))));
|
|
3042
3132
|
};
|
|
3043
3133
|
var NoResults = ({ searchValue, onClear }) => /* @__PURE__ */ React70.createElement(
|
|
3044
|
-
|
|
3134
|
+
Stack18,
|
|
3045
3135
|
{
|
|
3046
3136
|
gap: 1,
|
|
3047
3137
|
alignItems: "center",
|
|
@@ -3052,11 +3142,11 @@ var NoResults = ({ searchValue, onClear }) => /* @__PURE__ */ React70.createElem
|
|
|
3052
3142
|
sx: { pb: 3.5 }
|
|
3053
3143
|
},
|
|
3054
3144
|
/* @__PURE__ */ React70.createElement(DatabaseIcon, { fontSize: "large" }),
|
|
3055
|
-
/* @__PURE__ */ React70.createElement(
|
|
3056
|
-
/* @__PURE__ */ React70.createElement(
|
|
3145
|
+
/* @__PURE__ */ React70.createElement(Typography3, { align: "center", variant: "subtitle2" }, __46("Sorry, nothing matched", "elementor"), /* @__PURE__ */ React70.createElement("br", null), "\u201C", searchValue, "\u201D."),
|
|
3146
|
+
/* @__PURE__ */ React70.createElement(Typography3, { align: "center", variant: "caption" }, __46("Try something else.", "elementor"), "\xA0", /* @__PURE__ */ React70.createElement(Link, { color: "text.secondary", variant: "caption", component: "button", onClick: onClear }, __46("Clear & try again", "elementor")))
|
|
3057
3147
|
);
|
|
3058
3148
|
var NoDynamicTags = () => /* @__PURE__ */ React70.createElement(Box4, { sx: { overflowY: "hidden", height: 297, width: 220 } }, /* @__PURE__ */ React70.createElement(Divider6, null), /* @__PURE__ */ React70.createElement(
|
|
3059
|
-
|
|
3149
|
+
Stack18,
|
|
3060
3150
|
{
|
|
3061
3151
|
gap: 1,
|
|
3062
3152
|
alignItems: "center",
|
|
@@ -3067,8 +3157,8 @@ var NoDynamicTags = () => /* @__PURE__ */ React70.createElement(Box4, { sx: { ov
|
|
|
3067
3157
|
sx: { pb: 3.5 }
|
|
3068
3158
|
},
|
|
3069
3159
|
/* @__PURE__ */ React70.createElement(DatabaseIcon, { fontSize: "large" }),
|
|
3070
|
-
/* @__PURE__ */ React70.createElement(
|
|
3071
|
-
/* @__PURE__ */ React70.createElement(
|
|
3160
|
+
/* @__PURE__ */ React70.createElement(Typography3, { align: "center", variant: "subtitle2" }, __46("Streamline your workflow with dynamic tags", "elementor")),
|
|
3161
|
+
/* @__PURE__ */ React70.createElement(Typography3, { align: "center", variant: "caption" }, __46("You\u2019ll need Elementor Pro to use this feature.", "elementor"))
|
|
3072
3162
|
));
|
|
3073
3163
|
var useFilteredOptions = (searchValue) => {
|
|
3074
3164
|
const dynamicTags = usePropDynamicTags();
|
|
@@ -3128,7 +3218,7 @@ var DynamicSelectionControl = () => {
|
|
|
3128
3218
|
anchorOrigin: { vertical: "bottom", horizontal: "left" },
|
|
3129
3219
|
...bindPopover2(selectionPopoverState)
|
|
3130
3220
|
},
|
|
3131
|
-
/* @__PURE__ */ React71.createElement(
|
|
3221
|
+
/* @__PURE__ */ React71.createElement(Stack19, null, /* @__PURE__ */ React71.createElement(Stack19, { direction: "row", alignItems: "center", pl: 1.5, pr: 0.5, py: 1.5 }, /* @__PURE__ */ React71.createElement(DatabaseIcon2, { fontSize: SIZE4, sx: { mr: 0.5 } }), /* @__PURE__ */ React71.createElement(Typography4, { variant: "subtitle2" }, __47("Dynamic tags", "elementor")), /* @__PURE__ */ React71.createElement(IconButton3, { size: SIZE4, sx: { ml: "auto" }, onClick: selectionPopoverState.close }, /* @__PURE__ */ React71.createElement(XIcon2, { fontSize: SIZE4 }))), /* @__PURE__ */ React71.createElement(DynamicSelection, { onSelect: selectionPopoverState.close }))
|
|
3132
3222
|
));
|
|
3133
3223
|
};
|
|
3134
3224
|
var DynamicSettingsPopover = ({ dynamicTag }) => {
|
|
@@ -3153,7 +3243,7 @@ var DynamicSettingsPopover = ({ dynamicTag }) => {
|
|
|
3153
3243
|
anchorOrigin: { vertical: "bottom", horizontal: "center" },
|
|
3154
3244
|
...bindPopover2(settingsPopupState)
|
|
3155
3245
|
},
|
|
3156
|
-
/* @__PURE__ */ React71.createElement(Paper, { component:
|
|
3246
|
+
/* @__PURE__ */ React71.createElement(Paper, { component: Stack19, sx: { minHeight: "300px", width: "220px" } }, /* @__PURE__ */ React71.createElement(Stack19, { direction: "row", alignItems: "center", px: 1.5, pt: 2, pb: 1 }, /* @__PURE__ */ React71.createElement(DatabaseIcon2, { fontSize: SIZE4, sx: { mr: 0.5 } }), /* @__PURE__ */ React71.createElement(Typography4, { variant: "subtitle2" }, dynamicTag.label), /* @__PURE__ */ React71.createElement(IconButton3, { sx: { ml: "auto" }, size: SIZE4, onClick: settingsPopupState.close }, /* @__PURE__ */ React71.createElement(XIcon2, { fontSize: SIZE4 }))), /* @__PURE__ */ React71.createElement(DynamicSettings, { controls: dynamicTag.atomic_controls }))
|
|
3157
3247
|
));
|
|
3158
3248
|
};
|
|
3159
3249
|
var DynamicSettings = ({ controls }) => {
|
|
@@ -3178,6 +3268,55 @@ var Control3 = ({ control }) => {
|
|
|
3178
3268
|
return /* @__PURE__ */ React71.createElement(DynamicControl, { bind: control.bind }, /* @__PURE__ */ React71.createElement(Grid26, { container: true, gap: 0.75 }, control.label ? /* @__PURE__ */ React71.createElement(Grid26, { item: true, xs: 12 }, /* @__PURE__ */ React71.createElement(ControlFormLabel5, null, control.label)) : null, /* @__PURE__ */ React71.createElement(Grid26, { item: true, xs: 12 }, /* @__PURE__ */ React71.createElement(Control, { type: control.type, props: control.props }))));
|
|
3179
3269
|
};
|
|
3180
3270
|
|
|
3271
|
+
// src/dynamics/dynamic-transformer.ts
|
|
3272
|
+
import { createTransformer } from "@elementor/editor-canvas";
|
|
3273
|
+
import { isTransformable as isTransformable2 } from "@elementor/editor-props";
|
|
3274
|
+
|
|
3275
|
+
// src/dynamics/errors.ts
|
|
3276
|
+
import { createError as createError2 } from "@elementor/utils";
|
|
3277
|
+
var DynamicTagsManagerNotFoundError = createError2({
|
|
3278
|
+
code: "dynamic_tags_manager_not_found",
|
|
3279
|
+
message: "Dynamic tags manager not found"
|
|
3280
|
+
});
|
|
3281
|
+
|
|
3282
|
+
// src/dynamics/dynamic-transformer.ts
|
|
3283
|
+
var dynamicTransformer = createTransformer((value) => {
|
|
3284
|
+
if (!value.name) {
|
|
3285
|
+
return null;
|
|
3286
|
+
}
|
|
3287
|
+
return getDynamicValue(value.name, simpleTransform(value.settings ?? {}));
|
|
3288
|
+
});
|
|
3289
|
+
function simpleTransform(props) {
|
|
3290
|
+
const transformed = Object.entries(props).map(([settingKey, settingValue]) => {
|
|
3291
|
+
const value = isTransformable2(settingValue) ? settingValue.value : settingValue;
|
|
3292
|
+
return [settingKey, value];
|
|
3293
|
+
});
|
|
3294
|
+
return Object.fromEntries(transformed);
|
|
3295
|
+
}
|
|
3296
|
+
function getDynamicValue(name, settings) {
|
|
3297
|
+
const extendedWindow = window;
|
|
3298
|
+
const { dynamicTags } = extendedWindow.elementor ?? {};
|
|
3299
|
+
if (!dynamicTags) {
|
|
3300
|
+
throw new DynamicTagsManagerNotFoundError();
|
|
3301
|
+
}
|
|
3302
|
+
const getTagValue = () => {
|
|
3303
|
+
const tag = dynamicTags.createTag("v4-dynamic-tag", name, settings);
|
|
3304
|
+
if (!tag) {
|
|
3305
|
+
return null;
|
|
3306
|
+
}
|
|
3307
|
+
return dynamicTags.loadTagDataFromCache(tag) ?? null;
|
|
3308
|
+
};
|
|
3309
|
+
const tagValue = getTagValue();
|
|
3310
|
+
if (tagValue !== null) {
|
|
3311
|
+
return tagValue;
|
|
3312
|
+
}
|
|
3313
|
+
return new Promise((resolve) => {
|
|
3314
|
+
dynamicTags.refreshCacheFromServer(() => {
|
|
3315
|
+
resolve(getTagValue());
|
|
3316
|
+
});
|
|
3317
|
+
});
|
|
3318
|
+
}
|
|
3319
|
+
|
|
3181
3320
|
// src/dynamics/hooks/use-prop-dynamic-action.tsx
|
|
3182
3321
|
import * as React72 from "react";
|
|
3183
3322
|
import { useBoundProp as useBoundProp6 } from "@elementor/editor-controls";
|
|
@@ -3205,6 +3344,8 @@ var init = () => {
|
|
|
3205
3344
|
id: "dynamic-tags",
|
|
3206
3345
|
useProps: usePropDynamicAction
|
|
3207
3346
|
});
|
|
3347
|
+
styleTransformersRegistry.register("dynamic", dynamicTransformer);
|
|
3348
|
+
settingsTransformersRegistry.register("dynamic", dynamicTransformer);
|
|
3208
3349
|
};
|
|
3209
3350
|
|
|
3210
3351
|
// src/init.ts
|
|
@@ -3227,10 +3368,8 @@ var blockV1Panel = () => {
|
|
|
3227
3368
|
condition: isAtomicWidgetSelected
|
|
3228
3369
|
});
|
|
3229
3370
|
};
|
|
3230
|
-
|
|
3231
|
-
// src/index.ts
|
|
3232
|
-
init2();
|
|
3233
3371
|
export {
|
|
3372
|
+
init2 as init,
|
|
3234
3373
|
injectIntoClassSelectorActions,
|
|
3235
3374
|
replaceControl,
|
|
3236
3375
|
useBoundProp7 as useBoundProp,
|