@elementor/editor-variables 3.35.0-342 → 3.35.0-344
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 +29 -3
- package/dist/index.d.ts +29 -3
- package/dist/index.js +94 -44
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +85 -36
- package/dist/index.mjs.map +1 -1
- package/package.json +14 -14
- package/src/components/ui/empty-state.tsx +29 -29
- package/src/components/variable-creation.tsx +17 -15
- package/src/components/variable-edit.tsx +17 -15
- package/src/components/variable-restore.tsx +16 -14
- package/src/components/variable-selection-popover.tsx +4 -0
- package/src/components/variables-manager/variables-manager-table.tsx +2 -2
- package/src/components/variables-selection.tsx +45 -23
- package/src/hooks/use-quota-permissions.ts +18 -0
- package/src/index.ts +1 -0
- package/src/prop-types/size-variable-prop-type.ts +4 -0
- package/src/register-variable-types.tsx +14 -2
- package/src/sync/license-info.ts +9 -0
- package/src/sync/types.ts +1 -0
- package/src/variables-registry/create-variable-type-registry.ts +4 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as _elementor_editor_props from '@elementor/editor-props';
|
|
2
2
|
import { PropType } from '@elementor/editor-props';
|
|
3
|
+
import { z } from '@elementor/schema';
|
|
3
4
|
import * as react from 'react';
|
|
4
5
|
import { RefObject } from 'react';
|
|
5
6
|
import * as _mui_material from '@mui/material';
|
|
@@ -8,6 +9,30 @@ declare function init(): void;
|
|
|
8
9
|
|
|
9
10
|
declare function registerVariableTypes(): void;
|
|
10
11
|
|
|
12
|
+
declare const sizeVariablePropTypeUtil: {
|
|
13
|
+
extract: (prop: unknown) => string | null;
|
|
14
|
+
isValid: (prop: unknown) => prop is _elementor_editor_props.TransformablePropValue<"global-size-variable", string>;
|
|
15
|
+
create: {
|
|
16
|
+
(value: string): _elementor_editor_props.TransformablePropValue<"global-size-variable", string>;
|
|
17
|
+
(value: string, createOptions?: _elementor_editor_props.CreateOptions): _elementor_editor_props.TransformablePropValue<"global-size-variable", string>;
|
|
18
|
+
(value: (prev?: string | undefined) => string, createOptions: _elementor_editor_props.CreateOptions): _elementor_editor_props.TransformablePropValue<"global-size-variable", string>;
|
|
19
|
+
};
|
|
20
|
+
schema: z.ZodObject<{
|
|
21
|
+
$$type: z.ZodLiteral<"global-size-variable">;
|
|
22
|
+
value: z.ZodType<string, z.ZodTypeDef, string>;
|
|
23
|
+
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
24
|
+
}, "strict", z.ZodTypeAny, {
|
|
25
|
+
value: string;
|
|
26
|
+
$$type: "global-size-variable";
|
|
27
|
+
disabled?: boolean | undefined;
|
|
28
|
+
}, {
|
|
29
|
+
value: string;
|
|
30
|
+
$$type: "global-size-variable";
|
|
31
|
+
disabled?: boolean | undefined;
|
|
32
|
+
}>;
|
|
33
|
+
key: "global-size-variable";
|
|
34
|
+
};
|
|
35
|
+
|
|
11
36
|
type TVariable = {
|
|
12
37
|
type: string;
|
|
13
38
|
label: string;
|
|
@@ -77,12 +102,12 @@ type ValueFieldProps = {
|
|
|
77
102
|
ref?: RefObject<HTMLElement | null>;
|
|
78
103
|
};
|
|
79
104
|
|
|
80
|
-
declare const registerVariableType: ({ key, icon, startIcon, valueField, propTypeUtil, variableType, defaultValue, selectionFilter, valueTransformer, fallbackPropTypeUtil, isCompatible, }: {
|
|
105
|
+
declare const registerVariableType: ({ key, icon, startIcon, valueField, propTypeUtil, variableType, defaultValue, selectionFilter, valueTransformer, fallbackPropTypeUtil, isCompatible, emptyState, }: {
|
|
81
106
|
icon: react.ForwardRefExoticComponent<Omit<_mui_material.SvgIconProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
|
|
82
107
|
startIcon?: ({ value }: {
|
|
83
108
|
value: string;
|
|
84
109
|
}) => react.JSX.Element;
|
|
85
|
-
valueField
|
|
110
|
+
valueField?: (props: ValueFieldProps) => react.JSX.Element;
|
|
86
111
|
variableType: string;
|
|
87
112
|
key?: string;
|
|
88
113
|
defaultValue?: string;
|
|
@@ -91,6 +116,7 @@ declare const registerVariableType: ({ key, icon, startIcon, valueField, propTyp
|
|
|
91
116
|
selectionFilter?: (variables: NormalizedVariable[], propType: _elementor_editor_props.PropType) => NormalizedVariable[];
|
|
92
117
|
valueTransformer?: (value: string, type?: string) => _elementor_editor_props.PropValue;
|
|
93
118
|
isCompatible?: (propType: _elementor_editor_props.PropType, variable: Variable) => boolean;
|
|
119
|
+
emptyState?: react.JSX.Element;
|
|
94
120
|
}) => void;
|
|
95
121
|
|
|
96
122
|
declare const GLOBAL_VARIABLES_URI = "elementor://global-variables";
|
|
@@ -112,4 +138,4 @@ declare const Utils: {
|
|
|
112
138
|
};
|
|
113
139
|
};
|
|
114
140
|
|
|
115
|
-
export { GLOBAL_VARIABLES_URI, Utils, init, registerVariableType, registerVariableTypes, service };
|
|
141
|
+
export { GLOBAL_VARIABLES_URI, Utils, init, registerVariableType, registerVariableTypes, service, sizeVariablePropTypeUtil };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as _elementor_editor_props from '@elementor/editor-props';
|
|
2
2
|
import { PropType } from '@elementor/editor-props';
|
|
3
|
+
import { z } from '@elementor/schema';
|
|
3
4
|
import * as react from 'react';
|
|
4
5
|
import { RefObject } from 'react';
|
|
5
6
|
import * as _mui_material from '@mui/material';
|
|
@@ -8,6 +9,30 @@ declare function init(): void;
|
|
|
8
9
|
|
|
9
10
|
declare function registerVariableTypes(): void;
|
|
10
11
|
|
|
12
|
+
declare const sizeVariablePropTypeUtil: {
|
|
13
|
+
extract: (prop: unknown) => string | null;
|
|
14
|
+
isValid: (prop: unknown) => prop is _elementor_editor_props.TransformablePropValue<"global-size-variable", string>;
|
|
15
|
+
create: {
|
|
16
|
+
(value: string): _elementor_editor_props.TransformablePropValue<"global-size-variable", string>;
|
|
17
|
+
(value: string, createOptions?: _elementor_editor_props.CreateOptions): _elementor_editor_props.TransformablePropValue<"global-size-variable", string>;
|
|
18
|
+
(value: (prev?: string | undefined) => string, createOptions: _elementor_editor_props.CreateOptions): _elementor_editor_props.TransformablePropValue<"global-size-variable", string>;
|
|
19
|
+
};
|
|
20
|
+
schema: z.ZodObject<{
|
|
21
|
+
$$type: z.ZodLiteral<"global-size-variable">;
|
|
22
|
+
value: z.ZodType<string, z.ZodTypeDef, string>;
|
|
23
|
+
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
24
|
+
}, "strict", z.ZodTypeAny, {
|
|
25
|
+
value: string;
|
|
26
|
+
$$type: "global-size-variable";
|
|
27
|
+
disabled?: boolean | undefined;
|
|
28
|
+
}, {
|
|
29
|
+
value: string;
|
|
30
|
+
$$type: "global-size-variable";
|
|
31
|
+
disabled?: boolean | undefined;
|
|
32
|
+
}>;
|
|
33
|
+
key: "global-size-variable";
|
|
34
|
+
};
|
|
35
|
+
|
|
11
36
|
type TVariable = {
|
|
12
37
|
type: string;
|
|
13
38
|
label: string;
|
|
@@ -77,12 +102,12 @@ type ValueFieldProps = {
|
|
|
77
102
|
ref?: RefObject<HTMLElement | null>;
|
|
78
103
|
};
|
|
79
104
|
|
|
80
|
-
declare const registerVariableType: ({ key, icon, startIcon, valueField, propTypeUtil, variableType, defaultValue, selectionFilter, valueTransformer, fallbackPropTypeUtil, isCompatible, }: {
|
|
105
|
+
declare const registerVariableType: ({ key, icon, startIcon, valueField, propTypeUtil, variableType, defaultValue, selectionFilter, valueTransformer, fallbackPropTypeUtil, isCompatible, emptyState, }: {
|
|
81
106
|
icon: react.ForwardRefExoticComponent<Omit<_mui_material.SvgIconProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
|
|
82
107
|
startIcon?: ({ value }: {
|
|
83
108
|
value: string;
|
|
84
109
|
}) => react.JSX.Element;
|
|
85
|
-
valueField
|
|
110
|
+
valueField?: (props: ValueFieldProps) => react.JSX.Element;
|
|
86
111
|
variableType: string;
|
|
87
112
|
key?: string;
|
|
88
113
|
defaultValue?: string;
|
|
@@ -91,6 +116,7 @@ declare const registerVariableType: ({ key, icon, startIcon, valueField, propTyp
|
|
|
91
116
|
selectionFilter?: (variables: NormalizedVariable[], propType: _elementor_editor_props.PropType) => NormalizedVariable[];
|
|
92
117
|
valueTransformer?: (value: string, type?: string) => _elementor_editor_props.PropValue;
|
|
93
118
|
isCompatible?: (propType: _elementor_editor_props.PropType, variable: Variable) => boolean;
|
|
119
|
+
emptyState?: react.JSX.Element;
|
|
94
120
|
}) => void;
|
|
95
121
|
|
|
96
122
|
declare const GLOBAL_VARIABLES_URI = "elementor://global-variables";
|
|
@@ -112,4 +138,4 @@ declare const Utils: {
|
|
|
112
138
|
};
|
|
113
139
|
};
|
|
114
140
|
|
|
115
|
-
export { GLOBAL_VARIABLES_URI, Utils, init, registerVariableType, registerVariableTypes, service };
|
|
141
|
+
export { GLOBAL_VARIABLES_URI, Utils, init, registerVariableType, registerVariableTypes, service, sizeVariablePropTypeUtil };
|
package/dist/index.js
CHANGED
|
@@ -35,7 +35,8 @@ __export(index_exports, {
|
|
|
35
35
|
init: () => init,
|
|
36
36
|
registerVariableType: () => registerVariableType,
|
|
37
37
|
registerVariableTypes: () => registerVariableTypes,
|
|
38
|
-
service: () => service
|
|
38
|
+
service: () => service,
|
|
39
|
+
sizeVariablePropTypeUtil: () => sizeVariablePropTypeUtil
|
|
39
40
|
});
|
|
40
41
|
module.exports = __toCommonJS(index_exports);
|
|
41
42
|
|
|
@@ -43,7 +44,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
43
44
|
var import_editor = require("@elementor/editor");
|
|
44
45
|
var import_editor_editing_panel8 = require("@elementor/editor-editing-panel");
|
|
45
46
|
var import_editor_panels2 = require("@elementor/editor-panels");
|
|
46
|
-
var
|
|
47
|
+
var import_editor_props7 = require("@elementor/editor-props");
|
|
47
48
|
|
|
48
49
|
// src/components/variables-manager/variables-manager-panel.tsx
|
|
49
50
|
var React12 = __toESM(require("react"));
|
|
@@ -681,7 +682,8 @@ function createVariableTypeRegistry() {
|
|
|
681
682
|
selectionFilter,
|
|
682
683
|
valueTransformer,
|
|
683
684
|
fallbackPropTypeUtil,
|
|
684
|
-
isCompatible
|
|
685
|
+
isCompatible,
|
|
686
|
+
emptyState
|
|
685
687
|
}) => {
|
|
686
688
|
const variableTypeKey = key ?? propTypeUtil.key;
|
|
687
689
|
if (!isCompatible) {
|
|
@@ -704,7 +706,8 @@ function createVariableTypeRegistry() {
|
|
|
704
706
|
selectionFilter,
|
|
705
707
|
valueTransformer,
|
|
706
708
|
fallbackPropTypeUtil,
|
|
707
|
-
isCompatible
|
|
709
|
+
isCompatible,
|
|
710
|
+
emptyState
|
|
708
711
|
};
|
|
709
712
|
registerTransformer(propTypeUtil.key);
|
|
710
713
|
registerInheritanceTransformer(propTypeUtil.key);
|
|
@@ -771,8 +774,13 @@ var usePermissions = () => {
|
|
|
771
774
|
};
|
|
772
775
|
|
|
773
776
|
// src/components/ui/empty-state.tsx
|
|
774
|
-
var EmptyState = ({ icon, title, message, onAdd }) => {
|
|
777
|
+
var EmptyState = ({ icon, title, message, onAdd, children }) => {
|
|
775
778
|
const canAdd = usePermissions().canAdd();
|
|
779
|
+
const displayTitle = canAdd ? title : (0, import_i18n5.__)("There are no variables", "elementor");
|
|
780
|
+
const displayMessage = canAdd ? message : (0, import_i18n5.__)("With your current role, you can only connect and detach variables.", "elementor");
|
|
781
|
+
return /* @__PURE__ */ React3.createElement(Content, { title: displayTitle, message: displayMessage, icon }, children || onAdd && /* @__PURE__ */ React3.createElement(import_ui4.Button, { variant: "outlined", color: "secondary", size: "small", onClick: onAdd }, (0, import_i18n5.__)("Create a variable", "elementor")));
|
|
782
|
+
};
|
|
783
|
+
function Content({ title, message, icon, children }) {
|
|
776
784
|
return /* @__PURE__ */ React3.createElement(
|
|
777
785
|
import_ui4.Stack,
|
|
778
786
|
{
|
|
@@ -784,17 +792,10 @@ var EmptyState = ({ icon, title, message, onAdd }) => {
|
|
|
784
792
|
sx: { p: 2.5, pt: 8, pb: 5.5 }
|
|
785
793
|
},
|
|
786
794
|
icon,
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
title: (0, import_i18n5.__)("There are no variables", "elementor"),
|
|
791
|
-
message: (0, import_i18n5.__)("With your current role, you can only connect and detach variables.", "elementor")
|
|
792
|
-
}
|
|
793
|
-
)
|
|
795
|
+
/* @__PURE__ */ React3.createElement(import_ui4.Typography, { align: "center", variant: "subtitle2" }, title),
|
|
796
|
+
/* @__PURE__ */ React3.createElement(import_ui4.Typography, { align: "center", variant: "caption", maxWidth: "180px" }, message),
|
|
797
|
+
children
|
|
794
798
|
);
|
|
795
|
-
};
|
|
796
|
-
function Content({ title, message }) {
|
|
797
|
-
return /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(import_ui4.Typography, { align: "center", variant: "subtitle2" }, title), /* @__PURE__ */ React3.createElement(import_ui4.Typography, { align: "center", variant: "caption", maxWidth: "180px" }, message));
|
|
798
799
|
}
|
|
799
800
|
|
|
800
801
|
// src/components/ui/no-search-results.tsx
|
|
@@ -1617,7 +1618,7 @@ var VariablesManagerTable = ({
|
|
|
1617
1618
|
onChange,
|
|
1618
1619
|
onValidationChange,
|
|
1619
1620
|
error
|
|
1620
|
-
}) => row.valueField({
|
|
1621
|
+
}) => row.valueField?.({
|
|
1621
1622
|
ref: {
|
|
1622
1623
|
current: variableRowRefs.current.get(
|
|
1623
1624
|
"table-ref-" + row.id
|
|
@@ -1637,7 +1638,7 @@ var VariablesManagerTable = ({
|
|
|
1637
1638
|
onFieldError?.(!!errorMsg);
|
|
1638
1639
|
},
|
|
1639
1640
|
error
|
|
1640
|
-
}),
|
|
1641
|
+
}) ?? /* @__PURE__ */ React11.createElement(React11.Fragment, null),
|
|
1641
1642
|
onRowRef: handleRowRef(row.id),
|
|
1642
1643
|
gap: 0.25,
|
|
1643
1644
|
fieldType: "value"
|
|
@@ -2002,6 +2003,25 @@ var usePopoverContentRef = () => {
|
|
|
2002
2003
|
return (0, import_react12.useContext)(PopoverContentRefContext);
|
|
2003
2004
|
};
|
|
2004
2005
|
|
|
2006
|
+
// src/sync/license-info.ts
|
|
2007
|
+
function getLicenseInfo() {
|
|
2008
|
+
const extendedWindow = window;
|
|
2009
|
+
return {
|
|
2010
|
+
hasPro: !!extendedWindow.elementorPro
|
|
2011
|
+
};
|
|
2012
|
+
}
|
|
2013
|
+
|
|
2014
|
+
// src/hooks/use-quota-permissions.ts
|
|
2015
|
+
var useQuotaPermissions = (variableType) => {
|
|
2016
|
+
const quotaConfig = window.ElementorVariablesQuotaConfig || {};
|
|
2017
|
+
const limit = quotaConfig[variableType] || 0;
|
|
2018
|
+
const hasQuota = limit > 0;
|
|
2019
|
+
return {
|
|
2020
|
+
canAdd: () => hasQuota || getLicenseInfo().hasPro,
|
|
2021
|
+
canEdit: () => hasQuota || getLicenseInfo().hasPro
|
|
2022
|
+
};
|
|
2023
|
+
};
|
|
2024
|
+
|
|
2005
2025
|
// src/components/variable-creation.tsx
|
|
2006
2026
|
var React15 = __toESM(require("react"));
|
|
2007
2027
|
var import_react13 = require("react");
|
|
@@ -2154,7 +2174,7 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
2154
2174
|
}
|
|
2155
2175
|
}
|
|
2156
2176
|
)
|
|
2157
|
-
), /* @__PURE__ */ React15.createElement(FormField, { errorMsg: valueFieldError, label: (0, import_i18n10.__)("Value", "elementor") }, /* @__PURE__ */ React15.createElement(import_ui15.Typography, { variant: "h5", id: "variable-value-wrapper" }, /* @__PURE__ */ React15.createElement(
|
|
2177
|
+
), ValueField && /* @__PURE__ */ React15.createElement(FormField, { errorMsg: valueFieldError, label: (0, import_i18n10.__)("Value", "elementor") }, /* @__PURE__ */ React15.createElement(import_ui15.Typography, { variant: "h5", id: "variable-value-wrapper" }, /* @__PURE__ */ React15.createElement(
|
|
2158
2178
|
ValueField,
|
|
2159
2179
|
{
|
|
2160
2180
|
value,
|
|
@@ -2373,7 +2393,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2373
2393
|
}
|
|
2374
2394
|
}
|
|
2375
2395
|
)
|
|
2376
|
-
), /* @__PURE__ */ React17.createElement(FormField, { errorMsg: valueFieldError, label: (0, import_i18n12.__)("Value", "elementor") }, /* @__PURE__ */ React17.createElement(import_ui17.Typography, { variant: "h5" }, /* @__PURE__ */ React17.createElement(
|
|
2396
|
+
), ValueField && /* @__PURE__ */ React17.createElement(FormField, { errorMsg: valueFieldError, label: (0, import_i18n12.__)("Value", "elementor") }, /* @__PURE__ */ React17.createElement(import_ui17.Typography, { variant: "h5" }, /* @__PURE__ */ React17.createElement(
|
|
2377
2397
|
ValueField,
|
|
2378
2398
|
{
|
|
2379
2399
|
propTypeKey: variable.type,
|
|
@@ -2506,8 +2526,8 @@ var VariablesStyledMenuList = (0, import_ui19.styled)(import_ui19.MenuList)(({ t
|
|
|
2506
2526
|
var SIZE5 = "tiny";
|
|
2507
2527
|
var CREATE_LABEL = (0, import_i18n14.__)("Create variable", "elementor");
|
|
2508
2528
|
var MANAGER_LABEL = (0, import_i18n14.__)("Variables Manager", "elementor");
|
|
2509
|
-
var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
|
|
2510
|
-
const { icon: VariableIcon, startIcon, variableType, propTypeUtil } = useVariableType();
|
|
2529
|
+
var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled = false }) => {
|
|
2530
|
+
const { icon: VariableIcon, startIcon, variableType, propTypeUtil, emptyState } = useVariableType();
|
|
2511
2531
|
const { value: variable, setValue: setVariable, path } = useVariableBoundProp();
|
|
2512
2532
|
const [searchValue, setSearchValue] = (0, import_react16.useState)("");
|
|
2513
2533
|
const {
|
|
@@ -2536,16 +2556,17 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
|
|
|
2536
2556
|
const actions = [];
|
|
2537
2557
|
if (onAdd) {
|
|
2538
2558
|
actions.push(
|
|
2539
|
-
/* @__PURE__ */ React19.createElement(import_ui20.Tooltip, { key: "add", placement: "top", title: CREATE_LABEL }, /* @__PURE__ */ React19.createElement(
|
|
2559
|
+
/* @__PURE__ */ React19.createElement(import_ui20.Tooltip, { key: "add", placement: "top", title: CREATE_LABEL }, /* @__PURE__ */ React19.createElement("span", null, /* @__PURE__ */ React19.createElement(
|
|
2540
2560
|
import_ui20.IconButton,
|
|
2541
2561
|
{
|
|
2542
2562
|
id: "add-variable-button",
|
|
2543
2563
|
size: SIZE5,
|
|
2544
2564
|
onClick: onAddAndTrack,
|
|
2545
|
-
"aria-label": CREATE_LABEL
|
|
2565
|
+
"aria-label": CREATE_LABEL,
|
|
2566
|
+
disabled
|
|
2546
2567
|
},
|
|
2547
2568
|
/* @__PURE__ */ React19.createElement(import_icons11.PlusIcon, { fontSize: SIZE5 })
|
|
2548
|
-
))
|
|
2569
|
+
)))
|
|
2549
2570
|
);
|
|
2550
2571
|
}
|
|
2551
2572
|
if (onSettings) {
|
|
@@ -2585,11 +2606,23 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
|
|
|
2585
2606
|
const handleClearSearch = () => {
|
|
2586
2607
|
setSearchValue("");
|
|
2587
2608
|
};
|
|
2588
|
-
const noVariableTitle = (0, import_i18n14.sprintf)(
|
|
2609
|
+
const noVariableTitle = disabled ? (0, import_i18n14.sprintf)(
|
|
2610
|
+
/* translators: %s: Variable Type. */
|
|
2611
|
+
(0, import_i18n14.__)("No %s variables yet", "elementor"),
|
|
2612
|
+
variableType
|
|
2613
|
+
) : (0, import_i18n14.sprintf)(
|
|
2589
2614
|
/* translators: %s: Variable Type. */
|
|
2590
2615
|
(0, import_i18n14.__)("Create your first %s variable", "elementor"),
|
|
2591
2616
|
variableType
|
|
2592
2617
|
);
|
|
2618
|
+
const noVariableMessage = disabled ? (0, import_i18n14.sprintf)(
|
|
2619
|
+
/* translators: %s: Variable Type. */
|
|
2620
|
+
(0, import_i18n14.__)(
|
|
2621
|
+
"Start by creating your first %s variable to apply consistent sizing across elements.",
|
|
2622
|
+
"elementor"
|
|
2623
|
+
),
|
|
2624
|
+
variableType
|
|
2625
|
+
) : (0, import_i18n14.__)("Variables are saved attributes that you can apply anywhere on your site.", "elementor");
|
|
2593
2626
|
return /* @__PURE__ */ React19.createElement(import_editor_editing_panel4.PopoverBody, null, /* @__PURE__ */ React19.createElement(
|
|
2594
2627
|
import_editor_ui7.PopoverHeader,
|
|
2595
2628
|
{
|
|
@@ -2628,13 +2661,11 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
|
|
|
2628
2661
|
EmptyState,
|
|
2629
2662
|
{
|
|
2630
2663
|
title: noVariableTitle,
|
|
2631
|
-
message:
|
|
2632
|
-
"Variables are saved attributes that you can apply anywhere on your site.",
|
|
2633
|
-
"elementor"
|
|
2634
|
-
),
|
|
2664
|
+
message: noVariableMessage,
|
|
2635
2665
|
icon: /* @__PURE__ */ React19.createElement(VariableIcon, { fontSize: "large" }),
|
|
2636
|
-
onAdd
|
|
2637
|
-
}
|
|
2666
|
+
onAdd: disabled ? void 0 : onAdd
|
|
2667
|
+
},
|
|
2668
|
+
emptyState
|
|
2638
2669
|
), hasNoCompatibleVariables && /* @__PURE__ */ React19.createElement(
|
|
2639
2670
|
EmptyState,
|
|
2640
2671
|
{
|
|
@@ -2644,8 +2675,9 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
|
|
|
2644
2675
|
"elementor"
|
|
2645
2676
|
),
|
|
2646
2677
|
icon: /* @__PURE__ */ React19.createElement(VariableIcon, { fontSize: "large" }),
|
|
2647
|
-
onAdd
|
|
2648
|
-
}
|
|
2678
|
+
onAdd: disabled ? void 0 : onAdd
|
|
2679
|
+
},
|
|
2680
|
+
emptyState
|
|
2649
2681
|
));
|
|
2650
2682
|
};
|
|
2651
2683
|
|
|
@@ -2673,6 +2705,7 @@ var VariableSelectionPopover = ({ closePopover, propTypeKey, selectedVariable })
|
|
|
2673
2705
|
};
|
|
2674
2706
|
function RenderView(props) {
|
|
2675
2707
|
const userPermissions = usePermissions();
|
|
2708
|
+
const userQuotaPremissions = useQuotaPermissions(props.propTypeKey);
|
|
2676
2709
|
const handlers = {
|
|
2677
2710
|
onClose: () => {
|
|
2678
2711
|
props.closePopover();
|
|
@@ -2712,7 +2745,8 @@ function RenderView(props) {
|
|
|
2712
2745
|
closePopover: handlers.onClose,
|
|
2713
2746
|
onAdd: handlers.onAdd,
|
|
2714
2747
|
onEdit: handlers.onEdit,
|
|
2715
|
-
onSettings: handlers.onSettings
|
|
2748
|
+
onSettings: handlers.onSettings,
|
|
2749
|
+
disabled: !userQuotaPremissions.canAdd()
|
|
2716
2750
|
}
|
|
2717
2751
|
);
|
|
2718
2752
|
}
|
|
@@ -2901,7 +2935,7 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
2901
2935
|
}
|
|
2902
2936
|
}
|
|
2903
2937
|
)
|
|
2904
|
-
), /* @__PURE__ */ React23.createElement(FormField, { errorMsg: valueFieldError, label: (0, import_i18n16.__)("Value", "elementor") }, /* @__PURE__ */ React23.createElement(import_ui23.Typography, { variant: "h5" }, /* @__PURE__ */ React23.createElement(
|
|
2938
|
+
), ValueField && /* @__PURE__ */ React23.createElement(FormField, { errorMsg: valueFieldError, label: (0, import_i18n16.__)("Value", "elementor") }, /* @__PURE__ */ React23.createElement(import_ui23.Typography, { variant: "h5" }, /* @__PURE__ */ React23.createElement(
|
|
2905
2939
|
ValueField,
|
|
2906
2940
|
{
|
|
2907
2941
|
value,
|
|
@@ -3527,7 +3561,8 @@ function initMcp() {
|
|
|
3527
3561
|
|
|
3528
3562
|
// src/register-variable-types.tsx
|
|
3529
3563
|
var React35 = __toESM(require("react"));
|
|
3530
|
-
var
|
|
3564
|
+
var import_editor_props5 = require("@elementor/editor-props");
|
|
3565
|
+
var import_editor_ui9 = require("@elementor/editor-ui");
|
|
3531
3566
|
var import_icons17 = require("@elementor/icons");
|
|
3532
3567
|
|
|
3533
3568
|
// src/components/fields/color-field.tsx
|
|
@@ -3644,6 +3679,11 @@ var FontField = ({ value, onChange, onValidationChange }) => {
|
|
|
3644
3679
|
));
|
|
3645
3680
|
};
|
|
3646
3681
|
|
|
3682
|
+
// src/prop-types/size-variable-prop-type.ts
|
|
3683
|
+
var import_editor_props4 = require("@elementor/editor-props");
|
|
3684
|
+
var import_schema6 = require("@elementor/schema");
|
|
3685
|
+
var sizeVariablePropTypeUtil = (0, import_editor_props4.createPropUtils)("global-size-variable", import_schema6.z.string());
|
|
3686
|
+
|
|
3647
3687
|
// src/register-variable-types.tsx
|
|
3648
3688
|
function registerVariableTypes() {
|
|
3649
3689
|
registerVariableType({
|
|
@@ -3651,7 +3691,7 @@ function registerVariableTypes() {
|
|
|
3651
3691
|
valueField: ColorField,
|
|
3652
3692
|
icon: import_icons17.BrushIcon,
|
|
3653
3693
|
propTypeUtil: colorVariablePropTypeUtil,
|
|
3654
|
-
fallbackPropTypeUtil:
|
|
3694
|
+
fallbackPropTypeUtil: import_editor_props5.colorPropTypeUtil,
|
|
3655
3695
|
variableType: "color",
|
|
3656
3696
|
startIcon: ({ value }) => /* @__PURE__ */ React35.createElement(ColorIndicator, { size: "inherit", component: "span", value }),
|
|
3657
3697
|
defaultValue: "#ffffff"
|
|
@@ -3661,10 +3701,19 @@ function registerVariableTypes() {
|
|
|
3661
3701
|
valueField: FontField,
|
|
3662
3702
|
icon: import_icons17.TextIcon,
|
|
3663
3703
|
propTypeUtil: fontVariablePropTypeUtil,
|
|
3664
|
-
fallbackPropTypeUtil:
|
|
3704
|
+
fallbackPropTypeUtil: import_editor_props5.stringPropTypeUtil,
|
|
3665
3705
|
variableType: "font",
|
|
3666
3706
|
defaultValue: "Roboto"
|
|
3667
3707
|
});
|
|
3708
|
+
registerVariableType({
|
|
3709
|
+
key: sizeVariablePropTypeUtil.key,
|
|
3710
|
+
icon: import_icons17.ExpandDiagonalIcon,
|
|
3711
|
+
propTypeUtil: sizeVariablePropTypeUtil,
|
|
3712
|
+
fallbackPropTypeUtil: import_editor_props5.sizePropTypeUtil,
|
|
3713
|
+
variableType: "size",
|
|
3714
|
+
selectionFilter: () => [],
|
|
3715
|
+
emptyState: /* @__PURE__ */ React35.createElement(import_editor_ui9.UpgradeButton, { size: "small", href: "https://go.elementor.com/go-pro-panel-size-variable/" })
|
|
3716
|
+
});
|
|
3668
3717
|
}
|
|
3669
3718
|
|
|
3670
3719
|
// src/renderers/style-variables-renderer.tsx
|
|
@@ -3717,7 +3766,7 @@ function convertToCssVariables(variables) {
|
|
|
3717
3766
|
|
|
3718
3767
|
// src/repeater-injections.ts
|
|
3719
3768
|
var import_editor_controls13 = require("@elementor/editor-controls");
|
|
3720
|
-
var
|
|
3769
|
+
var import_editor_props6 = require("@elementor/editor-props");
|
|
3721
3770
|
|
|
3722
3771
|
// src/components/variables-repeater-item-slot.tsx
|
|
3723
3772
|
var React37 = __toESM(require("react"));
|
|
@@ -3744,21 +3793,21 @@ function registerRepeaterInjections() {
|
|
|
3744
3793
|
id: "color-variables-background-icon",
|
|
3745
3794
|
component: BackgroundRepeaterColorIndicator,
|
|
3746
3795
|
condition: ({ value: prop }) => {
|
|
3747
|
-
return hasAssignedColorVariable(
|
|
3796
|
+
return hasAssignedColorVariable(import_editor_props6.backgroundColorOverlayPropTypeUtil.extract(prop)?.color);
|
|
3748
3797
|
}
|
|
3749
3798
|
});
|
|
3750
3799
|
(0, import_editor_controls13.injectIntoRepeaterItemIcon)({
|
|
3751
3800
|
id: "color-variables-icon",
|
|
3752
3801
|
component: BoxShadowRepeaterColorIndicator,
|
|
3753
3802
|
condition: ({ value: prop }) => {
|
|
3754
|
-
return hasAssignedColorVariable(
|
|
3803
|
+
return hasAssignedColorVariable(import_editor_props6.shadowPropTypeUtil.extract(prop)?.color);
|
|
3755
3804
|
}
|
|
3756
3805
|
});
|
|
3757
3806
|
(0, import_editor_controls13.injectIntoRepeaterItemLabel)({
|
|
3758
3807
|
id: "color-variables-label",
|
|
3759
3808
|
component: BackgroundRepeaterLabel,
|
|
3760
3809
|
condition: ({ value: prop }) => {
|
|
3761
|
-
return hasAssignedColorVariable(
|
|
3810
|
+
return hasAssignedColorVariable(import_editor_props6.backgroundColorOverlayPropTypeUtil.extract(prop)?.color);
|
|
3762
3811
|
}
|
|
3763
3812
|
});
|
|
3764
3813
|
}
|
|
@@ -3789,7 +3838,7 @@ function init() {
|
|
|
3789
3838
|
(0, import_editor_panels2.__registerPanel)(panel);
|
|
3790
3839
|
}
|
|
3791
3840
|
function hasVariable(value) {
|
|
3792
|
-
if ((0,
|
|
3841
|
+
if ((0, import_editor_props7.isTransformable)(value)) {
|
|
3793
3842
|
return hasVariableType(value.$$type);
|
|
3794
3843
|
}
|
|
3795
3844
|
return false;
|
|
@@ -3831,6 +3880,7 @@ var Utils = {
|
|
|
3831
3880
|
init,
|
|
3832
3881
|
registerVariableType,
|
|
3833
3882
|
registerVariableTypes,
|
|
3834
|
-
service
|
|
3883
|
+
service,
|
|
3884
|
+
sizeVariablePropTypeUtil
|
|
3835
3885
|
});
|
|
3836
3886
|
//# sourceMappingURL=index.js.map
|