@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/CHANGELOG.md CHANGED
@@ -1,5 +1,45 @@
1
1
  # Change Log
2
2
 
3
+ ## 1.23.0
4
+
5
+ ### Minor Changes
6
+
7
+ - c10d154: Change outer margin of dynamic tags popover
8
+ - 50938e4: Change controls menus text style
9
+ - 64ec032: Change the style from 'ListSubHeader' to 'MenuSubHeader'
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies [2ea9555]
14
+ - Updated dependencies [50938e4]
15
+ - Updated dependencies [64ec032]
16
+ - @elementor/editor-elements@0.7.0
17
+ - @elementor/editor-controls@0.20.0
18
+ - @elementor/editor-ui@0.5.0
19
+ - @elementor/editor-styles-repository@0.8.1
20
+
21
+ ## 1.22.0
22
+
23
+ ### Minor Changes
24
+
25
+ - 202ff33: Set max global classes creation limit.
26
+
27
+ ### Patch Changes
28
+
29
+ - 3e108d9: update elementor/ui
30
+ - 700303b: Prevent creation attempt to invalid css class.
31
+ - Updated dependencies [3e108d9]
32
+ - Updated dependencies [202ff33]
33
+ - Updated dependencies [593f222]
34
+ - @elementor/editor-controls@0.19.1
35
+ - @elementor/editor-panels@0.13.1
36
+ - @elementor/editor-ui@0.4.3
37
+ - @elementor/locations@0.7.7
38
+ - @elementor/editor@0.18.4
39
+ - @elementor/menus@0.1.4
40
+ - @elementor/editor-styles-repository@0.8.0
41
+ - @elementor/editor-elements@0.6.6
42
+
3
43
  ## 1.21.0
4
44
 
5
45
  ### Minor Changes
