@wistia/ui 0.6.29 → 0.6.30

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.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  /*
3
- * @license @wistia/ui v0.6.29
3
+ * @license @wistia/ui v0.6.30
4
4
  *
5
5
  * Copyright (c) 2024-2025, Wistia, Inc. and its affiliates.
6
6
  *
@@ -9382,24 +9382,29 @@ var ErrorMessages = ({ errors, id }) => {
9382
9382
  };
9383
9383
  var FormField = ({
9384
9384
  children,
9385
+ description,
9386
+ error,
9387
+ id,
9385
9388
  label,
9389
+ labelPosition,
9386
9390
  name,
9387
- error,
9388
9391
  value,
9389
- labelPosition,
9390
- id,
9391
9392
  ...props
9392
9393
  }) => {
9393
9394
  const formState = (0, import_react32.useContext)(FormContext);
9394
9395
  const checkboxGroup = (0, import_react32.useContext)(CheckboxGroupContext);
9396
+ const defaultValue = formState.values[name];
9395
9397
  const isIntegratedLabel = children.type === Checkbox;
9396
9398
  const computedId = id ?? `${formState.formId}-${name}`;
9397
9399
  const computedError = error ?? formState.errors[name];
9398
- const defaultValue = formState.values[name];
9400
+ const descriptionId = `${computedId}-description`;
9401
+ const errorId = `${computedId}-error`;
9402
+ const ariaDescribedby = [descriptionId, errorId].filter(Boolean).join(" ") || void 0;
9399
9403
  let childProps = {
9400
9404
  name,
9401
9405
  id: computedId,
9402
9406
  label: isIntegratedLabel ? label : void 0,
9407
+ "aria-describedby": ariaDescribedby,
9403
9408
  ...props
9404
9409
  };
9405
9410
  if ((0, import_type_guards29.isUndefined)(value) && (0, import_type_guards29.isNotUndefined)(defaultValue)) {
@@ -9422,8 +9427,7 @@ var FormField = ({
9422
9427
  ...childProps,
9423
9428
  name: computedName,
9424
9429
  onChange: handleChange,
9425
- "aria-invalid": (0, import_type_guards29.isNotNil)(error),
9426
- "aria-describedby": (0, import_type_guards29.isNotNil)(error) ? `${computedId}-error` : void 0
9430
+ "aria-invalid": (0, import_type_guards29.isNotNil)(error)
9427
9431
  };
9428
9432
  }
9429
9433
  import_react32.Children.only(children);
@@ -9434,6 +9438,7 @@ var FormField = ({
9434
9438
  "data-label-position": labelPosition ?? formState.labelPosition,
9435
9439
  children: [
9436
9440
  !isIntegratedLabel && /* @__PURE__ */ (0, import_jsx_runtime225.jsx)(Label, { htmlFor: computedId, children: label }),
9441
+ (0, import_type_guards29.isNotNil)(description) ? /* @__PURE__ */ (0, import_jsx_runtime225.jsx)(FormControlLabelDescription, { id: descriptionId, children: description }) : null,
9437
9442
  (0, import_react32.cloneElement)(children, childProps),
9438
9443
  (0, import_type_guards29.isNotNil)(computedError) ? /* @__PURE__ */ (0, import_jsx_runtime225.jsxs)(import_jsx_runtime225.Fragment, { children: [
9439
9444
  /* @__PURE__ */ (0, import_jsx_runtime225.jsx)("div", {}),
@@ -9441,7 +9446,7 @@ var FormField = ({
9441
9446
  ErrorMessages,
9442
9447
  {
9443
9448
  errors: computedError,
9444
- id: `${computedId}-error`
9449
+ id: errorId
9445
9450
  }
9446
9451
  )
9447
9452
  ] }) : null