@elementor/editor-editing-panel 1.27.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/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
- ELEMENTS_STYLES_PROVIDER_KEY as ELEMENTS_STYLES_PROVIDER_KEY2,
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, Stack as Stack3, Typography as Typography2 } from "@elementor/ui";
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.get().find((style) => style.id === styleId);
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,7 +233,7 @@ 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 {
@@ -245,7 +248,7 @@ 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 { ELEMENTS_STYLES_PROVIDER_KEY, 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
253
  import { bindMenu, Divider, Menu, MenuSubheader, Stack } from "@elementor/ui";
251
254
  import { __ } from "@wordpress/i18n";
@@ -298,7 +301,7 @@ var StyleIndicator = styled2("div", {
298
301
  var STATES = ["hover", "focus", "active"];
299
302
  function CssClassMenu({ styleId, provider, popupState, handleRename, anchorEl }) {
300
303
  const styledStates = useStyledStates(styleId);
301
- const indicatorVariant = provider === ELEMENTS_STYLES_PROVIDER_KEY ? "local" : "global";
304
+ const indicatorVariant = !provider || isElementsStylesProvider(provider) ? "local" : "global";
302
305
  const handleKeyDown = (e) => {
303
306
  e.stopPropagation();
304
307
  };
@@ -316,7 +319,8 @@ function CssClassMenu({ styleId, provider, popupState, handleRename, anchorEl })
316
319
  horizontal: "left",
317
320
  vertical: -4
318
321
  },
319
- onKeyDown: handleKeyDown
322
+ onKeyDown: handleKeyDown,
323
+ disableAutoFocusItem: true
320
324
  },
321
325
  getMenuItemsByProvider({ provider, styleId, handleRename, closeMenu: popupState.close }),
322
326
  /* @__PURE__ */ React5.createElement(MenuSubheader, { sx: { typography: "caption", color: "text.secondary", pb: 0.5, pt: 1 } }, __("States", "elementor")),
@@ -359,7 +363,7 @@ function getMenuItemsByProvider({
359
363
  handleRename,
360
364
  closeMenu
361
365
  }) {
362
- if (!styleId) {
366
+ if (!styleId || !provider) {
363
367
  return [];
364
368
  }
365
369
  const providerInstance = stylesRepository2.getProviderByKey(provider);
@@ -449,8 +453,8 @@ function RenameClassMenuItem({
449
453
  var CHIP_SIZE = "tiny";
450
454
  function CssClassItem({
451
455
  id,
452
- label,
453
456
  provider,
457
+ label,
454
458
  isActive,
455
459
  color: colorProp,
456
460
  icon,
@@ -474,7 +478,7 @@ function CssClassItem({
474
478
  validation: validateLabel
475
479
  });
476
480
  const color = error ? "error" : colorProp;
477
- const providerActions = stylesRepository3.getProviderByKey(provider)?.actions;
481
+ const providerActions = provider ? stylesRepository3.getProviderByKey(provider)?.actions : null;
478
482
  const allowRename = Boolean(providerActions?.update);
479
483
  const isShowingState = isActive && meta.state;
480
484
  return /* @__PURE__ */ React6.createElement(React6.Fragment, null, /* @__PURE__ */ React6.createElement(
@@ -549,13 +553,11 @@ function CssClassItem({
549
553
  ));
550
554
  }
551
555
  var validateLabel = (newLabel) => {
552
- if (!stylesRepository3.isLabelValid(newLabel)) {
553
- return __2("Invalid format", "elementor");
554
- }
555
- if (stylesRepository3.isLabelExist(newLabel)) {
556
- return __2("Name exists", "elementor");
556
+ const result = validateStyleLabel(newLabel);
557
+ if (result.isValid) {
558
+ return null;
557
559
  }
558
- return null;
560
+ return result.error;
559
561
  };
560
562
 
561
563
  // src/components/css-classes/css-class-selector.tsx
@@ -567,7 +569,7 @@ var EMPTY_OPTION = {
567
569
  fixed: true,
568
570
  color: "accent",
569
571
  icon: /* @__PURE__ */ React7.createElement(MapPinIcon, null),
570
- provider: ELEMENTS_STYLES_PROVIDER_KEY2
572
+ provider: null
571
573
  };
572
574
  var { Slot: ClassSelectorActionsSlot, inject: injectIntoClassSelectorActions } = createLocation();
573
575
  function CssClassSelector() {
@@ -578,11 +580,13 @@ function CssClassSelector() {
578
580
  const handleApply = useHandleApply(appliedIds, setAppliedIds);
579
581
  const applied = useAppliedOptions(options13, appliedIds);
580
582
  const active = applied.find((option) => option.value === activeId) ?? EMPTY_OPTION;
581
- return /* @__PURE__ */ React7.createElement(Stack3, { gap: 1, p: 2 }, /* @__PURE__ */ React7.createElement(Stack3, { direction: "row", gap: 1, alignItems: "center", justifyContent: "space-between" }, /* @__PURE__ */ React7.createElement(Typography2, { component: "label", variant: "caption", htmlFor: ID }, __3("Classes", "elementor")), /* @__PURE__ */ React7.createElement(Stack3, { direction: "row", gap: 1 }, /* @__PURE__ */ React7.createElement(ClassSelectorActionsSlot, null))), /* @__PURE__ */ React7.createElement(
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(
582
585
  MultiCombobox,
583
586
  {
584
587
  id: ID,
585
588
  size: "tiny",
589
+ placeholder: showPlaceholder ? __3("Type to search/add global classes", "elementor") : void 0,
586
590
  options: options13,
587
591
  selected: applied,
588
592
  onSelect: handleApply,
@@ -618,6 +622,9 @@ function CssClassSelector() {
618
622
  ));
619
623
  }
620
624
  var updateClassByProvider = (provider, data) => {
625
+ if (!provider) {
626
+ return;
627
+ }
621
628
  const providerInstance = stylesRepository4.getProviderByKey(provider);
622
629
  if (!providerInstance) {
623
630
  return;
@@ -628,8 +635,8 @@ function useOptions() {
628
635
  const { element } = useElement();
629
636
  const isProviderEditable = (provider) => !!provider.actions.updateProps;
630
637
  return useProviders().filter(isProviderEditable).flatMap((provider) => {
631
- const isElements = provider.key === ELEMENTS_STYLES_PROVIDER_KEY2;
632
- const styleDefs = provider.actions.get({ elementId: element.id });
638
+ const isElements = isElementsStylesProvider2(provider.getKey());
639
+ const styleDefs = provider.actions.all({ elementId: element.id });
633
640
  if (isElements && styleDefs.length === 0) {
634
641
  return [EMPTY_OPTION];
635
642
  }
@@ -640,7 +647,7 @@ function useOptions() {
640
647
  fixed: isElements,
641
648
  color: isElements ? "accent" : "global",
642
649
  icon: isElements ? /* @__PURE__ */ React7.createElement(MapPinIcon, null) : null,
643
- provider: provider.key,
650
+ provider: provider.getKey(),
644
651
  // translators: %s is the plural label of the provider (e.g "Existing classes").
645
652
  group: __3("Existing %s", "elementor").replace("%s", provider.labels?.plural ?? "")
646
653
  };
@@ -657,7 +664,7 @@ function useCreateActions({
657
664
  label: (value) => __3('Create "%s"', "elementor").replace("%s", value),
658
665
  // translators: %s is the singular label of css class provider (e.g "CSS Class").
659
666
  group: __3("Create a new %s", "elementor").replace("%s", provider.labels?.singular ?? ""),
660
- condition: (_, inputValue) => isLabelValid(inputValue) && !hasReachedLimit(provider),
667
+ condition: (_, inputValue) => validateStyleLabel2(inputValue).isValid && !hasReachedLimit(provider),
661
668
  apply: (label) => {
662
669
  const createdId = create(label);
663
670
  if (!createdId) {
@@ -670,18 +677,12 @@ function useCreateActions({
670
677
  });
671
678
  }
672
679
  function hasReachedLimit(provider) {
673
- if (provider.limit === void 0) {
674
- return false;
675
- }
676
- return provider.actions.get().length >= provider.limit;
677
- }
678
- function isLabelValid(newLabel) {
679
- return stylesRepository4.isLabelValid(newLabel) && !stylesRepository4.isLabelExist(newLabel);
680
+ return provider.actions.all().length >= provider.limit;
680
681
  }
681
682
  function useAppliedOptions(options13, appliedIds) {
682
683
  const applied = options13.filter((option) => option.value && appliedIds.includes(option.value));
683
684
  const hasElementsProviderStyleApplied = applied.some(
684
- (option) => option.provider === ELEMENTS_STYLES_PROVIDER_KEY2
685
+ (option) => option.provider && isElementsStylesProvider2(option.provider)
685
686
  );
686
687
  if (!hasElementsProviderStyleApplied) {
687
688
  applied.unshift(EMPTY_OPTION);
@@ -752,7 +753,7 @@ import { createMenu } from "@elementor/menus";
752
753
  import * as React8 from "react";
753
754
  import { useId as useId2 } from "react";
754
755
  import { XIcon } from "@elementor/icons";
755
- import { bindPopover, bindToggle, IconButton, Popover, Stack as Stack4, Tooltip, Typography as Typography3, usePopupState as usePopupState2 } from "@elementor/ui";
756
+ import { bindPopover, bindToggle, IconButton, Popover, Stack as Stack4, Tooltip, Typography as Typography2, usePopupState as usePopupState2 } from "@elementor/ui";
756
757
  var SIZE = "tiny";
757
758
  function PopoverAction({
758
759
  title,
@@ -779,7 +780,7 @@ function PopoverAction({
779
780
  },
780
781
  ...bindPopover(popupState)
781
782
  },
782
- /* @__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(Typography3, { variant: "subtitle2" }, title), /* @__PURE__ */ React8.createElement(IconButton, { sx: { ml: "auto" }, size: SIZE, onClick: popupState.close }, /* @__PURE__ */ React8.createElement(XIcon, { fontSize: SIZE }))),
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 }))),
783
784
  /* @__PURE__ */ React8.createElement(PopoverContent2, { closePopover: popupState.close })
784
785
  ));
785
786
  }
@@ -982,8 +983,7 @@ var Control2 = ({ control }) => {
982
983
 
983
984
  // src/components/style-tab.tsx
984
985
  import * as React65 from "react";
985
- import { useState as useState7 } from "react";
986
- import { getElementStyles, useElementSetting as useElementSetting5 } from "@elementor/editor-elements";
986
+ import { useState as useState8 } from "react";
987
987
  import { CLASSES_PROP_KEY } from "@elementor/editor-props";
988
988
  import { useActiveBreakpoint } from "@elementor/editor-responsive";
989
989
  import { SessionStorageProvider as SessionStorageProvider2 } from "@elementor/session";
@@ -1006,6 +1006,9 @@ var useStylesRerender = () => {
1006
1006
  useEffect(() => provider?.subscribe(reRender), [provider]);
1007
1007
  };
1008
1008
 
1009
+ // src/styles-inheritance/create-snapshots-manager.ts
1010
+ import { filterEmptyValues } from "@elementor/editor-props";
1011
+
1009
1012
  // src/styles-inheritance/utils.ts
1010
1013
  var DEFAULT_STATE = "normal";
1011
1014
  var DEFAULT_BREAKPOINT = "desktop";
@@ -1096,12 +1099,16 @@ function buildInitialSnapshotFromStyles(styles) {
1096
1099
  variant: { props }
1097
1100
  } = styleData;
1098
1101
  Object.entries(props).forEach(([key, value]) => {
1102
+ const filteredValue = filterEmptyValues(value);
1103
+ if (filteredValue === null) {
1104
+ return;
1105
+ }
1099
1106
  if (!snapshot[key]) {
1100
1107
  snapshot[key] = [];
1101
1108
  }
1102
1109
  const snapshotPropValue = {
1103
1110
  ...styleData,
1104
- value
1111
+ value: filteredValue
1105
1112
  };
1106
1113
  snapshot[key].push(snapshotPropValue);
1107
1114
  });
@@ -1133,7 +1140,7 @@ function createStylesInheritance(styleDefs, breakpointsRoot) {
1133
1140
  function buildStyleVariantsByMetaMapping(styleDefs) {
1134
1141
  const breakpointStateSlots = {};
1135
1142
  styleDefs.forEach((styleDef) => {
1136
- const provider = getProviderByStyleId(styleDef.id)?.key ?? null;
1143
+ const provider = getProviderByStyleId(styleDef.id)?.getKey() ?? null;
1137
1144
  styleDef.variants.forEach((variant) => {
1138
1145
  const { meta } = variant;
1139
1146
  const { state, breakpoint } = meta;
@@ -1198,6 +1205,30 @@ var useBaseStyles = () => {
1198
1205
  return Object.values(widgetCache?.base_styles ?? {});
1199
1206
  };
1200
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
+
1201
1232
  // src/components/style-sections/background-section/background-section.tsx
1202
1233
  import * as React19 from "react";
1203
1234
  import { BackgroundControl } from "@elementor/editor-controls";
@@ -1215,7 +1246,7 @@ import {
1215
1246
  getElementLabel
1216
1247
  } from "@elementor/editor-elements";
1217
1248
  import { getVariantByMeta } from "@elementor/editor-styles";
1218
- import { LOCAL_STYLES_RESERVED_LABEL } from "@elementor/editor-styles-repository";
1249
+ import { ELEMENTS_STYLES_RESERVED_LABEL } from "@elementor/editor-styles-repository";
1219
1250
  import { undoable } from "@elementor/editor-v1-adapters";
1220
1251
  import { __ as __4 } from "@wordpress/i18n";
1221
1252
  function useStylesFields(propNames) {
@@ -1256,9 +1287,9 @@ function getProps({ styleId, elementId, provider, meta, propNames }) {
1256
1287
  if (!provider || !styleId) {
1257
1288
  return null;
1258
1289
  }
1259
- const style = provider.actions.getById?.(styleId, { elementId });
1290
+ const style = provider.actions.get(styleId, { elementId });
1260
1291
  if (!style) {
1261
- throw new StyleNotFoundUnderProviderError({ context: { styleId, providerKey: provider.key } });
1292
+ throw new StyleNotFoundUnderProviderError({ context: { styleId, providerKey: provider.getKey() } });
1262
1293
  }
1263
1294
  const variant = getVariantByMeta(style, meta);
1264
1295
  return Object.fromEntries(
@@ -1272,7 +1303,7 @@ function useUndoableCreateElementStyle() {
1272
1303
  do: (payload) => {
1273
1304
  return createElementStyle({
1274
1305
  ...payload,
1275
- label: LOCAL_STYLES_RESERVED_LABEL
1306
+ label: ELEMENTS_STYLES_RESERVED_LABEL
1276
1307
  });
1277
1308
  },
1278
1309
  undo: ({ elementId }, styleId) => {
@@ -1282,7 +1313,7 @@ function useUndoableCreateElementStyle() {
1282
1313
  return createElementStyle({
1283
1314
  ...payload,
1284
1315
  styleId,
1285
- label: LOCAL_STYLES_RESERVED_LABEL
1316
+ label: ELEMENTS_STYLES_RESERVED_LABEL
1286
1317
  });
1287
1318
  }
1288
1319
  },
@@ -1300,10 +1331,10 @@ function useUndoableUpdateStyle() {
1300
1331
  do: ({ elementId, styleId, provider, meta, props }) => {
1301
1332
  if (!provider.actions.updateProps) {
1302
1333
  throw new StylesProviderCannotUpdatePropsError({
1303
- context: { providerKey: provider.key }
1334
+ context: { providerKey: provider.getKey() }
1304
1335
  });
1305
1336
  }
1306
- const style = provider.actions.getById(styleId, { elementId });
1337
+ const style = provider.actions.get(styleId, { elementId });
1307
1338
  const prevProps = getCurrentProps(style, meta);
1308
1339
  provider.actions.updateProps(
1309
1340
  {
@@ -1350,7 +1381,7 @@ function useStylesField(propName) {
1350
1381
  // src/styles-inheritance/styles-inheritance-indicator.tsx
1351
1382
  import * as React17 from "react";
1352
1383
  import { useBoundProp } from "@elementor/editor-controls";
1353
- import { ELEMENTS_BASE_STYLES_PROVIDER_KEY, ELEMENTS_STYLES_PROVIDER_KEY as ELEMENTS_STYLES_PROVIDER_KEY3 } from "@elementor/editor-styles-repository";
1384
+ import { ELEMENTS_BASE_STYLES_PROVIDER_KEY, isElementsStylesProvider as isElementsStylesProvider3 } from "@elementor/editor-styles-repository";
1354
1385
  import { __ as __5 } from "@wordpress/i18n";
1355
1386
  var StylesInheritanceIndicator = () => {
1356
1387
  const { value, path } = useBoundProp();
@@ -1370,7 +1401,7 @@ var StylesInheritanceIndicator = () => {
1370
1401
  StyleIndicator,
1371
1402
  {
1372
1403
  "aria-label": __5("This is the final value", "elementor"),
1373
- variant: currentStyleProvider?.key === ELEMENTS_STYLES_PROVIDER_KEY3 ? "local" : "global"
1404
+ variant: isElementsStylesProvider3(currentStyleProvider?.getKey()) ? "local" : "global"
1374
1405
  }
1375
1406
  );
1376
1407
  }
@@ -1387,11 +1418,12 @@ var StylesInheritanceIndicator = () => {
1387
1418
  };
1388
1419
 
1389
1420
  // src/controls-registry/styles-field.tsx
1390
- var StylesField = ({ bind, children }) => {
1421
+ var StylesField = ({ bind, placeholder, children }) => {
1391
1422
  const [value, setValue] = useStylesField(bind);
1392
1423
  const stylesSchema = getStylesSchema();
1393
1424
  const propType = createTopLevelOjectType({ schema: stylesSchema });
1394
1425
  const values = { [bind]: value };
1426
+ const placeholderValues = { [bind]: placeholder };
1395
1427
  const setValues = (newValue) => {
1396
1428
  setValue(newValue[bind]);
1397
1429
  };
@@ -1405,7 +1437,16 @@ var StylesField = ({ bind, children }) => {
1405
1437
  }
1406
1438
  ]
1407
1439
  },
1408
- /* @__PURE__ */ React18.createElement(PropProvider2, { propType, value: values, setValue: setValues }, /* @__PURE__ */ React18.createElement(PropKeyProvider2, { bind }, children))
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
+ )
1409
1450
  );
1410
1451
  };
1411
1452
 
@@ -1885,35 +1926,37 @@ import * as React35 from "react";
1885
1926
  import { ToggleControl as ToggleControl4 } from "@elementor/editor-controls";
1886
1927
  import { Stack as Stack10 } from "@elementor/ui";
1887
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
+ ];
1888
1955
  var DisplayField = () => {
1889
- const options13 = [
1890
- {
1891
- value: "block",
1892
- renderContent: () => __14("Block", "elementor"),
1893
- label: __14("Block", "elementor"),
1894
- showTooltip: true
1895
- },
1896
- {
1897
- value: "flex",
1898
- renderContent: () => __14("Flex", "elementor"),
1899
- label: __14("Flex", "elementor"),
1900
- showTooltip: true
1901
- },
1902
- {
1903
- value: "inline-block",
1904
- renderContent: () => __14("In-blk", "elementor"),
1905
- label: __14("Inline-block", "elementor"),
1906
- showTooltip: true
1907
- },
1908
- {
1909
- value: "inline-flex",
1910
- renderContent: () => __14("In-flx", "elementor"),
1911
- label: __14("Inline-flex", "elementor"),
1912
- showTooltip: true
1913
- }
1914
- ];
1915
- return /* @__PURE__ */ React35.createElement(StylesField, { bind: "display" }, /* @__PURE__ */ React35.createElement(Stack10, { 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 })));
1916
1958
  };
1959
+ var useDisplayPlaceholderValue = () => useStylesInheritanceField("display")[0]?.value ?? void 0;
1917
1960
 
1918
1961
  // src/components/style-sections/layout-section/flex-direction-field.tsx
1919
1962
  import * as React36 from "react";
@@ -1960,7 +2003,7 @@ var FlexDirectionField = () => {
1960
2003
 
1961
2004
  // src/components/style-sections/layout-section/flex-order-field.tsx
1962
2005
  import * as React37 from "react";
1963
- import { useState as useState4 } from "react";
2006
+ import { useState as useState5 } from "react";
1964
2007
  import { ControlToggleButtonGroup, NumberControl } from "@elementor/editor-controls";
1965
2008
  import { ArrowDownSmallIcon as ArrowDownSmallIcon2, ArrowUpSmallIcon as ArrowUpSmallIcon2, PencilIcon } from "@elementor/icons";
1966
2009
  import { DirectionProvider as DirectionProvider5, Grid as Grid6, ThemeProvider as ThemeProvider5 } from "@elementor/ui";
@@ -1996,7 +2039,7 @@ var items = [
1996
2039
  ];
1997
2040
  var FlexOrderField = () => {
1998
2041
  const { isSiteRtl } = useDirection(), [order, setOrder] = useStylesField("order");
1999
- const [groupControlValue, setGroupControlValue] = useState4(getGroupControlValue(order?.value || null));
2042
+ const [groupControlValue, setGroupControlValue] = useState5(getGroupControlValue(order?.value || null));
2000
2043
  const handleToggleButtonChange = (group) => {
2001
2044
  setGroupControlValue(group);
2002
2045
  if (!group || group === CUSTOM) {
@@ -2034,7 +2077,7 @@ var getGroupControlValue = (order) => {
2034
2077
 
2035
2078
  // src/components/style-sections/layout-section/flex-size-field.tsx
2036
2079
  import * as React38 from "react";
2037
- import { useMemo as useMemo2, useState as useState5 } from "react";
2080
+ import { useMemo as useMemo2, useState as useState6 } from "react";
2038
2081
  import {
2039
2082
  ControlToggleButtonGroup as ControlToggleButtonGroup2,
2040
2083
  NumberControl as NumberControl2,
@@ -2071,7 +2114,7 @@ var FlexSizeField = () => {
2071
2114
  const grow = fields?.["flex-grow"]?.value || null;
2072
2115
  const shrink = fields?.["flex-shrink"]?.value || null;
2073
2116
  const basis = fields?.["flex-basis"]?.value || null;
2074
- const currentGroup = useMemo2(() => getActiveGroup({ grow, shrink, basis }), [grow, shrink, basis]), [activeGroup, setActiveGroup] = useState5(currentGroup);
2117
+ const currentGroup = useMemo2(() => getActiveGroup({ grow, shrink, basis }), [grow, shrink, basis]), [activeGroup, setActiveGroup] = useState6(currentGroup);
2075
2118
  const onChangeGroup = (group = null) => {
2076
2119
  setActiveGroup(group);
2077
2120
  if (!group || group === "custom") {
@@ -2232,16 +2275,25 @@ var WrapField = () => {
2232
2275
  // src/components/style-sections/layout-section/layout-section.tsx
2233
2276
  var LayoutSection = () => {
2234
2277
  const [display] = useStylesField("display");
2278
+ const displayPlaceholder = useDisplayPlaceholderValue();
2279
+ const isDisplayFlex = shouldDisplayFlexFields(display, displayPlaceholder);
2235
2280
  const { element } = useElement();
2236
2281
  const parent = useParentElement(element.id);
2237
2282
  const parentStyle = useComputedStyle(parent?.id || null);
2238
- return /* @__PURE__ */ React42.createElement(SectionContent, null, /* @__PURE__ */ React42.createElement(DisplayField, null), ("flex" === display?.value || "inline-flex" === display?.value) && /* @__PURE__ */ React42.createElement(FlexFields, null), "flex" === parentStyle?.display && /* @__PURE__ */ React42.createElement(FlexChildFields, 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));
2239
2284
  };
2240
2285
  var FlexFields = () => {
2241
2286
  const [flexWrap] = useStylesField("flex-wrap");
2242
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));
2243
2288
  };
2244
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
+ };
2245
2297
 
2246
2298
  // src/components/style-sections/position-section/position-section.tsx
2247
2299
  import * as React46 from "react";
@@ -2413,11 +2465,11 @@ import * as React64 from "react";
2413
2465
 
2414
2466
  // src/components/collapsible-content.tsx
2415
2467
  import * as React50 from "react";
2416
- import { useState as useState6 } from "react";
2468
+ import { useState as useState7 } from "react";
2417
2469
  import { Button, Collapse as Collapse3, Stack as Stack15 } from "@elementor/ui";
2418
2470
  import { __ as __28 } from "@wordpress/i18n";
2419
2471
  var CollapsibleContent = ({ children, defaultOpen = false }) => {
2420
- const [open, setOpen] = useState6(defaultOpen);
2472
+ const [open, setOpen] = useState7(defaultOpen);
2421
2473
  const handleToggle = () => {
2422
2474
  setOpen((prevOpen) => !prevOpen);
2423
2475
  };
@@ -2764,7 +2816,7 @@ var TypographySection = () => {
2764
2816
  var StyleTab = () => {
2765
2817
  const currentClassesProp = useCurrentClassesProp();
2766
2818
  const [activeStyleDefId, setActiveStyleDefId] = useActiveStyleDefId(currentClassesProp);
2767
- const [activeStyleState, setActiveStyleState] = useState7(null);
2819
+ const [activeStyleState, setActiveStyleState] = useState8(null);
2768
2820
  const breakpoint = useActiveBreakpoint();
2769
2821
  return /* @__PURE__ */ React65.createElement(ClassesPropProvider, { prop: currentClassesProp }, /* @__PURE__ */ React65.createElement(
2770
2822
  StyleProvider,
@@ -2780,17 +2832,6 @@ var StyleTab = () => {
2780
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)))))
2781
2833
  ));
2782
2834
  };
2783
- function useActiveStyleDefId(currentClassesProp) {
2784
- const [activeStyledDefId, setActiveStyledDefId] = useState7(null);
2785
- const fallback = useFirstElementStyleDef(currentClassesProp);
2786
- return [activeStyledDefId || fallback?.id || null, setActiveStyledDefId];
2787
- }
2788
- function useFirstElementStyleDef(currentClassesProp) {
2789
- const { element } = useElement();
2790
- const classesIds = useElementSetting5(element.id, currentClassesProp)?.value || [];
2791
- const stylesDefs = getElementStyles(element.id) ?? {};
2792
- return Object.values(stylesDefs).find((styleDef) => classesIds.includes(styleDef.id));
2793
- }
2794
2835
  function useCurrentClassesProp() {
2795
2836
  const { elementType } = useElement();
2796
2837
  const prop = Object.entries(elementType.propsSchema).find(
@@ -2892,7 +2933,7 @@ import {
2892
2933
  Tab as Tab2,
2893
2934
  TabPanel as TabPanel2,
2894
2935
  Tabs as Tabs2,
2895
- Typography as Typography5,
2936
+ Typography as Typography4,
2896
2937
  UnstableTag as Tag,
2897
2938
  usePopupState as usePopupState3,
2898
2939
  useTabs as useTabs2
@@ -3020,7 +3061,7 @@ var DynamicControl = ({ bind, children }) => {
3020
3061
 
3021
3062
  // src/dynamics/components/dynamic-selection.tsx
3022
3063
  import * as React70 from "react";
3023
- import { Fragment as Fragment9, useState as useState8 } from "react";
3064
+ import { Fragment as Fragment9, useState as useState9 } from "react";
3024
3065
  import { useBoundProp as useBoundProp4 } from "@elementor/editor-controls";
3025
3066
  import { DatabaseIcon, SearchIcon } from "@elementor/icons";
3026
3067
  import {
@@ -3033,12 +3074,12 @@ import {
3033
3074
  MenuSubheader as MenuSubheader2,
3034
3075
  Stack as Stack18,
3035
3076
  TextField as TextField2,
3036
- Typography as Typography4
3077
+ Typography as Typography3
3037
3078
  } from "@elementor/ui";
3038
3079
  import { __ as __46 } from "@wordpress/i18n";
3039
3080
  var SIZE3 = "tiny";
3040
3081
  var DynamicSelection = ({ onSelect }) => {
3041
- const [searchValue, setSearchValue] = useState8("");
3082
+ const [searchValue, setSearchValue] = useState9("");
3042
3083
  const { groups: dynamicGroups } = getAtomicDynamicTags() || {};
3043
3084
  const { value: anyValue } = useBoundProp4();
3044
3085
  const { bind, value: dynamicValue, setValue } = useBoundProp4(dynamicPropTypeUtil);
@@ -3101,8 +3142,8 @@ var NoResults = ({ searchValue, onClear }) => /* @__PURE__ */ React70.createElem
3101
3142
  sx: { pb: 3.5 }
3102
3143
  },
3103
3144
  /* @__PURE__ */ React70.createElement(DatabaseIcon, { fontSize: "large" }),
3104
- /* @__PURE__ */ React70.createElement(Typography4, { align: "center", variant: "subtitle2" }, __46("Sorry, nothing matched", "elementor"), /* @__PURE__ */ React70.createElement("br", null), "\u201C", searchValue, "\u201D."),
3105
- /* @__PURE__ */ React70.createElement(Typography4, { 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")))
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")))
3106
3147
  );
3107
3148
  var NoDynamicTags = () => /* @__PURE__ */ React70.createElement(Box4, { sx: { overflowY: "hidden", height: 297, width: 220 } }, /* @__PURE__ */ React70.createElement(Divider6, null), /* @__PURE__ */ React70.createElement(
3108
3149
  Stack18,
@@ -3116,8 +3157,8 @@ var NoDynamicTags = () => /* @__PURE__ */ React70.createElement(Box4, { sx: { ov
3116
3157
  sx: { pb: 3.5 }
3117
3158
  },
3118
3159
  /* @__PURE__ */ React70.createElement(DatabaseIcon, { fontSize: "large" }),
3119
- /* @__PURE__ */ React70.createElement(Typography4, { align: "center", variant: "subtitle2" }, __46("Streamline your workflow with dynamic tags", "elementor")),
3120
- /* @__PURE__ */ React70.createElement(Typography4, { align: "center", variant: "caption" }, __46("You\u2019ll need Elementor Pro to use this feature.", "elementor"))
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"))
3121
3162
  ));
3122
3163
  var useFilteredOptions = (searchValue) => {
3123
3164
  const dynamicTags = usePropDynamicTags();
@@ -3177,7 +3218,7 @@ var DynamicSelectionControl = () => {
3177
3218
  anchorOrigin: { vertical: "bottom", horizontal: "left" },
3178
3219
  ...bindPopover2(selectionPopoverState)
3179
3220
  },
3180
- /* @__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(Typography5, { 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 }))
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 }))
3181
3222
  ));
3182
3223
  };
3183
3224
  var DynamicSettingsPopover = ({ dynamicTag }) => {
@@ -3202,7 +3243,7 @@ var DynamicSettingsPopover = ({ dynamicTag }) => {
3202
3243
  anchorOrigin: { vertical: "bottom", horizontal: "center" },
3203
3244
  ...bindPopover2(settingsPopupState)
3204
3245
  },
3205
- /* @__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(Typography5, { 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 }))
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 }))
3206
3247
  ));
3207
3248
  };
3208
3249
  var DynamicSettings = ({ controls }) => {
@@ -3327,10 +3368,8 @@ var blockV1Panel = () => {
3327
3368
  condition: isAtomicWidgetSelected
3328
3369
  });
3329
3370
  };
3330
-
3331
- // src/index.ts
3332
- init2();
3333
3371
  export {
3372
+ init2 as init,
3334
3373
  injectIntoClassSelectorActions,
3335
3374
  replaceControl,
3336
3375
  useBoundProp7 as useBoundProp,