@elementor/editor-editing-panel 1.21.0 → 1.23.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
@@ -136,7 +136,7 @@ function MultiCombobox({
136
136
  const optionsAndActions = selectedOrInputValue.filter((option) => typeof option !== "string");
137
137
  if (reason === "createOption") {
138
138
  const [firstAction] = filterActions(actions, { options: options13, inputValue: inputValue ?? "" });
139
- if (firstAction.value) {
139
+ if (firstAction?.value) {
140
140
  return run(firstAction.apply, firstAction.value);
141
141
  }
142
142
  }
@@ -235,7 +235,8 @@ import { __ as __2 } from "@wordpress/i18n";
235
235
  // src/components/css-classes/css-class-menu.tsx
236
236
  import * as React5 from "react";
237
237
  import { stylesRepository as stylesRepository2 } from "@elementor/editor-styles-repository";
238
- import { bindMenu, Divider, ListSubheader, Menu, MenuItem } from "@elementor/ui";
238
+ import { MenuListItem } from "@elementor/editor-ui";
239
+ import { bindMenu, Divider, Menu, MenuSubheader } from "@elementor/ui";
239
240
  import { __ } from "@wordpress/i18n";
240
241
 
241
242
  // src/hooks/use-unapply-class.ts
@@ -283,7 +284,7 @@ function CssClassMenu({ styleId, provider, popupState, handleRename, anchorEl })
283
284
  onKeyDown: handleKeyDown
284
285
  },
285
286
  getMenuItemsByProvider({ provider, styleId, handleRename, closeMenu: popupState.close }),
286
- /* @__PURE__ */ React5.createElement(ListSubheader, { sx: { typography: "caption", color: "text.secondary", pb: 0.5, pt: 1 } }, __("Pseudo classes", "elementor")),
287
+ /* @__PURE__ */ React5.createElement(MenuSubheader, { sx: { typography: "caption", color: "text.secondary", pb: 0.5, pt: 1 } }, __("Pseudo classes", "elementor")),
287
288
  /* @__PURE__ */ React5.createElement(StateMenuItem, { key: "normal", state: null, styleId, closeMenu: popupState.close }),
288
289
  STATES.map((state) => {
289
290
  return /* @__PURE__ */ React5.createElement(StateMenuItem, { key: state, state, styleId, closeMenu: popupState.close });
@@ -309,7 +310,7 @@ function getMenuItemsByProvider({
309
310
  if (actions.length) {
310
311
  actions.unshift(
311
312
  /* @__PURE__ */ React5.createElement(
312
- ListSubheader,
313
+ MenuSubheader,
313
314
  {
314
315
  key: "provider-label",
315
316
  sx: { typography: "caption", color: "text.secondary", pb: 0.5, pt: 1 }
@@ -327,7 +328,7 @@ function StateMenuItem({ state, styleId, closeMenu, ...props }) {
327
328
  const isActive = styleId === activeId;
328
329
  const isSelected = state === activeState && isActive;
329
330
  return /* @__PURE__ */ React5.createElement(
330
- StyledMenuItem,
331
+ MenuListItem,
331
332
  {
332
333
  ...props,
333
334
  selected: isSelected,
@@ -346,7 +347,7 @@ function StateMenuItem({ state, styleId, closeMenu, ...props }) {
346
347
  function UnapplyClassMenuItem({ styleId, closeMenu, ...props }) {
347
348
  const unapplyClass = useUnapplyClass(styleId);
348
349
  return /* @__PURE__ */ React5.createElement(
349
- StyledMenuItem,
350
+ MenuListItem,
350
351
  {
351
352
  ...props,
352
353
  onClick: () => {
@@ -363,7 +364,7 @@ function RenameClassMenuItem({
363
364
  ...props
364
365
  }) {
365
366
  return /* @__PURE__ */ React5.createElement(
366
- StyledMenuItem,
367
+ MenuListItem,
367
368
  {
368
369
  ...props,
369
370
  onClick: () => {
@@ -374,7 +375,6 @@ function RenameClassMenuItem({
374
375
  __("Rename", "elementor")
375
376
  );
376
377
  }
377
- var StyledMenuItem = ({ ...props }) => /* @__PURE__ */ React5.createElement(MenuItem, { ...props, sx: { ...props.sx ?? {}, typography: "caption", color: "text.primary" } });
378
378
 
379
379
  // src/components/css-classes/css-class-item.tsx
380
380
  var CHIP_SIZE = "tiny";
@@ -570,6 +570,9 @@ function useCreateActions({
570
570
  return {
571
571
  // translators: %s is the label of the new class.
572
572
  label: (value) => __3('Create new "%s"', "elementor").replace("%s", value),
573
+ // translators: %s is the singular label of css class provider (e.g "Global CSS Class").
574
+ group: __3("Create New %s", "elementor").replace("%s", provider.labels?.singular ?? ""),
575
+ condition: (_, inputValue) => isLabelValid(inputValue) && !hasReachedLimit(provider),
573
576
  apply: (label) => {
574
577
  const createdId = create(label);
575
578
  if (!createdId) {
@@ -577,13 +580,19 @@ function useCreateActions({
577
580
  }
578
581
  pushAppliedId(createdId);
579
582
  setActiveId(createdId);
580
- },
581
- condition: (_, inputValue) => stylesRepository4.isLabelValid(inputValue) && !stylesRepository4.isLabelExist(inputValue),
582
- // translators: %s is the singular label of css class provider (e.g "Global CSS Class").
583
- group: __3("Create New %s", "elementor").replace("%s", provider.labels?.singular ?? "")
583
+ }
584
584
  };
585
585
  });
586
586
  }
587
+ function hasReachedLimit(provider) {
588
+ if (provider.limit === void 0) {
589
+ return false;
590
+ }
591
+ return provider.actions.get().length >= provider.limit;
592
+ }
593
+ function isLabelValid(newLabel) {
594
+ return stylesRepository4.isLabelValid(newLabel) && !stylesRepository4.isLabelExist(newLabel);
595
+ }
587
596
  function useAppliedOptions(options13, appliedIds) {
588
597
  const applied = options13.filter((option) => option.value && appliedIds.includes(option.value));
589
598
  const hasElementsProviderStyleApplied = applied.some(
@@ -846,7 +855,7 @@ function Section({ title, children, defaultExpanded = false }) {
846
855
  ListItemText,
847
856
  {
848
857
  secondary: title,
849
- secondaryTypographyProps: { sx: { typography: "caption", fontWeight: "bold" } }
858
+ secondaryTypographyProps: { color: "text.primary", variant: "caption", fontWeight: "bold" }
850
859
  }
851
860
  ),
852
861
  /* @__PURE__ */ React13.createElement(CollapseIcon, { open: isOpen, color: "secondary", fontSize: "tiny" })
@@ -2927,9 +2936,9 @@ import {
2927
2936
  Divider as Divider6,
2928
2937
  InputAdornment,
2929
2938
  Link,
2930
- ListSubheader as ListSubheader2,
2931
- MenuItem as MenuItem2,
2939
+ MenuItem,
2932
2940
  MenuList,
2941
+ MenuSubheader as MenuSubheader2,
2933
2942
  Stack as Stack16,
2934
2943
  TextField as TextField2,
2935
2944
  Typography as Typography4
@@ -2968,7 +2977,7 @@ var DynamicSelection = ({ onSelect }) => {
2968
2977
  }
2969
2978
  }
2970
2979
  )), /* @__PURE__ */ React69.createElement(Divider6, null), /* @__PURE__ */ React69.createElement(Box4, { sx: { overflowY: "auto", height: 260, width: 220 } }, options13.length > 0 ? /* @__PURE__ */ React69.createElement(MenuList, { role: "listbox", tabIndex: 0 }, options13.map(([category, items3], index) => /* @__PURE__ */ React69.createElement(Fragment9, { key: index }, /* @__PURE__ */ React69.createElement(
2971
- ListSubheader2,
2980
+ MenuSubheader2,
2972
2981
  {
2973
2982
  sx: { px: 1.5, typography: "caption", color: "text.tertiary" }
2974
2983
  },
@@ -2976,7 +2985,7 @@ var DynamicSelection = ({ onSelect }) => {
2976
2985
  ), items3.map(({ value, label: tagLabel }) => {
2977
2986
  const isSelected = isCurrentValueDynamic && value === dynamicValue?.name;
2978
2987
  return /* @__PURE__ */ React69.createElement(
2979
- MenuItem2,
2988
+ MenuItem,
2980
2989
  {
2981
2990
  key: value,
2982
2991
  selected: isSelected,
@@ -3111,7 +3120,7 @@ var DynamicSettings = ({ controls }) => {
3111
3120
  return null;
3112
3121
  }
3113
3122
  return /* @__PURE__ */ React70.createElement(React70.Fragment, null, /* @__PURE__ */ React70.createElement(Tabs2, { size: "small", variant: "fullWidth", ...getTabsProps() }, tabs.map(({ value }, index) => /* @__PURE__ */ React70.createElement(Tab2, { key: index, label: value.label, sx: { px: 1, py: 0.5 }, ...getTabProps(index) }))), /* @__PURE__ */ React70.createElement(Divider7, null), tabs.map(({ value }, index) => {
3114
- return /* @__PURE__ */ React70.createElement(TabPanel2, { key: index, sx: { flexGrow: 1, py: 0 }, ...getTabPanelProps(index) }, /* @__PURE__ */ React70.createElement(PopoverContent, { p: 1.5 }, value.items.map((item) => {
3123
+ return /* @__PURE__ */ React70.createElement(TabPanel2, { key: index, sx: { flexGrow: 1, py: 0 }, ...getTabPanelProps(index) }, /* @__PURE__ */ React70.createElement(PopoverContent, { p: 2, gap: 2 }, value.items.map((item) => {
3115
3124
  if (item.type === "control") {
3116
3125
  return /* @__PURE__ */ React70.createElement(Control3, { key: item.value.bind, control: item.value });
3117
3126
  }