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

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elementor/editor-variables",
3
- "version": "4.5.0-1180",
3
+ "version": "4.5.0-1181",
4
4
  "private": false,
5
5
  "author": "Elementor Team",
6
6
  "homepage": "https://elementor.com/",
@@ -39,22 +39,23 @@
39
39
  "dev": "tsup --config=../../tsup.dev.ts"
40
40
  },
41
41
  "dependencies": {
42
- "@elementor/editor": "4.5.0-1180",
43
- "@elementor/editor-canvas": "4.5.0-1180",
44
- "@elementor/editor-controls": "4.5.0-1180",
45
- "@elementor/editor-current-user": "4.5.0-1180",
46
- "@elementor/editor-mcp": "4.5.0-1180",
47
- "@elementor/editor-panels": "4.5.0-1180",
48
- "@elementor/editor-props": "4.5.0-1180",
49
- "@elementor/editor-ui": "4.5.0-1180",
50
- "@elementor/editor-v1-adapters": "4.5.0-1180",
51
- "@elementor/menus": "4.5.0-1180",
52
- "@elementor/http-client": "4.5.0-1180",
42
+ "@elementor/editor": "4.5.0-1181",
43
+ "@elementor/editor-canvas": "4.5.0-1181",
44
+ "@elementor/editor-controls": "4.5.0-1181",
45
+ "@elementor/editor-current-user": "4.5.0-1181",
46
+ "@elementor/editor-mcp": "4.5.0-1181",
47
+ "@elementor/editor-panels": "4.5.0-1181",
48
+ "@elementor/editor-props": "4.5.0-1181",
49
+ "@elementor/editor-ui": "4.5.0-1181",
50
+ "@elementor/editor-v1-adapters": "4.5.0-1181",
51
+ "@elementor/locations": "4.5.0-1181",
52
+ "@elementor/menus": "4.5.0-1181",
53
+ "@elementor/http-client": "4.5.0-1181",
53
54
  "@elementor/icons": "~1.78.1",
54
- "@elementor/events": "4.5.0-1180",
55
- "@elementor/schema": "4.5.0-1180",
55
+ "@elementor/events": "4.5.0-1181",
56
+ "@elementor/schema": "4.5.0-1181",
56
57
  "@elementor/ui": "1.41.4",
57
- "@elementor/utils": "4.5.0-1180",
58
+ "@elementor/utils": "4.5.0-1181",
58
59
  "@wordpress/i18n": "^5.13.0"
59
60
  },