package/dist/index.js CHANGED
@@ -163,7 +163,7 @@ function MultiCombobox({
163
163
  const optionsAndActions = selectedOrInputValue.filter((option) => typeof option !== "string");
164
164
  if (reason === "createOption") {
165
165
  const [firstAction] = filterActions(actions, { options: options13, inputValue: inputValue ?? "" });
166
- if (firstAction.value) {
166
+ if (firstAction?.value) {
167
167
  return run(firstAction.apply, firstAction.value);
168
168
  }
169
169
  }
@@ -247,7 +247,7 @@ function isAction(option) {
247
247
  var React6 = __toESM(require("react"));
248
248
  var import_react5 = require("react");
249
249
  var import_editor_styles_repository3 = require("@elementor/editor-styles-repository");
250
- var import_editor_ui = require("@elementor/editor-ui");
250
+ var import_editor_ui2 = require("@elementor/editor-ui");
251
251
  var import_icons = require("@elementor/icons");
252
252
  var import_ui3 = require("@elementor/ui");
253
253
  var import_i18n2 = require("@wordpress/i18n");
@@ -255,6 +255,7 @@ var import_i18n2 = require("@wordpress/i18n");
255
255
  // src/components/css-classes/css-class-menu.tsx
256
256
  var React5 = __toESM(require("react"));
257
257
  var import_editor_styles_repository2 = require("@elementor/editor-styles-repository");
258
+ var import_editor_ui = require("@elementor/editor-ui");
258
259
  var import_ui2 = require("@elementor/ui");
259
260
  var import_i18n = require("@wordpress/i18n");
260
261
 
@@ -303,7 +304,7 @@ function CssClassMenu({ styleId, provider, popupState, handleRename, anchorEl })
303
304
  onKeyDown: handleKeyDown
304
305
  },
305
306
  getMenuItemsByProvider({ provider, styleId, handleRename, closeMenu: popupState.close }),
306
- /* @__PURE__ */ React5.createElement(import_ui2.ListSubheader, { sx: { typography: "caption", color: "text.secondary", pb: 0.5, pt: 1 } }, (0, import_i18n.__)("Pseudo classes", "elementor")),
307
+ /* @__PURE__ */ React5.createElement(import_ui2.MenuSubheader, { sx: { typography: "caption", color: "text.secondary", pb: 0.5, pt: 1 } }, (0, import_i18n.__)("Pseudo classes", "elementor")),
307
308
  /* @__PURE__ */ React5.createElement(StateMenuItem, { key: "normal", state: null, styleId, closeMenu: popupState.close }),
308
309
  STATES.map((state) => {
309
310
  return /* @__PURE__ */ React5.createElement(StateMenuItem, { key: state, state, styleId, closeMenu: popupState.close });
@@ -329,7 +330,7 @@ function getMenuItemsByProvider({
329
330
  if (actions.length) {
330
331
  actions.unshift(
331
332
  /* @__PURE__ */ React5.createElement(
332
- import_ui2.ListSubheader,
333
+ import_ui2.MenuSubheader,
333
334
  {
334
335
  key: "provider-label",
335
336
  sx: { typography: "caption", color: "text.secondary", pb: 0.5, pt: 1 }
@@ -347,7 +348,7 @@ function StateMenuItem({ state, styleId, closeMenu, ...props }) {
347
348
  const isActive = styleId === activeId;
348
349
  const isSelected = state === activeState && isActive;
349
350
  return /* @__PURE__ */ React5.createElement(
350
- StyledMenuItem,
351
+ import_editor_ui.MenuListItem,
351
352
  {
352
353
  ...props,
353
354
  selected: isSelected,
@@ -366,7 +367,7 @@ function StateMenuItem({ state, styleId, closeMenu, ...props }) {
366
367
  function UnapplyClassMenuItem({ styleId, closeMenu, ...props }) {
367
368
  const unapplyClass = useUnapplyClass(styleId);
368
369
  return /* @__PURE__ */ React5.createElement(
369
- StyledMenuItem,
370
+ import_editor_ui.MenuListItem,
370
371
  {
371
372
  ...props,
372
373
  onClick: () => {
@@ -383,7 +384,7 @@ function RenameClassMenuItem({
383
384
  ...props
384
385
  }) {
385
386
  return /* @__PURE__ */ React5.createElement(
386
- StyledMenuItem,
387
+ import_editor_ui.MenuListItem,
387
388
  {
388
389
  ...props,
389
390
  onClick: () => {
@@ -394,7 +395,6 @@ function RenameClassMenuItem({
394
395
  (0, import_i18n.__)("Rename", "elementor")
395
396
  );
396
397
  }
397
- var StyledMenuItem = ({ ...props }) => /* @__PURE__ */ React5.createElement(import_ui2.MenuItem, { ...props, sx: { ...props.sx ?? {}, typography: "caption", color: "text.primary" } });
398
398
 
399
399
  // src/components/css-classes/css-class-item.tsx
400
400
  var CHIP_SIZE = "tiny";
@@ -419,7 +419,7 @@ function CssClassItem({
419
419
  openEditMode,
420
420
  error,
421
421
  getProps: getEditableProps
422
- } = (0, import_editor_ui.useEditable)({
422
+ } = (0, import_editor_ui2.useEditable)({
423
423
  value: label,
424
424
  onSubmit: renameLabel,
425
425
  validation: validateLabel
@@ -432,7 +432,7 @@ function CssClassItem({
432
432
  import_ui3.Chip,
433
433
  {
434
434
  size: CHIP_SIZE,
435
- label: isEditing ? /* @__PURE__ */ React6.createElement(import_editor_ui.EditableField, { ref, error, ...getEditableProps() }) : /* @__PURE__ */ React6.createElement(import_editor_ui.EllipsisWithTooltip, { maxWidth: "10ch", title: label, as: "div" }),
435
+ label: isEditing ? /* @__PURE__ */ React6.createElement(import_editor_ui2.EditableField, { ref, error, ...getEditableProps() }) : /* @__PURE__ */ React6.createElement(import_editor_ui2.EllipsisWithTooltip, { maxWidth: "10ch", title: label, as: "div" }),
436
436
  variant: isActive && !meta.state && !isEditing ? "filled" : "standard",
437
437
  shape: "rounded",
438
438
  icon,
@@ -590,6 +590,9 @@ function useCreateActions({
590
590
  return {
591
591
  // translators: %s is the label of the new class.
592
592
  label: (value) => (0, import_i18n3.__)('Create new "%s"', "elementor").replace("%s", value),
593
+ // translators: %s is the singular label of css class provider (e.g "Global CSS Class").
594
+ group: (0, import_i18n3.__)("Create New %s", "elementor").replace("%s", provider.labels?.singular ?? ""),
595
+ condition: (_, inputValue) => isLabelValid(inputValue) && !hasReachedLimit(provider),
593
596
  apply: (label) => {
594
597
  const createdId = create(label);
595
598
  if (!createdId) {
@@ -597,13 +600,19 @@ function useCreateActions({
597
600
  }
598
601
  pushAppliedId(createdId);
599
602
  setActiveId(createdId);
600
- },
601
- condition: (_, inputValue) => import_editor_styles_repository4.stylesRepository.isLabelValid(inputValue) && !import_editor_styles_repository4.stylesRepository.isLabelExist(inputValue),
602
- // translators: %s is the singular label of css class provider (e.g "Global CSS Class").
603
- group: (0, import_i18n3.__)("Create New %s", "elementor").replace("%s", provider.labels?.singular ?? "")
603
+ }
604
604
  };
605
605
  });
606
606
  }
607
+ function hasReachedLimit(provider) {
608
+ if (provider.limit === void 0) {
609
+ return false;
610
+ }
611
+ return provider.actions.get().length >= provider.limit;
612
+ }
613
+ function isLabelValid(newLabel) {
614
+ return import_editor_styles_repository4.stylesRepository.isLabelValid(newLabel) && !import_editor_styles_repository4.stylesRepository.isLabelExist(newLabel);
615
+ }
607
616
  function useAppliedOptions(options13, appliedIds) {
608
617
  const applied = options13.filter((option) => option.value && appliedIds.includes(option.value));
609
618
  const hasElementsProviderStyleApplied = applied.some(
@@ -857,7 +866,7 @@ function Section({ title, children, defaultExpanded = false }) {
857
866
  import_ui9.ListItemText,
858
867
  {
859
868
  secondary: title,
860
- secondaryTypographyProps: { sx: { typography: "caption", fontWeight: "bold" } }
869
+ secondaryTypographyProps: { color: "text.primary", variant: "caption", fontWeight: "bold" }
861
870
  }
862
871
  ),
863
872
  /* @__PURE__ */ React13.createElement(CollapseIcon, { open: isOpen, color: "secondary", fontSize: "tiny" })
@@ -2905,7 +2914,7 @@ var DynamicSelection = ({ onSelect }) => {
2905
2914
  }
2906
2915
  }
2907
2916
  )), /* @__PURE__ */ React69.createElement(import_ui53.Divider, null), /* @__PURE__ */ React69.createElement(import_ui53.Box, { sx: { overflowY: "auto", height: 260, width: 220 } }, options13.length > 0 ? /* @__PURE__ */ React69.createElement(import_ui53.MenuList, { role: "listbox", tabIndex: 0 }, options13.map(([category, items3], index) => /* @__PURE__ */ React69.createElement(import_react21.Fragment, { key: index }, /* @__PURE__ */ React69.createElement(
2908
- import_ui53.ListSubheader,
2917
+ import_ui53.MenuSubheader,
2909
2918
  {
2910
2919
  sx: { px: 1.5, typography: "caption", color: "text.tertiary" }
2911
2920
  },
@@ -3048,7 +3057,7 @@ var DynamicSettings = ({ controls }) => {
3048
3057
  return null;
3049
3058
  }
3050
3059
  return /* @__PURE__ */ React70.createElement(React70.Fragment, null, /* @__PURE__ */ React70.createElement(import_ui54.Tabs, { size: "small", variant: "fullWidth", ...getTabsProps() }, tabs.map(({ value }, index) => /* @__PURE__ */ React70.createElement(import_ui54.Tab, { key: index, label: value.label, sx: { px: 1, py: 0.5 }, ...getTabProps(index) }))), /* @__PURE__ */ React70.createElement(import_ui54.Divider, null), tabs.map(({ value }, index) => {
3051
- return /* @__PURE__ */ React70.createElement(import_ui54.TabPanel, { key: index, sx: { flexGrow: 1, py: 0 }, ...getTabPanelProps(index) }, /* @__PURE__ */ React70.createElement(PopoverContent, { p: 1.5 }, value.items.map((item) => {
3060
+ return /* @__PURE__ */ React70.createElement(import_ui54.TabPanel, { key: index, sx: { flexGrow: 1, py: 0 }, ...getTabPanelProps(index) }, /* @__PURE__ */ React70.createElement(PopoverContent, { p: 2, gap: 2 }, value.items.map((item) => {
3052
3061
  if (item.type === "control") {
3053
3062
  return /* @__PURE__ */ React70.createElement(Control3, { key: item.value.bind, control: item.value });
3054
3063
  }