@elementor/editor-controls 4.1.0-711 → 4.1.0-713
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 +144 -74
- package/dist/index.d.ts +144 -74
- package/dist/index.js +793 -160
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +767 -138
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -15
- package/src/components/control-toggle-button-group.tsx +1 -1
- 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/index.ts +3 -0
- package/src/controls/size-control/utils/is-numeric-value.ts +0 -11
package/dist/index.js
CHANGED
|
@@ -72,8 +72,11 @@ __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,
|
|
78
|
+
StyledToggleButton: () => StyledToggleButton,
|
|
79
|
+
StyledToggleButtonGroup: () => StyledToggleButtonGroup,
|
|
77
80
|
SvgMediaControl: () => SvgMediaControl,
|
|
78
81
|
SwitchControl: () => SwitchControl,
|
|
79
82
|
TextAreaControl: () => TextAreaControl,
|
|
@@ -83,6 +86,7 @@ __export(index_exports, {
|
|
|
83
86
|
TransformRepeaterControl: () => TransformRepeaterControl,
|
|
84
87
|
TransformSettingsControl: () => TransformSettingsControl,
|
|
85
88
|
TransitionRepeaterControl: () => TransitionRepeaterControl,
|
|
89
|
+
UnstableSizeControl: () => UnstableSizeControl,
|
|
86
90
|
UnstableSizeField: () => UnstableSizeField,
|
|
87
91
|
UrlControl: () => UrlControl,
|
|
88
92
|
VideoMediaControl: () => VideoMediaControl,
|
|
@@ -755,14 +759,14 @@ var TextFieldInnerSelection = (0, import_react9.forwardRef)(
|
|
|
755
759
|
id
|
|
756
760
|
}, ref) => {
|
|
757
761
|
const { placeholder: boundPropPlaceholder } = useBoundProp(import_editor_props6.sizePropTypeUtil);
|
|
758
|
-
const
|
|
762
|
+
const getCursorStyle3 = () => ({
|
|
759
763
|
input: { cursor: InputProps.readOnly ? "default !important" : void 0 }
|
|
760
764
|
});
|
|
761
765
|
return /* @__PURE__ */ React17.createElement(
|
|
762
766
|
NumberInput,
|
|
763
767
|
{
|
|
764
768
|
ref,
|
|
765
|
-
sx:
|
|
769
|
+
sx: getCursorStyle3(),
|
|
766
770
|
size: "tiny",
|
|
767
771
|
fullWidth: true,
|
|
768
772
|
type,
|
|
@@ -6781,26 +6785,651 @@ var EmailFormActionControl = createControl(() => {
|
|
|
6781
6785
|
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)));
|
|
6782
6786
|
});
|
|
6783
6787
|
|
|
6784
|
-
// src/
|
|
6785
|
-
var
|
|
6786
|
-
var
|
|
6788
|
+
// src/controls/size-control/unstable-size-control.tsx
|
|
6789
|
+
var React108 = __toESM(require("react"));
|
|
6790
|
+
var import_editor_props56 = require("@elementor/editor-props");
|
|
6791
|
+
|
|
6792
|
+
// src/controls/size-control/size-component.tsx
|
|
6793
|
+
var React107 = __toESM(require("react"));
|
|
6794
|
+
var import_react58 = require("react");
|
|
6795
|
+
var import_editor_responsive4 = require("@elementor/editor-responsive");
|
|
6796
|
+
var import_ui92 = require("@elementor/ui");
|
|
6797
|
+
|
|
6798
|
+
// src/controls/size-control/size-field.tsx
|
|
6799
|
+
var React105 = __toESM(require("react"));
|
|
6787
6800
|
var import_icons34 = require("@elementor/icons");
|
|
6788
6801
|
var import_ui90 = require("@elementor/ui");
|
|
6789
|
-
var import_i18n52 = require("@wordpress/i18n");
|
|
6790
6802
|
|
|
6791
|
-
// src/
|
|
6792
|
-
var
|
|
6803
|
+
// src/controls/size-control/sync/get-units.ts
|
|
6804
|
+
var getLengthUnits = () => {
|
|
6805
|
+
return window.elementor?.config?.size_units?.length ?? [];
|
|
6806
|
+
};
|
|
6807
|
+
var getAngleUnits = () => {
|
|
6808
|
+
return window.elementor?.config?.size_units?.angle ?? [];
|
|
6809
|
+
};
|
|
6810
|
+
var getTimeUnits = () => {
|
|
6811
|
+
return window.elementor?.config?.size_units?.time ?? [];
|
|
6812
|
+
};
|
|
6813
|
+
var getExtendedUnits = () => {
|
|
6814
|
+
return window.elementor?.config?.size_units?.extended_units ?? [];
|
|
6815
|
+
};
|
|
6816
|
+
|
|
6817
|
+
// src/controls/size-control/utils/is-extended-unit.ts
|
|
6818
|
+
var isExtendedUnit = (unit) => {
|
|
6819
|
+
const extendedUnits = getExtendedUnits();
|
|
6820
|
+
return extendedUnits.includes(unit);
|
|
6821
|
+
};
|
|
6822
|
+
|
|
6823
|
+
// src/controls/size-control/hooks/use-size-unit-keyboard.tsx
|
|
6824
|
+
var UNIT_KEY_PATTERN = /^[a-zA-Z%]$/;
|
|
6825
|
+
var useSizeUnitKeyboard = ({ unit, units: units2, onUnitChange }) => {
|
|
6826
|
+
const { appendKey, startsWith } = useTypingBuffer();
|
|
6827
|
+
const onUnitKeyDown = (event) => {
|
|
6828
|
+
if (units2.length === 0) {
|
|
6829
|
+
return;
|
|
6830
|
+
}
|
|
6831
|
+
const { key, altKey, ctrlKey, metaKey } = event;
|
|
6832
|
+
if (altKey || ctrlKey || metaKey) {
|
|
6833
|
+
return;
|
|
6834
|
+
}
|
|
6835
|
+
if (isExtendedUnit(unit) && isNumericValue(key)) {
|
|
6836
|
+
const [defaultUnit] = units2;
|
|
6837
|
+
if (defaultUnit) {
|
|
6838
|
+
onUnitChange(defaultUnit);
|
|
6839
|
+
}
|
|
6840
|
+
return;
|
|
6841
|
+
}
|
|
6842
|
+
if (!UNIT_KEY_PATTERN.test(key)) {
|
|
6843
|
+
return;
|
|
6844
|
+
}
|
|
6845
|
+
event.preventDefault();
|
|
6846
|
+
const updatedBuffer = appendKey(key.toLowerCase());
|
|
6847
|
+
const matchedUnit = units2.find((u) => startsWith(u, updatedBuffer));
|
|
6848
|
+
if (matchedUnit) {
|
|
6849
|
+
onUnitChange(matchedUnit);
|
|
6850
|
+
}
|
|
6851
|
+
};
|
|
6852
|
+
return { onUnitKeyDown };
|
|
6853
|
+
};
|
|
6854
|
+
var isNumericValue = (value) => {
|
|
6855
|
+
if (typeof value === "number") {
|
|
6856
|
+
return !isNaN(value);
|
|
6857
|
+
}
|
|
6858
|
+
if (typeof value === "string") {
|
|
6859
|
+
return value.trim() !== "" && !isNaN(Number(value));
|
|
6860
|
+
}
|
|
6861
|
+
return false;
|
|
6862
|
+
};
|
|
6863
|
+
|
|
6864
|
+
// src/controls/size-control/hooks/use-size-value.ts
|
|
6793
6865
|
var import_react54 = require("react");
|
|
6866
|
+
|
|
6867
|
+
// src/controls/size-control/utils/resolve-size-value.ts
|
|
6868
|
+
var DEFAULT_SIZE2 = "";
|
|
6869
|
+
var EXTENDED_UNITS = {
|
|
6870
|
+
auto: "auto",
|
|
6871
|
+
custom: "custom"
|
|
6872
|
+
};
|
|
6873
|
+
var resolveSizeValue = (value, context) => {
|
|
6874
|
+
if (!value) {
|
|
6875
|
+
return value;
|
|
6876
|
+
}
|
|
6877
|
+
const { units: units2, defaultUnit } = context;
|
|
6878
|
+
const unit = resolveFallbackUnit(value.unit, units2, defaultUnit);
|
|
6879
|
+
if (unit === EXTENDED_UNITS.auto) {
|
|
6880
|
+
return { size: DEFAULT_SIZE2, unit };
|
|
6881
|
+
}
|
|
6882
|
+
if (unit === EXTENDED_UNITS.custom) {
|
|
6883
|
+
return { size: String(value.size ?? DEFAULT_SIZE2), unit };
|
|
6884
|
+
}
|
|
6885
|
+
return {
|
|
6886
|
+
size: sanitizeSize(value.size) ?? DEFAULT_SIZE2,
|
|
6887
|
+
unit
|
|
6888
|
+
};
|
|
6889
|
+
};
|
|
6890
|
+
var resolveSizeOnUnitChange = (size, unit) => {
|
|
6891
|
+
return isExtendedUnit(unit) ? DEFAULT_SIZE2 : size;
|
|
6892
|
+
};
|
|
6893
|
+
var createDefaultSizeValue = (units2, defaultUnit) => {
|
|
6894
|
+
let [unit] = units2;
|
|
6895
|
+
if (defaultUnit !== void 0) {
|
|
6896
|
+
unit = resolveFallbackUnit(defaultUnit, units2);
|
|
6897
|
+
}
|
|
6898
|
+
return { size: DEFAULT_SIZE2, unit };
|
|
6899
|
+
};
|
|
6900
|
+
var resolveFallbackUnit = (unit, units2, defaultUnit) => {
|
|
6901
|
+
if (units2.includes(unit)) {
|
|
6902
|
+
return unit;
|
|
6903
|
+
}
|
|
6904
|
+
if (defaultUnit && units2.includes(defaultUnit)) {
|
|
6905
|
+
return defaultUnit;
|
|
6906
|
+
}
|
|
6907
|
+
return units2[0] ?? "";
|
|
6908
|
+
};
|
|
6909
|
+
var sanitizeSize = (size) => {
|
|
6910
|
+
if (typeof size === "number" && isNaN(size)) {
|
|
6911
|
+
return DEFAULT_SIZE2;
|
|
6912
|
+
}
|
|
6913
|
+
return size;
|
|
6914
|
+
};
|
|
6915
|
+
|
|
6916
|
+
// src/controls/size-control/hooks/use-size-value.ts
|
|
6917
|
+
var useSizeValue = ({
|
|
6918
|
+
value,
|
|
6919
|
+
setValue,
|
|
6920
|
+
units: units2,
|
|
6921
|
+
defaultUnit
|
|
6922
|
+
}) => {
|
|
6923
|
+
const resolvedValue = (0, import_react54.useMemo)(
|
|
6924
|
+
() => resolveSizeValue(value, { units: units2, defaultUnit }),
|
|
6925
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
6926
|
+
[value?.size, value?.unit, defaultUnit]
|
|
6927
|
+
);
|
|
6928
|
+
const [sizeValue, setSizeValue] = useSyncExternalState({
|
|
6929
|
+
external: resolvedValue,
|
|
6930
|
+
setExternal: (newState, options, meta) => {
|
|
6931
|
+
if (newState !== null) {
|
|
6932
|
+
setValue(newState, options, meta);
|
|
6933
|
+
}
|
|
6934
|
+
},
|
|
6935
|
+
persistWhen: (next) => hasChanged(next, resolvedValue),
|
|
6936
|
+
fallback: () => createDefaultSizeValue(units2, defaultUnit)
|
|
6937
|
+
});
|
|
6938
|
+
const setSize = (newSize, isInputValid = true) => {
|
|
6939
|
+
if (isExtendedUnit(sizeValue.unit)) {
|
|
6940
|
+
return;
|
|
6941
|
+
}
|
|
6942
|
+
const trimmed = newSize.trim();
|
|
6943
|
+
const parsed = Number(trimmed);
|
|
6944
|
+
const newState = {
|
|
6945
|
+
...sizeValue,
|
|
6946
|
+
size: trimmed && !isNaN(parsed) ? parsed : ""
|
|
6947
|
+
};
|
|
6948
|
+
setSizeValue(newState, void 0, { validation: () => isInputValid });
|
|
6949
|
+
};
|
|
6950
|
+
const setUnit = (unit) => {
|
|
6951
|
+
setSizeValue({ unit, size: resolveSizeOnUnitChange(sizeValue.size, unit) });
|
|
6952
|
+
};
|
|
6953
|
+
return {
|
|
6954
|
+
size: sizeValue.size,
|
|
6955
|
+
unit: sizeValue.unit,
|
|
6956
|
+
setSize,
|
|
6957
|
+
setUnit
|
|
6958
|
+
};
|
|
6959
|
+
};
|
|
6960
|
+
var hasChanged = (next, current) => {
|
|
6961
|
+
return next?.size !== current?.size || next?.unit !== current?.unit;
|
|
6962
|
+
};
|
|
6963
|
+
|
|
6964
|
+
// src/controls/size-control/ui/size-input.tsx
|
|
6965
|
+
var React103 = __toESM(require("react"));
|
|
6966
|
+
var import_react55 = require("react");
|
|
6967
|
+
var SizeInput2 = (0, import_react55.forwardRef)(
|
|
6968
|
+
({
|
|
6969
|
+
id,
|
|
6970
|
+
type,
|
|
6971
|
+
value,
|
|
6972
|
+
onBlur,
|
|
6973
|
+
onKeyUp,
|
|
6974
|
+
focused,
|
|
6975
|
+
disabled,
|
|
6976
|
+
onChange,
|
|
6977
|
+
onKeyDown,
|
|
6978
|
+
InputProps,
|
|
6979
|
+
inputProps,
|
|
6980
|
+
placeholder
|
|
6981
|
+
}, ref) => {
|
|
6982
|
+
return /* @__PURE__ */ React103.createElement(
|
|
6983
|
+
NumberInput,
|
|
6984
|
+
{
|
|
6985
|
+
id,
|
|
6986
|
+
ref,
|
|
6987
|
+
size: "tiny",
|
|
6988
|
+
fullWidth: true,
|
|
6989
|
+
type,
|
|
6990
|
+
value,
|
|
6991
|
+
placeholder,
|
|
6992
|
+
onKeyUp,
|
|
6993
|
+
focused,
|
|
6994
|
+
disabled,
|
|
6995
|
+
onKeyDown,
|
|
6996
|
+
onInput: onChange,
|
|
6997
|
+
onBlur,
|
|
6998
|
+
InputProps,
|
|
6999
|
+
inputProps,
|
|
7000
|
+
sx: getCursorStyle(InputProps?.readOnly ?? false)
|
|
7001
|
+
}
|
|
7002
|
+
);
|
|
7003
|
+
}
|
|
7004
|
+
);
|
|
7005
|
+
var getCursorStyle = (readOnly) => ({
|
|
7006
|
+
input: { cursor: readOnly ? "default !important" : void 0 }
|
|
7007
|
+
});
|
|
7008
|
+
|
|
7009
|
+
// src/controls/size-control/ui/unit-selector.tsx
|
|
7010
|
+
var React104 = __toESM(require("react"));
|
|
7011
|
+
var import_react56 = require("react");
|
|
6794
7012
|
var import_editor_ui14 = require("@elementor/editor-ui");
|
|
6795
7013
|
var import_ui89 = require("@elementor/ui");
|
|
7014
|
+
var menuItemContentStyles = {
|
|
7015
|
+
display: "flex",
|
|
7016
|
+
flexDirection: "column",
|
|
7017
|
+
justifyContent: "center"
|
|
7018
|
+
};
|
|
7019
|
+
var UnitSelector = ({
|
|
7020
|
+
value,
|
|
7021
|
+
isActive,
|
|
7022
|
+
onSelect,
|
|
7023
|
+
options,
|
|
7024
|
+
disabled,
|
|
7025
|
+
menuItemsAttributes = {},
|
|
7026
|
+
optionLabelOverrides = {}
|
|
7027
|
+
}) => {
|
|
7028
|
+
const popupState = (0, import_ui89.usePopupState)({
|
|
7029
|
+
variant: "popover",
|
|
7030
|
+
popupId: (0, import_react56.useId)()
|
|
7031
|
+
});
|
|
7032
|
+
const handleMenuItemClick = (option) => {
|
|
7033
|
+
onSelect(option);
|
|
7034
|
+
popupState.close();
|
|
7035
|
+
};
|
|
7036
|
+
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(
|
|
7037
|
+
import_editor_ui14.MenuListItem,
|
|
7038
|
+
{
|
|
7039
|
+
key: option,
|
|
7040
|
+
onClick: () => handleMenuItemClick(option),
|
|
7041
|
+
...menuItemsAttributes?.[option],
|
|
7042
|
+
primaryTypographyProps: {
|
|
7043
|
+
variant: "caption",
|
|
7044
|
+
sx: {
|
|
7045
|
+
...menuItemContentStyles,
|
|
7046
|
+
lineHeight: "1"
|
|
7047
|
+
}
|
|
7048
|
+
},
|
|
7049
|
+
menuItemTextProps: {
|
|
7050
|
+
sx: menuItemContentStyles
|
|
7051
|
+
}
|
|
7052
|
+
},
|
|
7053
|
+
optionLabelOverrides[option] ?? option.toUpperCase()
|
|
7054
|
+
))));
|
|
7055
|
+
};
|
|
7056
|
+
var StyledButton2 = (0, import_ui89.styled)(import_ui89.Button, {
|
|
7057
|
+
shouldForwardProp: (prop) => prop !== "isActive"
|
|
7058
|
+
})(({ isActive, theme }) => ({
|
|
7059
|
+
color: isActive ? theme.palette.text.primary : theme.palette.text.tertiary,
|
|
7060
|
+
font: "inherit",
|
|
7061
|
+
minWidth: "initial",
|
|
7062
|
+
textTransform: "uppercase"
|
|
7063
|
+
}));
|
|
7064
|
+
|
|
7065
|
+
// src/controls/size-control/utils/has-size-value.ts
|
|
7066
|
+
var hasSizeValue = (size) => {
|
|
7067
|
+
return Boolean(size) || size === 0;
|
|
7068
|
+
};
|
|
7069
|
+
|
|
7070
|
+
// src/controls/size-control/size-field.tsx
|
|
7071
|
+
var UNIT_DISPLAY_LABELS_OVERRIDES = {
|
|
7072
|
+
custom: /* @__PURE__ */ React105.createElement(import_icons34.MathFunctionIcon, { fontSize: "tiny" })
|
|
7073
|
+
};
|
|
7074
|
+
var SizeField = ({
|
|
7075
|
+
value,
|
|
7076
|
+
focused,
|
|
7077
|
+
disabled,
|
|
7078
|
+
InputProps,
|
|
7079
|
+
defaultUnit,
|
|
7080
|
+
placeholder,
|
|
7081
|
+
onUnitChange,
|
|
7082
|
+
startIcon,
|
|
7083
|
+
ariaLabel,
|
|
7084
|
+
onKeyDown,
|
|
7085
|
+
setValue,
|
|
7086
|
+
onBlur,
|
|
7087
|
+
units: units2,
|
|
7088
|
+
min,
|
|
7089
|
+
unitSelectorProps
|
|
7090
|
+
}) => {
|
|
7091
|
+
const { size, unit, setSize, setUnit } = useSizeValue({ value, setValue, units: units2, defaultUnit });
|
|
7092
|
+
const handleUnitChange = (newUnit) => {
|
|
7093
|
+
setUnit(newUnit);
|
|
7094
|
+
onUnitChange?.(newUnit);
|
|
7095
|
+
};
|
|
7096
|
+
const { onUnitKeyDown } = useSizeUnitKeyboard({ unit, onUnitChange: handleUnitChange, units: units2 });
|
|
7097
|
+
const handleKeyDown = (event) => {
|
|
7098
|
+
onUnitKeyDown(event);
|
|
7099
|
+
onKeyDown?.(event);
|
|
7100
|
+
};
|
|
7101
|
+
const handleChange = (event) => {
|
|
7102
|
+
const newSize = event.target.value;
|
|
7103
|
+
const isInputValid = event.target.validity.valid;
|
|
7104
|
+
setSize(newSize, isInputValid);
|
|
7105
|
+
};
|
|
7106
|
+
const inputType = isExtendedUnit(unit) ? "text" : "number";
|
|
7107
|
+
return /* @__PURE__ */ React105.createElement(
|
|
7108
|
+
SizeInput2,
|
|
7109
|
+
{
|
|
7110
|
+
disabled,
|
|
7111
|
+
focused,
|
|
7112
|
+
type: inputType,
|
|
7113
|
+
value: size,
|
|
7114
|
+
placeholder,
|
|
7115
|
+
onBlur,
|
|
7116
|
+
onKeyDown: handleKeyDown,
|
|
7117
|
+
onChange: handleChange,
|
|
7118
|
+
InputProps: {
|
|
7119
|
+
...InputProps,
|
|
7120
|
+
autoComplete: "off",
|
|
7121
|
+
readOnly: isExtendedUnit(unit),
|
|
7122
|
+
startAdornment: startIcon && /* @__PURE__ */ React105.createElement(import_ui90.InputAdornment, { position: "start", disabled }, startIcon),
|
|
7123
|
+
endAdornment: /* @__PURE__ */ React105.createElement(import_ui90.InputAdornment, { position: "end" }, /* @__PURE__ */ React105.createElement(
|
|
7124
|
+
UnitSelector,
|
|
7125
|
+
{
|
|
7126
|
+
options: units2,
|
|
7127
|
+
value: unit,
|
|
7128
|
+
onSelect: handleUnitChange,
|
|
7129
|
+
isActive: unitSelectorProps?.isActive ?? hasSizeValue(size),
|
|
7130
|
+
...unitSelectorProps,
|
|
7131
|
+
optionLabelOverrides: UNIT_DISPLAY_LABELS_OVERRIDES
|
|
7132
|
+
}
|
|
7133
|
+
))
|
|
7134
|
+
},
|
|
7135
|
+
inputProps: { min, step: "any", "arial-label": ariaLabel }
|
|
7136
|
+
}
|
|
7137
|
+
);
|
|
7138
|
+
};
|
|
7139
|
+
|
|
7140
|
+
// src/controls/size-control/ui/text-field-popover.tsx
|
|
7141
|
+
var React106 = __toESM(require("react"));
|
|
7142
|
+
var import_react57 = require("react");
|
|
7143
|
+
var import_editor_ui15 = require("@elementor/editor-ui");
|
|
7144
|
+
var import_icons35 = require("@elementor/icons");
|
|
7145
|
+
var import_ui91 = require("@elementor/ui");
|
|
7146
|
+
var import_i18n52 = require("@wordpress/i18n");
|
|
7147
|
+
var SIZE10 = "tiny";
|
|
7148
|
+
var TextFieldPopover2 = ({ popupState, anchorRef, value, onChange, onClose }) => {
|
|
7149
|
+
const inputRef = (0, import_react57.useRef)(null);
|
|
7150
|
+
(0, import_react57.useEffect)(() => {
|
|
7151
|
+
if (popupState.isOpen) {
|
|
7152
|
+
requestAnimationFrame(() => {
|
|
7153
|
+
if (inputRef.current) {
|
|
7154
|
+
inputRef.current.focus();
|
|
7155
|
+
}
|
|
7156
|
+
});
|
|
7157
|
+
}
|
|
7158
|
+
}, [popupState.isOpen]);
|
|
7159
|
+
const handleKeyDown = (event) => {
|
|
7160
|
+
if (event.key.toLowerCase() === "enter") {
|
|
7161
|
+
handleClose();
|
|
7162
|
+
}
|
|
7163
|
+
};
|
|
7164
|
+
const handleClose = () => {
|
|
7165
|
+
onClose?.();
|
|
7166
|
+
popupState.close();
|
|
7167
|
+
};
|
|
7168
|
+
return /* @__PURE__ */ React106.createElement(
|
|
7169
|
+
import_ui91.Popover,
|
|
7170
|
+
{
|
|
7171
|
+
disablePortal: true,
|
|
7172
|
+
slotProps: {
|
|
7173
|
+
paper: {
|
|
7174
|
+
sx: {
|
|
7175
|
+
borderRadius: 2,
|
|
7176
|
+
width: anchorRef.current?.offsetWidth + "px"
|
|
7177
|
+
}
|
|
7178
|
+
}
|
|
7179
|
+
},
|
|
7180
|
+
...(0, import_ui91.bindPopover)(popupState),
|
|
7181
|
+
anchorOrigin: { vertical: "bottom", horizontal: "center" },
|
|
7182
|
+
transformOrigin: { vertical: "top", horizontal: "center" },
|
|
7183
|
+
onClose: handleClose
|
|
7184
|
+
},
|
|
7185
|
+
/* @__PURE__ */ React106.createElement(
|
|
7186
|
+
import_editor_ui15.PopoverHeader,
|
|
7187
|
+
{
|
|
7188
|
+
title: (0, import_i18n52.__)("CSS function", "elementor"),
|
|
7189
|
+
onClose: handleClose,
|
|
7190
|
+
icon: /* @__PURE__ */ React106.createElement(import_icons35.MathFunctionIcon, { fontSize: SIZE10 })
|
|
7191
|
+
}
|
|
7192
|
+
),
|
|
7193
|
+
/* @__PURE__ */ React106.createElement(
|
|
7194
|
+
import_ui91.TextField,
|
|
7195
|
+
{
|
|
7196
|
+
value,
|
|
7197
|
+
onChange,
|
|
7198
|
+
onKeyDown: handleKeyDown,
|
|
7199
|
+
size: "tiny",
|
|
7200
|
+
type: "text",
|
|
7201
|
+
fullWidth: true,
|
|
7202
|
+
inputProps: {
|
|
7203
|
+
ref: inputRef
|
|
7204
|
+
},
|
|
7205
|
+
sx: { pt: 0, pr: 1.5, pb: 1.5, pl: 1.5 }
|
|
7206
|
+
}
|
|
7207
|
+
)
|
|
7208
|
+
);
|
|
7209
|
+
};
|
|
7210
|
+
|
|
7211
|
+
// src/controls/size-control/size-component.tsx
|
|
7212
|
+
var SizeComponent = ({
|
|
7213
|
+
anchorRef,
|
|
7214
|
+
isUnitActive,
|
|
7215
|
+
SizeFieldWrapper = React107.Fragment,
|
|
7216
|
+
...sizeFieldProps
|
|
7217
|
+
}) => {
|
|
7218
|
+
const popupState = (0, import_ui92.usePopupState)({ variant: "popover" });
|
|
7219
|
+
const activeBreakpoint = (0, import_editor_responsive4.useActiveBreakpoint)();
|
|
7220
|
+
const isCustomUnit = sizeFieldProps?.value?.unit === EXTENDED_UNITS.custom;
|
|
7221
|
+
const hasCustomUnitOption = sizeFieldProps.units.includes(EXTENDED_UNITS.custom);
|
|
7222
|
+
(0, import_react58.useEffect)(() => {
|
|
7223
|
+
if (popupState && popupState.isOpen) {
|
|
7224
|
+
popupState.close();
|
|
7225
|
+
}
|
|
7226
|
+
}, [activeBreakpoint]);
|
|
7227
|
+
const handleCustomSizeChange = (event) => {
|
|
7228
|
+
sizeFieldProps.setValue({
|
|
7229
|
+
size: event.target.value,
|
|
7230
|
+
unit: EXTENDED_UNITS.custom
|
|
7231
|
+
});
|
|
7232
|
+
};
|
|
7233
|
+
const handleSizeFieldClick = (event) => {
|
|
7234
|
+
if (event.target.closest("input") && isCustomUnit) {
|
|
7235
|
+
popupState.open(anchorRef?.current);
|
|
7236
|
+
}
|
|
7237
|
+
};
|
|
7238
|
+
const handleUnitChange = (unit) => {
|
|
7239
|
+
if (unit === EXTENDED_UNITS.custom && anchorRef?.current) {
|
|
7240
|
+
popupState.open(anchorRef.current);
|
|
7241
|
+
}
|
|
7242
|
+
};
|
|
7243
|
+
const popupAttributes = {
|
|
7244
|
+
"aria-controls": popupState.isOpen ? popupState.popupId : void 0,
|
|
7245
|
+
"aria-haspopup": true
|
|
7246
|
+
};
|
|
7247
|
+
return /* @__PURE__ */ React107.createElement(React107.Fragment, null, /* @__PURE__ */ React107.createElement(SizeFieldWrapper, null, /* @__PURE__ */ React107.createElement(import_ui92.Box, null, /* @__PURE__ */ React107.createElement(
|
|
7248
|
+
SizeField,
|
|
7249
|
+
{
|
|
7250
|
+
focused: popupState.isOpen ? true : void 0,
|
|
7251
|
+
onUnitChange: handleUnitChange,
|
|
7252
|
+
InputProps: {
|
|
7253
|
+
...popupAttributes,
|
|
7254
|
+
onClick: handleSizeFieldClick
|
|
7255
|
+
},
|
|
7256
|
+
unitSelectorProps: {
|
|
7257
|
+
menuItemsAttributes: hasCustomUnitOption ? { custom: popupAttributes } : void 0,
|
|
7258
|
+
isActive: isUnitActive
|
|
7259
|
+
},
|
|
7260
|
+
...sizeFieldProps
|
|
7261
|
+
}
|
|
7262
|
+
))), popupState.isOpen && anchorRef?.current && /* @__PURE__ */ React107.createElement(
|
|
7263
|
+
TextFieldPopover2,
|
|
7264
|
+
{
|
|
7265
|
+
popupState,
|
|
7266
|
+
anchorRef,
|
|
7267
|
+
value: String(sizeFieldProps?.value?.size ?? ""),
|
|
7268
|
+
onChange: handleCustomSizeChange,
|
|
7269
|
+
onClose: () => {
|
|
7270
|
+
}
|
|
7271
|
+
}
|
|
7272
|
+
));
|
|
7273
|
+
};
|
|
7274
|
+
|
|
7275
|
+
// src/controls/size-control/utils/resolve-bound-prop-value.ts
|
|
7276
|
+
var import_editor_props55 = require("@elementor/editor-props");
|
|
7277
|
+
var resolveBoundPropValue = (value, boundPropPlaceholder, propPlaceholder) => {
|
|
7278
|
+
let sizeValue = null;
|
|
7279
|
+
if (validateSizeValue(value)) {
|
|
7280
|
+
sizeValue = value;
|
|
7281
|
+
} else if (validateSizeValue(boundPropPlaceholder)) {
|
|
7282
|
+
sizeValue = { size: "", unit: boundPropPlaceholder?.unit };
|
|
7283
|
+
}
|
|
7284
|
+
return {
|
|
7285
|
+
sizeValue,
|
|
7286
|
+
isUnitHighlighted: shouldHighlightUnit(value),
|
|
7287
|
+
placeholder: resolvePlaceholder(propPlaceholder, boundPropPlaceholder)
|
|
7288
|
+
};
|
|
7289
|
+
};
|
|
7290
|
+
var validateSizeValue = (value) => {
|
|
7291
|
+
if (!value) {
|
|
7292
|
+
return false;
|
|
7293
|
+
}
|
|
7294
|
+
const sizePropValue = import_editor_props55.sizePropTypeUtil.create(value);
|
|
7295
|
+
return import_editor_props55.sizePropTypeUtil.isValid(sizePropValue);
|
|
7296
|
+
};
|
|
7297
|
+
var resolvePlaceholder = (propPlaceholder, boundPropPlaceholder) => {
|
|
7298
|
+
if (propPlaceholder) {
|
|
7299
|
+
return propPlaceholder;
|
|
7300
|
+
}
|
|
7301
|
+
const size = boundPropPlaceholder?.size;
|
|
7302
|
+
if (size === void 0) {
|
|
7303
|
+
return void 0;
|
|
7304
|
+
}
|
|
7305
|
+
if (typeof size === "number") {
|
|
7306
|
+
return size.toString();
|
|
7307
|
+
}
|
|
7308
|
+
return size;
|
|
7309
|
+
};
|
|
7310
|
+
var shouldHighlightUnit = (value) => {
|
|
7311
|
+
if (!value) {
|
|
7312
|
+
return false;
|
|
7313
|
+
}
|
|
7314
|
+
if (value.unit === EXTENDED_UNITS.auto) {
|
|
7315
|
+
return true;
|
|
7316
|
+
}
|
|
7317
|
+
return hasSizeValue(value.size);
|
|
7318
|
+
};
|
|
7319
|
+
|
|
7320
|
+
// src/controls/size-control/utils/settings/get-prop-type-settings.ts
|
|
7321
|
+
var getPropTypeSettings = (propType) => {
|
|
7322
|
+
return propType.settings;
|
|
7323
|
+
};
|
|
7324
|
+
|
|
7325
|
+
// src/controls/size-control/utils/settings/get-default-unit.ts
|
|
7326
|
+
var getDefaultUnit = (propType) => {
|
|
7327
|
+
return getPropTypeSettings(propType)?.default_unit;
|
|
7328
|
+
};
|
|
7329
|
+
|
|
7330
|
+
// src/controls/size-control/utils/settings/get-size-units.ts
|
|
7331
|
+
var getVariantUnits = (variant) => {
|
|
7332
|
+
const map = {
|
|
7333
|
+
length: getLengthUnits,
|
|
7334
|
+
angle: getAngleUnits,
|
|
7335
|
+
time: getTimeUnits
|
|
7336
|
+
};
|
|
7337
|
+
return map[variant]();
|
|
7338
|
+
};
|
|
7339
|
+
var getSettingsUnits = (propType) => {
|
|
7340
|
+
return getPropTypeSettings(propType)?.units;
|
|
7341
|
+
};
|
|
7342
|
+
var getSizeUnits = (propType, variant) => {
|
|
7343
|
+
return getSettingsUnits(propType) ?? getVariantUnits(variant);
|
|
7344
|
+
};
|
|
7345
|
+
|
|
7346
|
+
// src/controls/size-control/utils/should-nullify-value.ts
|
|
7347
|
+
var conditions = [
|
|
7348
|
+
(value) => value?.size === null || value?.size === void 0 || value?.size === "",
|
|
7349
|
+
(value) => value?.unit !== EXTENDED_UNITS.auto,
|
|
7350
|
+
(value) => value?.unit !== EXTENDED_UNITS.custom
|
|
7351
|
+
];
|
|
7352
|
+
var shouldNullifyValue = (value) => {
|
|
7353
|
+
return conditions.every((condition) => condition(value));
|
|
7354
|
+
};
|
|
7355
|
+
|
|
7356
|
+
// src/controls/size-control/unstable-size-control.tsx
|
|
7357
|
+
var UnstableSizeControl = createControl(
|
|
7358
|
+
({ variant = "length", placeholder: propPlaceholder, anchorRef, startIcon, ariaLabel, min }) => {
|
|
7359
|
+
const {
|
|
7360
|
+
value,
|
|
7361
|
+
setValue,
|
|
7362
|
+
propType,
|
|
7363
|
+
placeholder: boundPropPlaceholder,
|
|
7364
|
+
restoreValue
|
|
7365
|
+
} = useBoundProp(import_editor_props56.sizePropTypeUtil);
|
|
7366
|
+
const { sizeValue, isUnitHighlighted, placeholder } = resolveBoundPropValue(
|
|
7367
|
+
value,
|
|
7368
|
+
boundPropPlaceholder,
|
|
7369
|
+
propPlaceholder
|
|
7370
|
+
);
|
|
7371
|
+
const units2 = getSizeUnits(propType, variant);
|
|
7372
|
+
const defaultUnit = getDefaultUnit(propType);
|
|
7373
|
+
const handleBlur = () => {
|
|
7374
|
+
const isRequired = propType.settings.required;
|
|
7375
|
+
if (shouldNullifyValue(value) && !isRequired) {
|
|
7376
|
+
setValue(null);
|
|
7377
|
+
}
|
|
7378
|
+
if (isRequired) {
|
|
7379
|
+
restoreValue();
|
|
7380
|
+
}
|
|
7381
|
+
};
|
|
7382
|
+
const handleChange = (newValue, options, meta) => {
|
|
7383
|
+
setValue(newValue, options, {
|
|
7384
|
+
...meta,
|
|
7385
|
+
validation: () => {
|
|
7386
|
+
if (propType.settings.required) {
|
|
7387
|
+
return newValue.size !== "";
|
|
7388
|
+
}
|
|
7389
|
+
return meta?.validation ? meta.validation(newValue) : true;
|
|
7390
|
+
}
|
|
7391
|
+
});
|
|
7392
|
+
};
|
|
7393
|
+
return /* @__PURE__ */ React108.createElement(
|
|
7394
|
+
SizeComponent,
|
|
7395
|
+
{
|
|
7396
|
+
units: units2,
|
|
7397
|
+
value: sizeValue,
|
|
7398
|
+
anchorRef,
|
|
7399
|
+
placeholder,
|
|
7400
|
+
defaultUnit,
|
|
7401
|
+
isUnitActive: isUnitHighlighted,
|
|
7402
|
+
onBlur: handleBlur,
|
|
7403
|
+
setValue: handleChange,
|
|
7404
|
+
SizeFieldWrapper: ControlActions,
|
|
7405
|
+
startIcon,
|
|
7406
|
+
ariaLabel,
|
|
7407
|
+
min
|
|
7408
|
+
}
|
|
7409
|
+
);
|
|
7410
|
+
}
|
|
7411
|
+
);
|
|
7412
|
+
|
|
7413
|
+
// src/components/promotions/display-conditions-control.tsx
|
|
7414
|
+
var React110 = __toESM(require("react"));
|
|
7415
|
+
var import_react60 = require("react");
|
|
7416
|
+
var import_icons36 = require("@elementor/icons");
|
|
7417
|
+
var import_ui94 = require("@elementor/ui");
|
|
7418
|
+
var import_i18n53 = require("@wordpress/i18n");
|
|
7419
|
+
|
|
7420
|
+
// src/components/promotions/promotion-trigger.tsx
|
|
7421
|
+
var React109 = __toESM(require("react"));
|
|
7422
|
+
var import_react59 = require("react");
|
|
7423
|
+
var import_editor_ui16 = require("@elementor/editor-ui");
|
|
7424
|
+
var import_ui93 = require("@elementor/ui");
|
|
6796
7425
|
function getV4Promotion(key) {
|
|
6797
7426
|
return window.elementor?.config?.v4Promotions?.[key];
|
|
6798
7427
|
}
|
|
6799
|
-
var PromotionTrigger = (0,
|
|
7428
|
+
var PromotionTrigger = (0, import_react59.forwardRef)(
|
|
6800
7429
|
({ promotionKey, children, trackingData }, ref) => {
|
|
6801
|
-
const [isOpen, setIsOpen] = (0,
|
|
7430
|
+
const [isOpen, setIsOpen] = (0, import_react59.useState)(false);
|
|
6802
7431
|
const promotion = getV4Promotion(promotionKey);
|
|
6803
|
-
const toggle = (0,
|
|
7432
|
+
const toggle = (0, import_react59.useCallback)(() => {
|
|
6804
7433
|
setIsOpen((prev) => {
|
|
6805
7434
|
if (!prev) {
|
|
6806
7435
|
trackViewPromotion(trackingData);
|
|
@@ -6808,9 +7437,9 @@ var PromotionTrigger = (0, import_react54.forwardRef)(
|
|
|
6808
7437
|
return !prev;
|
|
6809
7438
|
});
|
|
6810
7439
|
}, [trackingData]);
|
|
6811
|
-
(0,
|
|
6812
|
-
return /* @__PURE__ */
|
|
6813
|
-
|
|
7440
|
+
(0, import_react59.useImperativeHandle)(ref, () => ({ toggle }), [toggle]);
|
|
7441
|
+
return /* @__PURE__ */ React109.createElement(React109.Fragment, null, promotion && /* @__PURE__ */ React109.createElement(
|
|
7442
|
+
import_editor_ui16.PromotionInfotip,
|
|
6814
7443
|
{
|
|
6815
7444
|
title: promotion.title,
|
|
6816
7445
|
content: promotion.content,
|
|
@@ -6823,8 +7452,8 @@ var PromotionTrigger = (0, import_react54.forwardRef)(
|
|
|
6823
7452
|
},
|
|
6824
7453
|
onCtaClick: () => trackUpgradePromotionClick(trackingData)
|
|
6825
7454
|
},
|
|
6826
|
-
/* @__PURE__ */
|
|
6827
|
-
|
|
7455
|
+
/* @__PURE__ */ React109.createElement(
|
|
7456
|
+
import_ui93.Box,
|
|
6828
7457
|
{
|
|
6829
7458
|
onClick: (e) => {
|
|
6830
7459
|
e.stopPropagation();
|
|
@@ -6832,19 +7461,19 @@ var PromotionTrigger = (0, import_react54.forwardRef)(
|
|
|
6832
7461
|
},
|
|
6833
7462
|
sx: { cursor: "pointer", display: "inline-flex" }
|
|
6834
7463
|
},
|
|
6835
|
-
children ?? /* @__PURE__ */
|
|
7464
|
+
children ?? /* @__PURE__ */ React109.createElement(import_editor_ui16.PromotionChip, null)
|
|
6836
7465
|
)
|
|
6837
7466
|
));
|
|
6838
7467
|
}
|
|
6839
7468
|
);
|
|
6840
7469
|
|
|
6841
7470
|
// src/components/promotions/display-conditions-control.tsx
|
|
6842
|
-
var ARIA_LABEL = (0,
|
|
7471
|
+
var ARIA_LABEL = (0, import_i18n53.__)("Display Conditions", "elementor");
|
|
6843
7472
|
var TRACKING_DATA = { target_name: "display_conditions", location_l2: "general" };
|
|
6844
7473
|
var DisplayConditionsControl = createControl(() => {
|
|
6845
|
-
const triggerRef = (0,
|
|
6846
|
-
return /* @__PURE__ */
|
|
6847
|
-
|
|
7474
|
+
const triggerRef = (0, import_react60.useRef)(null);
|
|
7475
|
+
return /* @__PURE__ */ React110.createElement(
|
|
7476
|
+
import_ui94.Stack,
|
|
6848
7477
|
{
|
|
6849
7478
|
direction: "row",
|
|
6850
7479
|
spacing: 2,
|
|
@@ -6853,9 +7482,9 @@ var DisplayConditionsControl = createControl(() => {
|
|
|
6853
7482
|
alignItems: "center"
|
|
6854
7483
|
}
|
|
6855
7484
|
},
|
|
6856
|
-
/* @__PURE__ */
|
|
6857
|
-
/* @__PURE__ */
|
|
6858
|
-
|
|
7485
|
+
/* @__PURE__ */ React110.createElement(PromotionTrigger, { ref: triggerRef, promotionKey: "displayConditions", trackingData: TRACKING_DATA }),
|
|
7486
|
+
/* @__PURE__ */ React110.createElement(import_ui94.Tooltip, { title: ARIA_LABEL, placement: "top" }, /* @__PURE__ */ React110.createElement(
|
|
7487
|
+
import_ui94.IconButton,
|
|
6859
7488
|
{
|
|
6860
7489
|
size: "tiny",
|
|
6861
7490
|
"aria-label": ARIA_LABEL,
|
|
@@ -6867,23 +7496,23 @@ var DisplayConditionsControl = createControl(() => {
|
|
|
6867
7496
|
borderRadius: 1
|
|
6868
7497
|
}
|
|
6869
7498
|
},
|
|
6870
|
-
/* @__PURE__ */
|
|
7499
|
+
/* @__PURE__ */ React110.createElement(import_icons36.SitemapIcon, { fontSize: "tiny", color: "disabled" })
|
|
6871
7500
|
))
|
|
6872
7501
|
);
|
|
6873
7502
|
});
|
|
6874
7503
|
|
|
6875
7504
|
// src/components/promotions/attributes-control.tsx
|
|
6876
|
-
var
|
|
6877
|
-
var
|
|
6878
|
-
var
|
|
6879
|
-
var
|
|
6880
|
-
var
|
|
6881
|
-
var ARIA_LABEL2 = (0,
|
|
7505
|
+
var React111 = __toESM(require("react"));
|
|
7506
|
+
var import_react61 = require("react");
|
|
7507
|
+
var import_icons37 = require("@elementor/icons");
|
|
7508
|
+
var import_ui95 = require("@elementor/ui");
|
|
7509
|
+
var import_i18n54 = require("@wordpress/i18n");
|
|
7510
|
+
var ARIA_LABEL2 = (0, import_i18n54.__)("Attributes", "elementor");
|
|
6882
7511
|
var TRACKING_DATA2 = { target_name: "attributes", location_l2: "general" };
|
|
6883
7512
|
var AttributesControl = createControl(() => {
|
|
6884
|
-
const triggerRef = (0,
|
|
6885
|
-
return /* @__PURE__ */
|
|
6886
|
-
|
|
7513
|
+
const triggerRef = (0, import_react61.useRef)(null);
|
|
7514
|
+
return /* @__PURE__ */ React111.createElement(
|
|
7515
|
+
import_ui95.Stack,
|
|
6887
7516
|
{
|
|
6888
7517
|
direction: "row",
|
|
6889
7518
|
spacing: 2,
|
|
@@ -6892,9 +7521,9 @@ var AttributesControl = createControl(() => {
|
|
|
6892
7521
|
alignItems: "center"
|
|
6893
7522
|
}
|
|
6894
7523
|
},
|
|
6895
|
-
/* @__PURE__ */
|
|
6896
|
-
/* @__PURE__ */
|
|
6897
|
-
|
|
7524
|
+
/* @__PURE__ */ React111.createElement(PromotionTrigger, { ref: triggerRef, promotionKey: "attributes", trackingData: TRACKING_DATA2 }),
|
|
7525
|
+
/* @__PURE__ */ React111.createElement(import_ui95.Tooltip, { title: ARIA_LABEL2, placement: "top" }, /* @__PURE__ */ React111.createElement(
|
|
7526
|
+
import_icons37.PlusIcon,
|
|
6898
7527
|
{
|
|
6899
7528
|
"aria-label": ARIA_LABEL2,
|
|
6900
7529
|
fontSize: "tiny",
|
|
@@ -6907,22 +7536,22 @@ var AttributesControl = createControl(() => {
|
|
|
6907
7536
|
});
|
|
6908
7537
|
|
|
6909
7538
|
// src/components/icon-buttons/clear-icon-button.tsx
|
|
6910
|
-
var
|
|
6911
|
-
var
|
|
6912
|
-
var
|
|
6913
|
-
var CustomIconButton = (0,
|
|
7539
|
+
var React112 = __toESM(require("react"));
|
|
7540
|
+
var import_icons38 = require("@elementor/icons");
|
|
7541
|
+
var import_ui96 = require("@elementor/ui");
|
|
7542
|
+
var CustomIconButton = (0, import_ui96.styled)(import_ui96.IconButton)(({ theme }) => ({
|
|
6914
7543
|
width: theme.spacing(2.5),
|
|
6915
7544
|
height: theme.spacing(2.5)
|
|
6916
7545
|
}));
|
|
6917
|
-
var ClearIconButton = ({ tooltipText, onClick, disabled, size = "tiny" }) => /* @__PURE__ */
|
|
7546
|
+
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 })));
|
|
6918
7547
|
|
|
6919
7548
|
// src/components/repeater/repeater.tsx
|
|
6920
|
-
var
|
|
6921
|
-
var
|
|
6922
|
-
var
|
|
6923
|
-
var
|
|
6924
|
-
var
|
|
6925
|
-
var
|
|
7549
|
+
var React113 = __toESM(require("react"));
|
|
7550
|
+
var import_react62 = require("react");
|
|
7551
|
+
var import_icons39 = require("@elementor/icons");
|
|
7552
|
+
var import_ui97 = require("@elementor/ui");
|
|
7553
|
+
var import_i18n55 = require("@wordpress/i18n");
|
|
7554
|
+
var SIZE11 = "tiny";
|
|
6926
7555
|
var EMPTY_OPEN_ITEM2 = -1;
|
|
6927
7556
|
var Repeater3 = ({
|
|
6928
7557
|
label,
|
|
@@ -6939,7 +7568,7 @@ var Repeater3 = ({
|
|
|
6939
7568
|
openItem: initialOpenItem = EMPTY_OPEN_ITEM2,
|
|
6940
7569
|
isSortable = true
|
|
6941
7570
|
}) => {
|
|
6942
|
-
const [openItem, setOpenItem] = (0,
|
|
7571
|
+
const [openItem, setOpenItem] = (0, import_react62.useState)(initialOpenItem);
|
|
6943
7572
|
const uniqueKeys = items2.map(
|
|
6944
7573
|
(item, index) => isSortable && "getId" in itemSettings ? itemSettings.getId({ item, index }) : String(index)
|
|
6945
7574
|
);
|
|
@@ -7002,41 +7631,41 @@ var Repeater3 = ({
|
|
|
7002
7631
|
};
|
|
7003
7632
|
const isButtonDisabled = disabled || disableAddItemButton;
|
|
7004
7633
|
const shouldShowInfotip = isButtonDisabled && addButtonInfotipContent;
|
|
7005
|
-
const addButton = /* @__PURE__ */
|
|
7006
|
-
|
|
7634
|
+
const addButton = /* @__PURE__ */ React113.createElement(
|
|
7635
|
+
import_ui97.IconButton,
|
|
7007
7636
|
{
|
|
7008
|
-
size:
|
|
7637
|
+
size: SIZE11,
|
|
7009
7638
|
sx: {
|
|
7010
7639
|
ml: "auto"
|
|
7011
7640
|
},
|
|
7012
7641
|
disabled: isButtonDisabled,
|
|
7013
7642
|
onClick: addRepeaterItem,
|
|
7014
|
-
"aria-label": (0,
|
|
7643
|
+
"aria-label": (0, import_i18n55.__)("Add item", "elementor")
|
|
7015
7644
|
},
|
|
7016
|
-
/* @__PURE__ */
|
|
7645
|
+
/* @__PURE__ */ React113.createElement(import_icons39.PlusIcon, { fontSize: SIZE11 })
|
|
7017
7646
|
);
|
|
7018
|
-
return /* @__PURE__ */
|
|
7019
|
-
|
|
7647
|
+
return /* @__PURE__ */ React113.createElement(SectionContent, { gap: 2 }, /* @__PURE__ */ React113.createElement(RepeaterHeader, { label, adornment: ControlAdornments }, shouldShowInfotip ? /* @__PURE__ */ React113.createElement(
|
|
7648
|
+
import_ui97.Infotip,
|
|
7020
7649
|
{
|
|
7021
7650
|
placement: "right",
|
|
7022
7651
|
content: addButtonInfotipContent,
|
|
7023
7652
|
color: "secondary",
|
|
7024
7653
|
slotProps: { popper: { sx: { width: 300 } } }
|
|
7025
7654
|
},
|
|
7026
|
-
/* @__PURE__ */
|
|
7027
|
-
) : addButton), 0 < uniqueKeys.length && /* @__PURE__ */
|
|
7655
|
+
/* @__PURE__ */ React113.createElement(import_ui97.Box, { sx: { ...isButtonDisabled ? { cursor: "not-allowed" } : {} } }, addButton)
|
|
7656
|
+
) : addButton), 0 < uniqueKeys.length && /* @__PURE__ */ React113.createElement(SortableProvider, { value: uniqueKeys, onChange: onChangeOrder }, uniqueKeys.map((key) => {
|
|
7028
7657
|
const index = uniqueKeys.indexOf(key);
|
|
7029
7658
|
const value = items2[index];
|
|
7030
7659
|
if (!value) {
|
|
7031
7660
|
return null;
|
|
7032
7661
|
}
|
|
7033
|
-
return /* @__PURE__ */
|
|
7662
|
+
return /* @__PURE__ */ React113.createElement(SortableItem, { id: key, key: `sortable-${key}`, disabled: !isSortable }, /* @__PURE__ */ React113.createElement(
|
|
7034
7663
|
RepeaterItem,
|
|
7035
7664
|
{
|
|
7036
7665
|
disabled,
|
|
7037
7666
|
propDisabled: value?.disabled,
|
|
7038
|
-
label: /* @__PURE__ */
|
|
7039
|
-
startIcon: /* @__PURE__ */
|
|
7667
|
+
label: /* @__PURE__ */ React113.createElement(RepeaterItemLabelSlot, { value }, /* @__PURE__ */ React113.createElement(itemSettings.Label, { value, index })),
|
|
7668
|
+
startIcon: /* @__PURE__ */ React113.createElement(RepeaterItemIconSlot, { value }, /* @__PURE__ */ React113.createElement(itemSettings.Icon, { value })),
|
|
7040
7669
|
removeItem: () => removeRepeaterItem(index),
|
|
7041
7670
|
duplicateItem: () => duplicateRepeaterItem(index),
|
|
7042
7671
|
toggleDisableItem: () => toggleDisableRepeaterItem(index),
|
|
@@ -7048,7 +7677,7 @@ var Repeater3 = ({
|
|
|
7048
7677
|
actions: itemSettings.actions,
|
|
7049
7678
|
value
|
|
7050
7679
|
},
|
|
7051
|
-
(props) => /* @__PURE__ */
|
|
7680
|
+
(props) => /* @__PURE__ */ React113.createElement(
|
|
7052
7681
|
itemSettings.Content,
|
|
7053
7682
|
{
|
|
7054
7683
|
...props,
|
|
@@ -7078,27 +7707,27 @@ var RepeaterItem = ({
|
|
|
7078
7707
|
value
|
|
7079
7708
|
}) => {
|
|
7080
7709
|
const { popoverState, popoverProps, ref, setRef } = usePopover(openOnMount, onOpen);
|
|
7081
|
-
const duplicateLabel = (0,
|
|
7082
|
-
const toggleLabel = propDisabled ? (0,
|
|
7083
|
-
const removeLabel = (0,
|
|
7084
|
-
return /* @__PURE__ */
|
|
7710
|
+
const duplicateLabel = (0, import_i18n55.__)("Duplicate", "elementor");
|
|
7711
|
+
const toggleLabel = propDisabled ? (0, import_i18n55.__)("Show", "elementor") : (0, import_i18n55.__)("Hide", "elementor");
|
|
7712
|
+
const removeLabel = (0, import_i18n55.__)("Remove", "elementor");
|
|
7713
|
+
return /* @__PURE__ */ React113.createElement(React113.Fragment, null, /* @__PURE__ */ React113.createElement(
|
|
7085
7714
|
RepeaterTag,
|
|
7086
7715
|
{
|
|
7087
7716
|
disabled,
|
|
7088
7717
|
label,
|
|
7089
7718
|
ref: setRef,
|
|
7090
|
-
"aria-label": (0,
|
|
7091
|
-
...(0,
|
|
7719
|
+
"aria-label": (0, import_i18n55.__)("Open item", "elementor"),
|
|
7720
|
+
...(0, import_ui97.bindTrigger)(popoverState),
|
|
7092
7721
|
startIcon,
|
|
7093
|
-
actions: /* @__PURE__ */
|
|
7722
|
+
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 }))))
|
|
7094
7723
|
}
|
|
7095
|
-
), /* @__PURE__ */
|
|
7724
|
+
), /* @__PURE__ */ React113.createElement(RepeaterPopover, { width: ref?.getBoundingClientRect().width, ...popoverProps, anchorEl: ref }, /* @__PURE__ */ React113.createElement(import_ui97.Box, null, children({ anchorEl: ref }))));
|
|
7096
7725
|
};
|
|
7097
7726
|
var usePopover = (openOnMount, onOpen) => {
|
|
7098
|
-
const [ref, setRef] = (0,
|
|
7099
|
-
const popoverState = (0,
|
|
7100
|
-
const popoverProps = (0,
|
|
7101
|
-
(0,
|
|
7727
|
+
const [ref, setRef] = (0, import_react62.useState)(null);
|
|
7728
|
+
const popoverState = (0, import_ui97.usePopupState)({ variant: "popover" });
|
|
7729
|
+
const popoverProps = (0, import_ui97.bindPopover)(popoverState);
|
|
7730
|
+
(0, import_react62.useEffect)(() => {
|
|
7102
7731
|
if (openOnMount && ref) {
|
|
7103
7732
|
popoverState.open(ref);
|
|
7104
7733
|
onOpen?.();
|
|
@@ -7113,20 +7742,20 @@ var usePopover = (openOnMount, onOpen) => {
|
|
|
7113
7742
|
};
|
|
7114
7743
|
|
|
7115
7744
|
// src/components/inline-editor-toolbar.tsx
|
|
7116
|
-
var
|
|
7117
|
-
var
|
|
7745
|
+
var React115 = __toESM(require("react"));
|
|
7746
|
+
var import_react64 = require("react");
|
|
7118
7747
|
var import_editor_elements6 = require("@elementor/editor-elements");
|
|
7119
|
-
var
|
|
7120
|
-
var
|
|
7121
|
-
var
|
|
7122
|
-
var
|
|
7748
|
+
var import_icons41 = require("@elementor/icons");
|
|
7749
|
+
var import_ui99 = require("@elementor/ui");
|
|
7750
|
+
var import_react65 = require("@tiptap/react");
|
|
7751
|
+
var import_i18n57 = require("@wordpress/i18n");
|
|
7123
7752
|
|
|
7124
7753
|
// src/components/url-popover.tsx
|
|
7125
|
-
var
|
|
7126
|
-
var
|
|
7127
|
-
var
|
|
7128
|
-
var
|
|
7129
|
-
var
|
|
7754
|
+
var React114 = __toESM(require("react"));
|
|
7755
|
+
var import_react63 = require("react");
|
|
7756
|
+
var import_icons40 = require("@elementor/icons");
|
|
7757
|
+
var import_ui98 = require("@elementor/ui");
|
|
7758
|
+
var import_i18n56 = require("@wordpress/i18n");
|
|
7130
7759
|
var UrlPopover = ({
|
|
7131
7760
|
popupState,
|
|
7132
7761
|
restoreValue,
|
|
@@ -7136,8 +7765,8 @@ var UrlPopover = ({
|
|
|
7136
7765
|
openInNewTab,
|
|
7137
7766
|
onToggleNewTab
|
|
7138
7767
|
}) => {
|
|
7139
|
-
const inputRef = (0,
|
|
7140
|
-
(0,
|
|
7768
|
+
const inputRef = (0, import_react63.useRef)(null);
|
|
7769
|
+
(0, import_react63.useEffect)(() => {
|
|
7141
7770
|
if (popupState.isOpen) {
|
|
7142
7771
|
requestAnimationFrame(() => inputRef.current?.focus());
|
|
7143
7772
|
}
|
|
@@ -7146,57 +7775,57 @@ var UrlPopover = ({
|
|
|
7146
7775
|
restoreValue();
|
|
7147
7776
|
popupState.close();
|
|
7148
7777
|
};
|
|
7149
|
-
return /* @__PURE__ */
|
|
7150
|
-
|
|
7778
|
+
return /* @__PURE__ */ React114.createElement(
|
|
7779
|
+
import_ui98.Popover,
|
|
7151
7780
|
{
|
|
7152
7781
|
slotProps: {
|
|
7153
7782
|
paper: { sx: { borderRadius: "16px", width: anchorRef.current?.offsetWidth + "px", marginTop: -1 } }
|
|
7154
7783
|
},
|
|
7155
|
-
...(0,
|
|
7784
|
+
...(0, import_ui98.bindPopover)(popupState),
|
|
7156
7785
|
anchorOrigin: { vertical: "top", horizontal: "left" },
|
|
7157
7786
|
transformOrigin: { vertical: "top", horizontal: "left" },
|
|
7158
7787
|
onClose: handleClose
|
|
7159
7788
|
},
|
|
7160
|
-
/* @__PURE__ */
|
|
7161
|
-
|
|
7789
|
+
/* @__PURE__ */ React114.createElement(import_ui98.Stack, { direction: "row", alignItems: "center", gap: 1, sx: { p: 1.5 } }, /* @__PURE__ */ React114.createElement(
|
|
7790
|
+
import_ui98.TextField,
|
|
7162
7791
|
{
|
|
7163
7792
|
value,
|
|
7164
7793
|
onChange,
|
|
7165
7794
|
size: "tiny",
|
|
7166
7795
|
fullWidth: true,
|
|
7167
|
-
placeholder: (0,
|
|
7796
|
+
placeholder: (0, import_i18n56.__)("Type a URL", "elementor"),
|
|
7168
7797
|
inputProps: { ref: inputRef },
|
|
7169
7798
|
color: "secondary",
|
|
7170
7799
|
InputProps: { sx: { borderRadius: "8px" } },
|
|
7171
7800
|
onKeyUp: (event) => event.key === "Enter" && handleClose()
|
|
7172
7801
|
}
|
|
7173
|
-
), /* @__PURE__ */
|
|
7174
|
-
|
|
7802
|
+
), /* @__PURE__ */ React114.createElement(import_ui98.Tooltip, { title: (0, import_i18n56.__)("Open in a new tab", "elementor") }, /* @__PURE__ */ React114.createElement(
|
|
7803
|
+
import_ui98.ToggleButton,
|
|
7175
7804
|
{
|
|
7176
7805
|
size: "tiny",
|
|
7177
7806
|
value: "newTab",
|
|
7178
7807
|
selected: openInNewTab,
|
|
7179
7808
|
onClick: onToggleNewTab,
|
|
7180
|
-
"aria-label": (0,
|
|
7809
|
+
"aria-label": (0, import_i18n56.__)("Open in a new tab", "elementor"),
|
|
7181
7810
|
sx: { borderRadius: "8px" }
|
|
7182
7811
|
},
|
|
7183
|
-
/* @__PURE__ */
|
|
7812
|
+
/* @__PURE__ */ React114.createElement(import_icons40.ExternalLinkIcon, { fontSize: "tiny" })
|
|
7184
7813
|
)))
|
|
7185
7814
|
);
|
|
7186
7815
|
};
|
|
7187
7816
|
|
|
7188
7817
|
// src/components/inline-editor-toolbar.tsx
|
|
7189
7818
|
var InlineEditorToolbar = ({ editor, elementId, sx = {} }) => {
|
|
7190
|
-
const [urlValue, setUrlValue] = (0,
|
|
7191
|
-
const [openInNewTab, setOpenInNewTab] = (0,
|
|
7192
|
-
const toolbarRef = (0,
|
|
7193
|
-
const linkPopupState = (0,
|
|
7819
|
+
const [urlValue, setUrlValue] = (0, import_react64.useState)("");
|
|
7820
|
+
const [openInNewTab, setOpenInNewTab] = (0, import_react64.useState)(false);
|
|
7821
|
+
const toolbarRef = (0, import_react64.useRef)(null);
|
|
7822
|
+
const linkPopupState = (0, import_ui99.usePopupState)({ variant: "popover" });
|
|
7194
7823
|
const isElementClickable = elementId ? checkIfElementIsClickable(elementId) : false;
|
|
7195
|
-
const editorState = (0,
|
|
7824
|
+
const editorState = (0, import_react65.useEditorState)({
|
|
7196
7825
|
editor,
|
|
7197
7826
|
selector: (ctx) => possibleFormats.filter((format) => ctx.editor.isActive(format))
|
|
7198
7827
|
});
|
|
7199
|
-
const formatButtonsList = (0,
|
|
7828
|
+
const formatButtonsList = (0, import_react64.useMemo)(() => {
|
|
7200
7829
|
const buttons = Object.values(formatButtons);
|
|
7201
7830
|
if (isElementClickable) {
|
|
7202
7831
|
return buttons.filter((button) => button.action !== "link");
|
|
@@ -7233,11 +7862,11 @@ var InlineEditorToolbar = ({ editor, elementId, sx = {} }) => {
|
|
|
7233
7862
|
}
|
|
7234
7863
|
linkPopupState.close();
|
|
7235
7864
|
};
|
|
7236
|
-
|
|
7865
|
+
React115.useEffect(() => {
|
|
7237
7866
|
editor?.commands?.focus();
|
|
7238
7867
|
}, [editor]);
|
|
7239
|
-
return /* @__PURE__ */
|
|
7240
|
-
|
|
7868
|
+
return /* @__PURE__ */ React115.createElement(
|
|
7869
|
+
import_ui99.Box,
|
|
7241
7870
|
{
|
|
7242
7871
|
ref: toolbarRef,
|
|
7243
7872
|
sx: {
|
|
@@ -7253,9 +7882,9 @@ var InlineEditorToolbar = ({ editor, elementId, sx = {} }) => {
|
|
|
7253
7882
|
...sx
|
|
7254
7883
|
}
|
|
7255
7884
|
},
|
|
7256
|
-
/* @__PURE__ */
|
|
7257
|
-
/* @__PURE__ */
|
|
7258
|
-
|
|
7885
|
+
/* @__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)),
|
|
7886
|
+
/* @__PURE__ */ React115.createElement(
|
|
7887
|
+
import_ui99.ToggleButtonGroup,
|
|
7259
7888
|
{
|
|
7260
7889
|
value: editorState,
|
|
7261
7890
|
size: "tiny",
|
|
@@ -7263,7 +7892,7 @@ var InlineEditorToolbar = ({ editor, elementId, sx = {} }) => {
|
|
|
7263
7892
|
display: "flex",
|
|
7264
7893
|
gap: 0.5,
|
|
7265
7894
|
border: "none",
|
|
7266
|
-
[`& .${
|
|
7895
|
+
[`& .${import_ui99.toggleButtonGroupClasses.firstButton}, & .${import_ui99.toggleButtonGroupClasses.middleButton}, & .${import_ui99.toggleButtonGroupClasses.lastButton}`]: {
|
|
7267
7896
|
borderRadius: "8px",
|
|
7268
7897
|
border: "none",
|
|
7269
7898
|
marginLeft: 0,
|
|
@@ -7276,8 +7905,8 @@ var InlineEditorToolbar = ({ editor, elementId, sx = {} }) => {
|
|
|
7276
7905
|
}
|
|
7277
7906
|
}
|
|
7278
7907
|
},
|
|
7279
|
-
formatButtonsList.map((button) => /* @__PURE__ */
|
|
7280
|
-
|
|
7908
|
+
formatButtonsList.map((button) => /* @__PURE__ */ React115.createElement(import_ui99.Tooltip, { title: button.label, key: button.action, placement: "top" }, /* @__PURE__ */ React115.createElement(
|
|
7909
|
+
import_ui99.ToggleButton,
|
|
7281
7910
|
{
|
|
7282
7911
|
value: button.action,
|
|
7283
7912
|
"aria-label": button.label,
|
|
@@ -7294,7 +7923,7 @@ var InlineEditorToolbar = ({ editor, elementId, sx = {} }) => {
|
|
|
7294
7923
|
button.icon
|
|
7295
7924
|
)))
|
|
7296
7925
|
),
|
|
7297
|
-
/* @__PURE__ */
|
|
7926
|
+
/* @__PURE__ */ React115.createElement(
|
|
7298
7927
|
UrlPopover,
|
|
7299
7928
|
{
|
|
7300
7929
|
popupState: linkPopupState,
|
|
@@ -7317,64 +7946,64 @@ var checkIfElementIsClickable = (elementId) => {
|
|
|
7317
7946
|
};
|
|
7318
7947
|
var toolbarButtons = {
|
|
7319
7948
|
clear: {
|
|
7320
|
-
label: (0,
|
|
7321
|
-
icon: /* @__PURE__ */
|
|
7949
|
+
label: (0, import_i18n57.__)("Clear", "elementor"),
|
|
7950
|
+
icon: /* @__PURE__ */ React115.createElement(import_icons41.MinusIcon, { fontSize: "tiny" }),
|
|
7322
7951
|
action: "clear",
|
|
7323
7952
|
method: (editor) => {
|
|
7324
7953
|
editor.chain().focus().clearNodes().unsetAllMarks().run();
|
|
7325
7954
|
}
|
|
7326
7955
|
},
|
|
7327
7956
|
bold: {
|
|
7328
|
-
label: (0,
|
|
7329
|
-
icon: /* @__PURE__ */
|
|
7957
|
+
label: (0, import_i18n57.__)("Bold", "elementor"),
|
|
7958
|
+
icon: /* @__PURE__ */ React115.createElement(import_icons41.BoldIcon, { fontSize: "tiny" }),
|
|
7330
7959
|
action: "bold",
|
|
7331
7960
|
method: (editor) => {
|
|
7332
7961
|
editor.chain().focus().toggleBold().run();
|
|
7333
7962
|
}
|
|
7334
7963
|
},
|
|
7335
7964
|
italic: {
|
|
7336
|
-
label: (0,
|
|
7337
|
-
icon: /* @__PURE__ */
|
|
7965
|
+
label: (0, import_i18n57.__)("Italic", "elementor"),
|
|
7966
|
+
icon: /* @__PURE__ */ React115.createElement(import_icons41.ItalicIcon, { fontSize: "tiny" }),
|
|
7338
7967
|
action: "italic",
|
|
7339
7968
|
method: (editor) => {
|
|
7340
7969
|
editor.chain().focus().toggleItalic().run();
|
|
7341
7970
|
}
|
|
7342
7971
|
},
|
|
7343
7972
|
underline: {
|
|
7344
|
-
label: (0,
|
|
7345
|
-
icon: /* @__PURE__ */
|
|
7973
|
+
label: (0, import_i18n57.__)("Underline", "elementor"),
|
|
7974
|
+
icon: /* @__PURE__ */ React115.createElement(import_icons41.UnderlineIcon, { fontSize: "tiny" }),
|
|
7346
7975
|
action: "underline",
|
|
7347
7976
|
method: (editor) => {
|
|
7348
7977
|
editor.chain().focus().toggleUnderline().run();
|
|
7349
7978
|
}
|
|
7350
7979
|
},
|
|
7351
7980
|
strike: {
|
|
7352
|
-
label: (0,
|
|
7353
|
-
icon: /* @__PURE__ */
|
|
7981
|
+
label: (0, import_i18n57.__)("Strikethrough", "elementor"),
|
|
7982
|
+
icon: /* @__PURE__ */ React115.createElement(import_icons41.StrikethroughIcon, { fontSize: "tiny" }),
|
|
7354
7983
|
action: "strike",
|
|
7355
7984
|
method: (editor) => {
|
|
7356
7985
|
editor.chain().focus().toggleStrike().run();
|
|
7357
7986
|
}
|
|
7358
7987
|
},
|
|
7359
7988
|
superscript: {
|
|
7360
|
-
label: (0,
|
|
7361
|
-
icon: /* @__PURE__ */
|
|
7989
|
+
label: (0, import_i18n57.__)("Superscript", "elementor"),
|
|
7990
|
+
icon: /* @__PURE__ */ React115.createElement(import_icons41.SuperscriptIcon, { fontSize: "tiny" }),
|
|
7362
7991
|
action: "superscript",
|
|
7363
7992
|
method: (editor) => {
|
|
7364
7993
|
editor.chain().focus().toggleSuperscript().run();
|
|
7365
7994
|
}
|
|
7366
7995
|
},
|
|
7367
7996
|
subscript: {
|
|
7368
|
-
label: (0,
|
|
7369
|
-
icon: /* @__PURE__ */
|
|
7997
|
+
label: (0, import_i18n57.__)("Subscript", "elementor"),
|
|
7998
|
+
icon: /* @__PURE__ */ React115.createElement(import_icons41.SubscriptIcon, { fontSize: "tiny" }),
|
|
7370
7999
|
action: "subscript",
|
|
7371
8000
|
method: (editor) => {
|
|
7372
8001
|
editor.chain().focus().toggleSubscript().run();
|
|
7373
8002
|
}
|
|
7374
8003
|
},
|
|
7375
8004
|
link: {
|
|
7376
|
-
label: (0,
|
|
7377
|
-
icon: /* @__PURE__ */
|
|
8005
|
+
label: (0, import_i18n57.__)("Link", "elementor"),
|
|
8006
|
+
icon: /* @__PURE__ */ React115.createElement(import_icons41.LinkIcon, { fontSize: "tiny" }),
|
|
7378
8007
|
action: "link",
|
|
7379
8008
|
method: null
|
|
7380
8009
|
}
|
|
@@ -7383,13 +8012,13 @@ var { clear: clearButton, ...formatButtons } = toolbarButtons;
|
|
|
7383
8012
|
var possibleFormats = Object.keys(formatButtons);
|
|
7384
8013
|
|
|
7385
8014
|
// src/components/size/unstable-size-field.tsx
|
|
7386
|
-
var
|
|
7387
|
-
var
|
|
8015
|
+
var React118 = __toESM(require("react"));
|
|
8016
|
+
var import_ui101 = require("@elementor/ui");
|
|
7388
8017
|
|
|
7389
8018
|
// src/hooks/use-size-value.ts
|
|
7390
8019
|
var DEFAULT_UNIT2 = "px";
|
|
7391
|
-
var
|
|
7392
|
-
var
|
|
8020
|
+
var DEFAULT_SIZE3 = "";
|
|
8021
|
+
var useSizeValue2 = (externalValue, onChange, defaultUnit) => {
|
|
7393
8022
|
const [sizeValue, setSizeValue] = useSyncExternalState({
|
|
7394
8023
|
external: externalValue,
|
|
7395
8024
|
setExternal: (newState) => {
|
|
@@ -7398,7 +8027,7 @@ var useSizeValue = (externalValue, onChange, defaultUnit) => {
|
|
|
7398
8027
|
}
|
|
7399
8028
|
},
|
|
7400
8029
|
persistWhen: (newState) => differsFromExternal(newState, externalValue),
|
|
7401
|
-
fallback: () => ({ size:
|
|
8030
|
+
fallback: () => ({ size: DEFAULT_SIZE3, unit: defaultUnit ?? DEFAULT_UNIT2 })
|
|
7402
8031
|
});
|
|
7403
8032
|
const setSize = (value) => {
|
|
7404
8033
|
const newState = {
|
|
@@ -7426,44 +8055,44 @@ var differsFromExternal = (newState, externalState) => {
|
|
|
7426
8055
|
};
|
|
7427
8056
|
|
|
7428
8057
|
// src/components/size/unit-select.tsx
|
|
7429
|
-
var
|
|
7430
|
-
var
|
|
7431
|
-
var
|
|
7432
|
-
var
|
|
7433
|
-
var
|
|
8058
|
+
var React116 = __toESM(require("react"));
|
|
8059
|
+
var import_react66 = require("react");
|
|
8060
|
+
var import_editor_ui17 = require("@elementor/editor-ui");
|
|
8061
|
+
var import_ui100 = require("@elementor/ui");
|
|
8062
|
+
var menuItemContentStyles2 = {
|
|
7434
8063
|
display: "flex",
|
|
7435
8064
|
flexDirection: "column",
|
|
7436
8065
|
justifyContent: "center"
|
|
7437
8066
|
};
|
|
7438
8067
|
var UnitSelect = ({ value, showPrimaryColor, onClick, options }) => {
|
|
7439
|
-
const popupState = (0,
|
|
8068
|
+
const popupState = (0, import_ui100.usePopupState)({
|
|
7440
8069
|
variant: "popover",
|
|
7441
|
-
popupId: (0,
|
|
8070
|
+
popupId: (0, import_react66.useId)()
|
|
7442
8071
|
});
|
|
7443
8072
|
const handleMenuItemClick = (index) => {
|
|
7444
8073
|
onClick(options[index]);
|
|
7445
8074
|
popupState.close();
|
|
7446
8075
|
};
|
|
7447
|
-
return /* @__PURE__ */
|
|
7448
|
-
|
|
8076
|
+
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(
|
|
8077
|
+
import_editor_ui17.MenuListItem,
|
|
7449
8078
|
{
|
|
7450
8079
|
key: option,
|
|
7451
8080
|
onClick: () => handleMenuItemClick(index),
|
|
7452
8081
|
primaryTypographyProps: {
|
|
7453
8082
|
variant: "caption",
|
|
7454
8083
|
sx: {
|
|
7455
|
-
...
|
|
8084
|
+
...menuItemContentStyles2,
|
|
7456
8085
|
lineHeight: "1"
|
|
7457
8086
|
}
|
|
7458
8087
|
},
|
|
7459
8088
|
menuItemTextProps: {
|
|
7460
|
-
sx:
|
|
8089
|
+
sx: menuItemContentStyles2
|
|
7461
8090
|
}
|
|
7462
8091
|
},
|
|
7463
8092
|
option.toUpperCase()
|
|
7464
8093
|
))));
|
|
7465
8094
|
};
|
|
7466
|
-
var
|
|
8095
|
+
var StyledButton3 = (0, import_ui100.styled)(import_ui100.Button, {
|
|
7467
8096
|
shouldForwardProp: (prop) => prop !== "isPrimaryColor"
|
|
7468
8097
|
})(({ isPrimaryColor, theme }) => ({
|
|
7469
8098
|
color: isPrimaryColor ? theme.palette.text.primary : theme.palette.text.tertiary,
|
|
@@ -7473,11 +8102,11 @@ var StyledButton2 = (0, import_ui96.styled)(import_ui96.Button, {
|
|
|
7473
8102
|
}));
|
|
7474
8103
|
|
|
7475
8104
|
// src/components/size/unstable-size-input.tsx
|
|
7476
|
-
var
|
|
7477
|
-
var
|
|
7478
|
-
var UnstableSizeInput = (0,
|
|
8105
|
+
var React117 = __toESM(require("react"));
|
|
8106
|
+
var import_react67 = require("react");
|
|
8107
|
+
var UnstableSizeInput = (0, import_react67.forwardRef)(
|
|
7479
8108
|
({ type, value, onChange, onKeyDown, onKeyUp, InputProps, onBlur, focused, disabled }, ref) => {
|
|
7480
|
-
return /* @__PURE__ */
|
|
8109
|
+
return /* @__PURE__ */ React117.createElement(
|
|
7481
8110
|
NumberInput,
|
|
7482
8111
|
{
|
|
7483
8112
|
ref,
|
|
@@ -7492,12 +8121,12 @@ var UnstableSizeInput = (0, import_react62.forwardRef)(
|
|
|
7492
8121
|
onInput: onChange,
|
|
7493
8122
|
onBlur,
|
|
7494
8123
|
InputProps,
|
|
7495
|
-
sx:
|
|
8124
|
+
sx: getCursorStyle2(InputProps?.readOnly ?? false)
|
|
7496
8125
|
}
|
|
7497
8126
|
);
|
|
7498
8127
|
}
|
|
7499
8128
|
);
|
|
7500
|
-
var
|
|
8129
|
+
var getCursorStyle2 = (readOnly) => ({
|
|
7501
8130
|
input: { cursor: readOnly ? "default !important" : void 0 }
|
|
7502
8131
|
});
|
|
7503
8132
|
|
|
@@ -7511,11 +8140,11 @@ var UnstableSizeField = ({
|
|
|
7511
8140
|
defaultUnit,
|
|
7512
8141
|
startIcon
|
|
7513
8142
|
}) => {
|
|
7514
|
-
const { size, unit, setSize, setUnit } =
|
|
7515
|
-
const
|
|
8143
|
+
const { size, unit, setSize, setUnit } = useSizeValue2(value, onChange, defaultUnit);
|
|
8144
|
+
const shouldHighlightUnit2 = () => {
|
|
7516
8145
|
return hasValue(size);
|
|
7517
8146
|
};
|
|
7518
|
-
return /* @__PURE__ */
|
|
8147
|
+
return /* @__PURE__ */ React118.createElement(
|
|
7519
8148
|
UnstableSizeInput,
|
|
7520
8149
|
{
|
|
7521
8150
|
type: "number",
|
|
@@ -7524,14 +8153,14 @@ var UnstableSizeField = ({
|
|
|
7524
8153
|
onChange: (event) => setSize(event.target.value),
|
|
7525
8154
|
InputProps: {
|
|
7526
8155
|
...InputProps,
|
|
7527
|
-
startAdornment: startIcon && /* @__PURE__ */
|
|
7528
|
-
endAdornment: /* @__PURE__ */
|
|
8156
|
+
startAdornment: startIcon && /* @__PURE__ */ React118.createElement(import_ui101.InputAdornment, { position: "start" }, startIcon),
|
|
8157
|
+
endAdornment: /* @__PURE__ */ React118.createElement(import_ui101.InputAdornment, { position: "end" }, /* @__PURE__ */ React118.createElement(
|
|
7529
8158
|
UnitSelect,
|
|
7530
8159
|
{
|
|
7531
8160
|
options: units2,
|
|
7532
8161
|
value: unit,
|
|
7533
8162
|
onClick: setUnit,
|
|
7534
|
-
showPrimaryColor:
|
|
8163
|
+
showPrimaryColor: shouldHighlightUnit2()
|
|
7535
8164
|
}
|
|
7536
8165
|
))
|
|
7537
8166
|
}
|
|
@@ -7543,7 +8172,7 @@ var hasValue = (value) => {
|
|
|
7543
8172
|
};
|
|
7544
8173
|
|
|
7545
8174
|
// src/hooks/use-font-families.ts
|
|
7546
|
-
var
|
|
8175
|
+
var import_react68 = require("react");
|
|
7547
8176
|
var import_editor_v1_adapters = require("@elementor/editor-v1-adapters");
|
|
7548
8177
|
var getFontControlConfig = () => {
|
|
7549
8178
|
const { controls } = (0, import_editor_v1_adapters.getElementorConfig)();
|
|
@@ -7551,7 +8180,7 @@ var getFontControlConfig = () => {
|
|
|
7551
8180
|
};
|
|
7552
8181
|
var useFontFamilies = () => {
|
|
7553
8182
|
const { groups, options } = getFontControlConfig();
|
|
7554
|
-
return (0,
|
|
8183
|
+
return (0, import_react68.useMemo)(() => {
|
|
7555
8184
|
if (!groups || !options) {
|
|
7556
8185
|
return [];
|
|
7557
8186
|
}
|
|
@@ -7617,8 +8246,11 @@ var useFontFamilies = () => {
|
|
|
7617
8246
|
Repeater,
|
|
7618
8247
|
SelectControl,
|
|
7619
8248
|
SelectControlWrapper,
|
|
8249
|
+
SizeComponent,
|
|
7620
8250
|
SizeControl,
|
|
7621
8251
|
StrokeControl,
|
|
8252
|
+
StyledToggleButton,
|
|
8253
|
+
StyledToggleButtonGroup,
|
|
7622
8254
|
SvgMediaControl,
|
|
7623
8255
|
SwitchControl,
|
|
7624
8256
|
TextAreaControl,
|
|
@@ -7628,6 +8260,7 @@ var useFontFamilies = () => {
|
|
|
7628
8260
|
TransformRepeaterControl,
|
|
7629
8261
|
TransformSettingsControl,
|
|
7630
8262
|
TransitionRepeaterControl,
|
|
8263
|
+
UnstableSizeControl,
|
|
7631
8264
|
UnstableSizeField,
|
|
7632
8265
|
UrlControl,
|
|
7633
8266
|
VideoMediaControl,
|