@elementor/editor-controls 4.0.0-683 → 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 -74
- package/dist/index.d.ts +137 -74
- package/dist/index.js +807 -172
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +781 -148
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -15
- package/src/controls/email-form-action-control.tsx +5 -5
- package/src/controls/size-control/hooks/use-size-unit-keyboard.tsx +12 -1
- package/src/controls/size-control/hooks/use-size-value.ts +12 -16
- package/src/controls/size-control/size-component.tsx +38 -17
- package/src/controls/size-control/size-field.tsx +37 -13
- package/src/controls/size-control/sync/get-units.ts +15 -1
- package/src/controls/size-control/types.ts +8 -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/resolve-bound-prop-value.ts +72 -0
- package/src/controls/size-control/utils/resolve-size-value.ts +4 -3
- 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/index.ts +2 -0
- package/src/controls/size-control/utils/is-numeric-value.ts +0 -11
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,
|
|
@@ -755,14 +757,14 @@ var TextFieldInnerSelection = (0, import_react9.forwardRef)(
|
|
|
755
757
|
id
|
|
756
758
|
}, ref) => {
|
|
757
759
|
const { placeholder: boundPropPlaceholder } = useBoundProp(import_editor_props6.sizePropTypeUtil);
|
|
758
|
-
const
|
|
760
|
+
const getCursorStyle3 = () => ({
|
|
759
761
|
input: { cursor: InputProps.readOnly ? "default !important" : void 0 }
|
|
760
762
|
});
|
|
761
763
|
return /* @__PURE__ */ React17.createElement(
|
|
762
764
|
NumberInput,
|
|
763
765
|
{
|
|
764
766
|
ref,
|
|
765
|
-
sx:
|
|
767
|
+
sx: getCursorStyle3(),
|
|
766
768
|
size: "tiny",
|
|
767
769
|
fullWidth: true,
|
|
768
770
|
type,
|
|
@@ -5761,6 +5763,7 @@ var import_react50 = require("react");
|
|
|
5761
5763
|
var import_editor_props50 = require("@elementor/editor-props");
|
|
5762
5764
|
var import_icons33 = require("@elementor/icons");
|
|
5763
5765
|
var import_ui84 = require("@elementor/ui");
|
|
5766
|
+
var import_utils7 = require("@elementor/utils");
|
|
5764
5767
|
var import_i18n50 = require("@wordpress/i18n");
|
|
5765
5768
|
|
|
5766
5769
|
// src/controls/selection-size-control.tsx
|
|
@@ -5814,9 +5817,9 @@ var MIN_PRO_VERSION = "3.35";
|
|
|
5814
5817
|
var getIsSiteRtl = () => {
|
|
5815
5818
|
return !!window.elementorFrontend?.config?.is_rtl;
|
|
5816
5819
|
};
|
|
5817
|
-
var
|
|
5820
|
+
var shouldShowAllTransitionProperties = () => {
|
|
5818
5821
|
if (!(0, import_utils6.hasProInstalled)()) {
|
|
5819
|
-
return
|
|
5822
|
+
return true;
|
|
5820
5823
|
}
|
|
5821
5824
|
const proVersion = window.elementorPro?.config?.version;
|
|
5822
5825
|
if (!proVersion) {
|
|
@@ -5953,7 +5956,7 @@ var createTransitionPropertiesList = () => {
|
|
|
5953
5956
|
]
|
|
5954
5957
|
}
|
|
5955
5958
|
];
|
|
5956
|
-
return
|
|
5959
|
+
return shouldShowAllTransitionProperties() ? baseProperties : [baseProperties[0]];
|
|
5957
5960
|
};
|
|
5958
5961
|
var transitionProperties = createTransitionPropertiesList();
|
|
5959
5962
|
var transitionsItemsList = transitionProperties.map((category) => ({
|
|
@@ -6302,6 +6305,7 @@ var TransitionRepeaterControl = createControl(
|
|
|
6302
6305
|
}) => {
|
|
6303
6306
|
const currentStyleIsNormal = currentStyleState === null;
|
|
6304
6307
|
const [recentlyUsedList, setRecentlyUsedList] = (0, import_react50.useState)([]);
|
|
6308
|
+
const proInstalled = (0, import_utils7.hasProInstalled)();
|
|
6305
6309
|
const { value, setValue } = useBoundProp(childArrayPropTypeUtil);
|
|
6306
6310
|
const { allDisabled: disabledItems, proDisabled: proDisabledItems } = (0, import_react50.useMemo)(
|
|
6307
6311
|
() => getDisabledItemLabels(value),
|
|
@@ -6310,10 +6314,14 @@ var TransitionRepeaterControl = createControl(
|
|
|
6310
6314
|
const allowedTransitionSet = (0, import_react50.useMemo)(() => {
|
|
6311
6315
|
const set = /* @__PURE__ */ new Set();
|
|
6312
6316
|
transitionProperties.forEach((category) => {
|
|
6313
|
-
category.properties.forEach((prop) =>
|
|
6317
|
+
category.properties.forEach((prop) => {
|
|
6318
|
+
if (!prop.isDisabled || proInstalled) {
|
|
6319
|
+
set.add(prop.value);
|
|
6320
|
+
}
|
|
6321
|
+
});
|
|
6314
6322
|
});
|
|
6315
6323
|
return set;
|
|
6316
|
-
}, []);
|
|
6324
|
+
}, [proInstalled]);
|
|
6317
6325
|
(0, import_react50.useEffect)(() => {
|
|
6318
6326
|
if (!value || value.length === 0) {
|
|
6319
6327
|
return;
|
|
@@ -6438,7 +6446,7 @@ var React101 = __toESM(require("react"));
|
|
|
6438
6446
|
var import_react53 = require("react");
|
|
6439
6447
|
var import_editor_props53 = require("@elementor/editor-props");
|
|
6440
6448
|
var import_ui87 = require("@elementor/ui");
|
|
6441
|
-
var
|
|
6449
|
+
var import_utils8 = require("@elementor/utils");
|
|
6442
6450
|
|
|
6443
6451
|
// src/components/inline-editor.tsx
|
|
6444
6452
|
var React100 = __toESM(require("react"));
|
|
@@ -6621,7 +6629,7 @@ var InlineEditingControl = createControl(
|
|
|
6621
6629
|
const { value, setValue } = useBoundProp(import_editor_props53.htmlV3PropTypeUtil);
|
|
6622
6630
|
const content = import_editor_props53.stringPropTypeUtil.extract(value?.content ?? null) ?? "";
|
|
6623
6631
|
const debouncedParse = (0, import_react53.useMemo)(
|
|
6624
|
-
() => (0,
|
|
6632
|
+
() => (0, import_utils8.debounce)((html) => {
|
|
6625
6633
|
const parsed = (0, import_editor_props53.parseHtmlChildren)(html);
|
|
6626
6634
|
setValue({
|
|
6627
6635
|
content: parsed.content ? import_editor_props53.stringPropTypeUtil.create(parsed.content) : null,
|
|
@@ -6696,7 +6704,7 @@ var SendToField = () => /* @__PURE__ */ React102.createElement(
|
|
|
6696
6704
|
EmailField,
|
|
6697
6705
|
{
|
|
6698
6706
|
bind: "to",
|
|
6699
|
-
label: (0, import_i18n51.__)("Send
|
|
6707
|
+
label: (0, import_i18n51.__)("Send to", "elementor"),
|
|
6700
6708
|
placeholder: (0, import_i18n51.__)("Where should we send new submissions?", "elementor")
|
|
6701
6709
|
}
|
|
6702
6710
|
);
|
|
@@ -6704,7 +6712,7 @@ var SubjectField = () => /* @__PURE__ */ React102.createElement(
|
|
|
6704
6712
|
EmailField,
|
|
6705
6713
|
{
|
|
6706
6714
|
bind: "subject",
|
|
6707
|
-
label: (0, import_i18n51.__)("Email
|
|
6715
|
+
label: (0, import_i18n51.__)("Email subject", "elementor"),
|
|
6708
6716
|
placeholder: (0, import_i18n51.__)("New form submission", "elementor")
|
|
6709
6717
|
}
|
|
6710
6718
|
);
|
|
@@ -6722,7 +6730,7 @@ var FromEmailField = () => /* @__PURE__ */ React102.createElement(
|
|
|
6722
6730
|
{
|
|
6723
6731
|
bind: "from",
|
|
6724
6732
|
label: (0, import_i18n51.__)("From email", "elementor"),
|
|
6725
|
-
placeholder: (0, import_i18n51.__)("What email
|
|
6733
|
+
placeholder: (0, import_i18n51.__)("What email should appear as the sender?", "elementor")
|
|
6726
6734
|
}
|
|
6727
6735
|
);
|
|
6728
6736
|
var FromNameField = () => /* @__PURE__ */ React102.createElement(
|
|
@@ -6736,7 +6744,7 @@ var FromNameField = () => /* @__PURE__ */ React102.createElement(
|
|
|
6736
6744
|
var ReplyToField = () => /* @__PURE__ */ React102.createElement(EmailField, { bind: "reply-to", label: (0, import_i18n51.__)("Reply-to", "elementor") });
|
|
6737
6745
|
var CcField = () => /* @__PURE__ */ React102.createElement(EmailField, { bind: "cc", label: (0, import_i18n51.__)("Cc", "elementor") });
|
|
6738
6746
|
var BccField = () => /* @__PURE__ */ React102.createElement(EmailField, { bind: "bcc", label: (0, import_i18n51.__)("Bcc", "elementor") });
|
|
6739
|
-
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(
|
|
6740
6748
|
ChipsControl,
|
|
6741
6749
|
{
|
|
6742
6750
|
options: [
|
|
@@ -6760,29 +6768,654 @@ var SendAsField = () => /* @__PURE__ */ React102.createElement(PropKeyProvider,
|
|
|
6760
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))));
|
|
6761
6769
|
var EmailFormActionControl = createControl(() => {
|
|
6762
6770
|
const { value, setValue, ...propContext } = useBoundProp(import_editor_props54.emailPropTypeUtil);
|
|
6763
|
-
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)));
|
|
6764
6772
|
});
|
|
6765
6773
|
|
|
6766
|
-
// src/
|
|
6767
|
-
var
|
|
6768
|
-
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"));
|
|
6769
6786
|
var import_icons34 = require("@elementor/icons");
|
|
6770
6787
|
var import_ui90 = require("@elementor/ui");
|
|
6771
|
-
var import_i18n52 = require("@wordpress/i18n");
|
|
6772
6788
|
|
|
6773
|
-
// src/
|
|
6774
|
-
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
|
|
6775
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");
|
|
6776
6998
|
var import_editor_ui14 = require("@elementor/editor-ui");
|
|
6777
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");
|
|
6778
7411
|
function getV4Promotion(key) {
|
|
6779
7412
|
return window.elementor?.config?.v4Promotions?.[key];
|
|
6780
7413
|
}
|
|
6781
|
-
var PromotionTrigger = (0,
|
|
7414
|
+
var PromotionTrigger = (0, import_react59.forwardRef)(
|
|
6782
7415
|
({ promotionKey, children, trackingData }, ref) => {
|
|
6783
|
-
const [isOpen, setIsOpen] = (0,
|
|
7416
|
+
const [isOpen, setIsOpen] = (0, import_react59.useState)(false);
|
|
6784
7417
|
const promotion = getV4Promotion(promotionKey);
|
|
6785
|
-
const toggle = (0,
|
|
7418
|
+
const toggle = (0, import_react59.useCallback)(() => {
|
|
6786
7419
|
setIsOpen((prev) => {
|
|
6787
7420
|
if (!prev) {
|
|
6788
7421
|
trackViewPromotion(trackingData);
|
|
@@ -6790,9 +7423,9 @@ var PromotionTrigger = (0, import_react54.forwardRef)(
|
|
|
6790
7423
|
return !prev;
|
|
6791
7424
|
});
|
|
6792
7425
|
}, [trackingData]);
|
|
6793
|
-
(0,
|
|
6794
|
-
return /* @__PURE__ */
|
|
6795
|
-
|
|
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,
|
|
6796
7429
|
{
|
|
6797
7430
|
title: promotion.title,
|
|
6798
7431
|
content: promotion.content,
|
|
@@ -6805,8 +7438,8 @@ var PromotionTrigger = (0, import_react54.forwardRef)(
|
|
|
6805
7438
|
},
|
|
6806
7439
|
onCtaClick: () => trackUpgradePromotionClick(trackingData)
|
|
6807
7440
|
},
|
|
6808
|
-
/* @__PURE__ */
|
|
6809
|
-
|
|
7441
|
+
/* @__PURE__ */ React109.createElement(
|
|
7442
|
+
import_ui93.Box,
|
|
6810
7443
|
{
|
|
6811
7444
|
onClick: (e) => {
|
|
6812
7445
|
e.stopPropagation();
|
|
@@ -6814,19 +7447,19 @@ var PromotionTrigger = (0, import_react54.forwardRef)(
|
|
|
6814
7447
|
},
|
|
6815
7448
|
sx: { cursor: "pointer", display: "inline-flex" }
|
|
6816
7449
|
},
|
|
6817
|
-
children ?? /* @__PURE__ */
|
|
7450
|
+
children ?? /* @__PURE__ */ React109.createElement(import_editor_ui16.PromotionChip, null)
|
|
6818
7451
|
)
|
|
6819
7452
|
));
|
|
6820
7453
|
}
|
|
6821
7454
|
);
|
|
6822
7455
|
|
|
6823
7456
|
// src/components/promotions/display-conditions-control.tsx
|
|
6824
|
-
var ARIA_LABEL = (0,
|
|
7457
|
+
var ARIA_LABEL = (0, import_i18n53.__)("Display Conditions", "elementor");
|
|
6825
7458
|
var TRACKING_DATA = { target_name: "display_conditions", location_l2: "general" };
|
|
6826
7459
|
var DisplayConditionsControl = createControl(() => {
|
|
6827
|
-
const triggerRef = (0,
|
|
6828
|
-
return /* @__PURE__ */
|
|
6829
|
-
|
|
7460
|
+
const triggerRef = (0, import_react60.useRef)(null);
|
|
7461
|
+
return /* @__PURE__ */ React110.createElement(
|
|
7462
|
+
import_ui94.Stack,
|
|
6830
7463
|
{
|
|
6831
7464
|
direction: "row",
|
|
6832
7465
|
spacing: 2,
|
|
@@ -6835,9 +7468,9 @@ var DisplayConditionsControl = createControl(() => {
|
|
|
6835
7468
|
alignItems: "center"
|
|
6836
7469
|
}
|
|
6837
7470
|
},
|
|
6838
|
-
/* @__PURE__ */
|
|
6839
|
-
/* @__PURE__ */
|
|
6840
|
-
|
|
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,
|
|
6841
7474
|
{
|
|
6842
7475
|
size: "tiny",
|
|
6843
7476
|
"aria-label": ARIA_LABEL,
|
|
@@ -6849,23 +7482,23 @@ var DisplayConditionsControl = createControl(() => {
|
|
|
6849
7482
|
borderRadius: 1
|
|
6850
7483
|
}
|
|
6851
7484
|
},
|
|
6852
|
-
/* @__PURE__ */
|
|
7485
|
+
/* @__PURE__ */ React110.createElement(import_icons36.SitemapIcon, { fontSize: "tiny", color: "disabled" })
|
|
6853
7486
|
))
|
|
6854
7487
|
);
|
|
6855
7488
|
});
|
|
6856
7489
|
|
|
6857
7490
|
// src/components/promotions/attributes-control.tsx
|
|
6858
|
-
var
|
|
6859
|
-
var
|
|
6860
|
-
var
|
|
6861
|
-
var
|
|
6862
|
-
var
|
|
6863
|
-
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");
|
|
6864
7497
|
var TRACKING_DATA2 = { target_name: "attributes", location_l2: "general" };
|
|
6865
7498
|
var AttributesControl = createControl(() => {
|
|
6866
|
-
const triggerRef = (0,
|
|
6867
|
-
return /* @__PURE__ */
|
|
6868
|
-
|
|
7499
|
+
const triggerRef = (0, import_react61.useRef)(null);
|
|
7500
|
+
return /* @__PURE__ */ React111.createElement(
|
|
7501
|
+
import_ui95.Stack,
|
|
6869
7502
|
{
|
|
6870
7503
|
direction: "row",
|
|
6871
7504
|
spacing: 2,
|
|
@@ -6874,9 +7507,9 @@ var AttributesControl = createControl(() => {
|
|
|
6874
7507
|
alignItems: "center"
|
|
6875
7508
|
}
|
|
6876
7509
|
},
|
|
6877
|
-
/* @__PURE__ */
|
|
6878
|
-
/* @__PURE__ */
|
|
6879
|
-
|
|
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,
|
|
6880
7513
|
{
|
|
6881
7514
|
"aria-label": ARIA_LABEL2,
|
|
6882
7515
|
fontSize: "tiny",
|
|
@@ -6889,22 +7522,22 @@ var AttributesControl = createControl(() => {
|
|
|
6889
7522
|
});
|
|
6890
7523
|
|
|
6891
7524
|
// src/components/icon-buttons/clear-icon-button.tsx
|
|
6892
|
-
var
|
|
6893
|
-
var
|
|
6894
|
-
var
|
|
6895
|
-
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 }) => ({
|
|
6896
7529
|
width: theme.spacing(2.5),
|
|
6897
7530
|
height: theme.spacing(2.5)
|
|
6898
7531
|
}));
|
|
6899
|
-
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 })));
|
|
6900
7533
|
|
|
6901
7534
|
// src/components/repeater/repeater.tsx
|
|
6902
|
-
var
|
|
6903
|
-
var
|
|
6904
|
-
var
|
|
6905
|
-
var
|
|
6906
|
-
var
|
|
6907
|
-
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";
|
|
6908
7541
|
var EMPTY_OPEN_ITEM2 = -1;
|
|
6909
7542
|
var Repeater3 = ({
|
|
6910
7543
|
label,
|
|
@@ -6921,7 +7554,7 @@ var Repeater3 = ({
|
|
|
6921
7554
|
openItem: initialOpenItem = EMPTY_OPEN_ITEM2,
|
|
6922
7555
|
isSortable = true
|
|
6923
7556
|
}) => {
|
|
6924
|
-
const [openItem, setOpenItem] = (0,
|
|
7557
|
+
const [openItem, setOpenItem] = (0, import_react62.useState)(initialOpenItem);
|
|
6925
7558
|
const uniqueKeys = items2.map(
|
|
6926
7559
|
(item, index) => isSortable && "getId" in itemSettings ? itemSettings.getId({ item, index }) : String(index)
|
|
6927
7560
|
);
|
|
@@ -6984,41 +7617,41 @@ var Repeater3 = ({
|
|
|
6984
7617
|
};
|
|
6985
7618
|
const isButtonDisabled = disabled || disableAddItemButton;
|
|
6986
7619
|
const shouldShowInfotip = isButtonDisabled && addButtonInfotipContent;
|
|
6987
|
-
const addButton = /* @__PURE__ */
|
|
6988
|
-
|
|
7620
|
+
const addButton = /* @__PURE__ */ React113.createElement(
|
|
7621
|
+
import_ui97.IconButton,
|
|
6989
7622
|
{
|
|
6990
|
-
size:
|
|
7623
|
+
size: SIZE11,
|
|
6991
7624
|
sx: {
|
|
6992
7625
|
ml: "auto"
|
|
6993
7626
|
},
|
|
6994
7627
|
disabled: isButtonDisabled,
|
|
6995
7628
|
onClick: addRepeaterItem,
|
|
6996
|
-
"aria-label": (0,
|
|
7629
|
+
"aria-label": (0, import_i18n55.__)("Add item", "elementor")
|
|
6997
7630
|
},
|
|
6998
|
-
/* @__PURE__ */
|
|
7631
|
+
/* @__PURE__ */ React113.createElement(import_icons39.PlusIcon, { fontSize: SIZE11 })
|
|
6999
7632
|
);
|
|
7000
|
-
return /* @__PURE__ */
|
|
7001
|
-
|
|
7633
|
+
return /* @__PURE__ */ React113.createElement(SectionContent, { gap: 2 }, /* @__PURE__ */ React113.createElement(RepeaterHeader, { label, adornment: ControlAdornments }, shouldShowInfotip ? /* @__PURE__ */ React113.createElement(
|
|
7634
|
+
import_ui97.Infotip,
|
|
7002
7635
|
{
|
|
7003
7636
|
placement: "right",
|
|
7004
7637
|
content: addButtonInfotipContent,
|
|
7005
7638
|
color: "secondary",
|
|
7006
7639
|
slotProps: { popper: { sx: { width: 300 } } }
|
|
7007
7640
|
},
|
|
7008
|
-
/* @__PURE__ */
|
|
7009
|
-
) : 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) => {
|
|
7010
7643
|
const index = uniqueKeys.indexOf(key);
|
|
7011
7644
|
const value = items2[index];
|
|
7012
7645
|
if (!value) {
|
|
7013
7646
|
return null;
|
|
7014
7647
|
}
|
|
7015
|
-
return /* @__PURE__ */
|
|
7648
|
+
return /* @__PURE__ */ React113.createElement(SortableItem, { id: key, key: `sortable-${key}`, disabled: !isSortable }, /* @__PURE__ */ React113.createElement(
|
|
7016
7649
|
RepeaterItem,
|
|
7017
7650
|
{
|
|
7018
7651
|
disabled,
|
|
7019
7652
|
propDisabled: value?.disabled,
|
|
7020
|
-
label: /* @__PURE__ */
|
|
7021
|
-
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 })),
|
|
7022
7655
|
removeItem: () => removeRepeaterItem(index),
|
|
7023
7656
|
duplicateItem: () => duplicateRepeaterItem(index),
|
|
7024
7657
|
toggleDisableItem: () => toggleDisableRepeaterItem(index),
|
|
@@ -7030,7 +7663,7 @@ var Repeater3 = ({
|
|
|
7030
7663
|
actions: itemSettings.actions,
|
|
7031
7664
|
value
|
|
7032
7665
|
},
|
|
7033
|
-
(props) => /* @__PURE__ */
|
|
7666
|
+
(props) => /* @__PURE__ */ React113.createElement(
|
|
7034
7667
|
itemSettings.Content,
|
|
7035
7668
|
{
|
|
7036
7669
|
...props,
|
|
@@ -7060,27 +7693,27 @@ var RepeaterItem = ({
|
|
|
7060
7693
|
value
|
|
7061
7694
|
}) => {
|
|
7062
7695
|
const { popoverState, popoverProps, ref, setRef } = usePopover(openOnMount, onOpen);
|
|
7063
|
-
const duplicateLabel = (0,
|
|
7064
|
-
const toggleLabel = propDisabled ? (0,
|
|
7065
|
-
const removeLabel = (0,
|
|
7066
|
-
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(
|
|
7067
7700
|
RepeaterTag,
|
|
7068
7701
|
{
|
|
7069
7702
|
disabled,
|
|
7070
7703
|
label,
|
|
7071
7704
|
ref: setRef,
|
|
7072
|
-
"aria-label": (0,
|
|
7073
|
-
...(0,
|
|
7705
|
+
"aria-label": (0, import_i18n55.__)("Open item", "elementor"),
|
|
7706
|
+
...(0, import_ui97.bindTrigger)(popoverState),
|
|
7074
7707
|
startIcon,
|
|
7075
|
-
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 }))))
|
|
7076
7709
|
}
|
|
7077
|
-
), /* @__PURE__ */
|
|
7710
|
+
), /* @__PURE__ */ React113.createElement(RepeaterPopover, { width: ref?.getBoundingClientRect().width, ...popoverProps, anchorEl: ref }, /* @__PURE__ */ React113.createElement(import_ui97.Box, null, children({ anchorEl: ref }))));
|
|
7078
7711
|
};
|
|
7079
7712
|
var usePopover = (openOnMount, onOpen) => {
|
|
7080
|
-
const [ref, setRef] = (0,
|
|
7081
|
-
const popoverState = (0,
|
|
7082
|
-
const popoverProps = (0,
|
|
7083
|
-
(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)(() => {
|
|
7084
7717
|
if (openOnMount && ref) {
|
|
7085
7718
|
popoverState.open(ref);
|
|
7086
7719
|
onOpen?.();
|
|
@@ -7095,20 +7728,20 @@ var usePopover = (openOnMount, onOpen) => {
|
|
|
7095
7728
|
};
|
|
7096
7729
|
|
|
7097
7730
|
// src/components/inline-editor-toolbar.tsx
|
|
7098
|
-
var
|
|
7099
|
-
var
|
|
7731
|
+
var React115 = __toESM(require("react"));
|
|
7732
|
+
var import_react64 = require("react");
|
|
7100
7733
|
var import_editor_elements6 = require("@elementor/editor-elements");
|
|
7101
|
-
var
|
|
7102
|
-
var
|
|
7103
|
-
var
|
|
7104
|
-
var
|
|
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");
|
|
7105
7738
|
|
|
7106
7739
|
// src/components/url-popover.tsx
|
|
7107
|
-
var
|
|
7108
|
-
var
|
|
7109
|
-
var
|
|
7110
|
-
var
|
|
7111
|
-
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");
|
|
7112
7745
|
var UrlPopover = ({
|
|
7113
7746
|
popupState,
|
|
7114
7747
|
restoreValue,
|
|
@@ -7118,8 +7751,8 @@ var UrlPopover = ({
|
|
|
7118
7751
|
openInNewTab,
|
|
7119
7752
|
onToggleNewTab
|
|
7120
7753
|
}) => {
|
|
7121
|
-
const inputRef = (0,
|
|
7122
|
-
(0,
|
|
7754
|
+
const inputRef = (0, import_react63.useRef)(null);
|
|
7755
|
+
(0, import_react63.useEffect)(() => {
|
|
7123
7756
|
if (popupState.isOpen) {
|
|
7124
7757
|
requestAnimationFrame(() => inputRef.current?.focus());
|
|
7125
7758
|
}
|
|
@@ -7128,57 +7761,57 @@ var UrlPopover = ({
|
|
|
7128
7761
|
restoreValue();
|
|
7129
7762
|
popupState.close();
|
|
7130
7763
|
};
|
|
7131
|
-
return /* @__PURE__ */
|
|
7132
|
-
|
|
7764
|
+
return /* @__PURE__ */ React114.createElement(
|
|
7765
|
+
import_ui98.Popover,
|
|
7133
7766
|
{
|
|
7134
7767
|
slotProps: {
|
|
7135
7768
|
paper: { sx: { borderRadius: "16px", width: anchorRef.current?.offsetWidth + "px", marginTop: -1 } }
|
|
7136
7769
|
},
|
|
7137
|
-
...(0,
|
|
7770
|
+
...(0, import_ui98.bindPopover)(popupState),
|
|
7138
7771
|
anchorOrigin: { vertical: "top", horizontal: "left" },
|
|
7139
7772
|
transformOrigin: { vertical: "top", horizontal: "left" },
|
|
7140
7773
|
onClose: handleClose
|
|
7141
7774
|
},
|
|
7142
|
-
/* @__PURE__ */
|
|
7143
|
-
|
|
7775
|
+
/* @__PURE__ */ React114.createElement(import_ui98.Stack, { direction: "row", alignItems: "center", gap: 1, sx: { p: 1.5 } }, /* @__PURE__ */ React114.createElement(
|
|
7776
|
+
import_ui98.TextField,
|
|
7144
7777
|
{
|
|
7145
7778
|
value,
|
|
7146
7779
|
onChange,
|
|
7147
7780
|
size: "tiny",
|
|
7148
7781
|
fullWidth: true,
|
|
7149
|
-
placeholder: (0,
|
|
7782
|
+
placeholder: (0, import_i18n56.__)("Type a URL", "elementor"),
|
|
7150
7783
|
inputProps: { ref: inputRef },
|
|
7151
7784
|
color: "secondary",
|
|
7152
7785
|
InputProps: { sx: { borderRadius: "8px" } },
|
|
7153
7786
|
onKeyUp: (event) => event.key === "Enter" && handleClose()
|
|
7154
7787
|
}
|
|
7155
|
-
), /* @__PURE__ */
|
|
7156
|
-
|
|
7788
|
+
), /* @__PURE__ */ React114.createElement(import_ui98.Tooltip, { title: (0, import_i18n56.__)("Open in a new tab", "elementor") }, /* @__PURE__ */ React114.createElement(
|
|
7789
|
+
import_ui98.ToggleButton,
|
|
7157
7790
|
{
|
|
7158
7791
|
size: "tiny",
|
|
7159
7792
|
value: "newTab",
|
|
7160
7793
|
selected: openInNewTab,
|
|
7161
7794
|
onClick: onToggleNewTab,
|
|
7162
|
-
"aria-label": (0,
|
|
7795
|
+
"aria-label": (0, import_i18n56.__)("Open in a new tab", "elementor"),
|
|
7163
7796
|
sx: { borderRadius: "8px" }
|
|
7164
7797
|
},
|
|
7165
|
-
/* @__PURE__ */
|
|
7798
|
+
/* @__PURE__ */ React114.createElement(import_icons40.ExternalLinkIcon, { fontSize: "tiny" })
|
|
7166
7799
|
)))
|
|
7167
7800
|
);
|
|
7168
7801
|
};
|
|
7169
7802
|
|
|
7170
7803
|
// src/components/inline-editor-toolbar.tsx
|
|
7171
7804
|
var InlineEditorToolbar = ({ editor, elementId, sx = {} }) => {
|
|
7172
|
-
const [urlValue, setUrlValue] = (0,
|
|
7173
|
-
const [openInNewTab, setOpenInNewTab] = (0,
|
|
7174
|
-
const toolbarRef = (0,
|
|
7175
|
-
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" });
|
|
7176
7809
|
const isElementClickable = elementId ? checkIfElementIsClickable(elementId) : false;
|
|
7177
|
-
const editorState = (0,
|
|
7810
|
+
const editorState = (0, import_react65.useEditorState)({
|
|
7178
7811
|
editor,
|
|
7179
7812
|
selector: (ctx) => possibleFormats.filter((format) => ctx.editor.isActive(format))
|
|
7180
7813
|
});
|
|
7181
|
-
const formatButtonsList = (0,
|
|
7814
|
+
const formatButtonsList = (0, import_react64.useMemo)(() => {
|
|
7182
7815
|
const buttons = Object.values(formatButtons);
|
|
7183
7816
|
if (isElementClickable) {
|
|
7184
7817
|
return buttons.filter((button) => button.action !== "link");
|
|
@@ -7215,11 +7848,11 @@ var InlineEditorToolbar = ({ editor, elementId, sx = {} }) => {
|
|
|
7215
7848
|
}
|
|
7216
7849
|
linkPopupState.close();
|
|
7217
7850
|
};
|
|
7218
|
-
|
|
7851
|
+
React115.useEffect(() => {
|
|
7219
7852
|
editor?.commands?.focus();
|
|
7220
7853
|
}, [editor]);
|
|
7221
|
-
return /* @__PURE__ */
|
|
7222
|
-
|
|
7854
|
+
return /* @__PURE__ */ React115.createElement(
|
|
7855
|
+
import_ui99.Box,
|
|
7223
7856
|
{
|
|
7224
7857
|
ref: toolbarRef,
|
|
7225
7858
|
sx: {
|
|
@@ -7235,9 +7868,9 @@ var InlineEditorToolbar = ({ editor, elementId, sx = {} }) => {
|
|
|
7235
7868
|
...sx
|
|
7236
7869
|
}
|
|
7237
7870
|
},
|
|
7238
|
-
/* @__PURE__ */
|
|
7239
|
-
/* @__PURE__ */
|
|
7240
|
-
|
|
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,
|
|
7241
7874
|
{
|
|
7242
7875
|
value: editorState,
|
|
7243
7876
|
size: "tiny",
|
|
@@ -7245,7 +7878,7 @@ var InlineEditorToolbar = ({ editor, elementId, sx = {} }) => {
|
|
|
7245
7878
|
display: "flex",
|
|
7246
7879
|
gap: 0.5,
|
|
7247
7880
|
border: "none",
|
|
7248
|
-
[`& .${
|
|
7881
|
+
[`& .${import_ui99.toggleButtonGroupClasses.firstButton}, & .${import_ui99.toggleButtonGroupClasses.middleButton}, & .${import_ui99.toggleButtonGroupClasses.lastButton}`]: {
|
|
7249
7882
|
borderRadius: "8px",
|
|
7250
7883
|
border: "none",
|
|
7251
7884
|
marginLeft: 0,
|
|
@@ -7258,8 +7891,8 @@ var InlineEditorToolbar = ({ editor, elementId, sx = {} }) => {
|
|
|
7258
7891
|
}
|
|
7259
7892
|
}
|
|
7260
7893
|
},
|
|
7261
|
-
formatButtonsList.map((button) => /* @__PURE__ */
|
|
7262
|
-
|
|
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,
|
|
7263
7896
|
{
|
|
7264
7897
|
value: button.action,
|
|
7265
7898
|
"aria-label": button.label,
|
|
@@ -7276,7 +7909,7 @@ var InlineEditorToolbar = ({ editor, elementId, sx = {} }) => {
|
|
|
7276
7909
|
button.icon
|
|
7277
7910
|
)))
|
|
7278
7911
|
),
|
|
7279
|
-
/* @__PURE__ */
|
|
7912
|
+
/* @__PURE__ */ React115.createElement(
|
|
7280
7913
|
UrlPopover,
|
|
7281
7914
|
{
|
|
7282
7915
|
popupState: linkPopupState,
|
|
@@ -7299,64 +7932,64 @@ var checkIfElementIsClickable = (elementId) => {
|
|
|
7299
7932
|
};
|
|
7300
7933
|
var toolbarButtons = {
|
|
7301
7934
|
clear: {
|
|
7302
|
-
label: (0,
|
|
7303
|
-
icon: /* @__PURE__ */
|
|
7935
|
+
label: (0, import_i18n57.__)("Clear", "elementor"),
|
|
7936
|
+
icon: /* @__PURE__ */ React115.createElement(import_icons41.MinusIcon, { fontSize: "tiny" }),
|
|
7304
7937
|
action: "clear",
|
|
7305
7938
|
method: (editor) => {
|
|
7306
7939
|
editor.chain().focus().clearNodes().unsetAllMarks().run();
|
|
7307
7940
|
}
|
|
7308
7941
|
},
|
|
7309
7942
|
bold: {
|
|
7310
|
-
label: (0,
|
|
7311
|
-
icon: /* @__PURE__ */
|
|
7943
|
+
label: (0, import_i18n57.__)("Bold", "elementor"),
|
|
7944
|
+
icon: /* @__PURE__ */ React115.createElement(import_icons41.BoldIcon, { fontSize: "tiny" }),
|
|
7312
7945
|
action: "bold",
|
|
7313
7946
|
method: (editor) => {
|
|
7314
7947
|
editor.chain().focus().toggleBold().run();
|
|
7315
7948
|
}
|
|
7316
7949
|
},
|
|
7317
7950
|
italic: {
|
|
7318
|
-
label: (0,
|
|
7319
|
-
icon: /* @__PURE__ */
|
|
7951
|
+
label: (0, import_i18n57.__)("Italic", "elementor"),
|
|
7952
|
+
icon: /* @__PURE__ */ React115.createElement(import_icons41.ItalicIcon, { fontSize: "tiny" }),
|
|
7320
7953
|
action: "italic",
|
|
7321
7954
|
method: (editor) => {
|
|
7322
7955
|
editor.chain().focus().toggleItalic().run();
|
|
7323
7956
|
}
|
|
7324
7957
|
},
|
|
7325
7958
|
underline: {
|
|
7326
|
-
label: (0,
|
|
7327
|
-
icon: /* @__PURE__ */
|
|
7959
|
+
label: (0, import_i18n57.__)("Underline", "elementor"),
|
|
7960
|
+
icon: /* @__PURE__ */ React115.createElement(import_icons41.UnderlineIcon, { fontSize: "tiny" }),
|
|
7328
7961
|
action: "underline",
|
|
7329
7962
|
method: (editor) => {
|
|
7330
7963
|
editor.chain().focus().toggleUnderline().run();
|
|
7331
7964
|
}
|
|
7332
7965
|
},
|
|
7333
7966
|
strike: {
|
|
7334
|
-
label: (0,
|
|
7335
|
-
icon: /* @__PURE__ */
|
|
7967
|
+
label: (0, import_i18n57.__)("Strikethrough", "elementor"),
|
|
7968
|
+
icon: /* @__PURE__ */ React115.createElement(import_icons41.StrikethroughIcon, { fontSize: "tiny" }),
|
|
7336
7969
|
action: "strike",
|
|
7337
7970
|
method: (editor) => {
|
|
7338
7971
|
editor.chain().focus().toggleStrike().run();
|
|
7339
7972
|
}
|
|
7340
7973
|
},
|
|
7341
7974
|
superscript: {
|
|
7342
|
-
label: (0,
|
|
7343
|
-
icon: /* @__PURE__ */
|
|
7975
|
+
label: (0, import_i18n57.__)("Superscript", "elementor"),
|
|
7976
|
+
icon: /* @__PURE__ */ React115.createElement(import_icons41.SuperscriptIcon, { fontSize: "tiny" }),
|
|
7344
7977
|
action: "superscript",
|
|
7345
7978
|
method: (editor) => {
|
|
7346
7979
|
editor.chain().focus().toggleSuperscript().run();
|
|
7347
7980
|
}
|
|
7348
7981
|
},
|
|
7349
7982
|
subscript: {
|
|
7350
|
-
label: (0,
|
|
7351
|
-
icon: /* @__PURE__ */
|
|
7983
|
+
label: (0, import_i18n57.__)("Subscript", "elementor"),
|
|
7984
|
+
icon: /* @__PURE__ */ React115.createElement(import_icons41.SubscriptIcon, { fontSize: "tiny" }),
|
|
7352
7985
|
action: "subscript",
|
|
7353
7986
|
method: (editor) => {
|
|
7354
7987
|
editor.chain().focus().toggleSubscript().run();
|
|
7355
7988
|
}
|
|
7356
7989
|
},
|
|
7357
7990
|
link: {
|
|
7358
|
-
label: (0,
|
|
7359
|
-
icon: /* @__PURE__ */
|
|
7991
|
+
label: (0, import_i18n57.__)("Link", "elementor"),
|
|
7992
|
+
icon: /* @__PURE__ */ React115.createElement(import_icons41.LinkIcon, { fontSize: "tiny" }),
|
|
7360
7993
|
action: "link",
|
|
7361
7994
|
method: null
|
|
7362
7995
|
}
|
|
@@ -7365,13 +7998,13 @@ var { clear: clearButton, ...formatButtons } = toolbarButtons;
|
|
|
7365
7998
|
var possibleFormats = Object.keys(formatButtons);
|
|
7366
7999
|
|
|
7367
8000
|
// src/components/size/unstable-size-field.tsx
|
|
7368
|
-
var
|
|
7369
|
-
var
|
|
8001
|
+
var React118 = __toESM(require("react"));
|
|
8002
|
+
var import_ui101 = require("@elementor/ui");
|
|
7370
8003
|
|
|
7371
8004
|
// src/hooks/use-size-value.ts
|
|
7372
8005
|
var DEFAULT_UNIT2 = "px";
|
|
7373
|
-
var
|
|
7374
|
-
var
|
|
8006
|
+
var DEFAULT_SIZE3 = "";
|
|
8007
|
+
var useSizeValue2 = (externalValue, onChange, defaultUnit) => {
|
|
7375
8008
|
const [sizeValue, setSizeValue] = useSyncExternalState({
|
|
7376
8009
|
external: externalValue,
|
|
7377
8010
|
setExternal: (newState) => {
|
|
@@ -7380,7 +8013,7 @@ var useSizeValue = (externalValue, onChange, defaultUnit) => {
|
|
|
7380
8013
|
}
|
|
7381
8014
|
},
|
|
7382
8015
|
persistWhen: (newState) => differsFromExternal(newState, externalValue),
|
|
7383
|
-
fallback: () => ({ size:
|
|
8016
|
+
fallback: () => ({ size: DEFAULT_SIZE3, unit: defaultUnit ?? DEFAULT_UNIT2 })
|
|
7384
8017
|
});
|
|
7385
8018
|
const setSize = (value) => {
|
|
7386
8019
|
const newState = {
|
|
@@ -7408,44 +8041,44 @@ var differsFromExternal = (newState, externalState) => {
|
|
|
7408
8041
|
};
|
|
7409
8042
|
|
|
7410
8043
|
// src/components/size/unit-select.tsx
|
|
7411
|
-
var
|
|
7412
|
-
var
|
|
7413
|
-
var
|
|
7414
|
-
var
|
|
7415
|
-
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 = {
|
|
7416
8049
|
display: "flex",
|
|
7417
8050
|
flexDirection: "column",
|
|
7418
8051
|
justifyContent: "center"
|
|
7419
8052
|
};
|
|
7420
8053
|
var UnitSelect = ({ value, showPrimaryColor, onClick, options }) => {
|
|
7421
|
-
const popupState = (0,
|
|
8054
|
+
const popupState = (0, import_ui100.usePopupState)({
|
|
7422
8055
|
variant: "popover",
|
|
7423
|
-
popupId: (0,
|
|
8056
|
+
popupId: (0, import_react66.useId)()
|
|
7424
8057
|
});
|
|
7425
8058
|
const handleMenuItemClick = (index) => {
|
|
7426
8059
|
onClick(options[index]);
|
|
7427
8060
|
popupState.close();
|
|
7428
8061
|
};
|
|
7429
|
-
return /* @__PURE__ */
|
|
7430
|
-
|
|
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,
|
|
7431
8064
|
{
|
|
7432
8065
|
key: option,
|
|
7433
8066
|
onClick: () => handleMenuItemClick(index),
|
|
7434
8067
|
primaryTypographyProps: {
|
|
7435
8068
|
variant: "caption",
|
|
7436
8069
|
sx: {
|
|
7437
|
-
...
|
|
8070
|
+
...menuItemContentStyles2,
|
|
7438
8071
|
lineHeight: "1"
|
|
7439
8072
|
}
|
|
7440
8073
|
},
|
|
7441
8074
|
menuItemTextProps: {
|
|
7442
|
-
sx:
|
|
8075
|
+
sx: menuItemContentStyles2
|
|
7443
8076
|
}
|
|
7444
8077
|
},
|
|
7445
8078
|
option.toUpperCase()
|
|
7446
8079
|
))));
|
|
7447
8080
|
};
|
|
7448
|
-
var
|
|
8081
|
+
var StyledButton3 = (0, import_ui100.styled)(import_ui100.Button, {
|
|
7449
8082
|
shouldForwardProp: (prop) => prop !== "isPrimaryColor"
|
|
7450
8083
|
})(({ isPrimaryColor, theme }) => ({
|
|
7451
8084
|
color: isPrimaryColor ? theme.palette.text.primary : theme.palette.text.tertiary,
|
|
@@ -7455,11 +8088,11 @@ var StyledButton2 = (0, import_ui96.styled)(import_ui96.Button, {
|
|
|
7455
8088
|
}));
|
|
7456
8089
|
|
|
7457
8090
|
// src/components/size/unstable-size-input.tsx
|
|
7458
|
-
var
|
|
7459
|
-
var
|
|
7460
|
-
var UnstableSizeInput = (0,
|
|
8091
|
+
var React117 = __toESM(require("react"));
|
|
8092
|
+
var import_react67 = require("react");
|
|
8093
|
+
var UnstableSizeInput = (0, import_react67.forwardRef)(
|
|
7461
8094
|
({ type, value, onChange, onKeyDown, onKeyUp, InputProps, onBlur, focused, disabled }, ref) => {
|
|
7462
|
-
return /* @__PURE__ */
|
|
8095
|
+
return /* @__PURE__ */ React117.createElement(
|
|
7463
8096
|
NumberInput,
|
|
7464
8097
|
{
|
|
7465
8098
|
ref,
|
|
@@ -7474,12 +8107,12 @@ var UnstableSizeInput = (0, import_react62.forwardRef)(
|
|
|
7474
8107
|
onInput: onChange,
|
|
7475
8108
|
onBlur,
|
|
7476
8109
|
InputProps,
|
|
7477
|
-
sx:
|
|
8110
|
+
sx: getCursorStyle2(InputProps?.readOnly ?? false)
|
|
7478
8111
|
}
|
|
7479
8112
|
);
|
|
7480
8113
|
}
|
|
7481
8114
|
);
|
|
7482
|
-
var
|
|
8115
|
+
var getCursorStyle2 = (readOnly) => ({
|
|
7483
8116
|
input: { cursor: readOnly ? "default !important" : void 0 }
|
|
7484
8117
|
});
|
|
7485
8118
|
|
|
@@ -7493,11 +8126,11 @@ var UnstableSizeField = ({
|
|
|
7493
8126
|
defaultUnit,
|
|
7494
8127
|
startIcon
|
|
7495
8128
|
}) => {
|
|
7496
|
-
const { size, unit, setSize, setUnit } =
|
|
7497
|
-
const
|
|
8129
|
+
const { size, unit, setSize, setUnit } = useSizeValue2(value, onChange, defaultUnit);
|
|
8130
|
+
const shouldHighlightUnit2 = () => {
|
|
7498
8131
|
return hasValue(size);
|
|
7499
8132
|
};
|
|
7500
|
-
return /* @__PURE__ */
|
|
8133
|
+
return /* @__PURE__ */ React118.createElement(
|
|
7501
8134
|
UnstableSizeInput,
|
|
7502
8135
|
{
|
|
7503
8136
|
type: "number",
|
|
@@ -7506,14 +8139,14 @@ var UnstableSizeField = ({
|
|
|
7506
8139
|
onChange: (event) => setSize(event.target.value),
|
|
7507
8140
|
InputProps: {
|
|
7508
8141
|
...InputProps,
|
|
7509
|
-
startAdornment: startIcon && /* @__PURE__ */
|
|
7510
|
-
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(
|
|
7511
8144
|
UnitSelect,
|
|
7512
8145
|
{
|
|
7513
8146
|
options: units2,
|
|
7514
8147
|
value: unit,
|
|
7515
8148
|
onClick: setUnit,
|
|
7516
|
-
showPrimaryColor:
|
|
8149
|
+
showPrimaryColor: shouldHighlightUnit2()
|
|
7517
8150
|
}
|
|
7518
8151
|
))
|
|
7519
8152
|
}
|
|
@@ -7525,7 +8158,7 @@ var hasValue = (value) => {
|
|
|
7525
8158
|
};
|
|
7526
8159
|
|
|
7527
8160
|
// src/hooks/use-font-families.ts
|
|
7528
|
-
var
|
|
8161
|
+
var import_react68 = require("react");
|
|
7529
8162
|
var import_editor_v1_adapters = require("@elementor/editor-v1-adapters");
|
|
7530
8163
|
var getFontControlConfig = () => {
|
|
7531
8164
|
const { controls } = (0, import_editor_v1_adapters.getElementorConfig)();
|
|
@@ -7533,7 +8166,7 @@ var getFontControlConfig = () => {
|
|
|
7533
8166
|
};
|
|
7534
8167
|
var useFontFamilies = () => {
|
|
7535
8168
|
const { groups, options } = getFontControlConfig();
|
|
7536
|
-
return (0,
|
|
8169
|
+
return (0, import_react68.useMemo)(() => {
|
|
7537
8170
|
if (!groups || !options) {
|
|
7538
8171
|
return [];
|
|
7539
8172
|
}
|
|
@@ -7599,6 +8232,7 @@ var useFontFamilies = () => {
|
|
|
7599
8232
|
Repeater,
|
|
7600
8233
|
SelectControl,
|
|
7601
8234
|
SelectControlWrapper,
|
|
8235
|
+
SizeComponent,
|
|
7602
8236
|
SizeControl,
|
|
7603
8237
|
StrokeControl,
|
|
7604
8238
|
SvgMediaControl,
|
|
@@ -7610,6 +8244,7 @@ var useFontFamilies = () => {
|
|
|
7610
8244
|
TransformRepeaterControl,
|
|
7611
8245
|
TransformSettingsControl,
|
|
7612
8246
|
TransitionRepeaterControl,
|
|
8247
|
+
UnstableSizeControl,
|
|
7613
8248
|
UnstableSizeField,
|
|
7614
8249
|
UrlControl,
|
|
7615
8250
|
VideoMediaControl,
|