@elementor/editor-controls 4.4.0-1141 → 4.4.0-1143

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.js CHANGED
@@ -6647,6 +6647,8 @@ var IconLibraryGrid = ({
6647
6647
 
6648
6648
  // src/controls/icon-library/icon-library-providers.ts
6649
6649
  var import_react54 = require("react");
6650
+ var import_query2 = require("@elementor/query");
6651
+ var PROVIDER_ICON_SVG_QUERY_KEY = "icon-library-provider-svg";
6650
6652
  var providers = /* @__PURE__ */ new Map();
6651
6653
  function registerIconLibraryProvider(provider) {
6652
6654
  providers.set(provider.id, provider);
@@ -6677,6 +6679,14 @@ async function resolveProviderIconSvg(library, iconValue, signal) {
6677
6679
  }
6678
6680
  return null;
6679
6681
  }
6682
+ function useProviderIconSvg(library, iconValue, enabled) {
6683
+ return (0, import_query2.useQuery)({
6684
+ queryKey: [PROVIDER_ICON_SVG_QUERY_KEY, library, iconValue],
6685
+ queryFn: ({ signal }) => resolveProviderIconSvg(library, iconValue, signal),
6686
+ enabled: enabled && Boolean(library && iconValue),
6687
+ staleTime: Infinity
6688
+ });
6689
+ }
6680
6690
 
6681
6691
  // src/controls/icon-library/icon-library-upload-action.tsx
6682
6692
  var React87 = __toESM(require("react"));
@@ -6835,10 +6845,10 @@ var SvgElementIcon = React89.forwardRef(
6835
6845
  );
6836
6846
 
6837
6847
  // src/controls/icon-library/use-font-awesome-7-catalog.ts
6838
- var import_query2 = require("@elementor/query");
6848
+ var import_query3 = require("@elementor/query");
6839
6849
  var FONT_AWESOME_7_CATALOG_QUERY_KEY = ["font-awesome-7-catalog"];
6840
6850
  function useFontAwesome7Catalog(enabled) {
6841
- return (0, import_query2.useQuery)({
6851
+ return (0, import_query3.useQuery)({
6842
6852
  queryKey: FONT_AWESOME_7_CATALOG_QUERY_KEY,
6843
6853
  queryFn: ({ signal }) => loadFontAwesome7Catalog(signal),
6844
6854
  enabled,
@@ -7071,6 +7081,7 @@ function createIconPropValue(icon, library) {
7071
7081
 
7072
7082
  // src/controls/svg-media-overlay.tsx
7073
7083
  var React91 = __toESM(require("react"));
7084
+ var import_editor_ui13 = require("@elementor/editor-ui");
7074
7085
  var import_icons27 = require("@elementor/icons");
7075
7086
  var import_ui74 = require("@elementor/ui");
7076
7087
  var import_i18n39 = require("@wordpress/i18n");
@@ -7125,7 +7136,7 @@ var UploadControl = ({ isAdmin, onUpload }) => {
7125
7136
  if (isAdmin) {
7126
7137
  return /* @__PURE__ */ React91.createElement(MediaUploadButton, { onClick: onUpload });
7127
7138
  }
7128
- return /* @__PURE__ */ React91.createElement(import_ui74.ThemeProvider, { colorScheme: "dark" }, /* @__PURE__ */ React91.createElement(MediaUploadButton, { disabled: true }));
7139
+ return /* @__PURE__ */ React91.createElement(import_editor_ui13.ThemeProvider, { colorScheme: "dark" }, /* @__PURE__ */ React91.createElement(MediaUploadButton, { disabled: true }));
7129
7140
  };
7130
7141
 
7131
7142
  // src/controls/svg-media-preview.tsx
@@ -7141,17 +7152,37 @@ var SvgMediaPreview = ({ isFetching, src, iconClassName, iconLibrary }) => {
7141
7152
  const icons = [...fontAwesomeIcons, ...providerIcons];
7142
7153
  const selectedIcon = findFontAwesome7Icon(icons, iconClassName, iconLibrary);
7143
7154
  const isLoadingCatalog = shouldLoadIconCatalog && (isFontAwesomeLoading || isProviderLoading);
7144
- if (isFetching || isLoadingCatalog) {
7155
+ const { data: savedIconSvg, isLoading: isSavedIconLoading } = useProviderIconSvg(
7156
+ iconLibrary,
7157
+ iconClassName,
7158
+ shouldLoadIconCatalog && !isLoadingCatalog && !selectedIcon
7159
+ );
7160
+ if (isFetching || isLoadingCatalog || isSavedIconLoading) {
7145
7161
  return /* @__PURE__ */ React92.createElement(import_ui75.CircularProgress, { role: "progressbar" });
7146
7162
  }
7147
7163
  if (selectedIcon) {
7148
7164
  return /* @__PURE__ */ React92.createElement(IconPreview, { icon: selectedIcon });
7149
7165
  }
7166
+ if (savedIconSvg) {
7167
+ return /* @__PURE__ */ React92.createElement(IconPreview, { icon: toSvgMarkupIcon(savedIconSvg, iconLibrary, iconClassName) });
7168
+ }
7150
7169
  if (shouldLoadIconCatalog) {
7151
7170
  return /* @__PURE__ */ React92.createElement(IconPreviewPlaceholder, null);
7152
7171
  }
7153
7172
  return /* @__PURE__ */ React92.createElement(SvgPreview, { src });
7154
7173
  };
7174
+ var toSvgMarkupIcon = (svgMarkup, library, value) => ({
7175
+ id: `${library}:${value}`,
7176
+ label: value ?? "",
7177
+ library: library ?? "",
7178
+ value: value ?? "",
7179
+ name: value ?? "",
7180
+ aliases: [],
7181
+ width: 0,
7182
+ height: 0,
7183
+ paths: [],
7184
+ svgMarkup
7185
+ });
7155
7186
  var IconPreview = ({ icon }) => /* @__PURE__ */ React92.createElement(import_ui75.Box, { sx: { color: ICON_PREVIEW_COLOR } }, /* @__PURE__ */ React92.createElement(
7156
7187
  FontAwesomeGlyph,
7157
7188
  {
@@ -7561,7 +7592,7 @@ var BackgroundImageOverlayAttachment = () => {
7561
7592
  var React97 = __toESM(require("react"));
7562
7593
  var import_react58 = require("react");
7563
7594
  var import_editor_props38 = require("@elementor/editor-props");
7564
- var import_editor_ui13 = require("@elementor/editor-ui");
7595
+ var import_editor_ui14 = require("@elementor/editor-ui");
7565
7596
  var import_icons29 = require("@elementor/icons");
7566
7597
  var import_ui80 = require("@elementor/ui");
7567
7598
  var import_i18n44 = require("@wordpress/i18n");
@@ -7599,7 +7630,7 @@ var BackgroundImageOverlayPosition = () => {
7599
7630
  disabled: stringPropContext.disabled,
7600
7631
  value: (backgroundImageOffsetContext.value ? "custom" : stringPropContext.value) ?? ""
7601
7632
  },
7602
- backgroundPositionOptions.map(({ label, value }) => /* @__PURE__ */ React97.createElement(import_editor_ui13.MenuListItem, { key: value, value: value ?? "" }, label))
7633
+ backgroundPositionOptions.map(({ label, value }) => /* @__PURE__ */ React97.createElement(import_editor_ui14.MenuListItem, { key: value, value: value ?? "" }, label))
7603
7634
  ))))), isCustom ? /* @__PURE__ */ React97.createElement(PropProvider, { ...backgroundImageOffsetContext }, /* @__PURE__ */ React97.createElement(import_ui80.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React97.createElement(import_ui80.Grid, { container: true, spacing: 1.5, ref: rowRef }, /* @__PURE__ */ React97.createElement(import_ui80.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React97.createElement(PropKeyProvider, { bind: "x" }, /* @__PURE__ */ React97.createElement(
7604
7635
  SizeControl,
7605
7636
  {
@@ -8262,7 +8293,7 @@ var KeyValueControl = createControl((props = {}) => {
8262
8293
  // src/controls/position-control.tsx
8263
8294
  var React104 = __toESM(require("react"));
8264
8295
  var import_editor_props45 = require("@elementor/editor-props");
8265
- var import_editor_ui14 = require("@elementor/editor-ui");
8296
+ var import_editor_ui15 = require("@elementor/editor-ui");
8266
8297
  var import_icons32 = require("@elementor/icons");
8267
8298
  var import_ui88 = require("@elementor/ui");
8268
8299
  var import_i18n50 = require("@wordpress/i18n");
@@ -8302,7 +8333,7 @@ var PositionControl = () => {
8302
8333
  renderValue: (selectedValue) => getSelectRenderValue(positionOptions, placeholder, selectedValue),
8303
8334
  fullWidth: true
8304
8335
  },
8305
- positionOptions.map(({ label, value }) => /* @__PURE__ */ React104.createElement(import_editor_ui14.MenuListItem, { key: value, value: value ?? "" }, label))
8336
+ positionOptions.map(({ label, value }) => /* @__PURE__ */ React104.createElement(import_editor_ui15.MenuListItem, { key: value, value: value ?? "" }, label))
8306
8337
  )))), isCustom && /* @__PURE__ */ React104.createElement(PropProvider, { ...positionContext }, /* @__PURE__ */ React104.createElement(import_ui88.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React104.createElement(import_ui88.Grid, { container: true, spacing: 1.5 }, /* @__PURE__ */ React104.createElement(import_ui88.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React104.createElement(PropKeyProvider, { bind: "x" }, /* @__PURE__ */ React104.createElement(
8307
8338
  SizeControl,
8308
8339
  {
@@ -8716,7 +8747,7 @@ var Label2 = ({ label, value }) => {
8716
8747
 
8717
8748
  // src/controls/transform-control/transform-settings-control.tsx
8718
8749
  var React116 = __toESM(require("react"));
8719
- var import_editor_ui15 = require("@elementor/editor-ui");
8750
+ var import_editor_ui16 = require("@elementor/editor-ui");
8720
8751
  var import_icons38 = require("@elementor/icons");
8721
8752
  var import_ui100 = require("@elementor/ui");
8722
8753
  var import_i18n59 = require("@wordpress/i18n");
@@ -8820,7 +8851,7 @@ var TransformSettingsControl = ({
8820
8851
  ...popupProps
8821
8852
  },
8822
8853
  /* @__PURE__ */ React116.createElement(
8823
- import_editor_ui15.PopoverHeader,
8854
+ import_editor_ui16.PopoverHeader,
8824
8855
  {
8825
8856
  title: (0, import_i18n59.__)("Transform settings", "elementor"),
8826
8857
  onClose: popupState.close,
@@ -9149,7 +9180,7 @@ function subscribeToTransitionEvent() {
9149
9180
  var React119 = __toESM(require("react"));
9150
9181
  var import_react72 = require("react");
9151
9182
  var import_editor_props56 = require("@elementor/editor-props");
9152
- var import_editor_ui16 = require("@elementor/editor-ui");
9183
+ var import_editor_ui17 = require("@elementor/editor-ui");
9153
9184
  var import_icons40 = require("@elementor/icons");
9154
9185
  var import_ui103 = require("@elementor/ui");
9155
9186
  var import_i18n62 = require("@wordpress/i18n");
@@ -9281,10 +9312,10 @@ var TransitionSelector = ({
9281
9312
  }
9282
9313
  },
9283
9314
  /* @__PURE__ */ React119.createElement("span", null, item.value),
9284
- showPromotion && disabledCategories.has(item.value) && /* @__PURE__ */ React119.createElement(import_editor_ui16.PromotionChip, null)
9315
+ showPromotion && disabledCategories.has(item.value) && /* @__PURE__ */ React119.createElement(import_editor_ui17.PromotionChip, null)
9285
9316
  ),
9286
9317
  footer: showPromotion ? /* @__PURE__ */ React119.createElement(
9287
- import_editor_ui16.PromotionAlert,
9318
+ import_editor_ui17.PromotionAlert,
9288
9319
  {
9289
9320
  message: (0, import_i18n62.__)(
9290
9321
  "Upgrade to customize transition properties and control effects.",
@@ -10313,13 +10344,13 @@ var InlineEditingControl = createControl(
10313
10344
  // src/controls/email-form-action-control/index.tsx
10314
10345
  var React133 = __toESM(require("react"));
10315
10346
  var import_editor_props68 = require("@elementor/editor-props");
10316
- var import_editor_ui18 = require("@elementor/editor-ui");
10347
+ var import_editor_ui19 = require("@elementor/editor-ui");
10317
10348
  var import_ui117 = require("@elementor/ui");
10318
10349
  var import_i18n69 = require("@wordpress/i18n");
10319
10350
 
10320
10351
  // src/controls/email-form-action-control/fields.tsx
10321
10352
  var React132 = __toESM(require("react"));
10322
- var import_editor_ui17 = require("@elementor/editor-ui");
10353
+ var import_editor_ui18 = require("@elementor/editor-ui");
10323
10354
  var import_ui116 = require("@elementor/ui");
10324
10355
  var import_i18n68 = require("@wordpress/i18n");
10325
10356
 
@@ -10542,7 +10573,7 @@ var SendToField = ({ placeholder }) => {
10542
10573
  placeholder,
10543
10574
  suggestions
10544
10575
  }
10545
- ), shouldShowMentionsInfo() && /* @__PURE__ */ React132.createElement(import_editor_ui17.InfoAlert, null, (0, import_i18n68.__)("Type @ or an email field name to insert its submitted value.", "elementor"))));
10576
+ ), shouldShowMentionsInfo() && /* @__PURE__ */ React132.createElement(import_editor_ui18.InfoAlert, null, (0, import_i18n68.__)("Type @ or an email field name to insert its submitted value.", "elementor"))));
10546
10577
  };
10547
10578
  var SubjectField = () => /* @__PURE__ */ React132.createElement(
10548
10579
  FieldValueMentionField,
@@ -10554,7 +10585,7 @@ var SubjectField = () => /* @__PURE__ */ React132.createElement(
10554
10585
  );
10555
10586
  var MessageField = () => {
10556
10587
  const suggestions = useFormFieldSuggestions();
10557
- return /* @__PURE__ */ React132.createElement(PropKeyProvider, { bind: "message" }, /* @__PURE__ */ React132.createElement(import_ui116.Grid, { container: true, direction: "column", gap: 0.5 }, /* @__PURE__ */ React132.createElement(import_ui116.Grid, { item: true }, /* @__PURE__ */ React132.createElement(ControlFormLabel, null, (0, import_i18n68.__)("Message", "elementor"))), /* @__PURE__ */ React132.createElement(import_ui116.Grid, { item: true }, /* @__PURE__ */ React132.createElement(MentionTextAreaControl, { suggestions })), /* @__PURE__ */ React132.createElement(import_ui116.Grid, { item: true }, /* @__PURE__ */ React132.createElement(import_editor_ui17.InfoAlert, null, shouldShowMentionsInfo() ? (0, import_i18n68.__)(
10588
+ return /* @__PURE__ */ React132.createElement(PropKeyProvider, { bind: "message" }, /* @__PURE__ */ React132.createElement(import_ui116.Grid, { container: true, direction: "column", gap: 0.5 }, /* @__PURE__ */ React132.createElement(import_ui116.Grid, { item: true }, /* @__PURE__ */ React132.createElement(ControlFormLabel, null, (0, import_i18n68.__)("Message", "elementor"))), /* @__PURE__ */ React132.createElement(import_ui116.Grid, { item: true }, /* @__PURE__ */ React132.createElement(MentionTextAreaControl, { suggestions })), /* @__PURE__ */ React132.createElement(import_ui116.Grid, { item: true }, /* @__PURE__ */ React132.createElement(import_editor_ui18.InfoAlert, null, shouldShowMentionsInfo() ? (0, import_i18n68.__)(
10558
10589
  "[all-fields] shortcode sends all fields. Type @ to insert specific fields and customize your message.",
10559
10590
  "elementor"
10560
10591
  ) : (0, import_i18n68.__)("[all-fields] shortcode sends all fields.", "elementor")))));
@@ -10624,15 +10655,15 @@ var EmailFormActionControl = createControl(
10624
10655
  return /* @__PURE__ */ React133.createElement(PropProvider, { ...propContext, value, setValue }, /* @__PURE__ */ React133.createElement(import_ui117.Stack, { gap: 2 }, /* @__PURE__ */ React133.createElement(ControlLabel, null, label ? label + " " + (0, import_i18n69.__)("settings", "elementor") : (0, import_i18n69.__)("Email settings", "elementor")), /* @__PURE__ */ React133.createElement(SendToField, { placeholder: toPlaceholder }), /* @__PURE__ */ React133.createElement(SubjectField, null), /* @__PURE__ */ React133.createElement(MessageField, null), /* @__PURE__ */ React133.createElement(FromEmailField, null), /* @__PURE__ */ React133.createElement(AdvancedSettings, null)));
10625
10656
  }
10626
10657
  );
10627
- var AdvancedSettings = () => /* @__PURE__ */ React133.createElement(import_editor_ui18.CollapsibleContent, { defaultOpen: false }, /* @__PURE__ */ React133.createElement(import_ui117.Box, { sx: { pt: 2 } }, /* @__PURE__ */ React133.createElement(import_ui117.Stack, { gap: 2 }, /* @__PURE__ */ React133.createElement(FromNameField, null), /* @__PURE__ */ React133.createElement(ReplyToField, null), /* @__PURE__ */ React133.createElement(CcField, null), /* @__PURE__ */ React133.createElement(BccField, null), /* @__PURE__ */ React133.createElement(import_ui117.Divider, null), /* @__PURE__ */ React133.createElement(MetaDataField, null), /* @__PURE__ */ React133.createElement(SendAsField, null))));
10658
+ var AdvancedSettings = () => /* @__PURE__ */ React133.createElement(import_editor_ui19.CollapsibleContent, { defaultOpen: false }, /* @__PURE__ */ React133.createElement(import_ui117.Box, { sx: { pt: 2 } }, /* @__PURE__ */ React133.createElement(import_ui117.Stack, { gap: 2 }, /* @__PURE__ */ React133.createElement(FromNameField, null), /* @__PURE__ */ React133.createElement(ReplyToField, null), /* @__PURE__ */ React133.createElement(CcField, null), /* @__PURE__ */ React133.createElement(BccField, null), /* @__PURE__ */ React133.createElement(import_ui117.Divider, null), /* @__PURE__ */ React133.createElement(MetaDataField, null), /* @__PURE__ */ React133.createElement(SendAsField, null))));
10628
10659
 
10629
10660
  // src/controls/attachment-type-control.tsx
10630
10661
  var React134 = __toESM(require("react"));
10631
- var import_editor_ui19 = require("@elementor/editor-ui");
10662
+ var import_editor_ui20 = require("@elementor/editor-ui");
10632
10663
  var import_ui118 = require("@elementor/ui");
10633
10664
  var import_i18n70 = require("@wordpress/i18n");
10634
10665
  var AttachmentTypeControl = createControl(({ label, options }) => {
10635
- return /* @__PURE__ */ React134.createElement(import_ui118.Grid, { container: true, direction: "column", gap: 1 }, label && /* @__PURE__ */ React134.createElement(import_ui118.Grid, { item: true }, /* @__PURE__ */ React134.createElement(ControlFormLabel, null, label)), /* @__PURE__ */ React134.createElement(import_ui118.Grid, { item: true }, /* @__PURE__ */ React134.createElement(SelectControl, { options })), /* @__PURE__ */ React134.createElement(import_ui118.Grid, { item: true }, /* @__PURE__ */ React134.createElement(import_editor_ui19.InfoAlert, null, (0, import_i18n70.__)(
10666
+ return /* @__PURE__ */ React134.createElement(import_ui118.Grid, { container: true, direction: "column", gap: 1 }, label && /* @__PURE__ */ React134.createElement(import_ui118.Grid, { item: true }, /* @__PURE__ */ React134.createElement(ControlFormLabel, null, label)), /* @__PURE__ */ React134.createElement(import_ui118.Grid, { item: true }, /* @__PURE__ */ React134.createElement(SelectControl, { options })), /* @__PURE__ */ React134.createElement(import_ui118.Grid, { item: true }, /* @__PURE__ */ React134.createElement(import_editor_ui20.InfoAlert, null, (0, import_i18n70.__)(
10636
10667
  "Linked uploads are saved to the server. Direct attachments will not appear under Submissions.",
10637
10668
  "elementor"
10638
10669
  ))));
@@ -10688,7 +10719,7 @@ var import_i18n71 = require("@wordpress/i18n");
10688
10719
  // src/components/promotions/promotion-trigger.tsx
10689
10720
  var React136 = __toESM(require("react"));
10690
10721
  var import_react81 = require("react");
10691
- var import_editor_ui20 = require("@elementor/editor-ui");
10722
+ var import_editor_ui21 = require("@elementor/editor-ui");
10692
10723
  var import_ui120 = require("@elementor/ui");
10693
10724
  function getV4Promotion(key) {
10694
10725
  return window.elementor?.config?.v4Promotions?.[key];
@@ -10707,7 +10738,7 @@ var PromotionTrigger = (0, import_react81.forwardRef)(
10707
10738
  }, [trackingData]);
10708
10739
  (0, import_react81.useImperativeHandle)(ref, () => ({ toggle }), [toggle]);
10709
10740
  return /* @__PURE__ */ React136.createElement(React136.Fragment, null, promotion && /* @__PURE__ */ React136.createElement(
10710
- import_editor_ui20.PromotionInfotip,
10741
+ import_editor_ui21.PromotionInfotip,
10711
10742
  {
10712
10743
  title: promotion.title,
10713
10744
  content: promotion.content,
@@ -10729,7 +10760,7 @@ var PromotionTrigger = (0, import_react81.forwardRef)(
10729
10760
  },
10730
10761
  sx: { cursor: "pointer", display: "inline-flex" }
10731
10762
  },
10732
- children ?? /* @__PURE__ */ React136.createElement(import_editor_ui20.PromotionChip, null)
10763
+ children ?? /* @__PURE__ */ React136.createElement(import_editor_ui21.PromotionChip, null)
10733
10764
  )
10734
10765
  ));
10735
10766
  }
@@ -11080,7 +11111,7 @@ var differsFromExternal = (newState, externalState) => {
11080
11111
  // src/components/size/unit-select.tsx
11081
11112
  var React141 = __toESM(require("react"));
11082
11113
  var import_react85 = require("react");
11083
- var import_editor_ui21 = require("@elementor/editor-ui");
11114
+ var import_editor_ui22 = require("@elementor/editor-ui");
11084
11115
  var import_ui125 = require("@elementor/ui");
11085
11116
  var menuItemContentStyles2 = {
11086
11117
  display: "flex",
@@ -11097,7 +11128,7 @@ var UnitSelect = ({ value, showPrimaryColor, onClick, options }) => {
11097
11128
  popupState.close();
11098
11129
  };
11099
11130
  return /* @__PURE__ */ React141.createElement(React141.Fragment, null, /* @__PURE__ */ React141.createElement(StyledButton3, { isPrimaryColor: showPrimaryColor, size: "small", ...(0, import_ui125.bindTrigger)(popupState) }, value), /* @__PURE__ */ React141.createElement(import_ui125.Menu, { MenuListProps: { dense: true }, ...(0, import_ui125.bindMenu)(popupState) }, options.map((option, index) => /* @__PURE__ */ React141.createElement(
11100
- import_editor_ui21.MenuListItem,
11131
+ import_editor_ui22.MenuListItem,
11101
11132
  {
11102
11133
  key: option,
11103
11134
  onClick: () => handleMenuItemClick(index),