@elementor/editor-controls 4.0.0-manual → 4.0.0
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 +137 -64
- package/dist/index.d.ts +137 -64
- package/dist/index.js +890 -202
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +872 -188
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -15
- package/src/components/promotions/attributes-control.tsx +2 -1
- package/src/components/promotions/display-conditions-control.tsx +2 -1
- package/src/components/promotions/promotion-trigger.tsx +14 -4
- package/src/controls/chips-control.tsx +1 -1
- package/src/controls/email-form-action-control.tsx +5 -5
- package/src/controls/number-control.tsx +8 -2
- package/src/controls/size-control/hooks/use-size-unit-keyboard.tsx +66 -0
- package/src/controls/size-control/hooks/use-size-value.ts +71 -0
- package/src/controls/size-control/size-component.tsx +94 -0
- package/src/controls/size-control/size-field.tsx +113 -0
- package/src/controls/size-control/sync/get-units.ts +17 -0
- package/src/controls/size-control/types.ts +17 -0
- package/src/controls/size-control/ui/size-input.tsx +68 -0
- package/src/controls/size-control/ui/text-field-popover.tsx +78 -0
- package/src/controls/size-control/ui/unit-selector.tsx +80 -0
- package/src/controls/size-control/unstable-size-control.tsx +86 -0
- package/src/controls/size-control/utils/has-size-value.ts +5 -0
- package/src/controls/size-control/utils/is-extended-unit.ts +8 -0
- package/src/controls/size-control/utils/resolve-bound-prop-value.ts +72 -0
- package/src/controls/size-control/utils/resolve-size-value.ts +85 -0
- package/src/controls/size-control/utils/settings/get-default-unit.ts +7 -0
- package/src/controls/size-control/utils/settings/get-prop-type-settings.ts +12 -0
- package/src/controls/size-control/utils/settings/get-size-units.ts +23 -0
- package/src/controls/size-control/utils/should-nullify-value.ts +15 -0
- package/src/controls/transition-control/data.ts +3 -3
- package/src/controls/transition-control/transition-repeater-control.tsx +8 -2
- package/src/controls/transition-control/transition-selector.tsx +7 -0
- package/src/hooks/use-font-families.ts +22 -25
- package/src/index.ts +4 -0
- package/src/utils/tracking.ts +61 -0
package/dist/index.js
CHANGED
|
@@ -72,6 +72,7 @@ __export(index_exports, {
|
|
|
72
72
|
Repeater: () => Repeater3,
|
|
73
73
|
SelectControl: () => SelectControl,
|
|
74
74
|
SelectControlWrapper: () => SelectControlWrapper,
|
|
75
|
+
SizeComponent: () => SizeComponent,
|
|
75
76
|
SizeControl: () => SizeControl,
|
|
76
77
|
StrokeControl: () => StrokeControl,
|
|
77
78
|
SvgMediaControl: () => SvgMediaControl,
|
|
@@ -83,6 +84,7 @@ __export(index_exports, {
|
|
|
83
84
|
TransformRepeaterControl: () => TransformRepeaterControl,
|
|
84
85
|
TransformSettingsControl: () => TransformSettingsControl,
|
|
85
86
|
TransitionRepeaterControl: () => TransitionRepeaterControl,
|
|
87
|
+
UnstableSizeControl: () => UnstableSizeControl,
|
|
86
88
|
UnstableSizeField: () => UnstableSizeField,
|
|
87
89
|
UrlControl: () => UrlControl,
|
|
88
90
|
VideoMediaControl: () => VideoMediaControl,
|
|
@@ -95,6 +97,8 @@ __export(index_exports, {
|
|
|
95
97
|
injectIntoRepeaterItemLabel: () => injectIntoRepeaterItemLabel,
|
|
96
98
|
isUnitExtendedOption: () => isUnitExtendedOption,
|
|
97
99
|
registerControlReplacement: () => registerControlReplacement,
|
|
100
|
+
trackUpgradePromotionClick: () => trackUpgradePromotionClick,
|
|
101
|
+
trackViewPromotion: () => trackViewPromotion,
|
|
98
102
|
transitionProperties: () => transitionProperties,
|
|
99
103
|
transitionsItemsList: () => transitionsItemsList,
|
|
100
104
|
useBoundProp: () => useBoundProp,
|
|
@@ -753,14 +757,14 @@ var TextFieldInnerSelection = (0, import_react9.forwardRef)(
|
|
|
753
757
|
id
|
|
754
758
|
}, ref) => {
|
|
755
759
|
const { placeholder: boundPropPlaceholder } = useBoundProp(import_editor_props6.sizePropTypeUtil);
|
|
756
|
-
const
|
|
760
|
+
const getCursorStyle3 = () => ({
|
|
757
761
|
input: { cursor: InputProps.readOnly ? "default !important" : void 0 }
|
|
758
762
|
});
|
|
759
763
|
return /* @__PURE__ */ React17.createElement(
|
|
760
764
|
NumberInput,
|
|
761
765
|
{
|
|
762
766
|
ref,
|
|
763
|
-
sx:
|
|
767
|
+
sx: getCursorStyle3(),
|
|
764
768
|
size: "tiny",
|
|
765
769
|
fullWidth: true,
|
|
766
770
|
type,
|
|
@@ -2329,7 +2333,7 @@ var ChipsControl = createControl(({ options }) => {
|
|
|
2329
2333
|
const selectedOptions = selectedValues.map((val) => options.find((opt) => opt.value === val)).filter((opt) => opt !== void 0);
|
|
2330
2334
|
const handleChange = (_, newValue) => {
|
|
2331
2335
|
const values = newValue.map((option) => import_editor_props16.stringPropTypeUtil.create(option.value));
|
|
2332
|
-
setValue(values
|
|
2336
|
+
setValue(values);
|
|
2333
2337
|
};
|
|
2334
2338
|
return /* @__PURE__ */ React50.createElement(ControlActions, null, /* @__PURE__ */ React50.createElement(
|
|
2335
2339
|
import_ui37.Autocomplete,
|
|
@@ -2678,7 +2682,7 @@ var import_ui40 = require("@elementor/ui");
|
|
|
2678
2682
|
var isEmptyOrNaN = (value) => value === null || value === void 0 || value === "" || Number.isNaN(Number(value));
|
|
2679
2683
|
var renderSuffix = (propType) => {
|
|
2680
2684
|
if (propType.meta?.suffix) {
|
|
2681
|
-
return /* @__PURE__ */ React55.createElement(import_ui40.InputAdornment, { position: "end" }, propType.meta.suffix);
|
|
2685
|
+
return /* @__PURE__ */ React55.createElement(import_ui40.InputAdornment, { position: "end" }, /* @__PURE__ */ React55.createElement(import_ui40.Typography, { variant: "caption", color: "text.secondary" }, propType.meta.suffix));
|
|
2682
2686
|
}
|
|
2683
2687
|
return /* @__PURE__ */ React55.createElement(React55.Fragment, null);
|
|
2684
2688
|
};
|
|
@@ -5759,6 +5763,7 @@ var import_react50 = require("react");
|
|
|
5759
5763
|
var import_editor_props50 = require("@elementor/editor-props");
|
|
5760
5764
|
var import_icons33 = require("@elementor/icons");
|
|
5761
5765
|
var import_ui84 = require("@elementor/ui");
|
|
5766
|
+
var import_utils7 = require("@elementor/utils");
|
|
5762
5767
|
var import_i18n50 = require("@wordpress/i18n");
|
|
5763
5768
|
|
|
5764
5769
|
// src/controls/selection-size-control.tsx
|
|
@@ -5812,9 +5817,9 @@ var MIN_PRO_VERSION = "3.35";
|
|
|
5812
5817
|
var getIsSiteRtl = () => {
|
|
5813
5818
|
return !!window.elementorFrontend?.config?.is_rtl;
|
|
5814
5819
|
};
|
|
5815
|
-
var
|
|
5820
|
+
var shouldShowAllTransitionProperties = () => {
|
|
5816
5821
|
if (!(0, import_utils6.hasProInstalled)()) {
|
|
5817
|
-
return
|
|
5822
|
+
return true;
|
|
5818
5823
|
}
|
|
5819
5824
|
const proVersion = window.elementorPro?.config?.version;
|
|
5820
5825
|
if (!proVersion) {
|
|
@@ -5951,7 +5956,7 @@ var createTransitionPropertiesList = () => {
|
|
|
5951
5956
|
]
|
|
5952
5957
|
}
|
|
5953
5958
|
];
|
|
5954
|
-
return
|
|
5959
|
+
return shouldShowAllTransitionProperties() ? baseProperties : [baseProperties[0]];
|
|
5955
5960
|
};
|
|
5956
5961
|
var transitionProperties = createTransitionPropertiesList();
|
|
5957
5962
|
var transitionsItemsList = transitionProperties.map((category) => ({
|
|
@@ -5990,6 +5995,47 @@ var import_editor_ui12 = require("@elementor/editor-ui");
|
|
|
5990
5995
|
var import_icons32 = require("@elementor/icons");
|
|
5991
5996
|
var import_ui83 = require("@elementor/ui");
|
|
5992
5997
|
var import_i18n49 = require("@wordpress/i18n");
|
|
5998
|
+
|
|
5999
|
+
// src/utils/tracking.ts
|
|
6000
|
+
var import_editor_elements5 = require("@elementor/editor-elements");
|
|
6001
|
+
var import_events2 = require("@elementor/events");
|
|
6002
|
+
var getBaseEventProperties = (data, config) => ({
|
|
6003
|
+
app_type: config?.appTypes?.editor ?? "editor",
|
|
6004
|
+
window_name: config?.appTypes?.editor ?? "editor",
|
|
6005
|
+
interaction_type: config?.triggers?.click ?? "Click",
|
|
6006
|
+
target_name: data.target_name,
|
|
6007
|
+
target_location: data.target_location ?? "widget_panel",
|
|
6008
|
+
location_l1: data.location_l1 ?? (0, import_editor_elements5.getSelectedElements)()[0]?.type ?? "",
|
|
6009
|
+
...data.location_l2 && { location_l2: data.location_l2 }
|
|
6010
|
+
});
|
|
6011
|
+
var dispatchPromotionEvent = (data, resolveOptions) => {
|
|
6012
|
+
const { dispatchEvent, config } = (0, import_events2.getMixpanel)();
|
|
6013
|
+
const { eventName, interactionResult, interactionDescription } = resolveOptions(config);
|
|
6014
|
+
if (!eventName) {
|
|
6015
|
+
return;
|
|
6016
|
+
}
|
|
6017
|
+
dispatchEvent?.(eventName, {
|
|
6018
|
+
...getBaseEventProperties(data, config),
|
|
6019
|
+
interaction_result: interactionResult,
|
|
6020
|
+
interaction_description: interactionDescription
|
|
6021
|
+
});
|
|
6022
|
+
};
|
|
6023
|
+
var trackViewPromotion = (data) => {
|
|
6024
|
+
dispatchPromotionEvent(data, (config) => ({
|
|
6025
|
+
eventName: config?.names?.promotions?.viewPromotion,
|
|
6026
|
+
interactionResult: config?.interactionResults?.promotionViewed ?? "promotion_viewed",
|
|
6027
|
+
interactionDescription: "user_viewed_promotion"
|
|
6028
|
+
}));
|
|
6029
|
+
};
|
|
6030
|
+
var trackUpgradePromotionClick = (data) => {
|
|
6031
|
+
dispatchPromotionEvent(data, (config) => ({
|
|
6032
|
+
eventName: config?.names?.promotions?.upgradePromotionClick,
|
|
6033
|
+
interactionResult: config?.interactionResults?.upgradeNow ?? "upgrade_now",
|
|
6034
|
+
interactionDescription: "user_clicked_upgrade_now"
|
|
6035
|
+
}));
|
|
6036
|
+
};
|
|
6037
|
+
|
|
6038
|
+
// src/controls/transition-control/transition-selector.tsx
|
|
5993
6039
|
var toTransitionSelectorValue = (label) => {
|
|
5994
6040
|
for (const category of transitionProperties) {
|
|
5995
6041
|
const property = category.properties.find((prop) => prop.label === label);
|
|
@@ -6127,7 +6173,11 @@ var TransitionSelector = ({
|
|
|
6127
6173
|
"Upgrade to customize transition properties and control effects.",
|
|
6128
6174
|
"elementor"
|
|
6129
6175
|
),
|
|
6130
|
-
upgradeUrl: PRO_UPGRADE_URL
|
|
6176
|
+
upgradeUrl: PRO_UPGRADE_URL,
|
|
6177
|
+
onCtaClick: () => trackUpgradePromotionClick({
|
|
6178
|
+
target_name: "transition_property",
|
|
6179
|
+
location_l2: "style"
|
|
6180
|
+
})
|
|
6131
6181
|
}
|
|
6132
6182
|
) : null
|
|
6133
6183
|
}
|
|
@@ -6255,6 +6305,7 @@ var TransitionRepeaterControl = createControl(
|
|
|
6255
6305
|
}) => {
|
|
6256
6306
|
const currentStyleIsNormal = currentStyleState === null;
|
|
6257
6307
|
const [recentlyUsedList, setRecentlyUsedList] = (0, import_react50.useState)([]);
|
|
6308
|
+
const proInstalled = (0, import_utils7.hasProInstalled)();
|
|
6258
6309
|
const { value, setValue } = useBoundProp(childArrayPropTypeUtil);
|
|
6259
6310
|
const { allDisabled: disabledItems, proDisabled: proDisabledItems } = (0, import_react50.useMemo)(
|
|
6260
6311
|
() => getDisabledItemLabels(value),
|
|
@@ -6263,10 +6314,14 @@ var TransitionRepeaterControl = createControl(
|
|
|
6263
6314
|
const allowedTransitionSet = (0, import_react50.useMemo)(() => {
|
|
6264
6315
|
const set = /* @__PURE__ */ new Set();
|
|
6265
6316
|
transitionProperties.forEach((category) => {
|
|
6266
|
-
category.properties.forEach((prop) =>
|
|
6317
|
+
category.properties.forEach((prop) => {
|
|
6318
|
+
if (!prop.isDisabled || proInstalled) {
|
|
6319
|
+
set.add(prop.value);
|
|
6320
|
+
}
|
|
6321
|
+
});
|
|
6267
6322
|
});
|
|
6268
6323
|
return set;
|
|
6269
|
-
}, []);
|
|
6324
|
+
}, [proInstalled]);
|
|
6270
6325
|
(0, import_react50.useEffect)(() => {
|
|
6271
6326
|
if (!value || value.length === 0) {
|
|
6272
6327
|
return;
|
|
@@ -6391,7 +6446,7 @@ var React101 = __toESM(require("react"));
|
|
|
6391
6446
|
var import_react53 = require("react");
|
|
6392
6447
|
var import_editor_props53 = require("@elementor/editor-props");
|
|
6393
6448
|
var import_ui87 = require("@elementor/ui");
|
|
6394
|
-
var
|
|
6449
|
+
var import_utils8 = require("@elementor/utils");
|
|
6395
6450
|
|
|
6396
6451
|
// src/components/inline-editor.tsx
|
|
6397
6452
|
var React100 = __toESM(require("react"));
|
|
@@ -6574,7 +6629,7 @@ var InlineEditingControl = createControl(
|
|
|
6574
6629
|
const { value, setValue } = useBoundProp(import_editor_props53.htmlV3PropTypeUtil);
|
|
6575
6630
|
const content = import_editor_props53.stringPropTypeUtil.extract(value?.content ?? null) ?? "";
|
|
6576
6631
|
const debouncedParse = (0, import_react53.useMemo)(
|
|
6577
|
-
() => (0,
|
|
6632
|
+
() => (0, import_utils8.debounce)((html) => {
|
|
6578
6633
|
const parsed = (0, import_editor_props53.parseHtmlChildren)(html);
|
|
6579
6634
|
setValue({
|
|
6580
6635
|
content: parsed.content ? import_editor_props53.stringPropTypeUtil.create(parsed.content) : null,
|
|
@@ -6649,7 +6704,7 @@ var SendToField = () => /* @__PURE__ */ React102.createElement(
|
|
|
6649
6704
|
EmailField,
|
|
6650
6705
|
{
|
|
6651
6706
|
bind: "to",
|
|
6652
|
-
label: (0, import_i18n51.__)("Send
|
|
6707
|
+
label: (0, import_i18n51.__)("Send to", "elementor"),
|
|
6653
6708
|
placeholder: (0, import_i18n51.__)("Where should we send new submissions?", "elementor")
|
|
6654
6709
|
}
|
|
6655
6710
|
);
|
|
@@ -6657,7 +6712,7 @@ var SubjectField = () => /* @__PURE__ */ React102.createElement(
|
|
|
6657
6712
|
EmailField,
|
|
6658
6713
|
{
|
|
6659
6714
|
bind: "subject",
|
|
6660
|
-
label: (0, import_i18n51.__)("Email
|
|
6715
|
+
label: (0, import_i18n51.__)("Email subject", "elementor"),
|
|
6661
6716
|
placeholder: (0, import_i18n51.__)("New form submission", "elementor")
|
|
6662
6717
|
}
|
|
6663
6718
|
);
|
|
@@ -6675,7 +6730,7 @@ var FromEmailField = () => /* @__PURE__ */ React102.createElement(
|
|
|
6675
6730
|
{
|
|
6676
6731
|
bind: "from",
|
|
6677
6732
|
label: (0, import_i18n51.__)("From email", "elementor"),
|
|
6678
|
-
placeholder: (0, import_i18n51.__)("What email
|
|
6733
|
+
placeholder: (0, import_i18n51.__)("What email should appear as the sender?", "elementor")
|
|
6679
6734
|
}
|
|
6680
6735
|
);
|
|
6681
6736
|
var FromNameField = () => /* @__PURE__ */ React102.createElement(
|
|
@@ -6689,7 +6744,7 @@ var FromNameField = () => /* @__PURE__ */ React102.createElement(
|
|
|
6689
6744
|
var ReplyToField = () => /* @__PURE__ */ React102.createElement(EmailField, { bind: "reply-to", label: (0, import_i18n51.__)("Reply-to", "elementor") });
|
|
6690
6745
|
var CcField = () => /* @__PURE__ */ React102.createElement(EmailField, { bind: "cc", label: (0, import_i18n51.__)("Cc", "elementor") });
|
|
6691
6746
|
var BccField = () => /* @__PURE__ */ React102.createElement(EmailField, { bind: "bcc", label: (0, import_i18n51.__)("Bcc", "elementor") });
|
|
6692
|
-
var MetaDataField = () => /* @__PURE__ */ React102.createElement(PropKeyProvider, { bind: "meta-data" }, /* @__PURE__ */ React102.createElement(import_ui88.Stack, { gap: 0.5 }, /* @__PURE__ */ React102.createElement(ControlLabel, null, (0, import_i18n51.__)("
|
|
6747
|
+
var MetaDataField = () => /* @__PURE__ */ React102.createElement(PropKeyProvider, { bind: "meta-data" }, /* @__PURE__ */ React102.createElement(import_ui88.Stack, { gap: 0.5 }, /* @__PURE__ */ React102.createElement(ControlLabel, null, (0, import_i18n51.__)("Metadata", "elementor")), /* @__PURE__ */ React102.createElement(
|
|
6693
6748
|
ChipsControl,
|
|
6694
6749
|
{
|
|
6695
6750
|
options: [
|
|
@@ -6713,32 +6768,664 @@ var SendAsField = () => /* @__PURE__ */ React102.createElement(PropKeyProvider,
|
|
|
6713
6768
|
var AdvancedSettings = () => /* @__PURE__ */ React102.createElement(import_editor_ui13.CollapsibleContent, { defaultOpen: false }, /* @__PURE__ */ React102.createElement(import_ui88.Box, { sx: { pt: 2 } }, /* @__PURE__ */ React102.createElement(import_ui88.Stack, { gap: 2 }, /* @__PURE__ */ React102.createElement(FromNameField, null), /* @__PURE__ */ React102.createElement(ReplyToField, null), /* @__PURE__ */ React102.createElement(CcField, null), /* @__PURE__ */ React102.createElement(BccField, null), /* @__PURE__ */ React102.createElement(import_ui88.Divider, null), /* @__PURE__ */ React102.createElement(MetaDataField, null), /* @__PURE__ */ React102.createElement(SendAsField, null))));
|
|
6714
6769
|
var EmailFormActionControl = createControl(() => {
|
|
6715
6770
|
const { value, setValue, ...propContext } = useBoundProp(import_editor_props54.emailPropTypeUtil);
|
|
6716
|
-
return /* @__PURE__ */ React102.createElement(PropProvider, { ...propContext, value, setValue }, /* @__PURE__ */ React102.createElement(import_ui88.Stack, { gap: 2 }, /* @__PURE__ */ React102.createElement(
|
|
6771
|
+
return /* @__PURE__ */ React102.createElement(PropProvider, { ...propContext, value, setValue }, /* @__PURE__ */ React102.createElement(import_ui88.Stack, { gap: 2 }, /* @__PURE__ */ React102.createElement(ControlLabel, null, (0, import_i18n51.__)("Email settings", "elementor")), /* @__PURE__ */ React102.createElement(SendToField, null), /* @__PURE__ */ React102.createElement(SubjectField, null), /* @__PURE__ */ React102.createElement(MessageField, null), /* @__PURE__ */ React102.createElement(FromEmailField, null), /* @__PURE__ */ React102.createElement(AdvancedSettings, null)));
|
|
6717
6772
|
});
|
|
6718
6773
|
|
|
6719
|
-
// src/
|
|
6720
|
-
var
|
|
6721
|
-
var
|
|
6774
|
+
// src/controls/size-control/unstable-size-control.tsx
|
|
6775
|
+
var React108 = __toESM(require("react"));
|
|
6776
|
+
var import_editor_props56 = require("@elementor/editor-props");
|
|
6777
|
+
|
|
6778
|
+
// src/controls/size-control/size-component.tsx
|
|
6779
|
+
var React107 = __toESM(require("react"));
|
|
6780
|
+
var import_react58 = require("react");
|
|
6781
|
+
var import_editor_responsive4 = require("@elementor/editor-responsive");
|
|
6782
|
+
var import_ui92 = require("@elementor/ui");
|
|
6783
|
+
|
|
6784
|
+
// src/controls/size-control/size-field.tsx
|
|
6785
|
+
var React105 = __toESM(require("react"));
|
|
6722
6786
|
var import_icons34 = require("@elementor/icons");
|
|
6723
6787
|
var import_ui90 = require("@elementor/ui");
|
|
6724
|
-
var import_i18n52 = require("@wordpress/i18n");
|
|
6725
6788
|
|
|
6726
|
-
// src/
|
|
6727
|
-
var
|
|
6789
|
+
// src/controls/size-control/sync/get-units.ts
|
|
6790
|
+
var getLengthUnits = () => {
|
|
6791
|
+
return window.elementor?.config?.size_units?.length ?? [];
|
|
6792
|
+
};
|
|
6793
|
+
var getAngleUnits = () => {
|
|
6794
|
+
return window.elementor?.config?.size_units?.angle ?? [];
|
|
6795
|
+
};
|
|
6796
|
+
var getTimeUnits = () => {
|
|
6797
|
+
return window.elementor?.config?.size_units?.time ?? [];
|
|
6798
|
+
};
|
|
6799
|
+
var getExtendedUnits = () => {
|
|
6800
|
+
return window.elementor?.config?.size_units?.extended_units ?? [];
|
|
6801
|
+
};
|
|
6802
|
+
|
|
6803
|
+
// src/controls/size-control/utils/is-extended-unit.ts
|
|
6804
|
+
var isExtendedUnit = (unit) => {
|
|
6805
|
+
const extendedUnits = getExtendedUnits();
|
|
6806
|
+
return extendedUnits.includes(unit);
|
|
6807
|
+
};
|
|
6808
|
+
|
|
6809
|
+
// src/controls/size-control/hooks/use-size-unit-keyboard.tsx
|
|
6810
|
+
var UNIT_KEY_PATTERN = /^[a-zA-Z%]$/;
|
|
6811
|
+
var useSizeUnitKeyboard = ({ unit, units: units2, onUnitChange }) => {
|
|
6812
|
+
const { appendKey, startsWith } = useTypingBuffer();
|
|
6813
|
+
const onUnitKeyDown = (event) => {
|
|
6814
|
+
if (units2.length === 0) {
|
|
6815
|
+
return;
|
|
6816
|
+
}
|
|
6817
|
+
const { key, altKey, ctrlKey, metaKey } = event;
|
|
6818
|
+
if (altKey || ctrlKey || metaKey) {
|
|
6819
|
+
return;
|
|
6820
|
+
}
|
|
6821
|
+
if (isExtendedUnit(unit) && isNumericValue(key)) {
|
|
6822
|
+
const [defaultUnit] = units2;
|
|
6823
|
+
if (defaultUnit) {
|
|
6824
|
+
onUnitChange(defaultUnit);
|
|
6825
|
+
}
|
|
6826
|
+
return;
|
|
6827
|
+
}
|
|
6828
|
+
if (!UNIT_KEY_PATTERN.test(key)) {
|
|
6829
|
+
return;
|
|
6830
|
+
}
|
|
6831
|
+
event.preventDefault();
|
|
6832
|
+
const updatedBuffer = appendKey(key.toLowerCase());
|
|
6833
|
+
const matchedUnit = units2.find((u) => startsWith(u, updatedBuffer));
|
|
6834
|
+
if (matchedUnit) {
|
|
6835
|
+
onUnitChange(matchedUnit);
|
|
6836
|
+
}
|
|
6837
|
+
};
|
|
6838
|
+
return { onUnitKeyDown };
|
|
6839
|
+
};
|
|
6840
|
+
var isNumericValue = (value) => {
|
|
6841
|
+
if (typeof value === "number") {
|
|
6842
|
+
return !isNaN(value);
|
|
6843
|
+
}
|
|
6844
|
+
if (typeof value === "string") {
|
|
6845
|
+
return value.trim() !== "" && !isNaN(Number(value));
|
|
6846
|
+
}
|
|
6847
|
+
return false;
|
|
6848
|
+
};
|
|
6849
|
+
|
|
6850
|
+
// src/controls/size-control/hooks/use-size-value.ts
|
|
6728
6851
|
var import_react54 = require("react");
|
|
6852
|
+
|
|
6853
|
+
// src/controls/size-control/utils/resolve-size-value.ts
|
|
6854
|
+
var DEFAULT_SIZE2 = "";
|
|
6855
|
+
var EXTENDED_UNITS = {
|
|
6856
|
+
auto: "auto",
|
|
6857
|
+
custom: "custom"
|
|
6858
|
+
};
|
|
6859
|
+
var resolveSizeValue = (value, context) => {
|
|
6860
|
+
if (!value) {
|
|
6861
|
+
return value;
|
|
6862
|
+
}
|
|
6863
|
+
const { units: units2, defaultUnit } = context;
|
|
6864
|
+
const unit = resolveFallbackUnit(value.unit, units2, defaultUnit);
|
|
6865
|
+
if (unit === EXTENDED_UNITS.auto) {
|
|
6866
|
+
return { size: DEFAULT_SIZE2, unit };
|
|
6867
|
+
}
|
|
6868
|
+
if (unit === EXTENDED_UNITS.custom) {
|
|
6869
|
+
return { size: String(value.size ?? DEFAULT_SIZE2), unit };
|
|
6870
|
+
}
|
|
6871
|
+
return {
|
|
6872
|
+
size: sanitizeSize(value.size) ?? DEFAULT_SIZE2,
|
|
6873
|
+
unit
|
|
6874
|
+
};
|
|
6875
|
+
};
|
|
6876
|
+
var resolveSizeOnUnitChange = (size, unit) => {
|
|
6877
|
+
return isExtendedUnit(unit) ? DEFAULT_SIZE2 : size;
|
|
6878
|
+
};
|
|
6879
|
+
var createDefaultSizeValue = (units2, defaultUnit) => {
|
|
6880
|
+
let [unit] = units2;
|
|
6881
|
+
if (defaultUnit !== void 0) {
|
|
6882
|
+
unit = resolveFallbackUnit(defaultUnit, units2);
|
|
6883
|
+
}
|
|
6884
|
+
return { size: DEFAULT_SIZE2, unit };
|
|
6885
|
+
};
|
|
6886
|
+
var resolveFallbackUnit = (unit, units2, defaultUnit) => {
|
|
6887
|
+
if (units2.includes(unit)) {
|
|
6888
|
+
return unit;
|
|
6889
|
+
}
|
|
6890
|
+
if (defaultUnit && units2.includes(defaultUnit)) {
|
|
6891
|
+
return defaultUnit;
|
|
6892
|
+
}
|
|
6893
|
+
return units2[0] ?? "";
|
|
6894
|
+
};
|
|
6895
|
+
var sanitizeSize = (size) => {
|
|
6896
|
+
if (typeof size === "number" && isNaN(size)) {
|
|
6897
|
+
return DEFAULT_SIZE2;
|
|
6898
|
+
}
|
|
6899
|
+
return size;
|
|
6900
|
+
};
|
|
6901
|
+
|
|
6902
|
+
// src/controls/size-control/hooks/use-size-value.ts
|
|
6903
|
+
var useSizeValue = ({
|
|
6904
|
+
value,
|
|
6905
|
+
setValue,
|
|
6906
|
+
units: units2,
|
|
6907
|
+
defaultUnit
|
|
6908
|
+
}) => {
|
|
6909
|
+
const resolvedValue = (0, import_react54.useMemo)(
|
|
6910
|
+
() => resolveSizeValue(value, { units: units2, defaultUnit }),
|
|
6911
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
6912
|
+
[value?.size, value?.unit, defaultUnit]
|
|
6913
|
+
);
|
|
6914
|
+
const [sizeValue, setSizeValue] = useSyncExternalState({
|
|
6915
|
+
external: resolvedValue,
|
|
6916
|
+
setExternal: (newState, options, meta) => {
|
|
6917
|
+
if (newState !== null) {
|
|
6918
|
+
setValue(newState, options, meta);
|
|
6919
|
+
}
|
|
6920
|
+
},
|
|
6921
|
+
persistWhen: (next) => hasChanged(next, resolvedValue),
|
|
6922
|
+
fallback: () => createDefaultSizeValue(units2, defaultUnit)
|
|
6923
|
+
});
|
|
6924
|
+
const setSize = (newSize, isInputValid = true) => {
|
|
6925
|
+
if (isExtendedUnit(sizeValue.unit)) {
|
|
6926
|
+
return;
|
|
6927
|
+
}
|
|
6928
|
+
const trimmed = newSize.trim();
|
|
6929
|
+
const parsed = Number(trimmed);
|
|
6930
|
+
const newState = {
|
|
6931
|
+
...sizeValue,
|
|
6932
|
+
size: trimmed && !isNaN(parsed) ? parsed : ""
|
|
6933
|
+
};
|
|
6934
|
+
setSizeValue(newState, void 0, { validation: () => isInputValid });
|
|
6935
|
+
};
|
|
6936
|
+
const setUnit = (unit) => {
|
|
6937
|
+
setSizeValue({ unit, size: resolveSizeOnUnitChange(sizeValue.size, unit) });
|
|
6938
|
+
};
|
|
6939
|
+
return {
|
|
6940
|
+
size: sizeValue.size,
|
|
6941
|
+
unit: sizeValue.unit,
|
|
6942
|
+
setSize,
|
|
6943
|
+
setUnit
|
|
6944
|
+
};
|
|
6945
|
+
};
|
|
6946
|
+
var hasChanged = (next, current) => {
|
|
6947
|
+
return next?.size !== current?.size || next?.unit !== current?.unit;
|
|
6948
|
+
};
|
|
6949
|
+
|
|
6950
|
+
// src/controls/size-control/ui/size-input.tsx
|
|
6951
|
+
var React103 = __toESM(require("react"));
|
|
6952
|
+
var import_react55 = require("react");
|
|
6953
|
+
var SizeInput2 = (0, import_react55.forwardRef)(
|
|
6954
|
+
({
|
|
6955
|
+
id,
|
|
6956
|
+
type,
|
|
6957
|
+
value,
|
|
6958
|
+
onBlur,
|
|
6959
|
+
onKeyUp,
|
|
6960
|
+
focused,
|
|
6961
|
+
disabled,
|
|
6962
|
+
onChange,
|
|
6963
|
+
onKeyDown,
|
|
6964
|
+
InputProps,
|
|
6965
|
+
inputProps,
|
|
6966
|
+
placeholder
|
|
6967
|
+
}, ref) => {
|
|
6968
|
+
return /* @__PURE__ */ React103.createElement(
|
|
6969
|
+
NumberInput,
|
|
6970
|
+
{
|
|
6971
|
+
id,
|
|
6972
|
+
ref,
|
|
6973
|
+
size: "tiny",
|
|
6974
|
+
fullWidth: true,
|
|
6975
|
+
type,
|
|
6976
|
+
value,
|
|
6977
|
+
placeholder,
|
|
6978
|
+
onKeyUp,
|
|
6979
|
+
focused,
|
|
6980
|
+
disabled,
|
|
6981
|
+
onKeyDown,
|
|
6982
|
+
onInput: onChange,
|
|
6983
|
+
onBlur,
|
|
6984
|
+
InputProps,
|
|
6985
|
+
inputProps,
|
|
6986
|
+
sx: getCursorStyle(InputProps?.readOnly ?? false)
|
|
6987
|
+
}
|
|
6988
|
+
);
|
|
6989
|
+
}
|
|
6990
|
+
);
|
|
6991
|
+
var getCursorStyle = (readOnly) => ({
|
|
6992
|
+
input: { cursor: readOnly ? "default !important" : void 0 }
|
|
6993
|
+
});
|
|
6994
|
+
|
|
6995
|
+
// src/controls/size-control/ui/unit-selector.tsx
|
|
6996
|
+
var React104 = __toESM(require("react"));
|
|
6997
|
+
var import_react56 = require("react");
|
|
6729
6998
|
var import_editor_ui14 = require("@elementor/editor-ui");
|
|
6730
6999
|
var import_ui89 = require("@elementor/ui");
|
|
7000
|
+
var menuItemContentStyles = {
|
|
7001
|
+
display: "flex",
|
|
7002
|
+
flexDirection: "column",
|
|
7003
|
+
justifyContent: "center"
|
|
7004
|
+
};
|
|
7005
|
+
var UnitSelector = ({
|
|
7006
|
+
value,
|
|
7007
|
+
isActive,
|
|
7008
|
+
onSelect,
|
|
7009
|
+
options,
|
|
7010
|
+
disabled,
|
|
7011
|
+
menuItemsAttributes = {},
|
|
7012
|
+
optionLabelOverrides = {}
|
|
7013
|
+
}) => {
|
|
7014
|
+
const popupState = (0, import_ui89.usePopupState)({
|
|
7015
|
+
variant: "popover",
|
|
7016
|
+
popupId: (0, import_react56.useId)()
|
|
7017
|
+
});
|
|
7018
|
+
const handleMenuItemClick = (option) => {
|
|
7019
|
+
onSelect(option);
|
|
7020
|
+
popupState.close();
|
|
7021
|
+
};
|
|
7022
|
+
return /* @__PURE__ */ React104.createElement(React104.Fragment, null, /* @__PURE__ */ React104.createElement(StyledButton2, { isActive, disabled, size: "small", ...(0, import_ui89.bindTrigger)(popupState) }, optionLabelOverrides[value] ?? value), /* @__PURE__ */ React104.createElement(import_ui89.Menu, { MenuListProps: { dense: true }, ...(0, import_ui89.bindMenu)(popupState) }, options.map((option) => /* @__PURE__ */ React104.createElement(
|
|
7023
|
+
import_editor_ui14.MenuListItem,
|
|
7024
|
+
{
|
|
7025
|
+
key: option,
|
|
7026
|
+
onClick: () => handleMenuItemClick(option),
|
|
7027
|
+
...menuItemsAttributes?.[option],
|
|
7028
|
+
primaryTypographyProps: {
|
|
7029
|
+
variant: "caption",
|
|
7030
|
+
sx: {
|
|
7031
|
+
...menuItemContentStyles,
|
|
7032
|
+
lineHeight: "1"
|
|
7033
|
+
}
|
|
7034
|
+
},
|
|
7035
|
+
menuItemTextProps: {
|
|
7036
|
+
sx: menuItemContentStyles
|
|
7037
|
+
}
|
|
7038
|
+
},
|
|
7039
|
+
optionLabelOverrides[option] ?? option.toUpperCase()
|
|
7040
|
+
))));
|
|
7041
|
+
};
|
|
7042
|
+
var StyledButton2 = (0, import_ui89.styled)(import_ui89.Button, {
|
|
7043
|
+
shouldForwardProp: (prop) => prop !== "isActive"
|
|
7044
|
+
})(({ isActive, theme }) => ({
|
|
7045
|
+
color: isActive ? theme.palette.text.primary : theme.palette.text.tertiary,
|
|
7046
|
+
font: "inherit",
|
|
7047
|
+
minWidth: "initial",
|
|
7048
|
+
textTransform: "uppercase"
|
|
7049
|
+
}));
|
|
7050
|
+
|
|
7051
|
+
// src/controls/size-control/utils/has-size-value.ts
|
|
7052
|
+
var hasSizeValue = (size) => {
|
|
7053
|
+
return Boolean(size) || size === 0;
|
|
7054
|
+
};
|
|
7055
|
+
|
|
7056
|
+
// src/controls/size-control/size-field.tsx
|
|
7057
|
+
var UNIT_DISPLAY_LABELS_OVERRIDES = {
|
|
7058
|
+
custom: /* @__PURE__ */ React105.createElement(import_icons34.MathFunctionIcon, { fontSize: "tiny" })
|
|
7059
|
+
};
|
|
7060
|
+
var SizeField = ({
|
|
7061
|
+
value,
|
|
7062
|
+
focused,
|
|
7063
|
+
disabled,
|
|
7064
|
+
InputProps,
|
|
7065
|
+
defaultUnit,
|
|
7066
|
+
placeholder,
|
|
7067
|
+
onUnitChange,
|
|
7068
|
+
startIcon,
|
|
7069
|
+
ariaLabel,
|
|
7070
|
+
onKeyDown,
|
|
7071
|
+
setValue,
|
|
7072
|
+
onBlur,
|
|
7073
|
+
units: units2,
|
|
7074
|
+
min,
|
|
7075
|
+
unitSelectorProps
|
|
7076
|
+
}) => {
|
|
7077
|
+
const { size, unit, setSize, setUnit } = useSizeValue({ value, setValue, units: units2, defaultUnit });
|
|
7078
|
+
const handleUnitChange = (newUnit) => {
|
|
7079
|
+
setUnit(newUnit);
|
|
7080
|
+
onUnitChange?.(newUnit);
|
|
7081
|
+
};
|
|
7082
|
+
const { onUnitKeyDown } = useSizeUnitKeyboard({ unit, onUnitChange: handleUnitChange, units: units2 });
|
|
7083
|
+
const handleKeyDown = (event) => {
|
|
7084
|
+
onUnitKeyDown(event);
|
|
7085
|
+
onKeyDown?.(event);
|
|
7086
|
+
};
|
|
7087
|
+
const handleChange = (event) => {
|
|
7088
|
+
const newSize = event.target.value;
|
|
7089
|
+
const isInputValid = event.target.validity.valid;
|
|
7090
|
+
setSize(newSize, isInputValid);
|
|
7091
|
+
};
|
|
7092
|
+
const inputType = isExtendedUnit(unit) ? "text" : "number";
|
|
7093
|
+
return /* @__PURE__ */ React105.createElement(
|
|
7094
|
+
SizeInput2,
|
|
7095
|
+
{
|
|
7096
|
+
disabled,
|
|
7097
|
+
focused,
|
|
7098
|
+
type: inputType,
|
|
7099
|
+
value: size,
|
|
7100
|
+
placeholder,
|
|
7101
|
+
onBlur,
|
|
7102
|
+
onKeyDown: handleKeyDown,
|
|
7103
|
+
onChange: handleChange,
|
|
7104
|
+
InputProps: {
|
|
7105
|
+
...InputProps,
|
|
7106
|
+
autoComplete: "off",
|
|
7107
|
+
readOnly: isExtendedUnit(unit),
|
|
7108
|
+
startAdornment: startIcon && /* @__PURE__ */ React105.createElement(import_ui90.InputAdornment, { position: "start", disabled }, startIcon),
|
|
7109
|
+
endAdornment: /* @__PURE__ */ React105.createElement(import_ui90.InputAdornment, { position: "end" }, /* @__PURE__ */ React105.createElement(
|
|
7110
|
+
UnitSelector,
|
|
7111
|
+
{
|
|
7112
|
+
options: units2,
|
|
7113
|
+
value: unit,
|
|
7114
|
+
onSelect: handleUnitChange,
|
|
7115
|
+
isActive: unitSelectorProps?.isActive ?? hasSizeValue(size),
|
|
7116
|
+
...unitSelectorProps,
|
|
7117
|
+
optionLabelOverrides: UNIT_DISPLAY_LABELS_OVERRIDES
|
|
7118
|
+
}
|
|
7119
|
+
))
|
|
7120
|
+
},
|
|
7121
|
+
inputProps: { min, step: "any", "arial-label": ariaLabel }
|
|
7122
|
+
}
|
|
7123
|
+
);
|
|
7124
|
+
};
|
|
7125
|
+
|
|
7126
|
+
// src/controls/size-control/ui/text-field-popover.tsx
|
|
7127
|
+
var React106 = __toESM(require("react"));
|
|
7128
|
+
var import_react57 = require("react");
|
|
7129
|
+
var import_editor_ui15 = require("@elementor/editor-ui");
|
|
7130
|
+
var import_icons35 = require("@elementor/icons");
|
|
7131
|
+
var import_ui91 = require("@elementor/ui");
|
|
7132
|
+
var import_i18n52 = require("@wordpress/i18n");
|
|
7133
|
+
var SIZE10 = "tiny";
|
|
7134
|
+
var TextFieldPopover2 = ({ popupState, anchorRef, value, onChange, onClose }) => {
|
|
7135
|
+
const inputRef = (0, import_react57.useRef)(null);
|
|
7136
|
+
(0, import_react57.useEffect)(() => {
|
|
7137
|
+
if (popupState.isOpen) {
|
|
7138
|
+
requestAnimationFrame(() => {
|
|
7139
|
+
if (inputRef.current) {
|
|
7140
|
+
inputRef.current.focus();
|
|
7141
|
+
}
|
|
7142
|
+
});
|
|
7143
|
+
}
|
|
7144
|
+
}, [popupState.isOpen]);
|
|
7145
|
+
const handleKeyDown = (event) => {
|
|
7146
|
+
if (event.key.toLowerCase() === "enter") {
|
|
7147
|
+
handleClose();
|
|
7148
|
+
}
|
|
7149
|
+
};
|
|
7150
|
+
const handleClose = () => {
|
|
7151
|
+
onClose?.();
|
|
7152
|
+
popupState.close();
|
|
7153
|
+
};
|
|
7154
|
+
return /* @__PURE__ */ React106.createElement(
|
|
7155
|
+
import_ui91.Popover,
|
|
7156
|
+
{
|
|
7157
|
+
disablePortal: true,
|
|
7158
|
+
slotProps: {
|
|
7159
|
+
paper: {
|
|
7160
|
+
sx: {
|
|
7161
|
+
borderRadius: 2,
|
|
7162
|
+
width: anchorRef.current?.offsetWidth + "px"
|
|
7163
|
+
}
|
|
7164
|
+
}
|
|
7165
|
+
},
|
|
7166
|
+
...(0, import_ui91.bindPopover)(popupState),
|
|
7167
|
+
anchorOrigin: { vertical: "bottom", horizontal: "center" },
|
|
7168
|
+
transformOrigin: { vertical: "top", horizontal: "center" },
|
|
7169
|
+
onClose: handleClose
|
|
7170
|
+
},
|
|
7171
|
+
/* @__PURE__ */ React106.createElement(
|
|
7172
|
+
import_editor_ui15.PopoverHeader,
|
|
7173
|
+
{
|
|
7174
|
+
title: (0, import_i18n52.__)("CSS function", "elementor"),
|
|
7175
|
+
onClose: handleClose,
|
|
7176
|
+
icon: /* @__PURE__ */ React106.createElement(import_icons35.MathFunctionIcon, { fontSize: SIZE10 })
|
|
7177
|
+
}
|
|
7178
|
+
),
|
|
7179
|
+
/* @__PURE__ */ React106.createElement(
|
|
7180
|
+
import_ui91.TextField,
|
|
7181
|
+
{
|
|
7182
|
+
value,
|
|
7183
|
+
onChange,
|
|
7184
|
+
onKeyDown: handleKeyDown,
|
|
7185
|
+
size: "tiny",
|
|
7186
|
+
type: "text",
|
|
7187
|
+
fullWidth: true,
|
|
7188
|
+
inputProps: {
|
|
7189
|
+
ref: inputRef
|
|
7190
|
+
},
|
|
7191
|
+
sx: { pt: 0, pr: 1.5, pb: 1.5, pl: 1.5 }
|
|
7192
|
+
}
|
|
7193
|
+
)
|
|
7194
|
+
);
|
|
7195
|
+
};
|
|
7196
|
+
|
|
7197
|
+
// src/controls/size-control/size-component.tsx
|
|
7198
|
+
var SizeComponent = ({
|
|
7199
|
+
anchorRef,
|
|
7200
|
+
isUnitActive,
|
|
7201
|
+
SizeFieldWrapper = React107.Fragment,
|
|
7202
|
+
...sizeFieldProps
|
|
7203
|
+
}) => {
|
|
7204
|
+
const popupState = (0, import_ui92.usePopupState)({ variant: "popover" });
|
|
7205
|
+
const activeBreakpoint = (0, import_editor_responsive4.useActiveBreakpoint)();
|
|
7206
|
+
const isCustomUnit = sizeFieldProps?.value?.unit === EXTENDED_UNITS.custom;
|
|
7207
|
+
const hasCustomUnitOption = sizeFieldProps.units.includes(EXTENDED_UNITS.custom);
|
|
7208
|
+
(0, import_react58.useEffect)(() => {
|
|
7209
|
+
if (popupState && popupState.isOpen) {
|
|
7210
|
+
popupState.close();
|
|
7211
|
+
}
|
|
7212
|
+
}, [activeBreakpoint]);
|
|
7213
|
+
const handleCustomSizeChange = (event) => {
|
|
7214
|
+
sizeFieldProps.setValue({
|
|
7215
|
+
size: event.target.value,
|
|
7216
|
+
unit: EXTENDED_UNITS.custom
|
|
7217
|
+
});
|
|
7218
|
+
};
|
|
7219
|
+
const handleSizeFieldClick = (event) => {
|
|
7220
|
+
if (event.target.closest("input") && isCustomUnit) {
|
|
7221
|
+
popupState.open(anchorRef?.current);
|
|
7222
|
+
}
|
|
7223
|
+
};
|
|
7224
|
+
const handleUnitChange = (unit) => {
|
|
7225
|
+
if (unit === EXTENDED_UNITS.custom && anchorRef?.current) {
|
|
7226
|
+
popupState.open(anchorRef.current);
|
|
7227
|
+
}
|
|
7228
|
+
};
|
|
7229
|
+
const popupAttributes = {
|
|
7230
|
+
"aria-controls": popupState.isOpen ? popupState.popupId : void 0,
|
|
7231
|
+
"aria-haspopup": true
|
|
7232
|
+
};
|
|
7233
|
+
return /* @__PURE__ */ React107.createElement(React107.Fragment, null, /* @__PURE__ */ React107.createElement(SizeFieldWrapper, null, /* @__PURE__ */ React107.createElement(import_ui92.Box, null, /* @__PURE__ */ React107.createElement(
|
|
7234
|
+
SizeField,
|
|
7235
|
+
{
|
|
7236
|
+
focused: popupState.isOpen ? true : void 0,
|
|
7237
|
+
onUnitChange: handleUnitChange,
|
|
7238
|
+
InputProps: {
|
|
7239
|
+
...popupAttributes,
|
|
7240
|
+
onClick: handleSizeFieldClick
|
|
7241
|
+
},
|
|
7242
|
+
unitSelectorProps: {
|
|
7243
|
+
menuItemsAttributes: hasCustomUnitOption ? { custom: popupAttributes } : void 0,
|
|
7244
|
+
isActive: isUnitActive
|
|
7245
|
+
},
|
|
7246
|
+
...sizeFieldProps
|
|
7247
|
+
}
|
|
7248
|
+
))), popupState.isOpen && anchorRef?.current && /* @__PURE__ */ React107.createElement(
|
|
7249
|
+
TextFieldPopover2,
|
|
7250
|
+
{
|
|
7251
|
+
popupState,
|
|
7252
|
+
anchorRef,
|
|
7253
|
+
value: String(sizeFieldProps?.value?.size ?? ""),
|
|
7254
|
+
onChange: handleCustomSizeChange,
|
|
7255
|
+
onClose: () => {
|
|
7256
|
+
}
|
|
7257
|
+
}
|
|
7258
|
+
));
|
|
7259
|
+
};
|
|
7260
|
+
|
|
7261
|
+
// src/controls/size-control/utils/resolve-bound-prop-value.ts
|
|
7262
|
+
var import_editor_props55 = require("@elementor/editor-props");
|
|
7263
|
+
var resolveBoundPropValue = (value, boundPropPlaceholder, propPlaceholder) => {
|
|
7264
|
+
let sizeValue = null;
|
|
7265
|
+
if (validateSizeValue(value)) {
|
|
7266
|
+
sizeValue = value;
|
|
7267
|
+
} else if (validateSizeValue(boundPropPlaceholder)) {
|
|
7268
|
+
sizeValue = { size: "", unit: boundPropPlaceholder?.unit };
|
|
7269
|
+
}
|
|
7270
|
+
return {
|
|
7271
|
+
sizeValue,
|
|
7272
|
+
isUnitHighlighted: shouldHighlightUnit(value),
|
|
7273
|
+
placeholder: resolvePlaceholder(propPlaceholder, boundPropPlaceholder)
|
|
7274
|
+
};
|
|
7275
|
+
};
|
|
7276
|
+
var validateSizeValue = (value) => {
|
|
7277
|
+
if (!value) {
|
|
7278
|
+
return false;
|
|
7279
|
+
}
|
|
7280
|
+
const sizePropValue = import_editor_props55.sizePropTypeUtil.create(value);
|
|
7281
|
+
return import_editor_props55.sizePropTypeUtil.isValid(sizePropValue);
|
|
7282
|
+
};
|
|
7283
|
+
var resolvePlaceholder = (propPlaceholder, boundPropPlaceholder) => {
|
|
7284
|
+
if (propPlaceholder) {
|
|
7285
|
+
return propPlaceholder;
|
|
7286
|
+
}
|
|
7287
|
+
const size = boundPropPlaceholder?.size;
|
|
7288
|
+
if (size === void 0) {
|
|
7289
|
+
return void 0;
|
|
7290
|
+
}
|
|
7291
|
+
if (typeof size === "number") {
|
|
7292
|
+
return size.toString();
|
|
7293
|
+
}
|
|
7294
|
+
return size;
|
|
7295
|
+
};
|
|
7296
|
+
var shouldHighlightUnit = (value) => {
|
|
7297
|
+
if (!value) {
|
|
7298
|
+
return false;
|
|
7299
|
+
}
|
|
7300
|
+
if (value.unit === EXTENDED_UNITS.auto) {
|
|
7301
|
+
return true;
|
|
7302
|
+
}
|
|
7303
|
+
return hasSizeValue(value.size);
|
|
7304
|
+
};
|
|
7305
|
+
|
|
7306
|
+
// src/controls/size-control/utils/settings/get-prop-type-settings.ts
|
|
7307
|
+
var getPropTypeSettings = (propType) => {
|
|
7308
|
+
return propType.settings;
|
|
7309
|
+
};
|
|
7310
|
+
|
|
7311
|
+
// src/controls/size-control/utils/settings/get-default-unit.ts
|
|
7312
|
+
var getDefaultUnit = (propType) => {
|
|
7313
|
+
return getPropTypeSettings(propType)?.default_unit;
|
|
7314
|
+
};
|
|
7315
|
+
|
|
7316
|
+
// src/controls/size-control/utils/settings/get-size-units.ts
|
|
7317
|
+
var getVariantUnits = (variant) => {
|
|
7318
|
+
const map = {
|
|
7319
|
+
length: getLengthUnits,
|
|
7320
|
+
angle: getAngleUnits,
|
|
7321
|
+
time: getTimeUnits
|
|
7322
|
+
};
|
|
7323
|
+
return map[variant]();
|
|
7324
|
+
};
|
|
7325
|
+
var getSettingsUnits = (propType) => {
|
|
7326
|
+
return getPropTypeSettings(propType)?.units;
|
|
7327
|
+
};
|
|
7328
|
+
var getSizeUnits = (propType, variant) => {
|
|
7329
|
+
return getSettingsUnits(propType) ?? getVariantUnits(variant);
|
|
7330
|
+
};
|
|
7331
|
+
|
|
7332
|
+
// src/controls/size-control/utils/should-nullify-value.ts
|
|
7333
|
+
var conditions = [
|
|
7334
|
+
(value) => value?.size === null || value?.size === void 0 || value?.size === "",
|
|
7335
|
+
(value) => value?.unit !== EXTENDED_UNITS.auto,
|
|
7336
|
+
(value) => value?.unit !== EXTENDED_UNITS.custom
|
|
7337
|
+
];
|
|
7338
|
+
var shouldNullifyValue = (value) => {
|
|
7339
|
+
return conditions.every((condition) => condition(value));
|
|
7340
|
+
};
|
|
7341
|
+
|
|
7342
|
+
// src/controls/size-control/unstable-size-control.tsx
|
|
7343
|
+
var UnstableSizeControl = createControl(
|
|
7344
|
+
({ variant = "length", placeholder: propPlaceholder, anchorRef, startIcon, ariaLabel, min }) => {
|
|
7345
|
+
const {
|
|
7346
|
+
value,
|
|
7347
|
+
setValue,
|
|
7348
|
+
propType,
|
|
7349
|
+
placeholder: boundPropPlaceholder,
|
|
7350
|
+
restoreValue
|
|
7351
|
+
} = useBoundProp(import_editor_props56.sizePropTypeUtil);
|
|
7352
|
+
const { sizeValue, isUnitHighlighted, placeholder } = resolveBoundPropValue(
|
|
7353
|
+
value,
|
|
7354
|
+
boundPropPlaceholder,
|
|
7355
|
+
propPlaceholder
|
|
7356
|
+
);
|
|
7357
|
+
const units2 = getSizeUnits(propType, variant);
|
|
7358
|
+
const defaultUnit = getDefaultUnit(propType);
|
|
7359
|
+
const handleBlur = () => {
|
|
7360
|
+
const isRequired = propType.settings.required;
|
|
7361
|
+
if (shouldNullifyValue(value) && !isRequired) {
|
|
7362
|
+
setValue(null);
|
|
7363
|
+
}
|
|
7364
|
+
if (isRequired) {
|
|
7365
|
+
restoreValue();
|
|
7366
|
+
}
|
|
7367
|
+
};
|
|
7368
|
+
const handleChange = (newValue, options, meta) => {
|
|
7369
|
+
setValue(newValue, options, {
|
|
7370
|
+
...meta,
|
|
7371
|
+
validation: () => {
|
|
7372
|
+
if (propType.settings.required) {
|
|
7373
|
+
return newValue.size !== "";
|
|
7374
|
+
}
|
|
7375
|
+
return meta?.validation ? meta.validation(newValue) : true;
|
|
7376
|
+
}
|
|
7377
|
+
});
|
|
7378
|
+
};
|
|
7379
|
+
return /* @__PURE__ */ React108.createElement(
|
|
7380
|
+
SizeComponent,
|
|
7381
|
+
{
|
|
7382
|
+
units: units2,
|
|
7383
|
+
value: sizeValue,
|
|
7384
|
+
anchorRef,
|
|
7385
|
+
placeholder,
|
|
7386
|
+
defaultUnit,
|
|
7387
|
+
isUnitActive: isUnitHighlighted,
|
|
7388
|
+
onBlur: handleBlur,
|
|
7389
|
+
setValue: handleChange,
|
|
7390
|
+
SizeFieldWrapper: ControlActions,
|
|
7391
|
+
startIcon,
|
|
7392
|
+
ariaLabel,
|
|
7393
|
+
min
|
|
7394
|
+
}
|
|
7395
|
+
);
|
|
7396
|
+
}
|
|
7397
|
+
);
|
|
7398
|
+
|
|
7399
|
+
// src/components/promotions/display-conditions-control.tsx
|
|
7400
|
+
var React110 = __toESM(require("react"));
|
|
7401
|
+
var import_react60 = require("react");
|
|
7402
|
+
var import_icons36 = require("@elementor/icons");
|
|
7403
|
+
var import_ui94 = require("@elementor/ui");
|
|
7404
|
+
var import_i18n53 = require("@wordpress/i18n");
|
|
7405
|
+
|
|
7406
|
+
// src/components/promotions/promotion-trigger.tsx
|
|
7407
|
+
var React109 = __toESM(require("react"));
|
|
7408
|
+
var import_react59 = require("react");
|
|
7409
|
+
var import_editor_ui16 = require("@elementor/editor-ui");
|
|
7410
|
+
var import_ui93 = require("@elementor/ui");
|
|
6731
7411
|
function getV4Promotion(key) {
|
|
6732
7412
|
return window.elementor?.config?.v4Promotions?.[key];
|
|
6733
7413
|
}
|
|
6734
|
-
var PromotionTrigger = (0,
|
|
6735
|
-
({ promotionKey, children }, ref) => {
|
|
6736
|
-
const [isOpen, setIsOpen] = (0,
|
|
7414
|
+
var PromotionTrigger = (0, import_react59.forwardRef)(
|
|
7415
|
+
({ promotionKey, children, trackingData }, ref) => {
|
|
7416
|
+
const [isOpen, setIsOpen] = (0, import_react59.useState)(false);
|
|
6737
7417
|
const promotion = getV4Promotion(promotionKey);
|
|
6738
|
-
const toggle = ()
|
|
6739
|
-
|
|
6740
|
-
|
|
6741
|
-
|
|
7418
|
+
const toggle = (0, import_react59.useCallback)(() => {
|
|
7419
|
+
setIsOpen((prev) => {
|
|
7420
|
+
if (!prev) {
|
|
7421
|
+
trackViewPromotion(trackingData);
|
|
7422
|
+
}
|
|
7423
|
+
return !prev;
|
|
7424
|
+
});
|
|
7425
|
+
}, [trackingData]);
|
|
7426
|
+
(0, import_react59.useImperativeHandle)(ref, () => ({ toggle }), [toggle]);
|
|
7427
|
+
return /* @__PURE__ */ React109.createElement(React109.Fragment, null, promotion && /* @__PURE__ */ React109.createElement(
|
|
7428
|
+
import_editor_ui16.PromotionInfotip,
|
|
6742
7429
|
{
|
|
6743
7430
|
title: promotion.title,
|
|
6744
7431
|
content: promotion.content,
|
|
@@ -6748,10 +7435,11 @@ var PromotionTrigger = (0, import_react54.forwardRef)(
|
|
|
6748
7435
|
onClose: (e) => {
|
|
6749
7436
|
e.stopPropagation();
|
|
6750
7437
|
setIsOpen(false);
|
|
6751
|
-
}
|
|
7438
|
+
},
|
|
7439
|
+
onCtaClick: () => trackUpgradePromotionClick(trackingData)
|
|
6752
7440
|
},
|
|
6753
|
-
/* @__PURE__ */
|
|
6754
|
-
|
|
7441
|
+
/* @__PURE__ */ React109.createElement(
|
|
7442
|
+
import_ui93.Box,
|
|
6755
7443
|
{
|
|
6756
7444
|
onClick: (e) => {
|
|
6757
7445
|
e.stopPropagation();
|
|
@@ -6759,18 +7447,19 @@ var PromotionTrigger = (0, import_react54.forwardRef)(
|
|
|
6759
7447
|
},
|
|
6760
7448
|
sx: { cursor: "pointer", display: "inline-flex" }
|
|
6761
7449
|
},
|
|
6762
|
-
children ?? /* @__PURE__ */
|
|
7450
|
+
children ?? /* @__PURE__ */ React109.createElement(import_editor_ui16.PromotionChip, null)
|
|
6763
7451
|
)
|
|
6764
7452
|
));
|
|
6765
7453
|
}
|
|
6766
7454
|
);
|
|
6767
7455
|
|
|
6768
7456
|
// src/components/promotions/display-conditions-control.tsx
|
|
6769
|
-
var ARIA_LABEL = (0,
|
|
7457
|
+
var ARIA_LABEL = (0, import_i18n53.__)("Display Conditions", "elementor");
|
|
7458
|
+
var TRACKING_DATA = { target_name: "display_conditions", location_l2: "general" };
|
|
6770
7459
|
var DisplayConditionsControl = createControl(() => {
|
|
6771
|
-
const triggerRef = (0,
|
|
6772
|
-
return /* @__PURE__ */
|
|
6773
|
-
|
|
7460
|
+
const triggerRef = (0, import_react60.useRef)(null);
|
|
7461
|
+
return /* @__PURE__ */ React110.createElement(
|
|
7462
|
+
import_ui94.Stack,
|
|
6774
7463
|
{
|
|
6775
7464
|
direction: "row",
|
|
6776
7465
|
spacing: 2,
|
|
@@ -6779,9 +7468,9 @@ var DisplayConditionsControl = createControl(() => {
|
|
|
6779
7468
|
alignItems: "center"
|
|
6780
7469
|
}
|
|
6781
7470
|
},
|
|
6782
|
-
/* @__PURE__ */
|
|
6783
|
-
/* @__PURE__ */
|
|
6784
|
-
|
|
7471
|
+
/* @__PURE__ */ React110.createElement(PromotionTrigger, { ref: triggerRef, promotionKey: "displayConditions", trackingData: TRACKING_DATA }),
|
|
7472
|
+
/* @__PURE__ */ React110.createElement(import_ui94.Tooltip, { title: ARIA_LABEL, placement: "top" }, /* @__PURE__ */ React110.createElement(
|
|
7473
|
+
import_ui94.IconButton,
|
|
6785
7474
|
{
|
|
6786
7475
|
size: "tiny",
|
|
6787
7476
|
"aria-label": ARIA_LABEL,
|
|
@@ -6793,22 +7482,23 @@ var DisplayConditionsControl = createControl(() => {
|
|
|
6793
7482
|
borderRadius: 1
|
|
6794
7483
|
}
|
|
6795
7484
|
},
|
|
6796
|
-
/* @__PURE__ */
|
|
7485
|
+
/* @__PURE__ */ React110.createElement(import_icons36.SitemapIcon, { fontSize: "tiny", color: "disabled" })
|
|
6797
7486
|
))
|
|
6798
7487
|
);
|
|
6799
7488
|
});
|
|
6800
7489
|
|
|
6801
7490
|
// src/components/promotions/attributes-control.tsx
|
|
6802
|
-
var
|
|
6803
|
-
var
|
|
6804
|
-
var
|
|
6805
|
-
var
|
|
6806
|
-
var
|
|
6807
|
-
var ARIA_LABEL2 = (0,
|
|
7491
|
+
var React111 = __toESM(require("react"));
|
|
7492
|
+
var import_react61 = require("react");
|
|
7493
|
+
var import_icons37 = require("@elementor/icons");
|
|
7494
|
+
var import_ui95 = require("@elementor/ui");
|
|
7495
|
+
var import_i18n54 = require("@wordpress/i18n");
|
|
7496
|
+
var ARIA_LABEL2 = (0, import_i18n54.__)("Attributes", "elementor");
|
|
7497
|
+
var TRACKING_DATA2 = { target_name: "attributes", location_l2: "general" };
|
|
6808
7498
|
var AttributesControl = createControl(() => {
|
|
6809
|
-
const triggerRef = (0,
|
|
6810
|
-
return /* @__PURE__ */
|
|
6811
|
-
|
|
7499
|
+
const triggerRef = (0, import_react61.useRef)(null);
|
|
7500
|
+
return /* @__PURE__ */ React111.createElement(
|
|
7501
|
+
import_ui95.Stack,
|
|
6812
7502
|
{
|
|
6813
7503
|
direction: "row",
|
|
6814
7504
|
spacing: 2,
|
|
@@ -6817,9 +7507,9 @@ var AttributesControl = createControl(() => {
|
|
|
6817
7507
|
alignItems: "center"
|
|
6818
7508
|
}
|
|
6819
7509
|
},
|
|
6820
|
-
/* @__PURE__ */
|
|
6821
|
-
/* @__PURE__ */
|
|
6822
|
-
|
|
7510
|
+
/* @__PURE__ */ React111.createElement(PromotionTrigger, { ref: triggerRef, promotionKey: "attributes", trackingData: TRACKING_DATA2 }),
|
|
7511
|
+
/* @__PURE__ */ React111.createElement(import_ui95.Tooltip, { title: ARIA_LABEL2, placement: "top" }, /* @__PURE__ */ React111.createElement(
|
|
7512
|
+
import_icons37.PlusIcon,
|
|
6823
7513
|
{
|
|
6824
7514
|
"aria-label": ARIA_LABEL2,
|
|
6825
7515
|
fontSize: "tiny",
|
|
@@ -6832,22 +7522,22 @@ var AttributesControl = createControl(() => {
|
|
|
6832
7522
|
});
|
|
6833
7523
|
|
|
6834
7524
|
// src/components/icon-buttons/clear-icon-button.tsx
|
|
6835
|
-
var
|
|
6836
|
-
var
|
|
6837
|
-
var
|
|
6838
|
-
var CustomIconButton = (0,
|
|
7525
|
+
var React112 = __toESM(require("react"));
|
|
7526
|
+
var import_icons38 = require("@elementor/icons");
|
|
7527
|
+
var import_ui96 = require("@elementor/ui");
|
|
7528
|
+
var CustomIconButton = (0, import_ui96.styled)(import_ui96.IconButton)(({ theme }) => ({
|
|
6839
7529
|
width: theme.spacing(2.5),
|
|
6840
7530
|
height: theme.spacing(2.5)
|
|
6841
7531
|
}));
|
|
6842
|
-
var ClearIconButton = ({ tooltipText, onClick, disabled, size = "tiny" }) => /* @__PURE__ */
|
|
7532
|
+
var ClearIconButton = ({ tooltipText, onClick, disabled, size = "tiny" }) => /* @__PURE__ */ React112.createElement(import_ui96.Tooltip, { title: tooltipText, placement: "top", disableInteractive: true }, /* @__PURE__ */ React112.createElement(CustomIconButton, { "aria-label": tooltipText, size, onClick, disabled }, /* @__PURE__ */ React112.createElement(import_icons38.BrushBigIcon, { fontSize: size })));
|
|
6843
7533
|
|
|
6844
7534
|
// src/components/repeater/repeater.tsx
|
|
6845
|
-
var
|
|
6846
|
-
var
|
|
6847
|
-
var
|
|
6848
|
-
var
|
|
6849
|
-
var
|
|
6850
|
-
var
|
|
7535
|
+
var React113 = __toESM(require("react"));
|
|
7536
|
+
var import_react62 = require("react");
|
|
7537
|
+
var import_icons39 = require("@elementor/icons");
|
|
7538
|
+
var import_ui97 = require("@elementor/ui");
|
|
7539
|
+
var import_i18n55 = require("@wordpress/i18n");
|
|
7540
|
+
var SIZE11 = "tiny";
|
|
6851
7541
|
var EMPTY_OPEN_ITEM2 = -1;
|
|
6852
7542
|
var Repeater3 = ({
|
|
6853
7543
|
label,
|
|
@@ -6864,7 +7554,7 @@ var Repeater3 = ({
|
|
|
6864
7554
|
openItem: initialOpenItem = EMPTY_OPEN_ITEM2,
|
|
6865
7555
|
isSortable = true
|
|
6866
7556
|
}) => {
|
|
6867
|
-
const [openItem, setOpenItem] = (0,
|
|
7557
|
+
const [openItem, setOpenItem] = (0, import_react62.useState)(initialOpenItem);
|
|
6868
7558
|
const uniqueKeys = items2.map(
|
|
6869
7559
|
(item, index) => isSortable && "getId" in itemSettings ? itemSettings.getId({ item, index }) : String(index)
|
|
6870
7560
|
);
|
|
@@ -6927,41 +7617,41 @@ var Repeater3 = ({
|
|
|
6927
7617
|
};
|
|
6928
7618
|
const isButtonDisabled = disabled || disableAddItemButton;
|
|
6929
7619
|
const shouldShowInfotip = isButtonDisabled && addButtonInfotipContent;
|
|
6930
|
-
const addButton = /* @__PURE__ */
|
|
6931
|
-
|
|
7620
|
+
const addButton = /* @__PURE__ */ React113.createElement(
|
|
7621
|
+
import_ui97.IconButton,
|
|
6932
7622
|
{
|
|
6933
|
-
size:
|
|
7623
|
+
size: SIZE11,
|
|
6934
7624
|
sx: {
|
|
6935
7625
|
ml: "auto"
|
|
6936
7626
|
},
|
|
6937
7627
|
disabled: isButtonDisabled,
|
|
6938
7628
|
onClick: addRepeaterItem,
|
|
6939
|
-
"aria-label": (0,
|
|
7629
|
+
"aria-label": (0, import_i18n55.__)("Add item", "elementor")
|
|
6940
7630
|
},
|
|
6941
|
-
/* @__PURE__ */
|
|
7631
|
+
/* @__PURE__ */ React113.createElement(import_icons39.PlusIcon, { fontSize: SIZE11 })
|
|
6942
7632
|
);
|
|
6943
|
-
return /* @__PURE__ */
|
|
6944
|
-
|
|
7633
|
+
return /* @__PURE__ */ React113.createElement(SectionContent, { gap: 2 }, /* @__PURE__ */ React113.createElement(RepeaterHeader, { label, adornment: ControlAdornments }, shouldShowInfotip ? /* @__PURE__ */ React113.createElement(
|
|
7634
|
+
import_ui97.Infotip,
|
|
6945
7635
|
{
|
|
6946
7636
|
placement: "right",
|
|
6947
7637
|
content: addButtonInfotipContent,
|
|
6948
7638
|
color: "secondary",
|
|
6949
7639
|
slotProps: { popper: { sx: { width: 300 } } }
|
|
6950
7640
|
},
|
|
6951
|
-
/* @__PURE__ */
|
|
6952
|
-
) : addButton), 0 < uniqueKeys.length && /* @__PURE__ */
|
|
7641
|
+
/* @__PURE__ */ React113.createElement(import_ui97.Box, { sx: { ...isButtonDisabled ? { cursor: "not-allowed" } : {} } }, addButton)
|
|
7642
|
+
) : addButton), 0 < uniqueKeys.length && /* @__PURE__ */ React113.createElement(SortableProvider, { value: uniqueKeys, onChange: onChangeOrder }, uniqueKeys.map((key) => {
|
|
6953
7643
|
const index = uniqueKeys.indexOf(key);
|
|
6954
7644
|
const value = items2[index];
|
|
6955
7645
|
if (!value) {
|
|
6956
7646
|
return null;
|
|
6957
7647
|
}
|
|
6958
|
-
return /* @__PURE__ */
|
|
7648
|
+
return /* @__PURE__ */ React113.createElement(SortableItem, { id: key, key: `sortable-${key}`, disabled: !isSortable }, /* @__PURE__ */ React113.createElement(
|
|
6959
7649
|
RepeaterItem,
|
|
6960
7650
|
{
|
|
6961
7651
|
disabled,
|
|
6962
7652
|
propDisabled: value?.disabled,
|
|
6963
|
-
label: /* @__PURE__ */
|
|
6964
|
-
startIcon: /* @__PURE__ */
|
|
7653
|
+
label: /* @__PURE__ */ React113.createElement(RepeaterItemLabelSlot, { value }, /* @__PURE__ */ React113.createElement(itemSettings.Label, { value, index })),
|
|
7654
|
+
startIcon: /* @__PURE__ */ React113.createElement(RepeaterItemIconSlot, { value }, /* @__PURE__ */ React113.createElement(itemSettings.Icon, { value })),
|
|
6965
7655
|
removeItem: () => removeRepeaterItem(index),
|
|
6966
7656
|
duplicateItem: () => duplicateRepeaterItem(index),
|
|
6967
7657
|
toggleDisableItem: () => toggleDisableRepeaterItem(index),
|
|
@@ -6973,7 +7663,7 @@ var Repeater3 = ({
|
|
|
6973
7663
|
actions: itemSettings.actions,
|
|
6974
7664
|
value
|
|
6975
7665
|
},
|
|
6976
|
-
(props) => /* @__PURE__ */
|
|
7666
|
+
(props) => /* @__PURE__ */ React113.createElement(
|
|
6977
7667
|
itemSettings.Content,
|
|
6978
7668
|
{
|
|
6979
7669
|
...props,
|
|
@@ -7003,27 +7693,27 @@ var RepeaterItem = ({
|
|
|
7003
7693
|
value
|
|
7004
7694
|
}) => {
|
|
7005
7695
|
const { popoverState, popoverProps, ref, setRef } = usePopover(openOnMount, onOpen);
|
|
7006
|
-
const duplicateLabel = (0,
|
|
7007
|
-
const toggleLabel = propDisabled ? (0,
|
|
7008
|
-
const removeLabel = (0,
|
|
7009
|
-
return /* @__PURE__ */
|
|
7696
|
+
const duplicateLabel = (0, import_i18n55.__)("Duplicate", "elementor");
|
|
7697
|
+
const toggleLabel = propDisabled ? (0, import_i18n55.__)("Show", "elementor") : (0, import_i18n55.__)("Hide", "elementor");
|
|
7698
|
+
const removeLabel = (0, import_i18n55.__)("Remove", "elementor");
|
|
7699
|
+
return /* @__PURE__ */ React113.createElement(React113.Fragment, null, /* @__PURE__ */ React113.createElement(
|
|
7010
7700
|
RepeaterTag,
|
|
7011
7701
|
{
|
|
7012
7702
|
disabled,
|
|
7013
7703
|
label,
|
|
7014
7704
|
ref: setRef,
|
|
7015
|
-
"aria-label": (0,
|
|
7016
|
-
...(0,
|
|
7705
|
+
"aria-label": (0, import_i18n55.__)("Open item", "elementor"),
|
|
7706
|
+
...(0, import_ui97.bindTrigger)(popoverState),
|
|
7017
7707
|
startIcon,
|
|
7018
|
-
actions: /* @__PURE__ */
|
|
7708
|
+
actions: /* @__PURE__ */ React113.createElement(React113.Fragment, null, showDuplicate && /* @__PURE__ */ React113.createElement(import_ui97.Tooltip, { title: duplicateLabel, placement: "top" }, /* @__PURE__ */ React113.createElement(import_ui97.IconButton, { size: SIZE11, onClick: duplicateItem, "aria-label": duplicateLabel }, /* @__PURE__ */ React113.createElement(import_icons39.CopyIcon, { fontSize: SIZE11 }))), showToggle && /* @__PURE__ */ React113.createElement(import_ui97.Tooltip, { title: toggleLabel, placement: "top" }, /* @__PURE__ */ React113.createElement(import_ui97.IconButton, { size: SIZE11, onClick: toggleDisableItem, "aria-label": toggleLabel }, propDisabled ? /* @__PURE__ */ React113.createElement(import_icons39.EyeOffIcon, { fontSize: SIZE11 }) : /* @__PURE__ */ React113.createElement(import_icons39.EyeIcon, { fontSize: SIZE11 }))), actions?.(value), showRemove && /* @__PURE__ */ React113.createElement(import_ui97.Tooltip, { title: removeLabel, placement: "top" }, /* @__PURE__ */ React113.createElement(import_ui97.IconButton, { size: SIZE11, onClick: removeItem, "aria-label": removeLabel }, /* @__PURE__ */ React113.createElement(import_icons39.XIcon, { fontSize: SIZE11 }))))
|
|
7019
7709
|
}
|
|
7020
|
-
), /* @__PURE__ */
|
|
7710
|
+
), /* @__PURE__ */ React113.createElement(RepeaterPopover, { width: ref?.getBoundingClientRect().width, ...popoverProps, anchorEl: ref }, /* @__PURE__ */ React113.createElement(import_ui97.Box, null, children({ anchorEl: ref }))));
|
|
7021
7711
|
};
|
|
7022
7712
|
var usePopover = (openOnMount, onOpen) => {
|
|
7023
|
-
const [ref, setRef] = (0,
|
|
7024
|
-
const popoverState = (0,
|
|
7025
|
-
const popoverProps = (0,
|
|
7026
|
-
(0,
|
|
7713
|
+
const [ref, setRef] = (0, import_react62.useState)(null);
|
|
7714
|
+
const popoverState = (0, import_ui97.usePopupState)({ variant: "popover" });
|
|
7715
|
+
const popoverProps = (0, import_ui97.bindPopover)(popoverState);
|
|
7716
|
+
(0, import_react62.useEffect)(() => {
|
|
7027
7717
|
if (openOnMount && ref) {
|
|
7028
7718
|
popoverState.open(ref);
|
|
7029
7719
|
onOpen?.();
|
|
@@ -7038,20 +7728,20 @@ var usePopover = (openOnMount, onOpen) => {
|
|
|
7038
7728
|
};
|
|
7039
7729
|
|
|
7040
7730
|
// src/components/inline-editor-toolbar.tsx
|
|
7041
|
-
var
|
|
7042
|
-
var
|
|
7043
|
-
var
|
|
7044
|
-
var
|
|
7045
|
-
var
|
|
7046
|
-
var
|
|
7047
|
-
var
|
|
7731
|
+
var React115 = __toESM(require("react"));
|
|
7732
|
+
var import_react64 = require("react");
|
|
7733
|
+
var import_editor_elements6 = require("@elementor/editor-elements");
|
|
7734
|
+
var import_icons41 = require("@elementor/icons");
|
|
7735
|
+
var import_ui99 = require("@elementor/ui");
|
|
7736
|
+
var import_react65 = require("@tiptap/react");
|
|
7737
|
+
var import_i18n57 = require("@wordpress/i18n");
|
|
7048
7738
|
|
|
7049
7739
|
// src/components/url-popover.tsx
|
|
7050
|
-
var
|
|
7051
|
-
var
|
|
7052
|
-
var
|
|
7053
|
-
var
|
|
7054
|
-
var
|
|
7740
|
+
var React114 = __toESM(require("react"));
|
|
7741
|
+
var import_react63 = require("react");
|
|
7742
|
+
var import_icons40 = require("@elementor/icons");
|
|
7743
|
+
var import_ui98 = require("@elementor/ui");
|
|
7744
|
+
var import_i18n56 = require("@wordpress/i18n");
|
|
7055
7745
|
var UrlPopover = ({
|
|
7056
7746
|
popupState,
|
|
7057
7747
|
restoreValue,
|
|
@@ -7061,8 +7751,8 @@ var UrlPopover = ({
|
|
|
7061
7751
|
openInNewTab,
|
|
7062
7752
|
onToggleNewTab
|
|
7063
7753
|
}) => {
|
|
7064
|
-
const inputRef = (0,
|
|
7065
|
-
(0,
|
|
7754
|
+
const inputRef = (0, import_react63.useRef)(null);
|
|
7755
|
+
(0, import_react63.useEffect)(() => {
|
|
7066
7756
|
if (popupState.isOpen) {
|
|
7067
7757
|
requestAnimationFrame(() => inputRef.current?.focus());
|
|
7068
7758
|
}
|
|
@@ -7071,57 +7761,57 @@ var UrlPopover = ({
|
|
|
7071
7761
|
restoreValue();
|
|
7072
7762
|
popupState.close();
|
|
7073
7763
|
};
|
|
7074
|
-
return /* @__PURE__ */
|
|
7075
|
-
|
|
7764
|
+
return /* @__PURE__ */ React114.createElement(
|
|
7765
|
+
import_ui98.Popover,
|
|
7076
7766
|
{
|
|
7077
7767
|
slotProps: {
|
|
7078
7768
|
paper: { sx: { borderRadius: "16px", width: anchorRef.current?.offsetWidth + "px", marginTop: -1 } }
|
|
7079
7769
|
},
|
|
7080
|
-
...(0,
|
|
7770
|
+
...(0, import_ui98.bindPopover)(popupState),
|
|
7081
7771
|
anchorOrigin: { vertical: "top", horizontal: "left" },
|
|
7082
7772
|
transformOrigin: { vertical: "top", horizontal: "left" },
|
|
7083
7773
|
onClose: handleClose
|
|
7084
7774
|
},
|
|
7085
|
-
/* @__PURE__ */
|
|
7086
|
-
|
|
7775
|
+
/* @__PURE__ */ React114.createElement(import_ui98.Stack, { direction: "row", alignItems: "center", gap: 1, sx: { p: 1.5 } }, /* @__PURE__ */ React114.createElement(
|
|
7776
|
+
import_ui98.TextField,
|
|
7087
7777
|
{
|
|
7088
7778
|
value,
|
|
7089
7779
|
onChange,
|
|
7090
7780
|
size: "tiny",
|
|
7091
7781
|
fullWidth: true,
|
|
7092
|
-
placeholder: (0,
|
|
7782
|
+
placeholder: (0, import_i18n56.__)("Type a URL", "elementor"),
|
|
7093
7783
|
inputProps: { ref: inputRef },
|
|
7094
7784
|
color: "secondary",
|
|
7095
7785
|
InputProps: { sx: { borderRadius: "8px" } },
|
|
7096
7786
|
onKeyUp: (event) => event.key === "Enter" && handleClose()
|
|
7097
7787
|
}
|
|
7098
|
-
), /* @__PURE__ */
|
|
7099
|
-
|
|
7788
|
+
), /* @__PURE__ */ React114.createElement(import_ui98.Tooltip, { title: (0, import_i18n56.__)("Open in a new tab", "elementor") }, /* @__PURE__ */ React114.createElement(
|
|
7789
|
+
import_ui98.ToggleButton,
|
|
7100
7790
|
{
|
|
7101
7791
|
size: "tiny",
|
|
7102
7792
|
value: "newTab",
|
|
7103
7793
|
selected: openInNewTab,
|
|
7104
7794
|
onClick: onToggleNewTab,
|
|
7105
|
-
"aria-label": (0,
|
|
7795
|
+
"aria-label": (0, import_i18n56.__)("Open in a new tab", "elementor"),
|
|
7106
7796
|
sx: { borderRadius: "8px" }
|
|
7107
7797
|
},
|
|
7108
|
-
/* @__PURE__ */
|
|
7798
|
+
/* @__PURE__ */ React114.createElement(import_icons40.ExternalLinkIcon, { fontSize: "tiny" })
|
|
7109
7799
|
)))
|
|
7110
7800
|
);
|
|
7111
7801
|
};
|
|
7112
7802
|
|
|
7113
7803
|
// src/components/inline-editor-toolbar.tsx
|
|
7114
7804
|
var InlineEditorToolbar = ({ editor, elementId, sx = {} }) => {
|
|
7115
|
-
const [urlValue, setUrlValue] = (0,
|
|
7116
|
-
const [openInNewTab, setOpenInNewTab] = (0,
|
|
7117
|
-
const toolbarRef = (0,
|
|
7118
|
-
const linkPopupState = (0,
|
|
7805
|
+
const [urlValue, setUrlValue] = (0, import_react64.useState)("");
|
|
7806
|
+
const [openInNewTab, setOpenInNewTab] = (0, import_react64.useState)(false);
|
|
7807
|
+
const toolbarRef = (0, import_react64.useRef)(null);
|
|
7808
|
+
const linkPopupState = (0, import_ui99.usePopupState)({ variant: "popover" });
|
|
7119
7809
|
const isElementClickable = elementId ? checkIfElementIsClickable(elementId) : false;
|
|
7120
|
-
const editorState = (0,
|
|
7810
|
+
const editorState = (0, import_react65.useEditorState)({
|
|
7121
7811
|
editor,
|
|
7122
7812
|
selector: (ctx) => possibleFormats.filter((format) => ctx.editor.isActive(format))
|
|
7123
7813
|
});
|
|
7124
|
-
const formatButtonsList = (0,
|
|
7814
|
+
const formatButtonsList = (0, import_react64.useMemo)(() => {
|
|
7125
7815
|
const buttons = Object.values(formatButtons);
|
|
7126
7816
|
if (isElementClickable) {
|
|
7127
7817
|
return buttons.filter((button) => button.action !== "link");
|
|
@@ -7158,11 +7848,11 @@ var InlineEditorToolbar = ({ editor, elementId, sx = {} }) => {
|
|
|
7158
7848
|
}
|
|
7159
7849
|
linkPopupState.close();
|
|
7160
7850
|
};
|
|
7161
|
-
|
|
7851
|
+
React115.useEffect(() => {
|
|
7162
7852
|
editor?.commands?.focus();
|
|
7163
7853
|
}, [editor]);
|
|
7164
|
-
return /* @__PURE__ */
|
|
7165
|
-
|
|
7854
|
+
return /* @__PURE__ */ React115.createElement(
|
|
7855
|
+
import_ui99.Box,
|
|
7166
7856
|
{
|
|
7167
7857
|
ref: toolbarRef,
|
|
7168
7858
|
sx: {
|
|
@@ -7178,9 +7868,9 @@ var InlineEditorToolbar = ({ editor, elementId, sx = {} }) => {
|
|
|
7178
7868
|
...sx
|
|
7179
7869
|
}
|
|
7180
7870
|
},
|
|
7181
|
-
/* @__PURE__ */
|
|
7182
|
-
/* @__PURE__ */
|
|
7183
|
-
|
|
7871
|
+
/* @__PURE__ */ React115.createElement(import_ui99.Tooltip, { title: clearButton.label, placement: "top", sx: { borderRadius: "8px" } }, /* @__PURE__ */ React115.createElement(import_ui99.IconButton, { "aria-label": clearButton.label, onClick: () => clearButton.method(editor), size: "tiny" }, clearButton.icon)),
|
|
7872
|
+
/* @__PURE__ */ React115.createElement(
|
|
7873
|
+
import_ui99.ToggleButtonGroup,
|
|
7184
7874
|
{
|
|
7185
7875
|
value: editorState,
|
|
7186
7876
|
size: "tiny",
|
|
@@ -7188,7 +7878,7 @@ var InlineEditorToolbar = ({ editor, elementId, sx = {} }) => {
|
|
|
7188
7878
|
display: "flex",
|
|
7189
7879
|
gap: 0.5,
|
|
7190
7880
|
border: "none",
|
|
7191
|
-
[`& .${
|
|
7881
|
+
[`& .${import_ui99.toggleButtonGroupClasses.firstButton}, & .${import_ui99.toggleButtonGroupClasses.middleButton}, & .${import_ui99.toggleButtonGroupClasses.lastButton}`]: {
|
|
7192
7882
|
borderRadius: "8px",
|
|
7193
7883
|
border: "none",
|
|
7194
7884
|
marginLeft: 0,
|
|
@@ -7201,8 +7891,8 @@ var InlineEditorToolbar = ({ editor, elementId, sx = {} }) => {
|
|
|
7201
7891
|
}
|
|
7202
7892
|
}
|
|
7203
7893
|
},
|
|
7204
|
-
formatButtonsList.map((button) => /* @__PURE__ */
|
|
7205
|
-
|
|
7894
|
+
formatButtonsList.map((button) => /* @__PURE__ */ React115.createElement(import_ui99.Tooltip, { title: button.label, key: button.action, placement: "top" }, /* @__PURE__ */ React115.createElement(
|
|
7895
|
+
import_ui99.ToggleButton,
|
|
7206
7896
|
{
|
|
7207
7897
|
value: button.action,
|
|
7208
7898
|
"aria-label": button.label,
|
|
@@ -7219,7 +7909,7 @@ var InlineEditorToolbar = ({ editor, elementId, sx = {} }) => {
|
|
|
7219
7909
|
button.icon
|
|
7220
7910
|
)))
|
|
7221
7911
|
),
|
|
7222
|
-
/* @__PURE__ */
|
|
7912
|
+
/* @__PURE__ */ React115.createElement(
|
|
7223
7913
|
UrlPopover,
|
|
7224
7914
|
{
|
|
7225
7915
|
popupState: linkPopupState,
|
|
@@ -7234,72 +7924,72 @@ var InlineEditorToolbar = ({ editor, elementId, sx = {} }) => {
|
|
|
7234
7924
|
);
|
|
7235
7925
|
};
|
|
7236
7926
|
var checkIfElementIsClickable = (elementId) => {
|
|
7237
|
-
const container = (0,
|
|
7927
|
+
const container = (0, import_editor_elements6.getContainer)(elementId);
|
|
7238
7928
|
const type = container?.model.get("widgetType");
|
|
7239
7929
|
const isButton = type === "e-button";
|
|
7240
|
-
const hasLink = !!(0,
|
|
7930
|
+
const hasLink = !!(0, import_editor_elements6.getElementSetting)(elementId, "link")?.value?.destination;
|
|
7241
7931
|
return isButton || hasLink;
|
|
7242
7932
|
};
|
|
7243
7933
|
var toolbarButtons = {
|
|
7244
7934
|
clear: {
|
|
7245
|
-
label: (0,
|
|
7246
|
-
icon: /* @__PURE__ */
|
|
7935
|
+
label: (0, import_i18n57.__)("Clear", "elementor"),
|
|
7936
|
+
icon: /* @__PURE__ */ React115.createElement(import_icons41.MinusIcon, { fontSize: "tiny" }),
|
|
7247
7937
|
action: "clear",
|
|
7248
7938
|
method: (editor) => {
|
|
7249
7939
|
editor.chain().focus().clearNodes().unsetAllMarks().run();
|
|
7250
7940
|
}
|
|
7251
7941
|
},
|
|
7252
7942
|
bold: {
|
|
7253
|
-
label: (0,
|
|
7254
|
-
icon: /* @__PURE__ */
|
|
7943
|
+
label: (0, import_i18n57.__)("Bold", "elementor"),
|
|
7944
|
+
icon: /* @__PURE__ */ React115.createElement(import_icons41.BoldIcon, { fontSize: "tiny" }),
|
|
7255
7945
|
action: "bold",
|
|
7256
7946
|
method: (editor) => {
|
|
7257
7947
|
editor.chain().focus().toggleBold().run();
|
|
7258
7948
|
}
|
|
7259
7949
|
},
|
|
7260
7950
|
italic: {
|
|
7261
|
-
label: (0,
|
|
7262
|
-
icon: /* @__PURE__ */
|
|
7951
|
+
label: (0, import_i18n57.__)("Italic", "elementor"),
|
|
7952
|
+
icon: /* @__PURE__ */ React115.createElement(import_icons41.ItalicIcon, { fontSize: "tiny" }),
|
|
7263
7953
|
action: "italic",
|
|
7264
7954
|
method: (editor) => {
|
|
7265
7955
|
editor.chain().focus().toggleItalic().run();
|
|
7266
7956
|
}
|
|
7267
7957
|
},
|
|
7268
7958
|
underline: {
|
|
7269
|
-
label: (0,
|
|
7270
|
-
icon: /* @__PURE__ */
|
|
7959
|
+
label: (0, import_i18n57.__)("Underline", "elementor"),
|
|
7960
|
+
icon: /* @__PURE__ */ React115.createElement(import_icons41.UnderlineIcon, { fontSize: "tiny" }),
|
|
7271
7961
|
action: "underline",
|
|
7272
7962
|
method: (editor) => {
|
|
7273
7963
|
editor.chain().focus().toggleUnderline().run();
|
|
7274
7964
|
}
|
|
7275
7965
|
},
|
|
7276
7966
|
strike: {
|
|
7277
|
-
label: (0,
|
|
7278
|
-
icon: /* @__PURE__ */
|
|
7967
|
+
label: (0, import_i18n57.__)("Strikethrough", "elementor"),
|
|
7968
|
+
icon: /* @__PURE__ */ React115.createElement(import_icons41.StrikethroughIcon, { fontSize: "tiny" }),
|
|
7279
7969
|
action: "strike",
|
|
7280
7970
|
method: (editor) => {
|
|
7281
7971
|
editor.chain().focus().toggleStrike().run();
|
|
7282
7972
|
}
|
|
7283
7973
|
},
|
|
7284
7974
|
superscript: {
|
|
7285
|
-
label: (0,
|
|
7286
|
-
icon: /* @__PURE__ */
|
|
7975
|
+
label: (0, import_i18n57.__)("Superscript", "elementor"),
|
|
7976
|
+
icon: /* @__PURE__ */ React115.createElement(import_icons41.SuperscriptIcon, { fontSize: "tiny" }),
|
|
7287
7977
|
action: "superscript",
|
|
7288
7978
|
method: (editor) => {
|
|
7289
7979
|
editor.chain().focus().toggleSuperscript().run();
|
|
7290
7980
|
}
|
|
7291
7981
|
},
|
|
7292
7982
|
subscript: {
|
|
7293
|
-
label: (0,
|
|
7294
|
-
icon: /* @__PURE__ */
|
|
7983
|
+
label: (0, import_i18n57.__)("Subscript", "elementor"),
|
|
7984
|
+
icon: /* @__PURE__ */ React115.createElement(import_icons41.SubscriptIcon, { fontSize: "tiny" }),
|
|
7295
7985
|
action: "subscript",
|
|
7296
7986
|
method: (editor) => {
|
|
7297
7987
|
editor.chain().focus().toggleSubscript().run();
|
|
7298
7988
|
}
|
|
7299
7989
|
},
|
|
7300
7990
|
link: {
|
|
7301
|
-
label: (0,
|
|
7302
|
-
icon: /* @__PURE__ */
|
|
7991
|
+
label: (0, import_i18n57.__)("Link", "elementor"),
|
|
7992
|
+
icon: /* @__PURE__ */ React115.createElement(import_icons41.LinkIcon, { fontSize: "tiny" }),
|
|
7303
7993
|
action: "link",
|
|
7304
7994
|
method: null
|
|
7305
7995
|
}
|
|
@@ -7308,13 +7998,13 @@ var { clear: clearButton, ...formatButtons } = toolbarButtons;
|
|
|
7308
7998
|
var possibleFormats = Object.keys(formatButtons);
|
|
7309
7999
|
|
|
7310
8000
|
// src/components/size/unstable-size-field.tsx
|
|
7311
|
-
var
|
|
7312
|
-
var
|
|
8001
|
+
var React118 = __toESM(require("react"));
|
|
8002
|
+
var import_ui101 = require("@elementor/ui");
|
|
7313
8003
|
|
|
7314
8004
|
// src/hooks/use-size-value.ts
|
|
7315
8005
|
var DEFAULT_UNIT2 = "px";
|
|
7316
|
-
var
|
|
7317
|
-
var
|
|
8006
|
+
var DEFAULT_SIZE3 = "";
|
|
8007
|
+
var useSizeValue2 = (externalValue, onChange, defaultUnit) => {
|
|
7318
8008
|
const [sizeValue, setSizeValue] = useSyncExternalState({
|
|
7319
8009
|
external: externalValue,
|
|
7320
8010
|
setExternal: (newState) => {
|
|
@@ -7323,7 +8013,7 @@ var useSizeValue = (externalValue, onChange, defaultUnit) => {
|
|
|
7323
8013
|
}
|
|
7324
8014
|
},
|
|
7325
8015
|
persistWhen: (newState) => differsFromExternal(newState, externalValue),
|
|
7326
|
-
fallback: () => ({ size:
|
|
8016
|
+
fallback: () => ({ size: DEFAULT_SIZE3, unit: defaultUnit ?? DEFAULT_UNIT2 })
|
|
7327
8017
|
});
|
|
7328
8018
|
const setSize = (value) => {
|
|
7329
8019
|
const newState = {
|
|
@@ -7351,44 +8041,44 @@ var differsFromExternal = (newState, externalState) => {
|
|
|
7351
8041
|
};
|
|
7352
8042
|
|
|
7353
8043
|
// src/components/size/unit-select.tsx
|
|
7354
|
-
var
|
|
7355
|
-
var
|
|
7356
|
-
var
|
|
7357
|
-
var
|
|
7358
|
-
var
|
|
8044
|
+
var React116 = __toESM(require("react"));
|
|
8045
|
+
var import_react66 = require("react");
|
|
8046
|
+
var import_editor_ui17 = require("@elementor/editor-ui");
|
|
8047
|
+
var import_ui100 = require("@elementor/ui");
|
|
8048
|
+
var menuItemContentStyles2 = {
|
|
7359
8049
|
display: "flex",
|
|
7360
8050
|
flexDirection: "column",
|
|
7361
8051
|
justifyContent: "center"
|
|
7362
8052
|
};
|
|
7363
8053
|
var UnitSelect = ({ value, showPrimaryColor, onClick, options }) => {
|
|
7364
|
-
const popupState = (0,
|
|
8054
|
+
const popupState = (0, import_ui100.usePopupState)({
|
|
7365
8055
|
variant: "popover",
|
|
7366
|
-
popupId: (0,
|
|
8056
|
+
popupId: (0, import_react66.useId)()
|
|
7367
8057
|
});
|
|
7368
8058
|
const handleMenuItemClick = (index) => {
|
|
7369
8059
|
onClick(options[index]);
|
|
7370
8060
|
popupState.close();
|
|
7371
8061
|
};
|
|
7372
|
-
return /* @__PURE__ */
|
|
7373
|
-
|
|
8062
|
+
return /* @__PURE__ */ React116.createElement(React116.Fragment, null, /* @__PURE__ */ React116.createElement(StyledButton3, { isPrimaryColor: showPrimaryColor, size: "small", ...(0, import_ui100.bindTrigger)(popupState) }, value), /* @__PURE__ */ React116.createElement(import_ui100.Menu, { MenuListProps: { dense: true }, ...(0, import_ui100.bindMenu)(popupState) }, options.map((option, index) => /* @__PURE__ */ React116.createElement(
|
|
8063
|
+
import_editor_ui17.MenuListItem,
|
|
7374
8064
|
{
|
|
7375
8065
|
key: option,
|
|
7376
8066
|
onClick: () => handleMenuItemClick(index),
|
|
7377
8067
|
primaryTypographyProps: {
|
|
7378
8068
|
variant: "caption",
|
|
7379
8069
|
sx: {
|
|
7380
|
-
...
|
|
8070
|
+
...menuItemContentStyles2,
|
|
7381
8071
|
lineHeight: "1"
|
|
7382
8072
|
}
|
|
7383
8073
|
},
|
|
7384
8074
|
menuItemTextProps: {
|
|
7385
|
-
sx:
|
|
8075
|
+
sx: menuItemContentStyles2
|
|
7386
8076
|
}
|
|
7387
8077
|
},
|
|
7388
8078
|
option.toUpperCase()
|
|
7389
8079
|
))));
|
|
7390
8080
|
};
|
|
7391
|
-
var
|
|
8081
|
+
var StyledButton3 = (0, import_ui100.styled)(import_ui100.Button, {
|
|
7392
8082
|
shouldForwardProp: (prop) => prop !== "isPrimaryColor"
|
|
7393
8083
|
})(({ isPrimaryColor, theme }) => ({
|
|
7394
8084
|
color: isPrimaryColor ? theme.palette.text.primary : theme.palette.text.tertiary,
|
|
@@ -7398,11 +8088,11 @@ var StyledButton2 = (0, import_ui96.styled)(import_ui96.Button, {
|
|
|
7398
8088
|
}));
|
|
7399
8089
|
|
|
7400
8090
|
// src/components/size/unstable-size-input.tsx
|
|
7401
|
-
var
|
|
7402
|
-
var
|
|
7403
|
-
var UnstableSizeInput = (0,
|
|
8091
|
+
var React117 = __toESM(require("react"));
|
|
8092
|
+
var import_react67 = require("react");
|
|
8093
|
+
var UnstableSizeInput = (0, import_react67.forwardRef)(
|
|
7404
8094
|
({ type, value, onChange, onKeyDown, onKeyUp, InputProps, onBlur, focused, disabled }, ref) => {
|
|
7405
|
-
return /* @__PURE__ */
|
|
8095
|
+
return /* @__PURE__ */ React117.createElement(
|
|
7406
8096
|
NumberInput,
|
|
7407
8097
|
{
|
|
7408
8098
|
ref,
|
|
@@ -7417,12 +8107,12 @@ var UnstableSizeInput = (0, import_react62.forwardRef)(
|
|
|
7417
8107
|
onInput: onChange,
|
|
7418
8108
|
onBlur,
|
|
7419
8109
|
InputProps,
|
|
7420
|
-
sx:
|
|
8110
|
+
sx: getCursorStyle2(InputProps?.readOnly ?? false)
|
|
7421
8111
|
}
|
|
7422
8112
|
);
|
|
7423
8113
|
}
|
|
7424
8114
|
);
|
|
7425
|
-
var
|
|
8115
|
+
var getCursorStyle2 = (readOnly) => ({
|
|
7426
8116
|
input: { cursor: readOnly ? "default !important" : void 0 }
|
|
7427
8117
|
});
|
|
7428
8118
|
|
|
@@ -7436,11 +8126,11 @@ var UnstableSizeField = ({
|
|
|
7436
8126
|
defaultUnit,
|
|
7437
8127
|
startIcon
|
|
7438
8128
|
}) => {
|
|
7439
|
-
const { size, unit, setSize, setUnit } =
|
|
7440
|
-
const
|
|
8129
|
+
const { size, unit, setSize, setUnit } = useSizeValue2(value, onChange, defaultUnit);
|
|
8130
|
+
const shouldHighlightUnit2 = () => {
|
|
7441
8131
|
return hasValue(size);
|
|
7442
8132
|
};
|
|
7443
|
-
return /* @__PURE__ */
|
|
8133
|
+
return /* @__PURE__ */ React118.createElement(
|
|
7444
8134
|
UnstableSizeInput,
|
|
7445
8135
|
{
|
|
7446
8136
|
type: "number",
|
|
@@ -7449,14 +8139,14 @@ var UnstableSizeField = ({
|
|
|
7449
8139
|
onChange: (event) => setSize(event.target.value),
|
|
7450
8140
|
InputProps: {
|
|
7451
8141
|
...InputProps,
|
|
7452
|
-
startAdornment: startIcon && /* @__PURE__ */
|
|
7453
|
-
endAdornment: /* @__PURE__ */
|
|
8142
|
+
startAdornment: startIcon && /* @__PURE__ */ React118.createElement(import_ui101.InputAdornment, { position: "start" }, startIcon),
|
|
8143
|
+
endAdornment: /* @__PURE__ */ React118.createElement(import_ui101.InputAdornment, { position: "end" }, /* @__PURE__ */ React118.createElement(
|
|
7454
8144
|
UnitSelect,
|
|
7455
8145
|
{
|
|
7456
8146
|
options: units2,
|
|
7457
8147
|
value: unit,
|
|
7458
8148
|
onClick: setUnit,
|
|
7459
|
-
showPrimaryColor:
|
|
8149
|
+
showPrimaryColor: shouldHighlightUnit2()
|
|
7460
8150
|
}
|
|
7461
8151
|
))
|
|
7462
8152
|
}
|
|
@@ -7468,41 +8158,35 @@ var hasValue = (value) => {
|
|
|
7468
8158
|
};
|
|
7469
8159
|
|
|
7470
8160
|
// src/hooks/use-font-families.ts
|
|
7471
|
-
var
|
|
8161
|
+
var import_react68 = require("react");
|
|
7472
8162
|
var import_editor_v1_adapters = require("@elementor/editor-v1-adapters");
|
|
7473
|
-
var
|
|
7474
|
-
var supportedCategories = {
|
|
7475
|
-
system: (0, import_i18n57.__)("System", "elementor"),
|
|
7476
|
-
custom: (0, import_i18n57.__)("Custom Fonts", "elementor"),
|
|
7477
|
-
googlefonts: (0, import_i18n57.__)("Google Fonts", "elementor")
|
|
7478
|
-
};
|
|
7479
|
-
var getFontFamilies = () => {
|
|
8163
|
+
var getFontControlConfig = () => {
|
|
7480
8164
|
const { controls } = (0, import_editor_v1_adapters.getElementorConfig)();
|
|
7481
|
-
|
|
7482
|
-
if (!options) {
|
|
7483
|
-
return null;
|
|
7484
|
-
}
|
|
7485
|
-
return options;
|
|
8165
|
+
return controls?.font ?? {};
|
|
7486
8166
|
};
|
|
7487
8167
|
var useFontFamilies = () => {
|
|
7488
|
-
const
|
|
7489
|
-
return (0,
|
|
7490
|
-
|
|
7491
|
-
|
|
7492
|
-
|
|
8168
|
+
const { groups, options } = getFontControlConfig();
|
|
8169
|
+
return (0, import_react68.useMemo)(() => {
|
|
8170
|
+
if (!groups || !options) {
|
|
8171
|
+
return [];
|
|
8172
|
+
}
|
|
8173
|
+
const groupKeys = Object.keys(groups);
|
|
8174
|
+
const groupIndexMap = new Map(groupKeys.map((key, index) => [key, index]));
|
|
8175
|
+
return Object.entries(options).reduce((acc, [font, category]) => {
|
|
8176
|
+
const groupIndex = groupIndexMap.get(category);
|
|
8177
|
+
if (groupIndex === void 0) {
|
|
7493
8178
|
return acc;
|
|
7494
8179
|
}
|
|
7495
|
-
|
|
7496
|
-
|
|
7497
|
-
|
|
7498
|
-
label: supportedCategories[category],
|
|
8180
|
+
if (!acc[groupIndex]) {
|
|
8181
|
+
acc[groupIndex] = {
|
|
8182
|
+
label: groups[category],
|
|
7499
8183
|
fonts: []
|
|
7500
8184
|
};
|
|
7501
8185
|
}
|
|
7502
|
-
acc[
|
|
8186
|
+
acc[groupIndex].fonts.push(font);
|
|
7503
8187
|
return acc;
|
|
7504
8188
|
}, []).filter(Boolean);
|
|
7505
|
-
}, [
|
|
8189
|
+
}, [groups, options]);
|
|
7506
8190
|
};
|
|
7507
8191
|
// Annotate the CommonJS export names for ESM import in node:
|
|
7508
8192
|
0 && (module.exports = {
|
|
@@ -7548,6 +8232,7 @@ var useFontFamilies = () => {
|
|
|
7548
8232
|
Repeater,
|
|
7549
8233
|
SelectControl,
|
|
7550
8234
|
SelectControlWrapper,
|
|
8235
|
+
SizeComponent,
|
|
7551
8236
|
SizeControl,
|
|
7552
8237
|
StrokeControl,
|
|
7553
8238
|
SvgMediaControl,
|
|
@@ -7559,6 +8244,7 @@ var useFontFamilies = () => {
|
|
|
7559
8244
|
TransformRepeaterControl,
|
|
7560
8245
|
TransformSettingsControl,
|
|
7561
8246
|
TransitionRepeaterControl,
|
|
8247
|
+
UnstableSizeControl,
|
|
7562
8248
|
UnstableSizeField,
|
|
7563
8249
|
UrlControl,
|
|
7564
8250
|
VideoMediaControl,
|
|
@@ -7571,6 +8257,8 @@ var useFontFamilies = () => {
|
|
|
7571
8257
|
injectIntoRepeaterItemLabel,
|
|
7572
8258
|
isUnitExtendedOption,
|
|
7573
8259
|
registerControlReplacement,
|
|
8260
|
+
trackUpgradePromotionClick,
|
|
8261
|
+
trackViewPromotion,
|
|
7574
8262
|
transitionProperties,
|
|
7575
8263
|
transitionsItemsList,
|
|
7576
8264
|
useBoundProp,
|