@elementor/editor-editing-panel 4.2.0-847 → 4.2.0-848
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 +86 -34
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +93 -41
- package/dist/index.mjs.map +1 -1
- package/package.json +24 -24
- package/src/components/style-sections/layout-section/grid-size-field.tsx +88 -23
package/dist/index.mjs
CHANGED
|
@@ -4194,48 +4194,100 @@ var GridJustifyItemsField = () => /* @__PURE__ */ React50.createElement(StylesFi
|
|
|
4194
4194
|
// src/components/style-sections/layout-section/grid-size-field.tsx
|
|
4195
4195
|
import * as React51 from "react";
|
|
4196
4196
|
import { useRef as useRef8 } from "react";
|
|
4197
|
-
import { SizeComponent } from "@elementor/editor-controls";
|
|
4197
|
+
import { SizeComponent, useBoundProp as useBoundProp4 } from "@elementor/editor-controls";
|
|
4198
|
+
import { stringPropTypeUtil as stringPropTypeUtil3 } from "@elementor/editor-props";
|
|
4198
4199
|
import { Grid as Grid4 } from "@elementor/ui";
|
|
4199
4200
|
import { __ as __29 } from "@wordpress/i18n";
|
|
4200
4201
|
var FR = "fr";
|
|
4201
4202
|
var CUSTOM2 = "custom";
|
|
4202
4203
|
var UNITS = [FR, CUSTOM2];
|
|
4204
|
+
var EMPTY = { kind: "empty" };
|
|
4203
4205
|
var REPEAT_FR_PATTERN = /^repeat\(\s*(\d+)\s*,\s*1fr\s*\)$/;
|
|
4204
|
-
var
|
|
4206
|
+
var parseCss = (css) => {
|
|
4205
4207
|
if (!css) {
|
|
4206
|
-
return
|
|
4208
|
+
return EMPTY;
|
|
4207
4209
|
}
|
|
4208
4210
|
const match = css.match(REPEAT_FR_PATTERN);
|
|
4209
4211
|
if (match) {
|
|
4210
|
-
|
|
4212
|
+
const count = parseInt(match[1], 10);
|
|
4213
|
+
return count >= 1 ? { kind: "fr", count } : EMPTY;
|
|
4211
4214
|
}
|
|
4212
|
-
return {
|
|
4215
|
+
return { kind: "custom", raw: css };
|
|
4213
4216
|
};
|
|
4214
|
-
var
|
|
4215
|
-
if (
|
|
4216
|
-
return
|
|
4217
|
+
var fromSizeInput = (v) => {
|
|
4218
|
+
if (v.size === "" || Number.isNaN(v.size)) {
|
|
4219
|
+
return EMPTY;
|
|
4220
|
+
}
|
|
4221
|
+
if (v.unit === FR) {
|
|
4222
|
+
const n = Number(v.size);
|
|
4223
|
+
return Number.isFinite(n) && n >= 1 ? { kind: "fr", count: Math.trunc(n) } : EMPTY;
|
|
4217
4224
|
}
|
|
4218
|
-
|
|
4219
|
-
|
|
4225
|
+
return { kind: "custom", raw: String(v.size) };
|
|
4226
|
+
};
|
|
4227
|
+
var toCss = (v) => {
|
|
4228
|
+
switch (v.kind) {
|
|
4229
|
+
case "empty":
|
|
4230
|
+
return null;
|
|
4231
|
+
case "fr":
|
|
4232
|
+
return `repeat(${v.count}, 1fr)`;
|
|
4233
|
+
case "custom":
|
|
4234
|
+
return v.raw;
|
|
4220
4235
|
}
|
|
4221
|
-
return String(trackValue.size);
|
|
4222
4236
|
};
|
|
4223
|
-
var
|
|
4237
|
+
var toSizeInput = (v, fallbackUnit = FR) => {
|
|
4238
|
+
switch (v.kind) {
|
|
4239
|
+
case "empty":
|
|
4240
|
+
return { size: "", unit: fallbackUnit };
|
|
4241
|
+
case "fr":
|
|
4242
|
+
return { size: v.count, unit: FR };
|
|
4243
|
+
case "custom":
|
|
4244
|
+
return { size: v.raw, unit: CUSTOM2 };
|
|
4245
|
+
}
|
|
4246
|
+
};
|
|
4247
|
+
var toPlaceholder = (v) => {
|
|
4248
|
+
switch (v.kind) {
|
|
4249
|
+
case "empty":
|
|
4250
|
+
return void 0;
|
|
4251
|
+
case "fr":
|
|
4252
|
+
return String(v.count);
|
|
4253
|
+
case "custom":
|
|
4254
|
+
return v.raw;
|
|
4255
|
+
}
|
|
4256
|
+
};
|
|
4257
|
+
var unitOf = (v, fallback = FR) => {
|
|
4258
|
+
if (v.kind === "fr") {
|
|
4259
|
+
return FR;
|
|
4260
|
+
}
|
|
4261
|
+
if (v.kind === "custom") {
|
|
4262
|
+
return CUSTOM2;
|
|
4263
|
+
}
|
|
4264
|
+
return fallback;
|
|
4265
|
+
};
|
|
4266
|
+
var GridTrackField = ({ cssProp, label }) => /* @__PURE__ */ React51.createElement(UiProviders, null, /* @__PURE__ */ React51.createElement(StylesField, { bind: cssProp, propDisplayName: label }, /* @__PURE__ */ React51.createElement(GridTrackFieldContent, { cssProp, label })));
|
|
4224
4267
|
var GridTrackFieldContent = ({ cssProp, label }) => {
|
|
4225
4268
|
const { value, setValue } = useStylesField(cssProp, {
|
|
4226
4269
|
history: { propDisplayName: label }
|
|
4227
4270
|
});
|
|
4271
|
+
const { placeholder: inheritedPlaceholder } = useBoundProp4();
|
|
4228
4272
|
const anchorRef = useRef8(null);
|
|
4229
|
-
const
|
|
4230
|
-
const
|
|
4231
|
-
|
|
4232
|
-
|
|
4273
|
+
const local = parseCss(value?.value ?? null);
|
|
4274
|
+
const inherited = parseCss(stringPropTypeUtil3.extract(inheritedPlaceholder));
|
|
4275
|
+
const displayValue = local.kind !== "empty" ? toSizeInput(local) : toSizeInput(EMPTY, unitOf(inherited));
|
|
4276
|
+
const placeholder = toPlaceholder(inherited);
|
|
4277
|
+
const handleChange = (raw) => {
|
|
4278
|
+
const next = fromSizeInput(raw);
|
|
4279
|
+
if (next.kind === "empty" && local.kind !== "empty" && raw.unit !== unitOf(local)) {
|
|
4280
|
+
return;
|
|
4281
|
+
}
|
|
4282
|
+
const css = toCss(next);
|
|
4283
|
+
setValue(css === null ? null : { $$type: "string", value: css });
|
|
4233
4284
|
};
|
|
4234
4285
|
return /* @__PURE__ */ React51.createElement(StylesFieldLayout, { label, direction: "column" }, /* @__PURE__ */ React51.createElement("div", { ref: anchorRef }, /* @__PURE__ */ React51.createElement(
|
|
4235
4286
|
SizeComponent,
|
|
4236
4287
|
{
|
|
4237
4288
|
units: UNITS,
|
|
4238
|
-
value:
|
|
4289
|
+
value: displayValue,
|
|
4290
|
+
placeholder,
|
|
4239
4291
|
defaultUnit: FR,
|
|
4240
4292
|
setValue: handleChange,
|
|
4241
4293
|
onBlur: () => {
|
|
@@ -5509,7 +5561,7 @@ import * as React89 from "react";
|
|
|
5509
5561
|
import {
|
|
5510
5562
|
ControlFormLabel as ControlFormLabel3,
|
|
5511
5563
|
Repeater,
|
|
5512
|
-
useBoundProp as
|
|
5564
|
+
useBoundProp as useBoundProp6
|
|
5513
5565
|
} from "@elementor/editor-controls";
|
|
5514
5566
|
import {
|
|
5515
5567
|
updateElementEditorSettings,
|
|
@@ -5535,7 +5587,7 @@ var getElementByType = (elementId, type) => {
|
|
|
5535
5587
|
};
|
|
5536
5588
|
|
|
5537
5589
|
// src/controls-registry/element-controls/tabs-control/use-actions.ts
|
|
5538
|
-
import { useBoundProp as
|
|
5590
|
+
import { useBoundProp as useBoundProp5 } from "@elementor/editor-controls";
|
|
5539
5591
|
import {
|
|
5540
5592
|
createElements,
|
|
5541
5593
|
duplicateElements,
|
|
@@ -5548,7 +5600,7 @@ import { __ as __63 } from "@wordpress/i18n";
|
|
|
5548
5600
|
var TAB_ELEMENT_TYPE = "e-tab";
|
|
5549
5601
|
var TAB_CONTENT_ELEMENT_TYPE = "e-tab-content";
|
|
5550
5602
|
var useActions = () => {
|
|
5551
|
-
const { value, setValue: setDefaultActiveTab } =
|
|
5603
|
+
const { value, setValue: setDefaultActiveTab } = useBoundProp5(numberPropTypeUtil3);
|
|
5552
5604
|
const defaultActiveTab = value ?? 0;
|
|
5553
5605
|
const duplicateItem = ({
|
|
5554
5606
|
items: items3,
|
|
@@ -5809,7 +5861,7 @@ var ItemLabel = ({ value, index }) => {
|
|
|
5809
5861
|
return /* @__PURE__ */ React89.createElement(Stack14, { sx: { minHeight: 20 }, direction: "row", alignItems: "center", gap: 1.5 }, /* @__PURE__ */ React89.createElement("span", null, elementTitle), /* @__PURE__ */ React89.createElement(ItemDefaultTab, { index }));
|
|
5810
5862
|
};
|
|
5811
5863
|
var ItemDefaultTab = ({ index }) => {
|
|
5812
|
-
const { value: defaultItem } =
|
|
5864
|
+
const { value: defaultItem } = useBoundProp6(numberPropTypeUtil4);
|
|
5813
5865
|
const isDefault = defaultItem === index;
|
|
5814
5866
|
if (!isDefault) {
|
|
5815
5867
|
return null;
|
|
@@ -5823,7 +5875,7 @@ var ItemContent = ({ value, index }) => {
|
|
|
5823
5875
|
return /* @__PURE__ */ React89.createElement(Stack14, { p: 2, gap: 1.5 }, /* @__PURE__ */ React89.createElement(TabLabelControl, { elementId: value.id }), /* @__PURE__ */ React89.createElement(SettingsField, { bind: "default-active-tab", propDisplayName: __64("Tabs", "elementor") }, /* @__PURE__ */ React89.createElement(DefaultTabControl, { tabIndex: index })));
|
|
5824
5876
|
};
|
|
5825
5877
|
var DefaultTabControl = ({ tabIndex }) => {
|
|
5826
|
-
const { value, setValue } =
|
|
5878
|
+
const { value, setValue } = useBoundProp6(numberPropTypeUtil4);
|
|
5827
5879
|
const isDefault = value === tabIndex;
|
|
5828
5880
|
return /* @__PURE__ */ React89.createElement(Stack14, { direction: "row", alignItems: "center", justifyContent: "space-between", gap: 2 }, /* @__PURE__ */ React89.createElement(ControlFormLabel3, null, __64("Set as default tab", "elementor")), /* @__PURE__ */ React89.createElement(ConditionalTooltip, { showTooltip: isDefault, placement: "right" }, /* @__PURE__ */ React89.createElement(
|
|
5829
5881
|
Switch,
|
|
@@ -5906,7 +5958,7 @@ import { controlActionsMenu as controlActionsMenu2 } from "@elementor/menus";
|
|
|
5906
5958
|
|
|
5907
5959
|
// src/dynamics/components/background-control-dynamic-tag.tsx
|
|
5908
5960
|
import * as React90 from "react";
|
|
5909
|
-
import { PropKeyProvider as PropKeyProvider4, PropProvider as PropProvider4, useBoundProp as
|
|
5961
|
+
import { PropKeyProvider as PropKeyProvider4, PropProvider as PropProvider4, useBoundProp as useBoundProp8 } from "@elementor/editor-controls";
|
|
5910
5962
|
import {
|
|
5911
5963
|
backgroundImageOverlayPropTypeUtil
|
|
5912
5964
|
} from "@elementor/editor-props";
|
|
@@ -5917,7 +5969,7 @@ import { useMemo as useMemo13 } from "react";
|
|
|
5917
5969
|
|
|
5918
5970
|
// src/dynamics/hooks/use-prop-dynamic-tags.ts
|
|
5919
5971
|
import { useMemo as useMemo12 } from "react";
|
|
5920
|
-
import { useBoundProp as
|
|
5972
|
+
import { useBoundProp as useBoundProp7 } from "@elementor/editor-controls";
|
|
5921
5973
|
|
|
5922
5974
|
// src/dynamics/sync/get-atomic-dynamic-tags.ts
|
|
5923
5975
|
import { getElementorConfig } from "@elementor/editor-v1-adapters";
|
|
@@ -6004,7 +6056,7 @@ var useAllPropDynamicTags = () => {
|
|
|
6004
6056
|
};
|
|
6005
6057
|
var usePropDynamicTagsInternal = (filterByLicense2) => {
|
|
6006
6058
|
let categories = [];
|
|
6007
|
-
const { propType } =
|
|
6059
|
+
const { propType } = useBoundProp7();
|
|
6008
6060
|
if (propType) {
|
|
6009
6061
|
const propDynamicType = getDynamicPropType(propType);
|
|
6010
6062
|
categories = propDynamicType?.settings.categories || [];
|
|
@@ -6050,11 +6102,11 @@ var useDynamicTag = (tagName) => {
|
|
|
6050
6102
|
// src/dynamics/components/background-control-dynamic-tag.tsx
|
|
6051
6103
|
var BackgroundControlDynamicTagIcon = () => /* @__PURE__ */ React90.createElement(DatabaseIcon, { fontSize: "tiny" });
|
|
6052
6104
|
var BackgroundControlDynamicTagLabel = ({ value }) => {
|
|
6053
|
-
const context =
|
|
6105
|
+
const context = useBoundProp8(backgroundImageOverlayPropTypeUtil);
|
|
6054
6106
|
return /* @__PURE__ */ React90.createElement(PropProvider4, { ...context, value: value.value }, /* @__PURE__ */ React90.createElement(PropKeyProvider4, { bind: "image" }, /* @__PURE__ */ React90.createElement(Wrapper2, { rawValue: value.value })));
|
|
6055
6107
|
};
|
|
6056
6108
|
var Wrapper2 = ({ rawValue }) => {
|
|
6057
|
-
const { propType } =
|
|
6109
|
+
const { propType } = useBoundProp8();
|
|
6058
6110
|
const imageOverlayPropType = propType.prop_types["background-image-overlay"];
|
|
6059
6111
|
return /* @__PURE__ */ React90.createElement(PropProvider4, { propType: imageOverlayPropType.shape.image, value: rawValue, setValue: () => void 0 }, /* @__PURE__ */ React90.createElement(PropKeyProvider4, { bind: "src" }, /* @__PURE__ */ React90.createElement(Content, { rawValue: rawValue.image })));
|
|
6060
6112
|
};
|
|
@@ -6070,7 +6122,7 @@ import {
|
|
|
6070
6122
|
ControlFormLabel as ControlFormLabel4,
|
|
6071
6123
|
PropKeyProvider as PropKeyProvider6,
|
|
6072
6124
|
PropProvider as PropProvider6,
|
|
6073
|
-
useBoundProp as
|
|
6125
|
+
useBoundProp as useBoundProp11
|
|
6074
6126
|
} from "@elementor/editor-controls";
|
|
6075
6127
|
import { PopoverHeader as PopoverHeader2, SectionPopoverBody as SectionPopoverBody2 } from "@elementor/editor-ui";
|
|
6076
6128
|
import { DatabaseIcon as DatabaseIcon3, SettingsIcon, XIcon } from "@elementor/icons";
|
|
@@ -6102,7 +6154,7 @@ var usePersistDynamicValue = (propKey) => {
|
|
|
6102
6154
|
|
|
6103
6155
|
// src/dynamics/dynamic-control.tsx
|
|
6104
6156
|
import * as React92 from "react";
|
|
6105
|
-
import { PropKeyProvider as PropKeyProvider5, PropProvider as PropProvider5, useBoundProp as
|
|
6157
|
+
import { PropKeyProvider as PropKeyProvider5, PropProvider as PropProvider5, useBoundProp as useBoundProp9 } from "@elementor/editor-controls";
|
|
6106
6158
|
|
|
6107
6159
|
// src/dynamics/components/dynamic-conditional-control.tsx
|
|
6108
6160
|
import * as React91 from "react";
|
|
@@ -6155,7 +6207,7 @@ var DynamicConditionalControl = ({
|
|
|
6155
6207
|
|
|
6156
6208
|
// src/dynamics/dynamic-control.tsx
|
|
6157
6209
|
var DynamicControl = ({ bind, children }) => {
|
|
6158
|
-
const { value, setValue } =
|
|
6210
|
+
const { value, setValue } = useBoundProp9(dynamicPropTypeUtil);
|
|
6159
6211
|
const { name = "", group = "", settings } = value ?? {};
|
|
6160
6212
|
const dynamicTag = useDynamicTag(name);
|
|
6161
6213
|
if (!dynamicTag) {
|
|
@@ -6189,7 +6241,7 @@ var DynamicControl = ({ bind, children }) => {
|
|
|
6189
6241
|
// src/dynamics/components/dynamic-selection.tsx
|
|
6190
6242
|
import * as React93 from "react";
|
|
6191
6243
|
import { Fragment as Fragment14, useEffect as useEffect9, useState as useState10 } from "react";
|
|
6192
|
-
import { trackUpgradePromotionClick, trackViewPromotion, useBoundProp as
|
|
6244
|
+
import { trackUpgradePromotionClick, trackViewPromotion, useBoundProp as useBoundProp10 } from "@elementor/editor-controls";
|
|
6193
6245
|
import { CtaButton, PopoverHeader, PopoverMenuList, SearchField, SectionPopoverBody } from "@elementor/editor-ui";
|
|
6194
6246
|
import { DatabaseIcon as DatabaseIcon2 } from "@elementor/icons";
|
|
6195
6247
|
import { Divider as Divider7, Link as Link2, Stack as Stack15, Typography as Typography5, useTheme as useTheme3 } from "@elementor/ui";
|
|
@@ -6202,8 +6254,8 @@ var DynamicSelection = ({ close: closePopover, expired = false }) => {
|
|
|
6202
6254
|
const [searchValue, setSearchValue] = useState10("");
|
|
6203
6255
|
const { groups: dynamicGroups } = getAtomicDynamicTags() || {};
|
|
6204
6256
|
const theme = useTheme3();
|
|
6205
|
-
const { value: anyValue } =
|
|
6206
|
-
const { bind, value: dynamicValue, setValue } =
|
|
6257
|
+
const { value: anyValue } = useBoundProp10();
|
|
6258
|
+
const { bind, value: dynamicValue, setValue } = useBoundProp10(dynamicPropTypeUtil);
|
|
6207
6259
|
const [, updatePropValueHistory] = usePersistDynamicValue(bind);
|
|
6208
6260
|
const isCurrentValueDynamic = !!dynamicValue;
|
|
6209
6261
|
const options13 = useFilteredOptions(searchValue);
|
|
@@ -6355,8 +6407,8 @@ var useFilteredOptions = (searchValue) => {
|
|
|
6355
6407
|
var SIZE3 = "tiny";
|
|
6356
6408
|
var tagsWithoutTabs = ["popup"];
|
|
6357
6409
|
var DynamicSelectionControl = ({ OriginalControl, ...props }) => {
|
|
6358
|
-
const { setValue: setAnyValue, propType } =
|
|
6359
|
-
const { bind, value } =
|
|
6410
|
+
const { setValue: setAnyValue, propType } = useBoundProp11();
|
|
6411
|
+
const { bind, value } = useBoundProp11(dynamicPropTypeUtil);
|
|
6360
6412
|
const { expired: readonly } = useLicenseConfig();
|
|
6361
6413
|
const originalPropType = createTopLevelObjectType({
|
|
6362
6414
|
schema: {
|
|
@@ -6575,11 +6627,11 @@ function getDynamicValue(name, settings) {
|
|
|
6575
6627
|
|
|
6576
6628
|
// src/dynamics/hooks/use-prop-dynamic-action.tsx
|
|
6577
6629
|
import * as React95 from "react";
|
|
6578
|
-
import { useBoundProp as
|
|
6630
|
+
import { useBoundProp as useBoundProp12 } from "@elementor/editor-controls";
|
|
6579
6631
|
import { DatabaseIcon as DatabaseIcon4 } from "@elementor/icons";
|
|
6580
6632
|
import { __ as __67 } from "@wordpress/i18n";
|
|
6581
6633
|
var usePropDynamicAction = () => {
|
|
6582
|
-
const { propType } =
|
|
6634
|
+
const { propType } = useBoundProp12();
|
|
6583
6635
|
const visible = !!propType && supportsDynamic(propType);
|
|
6584
6636
|
return {
|
|
6585
6637
|
visible,
|
|
@@ -6616,7 +6668,7 @@ var init2 = () => {
|
|
|
6616
6668
|
};
|
|
6617
6669
|
|
|
6618
6670
|
// src/reset-style-props.tsx
|
|
6619
|
-
import { useBoundProp as
|
|
6671
|
+
import { useBoundProp as useBoundProp13 } from "@elementor/editor-controls";
|
|
6620
6672
|
import { hasVariable as hasVariable2 } from "@elementor/editor-variables";
|
|
6621
6673
|
import { BrushBigIcon } from "@elementor/icons";
|
|
6622
6674
|
import { controlActionsMenu as controlActionsMenu3 } from "@elementor/menus";
|
|
@@ -6676,7 +6728,7 @@ function initResetStyleProps() {
|
|
|
6676
6728
|
}
|
|
6677
6729
|
function useResetStyleValueProps() {
|
|
6678
6730
|
const isStyle = useIsStyle();
|
|
6679
|
-
const { value, resetValue, propType } =
|
|
6731
|
+
const { value, resetValue, propType } = useBoundProp13();
|
|
6680
6732
|
const hasValue = value !== null && value !== void 0;
|
|
6681
6733
|
const hasInitial = propType.initial_value !== void 0 && propType.initial_value !== null;
|
|
6682
6734
|
const isRequired = !!propType.settings?.required;
|
|
@@ -6704,7 +6756,7 @@ function useResetStyleValueProps() {
|
|
|
6704
6756
|
|
|
6705
6757
|
// src/styles-inheritance/components/styles-inheritance-indicator.tsx
|
|
6706
6758
|
import * as React101 from "react";
|
|
6707
|
-
import { useBoundProp as
|
|
6759
|
+
import { useBoundProp as useBoundProp14 } from "@elementor/editor-controls";
|
|
6708
6760
|
import { isEmpty as isEmpty2 } from "@elementor/editor-props";
|
|
6709
6761
|
import { ELEMENTS_BASE_STYLES_PROVIDER_KEY as ELEMENTS_BASE_STYLES_PROVIDER_KEY4 } from "@elementor/editor-styles-repository";
|
|
6710
6762
|
import { __ as __72 } from "@wordpress/i18n";
|
|
@@ -7070,7 +7122,7 @@ function TooltipOrInfotip({
|
|
|
7070
7122
|
var StylesInheritanceIndicator = ({
|
|
7071
7123
|
customContext
|
|
7072
7124
|
}) => {
|
|
7073
|
-
const context =
|
|
7125
|
+
const context = useBoundProp14();
|
|
7074
7126
|
const { path, propType } = customContext || context;
|
|
7075
7127
|
const inheritanceChain = useStylesInheritanceChain(path);
|
|
7076
7128
|
if (!path || !inheritanceChain.length) {
|