@wix/editor-react-components 1.2641.0 → 1.2643.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.
@@ -9,6 +9,7 @@ import { a as getDataAttributes } from "../chunks/dataUtils.js";
9
9
  import { u as useValidatedField, R as RequiredIndicator } from "../chunks/RequiredIndicator.js";
10
10
  import { d as directionStyles } from "../chunks/direction.module.js";
11
11
  import { p as presetWrapperStyles } from "../chunks/presetWrapper.module.js";
12
+ import { a as accessibilityStyles } from "../chunks/accessibility.module.js";
12
13
  import { d as defaultValues, s as selectors, T as TestIds, V as VALIDATION_MESSAGES, a as semanticClassNames } from "../chunks/constants18.js";
13
14
  import { I as InfoCircleSmall_default } from "../chunks/InfoCircleSmall.js";
14
15
  const root = "root__dlp5n";
@@ -108,7 +109,8 @@ function TextBoxComponent(props) {
108
109
  };
109
110
  const hasLabel = !!label2;
110
111
  const hasTooltip = !!tooltip2;
111
- const ariaLabel = !hasLabel ? (a11y == null ? void 0 : a11y.ariaLabel) || void 0 : void 0;
112
+ const ariaLabel = (a11y == null ? void 0 : a11y.ariaLabel) || void 0;
113
+ const customAccessibleNameId = hasLabel && ariaLabel ? `${id}-accessible-name` : void 0;
112
114
  const presetsWrapperProps = (wix == null ? void 0 : wix.presetsWrapperProps) || {};
