@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.d.mts CHANGED
@@ -1194,6 +1194,10 @@ type FormFieldProps = ComponentPropsWithoutRef<'div'> & {
1194
1194
  * This should be a single child that is a valid form field (or can pretend to be one).
1195
1195
  */
1196
1196
  children: JSX.Element;
1197
+ /**
1198
+ * Additional descriptive text to display below the form field
1199
+ */
1200
+ description?: ReactNode;
1197
1201
  /**
1198
1202
  * Valid label text
1199
1203
  */
@@ -1220,10 +1224,10 @@ type FormFieldProps = ComponentPropsWithoutRef<'div'> & {
1220
1224
  labelPosition?: 'block' | 'inline-compact' | 'inline';
1221
1225
  };
1222
1226
  /**
1223
- * Component description goes here
1227
+ * FormField is a compound component that combines a label, form control, and optional description and error message.
1224
1228
  */
1225
1229
  declare const FormField: {
1226
- ({ children, label, name, error, value, labelPosition, id, ...props }: FormFieldProps): JSX.Element;
1230
+ ({ children, description, error, id, label, labelPosition, name, value, ...props }: FormFieldProps): JSX.Element;
1227
1231
  displayName: string;
1228
1232
  };
1229
1233
 
package/dist/index.d.ts CHANGED
@@ -1194,6 +1194,10 @@ type FormFieldProps = ComponentPropsWithoutRef<'div'> & {
1194
1194
  * This should be a single child that is a valid form field (or can pretend to be one).
1195
1195
  */
1196
1196
  children: JSX.Element;
1197
+ /**
1198
+ * Additional descriptive text to display below the form field
1199
+ */
1200
+ description?: ReactNode;
1197
1201
  /**
1198
1202
  * Valid label text
1199
1203
  */
@@ -1220,10 +1224,10 @@ type FormFieldProps = ComponentPropsWithoutRef<'div'> & {
1220
1224
  labelPosition?: 'block' | 'inline-compact' | 'inline';
1221
1225
  };
1222
1226
  /**
1223
- * Component description goes here
1227
+ * FormField is a compound component that combines a label, form control, and optional description and error message.
1224
1228
  */
1225
1229
  declare const FormField: {
1226
- ({ children, label, name, error, value, labelPosition, id, ...props }: FormFieldProps): JSX.Element;
1230
+ ({ children, description, error, id, label, labelPosition, name, value, ...props }: FormFieldProps): JSX.Element;
1227
1231
  displayName: string;
1228
1232
  };
1229
1233
 
package/dist/index.mjs 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
  *
@@ -9269,24 +9269,29 @@ var ErrorMessages = ({ errors, id }) => {
9269
9269
  };
9270
9270
  var FormField = ({
9271
9271
  children,
9272
+ description,
9273
+ error,
9274
+ id,
9272
9275
  label,
9276
+ labelPosition,
9273
9277
  name,
9274
- error,
9275
9278
  value,
9276
- labelPosition,
9277
- id,
9278
9279
  ...props
9279
9280
  }) => {
9280
9281
  const formState = useContext3(FormContext);
9281
9282
  const checkboxGroup = useContext3(CheckboxGroupContext);
9283
+ const defaultValue = formState.values[name];
9282
9284
  const isIntegratedLabel = children.type === Checkbox;
9283
9285
  const computedId = id ?? `${formState.formId}-${name}`;
9284
9286
  const computedError = error ?? formState.errors[name];
9285
- const defaultValue = formState.values[name];
9287
+ const descriptionId = `${computedId}-description`;
9288
+ const errorId = `${computedId}-error`;
9289
+ const ariaDescribedby = [descriptionId, errorId].filter(Boolean).join(" ") || void 0;
9286
9290
  let childProps = {
9287
9291
  name,
9288
9292
  id: computedId,
9289
9293
  label: isIntegratedLabel ? label : void 0,
9294
+ "aria-describedby": ariaDescribedby,
9290
9295
  ...props
9291
9296
  };
9292
9297
  if (isUndefined4(value) && isNotUndefined8(defaultValue)) {
@@ -9309,8 +9314,7 @@ var FormField = ({
9309
9314
  ...childProps,
9310
9315
  name: computedName,
9311
9316
  onChange: handleChange,
9312
- "aria-invalid": isNotNil12(error),
9313
- "aria-describedby": isNotNil12(error) ? `${computedId}-error` : void 0
9317
+ "aria-invalid": isNotNil12(error)
9314
9318
  };
9315
9319
  }
9316
9320
  Children5.only(children);
@@ -9321,6 +9325,7 @@ var FormField = ({
9321
9325
  "data-label-position": labelPosition ?? formState.labelPosition,
9322
9326
  children: [
9323
9327
  !isIntegratedLabel && /* @__PURE__ */ jsx225(Label, { htmlFor: computedId, children: label }),
9328
+ isNotNil12(description) ? /* @__PURE__ */ jsx225(FormControlLabelDescription, { id: descriptionId, children: description }) : null,
9324
9329
  cloneElement5(children, childProps),
9325
9330
  isNotNil12(computedError) ? /* @__PURE__ */ jsxs23(Fragment6, { children: [
9326
9331
  /* @__PURE__ */ jsx225("div", {}),
@@ -9328,7 +9333,7 @@ var FormField = ({
9328
9333
  ErrorMessages,
9329
9334
  {
9330
9335
  errors: computedError,
9331
- id: `${computedId}-error`
9336
+ id: errorId
9332
9337
  }
9333
9338
  )
9334
9339
  ] }) : null