@elementor/editor-controls 4.1.0-725 → 4.1.0-727
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 +2 -3
- package/dist/index.d.ts +2 -3
- package/dist/index.js +27 -35
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +27 -35
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -15
- package/src/controls/size-control/size-component.tsx +1 -8
- package/src/controls/size-control/size-field.tsx +14 -2
- package/src/controls/size-control/ui/unit-selector.tsx +11 -6
- package/src/controls/size-control/unstable-size-control.tsx +1 -6
- package/src/controls/size-control/utils/resolve-bound-prop-value.ts +0 -17
- package/src/controls/size-control/utils/has-size-value.ts +0 -5
package/dist/index.d.mts
CHANGED
|
@@ -666,7 +666,7 @@ type UnitSelectorProps<T extends string> = {
|
|
|
666
666
|
options: T[];
|
|
667
667
|
value: T;
|
|
668
668
|
onSelect: (value: T) => void;
|
|
669
|
-
|
|
669
|
+
isUnitHighlighted: boolean;
|
|
670
670
|
menuItemsAttributes?: {
|
|
671
671
|
[key in T]?: Record<string, unknown>;
|
|
672
672
|
};
|
|
@@ -698,12 +698,11 @@ type SizeValue = SizePropValue['value'];
|
|
|
698
698
|
type SizeUnit = SizePropValue['value']['unit'];
|
|
699
699
|
type Props$1 = SizeFieldProps<SizeValue, SizeUnit> & {
|
|
700
700
|
anchorRef?: RefObject<HTMLDivElement | null>;
|
|
701
|
-
isUnitActive?: boolean;
|
|
702
701
|
SizeFieldWrapper?: React$1.ComponentType<{
|
|
703
702
|
children: React$1.ReactNode;
|
|
704
703
|
}>;
|
|
705
704
|
};
|
|
706
|
-
declare const SizeComponent: ({ anchorRef,
|
|
705
|
+
declare const SizeComponent: ({ anchorRef, SizeFieldWrapper, ...sizeFieldProps }: Props$1) => React$1.JSX.Element;
|
|
707
706
|
|
|
708
707
|
type AnyComponentType = ComponentType<any>;
|
|
709
708
|
declare const brandSymbol: unique symbol;
|
package/dist/index.d.ts
CHANGED
|
@@ -666,7 +666,7 @@ type UnitSelectorProps<T extends string> = {
|
|
|
666
666
|
options: T[];
|
|
667
667
|
value: T;
|
|
668
668
|
onSelect: (value: T) => void;
|
|
669
|
-
|
|
669
|
+
isUnitHighlighted: boolean;
|
|
670
670
|
menuItemsAttributes?: {
|
|
671
671
|
[key in T]?: Record<string, unknown>;
|
|
672
672
|
};
|
|
@@ -698,12 +698,11 @@ type SizeValue = SizePropValue['value'];
|
|
|
698
698
|
type SizeUnit = SizePropValue['value']['unit'];
|
|
699
699
|
type Props$1 = SizeFieldProps<SizeValue, SizeUnit> & {
|
|
700
700
|
anchorRef?: RefObject<HTMLDivElement | null>;
|
|
701
|
-
isUnitActive?: boolean;
|
|
702
701
|
SizeFieldWrapper?: React$1.ComponentType<{
|
|
703
702
|
children: React$1.ReactNode;
|
|
704
703
|
}>;
|
|
705
704
|
};
|
|
706
|
-
declare const SizeComponent: ({ anchorRef,
|
|
705
|
+
declare const SizeComponent: ({ anchorRef, SizeFieldWrapper, ...sizeFieldProps }: Props$1) => React$1.JSX.Element;
|
|
707
706
|
|
|
708
707
|
type AnyComponentType = ComponentType<any>;
|
|
709
708
|
declare const brandSymbol: unique symbol;
|
package/dist/index.js
CHANGED
|
@@ -7030,7 +7030,7 @@ var menuItemContentStyles = {
|
|
|
7030
7030
|
};
|
|
7031
7031
|
var UnitSelector = ({
|
|
7032
7032
|
value,
|
|
7033
|
-
|
|
7033
|
+
isUnitHighlighted,
|
|
7034
7034
|
onSelect,
|
|
7035
7035
|
options,
|
|
7036
7036
|
disabled,
|
|
@@ -7045,7 +7045,16 @@ var UnitSelector = ({
|
|
|
7045
7045
|
onSelect(option);
|
|
7046
7046
|
popupState.close();
|
|
7047
7047
|
};
|
|
7048
|
-
return /* @__PURE__ */ React104.createElement(React104.Fragment, null, /* @__PURE__ */ React104.createElement(
|
|
7048
|
+
return /* @__PURE__ */ React104.createElement(React104.Fragment, null, /* @__PURE__ */ React104.createElement(
|
|
7049
|
+
StyledButton2,
|
|
7050
|
+
{
|
|
7051
|
+
isHighlighted: isUnitHighlighted,
|
|
7052
|
+
disabled,
|
|
7053
|
+
size: "small",
|
|
7054
|
+
...(0, import_ui89.bindTrigger)(popupState)
|
|
7055
|
+
},
|
|
7056
|
+
optionLabelOverrides[value] ?? value
|
|
7057
|
+
), /* @__PURE__ */ React104.createElement(import_ui89.Menu, { MenuListProps: { dense: true }, ...(0, import_ui89.bindMenu)(popupState) }, options.map((option) => /* @__PURE__ */ React104.createElement(
|
|
7049
7058
|
import_editor_ui14.MenuListItem,
|
|
7050
7059
|
{
|
|
7051
7060
|
key: option,
|
|
@@ -7066,19 +7075,14 @@ var UnitSelector = ({
|
|
|
7066
7075
|
))));
|
|
7067
7076
|
};
|
|
7068
7077
|
var StyledButton2 = (0, import_ui89.styled)(import_ui89.Button, {
|
|
7069
|
-
shouldForwardProp: (prop) => prop !== "
|
|
7070
|
-
})(({
|
|
7071
|
-
color:
|
|
7078
|
+
shouldForwardProp: (prop) => prop !== "isHighlighted"
|
|
7079
|
+
})(({ isHighlighted, theme }) => ({
|
|
7080
|
+
color: isHighlighted ? theme.palette.text.primary : theme.palette.text.tertiary,
|
|
7072
7081
|
font: "inherit",
|
|
7073
7082
|
minWidth: "initial",
|
|
7074
7083
|
textTransform: "uppercase"
|
|
7075
7084
|
}));
|
|
7076
7085
|
|
|
7077
|
-
// src/controls/size-control/utils/has-size-value.ts
|
|
7078
|
-
var hasSizeValue = (size) => {
|
|
7079
|
-
return Boolean(size) || size === 0;
|
|
7080
|
-
};
|
|
7081
|
-
|
|
7082
7086
|
// src/controls/size-control/size-field.tsx
|
|
7083
7087
|
var UNIT_DISPLAY_LABELS_OVERRIDES = {
|
|
7084
7088
|
custom: /* @__PURE__ */ React105.createElement(import_icons34.MathFunctionIcon, { fontSize: "tiny" })
|
|
@@ -7138,7 +7142,7 @@ var SizeField = ({
|
|
|
7138
7142
|
options: units2,
|
|
7139
7143
|
value: unit,
|
|
7140
7144
|
onSelect: handleUnitChange,
|
|
7141
|
-
|
|
7145
|
+
isUnitHighlighted: shouldHighlightUnit({ size, unit }),
|
|
7142
7146
|
...unitSelectorProps,
|
|
7143
7147
|
optionLabelOverrides: UNIT_DISPLAY_LABELS_OVERRIDES
|
|
7144
7148
|
}
|
|
@@ -7148,6 +7152,15 @@ var SizeField = ({
|
|
|
7148
7152
|
}
|
|
7149
7153
|
);
|
|
7150
7154
|
};
|
|
7155
|
+
var shouldHighlightUnit = (value) => {
|
|
7156
|
+
if (!value) {
|
|
7157
|
+
return false;
|
|
7158
|
+
}
|
|
7159
|
+
if (value.unit === EXTENDED_UNITS.auto) {
|
|
7160
|
+
return true;
|
|
7161
|
+
}
|
|
7162
|
+
return Boolean(value.size) || value.size === 0;
|
|
7163
|
+
};
|
|
7151
7164
|
|
|
7152
7165
|
// src/controls/size-control/ui/text-field-popover.tsx
|
|
7153
7166
|
var React106 = __toESM(require("react"));
|
|
@@ -7221,12 +7234,7 @@ var TextFieldPopover2 = ({ popupState, anchorRef, value, onChange, onClose }) =>
|
|
|
7221
7234
|
};
|
|
7222
7235
|
|
|
7223
7236
|
// src/controls/size-control/size-component.tsx
|
|
7224
|
-
var SizeComponent = ({
|
|
7225
|
-
anchorRef,
|
|
7226
|
-
isUnitActive,
|
|
7227
|
-
SizeFieldWrapper = React107.Fragment,
|
|
7228
|
-
...sizeFieldProps
|
|
7229
|
-
}) => {
|
|
7237
|
+
var SizeComponent = ({ anchorRef, SizeFieldWrapper = React107.Fragment, ...sizeFieldProps }) => {
|
|
7230
7238
|
const popupState = (0, import_ui92.usePopupState)({ variant: "popover" });
|
|
7231
7239
|
const activeBreakpoint = (0, import_editor_responsive4.useActiveBreakpoint)();
|
|
7232
7240
|
const isCustomUnit = sizeFieldProps?.value?.unit === EXTENDED_UNITS.custom;
|
|
@@ -7266,8 +7274,7 @@ var SizeComponent = ({
|
|
|
7266
7274
|
onClick: handleSizeFieldClick
|
|
7267
7275
|
},
|
|
7268
7276
|
unitSelectorProps: {
|
|
7269
|
-
menuItemsAttributes: hasCustomUnitOption ? { custom: popupAttributes } : void 0
|
|
7270
|
-
isActive: isUnitActive
|
|
7277
|
+
menuItemsAttributes: hasCustomUnitOption ? { custom: popupAttributes } : void 0
|
|
7271
7278
|
},
|
|
7272
7279
|
...sizeFieldProps
|
|
7273
7280
|
}
|
|
@@ -7295,7 +7302,6 @@ var resolveBoundPropValue = (value, boundPropPlaceholder, propPlaceholder) => {
|
|
|
7295
7302
|
}
|
|
7296
7303
|
return {
|
|
7297
7304
|
sizeValue,
|
|
7298
|
-
isUnitHighlighted: shouldHighlightUnit(value),
|
|
7299
7305
|
placeholder: resolvePlaceholder(propPlaceholder, boundPropPlaceholder)
|
|
7300
7306
|
};
|
|
7301
7307
|
};
|
|
@@ -7319,15 +7325,6 @@ var resolvePlaceholder = (propPlaceholder, boundPropPlaceholder) => {
|
|
|
7319
7325
|
}
|
|
7320
7326
|
return size;
|
|
7321
7327
|
};
|
|
7322
|
-
var shouldHighlightUnit = (value) => {
|
|
7323
|
-
if (!value) {
|
|
7324
|
-
return false;
|
|
7325
|
-
}
|
|
7326
|
-
if (value.unit === EXTENDED_UNITS.auto) {
|
|
7327
|
-
return true;
|
|
7328
|
-
}
|
|
7329
|
-
return hasSizeValue(value.size);
|
|
7330
|
-
};
|
|
7331
7328
|
|
|
7332
7329
|
// src/controls/size-control/utils/settings/get-prop-type-settings.ts
|
|
7333
7330
|
var getPropTypeSettings = (propType) => {
|
|
@@ -7375,11 +7372,7 @@ var UnstableSizeControl = createControl(
|
|
|
7375
7372
|
placeholder: boundPropPlaceholder,
|
|
7376
7373
|
restoreValue
|
|
7377
7374
|
} = useBoundProp(import_editor_props56.sizePropTypeUtil);
|
|
7378
|
-
const { sizeValue,
|
|
7379
|
-
value,
|
|
7380
|
-
boundPropPlaceholder,
|
|
7381
|
-
propPlaceholder
|
|
7382
|
-
);
|
|
7375
|
+
const { sizeValue, placeholder } = resolveBoundPropValue(value, boundPropPlaceholder, propPlaceholder);
|
|
7383
7376
|
const units2 = getSizeUnits(propType, variant);
|
|
7384
7377
|
const defaultUnit = getDefaultUnit(propType);
|
|
7385
7378
|
const handleBlur = () => {
|
|
@@ -7410,7 +7403,6 @@ var UnstableSizeControl = createControl(
|
|
|
7410
7403
|
anchorRef,
|
|
7411
7404
|
placeholder,
|
|
7412
7405
|
defaultUnit,
|
|
7413
|
-
isUnitActive: isUnitHighlighted,
|
|
7414
7406
|
onBlur: handleBlur,
|
|
7415
7407
|
setValue: handleChange,
|
|
7416
7408
|
SizeFieldWrapper: ControlActions,
|