113
115
  const rootClassName = clsx(
114
116
  className,
@@ -132,6 +134,14 @@ function TextBoxComponent(props) {
132
134
  disabled,
133
135
  invalid: isInvalid,
134
136
  children: [
137
+ customAccessibleNameId && /* @__PURE__ */ jsx(
138
+ "span",
139
+ {
140
+ id: customAccessibleNameId,
141
+ className: accessibilityStyles.visuallyHidden,
142
+ children: ariaLabel
143
+ }
144
+ ),
135
145
  (hasLabel || hasTooltip) && /* @__PURE__ */ jsxs("div", { className: styles.labelRow, children: [
136
146
  hasLabel && /* @__PURE__ */ jsxs(
137
147
  Field.Label,
@@ -189,6 +199,7 @@ function TextBoxComponent(props) {
189
199
  minLength: minLength ?? void 0,
190
200
  maxLength: maxLength ?? void 0,
191
201
  "aria-label": ariaLabel,
202
+ "aria-labelledby": customAccessibleNameId,
192
203
  "data-testid": TestIds.input,
193
204
  onFocus,
194
205
  onBlur: handleBlur
@@ -158,4 +158,15 @@
158
158
  }
159
159
  .presetWrapper__J1yzj {
160
160
  display: contents;
161
+ }
162
+ .visuallyHidden__Md84p {
163
+ position: absolute;
164
+ width: 1px;
165
+ height: 1px;
166
+ padding: 0;
167
+ margin: -1px;
168
+ overflow: hidden;
169
+ clip-path: inset(50%);
170
+ white-space: nowrap;
171
+ border: 0;
161
172
  }
@@ -1,4 +1,4 @@
1
- import { Direction } from '@wix/editor-react-types';
1
+ import { A11y, Direction } from '@wix/editor-react-types';
2
2
  import { CorvidTypes } from '../../../types/vendored/editor-elements-types-corvid';
3
3
  import { DefaultCompPlatformProps } from '../../../types/vendored/editor-elements-types-thunderbolt';
4
4
  import { IReadOnlyPropSDK } from '../../../common/sdk/props-factories/readOnlyPropsSDKFactory';
@@ -27,6 +27,7 @@ type Spx = {
27
27
  };
28
28
  export type ITextInputImperativeActions = IFocusPropsImperativeActions & IValidationPropsImperativeActions;
29
29
  export type ITextInputProps = ITextInputMapperProps & DefaultCompPlatformProps & IValidationPropSDKProps & FieldValidationProps<string> & IChangePropsSDKActions<HTMLInputElement> & Partial<ITextInputPropsSDKActions<HTMLInputElement>> & Partial<IFocusPropsSDKActions> & Partial<IClickPropsSDKActions> & Partial<IValidationPropsSDKActions<ITextInputProps>> & Partial<IElementPropsSDKActions> & Partial<HydrationSDKAction> & ITextInputControllerProps & IAccessibilityPropSDKProps & {
30
+ a11y?: Pick<A11y, 'ariaLabel'>;
30
31
  ref?: React.Ref<ITextInputImperativeActions>;
31
32
  autoFocus?: boolean;
32
33
  className?: string;
@@ -7,6 +7,7 @@ import { b as getAccessibilityAttributes, H as HAS_CUSTOM_FOCUS_CLASSNAME } from
7
7
  import { a as getDataAttributes } from "../chunks/dataUtils.js";
8
8
  import { u as useValidatedField, R as RequiredIndicator } from "../chunks/RequiredIndicator.js";
9
9
  import { d as directionStyles } from "../chunks/direction.module.js";
10
+ import { a as accessibilityStyles } from "../chunks/accessibility.module.js";
10
11
  import { s as selectors, T as TestIds, V as VALUE_MISSING_MESSAGE } from "../chunks/constants3.js";
11
12
  import { useService } from "@wix/services-manager-react";
12
13
  import { T as TranslationsDefinition } from "../chunks/index6.js";
@@ -220,6 +221,9 @@ class IconContentFetcher {
220
221
  if (this.pendingRequests.has(cacheKey)) {
221
222
  throw this.pendingRequests.get(cacheKey);
222
223
  }
224
+ if (typeof fetch !== "function") {
225
+ return "";
226
+ }
223
227
  const url = `https://static.parastorage.com/services/wix-ui-icons-common/dist/icons/${theme}/${category}/${name}.${hash}.json`;
224
228
  const request = fetch(url, {
225
229
  signal: createTimeoutSignal(ABORT_SIGNAL_TIMEOUT)
@@ -445,6 +449,7 @@ const style$1 = {
445
449
  };
446
450
  const errorMessageFallbackText = "Error text displays here.";
447
451
  const InlineErrorMessage = ({
452
+ id,
448
453
  errorMessage,
449
454
  errorMessageType,
450
455
  shouldShowValidityIndication,
@@ -464,7 +469,7 @@ const InlineErrorMessage = ({
464
469
  className: style$1.inlineErrorIndication,
465
470
  children: [
466
471
  /* @__PURE__ */ jsx(StatusAlertSmall_default, { className: style$1.iconErrorMessage }),
467
- /* @__PURE__ */ jsx("span", { className: style$1.txtErrMsg, children: errorMessageText })
472
+ /* @__PURE__ */ jsx("span", { id, className: style$1.txtErrMsg, children: errorMessageText })
468
473
  ]
469
474
  }
470
475
  ) : null;
@@ -624,6 +629,7 @@ const TextInput = (props, ref) => {
624
629
  onMouseEnter = noop,
625
630
  onMouseLeave = noop,
626
631
  onHydrationComplete = noop,
632
+ a11y,
627
633
  ariaAttributes,
628
634
  contentRef
629
635
  } = props;
@@ -847,10 +853,20 @@ const TextInput = (props, ref) => {
847
853
  };
848
854
  const getMinLength = () => activePhoneFormat ? activePhoneFormat.length : minLength ?? void 0;
849
855
  const {
850
- ariaAttributes: { "aria-label": ariaLabel, ...restAriaAttributes }
856
+ ariaAttributes: { "aria-label": sdkAriaLabel, ...restAriaAttributes }
851
857
  } = getAccessibilityAttributes({ ariaAttributes });
858
+ const ariaLabel = (a11y == null ? void 0 : a11y.ariaLabel) || sdkAriaLabel;
859
+ const explicitLabelledBy = restAriaAttributes["aria-labelledby"];
860
+ const customAccessibleNameId = label2 && ariaLabel && !explicitLabelledBy ? `${id}-accessible-name` : void 0;
861
+ const componentViewMode = (getPreviewMode == null ? void 0 : getPreviewMode()) ? "preview" : "editor";
852
862
  const hasFocus = () => !!inputRef.current && inputRef.current === document.activeElement;
853
863
  const descriptionId = description ? `description_${id}` : void 0;
864
+ const errorId = `${id}-error`;
865
+ const describedByIds = [
866
+ restAriaAttributes["aria-describedby"],
867
+ descriptionId,
868
+ errorMessageType === "inline" && showErrorIndication && (componentViewMode === "editor" || errorMessageToShow) ? errorId : void 0
869
+ ].filter(Boolean);
854
870
  const inputClasses = clsx(
855
871
  style.input,
856
872
  selectors.input,
@@ -897,11 +913,11 @@ const TextInput = (props, ref) => {
897
913
  ...ariaLabel && { "aria-label": ariaLabel },
898
914
  ...!required && { "aria-required": false },
899
915
  ...restAriaAttributes,
900
- ...descriptionId || restAriaAttributes["aria-describedby"] ? {
901
- "aria-describedby": [
902
- restAriaAttributes["aria-describedby"],
903
- descriptionId
904
- ].filter(Boolean).join(" ")
916
+ ...customAccessibleNameId && {
917
+ "aria-labelledby": customAccessibleNameId
918
+ },
919
+ ...describedByIds.length ? {
920
+ "aria-describedby": describedByIds.join(" ")
905
921
  } : {}
906
922
  };
907
923
  return /* @__PURE__ */ jsx(
@@ -919,6 +935,14 @@ const TextInput = (props, ref) => {
919
935
  onMouseLeave: _onMouseLeave,
920
936
  lang: language,
921
937
  children: /* @__PURE__ */ jsxs($bcdf0525bf22703d$export$2c73285ae9390cec, { ...textFieldProps, children: [
938
+ customAccessibleNameId && /* @__PURE__ */ jsx(
939
+ "span",
940
+ {
941
+ id: customAccessibleNameId,
942
+ className: accessibilityStyles.visuallyHidden,
943
+ children: ariaLabel
944
+ }
945
+ ),
922
946
  (label2 || tooltip2) && /* @__PURE__ */ jsxs("div", { className: style.labelRow, children: [
923
947
  label2 && /* @__PURE__ */ jsxs(
924
948
  $01b77f81d0f07f68$export$b04be29aa201d4f5,
@@ -977,11 +1001,12 @@ const TextInput = (props, ref) => {
977
1001
  /* @__PURE__ */ jsx(
978
1002
  InlineErrorMessage,
979
1003
  {
1004
+ id: errorId,
980
1005
  errorMessageType,
981
1006
  errorMessage: errorMessageToShow,
982
1007
  shouldShowValidityIndication: showErrorIndication,
983
1008
  translations,
984
- componentViewMode: (getPreviewMode == null ? void 0 : getPreviewMode()) ? "preview" : "editor"
1009
+ componentViewMode
985
1010
  }
986
1011
  )
987
1012
  ] })
@@ -245,4 +245,15 @@
245
245
  }
246
246
  .fallbackDirection__HeRgn:not([dir]) {
247
247
  direction: var(--wix-opt-in-direction);
248
+ }
249
+ .visuallyHidden__Md84p {
250
+ position: absolute;
251
+ width: 1px;
252
+ height: 1px;
253
+ padding: 0;
254
+ margin: -1px;
255
+ overflow: hidden;
256
+ clip-path: inset(50%);
257
+ white-space: nowrap;
258
+ border: 0;
248
259
  }
@@ -0,0 +1,7 @@
1
+ const visuallyHidden = "visuallyHidden__Md84p";
2
+ const accessibilityStyles = {
3
+ visuallyHidden
4
+ };
5
+ export {
6
+ accessibilityStyles as a
7
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/editor-react-components",
3
- "version": "1.2641.0",
3
+ "version": "1.2643.0",
4
4
  "description": "React components for the Wix Editor",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -84,7 +84,7 @@
84
84
  "@wix/site-service-business-logger": "^1.0.2",
85
85
  "@wix/site-service-configuration": "^1.0.1",
86
86
  "@wix/site-service-rendering-context": "^1.0.1",
87
- "@wix/site-ui": "1.267.0",
87
+ "@wix/site-ui": "1.268.0",
88
88
  "@wix/video": "^1.106.0",
89
89
  "@wix/viewer-service-consent-policy": "^1.0.103",
90
90
  "@wix/web-bi-logger": "^2.1.29",
@@ -199,5 +199,5 @@
199
199
  "registry": "https://registry.npmjs.org/",
200
200
  "access": "public"
201
201
  },
202
- "falconPackageHash": "f5fd7c46f975978d8a69260f7c61a6245145b7c1df69b74112540f32"
202
+ "falconPackageHash": "4ba57de011d631522ee555c6f7edfe20ac94137c9555adfc101d0228"
203
203
  }