@elementor/editor-controls 3.33.0-253 → 3.33.0-255
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 +91 -81
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +33 -23
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -15
- package/src/components/control-repeater/items/item.tsx +6 -0
- package/src/controls/repeatable-control.tsx +10 -2
- package/src/controls/transition-control/transition-selector.tsx +10 -7
package/dist/index.mjs
CHANGED
|
@@ -1476,6 +1476,17 @@ import * as React27 from "react";
|
|
|
1476
1476
|
import { bindTrigger as bindTrigger2 } from "@elementor/ui";
|
|
1477
1477
|
import { __ as __7 } from "@wordpress/i18n";
|
|
1478
1478
|
|
|
1479
|
+
// src/hooks/use-repeatable-control-context.ts
|
|
1480
|
+
import { createContext as createContext8, useContext as useContext7 } from "react";
|
|
1481
|
+
var RepeatableControlContext = createContext8(void 0);
|
|
1482
|
+
var useRepeatableControlContext = () => {
|
|
1483
|
+
const context = useContext7(RepeatableControlContext);
|
|
1484
|
+
if (!context) {
|
|
1485
|
+
throw new Error("useRepeatableControlContext must be used within RepeatableControl");
|
|
1486
|
+
}
|
|
1487
|
+
return context;
|
|
1488
|
+
};
|
|
1489
|
+
|
|
1479
1490
|
// src/components/repeater/repeater-tag.tsx
|
|
1480
1491
|
import * as React26 from "react";
|
|
1481
1492
|
import { forwardRef as forwardRef4 } from "react";
|
|
@@ -1503,8 +1514,13 @@ var { Slot: RepeaterItemActionsSlot, inject: injectIntoRepeaterItemActions } = c
|
|
|
1503
1514
|
// src/components/control-repeater/items/item.tsx
|
|
1504
1515
|
var Item = ({ Label: Label3, Icon, actions }) => {
|
|
1505
1516
|
const { popoverState, setRowRef, openItemIndex, setOpenItemIndex, index = -1, value } = useRepeaterContext();
|
|
1517
|
+
const repeatableContext = React27.useContext(RepeatableControlContext);
|
|
1518
|
+
const disableOpen = !!repeatableContext?.props?.readOnly;
|
|
1506
1519
|
const triggerProps = bindTrigger2(popoverState);
|
|
1507
1520
|
const onClick = (ev) => {
|
|
1521
|
+
if (disableOpen) {
|
|
1522
|
+
return;
|
|
1523
|
+
}
|
|
1508
1524
|
triggerProps.onClick(ev);
|
|
1509
1525
|
setOpenItemIndex(index);
|
|
1510
1526
|
};
|
|
@@ -1659,11 +1675,11 @@ import * as React37 from "react";
|
|
|
1659
1675
|
|
|
1660
1676
|
// src/control-adornments/control-adornments-context.tsx
|
|
1661
1677
|
import * as React36 from "react";
|
|
1662
|
-
import { createContext as
|
|
1663
|
-
var Context2 =
|
|
1678
|
+
import { createContext as createContext9, useContext as useContext9 } from "react";
|
|
1679
|
+
var Context2 = createContext9(null);
|
|
1664
1680
|
var ControlAdornmentsProvider = ({ children, items: items2 }) => /* @__PURE__ */ React36.createElement(Context2.Provider, { value: { items: items2 } }, children);
|
|
1665
1681
|
var useControlAdornments = () => {
|
|
1666
|
-
const context =
|
|
1682
|
+
const context = useContext9(Context2);
|
|
1667
1683
|
return context?.items ?? [];
|
|
1668
1684
|
};
|
|
1669
1685
|
|
|
@@ -1795,7 +1811,7 @@ import { __ as __16 } from "@wordpress/i18n";
|
|
|
1795
1811
|
|
|
1796
1812
|
// src/controls/filter-control/context/filter-config-context.tsx
|
|
1797
1813
|
import * as React40 from "react";
|
|
1798
|
-
import { createContext as
|
|
1814
|
+
import { createContext as createContext10, useContext as useContext10, useMemo as useMemo3 } from "react";
|
|
1799
1815
|
import { cssFilterFunctionPropUtil } from "@elementor/editor-props";
|
|
1800
1816
|
|
|
1801
1817
|
// src/controls/filter-control/utils.ts
|
|
@@ -1894,7 +1910,7 @@ function extractPropType(propType, filterFunctionGroup) {
|
|
|
1894
1910
|
}
|
|
1895
1911
|
|
|
1896
1912
|
// src/controls/filter-control/context/filter-config-context.tsx
|
|
1897
|
-
var FilterConfigContext =
|
|
1913
|
+
var FilterConfigContext = createContext10(null);
|
|
1898
1914
|
function FilterConfigProvider({ children }) {
|
|
1899
1915
|
const propContext = useBoundProp(cssFilterFunctionPropUtil);
|
|
1900
1916
|
const contextValue = useMemo3(() => {
|
|
@@ -1913,7 +1929,7 @@ function FilterConfigProvider({ children }) {
|
|
|
1913
1929
|
return /* @__PURE__ */ React40.createElement(FilterConfigContext.Provider, { value: contextValue }, children);
|
|
1914
1930
|
}
|
|
1915
1931
|
function useFilterConfig() {
|
|
1916
|
-
const context =
|
|
1932
|
+
const context = useContext10(FilterConfigContext);
|
|
1917
1933
|
if (!context) {
|
|
1918
1934
|
throw new Error("useFilterConfig must be used within FilterConfigProvider");
|
|
1919
1935
|
}
|
|
@@ -4473,19 +4489,6 @@ import * as React79 from "react";
|
|
|
4473
4489
|
import { useMemo as useMemo7 } from "react";
|
|
4474
4490
|
import { createArrayPropUtils } from "@elementor/editor-props";
|
|
4475
4491
|
import { Box as Box13 } from "@elementor/ui";
|
|
4476
|
-
|
|
4477
|
-
// src/hooks/use-repeatable-control-context.ts
|
|
4478
|
-
import { createContext as createContext10, useContext as useContext9 } from "react";
|
|
4479
|
-
var RepeatableControlContext = createContext10(void 0);
|
|
4480
|
-
var useRepeatableControlContext = () => {
|
|
4481
|
-
const context = useContext9(RepeatableControlContext);
|
|
4482
|
-
if (!context) {
|
|
4483
|
-
throw new Error("useRepeatableControlContext must be used within RepeatableControl");
|
|
4484
|
-
}
|
|
4485
|
-
return context;
|
|
4486
|
-
};
|
|
4487
|
-
|
|
4488
|
-
// src/controls/repeatable-control.tsx
|
|
4489
4492
|
var PLACEHOLDER_REGEX = /\$\{([^}]+)\}/g;
|
|
4490
4493
|
var RepeatableControl = createControl(
|
|
4491
4494
|
({
|
|
@@ -4616,11 +4619,18 @@ var shouldShowPlaceholder = (pattern, data) => {
|
|
|
4616
4619
|
}
|
|
4617
4620
|
return false;
|
|
4618
4621
|
};
|
|
4622
|
+
var getTextColor = (isReadOnly, showPlaceholder) => {
|
|
4623
|
+
if (isReadOnly) {
|
|
4624
|
+
return "text.disabled";
|
|
4625
|
+
}
|
|
4626
|
+
return showPlaceholder ? "text.tertiary" : "text.primary";
|
|
4627
|
+
};
|
|
4619
4628
|
var ItemLabel3 = ({ value }) => {
|
|
4620
|
-
const { placeholder, patternLabel } = useRepeatableControlContext();
|
|
4629
|
+
const { placeholder, patternLabel, props: childProps } = useRepeatableControlContext();
|
|
4621
4630
|
const showPlaceholder = shouldShowPlaceholder(patternLabel, value);
|
|
4622
4631
|
const label = showPlaceholder ? placeholder : interpolate(patternLabel, value);
|
|
4623
|
-
const
|
|
4632
|
+
const isReadOnly = !!childProps?.readOnly;
|
|
4633
|
+
const color = getTextColor(isReadOnly, showPlaceholder);
|
|
4624
4634
|
return /* @__PURE__ */ React79.createElement(Box13, { component: "span", color }, label);
|
|
4625
4635
|
};
|
|
4626
4636
|
var getAllProperties = (pattern) => {
|
|
@@ -5559,7 +5569,7 @@ var TransitionSelector = ({
|
|
|
5559
5569
|
left: rect.right + 36
|
|
5560
5570
|
};
|
|
5561
5571
|
};
|
|
5562
|
-
return /* @__PURE__ */ React96.createElement(Box18, { ref: defaultRef }, /* @__PURE__ */ React96.createElement(
|
|
5572
|
+
return /* @__PURE__ */ React96.createElement(Box18, { ref: defaultRef }, /* @__PURE__ */ React96.createElement(ControlActions, null, /* @__PURE__ */ React96.createElement(
|
|
5563
5573
|
UnstableTag3,
|
|
5564
5574
|
{
|
|
5565
5575
|
variant: "outlined",
|
|
@@ -5568,7 +5578,7 @@ var TransitionSelector = ({
|
|
|
5568
5578
|
...bindTrigger5(popoverState),
|
|
5569
5579
|
fullWidth: true
|
|
5570
5580
|
}
|
|
5571
|
-
), /* @__PURE__ */ React96.createElement(
|
|
5581
|
+
)), /* @__PURE__ */ React96.createElement(
|
|
5572
5582
|
Popover6,
|
|
5573
5583
|
{
|
|
5574
5584
|
disablePortal: true,
|