@elementor/editor-editing-panel 1.41.0 → 1.43.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/dist/index.mjs CHANGED
@@ -8,16 +8,15 @@ var { registerControlReplacement, getControlReplacements } = createControlReplac
8
8
  // src/components/css-classes/css-class-selector.tsx
9
9
  import * as React8 from "react";
10
10
  import { useRef, useState as useState4 } from "react";
11
- import { getElementSetting as getElementSetting2, updateElementSettings as updateElementSettings2, useElementSetting } from "@elementor/editor-elements";
12
- import { classesPropTypeUtil as classesPropTypeUtil2 } from "@elementor/editor-props";
11
+ import { useElementSetting } from "@elementor/editor-elements";
13
12
  import {
14
13
  isElementsStylesProvider as isElementsStylesProvider2,
15
14
  stylesRepository as stylesRepository4,
16
- useGetStylesRepositoryCreateAction,
17
15
  useProviders,
16
+ useUserStylesCapability as useUserStylesCapability4,
18
17
  validateStyleLabel as validateStyleLabel2
19
18
  } from "@elementor/editor-styles-repository";
20
- import { WarningInfotip } from "@elementor/editor-ui";
19
+ import { InfoAlert, WarningInfotip } from "@elementor/editor-ui";
21
20
  import { ColorSwatchIcon, MapPinIcon } from "@elementor/icons";
22
21
  import { createLocation } from "@elementor/locations";
23
22
  import { Box as Box2, Chip as Chip3, FormLabel, Link, Stack as Stack3, Typography as Typography3 } from "@elementor/ui";
