@elementor/editor-variables 4.5.0-1180 → 4.5.0-1182

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.d.mts CHANGED
@@ -1,5 +1,6 @@
1
1
  import * as react from 'react';
2
2
  import { KeyboardEvent } from 'react';
3
+ import * as _elementor_locations from '@elementor/locations';
3
4
  import * as _elementor_editor_props from '@elementor/editor-props';
4
5
  import { PropType } from '@elementor/editor-props';
5
6
  import { z } from '@elementor/schema';
@@ -17,6 +18,15 @@ declare function VariablesManagerPanelEmbedded({ onRequestClose, onExposeCloseAt
17
18
 
18
19
  declare function init(): void;
19
20
 
21
+ type VariableFormHeaderProps = {
22
+ variableType: string;
23
+ variableId?: string;
24
+ label?: string;
25
+ };
26
+ declare const injectIntoVariableFormHeader: (args: _elementor_locations.InjectArgs<VariableFormHeaderProps>) => void;
27
+
28
+ declare const injectIntoVariablesManagerHeader: (args: _elementor_locations.InjectArgs<object>) => void;
29
+
20
30
  declare const GLOBAL_VARIABLES_URI = "elementor://global-variables";
21
31
 
22
32
  declare const sizeVariablePropTypeUtil: {
@@ -214,4 +224,4 @@ declare const Utils: {
214
224
  };
215
225
  };
216
226
 
217
- export { GLOBAL_VARIABLES_URI, type MenuActionContext, type MenuActionsFactory, Utils, type VariableManagerMenuAction, VariablesManagerPanelEmbedded, type VariablesManagerPanelEmbeddedProps, getMenuActionsForVariable, hasVariable, init, registerVariableType, registerVariableTypes, service, sizeVariablePropTypeUtil, trackVariablesManagerEvent };
227
+ export { GLOBAL_VARIABLES_URI, type MenuActionContext, type MenuActionsFactory, Utils, type VariableFormHeaderProps, type VariableManagerMenuAction, VariablesManagerPanelEmbedded, type VariablesManagerPanelEmbeddedProps, getMenuActionsForVariable, hasVariable, init, injectIntoVariableFormHeader, injectIntoVariablesManagerHeader, registerVariableType, registerVariableTypes, service, sizeVariablePropTypeUtil, trackVariablesManagerEvent };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import * as react from 'react';
2
2
  import { KeyboardEvent } from 'react';
3
+ import * as _elementor_locations from '@elementor/locations';
3
4
  import * as _elementor_editor_props from '@elementor/editor-props';
4
5
  import { PropType } from '@elementor/editor-props';
5
6
  import { z } from '@elementor/schema';
@@ -17,6 +18,15 @@ declare function VariablesManagerPanelEmbedded({ onRequestClose, onExposeCloseAt
17
18
 
18
19
  declare function init(): void;
19
20
 
21
+ type VariableFormHeaderProps = {
22
+ variableType: string;
23
+ variableId?: string;
24
+ label?: string;
25
+ };
26
+ declare const injectIntoVariableFormHeader: (args: _elementor_locations.InjectArgs<VariableFormHeaderProps>) => void;
27
+
28
+ declare const injectIntoVariablesManagerHeader: (args: _elementor_locations.InjectArgs<object>) => void;
29
+
20
30
  declare const GLOBAL_VARIABLES_URI = "elementor://global-variables";
21
31
 
22
32
  declare const sizeVariablePropTypeUtil: {
@@ -214,4 +224,4 @@ declare const Utils: {
214
224
  };
215
225
  };
216
226
 
217
- export { GLOBAL_VARIABLES_URI, type MenuActionContext, type MenuActionsFactory, Utils, type VariableManagerMenuAction, VariablesManagerPanelEmbedded, type VariablesManagerPanelEmbeddedProps, getMenuActionsForVariable, hasVariable, init, registerVariableType, registerVariableTypes, service, sizeVariablePropTypeUtil, trackVariablesManagerEvent };
227
+ export { GLOBAL_VARIABLES_URI, type MenuActionContext, type MenuActionsFactory, Utils, type VariableFormHeaderProps, type VariableManagerMenuAction, VariablesManagerPanelEmbedded, type VariablesManagerPanelEmbeddedProps, getMenuActionsForVariable, hasVariable, init, injectIntoVariableFormHeader, injectIntoVariablesManagerHeader, registerVariableType, registerVariableTypes, service, sizeVariablePropTypeUtil, trackVariablesManagerEvent };
package/dist/index.js CHANGED
@@ -36,6 +36,8 @@ __export(index_exports, {
36
36
  getMenuActionsForVariable: () => getMenuActionsForVariable,
37
37
  hasVariable: () => hasVariable,
38
38
  init: () => init,
39
+ injectIntoVariableFormHeader: () => injectIntoVariableFormHeader,
40
+ injectIntoVariablesManagerHeader: () => injectIntoVariablesManagerHeader,
39
41
  registerVariableType: () => registerVariableType,
40
42
  registerVariableTypes: () => registerVariableTypes,
41
43
  service: () => service,
@@ -876,6 +878,14 @@ var NoSearchResults = ({ searchValue, onClear, icon }) => {
876
878
  );
877
879
  };
878
880
 
881
+ // src/components/variables-manager-header-location.tsx
882
+ var import_locations = require("@elementor/locations");
883
+ var {
884
+ Slot: VariablesManagerHeaderSlot,
885
+ inject: injectIntoVariablesManagerHeader,
886
+ useInjections: useVariablesManagerHeaderInjections
887
+ } = (0, import_locations.createLocation)();
888
+
879
889
  // src/components/variables-manager/hooks/use-auto-edit.ts
880
890
  var import_react = require("react");
881
891
  var useAutoEdit = () => {
@@ -2205,7 +2215,7 @@ function VariablesManagerPanelContent({ onRequestClose, onExposeCloseAttempt })
2205
2215
  }
2206
2216
  }
2207
2217
  ),
2208
- /* @__PURE__ */ React14.createElement(import_ui14.Box, { sx: { display: "flex", flexShrink: 0, alignItems: "center" } }, /* @__PURE__ */ React14.createElement(
2218
+ /* @__PURE__ */ React14.createElement(import_ui14.Box, { sx: { display: "flex", flexShrink: 0, alignItems: "center", gap: 0.5 } }, /* @__PURE__ */ React14.createElement(VariablesManagerHeaderSlot, null), /* @__PURE__ */ React14.createElement(
2209
2219
  VariableManagerCreateMenu,
2210
2220
  {
2211
2221
  outlinedTrigger: true,
@@ -2573,10 +2583,18 @@ var FormField = ({ id, label, errorMsg, noticeMsg, children }) => {
2573
2583
  return /* @__PURE__ */ React16.createElement(import_ui16.Grid, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React16.createElement(import_ui16.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React16.createElement(import_ui16.FormLabel, { htmlFor: id, size: "tiny" }, label)), /* @__PURE__ */ React16.createElement(import_ui16.Grid, { item: true, xs: 12 }, children, errorMsg && /* @__PURE__ */ React16.createElement(import_ui16.FormHelperText, { error: true }, errorMsg), noticeMsg && /* @__PURE__ */ React16.createElement(import_ui16.FormHelperText, null, noticeMsg)));
2574
2584
  };
2575
2585
 
2586
+ // src/components/variable-form-header-location.tsx
2587
+ var import_locations2 = require("@elementor/locations");
2588
+ var {
2589
+ Slot: VariableFormHeaderSlot,
2590
+ inject: injectIntoVariableFormHeader,
2591
+ useInjections: useVariableFormHeaderInjections
2592
+ } = (0, import_locations2.createLocation)();
2593
+
2576
2594
  // src/components/variable-creation.tsx
2577
2595
  var SIZE2 = "tiny";
2578
2596
  var VariableCreation = ({ onGoBack, onClose }) => {
2579
- const { icon: VariableIcon, valueField: ValueField, propTypeUtil } = useVariableType();
2597
+ const { icon: VariableIcon, valueField: ValueField, propTypeUtil, variableType } = useVariableType();
2580
2598
  const { setVariableValue: setVariable, path } = useVariableBoundProp();
2581
2599
  const { propType } = (0, import_editor_controls5.useBoundProp)();
2582
2600
  const initialValue = useInitialValue();
@@ -2644,7 +2662,17 @@ var VariableCreation = ({ onGoBack, onClose }) => {
2644
2662
  {
2645
2663
  icon: /* @__PURE__ */ React17.createElement(React17.Fragment, null, onGoBack && /* @__PURE__ */ React17.createElement(import_ui17.IconButton, { size: SIZE2, "aria-label": (0, import_i18n11.__)("Go Back", "elementor"), onClick: onGoBack }, /* @__PURE__ */ React17.createElement(import_icons6.ArrowLeftIcon, { fontSize: SIZE2 })), /* @__PURE__ */ React17.createElement(VariableIcon, { fontSize: SIZE2 })),
2646
2664
  title: (0, import_i18n11.__)("Create variable", "elementor"),
2647
- onClose: closePopover
2665
+ onClose: closePopover,
2666
+ actions: [
2667
+ /* @__PURE__ */ React17.createElement(
2668
+ VariableFormHeaderSlot,
2669
+ {
2670
+ key: "variable-form-header",
2671
+ variableType,
2672
+ label: label || void 0
2673
+ }
2674
+ )
2675
+ ]
2648
2676
  }
2649
2677
  ), /* @__PURE__ */ React17.createElement(import_ui17.Divider, null), /* @__PURE__ */ React17.createElement(import_editor_controls5.PopoverContent, { p: 2 }, /* @__PURE__ */ React17.createElement(
2650
2678
  FormField,
@@ -2829,7 +2857,17 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
2829
2857
  const closeEditDialog = () => () => {
2830
2858
  setEditConfirmation(false);
2831
2859
  };
2832
- const actions = [];
2860
+ const actions = [
2861
+ /* @__PURE__ */ React19.createElement(
2862
+ VariableFormHeaderSlot,
2863
+ {
2864
+ key: "variable-form-header",
2865
+ variableType,
2866
+ variableId: editId,
2867
+ label
2868
+ }
2869
+ )
2870
+ ];
2833
2871
  if (userPermissions.canDelete()) {
2834
2872
  actions.push(
2835
2873
  /* @__PURE__ */ React19.createElement(import_ui19.Tooltip, { key: "delete", placement: "top", title: DELETE_LABEL }, /* @__PURE__ */ React19.createElement(import_ui19.IconButton, { size: SIZE3, onClick: handleDeleteConfirmation, "aria-label": DELETE_LABEL }, /* @__PURE__ */ React19.createElement(import_icons8.TrashIcon, { fontSize: SIZE3 })))
@@ -4663,6 +4701,8 @@ var Utils = {
4663
4701
  getMenuActionsForVariable,
4664
4702
  hasVariable,
4665
4703
  init,
4704
+ injectIntoVariableFormHeader,
4705
+ injectIntoVariablesManagerHeader,
4666
4706
  registerVariableType,
4667
4707
  registerVariableTypes,
4668
4708
  service,