@wix/editor-react-components 1.2861.0 → 1.2862.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.
@@ -7,7 +7,7 @@ import { d as directionStyles } from "../chunks/direction.module.js";
7
7
  import { p as presetWrapperStyles } from "../chunks/presetWrapper.module.js";
8
8
  import { a as getDataAttributes } from "../chunks/dataUtils.js";
9
9
  import { u as useCurrentLanguage } from "../chunks/useCurrentLanguage.js";
10
- import { d as defaultValues, s as selectors, T as TestIds, D as DesignStates, E as ERROR_MESSAGE_PREVIEW_TEXT } from "../chunks/constants40.js";
10
+ import { d as defaultValues, s as selectors, T as TestIds, D as DesignStates } from "../chunks/constants40.js";
11
11
  const root = "root__0DpH8";
12
12
  const field = "field__R0D8f";
13
13
  const item = "item__EzhwB";
@@ -159,7 +159,7 @@ function CheckboxComponent(props) {
159
159
  ),
160
160
  "data-testid": TestIds.errorMessage,
161
161
  id: errorMessageId,
162
- children: errorMessage2 || ERROR_MESSAGE_PREVIEW_TEXT
162
+ children: errorMessage2
163
163
  }
164
164
  )
165
165
  ]
@@ -60,7 +60,6 @@ export declare const DesignStates: {
60
60
  export declare const FunctionalStateKeys: {
61
61
  readonly previewError: "previewError";
62
62
  };
63
- export declare const ERROR_MESSAGE_PREVIEW_TEXT = "Error message";
64
63
  export declare const defaultValues: {
65
64
  readonly label: "Label";
66
65
  readonly checked: false;
@@ -59,6 +59,12 @@ export type DatePickerProps = SdkFunctionFocusableProps & SdkFunctionKeyboardPro
59
59
  * design parts are editable on the canvas. Set by the manifest `visibleState`.
60
60
  */
61
61
  previewCalendarOpen?: boolean;
62
+ /**
63
+ * Editor-only: forces the error state so the Date input's Error design state
64
+ * and the Error message part can be styled on the canvas. No message text is
65
+ * shown unless `errorMessage` is set.
66
+ */
67
+ previewError?: boolean;
62
68
  /** Accessibility attributes. `ariaLabel` labels the date picker for assistive tech. */
63
69
  a11y?: A11y;
64
70
  /** Platform-provided props. */
@@ -4351,6 +4351,7 @@ function DatePicker2(props) {
4351
4351
  direction,
4352
4352
  a11y,
4353
4353
  previewCalendarOpen,
4354
+ previewError,
4354
4355
  onValueChange = noop,
4355
4356
  onOpenChange,
4356
4357
  onKeyDown,
@@ -4368,6 +4369,8 @@ function DatePicker2(props) {
4368
4369
  const handleChange = (date) => {
4369
4370
  onValueChange(toLocalDate(date));
4370
4371
  };
4372
+ const hasError = typeof errorMessage2 !== "undefined" && errorMessage2 !== "";
4373
+ const inErrorState = hasError || Boolean(previewError);
4371
4374
  const handleKeyDown = onKeyDown && ((event) => {
4372
4375
  const wasPrevented = event.defaultPrevented;
4373
4376
  onKeyDown(event);
@@ -4412,7 +4415,7 @@ function DatePicker2(props) {
4412
4415
  onChange: handleChange,
4413
4416
  isDisabled: disabled,
4414
4417
  isReadOnly: readOnly,
4415
- isInvalid: !!errorMessage2,
4418
+ isInvalid: inErrorState,
4416
4419
  "aria-label": ariaLabel,
4417
4420
  isOpen: previewCalendarOpen || void 0,
4418
4421
  onOpenChange: focusUnit.onOpenChange,
@@ -4448,7 +4451,7 @@ function DatePicker2(props) {
4448
4451
  children: helperText2
4449
4452
  }
4450
4453
  ) : null,
4451
- /* @__PURE__ */ jsx("div", { role: "alert", children: /* @__PURE__ */ jsx(
4454
+ /* @__PURE__ */ jsx("div", { role: "alert", children: inErrorState && /* @__PURE__ */ jsx(
4452
4455
  $ee014567cb39d3f0$export$f551688fc98f2e09,
4453
4456
  {
4454
4457
  className: clsx(
@@ -4457,7 +4460,7 @@ function DatePicker2(props) {
4457
4460
  (_c = elementProps == null ? void 0 : elementProps.errorMessage) == null ? void 0 : _c.className
4458
4461
  ),
4459
4462
  "data-testid": TestIds.errorMessage,
4460
- children: errorMessage2
4463
+ children: errorMessage2 ?? ""
4461
4464
  }
4462
4465
  ) }),
4463
4466
  /* @__PURE__ */ jsx(
@@ -55,8 +55,6 @@ export declare const defaultValues: {
55
55
  readonly readOnly: false;
56
56
  readonly disabled: false;
57
57
  };
58
- /** Shown on stage while the Error design state is selected. */
59
- export declare const PREVIEW_ERROR_MESSAGE = "Error message";
60
58
  /**
61
59
  * BEM classNames are the editor's preview hooks; the live site uses the matching
62
60
  * native pseudo-classes.
@@ -119,7 +117,10 @@ export declare const DesignStates: {
119
117
  };
120
118
  };
121
119
  };
122
- export declare const PREVIEW_CALENDAR_OPEN = "previewCalendarOpen";
120
+ export declare const FunctionalStateKeys: {
121
+ readonly previewCalendarOpen: "previewCalendarOpen";
122
+ readonly previewError: "previewError";
123
+ };
123
124
  export declare const ARIA_LABEL_NAMESPACE = "ariaLabels";
124
125
  /**
125
126
  * Viewer-facing aria labels: each entry is the `legacyKey` in the legacy
@@ -1,6 +1,6 @@
1
1
  import { D as DomEventType } from "../chunks/types.impl.js";
2
2
  import { C as CSS_PROPERTIES, N as NativeStateType, b as DISPLAY_GROUPS, D as DATA, E as ELEMENTS, L as LAYOUT, A as Archetype } from "../chunks/chunk-LDITHLYN.js";
3
- import { P as PREVIEW_CALENDAR_OPEN, D as DesignStates, d as defaultValues, b as DisplayNames, c as Descriptions, e as PREVIEW_ERROR_MESSAGE, C as COMPONENT_TYPE, s as selectors } from "../chunks/constants37.js";
3
+ import { F as FunctionalStateKeys, D as DesignStates, d as defaultValues, b as DisplayNames, c as Descriptions, C as COMPONENT_TYPE, s as selectors } from "../chunks/constants37.js";
4
4
  import { T as TEXT_PROP_STATIC_VALUE_MAX_LENGTH, g as getSelector } from "../chunks/manifest.js";
5
5
  import { b as manifestFocusable } from "../chunks/manifestSdkMixins.js";
6
6
  const basePresetName = "baseDatePicker";
@@ -46,7 +46,7 @@ const textShadow = {
46
46
  }
47
47
  };
48
48
  const openWhileDesigning = {
49
- stateKey: PREVIEW_CALENDAR_OPEN,
49
+ stateKey: FunctionalStateKeys.previewCalendarOpen,
50
50
  elementPath: ".root"
51
51
  };
52
52
  const boxBorder = {
@@ -208,7 +208,7 @@ const manifest = {
208
208
  focus: designState(DesignStates.dateInput.focus),
209
209
  error: {
210
210
  ...designState(DesignStates.dateInput.error),
211
- props: { errorMessage: PREVIEW_ERROR_MESSAGE }
211
+ props: { previewError: true }
212
212
  },
213
213
  disabled: {
214
214
  ...designState(DesignStates.dateInput.disabled),
@@ -304,7 +304,11 @@ const manifest = {
304
304
  selector: getSelector(selectors.errorMessage),
305
305
  behaviors: { selectable: false },
306
306
  cssProperties: { marginTop: {}, ...alignedTypography },
307
- cssCustomProperties: textShadow
307
+ cssCustomProperties: textShadow,
308
+ visibleState: {
309
+ stateKey: FunctionalStateKeys.previewError,
310
+ elementPath: ".root"
311
+ }
308
312
  }
309
313
  }
310
314
  },
@@ -447,15 +451,21 @@ const manifest = {
447
451
  },
448
452
  // Editor-only: activating this state passes `previewCalendarOpen` so the
449
453
  // overlay parts (referenced via `visibleState`) are editable on canvas.
450
- [PREVIEW_CALENDAR_OPEN]: {
451
- props: {
452
- [PREVIEW_CALENDAR_OPEN]: true
453
- }
454
+ [FunctionalStateKeys.previewCalendarOpen]: {
455
+ props: { previewCalendarOpen: true }
456
+ },
457
+ // Editor-only: forces the Error message part visible while it is being
458
+ // designed (referenced by the element's visibleState).
459
+ [FunctionalStateKeys.previewError]: {
460
+ props: { previewError: true }
454
461
  }
455
462
  },
456
463
  displayFilters: {
457
464
  states: {
458
- hide: [PREVIEW_CALENDAR_OPEN]
465
+ hide: [
466
+ FunctionalStateKeys.previewCalendarOpen,
467
+ FunctionalStateKeys.previewError
468
+ ]
459
469
  }
460
470
  }
461
471
  },
@@ -72,8 +72,8 @@ function Dropdown({
72
72
  }
73
73
  onValueChange == null ? void 0 : onValueChange(option2.value);
74
74
  };
75
- const invalid = typeof errorMessage2 !== "undefined" && errorMessage2 !== "";
76
- const inErrorState = invalid || Boolean(previewError);
75
+ const hasError = typeof errorMessage2 !== "undefined" && errorMessage2 !== "";
76
+ const inErrorState = hasError || Boolean(previewError);
77
77
  const { language } = useCurrentLanguage();
78
78
  const { translate } = useService(TranslationsDefinition);
79
79
  const ariaLabel = (a11y == null ? void 0 : a11y.ariaLabel) || (label2 ? void 0 : translate("ariaLabels")(
@@ -7,7 +7,7 @@ import { a as getDataAttributes } from "../chunks/dataUtils.js";
7
7
  import { p as presetWrapperStyles } from "../chunks/presetWrapper.module.js";
8
8
  import { d as directionStyles } from "../chunks/direction.module.js";
9
9
  import { a as accessibilityStyles } from "../chunks/accessibility.module.js";
10
- import { c as componentClassNames, D as DesignStates, E as ERROR_MESSAGE_PREVIEW_TEXT } from "../chunks/constants3.js";
10
+ import { c as componentClassNames, D as DesignStates } from "../chunks/constants3.js";
11
11
  import { b as $fd2148440a13ec26$export$fc1a364ae1f3ff10, c as $191c9b6d48a0a4e2$export$294aa081a6c6f55d, d as $860f7da480e22816$export$b8473d3665f3a75a, e as $d3e0e05bdfcf66bd$export$c24727297075ec6a, f as $3985021b0ad6602f$export$37fb8590cf2c088c, g as $514c0188e459b4c0$export$9afb8bc826b033ea, h as $ee014567cb39d3f0$export$ff05c3ac10437e03, i as $3985021b0ad6602f$export$f5b8910cec6cf069 } from "../chunks/Input.js";
12
12
  import { b as $3e6197669829fe11$export$40bfa8c7b0832715, c as $3274bf1495747a7b$export$5add1d006293d136, d as $bbaa08b3cd72f041$export$9d1611c77c2fe928, e as $23f2114a1b82827e$export$e58f029f0fbfdb29, f as $01b77f81d0f07f68$export$75b6ee27786ba447, g as $a049562f99e7db0e$export$f9c6924e160136d1, a as $01b77f81d0f07f68$export$b04be29aa201d4f5 } from "../chunks/Group.js";
13
13
  import { $ as $8e9d2fae0ecb9001$export$457c3d6518dd4c6f, a as $f39a9eba43920ace$export$86427a43e3e48ebb, b as $64fa3d84918910a7$export$29f1550f4b0d4415, c as $64fa3d84918910a7$export$fabf2dc03a41866e, d as $64fa3d84918910a7$export$9d4c57ee4c6ffdd8, e as $64fa3d84918910a7$export$ef03459518577ad4, f as $64fa3d84918910a7$export$4d86445c2cf5e3, g as $65484d02dcb7eb3e$export$457c3d6518dd4c6f, h as $64fa3d84918910a7$export$2881499e37b75b9a } from "../chunks/filterDOMProps.js";
@@ -233,8 +233,8 @@ const TextInput = (props) => {
233
233
  var _a2;
234
234
  handleValueChange(((_a2 = inputRef.current) == null ? void 0 : _a2.value) ?? "");
235
235
  }, []);
236
- const hasError = !!errorMessage2;
237
- const showErrorMessage = previewError === true || hasError;
236
+ const hasError = typeof errorMessage2 !== "undefined" && errorMessage2 !== "";
237
+ const inErrorState = hasError || Boolean(previewError);
238
238
  const containerClasses = clsx(
239
239
  style.root,
240
240
  componentClassNames.root,
@@ -242,16 +242,16 @@ const TextInput = (props) => {
242
242
  !direction && directionStyles.fallbackDirection
243
243
  );
244
244
  const ariaLabel = a11y == null ? void 0 : a11y.ariaLabel;
245
- const ariaInvalid = hasError ? true : (a11y == null ? void 0 : a11y.ariaInvalid) ?? false;
245
+ const ariaInvalid = inErrorState ? true : (a11y == null ? void 0 : a11y.ariaInvalid) ?? false;
246
246
  const customAccessibleNameId = label2 && ariaLabel ? `${id}-accessible-name` : void 0;
247
247
  const helperTextId = helperText2 ? `helper_${id}` : void 0;
248
- const errorMessageId = showErrorMessage ? `error_${id}` : void 0;
248
+ const errorMessageId = inErrorState ? `error_${id}` : void 0;
249
249
  const inputClasses = clsx(
250
250
  style.input,
251
251
  componentClassNames.input,
252
252
  (_a = elementProps == null ? void 0 : elementProps.input) == null ? void 0 : _a.className,
253
253
  {
254
- [DesignStates.input.error.className]: hasError
254
+ [DesignStates.input.error.className]: inErrorState
255
255
  }
256
256
  );
257
257
  const labelClasses = clsx(
@@ -329,7 +329,7 @@ const TextInput = (props) => {
329
329
  children: helperText2
330
330
  }
331
331
  ),
332
- showErrorMessage && /* @__PURE__ */ jsx(
332
+ inErrorState && /* @__PURE__ */ jsx(
333
333
  "p",
334
334
  {
335
335
  id: errorMessageId,
@@ -339,7 +339,7 @@ const TextInput = (props) => {
339
339
  (_d = elementProps == null ? void 0 : elementProps.errorMessage) == null ? void 0 : _d.className
340
340
  ),
341
341
  "data-testid": "error-message",
342
- children: errorMessage2 || ERROR_MESSAGE_PREVIEW_TEXT
342
+ children: errorMessage2
343
343
  }
344
344
  )
345
345
  ] })
@@ -8,7 +8,6 @@ export declare const componentClassNames: {
8
8
  export declare const FunctionalStateKeys: {
9
9
  readonly previewError: "previewError";
10
10
  };
11
- export declare const ERROR_MESSAGE_PREVIEW_TEXT = "Error message";
12
11
  export declare const DesignStates: {
13
12
  readonly input: {
14
13
  readonly hover: {
@@ -34,6 +34,12 @@ export type TimePickerProps = {
34
34
  helperText?: string;
35
35
  /** Message shown below the field when the selected value is invalid. */
36
36
  errorMessage?: string;
37
+ /**
38
+ * Editor-only: forces the error state so the Time input's Error design state
39
+ * and the Error message part can be styled on the canvas. No message text is
40
+ * shown unless `errorMessage` is set.
41
+ */
42
+ previewError?: boolean;
37
43
  /** Shows the time but blocks editing. */
38
44
  readOnly?: boolean;
39
45
  /** Disables interaction with the time picker. */
@@ -111,6 +111,7 @@ function TimePicker(props) {
111
111
  id,
112
112
  className = "",
113
113
  readOnly = false,
114
+ previewError,
114
115
  direction,
115
116
  a11y,
116
117
  onValueChange = noop,
@@ -125,7 +126,8 @@ function TimePicker(props) {
125
126
  value: props.value,
126
127
  onValueChange
127
128
  });
128
- const isInvalid = Boolean(errorMessage2);
129
+ const hasError = typeof errorMessage2 !== "undefined" && errorMessage2 !== "";
130
+ const inErrorState = hasError || Boolean(previewError);
129
131
  let ariaLabel = a11y == null ? void 0 : a11y.ariaLabel;
130
132
  if (!ariaLabel && !label2) {
131
133
  ariaLabel = translate("ariaLabels")(
@@ -161,7 +163,7 @@ function TimePicker(props) {
161
163
  granularity: "minute",
162
164
  isDisabled: disabled,
163
165
  isReadOnly: readOnly,
164
- isInvalid,
166
+ isInvalid: inErrorState,
165
167
  "aria-label": ariaLabel,
166
168
  children: [
167
169
  label2 ? /* @__PURE__ */ jsx(
@@ -188,7 +190,7 @@ function TimePicker(props) {
188
190
  children: helperText
189
191
  }
190
192
  ) : null,
191
- errorMessage2 ? /* @__PURE__ */ jsx(
193
+ inErrorState ? /* @__PURE__ */ jsx(
192
194
  $ee014567cb39d3f0$export$f551688fc98f2e09,
193
195
  {
194
196
  className: clsx(
@@ -1,7 +1 @@
1
- import { default as React } from 'react';
2
- import { TimePickerProps } from './TimePicker.types';
3
- type TimePickerPreviewProps = TimePickerProps & {
4
- previewError?: boolean;
5
- };
6
- export default function TimePickerPreview({ previewError, ...props }: TimePickerPreviewProps): React.JSX.Element;
7
- export {};
1
+ export { default } from './TimePicker';
@@ -42,7 +42,9 @@ export declare const Descriptions: {
42
42
  };
43
43
  };
44
44
  };
45
- export declare const PREVIEW_ERROR_MESSAGE = "Error message";
45
+ export declare const FunctionalStateKeys: {
46
+ readonly previewError: "previewError";
47
+ };
46
48
  export declare const DesignStates: {
47
49
  timeInput: {
48
50
  hover: {
@@ -1,5 +1,5 @@
1
1
  import { b as DISPLAY_GROUPS, D as DATA, E as ELEMENTS, L as LAYOUT, A as Archetype } from "../chunks/chunk-LDITHLYN.js";
2
- import { b as DisplayNames, c as Descriptions, D as DesignStates, P as PREVIEW_ERROR_MESSAGE, C as COMPONENT_TYPE, s as selectors } from "../chunks/constants2.js";
2
+ import { b as DisplayNames, c as Descriptions, F as FunctionalStateKeys, D as DesignStates, C as COMPONENT_TYPE, s as selectors } from "../chunks/constants2.js";
3
3
  import { T as TEXT_PROP_STATIC_VALUE_MAX_LENGTH, g as getSelector } from "../chunks/manifest.js";
4
4
  const basePresetName = "baseTimePicker";
5
5
  const manifest = {
@@ -137,9 +137,9 @@ const manifest = {
137
137
  disablePositioning: false
138
138
  },
139
139
  states: {
140
- previewError: { props: { previewError: true } }
140
+ [FunctionalStateKeys.previewError]: { props: { previewError: true } }
141
141
  },
142
- displayFilters: { states: { hide: ["previewError"] } },
142
+ displayFilters: { states: { hide: [FunctionalStateKeys.previewError] } },
143
143
  elements: {
144
144
  label: {
145
145
  elementType: ELEMENTS.ELEMENT_TYPE.inlineElement,
@@ -195,7 +195,7 @@ const manifest = {
195
195
  focus: DesignStates.timeInput.focus,
196
196
  error: {
197
197
  ...DesignStates.timeInput.error,
198
- props: { errorMessage: PREVIEW_ERROR_MESSAGE }
198
+ props: { previewError: true }
199
199
  },
200
200
  disabled: DesignStates.timeInput.disabled
201
201
  }
@@ -252,7 +252,10 @@ const manifest = {
252
252
  textTransform: {},
253
253
  textShadow: {}
254
254
  },
255
- visibleState: { stateKey: "previewError", elementPath: ".root" }
255
+ visibleState: {
256
+ stateKey: FunctionalStateKeys.previewError,
257
+ elementPath: ".root"
258
+ }
256
259
  }
257
260
  }
258
261
  },
@@ -42,7 +42,9 @@ const Descriptions = {
42
42
  }
43
43
  }
44
44
  };
45
- const PREVIEW_ERROR_MESSAGE = "Error message";
45
+ const FunctionalStateKeys = {
46
+ previewError: "previewError"
47
+ };
46
48
  const DesignStates = {
47
49
  timeInput: {
48
50
  hover: {
@@ -95,7 +97,7 @@ export {
95
97
  AriaLabels as A,
96
98
  COMPONENT_TYPE as C,
97
99
  DesignStates as D,
98
- PREVIEW_ERROR_MESSAGE as P,
100
+ FunctionalStateKeys as F,
99
101
  TestIds as T,
100
102
  DEFAULT_LOCALE as a,
101
103
  DisplayNames as b,
@@ -8,7 +8,6 @@ const componentClassNames = {
8
8
  const FunctionalStateKeys = {
9
9
  previewError: "previewError"
10
10
  };
11
- const ERROR_MESSAGE_PREVIEW_TEXT = "Error message";
12
11
  const DesignStates = {
13
12
  input: {
14
13
  hover: { displayName: "Hover", className: "textInput__input--hover" },
@@ -50,7 +49,6 @@ const DisplayNames = {
50
49
  };
51
50
  export {
52
51
  DesignStates as D,
53
- ERROR_MESSAGE_PREVIEW_TEXT as E,
54
52
  FunctionalStateKeys as F,
55
53
  DisplayNames as a,
56
54
  componentClassNames as c
@@ -55,7 +55,6 @@ const defaultValues = {
55
55
  readOnly: false,
56
56
  disabled: false
57
57
  };
58
- const PREVIEW_ERROR_MESSAGE = "Error message";
59
58
  const DesignStates = {
60
59
  root: {
61
60
  disabled: {
@@ -114,7 +113,10 @@ const DesignStates = {
114
113
  }
115
114
  }
116
115
  };
117
- const PREVIEW_CALENDAR_OPEN = "previewCalendarOpen";
116
+ const FunctionalStateKeys = {
117
+ previewCalendarOpen: "previewCalendarOpen",
118
+ previewError: "previewError"
119
+ };
118
120
  const ARIA_LABEL_NAMESPACE = "ariaLabels";
119
121
  const AriaLabels = {
120
122
  root: {
@@ -153,12 +155,11 @@ export {
153
155
  ARIA_LABEL_NAMESPACE as A,
154
156
  COMPONENT_TYPE as C,
155
157
  DesignStates as D,
156
- PREVIEW_CALENDAR_OPEN as P,
158
+ FunctionalStateKeys as F,
157
159
  TestIds as T,
158
160
  AriaLabels as a,
159
161
  DisplayNames as b,
160
162
  Descriptions as c,
161
163
  defaultValues as d,
162
- PREVIEW_ERROR_MESSAGE as e,
163
164
  selectors as s
164
165
  };
@@ -54,7 +54,6 @@ const DesignStates = {
54
54
  const FunctionalStateKeys = {
55
55
  previewError: "previewError"
56
56
  };
57
- const ERROR_MESSAGE_PREVIEW_TEXT = "Error message";
58
57
  const defaultValues = {
59
58
  label: "Label",
60
59
  checked: false,
@@ -77,7 +76,6 @@ const selectors = {
77
76
  };
78
77
  export {
79
78
  DesignStates as D,
80
- ERROR_MESSAGE_PREVIEW_TEXT as E,
81
79
  FunctionalStateKeys as F,
82
80
  TestIds as T,
83
81
  DisplayNames as a,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/editor-react-components",
3
- "version": "1.2861.0",
3
+ "version": "1.2862.0",
4
4
  "description": "React components for the Wix Editor",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -228,5 +228,5 @@
228
228
  "registry": "https://registry.npmjs.org/",
229
229
  "access": "public"
230
230
  },
231
- "falconPackageHash": "ef63c01f36ade5f01806be99e40f2814e2103f0c05ec10fc1bcaee3b"
231
+ "falconPackageHash": "61657244a9e1204e2d1db24d635cda45c7e8e26952e99ce32340b182"
232
232
  }