@elementor/editor-variables 3.35.0-349 → 3.35.0-351
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 +40 -28
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +40 -28
- package/dist/index.mjs.map +1 -1
- package/package.json +14 -14
- package/src/components/variables-selection.tsx +30 -32
- package/src/init.ts +12 -2
package/dist/index.js
CHANGED
|
@@ -2606,23 +2606,6 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2606
2606
|
const handleClearSearch = () => {
|
|
2607
2607
|
setSearchValue("");
|
|
2608
2608
|
};
|
|
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)(
|
|
2614
|
-
/* translators: %s: Variable Type. */
|
|
2615
|
-
(0, import_i18n14.__)("Create your first %s variable", "elementor"),
|
|
2616
|
-
variableType
|
|
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");
|
|
2626
2609
|
return /* @__PURE__ */ React19.createElement(import_editor_editing_panel4.PopoverBody, null, /* @__PURE__ */ React19.createElement(
|
|
2627
2610
|
import_editor_ui7.PopoverHeader,
|
|
2628
2611
|
{
|
|
@@ -2657,16 +2640,38 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2657
2640
|
onClear: handleClearSearch,
|
|
2658
2641
|
icon: /* @__PURE__ */ React19.createElement(VariableIcon, { fontSize: "large" })
|
|
2659
2642
|
}
|
|
2660
|
-
),
|
|
2643
|
+
), disabled && /* @__PURE__ */ React19.createElement(
|
|
2661
2644
|
EmptyState,
|
|
2662
2645
|
{
|
|
2663
|
-
title:
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2646
|
+
title: (0, import_i18n14.sprintf)(
|
|
2647
|
+
/* translators: %s: Variable Type. */
|
|
2648
|
+
(0, import_i18n14.__)("No %s variables yet", "elementor"),
|
|
2649
|
+
variableType
|
|
2650
|
+
),
|
|
2651
|
+
message: (0, import_i18n14.sprintf)(
|
|
2652
|
+
/* translators: %s: Variable Type. */
|
|
2653
|
+
(0, import_i18n14.__)("Upgrade to create %s variables and maintain consistent element sizing.", "elementor"),
|
|
2654
|
+
variableType
|
|
2655
|
+
),
|
|
2656
|
+
icon: /* @__PURE__ */ React19.createElement(VariableIcon, { fontSize: "large" })
|
|
2667
2657
|
},
|
|
2668
2658
|
emptyState
|
|
2669
|
-
), hasNoCompatibleVariables && /* @__PURE__ */ React19.createElement(
|
|
2659
|
+
), !hasVariables && !hasNoCompatibleVariables && !disabled && /* @__PURE__ */ React19.createElement(
|
|
2660
|
+
EmptyState,
|
|
2661
|
+
{
|
|
2662
|
+
title: (0, import_i18n14.sprintf)(
|
|
2663
|
+
/* translators: %s: Variable Type. */
|
|
2664
|
+
(0, import_i18n14.__)("Create your first %s variable", "elementor"),
|
|
2665
|
+
variableType
|
|
2666
|
+
),
|
|
2667
|
+
message: (0, import_i18n14.__)(
|
|
2668
|
+
"Variables are saved attributes that you can apply anywhere on your site.",
|
|
2669
|
+
"elementor"
|
|
2670
|
+
),
|
|
2671
|
+
icon: /* @__PURE__ */ React19.createElement(VariableIcon, { fontSize: "large" }),
|
|
2672
|
+
onAdd
|
|
2673
|
+
}
|
|
2674
|
+
), hasNoCompatibleVariables && !disabled && /* @__PURE__ */ React19.createElement(
|
|
2670
2675
|
EmptyState,
|
|
2671
2676
|
{
|
|
2672
2677
|
title: (0, import_i18n14.__)("No compatible variables", "elementor"),
|
|
@@ -2675,9 +2680,8 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2675
2680
|
"elementor"
|
|
2676
2681
|
),
|
|
2677
2682
|
icon: /* @__PURE__ */ React19.createElement(VariableIcon, { fontSize: "large" }),
|
|
2678
|
-
onAdd
|
|
2679
|
-
}
|
|
2680
|
-
emptyState
|
|
2683
|
+
onAdd
|
|
2684
|
+
}
|
|
2681
2685
|
));
|
|
2682
2686
|
};
|
|
2683
2687
|
|
|
@@ -3822,7 +3826,15 @@ function init() {
|
|
|
3822
3826
|
registerRepeaterInjections();
|
|
3823
3827
|
(0, import_editor_editing_panel8.registerControlReplacement)({
|
|
3824
3828
|
component: VariableControl,
|
|
3825
|
-
condition: ({ value, placeholder }) =>
|
|
3829
|
+
condition: ({ value, placeholder }) => {
|
|
3830
|
+
if (hasVariableAssigned(value)) {
|
|
3831
|
+
return true;
|
|
3832
|
+
}
|
|
3833
|
+
if (value) {
|
|
3834
|
+
return false;
|
|
3835
|
+
}
|
|
3836
|
+
return hasVariableAssigned(placeholder);
|
|
3837
|
+
}
|
|
3826
3838
|
});
|
|
3827
3839
|
registerPopoverAction({
|
|
3828
3840
|
id: "variables",
|
|
@@ -3837,7 +3849,7 @@ function init() {
|
|
|
3837
3849
|
});
|
|
3838
3850
|
(0, import_editor_panels2.__registerPanel)(panel);
|
|
3839
3851
|
}
|
|
3840
|
-
function
|
|
3852
|
+
function hasVariableAssigned(value) {
|
|
3841
3853
|
if ((0, import_editor_props7.isTransformable)(value)) {
|
|
3842
3854
|
return hasVariableType(value.$$type);
|
|
3843
3855
|
}
|