60
61
  "peerDependencies": {
@@ -13,6 +13,7 @@ import { useVariableBoundProp } from '../hooks/use-variable-bound-prop';
13
13
  import { ERROR_MESSAGES, labelHint, mapServerError } from '../utils/validations';
14
14
  import { LabelField, useLabelError } from './fields/label-field';
15
15
  import { FormField } from './ui/form-field';
16
+ import { VariableFormHeaderSlot } from './variable-form-header-location';
16
17
 
17
18
  const SIZE = 'tiny';
18
19
 
@@ -22,7 +23,7 @@ type Props = {
22
23
  };
23
24
 
24
25
  export const VariableCreation = ( { onGoBack, onClose }: Props ) => {
25
- const { icon: VariableIcon, valueField: ValueField, propTypeUtil } = useVariableType();
26
+ const { icon: VariableIcon, valueField: ValueField, propTypeUtil, variableType } = useVariableType();
26
27
 
27
28
  const { setVariableValue: setVariable, path } = useVariableBoundProp();
28
29
  const { propType } = useBoundProp();
@@ -117,6 +118,13 @@ export const VariableCreation = ( { onGoBack, onClose }: Props ) => {
117
118
  }
118
119
  title={ __( 'Create variable', 'elementor' ) }
119
120
  onClose={ closePopover }
121
+ actions={ [
122
+ <VariableFormHeaderSlot
123
+ key="variable-form-header"
124
+ variableType={ variableType }
125
+ label={ label || undefined }
126
+ />,
127
+ ] }
120
128
  />
121
129
 
122
130
  <Divider />
@@ -17,6 +17,7 @@ import { LabelField, useLabelError } from './fields/label-field';
17
17
  import { DeleteConfirmationDialog } from './ui/delete-confirmation-dialog';
18
18
  import { EDIT_CONFIRMATION_DIALOG_ID, EditConfirmationDialog } from './ui/edit-confirmation-dialog';
19
19
  import { FormField } from './ui/form-field';
20
+ import { VariableFormHeaderSlot } from './variable-form-header-location';
20
21
 
21
22
  const SIZE = 'tiny';
22
23
  const DELETE_LABEL = __( 'Delete variable', 'elementor' );
@@ -125,7 +126,14 @@ export const VariableEdit = ( { onClose, onGoBack, onSubmit, editId }: Props ) =
125
126
  setEditConfirmation( false );
126
127
  };
127
128
 
128
- const actions = [];
129
+ const actions: React.ReactNode[] = [
130
+ <VariableFormHeaderSlot
131
+ key="variable-form-header"
132
+ variableType={ variableType }
133
+ variableId={ editId }
134
+ label={ label }
135
+ />,
136
+ ];
129
137
 
130
138
  if ( userPermissions.canDelete() ) {
131
139
  actions.push(
@@ -0,0 +1,13 @@
1
+ import { createLocation } from '@elementor/locations';
2
+
3
+ export type VariableFormHeaderProps = {
4
+ variableType: string;
5
+ variableId?: string;
6
+ label?: string;
7
+ };
8
+
9
+ export const {
10
+ Slot: VariableFormHeaderSlot,
11
+ inject: injectIntoVariableFormHeader,
12
+ useInjections: useVariableFormHeaderInjections,
13
+ } = createLocation< VariableFormHeaderProps >();
@@ -13,6 +13,7 @@ import { getMenuActionsForVariable, getVariableType } from '../../variables-regi
13
13
  import { DeleteConfirmationDialog } from '../ui/delete-confirmation-dialog';
14
14
  import { EmptyState } from '../ui/empty-state';
15
15
  import { NoSearchResults } from '../ui/no-search-results';
16
+ import { VariablesManagerHeaderSlot } from '../variables-manager-header-location';
16
17
  import { useAutoEdit } from './hooks/use-auto-edit';
17
18
  import { useErrorNavigation } from './hooks/use-error-navigation';
18
19
  import { useVariablesManagerState } from './hooks/use-variables-manager-state';
@@ -272,7 +273,8 @@ function VariablesManagerPanelContent( { onRequestClose, onExposeCloseAttempt }:
272
273
  alignSelf: 'stretch',
273
274
  } }
274
275
  />
275
- <Box sx={ { display: 'flex', flexShrink: 0, alignItems: 'center' } }>
276
+ <Box sx={ { display: 'flex', flexShrink: 0, alignItems: 'center', gap: 0.5 } }>
277
+ <VariablesManagerHeaderSlot />
276
278
  <VariableManagerCreateMenu
277
279
  outlinedTrigger
278
280
  onCreate={ handleCreateVariable }
@@ -0,0 +1,7 @@
1
+ import { createLocation } from '@elementor/locations';
2
+
3
+ export const {
4
+ Slot: VariablesManagerHeaderSlot,
5
+ inject: injectIntoVariablesManagerHeader,
6
+ useInjections: useVariablesManagerHeaderInjections,
7
+ } = createLocation();
package/src/index.ts CHANGED
@@ -3,6 +3,8 @@ export {
3
3
  type VariablesManagerPanelEmbeddedProps,
4
4
  } from './components/variables-manager/variables-manager-panel';
5
5
  export { init } from './init';
6
+ export { injectIntoVariableFormHeader, type VariableFormHeaderProps } from './components/variable-form-header-location';
7
+ export { injectIntoVariablesManagerHeader } from './components/variables-manager-header-location';
6
8
  export { GLOBAL_VARIABLES_URI } from './mcp/variables-resource';
7
9
  export { sizeVariablePropTypeUtil } from './prop-types/size-variable-prop-type';
8
10
  export { registerVariableTypes } from './register-variable-types';