@@ -441,7 +440,7 @@ var StyledGroupItems = styled("ul")`
441
440
  // src/components/css-classes/css-class-item.tsx
442
441
  import * as React7 from "react";
443
442
  import { useState as useState3 } from "react";
444
- import { stylesRepository as stylesRepository3, validateStyleLabel } from "@elementor/editor-styles-repository";
443
+ import { stylesRepository as stylesRepository3, useUserStylesCapability as useUserStylesCapability3, validateStyleLabel } from "@elementor/editor-styles-repository";
445
444
  import { EditableField, EllipsisWithTooltip, useEditable } from "@elementor/editor-ui";
446
445
  import { DotsVerticalIcon } from "@elementor/icons";
447
446
  import {
@@ -507,12 +506,20 @@ import { useCallback, useMemo as useMemo2 } from "react";
507
506
  import { setDocumentModifiedStatus } from "@elementor/editor-documents";
508
507
  import { getElementLabel, getElementSetting, updateElementSettings } from "@elementor/editor-elements";
509
508
  import { classesPropTypeUtil } from "@elementor/editor-props";
509
+ import { useGetStylesRepositoryCreateAction } from "@elementor/editor-styles-repository";
510
510
  import { isExperimentActive, undoable } from "@elementor/editor-v1-adapters";
511
511
  import { __ } from "@wordpress/i18n";
512
+
513
+ // src/sync/experiments-flags.ts
514
+ var EXPERIMENTAL_FEATURES = {
515
+ V_3_30: "e_v_3_30"
516
+ };
517
+
518
+ // src/components/css-classes/use-apply-and-unapply-class.ts
512
519
  function useApplyClass() {
513
520
  const { id: activeId, setId: setActiveId } = useStyle();
514
521
  const { element } = useElement();
515
- const isVersion330Active = isExperimentActive("e_v_3_30");
522
+ const isVersion330Active = isExperimentActive(EXPERIMENTAL_FEATURES.V_3_30);
516
523
  const applyClass = useApply();
517
524
  const unapplyClass = useUnapply();
518
525
  const undoableApply = useMemo2(() => {
@@ -547,7 +554,7 @@ function useApplyClass() {
547
554
  function useUnapplyClass() {
548
555
  const { id: activeId, setId: setActiveId } = useStyle();
549
556
  const { element } = useElement();
550
- const isVersion330Active = isExperimentActive("e_v_3_30");
557
+ const isVersion330Active = isExperimentActive(EXPERIMENTAL_FEATURES.V_3_30);
551
558
  const applyClass = useApply();
552
559
  const unapplyClass = useUnapply();
553
560
  const undoableUnapply = useMemo2(() => {
@@ -579,10 +586,58 @@ function useUnapplyClass() {
579
586
  );
580
587
  return isVersion330Active ? undoableUnapply : unapplyWithoutHistory;
581
588
  }
589
+ function useCreateAndApplyClass() {
590
+ const { id: activeId, setId: setActiveId } = useStyle();
591
+ const isVersion330Active = isExperimentActive(EXPERIMENTAL_FEATURES.V_3_30);
592
+ const [provider, createAction] = useGetStylesRepositoryCreateAction() ?? [null, null];
593
+ const deleteAction = provider?.actions.delete;
594
+ const applyClass = useApply();
595
+ const unapplyClass = useUnapply();
596
+ const undoableCreateAndApply = useMemo2(() => {
597
+ if (!provider || !createAction) {
598
+ return;
599
+ }
600
+ return undoable(
601
+ {
602
+ do: ({ classLabel }) => {
603
+ const prevActiveId = activeId;
604
+ const createdId = createAction(classLabel);
605
+ applyClass(createdId);
606
+ return { prevActiveId, createdId };
607
+ },
608
+ undo: (_, { prevActiveId, createdId }) => {
609
+ unapplyClass(createdId);
610
+ deleteAction?.(createdId);
611
+ setActiveId(prevActiveId);
612
+ }
613
+ },
614
+ {
615
+ title: __("Class", "elementor"),
616
+ subtitle: ({ classLabel }) => {
617
+ return __(`%s created`, "elementor").replace("%s", classLabel);
618
+ }
619
+ }
620
+ );
621
+ }, [activeId, applyClass, createAction, deleteAction, provider, setActiveId, unapplyClass]);
622
+ const createAndApplyWithoutHistory = useCallback(
623
+ ({ classLabel }) => {
624
+ if (!createAction) {
625
+ return;
626
+ }
627
+ const createdId = createAction(classLabel);
628
+ applyClass(createdId);
629
+ },
630
+ [applyClass, createAction]
631
+ );
632
+ if (!provider || !undoableCreateAndApply) {
633
+ return [null, null];
634
+ }
635
+ return isVersion330Active ? [provider, undoableCreateAndApply] : [provider, createAndApplyWithoutHistory];
636
+ }
582
637
  function useApply() {
583
638
  const { element } = useElement();
584
639
  const { setId: setActiveId } = useStyle();
585
- const { setClasses, getAppliedClasses } = useSetClasses();
640
+ const { setClasses, getAppliedClasses } = useClasses();
586
641
  return useCallback(
587
642
  (classIDToApply) => {
588
643
  const appliedClasses = getAppliedClasses();
@@ -601,7 +656,7 @@ function useApply() {
601
656
  function useUnapply() {
602
657
  const { element } = useElement();
603
658
  const { id: activeId, setId: setActiveId } = useStyle();
604
- const { setClasses, getAppliedClasses } = useSetClasses();
659
+ const { setClasses, getAppliedClasses } = useClasses();
605
660
  return useCallback(
606
661
  (classIDToUnapply) => {
607
662
  const appliedClasses = getAppliedClasses();
@@ -619,10 +674,10 @@ function useUnapply() {
619
674
  [activeId, element.id, getAppliedClasses, setActiveId, setClasses]
620
675
  );
621
676
  }
622
- function useSetClasses() {
677
+ function useClasses() {
623
678
  const { element } = useElement();
624
679
  const currentClassesProp = useClassesProp();
625
- const isVersion330Active = isExperimentActive("e_v_3_30");
680
+ const isVersion330Active = isExperimentActive(EXPERIMENTAL_FEATURES.V_3_30);
626
681
  return useMemo2(() => {
627
682
  const setClasses = (ids) => {
628
683
  updateElementSettings({
@@ -635,10 +690,7 @@ function useSetClasses() {
635
690
  }
636
691
  };
637
692
  const getAppliedClasses = () => getElementSetting(element.id, currentClassesProp)?.value || [];
638
- return {
639
- setClasses,
640
- getAppliedClasses
641
- };
693
+ return { setClasses, getAppliedClasses };
642
694
  }, [currentClassesProp, element.id, isVersion330Active]);
643
695
  }
644
696
 
@@ -722,10 +774,10 @@ function StateMenuItem({ state, closeMenu, ...props }) {
722
774
  const { state: activeState } = meta;
723
775
  const { userCan } = useUserStylesCapability2();
724
776
  const modifiedStates = useModifiedStates(styleId);
725
- const isUpdateAllowed = userCan(provider ?? "").updateProps;
777
+ const isUpdateAllowed = !state || userCan(provider ?? "").updateProps;
726
778
  const indicatorVariant = !provider || isElementsStylesProvider(provider) ? "local" : "global";
727
779
  const isStyled = modifiedStates[state ?? "normal"] ?? false;
728
- const disabled = isUpdateAllowed ? false : !isStyled;
780
+ const disabled = !isUpdateAllowed && !isStyled;
729
781
  const isActive = styleId === activeId;
730
782
  const isSelected = state === activeState && isActive;
731
783
  return /* @__PURE__ */ React6.createElement(
@@ -747,7 +799,7 @@ function StateMenuItem({ state, closeMenu, ...props }) {
747
799
  MenuItemInfotip,
748
800
  {
749
801
  showInfoTip: disabled,
750
- content: __2("With your role as an editor, you can only use existing states.", "elementor")
802
+ content: __2("With your current role, you can only use existing states.", "elementor")
751
803
  },
752
804
  /* @__PURE__ */ React6.createElement(Stack, { gap: 0.75, direction: "row", alignItems: "center" }, isStyled && /* @__PURE__ */ React6.createElement(StyleIndicator, { "aria-label": __2("Has style", "elementor"), variant: indicatorVariant }), state ?? "normal")
753
805
  )
@@ -789,7 +841,7 @@ function RenameClassMenuItem({ closeMenu }) {
789
841
  {
790
842
  showInfoTip: !isAllowed,
791
843
  content: __2(
792
- "With your role as an editor, you can use existing classes but can\u2019t modify them.",
844
+ "With your current role, you can use existing classes but can\u2019t modify them.",
793
845
  "elementor"
794
846
  )
795
847
  },
@@ -807,6 +859,7 @@ function CssClassItem(props) {
807
859
  const popupState = usePopupState({ variant: "popover" });
808
860
  const [chipRef, setChipRef] = useState3(null);
809
861
  const { onDelete, ...chipGroupProps } = chipProps;
862
+ const { userCan } = useUserStylesCapability3();
810
863
  const {
811
864
  ref,
812
865
  isEditing,
@@ -821,7 +874,7 @@ function CssClassItem(props) {
821
874
  });
822
875
  const color = error ? "error" : colorProp;
823
876
  const providerActions = provider ? stylesRepository3.getProviderByKey(provider)?.actions : null;
824
- const allowRename = Boolean(providerActions?.update);
877
+ const allowRename = Boolean(providerActions?.update) && userCan(provider ?? "")?.update;
825
878
  const isShowingState = isActive && meta.state;
826
879
  return /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement(
827
880
  UnstableChipGroup,
@@ -908,15 +961,16 @@ var EMPTY_OPTION = {
908
961
  var { Slot: ClassSelectorActionsSlot, inject: injectIntoClassSelectorActions } = createLocation();
909
962
  function CssClassSelector() {
910
963
  const options12 = useOptions();
911
- const { value: appliedIds, pushValue: pushAppliedId } = useAppliedClassesIds();
912
964
  const { id: activeId, setId: setActiveId } = useStyle();
913
965
  const autocompleteRef = useRef(null);
914
966
  const [renameError, setRenameError] = useState4(null);
915
967
  const handleSelect = useHandleSelect();
916
- const { create, validate, entityName } = useCreateAction({ pushAppliedId, setActiveId });
917
- const applied = useAppliedOptions(options12, appliedIds);
918
- const active = applied.find((option) => option.value === activeId) ?? EMPTY_OPTION;
919
- const showPlaceholder = applied.every(({ fixed }) => fixed);
968
+ const { create, validate, entityName } = useCreateAction();
969
+ const appliedOptions = useAppliedOptions(options12);
970
+ const active = appliedOptions.find((option) => option.value === activeId) ?? EMPTY_OPTION;
971
+ const showPlaceholder = appliedOptions.every(({ fixed }) => fixed);
972
+ const { userCan } = useUserStylesCapability4();
973
+ const canEdit = active.provider ? userCan(active.provider).updateProps : true;
920
974
  return /* @__PURE__ */ React8.createElement(Stack3, { p: 2 }, /* @__PURE__ */ React8.createElement(Stack3, { direction: "row", gap: 1, alignItems: "center", justifyContent: "space-between" }, /* @__PURE__ */ React8.createElement(FormLabel, { htmlFor: ID, size: "small" }, __4("Classes", "elementor")), /* @__PURE__ */ React8.createElement(Stack3, { direction: "row", gap: 1 }, /* @__PURE__ */ React8.createElement(ClassSelectorActionsSlot, null))), /* @__PURE__ */ React8.createElement(
921
975
  WarningInfotip,
922
976
  {
@@ -934,7 +988,7 @@ function CssClassSelector() {
934
988
  size: "tiny",
935
989
  placeholder: showPlaceholder ? __4("Type class name", "elementor") : void 0,
936
990
  options: options12,
937
- selected: applied,
991
+ selected: appliedOptions,
938
992
  entityName,
939
993
  onSelect: handleSelect,
940
994
  onCreate: create ?? void 0,
@@ -971,6 +1025,15 @@ function CssClassSelector() {
971
1025
  })
972
1026
  }
973
1027
  )
1028
+ ), !canEdit && /* @__PURE__ */ React8.createElement(
1029
+ InfoAlert,
1030
+ {
1031
+ content: __4(
1032
+ "With your current role, you can use existing classes but can\u2019t modify them.",
1033
+ "elementor"
1034
+ ),
1035
+ sx: { mt: 1 }
1036
+ }
974
1037
  ));
975
1038
  }
976
1039
  var EmptyState = ({ searchValue, onClear }) => /* @__PURE__ */ React8.createElement(Box2, { sx: { py: 4 } }, /* @__PURE__ */ React8.createElement(
@@ -1018,18 +1081,13 @@ function useOptions() {
1018
1081
  });
1019
1082
  });
1020
1083
  }
1021
- function useCreateAction({
1022
- pushAppliedId,
1023
- setActiveId
1024
- }) {
1025
- const [provider, createAction] = useGetStylesRepositoryCreateAction() ?? [null, null];
1084
+ function useCreateAction() {
1085
+ const [provider, createAction] = useCreateAndApplyClass();
1026
1086
  if (!provider || !createAction) {
1027
1087
  return {};
1028
1088
  }
1029
- const create = (newClassLabel) => {
1030
- const createdId = createAction(newClassLabel);
1031
- pushAppliedId(createdId);
1032
- setActiveId(createdId);
1089
+ const create = (classLabel) => {
1090
+ createAction({ classLabel });
1033
1091
  };
1034
1092
  const validate = (newClassLabel, event) => {
1035
1093
  if (hasReachedLimit(provider)) {
@@ -1049,36 +1107,18 @@ function useCreateAction({
1049
1107
  function hasReachedLimit(provider) {
1050
1108
  return provider.actions.all().length >= provider.limit;
1051
1109
  }
1052
- function useAppliedOptions(options12, appliedIds) {
1053
- const applied = options12.filter((option) => option.value && appliedIds.includes(option.value));
1054
- const hasElementsProviderStyleApplied = applied.some(
1110
+ function useAppliedOptions(options12) {
1111
+ const { element } = useElement();
1112
+ const currentClassesProp = useClassesProp();
1113
+ const appliedIds = useElementSetting(element.id, currentClassesProp)?.value || [];
1114
+ const appliedOptions = options12.filter((option) => option.value && appliedIds.includes(option.value));
1115
+ const hasElementsProviderStyleApplied = appliedOptions.some(
1055
1116
  (option) => option.provider && isElementsStylesProvider2(option.provider)
1056
1117
  );
1057
1118
  if (!hasElementsProviderStyleApplied) {
1058
- applied.unshift(EMPTY_OPTION);
1119
+ appliedOptions.unshift(EMPTY_OPTION);
1059
1120
  }
1060
- return applied;
1061
- }
1062
- function useAppliedClassesIds() {
1063
- const { element } = useElement();
1064
- const currentClassesProp = useClassesProp();
1065
- const value = useElementSetting(element.id, currentClassesProp)?.value || [];
1066
- const setValue = (ids) => {
1067
- updateElementSettings2({
1068
- id: element.id,
1069
- props: {
1070
- [currentClassesProp]: classesPropTypeUtil2.create(ids)
1071
- }
1072
- });
1073
- };
1074
- const pushValue = (id) => {
1075
- const ids = getElementSetting2(element.id, currentClassesProp)?.value || [];
1076
- setValue([...ids, id]);
1077
- };
1078
- return {
1079
- value,
1080
- pushValue
1081
- };
1121
+ return appliedOptions;
1082
1122
  }
1083
1123
  function useHandleSelect() {
1084
1124
  const apply = useApplyClass();
@@ -1179,7 +1219,7 @@ function EditorPanelErrorFallback() {
1179
1219
 
1180
1220
  // src/components/editing-panel-tabs.tsx
1181
1221
  import * as React79 from "react";
1182
- import { Fragment as Fragment9 } from "react";
1222
+ import { Fragment as Fragment10 } from "react";
1183
1223
  import { isExperimentActive as isExperimentActive11 } from "@elementor/editor-v1-adapters";
1184
1224
  import { Divider as Divider6, Stack as Stack18, Tab, TabPanel, Tabs, useTabs } from "@elementor/ui";
1185
1225
  import { __ as __53 } from "@wordpress/i18n";
@@ -1252,13 +1292,6 @@ var useDefaultPanelSettings = () => {
1252
1292
  import { useState as useState6 } from "react";
1253
1293
  import { isExperimentActive as isExperimentActive2 } from "@elementor/editor-v1-adapters";
1254
1294
  import { getSessionStorageItem, setSessionStorageItem } from "@elementor/session";
1255
-
1256
- // src/sync/experiments-flags.ts
1257
- var EXPERIMENTAL_FEATURES = {
1258
- V_3_30: "e_v_3_30"
1259
- };
1260
-
1261
- // src/hooks/use-state-by-element.ts
1262
1295
  var useStateByElement = (key, initialValue) => {
1263
1296
  const { element } = useElement();
1264
1297
  const isFeatureActive = isExperimentActive2(EXPERIMENTAL_FEATURES.V_3_30);
@@ -1344,7 +1377,7 @@ var getGridLayout = (layout) => ({
1344
1377
  // src/controls-registry/settings-field.tsx
1345
1378
  import * as React15 from "react";
1346
1379
  import { PropKeyProvider, PropProvider } from "@elementor/editor-controls";
1347
- import { updateElementSettings as updateElementSettings3, useElementSetting as useElementSetting2 } from "@elementor/editor-elements";
1380
+ import { updateElementSettings as updateElementSettings2, useElementSetting as useElementSetting2 } from "@elementor/editor-elements";
1348
1381
 
1349
1382
  // src/controls-registry/create-top-level-object-type.ts
1350
1383
  var createTopLevelOjectType = ({ schema }) => {
@@ -1366,7 +1399,7 @@ var SettingsField = ({ bind, children }) => {
1366
1399
  const value = { [bind]: settingsValue };
1367
1400
  const propType = createTopLevelOjectType({ schema: elementType.propsSchema });
1368
1401
  const setValue = (newValue) => {
1369
- updateElementSettings3({
1402
+ updateElementSettings2({
1370
1403
  id: element.id,
1371
1404
  props: { ...newValue }
1372
1405
  });
@@ -1473,7 +1506,7 @@ import { __ as __52 } from "@wordpress/i18n";
1473
1506
  import * as React19 from "react";
1474
1507
  import { createContext as createContext7, useContext as useContext7 } from "react";
1475
1508
  import { getWidgetsCache, useElementSetting as useElementSetting3 } from "@elementor/editor-elements";
1476
- import { classesPropTypeUtil as classesPropTypeUtil3 } from "@elementor/editor-props";
1509
+ import { classesPropTypeUtil as classesPropTypeUtil2 } from "@elementor/editor-props";
1477
1510
  import { getBreakpointsTree } from "@elementor/editor-responsive";
1478
1511
  import { getStylesSchema } from "@elementor/editor-styles";
1479
1512
  import { stylesRepository as stylesRepository5 } from "@elementor/editor-styles-repository";
@@ -1741,7 +1774,7 @@ var useAppliedStyles = () => {
1741
1774
  const baseStyles = useBaseStyles();
1742
1775
  useStylesRerender();
1743
1776
  const classesProp = useElementSetting3(element.id, currentClassesProp);
1744
- const appliedStyles = classesPropTypeUtil3.extract(classesProp) ?? [];
1777
+ const appliedStyles = classesPropTypeUtil2.extract(classesProp) ?? [];
1745
1778
  return stylesRepository5.all().filter((style) => [...baseStyles, ...appliedStyles].includes(style.id));
1746
1779
  };
1747
1780
  var useBaseStyles = () => {
@@ -1758,7 +1791,7 @@ function useActiveStyleDefId(classProp) {
1758
1791
  "active-style-id",
1759
1792
  null
1760
1793
  );
1761
- const appliedClassesIds = useAppliedClassesIds2(classProp)?.value || [];
1794
+ const appliedClassesIds = useAppliedClassesIds(classProp)?.value || [];
1762
1795
  const fallback = useFirstAppliedClass(appliedClassesIds);
1763
1796
  const activeAndAppliedClassId = useActiveAndAppliedClassId(activeStyledDefId, appliedClassesIds);
1764
1797
  return [activeAndAppliedClassId || fallback?.id || null, setActiveStyledDefId];
@@ -1768,7 +1801,7 @@ function useFirstAppliedClass(appliedClassesIds) {
1768
1801
  const stylesDefs = getElementStyles(element.id) ?? {};
1769
1802
  return Object.values(stylesDefs).find((styleDef) => appliedClassesIds.includes(styleDef.id));
1770
1803
  }
1771
- function useAppliedClassesIds2(classProp) {
1804
+ function useAppliedClassesIds(classProp) {
1772
1805
  const { element } = useElement();
1773
1806
  return useElementSetting4(element.id, classProp);
1774
1807
  }
@@ -1932,7 +1965,7 @@ import { useBoundProp } from "@elementor/editor-controls";
1932
1965
  import { isEmpty as isEmpty2 } from "@elementor/editor-props";
1933
1966
  import { ELEMENTS_BASE_STYLES_PROVIDER_KEY as ELEMENTS_BASE_STYLES_PROVIDER_KEY3, isElementsStylesProvider as isElementsStylesProvider3 } from "@elementor/editor-styles-repository";
1934
1967
  import { isExperimentActive as isExperimentActive5 } from "@elementor/editor-v1-adapters";
1935
- import { Tooltip as Tooltip5 } from "@elementor/ui";
1968
+ import { Tooltip as Tooltip6 } from "@elementor/ui";
1936
1969
  import { __ as __9 } from "@wordpress/i18n";
1937
1970
 
1938
1971
  // src/styles-inheritance/consts.ts
@@ -1949,13 +1982,25 @@ var excludePropTypeTransformers = /* @__PURE__ */ new Set([
1949
1982
  "image",
1950
1983
  "background-overlay"
1951
1984
  ]);
1952
- var isUsingIndicatorPopover = () => isExperimentActive4("e_indications_popover");
1985
+ var isUsingIndicatorPopover = () => isExperimentActive4("e_v_3_30");
1953
1986
 
1954
1987
  // src/styles-inheritance/styles-inheritance-infotip.tsx
1955
1988
  import * as React25 from "react";
1956
1989
  import { useMemo as useMemo4, useState as useState8 } from "react";
1957
1990
  import { createPropsResolver } from "@elementor/editor-canvas";
1958
- import { Box as Box6, Card, CardContent, CloseButton, IconButton as IconButton3, Infotip, Stack as Stack7, Typography as Typography6 } from "@elementor/ui";
1991
+ import {
1992
+ Backdrop,
1993
+ Box as Box6,
1994
+ Card,
1995
+ CardContent,
1996
+ ClickAwayListener,
1997
+ CloseButton,
1998
+ IconButton as IconButton3,
1999
+ Infotip,
2000
+ Stack as Stack7,
2001
+ Tooltip as Tooltip5,
2002
+ Typography as Typography6
2003
+ } from "@elementor/ui";
1959
2004
  import { __ as __8 } from "@wordpress/i18n";
1960
2005
 
1961
2006
  // src/components/section-content.tsx
@@ -2031,16 +2076,18 @@ import { InfoCircleIcon } from "@elementor/icons";
2031
2076
  import { Chip as Chip4, Tooltip as Tooltip4 } from "@elementor/ui";
2032
2077
  import { __ as __6 } from "@wordpress/i18n";
2033
2078
  var SIZE4 = "tiny";
2034
- var LabelChip = ({ displayLabel, provider }) => {
2079
+ var LabelChip = ({ displayLabel, provider, chipColor }) => {
2080
+ const isBaseStyle = provider === ELEMENTS_BASE_STYLES_PROVIDER_KEY;
2081
+ const chipIcon = isBaseStyle ? /* @__PURE__ */ React22.createElement(Tooltip4, { title: __6("Inherited from base styles", "elementor"), placement: "top" }, /* @__PURE__ */ React22.createElement(InfoCircleIcon, { fontSize: SIZE4 })) : void 0;
2035
2082
  return /* @__PURE__ */ React22.createElement(
2036
2083
  Chip4,
2037
2084
  {
2038
2085
  label: displayLabel,
2039
2086
  size: SIZE4,
2040
- color: "global",
2087
+ color: chipColor,
2041
2088
  variant: "standard",
2042
2089
  state: "enabled",
2043
- icon: provider === ELEMENTS_BASE_STYLES_PROVIDER_KEY ? /* @__PURE__ */ React22.createElement(Tooltip4, { title: __6("Inherited from base styles", "elementor"), placement: "top" }, /* @__PURE__ */ React22.createElement(InfoCircleIcon, { fontSize: SIZE4 })) : void 0,
2090
+ icon: chipIcon,
2044
2091
  sx: (theme) => ({
2045
2092
  lineHeight: 1,
2046
2093
  flexWrap: "nowrap",
@@ -2118,7 +2165,8 @@ var normalizeInheritanceItem = async (item, index, bind, resolve) => {
2118
2165
  provider: item.provider || "",
2119
2166
  breakpoint: breakpoint ?? DEFAULT_BREAKPOINT3,
2120
2167
  displayLabel,
2121
- value: await getTransformedValue(item, bind, resolve)
2168
+ value: await getTransformedValue(item, bind, resolve),
2169
+ chipColor: getChipColor(item)
2122
2170
  };
2123
2171
  };
2124
2172
  var getTransformedValue = async (item, bind, resolve) => {
@@ -2140,6 +2188,16 @@ var getTransformedValue = async (item, bind, resolve) => {
2140
2188
  return "";
2141
2189
  }
2142
2190
  };
2191
+ var getChipColor = (item) => {
2192
+ const { provider = "", style } = item;
2193
+ if (provider === ELEMENTS_BASE_STYLES_PROVIDER_KEY2) {
2194
+ return "default";
2195
+ }
2196
+ if (style?.label === "local") {
2197
+ return "accent";
2198
+ }
2199
+ return "global";
2200
+ };
2143
2201
 
2144
2202
  // src/styles-inheritance/styles-inheritance-transformers-registry.tsx
2145
2203
  import { createTransformersRegistry } from "@elementor/editor-canvas";
@@ -2148,8 +2206,9 @@ var stylesInheritanceTransformersRegistry = createTransformersRegistry();
2148
2206
  // src/styles-inheritance/styles-inheritance-infotip.tsx
2149
2207
  var SIZE5 = "tiny";
2150
2208
  var StyleIndicatorInfotip = ({ inheritanceChain, propType, path, label, children }) => {
2151
- const [open, setOpen] = useState8(false);
2152
- const { isSiteRtl } = useDirection();
2209
+ const [showInfotip, setShowInfotip] = useState8(false);
2210
+ const toggleInfotip = () => setShowInfotip((prev) => !prev);
2211
+ const closeInfotip = () => setShowInfotip(false);
2153
2212
  const key = path.join(".");
2154
2213
  const sectionContentRef = useSectionContentRef();
2155
2214
  const sectionContentWidth = sectionContentRef?.current?.offsetWidth ?? 320;
@@ -2160,12 +2219,7 @@ var StyleIndicatorInfotip = ({ inheritanceChain, propType, path, label, children
2160
2219
  });
2161
2220
  }, [key, propType]);
2162
2221
  const items3 = useNormalizedInheritanceChainItems(inheritanceChain, key, resolve);
2163
- const toggleOpen = () => setOpen((prev) => !prev);
2164
- const closeInfotip = () => {
2165
- setOpen(false);
2166
- };
2167
- const forceInfotipAlignLeft = isSiteRtl ? 9999999 : -9999999;
2168
- const infotipContent = /* @__PURE__ */ React25.createElement(
2222
+ const infotipContent = /* @__PURE__ */ React25.createElement(ClickAwayListener, { onClickAway: closeInfotip }, /* @__PURE__ */ React25.createElement(
2169
2223
  Card,
2170
2224
  {
2171
2225
  elevation: 0,
@@ -2196,54 +2250,90 @@ var StyleIndicatorInfotip = ({ inheritanceChain, propType, path, label, children
2196
2250
  onClick: closeInfotip
2197
2251
  }
2198
2252
  )),
2199
- /* @__PURE__ */ React25.createElement(Stack7, { gap: 1.5, sx: { pl: 2, pr: 1, pb: 2, overflowX: "hidden", overflowY: "auto" }, role: "list" }, items3.map((item, index) => {
2200
- return /* @__PURE__ */ React25.createElement(
2201
- Box6,
2202
- {
2203
- key: item.id,
2204
- display: "flex",
2205
- gap: 0.5,
2206
- role: "listitem",
2207
- "aria-label": __8("Inheritance item: %s", "elementor").replace(
2208
- "%s",
2209
- item.displayLabel
2210
- )
2211
- },
2212
- /* @__PURE__ */ React25.createElement(Box6, { display: "flex", gap: 0.5, sx: { flexWrap: "wrap", width: "100%" } }, /* @__PURE__ */ React25.createElement(BreakpointIcon, { breakpoint: item.breakpoint }), /* @__PURE__ */ React25.createElement(LabelChip, { displayLabel: item.displayLabel, provider: item.provider }), /* @__PURE__ */ React25.createElement(ValueComponent, { index, value: item.value })),
2213
- /* @__PURE__ */ React25.createElement(ActionIcons, null)
2214
- );
2215
- }))
2253
+ /* @__PURE__ */ React25.createElement(
2254
+ Stack7,
2255
+ {
2256
+ gap: 1.5,
2257
+ sx: { pl: 2, pr: 1, pb: 2, overflowX: "hidden", overflowY: "auto" },
2258
+ role: "list"
2259
+ },
2260
+ items3.map((item, index) => {
2261
+ return /* @__PURE__ */ React25.createElement(
2262
+ Box6,
2263
+ {
2264
+ key: item.id,
2265
+ display: "flex",
2266
+ gap: 0.5,
2267
+ role: "listitem",
2268
+ "aria-label": __8("Inheritance item: %s", "elementor").replace(
2269
+ "%s",
2270
+ item.displayLabel
2271
+ )
2272
+ },
2273
+ /* @__PURE__ */ React25.createElement(Box6, { display: "flex", gap: 0.5, sx: { flexWrap: "wrap", width: "100%" } }, /* @__PURE__ */ React25.createElement(BreakpointIcon, { breakpoint: item.breakpoint }), /* @__PURE__ */ React25.createElement(
2274
+ LabelChip,
2275
+ {
2276
+ displayLabel: item.displayLabel,
2277
+ provider: item.provider,
2278
+ chipColor: item.chipColor
2279
+ }
2280
+ ), /* @__PURE__ */ React25.createElement(ValueComponent, { index, value: item.value })),
2281
+ /* @__PURE__ */ React25.createElement(ActionIcons, null)
2282
+ );
2283
+ })
2284
+ )
2216
2285
  )
2217
- );
2218
- return /* @__PURE__ */ React25.createElement(
2219
- Infotip,
2220
- {
2221
- placement: "top",
2222
- content: infotipContent,
2223
- open,
2224
- onClose: closeInfotip,
2225
- disableHoverListener: true,
2226
- componentsProps: {
2227
- tooltip: {
2228
- sx: {
2229
- mx: 2
2286
+ ));
2287
+ return /* @__PURE__ */ React25.createElement(TooltipOrInfotip, { showInfotip, onClose: closeInfotip, infotipContent }, /* @__PURE__ */ React25.createElement(IconButton3, { onClick: toggleInfotip, "aria-label": label, sx: { my: "-1px" } }, children));
2288
+ };
2289
+ function TooltipOrInfotip({
2290
+ children,
2291
+ showInfotip,
2292
+ onClose,
2293
+ infotipContent
2294
+ }) {
2295
+ const { isSiteRtl } = useDirection();
2296
+ const forceInfotipAlignLeft = isSiteRtl ? 9999999 : -9999999;
2297
+ if (showInfotip) {
2298
+ return /* @__PURE__ */ React25.createElement(React25.Fragment, null, /* @__PURE__ */ React25.createElement(
2299
+ Backdrop,
2300
+ {
2301
+ open: showInfotip,
2302
+ onClick: onClose,
2303
+ sx: {
2304
+ backgroundColor: "transparent",
2305
+ zIndex: (theme) => theme.zIndex.modal - 1
2306
+ }
2307
+ }
2308
+ ), /* @__PURE__ */ React25.createElement(
2309
+ Infotip,
2310
+ {
2311
+ placement: "top",
2312
+ content: infotipContent,
2313
+ open: showInfotip,
2314
+ onClose,
2315
+ disableHoverListener: true,
2316
+ componentsProps: {
2317
+ tooltip: {
2318
+ sx: { mx: 2 }
2319
+ }
2320
+ },
2321
+ slotProps: {
2322
+ popper: {
2323
+ modifiers: [
2324
+ {
2325
+ name: "offset",
2326
+ options: { offset: [forceInfotipAlignLeft, 0] }
2327
+ }
2328
+ ]
2230
2329
  }
2231
2330
  }
2232
2331
  },
2233
- slotProps: {
2234
- popper: {
2235
- modifiers: [
2236
- {
2237
- name: "offset",
2238
- options: { offset: [forceInfotipAlignLeft, 0] }
2239
- }
2240
- ]
2241
- }
2242
- }
2243
- },
2244
- /* @__PURE__ */ React25.createElement(IconButton3, { onClick: toggleOpen, "aria-label": label, sx: { my: "-1px" } }, children)
2245
- );
2246
- };
2332
+ children
2333
+ ));
2334
+ }
2335
+ return /* @__PURE__ */ React25.createElement(Tooltip5, { title: __8("Style origin", "elementor"), placement: "top" }, children);
2336
+ }
2247
2337
 
2248
2338
  // src/styles-inheritance/styles-inheritance-indicator.tsx
2249
2339
  var StylesInheritanceIndicator = () => {
@@ -2272,7 +2362,7 @@ var StylesInheritanceIndicator = () => {
2272
2362
  const label = getLabel({ isFinalValue, hasValue });
2273
2363
  const variantType = getVariant({ isFinalValue, hasValue, currentStyleProvider });
2274
2364
  if (!isUsingIndicatorPopover()) {
2275
- return /* @__PURE__ */ React26.createElement(Tooltip5, { title: __9("Style origin", "elementor"), placement: "top" }, /* @__PURE__ */ React26.createElement(StyleIndicator, { variant: variantType, "aria-label": label }));
2365
+ return /* @__PURE__ */ React26.createElement(Tooltip6, { title: __9("Style origin", "elementor"), placement: "top" }, /* @__PURE__ */ React26.createElement(StyleIndicator, { variant: variantType, "aria-label": label }));
2276
2366
  }
2277
2367
  return /* @__PURE__ */ React26.createElement(
2278
2368
  StyleIndicatorInfotip,
@@ -3383,8 +3473,8 @@ var positionOptions2 = [
3383
3473
  { label: __31("None", "elementor"), value: "none" },
3384
3474
  { label: __31("Scale down", "elementor"), value: "scale-down" }
3385
3475
  ];
3386
- var ObjectFitField = ({ onChange }) => {
3387
- return /* @__PURE__ */ React57.createElement(StylesField, { bind: "object-fit" }, /* @__PURE__ */ React57.createElement(Grid13, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React57.createElement(Grid13, { item: true, xs: 6 }, /* @__PURE__ */ React57.createElement(ControlLabel, null, __31("Object fit", "elementor"))), /* @__PURE__ */ React57.createElement(Grid13, { item: true, xs: 6, sx: { overflow: "hidden" } }, /* @__PURE__ */ React57.createElement(SelectControl4, { options: positionOptions2, onChange }))));
3476
+ var ObjectFitField = () => {
3477
+ return /* @__PURE__ */ React57.createElement(StylesField, { bind: "object-fit" }, /* @__PURE__ */ React57.createElement(Grid13, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React57.createElement(Grid13, { item: true, xs: 6 }, /* @__PURE__ */ React57.createElement(ControlLabel, null, __31("Object fit", "elementor"))), /* @__PURE__ */ React57.createElement(Grid13, { item: true, xs: 6, sx: { overflow: "hidden" } }, /* @__PURE__ */ React57.createElement(SelectControl4, { options: positionOptions2 }))));
3388
3478
  };
3389
3479
 
3390
3480
  // src/components/style-sections/size-section/object-position-field.tsx
@@ -3403,8 +3493,8 @@ var positionOptions3 = [
3403
3493
  { label: __32("Bottom left", "elementor"), value: "bottom left" },
3404
3494
  { label: __32("Bottom right", "elementor"), value: "bottom right" }
3405
3495
  ];
3406
- var ObjectPositionField = ({ onChange }) => {
3407
- return /* @__PURE__ */ React58.createElement(StylesField, { bind: "object-position" }, /* @__PURE__ */ React58.createElement(Grid14, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React58.createElement(Grid14, { item: true, xs: 6 }, /* @__PURE__ */ React58.createElement(ControlLabel, null, __32("Object position", "elementor"))), /* @__PURE__ */ React58.createElement(Grid14, { item: true, xs: 6, sx: { overflow: "hidden" } }, /* @__PURE__ */ React58.createElement(SelectControl5, { options: positionOptions3, onChange }))));
3496
+ var ObjectPositionField = () => {
3497
+ return /* @__PURE__ */ React58.createElement(StylesField, { bind: "object-position" }, /* @__PURE__ */ React58.createElement(Grid14, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React58.createElement(Grid14, { item: true, xs: 6 }, /* @__PURE__ */ React58.createElement(ControlLabel, null, __32("Object position", "elementor"))), /* @__PURE__ */ React58.createElement(Grid14, { item: true, xs: 6, sx: { overflow: "hidden" } }, /* @__PURE__ */ React58.createElement(SelectControl5, { options: positionOptions3 }))));
3408
3498
  };
3409
3499
 
3410
3500
  // src/components/style-sections/size-section/overflow-field.tsx
@@ -3439,16 +3529,8 @@ var OverflowField = () => {
3439
3529
 
3440
3530
  // src/components/style-sections/size-section/size-section.tsx
3441
3531
  var SizeSection = () => {
3442
- const [fitValue, setFitValue] = useStylesField("object-fit");
3532
+ const [fitValue] = useStylesField("object-fit");
3443
3533
  const isNotFill = fitValue && fitValue?.value !== "fill";
3444
- const onFitChange = (newFit, previousValue) => {
3445
- if (newFit && newFit !== previousValue) {
3446
- setFitValue({
3447
- value: newFit,
3448
- $$type: "string"
3449
- });
3450
- }
3451
- };
3452
3534
  const isVersion330Active = isExperimentActive8("e_v_3_30");
3453
3535
  return /* @__PURE__ */ React60.createElement(SectionContent, null, /* @__PURE__ */ React60.createElement(Grid16, { container: true, gap: 2, flexWrap: "nowrap" }, /* @__PURE__ */ React60.createElement(Grid16, { item: true, xs: 6 }, /* @__PURE__ */ React60.createElement(SizeField, { bind: "width", label: __34("Width", "elementor"), extendedValues: ["auto"] })), /* @__PURE__ */ React60.createElement(Grid16, { item: true, xs: 6 }, /* @__PURE__ */ React60.createElement(SizeField, { bind: "height", label: __34("Height", "elementor"), extendedValues: ["auto"] }))), /* @__PURE__ */ React60.createElement(Grid16, { container: true, gap: 2, flexWrap: "nowrap" }, /* @__PURE__ */ React60.createElement(Grid16, { item: true, xs: 6 }, /* @__PURE__ */ React60.createElement(
3454
3536
  SizeField,
@@ -3464,7 +3546,7 @@ var SizeSection = () => {
3464
3546
  label: __34("Min height", "elementor"),
3465
3547
  extendedValues: ["auto"]
3466
3548
  }
3467
- ))), /* @__PURE__ */ React60.createElement(Grid16, { container: true, gap: 2, flexWrap: "nowrap" }, /* @__PURE__ */ React60.createElement(Grid16, { item: true, xs: 6 }, /* @__PURE__ */ React60.createElement(SizeField, { bind: "max-width", label: __34("Max width", "elementor") })), /* @__PURE__ */ React60.createElement(Grid16, { item: true, xs: 6 }, /* @__PURE__ */ React60.createElement(SizeField, { bind: "max-height", label: __34("Max height", "elementor") }))), /* @__PURE__ */ React60.createElement(PanelDivider, null), /* @__PURE__ */ React60.createElement(Stack16, null, /* @__PURE__ */ React60.createElement(OverflowField, null)), isVersion330Active && /* @__PURE__ */ React60.createElement(CollapsibleContent, null, /* @__PURE__ */ React60.createElement(Stack16, { gap: 2 }, /* @__PURE__ */ React60.createElement(StylesField, { bind: "aspect-ratio" }, /* @__PURE__ */ React60.createElement(AspectRatioControl, { label: __34("Aspect Ratio", "elementor") })), /* @__PURE__ */ React60.createElement(PanelDivider, null), /* @__PURE__ */ React60.createElement(ObjectFitField, { onChange: onFitChange }), isNotFill && /* @__PURE__ */ React60.createElement(Grid16, { item: true, xs: 6 }, /* @__PURE__ */ React60.createElement(ObjectPositionField, null)))));
3549
+ ))), /* @__PURE__ */ React60.createElement(Grid16, { container: true, gap: 2, flexWrap: "nowrap" }, /* @__PURE__ */ React60.createElement(Grid16, { item: true, xs: 6 }, /* @__PURE__ */ React60.createElement(SizeField, { bind: "max-width", label: __34("Max width", "elementor") })), /* @__PURE__ */ React60.createElement(Grid16, { item: true, xs: 6 }, /* @__PURE__ */ React60.createElement(SizeField, { bind: "max-height", label: __34("Max height", "elementor") }))), /* @__PURE__ */ React60.createElement(PanelDivider, null), /* @__PURE__ */ React60.createElement(Stack16, null, /* @__PURE__ */ React60.createElement(OverflowField, null)), isVersion330Active && /* @__PURE__ */ React60.createElement(CollapsibleContent, null, /* @__PURE__ */ React60.createElement(Stack16, { gap: 2 }, /* @__PURE__ */ React60.createElement(StylesField, { bind: "aspect-ratio" }, /* @__PURE__ */ React60.createElement(AspectRatioControl, { label: __34("Aspect Ratio", "elementor") })), /* @__PURE__ */ React60.createElement(PanelDivider, null), /* @__PURE__ */ React60.createElement(ObjectFitField, null), isNotFill && /* @__PURE__ */ React60.createElement(Grid16, { item: true, xs: 6 }, /* @__PURE__ */ React60.createElement(ObjectPositionField, null)))));
3468
3550
  };
3469
3551
  var SizeField = ({ label, bind, extendedValues }) => {
3470
3552
  return /* @__PURE__ */ React60.createElement(StylesField, { bind }, /* @__PURE__ */ React60.createElement(Grid16, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React60.createElement(Grid16, { item: true, xs: 12 }, /* @__PURE__ */ React60.createElement(ControlLabel, null, label)), /* @__PURE__ */ React60.createElement(Grid16, { item: true, xs: 12 }, /* @__PURE__ */ React60.createElement(SizeControl5, { extendedValues }))));
@@ -3957,7 +4039,7 @@ var EditingPanelTabs = () => {
3957
4039
  return (
3958
4040
  // When switching between elements, the local states should be reset. We are using key to rerender the tabs.
3959
4041
  // Reference: https://react.dev/learn/preserving-and-resetting-state#resetting-a-form-with-a-key
3960
- /* @__PURE__ */ React79.createElement(Fragment9, { key: element.id }, /* @__PURE__ */ React79.createElement(PanelTabContent, null))
4042
+ /* @__PURE__ */ React79.createElement(Fragment10, { key: element.id }, /* @__PURE__ */ React79.createElement(PanelTabContent, null))
3961
4043
  );
3962
4044
  };
3963
4045
  var PanelTabContent = () => {
@@ -4188,7 +4270,7 @@ var DynamicControl = ({ bind, children }) => {
4188
4270
 
4189
4271
  // src/dynamics/components/dynamic-selection.tsx
4190
4272
  import * as React83 from "react";
4191
- import { Fragment as Fragment10, useState as useState13 } from "react";
4273
+ import { Fragment as Fragment11, useState as useState13 } from "react";
4192
4274
  import { useBoundProp as useBoundProp4 } from "@elementor/editor-controls";
4193
4275
  import { DatabaseIcon, SearchIcon } from "@elementor/icons";
4194
4276
  import {
@@ -4224,7 +4306,7 @@ var DynamicSelection = ({ onSelect }) => {
4224
4306
  setValue({ name: value, settings: { label } });
4225
4307
  onSelect?.();
4226
4308
  };
4227
- return /* @__PURE__ */ React83.createElement(Stack20, null, hasNoDynamicTags ? /* @__PURE__ */ React83.createElement(NoDynamicTags, null) : /* @__PURE__ */ React83.createElement(Fragment10, null, /* @__PURE__ */ React83.createElement(Box7, { px: 1.5, pb: 1 }, /* @__PURE__ */ React83.createElement(
4309
+ return /* @__PURE__ */ React83.createElement(Stack20, null, hasNoDynamicTags ? /* @__PURE__ */ React83.createElement(NoDynamicTags, null) : /* @__PURE__ */ React83.createElement(Fragment11, null, /* @__PURE__ */ React83.createElement(Box7, { px: 1.5, pb: 1 }, /* @__PURE__ */ React83.createElement(
4228
4310
  TextField2,
4229
4311
  {
4230
4312
  fullWidth: true,
@@ -4236,7 +4318,7 @@ var DynamicSelection = ({ onSelect }) => {
4236
4318
  startAdornment: /* @__PURE__ */ React83.createElement(InputAdornment, { position: "start" }, /* @__PURE__ */ React83.createElement(SearchIcon, { fontSize: SIZE7 }))
4237
4319
  }
4238
4320
  }
4239
- )), /* @__PURE__ */ React83.createElement(Divider7, null), /* @__PURE__ */ React83.createElement(Box7, { sx: { overflowY: "auto", height: 260, width: 220 } }, options12.length > 0 ? /* @__PURE__ */ React83.createElement(MenuList, { role: "listbox", tabIndex: 0 }, options12.map(([category, items3], index) => /* @__PURE__ */ React83.createElement(Fragment10, { key: index }, /* @__PURE__ */ React83.createElement(
4321
+ )), /* @__PURE__ */ React83.createElement(Divider7, null), /* @__PURE__ */ React83.createElement(Box7, { sx: { overflowY: "auto", height: 260, width: 220 } }, options12.length > 0 ? /* @__PURE__ */ React83.createElement(MenuList, { role: "listbox", tabIndex: 0 }, options12.map(([category, items3], index) => /* @__PURE__ */ React83.createElement(Fragment11, { key: index }, /* @__PURE__ */ React83.createElement(
4240
4322
  MenuSubheader2,
4241
4323
  {
4242
4324
  sx: { px: 1.5, typography: "caption", color: "text.tertiary" }