@elementor/editor-controls 4.0.0-573 → 4.0.0-591

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.mjs CHANGED
@@ -6231,7 +6231,7 @@ var DateTimeControl = createControl(({ inputDisabled }) => {
6231
6231
  // src/controls/inline-editing-control.tsx
6232
6232
  import * as React100 from "react";
6233
6233
  import { useCallback as useCallback3, useEffect as useEffect12, useMemo as useMemo15 } from "react";
6234
- import { htmlV2PropTypeUtil, parseHtmlChildren } from "@elementor/editor-props";
6234
+ import { htmlV3PropTypeUtil, parseHtmlChildren, stringPropTypeUtil as stringPropTypeUtil16 } from "@elementor/editor-props";
6235
6235
  import { Box as Box23 } from "@elementor/ui";
6236
6236
  import { debounce as debounce4 } from "@elementor/utils";
6237
6237
 
@@ -6416,13 +6416,13 @@ var InlineEditingControl = createControl(
6416
6416
  attributes,
6417
6417
  props
6418
6418
  }) => {
6419
- const { value, setValue } = useBoundProp(htmlV2PropTypeUtil);
6420
- const content = value?.content ?? "";
6419
+ const { value, setValue } = useBoundProp(htmlV3PropTypeUtil);
6420
+ const content = stringPropTypeUtil16.extract(value?.content ?? null) ?? "";
6421
6421
  const debouncedParse = useMemo15(
6422
6422
  () => debounce4((html) => {
6423
6423
  const parsed = parseHtmlChildren(html);
6424
6424
  setValue({
6425
- content: parsed.content || null,
6425
+ content: parsed.content ? stringPropTypeUtil16.create(parsed.content) : null,
6426
6426
  children: parsed.children
6427
6427
  });
6428
6428
  }, CHILDREN_PARSE_DEBOUNCE_MS),
@@ -6432,7 +6432,7 @@ var InlineEditingControl = createControl(
6432
6432
  (newValue) => {
6433
6433
  const html = newValue ?? "";
6434
6434
  setValue({
6435
- content: html || null,
6435
+ content: html ? stringPropTypeUtil16.create(html) : null,
6436
6436
  children: value?.children ?? []
6437
6437
  });
6438
6438
  debouncedParse(html);
@@ -7182,7 +7182,9 @@ import * as React111 from "react";
7182
7182
  import { InputAdornment as InputAdornment5 } from "@elementor/ui";
7183
7183
 
7184
7184
  // src/hooks/use-size-value.ts
7185
- var useSizeValue = (externalValue, onChange, defaultValue) => {
7185
+ var DEFAULT_UNIT2 = "px";
7186
+ var DEFAULT_SIZE2 = "";
7187
+ var useSizeValue = (externalValue, onChange, defaultUnit) => {
7186
7188
  const [sizeValue, setSizeValue] = useSyncExternalState({
7187
7189
  external: externalValue,
7188
7190
  setExternal: (newState) => {
@@ -7191,7 +7193,7 @@ var useSizeValue = (externalValue, onChange, defaultValue) => {
7191
7193
  }
7192
7194
  },
7193
7195
  persistWhen: (newState) => differsFromExternal(newState, externalValue),
7194
- fallback: () => defaultValue
7196
+ fallback: () => ({ size: DEFAULT_SIZE2, unit: defaultUnit ?? DEFAULT_UNIT2 })
7195
7197
  });
7196
7198
  const setSize = (value) => {
7197
7199
  const newState = {
@@ -7215,7 +7217,7 @@ var useSizeValue = (externalValue, onChange, defaultValue) => {
7215
7217
  };
7216
7218
  };
7217
7219
  var differsFromExternal = (newState, externalState) => {
7218
- return newState.size !== externalState.size || newState.unit !== externalState.unit;
7220
+ return newState?.size !== externalState?.size || newState?.unit !== externalState?.unit;
7219
7221
  };
7220
7222
 
7221
7223
  // src/components/size/unit-select.tsx
@@ -7295,22 +7297,16 @@ var getCursorStyle = (readOnly) => ({
7295
7297
  });
7296
7298
 
7297
7299
  // src/components/size/unstable-size-field.tsx
7298
- var DEFAULT_VALUE = {
7299
- unit: "px",
7300
- size: 0
7301
- };
7302
7300
  var UnstableSizeField = ({
7303
7301
  value,
7304
7302
  InputProps,
7305
- defaultValue,
7306
7303
  onChange,
7307
7304
  onBlur,
7308
- units: units2
7305
+ units: units2,
7306
+ defaultUnit,
7307
+ startIcon
7309
7308
  }) => {
7310
- const { size, unit, setSize, setUnit } = useSizeValue(value, onChange, {
7311
- ...DEFAULT_VALUE,
7312
- ...defaultValue
7313
- });
7309
+ const { size, unit, setSize, setUnit } = useSizeValue(value, onChange, defaultUnit);
7314
7310
  const shouldHighlightUnit = () => {
7315
7311
  return hasValue(size);
7316
7312
  };
@@ -7323,6 +7319,7 @@ var UnstableSizeField = ({
7323
7319
  onChange: (event) => setSize(event.target.value),
7324
7320
  InputProps: {
7325
7321
  ...InputProps,
7322
+ startAdornment: startIcon && /* @__PURE__ */ React111.createElement(InputAdornment5, { position: "start" }, startIcon),
7326
7323
  endAdornment: /* @__PURE__ */ React111.createElement(InputAdornment5, { position: "end" }, /* @__PURE__ */ React111.createElement(
7327
7324
  UnitSelect,
7328
7325
  {
@@ -7408,6 +7405,7 @@ export {
7408
7405
  LinkControl,
7409
7406
  LinkedDimensionsControl,
7410
7407
  NumberControl,
7408
+ NumberInput,
7411
7409
  PopoverContent,
7412
7410
  PopoverGridContainer,
7413
7411
  PositionControl,