@wistia/ui 0.6.2 → 0.6.3-beta.5b311d65.bf5ea63

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
@@ -1,6 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as react from 'react';
3
3
  import { ReactNode, Dispatch, SetStateAction, ComponentPropsWithoutRef, JSX, ComponentPropsWithRef, MouseEvent, ElementType, ChangeEvent, ForwardedRef, Ref, InputHTMLAttributes, RefObject, ForwardRefExoticComponent, RefAttributes } from 'react';
4
+ import * as react_router from 'react-router';
4
5
  import { LinkProps as LinkProps$1 } from 'react-router-dom';
5
6
  import { CollapsibleContentProps as CollapsibleContentProps$1 } from '@radix-ui/react-collapsible';
6
7
  import * as styled_components from 'styled-components';
@@ -261,7 +262,7 @@ type BaseButtonProps = {
261
262
  */
262
263
  variant?: ButtonVariants;
263
264
  };
264
- type ButtonAsLinkProps = BaseButtonProps & ComponentPropsWithRef<'a'> & {
265
+ type ButtonAsLinkProps = BaseButtonProps & ComponentPropsWithRef<'a'> & LinkProps & {
265
266
  href: string | undefined;
266
267
  children: ReactNode;
267
268
  /**
@@ -287,7 +288,63 @@ type ButtonProps = ButtonAsButtonProps | ButtonAsLinkProps;
287
288
  * action, or performing a delete operation. It replaces the HTML `<button>` element,
288
289
  * unless an `href` attribute is passed, in which it will render an `<a>` element.
289
290
  */
290
- declare const Button: react.ForwardRefExoticComponent<(Omit<ButtonAsLinkProps, "ref"> | Omit<ButtonAsButtonProps, "ref">) & react.RefAttributes<HTMLAnchorElement | HTMLButtonElement>>;
291
+ declare const Button: react.ForwardRefExoticComponent<(Omit<BaseButtonProps & Omit<react.DetailedHTMLProps<react.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "ref"> & {
292
+ ref?: ((instance: HTMLAnchorElement | null) => void | react.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof react.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | react.RefObject<HTMLAnchorElement> | null | undefined;
293
+ } & {
294
+ beforeAction?: (() => Promise<void>) | (() => void);
295
+ children: ReactNode;
296
+ colorScheme?: ColorSchemeTypes;
297
+ disabled?: boolean;
298
+ leftIcon?: JSX.Element | undefined;
299
+ rightIcon?: JSX.Element | undefined;
300
+ type?: LinkTypes | undefined;
301
+ underline?: boolean;
302
+ } & Omit<react_router.LinkProps, "to"> & {
303
+ href: string | undefined;
304
+ type?: LinkTypes;
305
+ } & {
306
+ href: string | undefined;
307
+ children: ReactNode;
308
+ /**
309
+ * This just allows pathrough to beforeAction for link
310
+ * @ignore
311
+ */
312
+ beforeAction?: (() => Promise<void>) | (() => void);
313
+ /**
314
+ * This just allows pathrough to beforeAction for link
315
+ * @ignore
316
+ */
317
+ type?: LinkTypes;
318
+ }, "ref"> | Omit<BaseButtonProps & Omit<react.DetailedHTMLProps<react.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "ref"> & {
319
+ ref?: ((instance: HTMLAnchorElement | null) => void | react.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof react.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | react.RefObject<HTMLAnchorElement> | null | undefined;
320
+ } & {
321
+ beforeAction?: (() => Promise<void>) | (() => void);
322
+ children: ReactNode;
323
+ colorScheme?: ColorSchemeTypes;
324
+ disabled?: boolean;
325
+ leftIcon?: JSX.Element | undefined;
326
+ rightIcon?: JSX.Element | undefined;
327
+ type?: LinkTypes | undefined;
328
+ underline?: boolean;
329
+ } & Omit<react.DetailedHTMLProps<react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
330
+ ref?: ((instance: HTMLButtonElement | null) => void | react.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof react.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | react.RefObject<HTMLButtonElement> | null | undefined;
331
+ } & {
332
+ href?: never;
333
+ type?: "button" | "reset" | "submit";
334
+ } & {
335
+ href: string | undefined;
336
+ children: ReactNode;
337
+ /**
338
+ * This just allows pathrough to beforeAction for link
339
+ * @ignore
340
+ */
341
+ beforeAction?: (() => Promise<void>) | (() => void);
342
+ /**
343
+ * This just allows pathrough to beforeAction for link
344
+ * @ignore
345
+ */
346
+ type?: LinkTypes;
347
+ }, "ref"> | Omit<ButtonAsButtonProps, "ref">) & react.RefAttributes<HTMLAnchorElement | HTMLButtonElement>>;
291
348
 
292
349
  type ToastProps = ComponentPropsWithoutRef<'div'> & {
293
350
  /**
@@ -990,6 +1047,11 @@ type FormProps<T> = Omit<ComponentPropsWithoutRef<'form'>, 'action' | 'aria-labe
990
1047
  * The action to be performed when the form is submitted. It can be asynchronous.
991
1048
  */
992
1049
  action?: Action;
1050
+ /**
1051
+ * Sets the default label position for all `FormFields` within the form. Will be ignored if labelPosition
1052
+ * is set on the `FormField` itself.
1053
+ */
1054
+ labelPosition?: 'block' | 'inline';
993
1055
  /**
994
1056
  * The form elements used in the form
995
1057
  */
@@ -1015,7 +1077,7 @@ type FormProps<T> = Omit<ComponentPropsWithoutRef<'form'>, 'action' | 'aria-labe
1015
1077
  * x
1016
1078
  */
1017
1079
  declare const FormComponent: {
1018
- <T>({ children, action, values, validate, fullWidth, ...props }: FormProps<T>, forwardedRef?: Ref<HTMLFormElement>): JSX.Element;
1080
+ <T>({ children, action, values, labelPosition, validate, fullWidth, ...props }: FormProps<T>, forwardedRef?: Ref<HTMLFormElement>): JSX.Element;
1019
1081
  displayName: string;
1020
1082
  };
1021
1083
  declare const Form: <T>(props: FormProps<T> & {
@@ -1052,12 +1114,16 @@ type FormFieldProps = ComponentPropsWithoutRef<'div'> & {
1052
1114
  * A value that overrides the basic value. This should pair with `onChange`.
1053
1115
  */
1054
1116
  value?: string;
1117
+ /**
1118
+ * Setting to `inline` will have the label and input appear on the same line. Setting to `block` will have the label above the input.
1119
+ */
1120
+ labelPosition?: 'block' | 'inline';
1055
1121
  };
1056
1122
  /**
1057
1123
  * Component description goes here
1058
1124
  */
1059
1125
  declare const FormField: {
1060
- ({ children, label, name, error, value, ...props }: FormFieldProps): JSX.Element;
1126
+ ({ children, label, name, error, value, labelPosition, id, ...props }: FormFieldProps): JSX.Element;
1061
1127
  displayName: string;
1062
1128
  };
1063
1129
 
@@ -1633,6 +1699,57 @@ type MenuItemButtonProps = ButtonProps & {
1633
1699
 
1634
1700
  declare const MenuItem: react.ForwardRefExoticComponent<(Omit<DropdownMenuItemProps & BaseButtonProps & Omit<react.DetailedHTMLProps<react.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "ref"> & {
1635
1701
  ref?: ((instance: HTMLAnchorElement | null) => void | react.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof react.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | react.RefObject<HTMLAnchorElement> | null | undefined;
1702
+ } & {
1703
+ beforeAction?: (() => Promise<void>) | (() => void);
1704
+ children: react.ReactNode;
1705
+ colorScheme?: ColorSchemeTypes;
1706
+ disabled?: boolean;
1707
+ leftIcon?: react.JSX.Element | undefined;
1708
+ rightIcon?: react.JSX.Element | undefined;
1709
+ type?: LinkTypes | undefined;
1710
+ underline?: boolean;
1711
+ } & Omit<react_router.LinkProps, "to"> & {
1712
+ href: string | undefined;
1713
+ type?: LinkTypes;
1714
+ } & {
1715
+ href: string | undefined;
1716
+ children: react.ReactNode;
1717
+ beforeAction?: (() => Promise<void>) | (() => void);
1718
+ type?: LinkTypes;
1719
+ } & {
1720
+ appearance?: "dangerous" | "default" | "gated";
1721
+ badge?: react.JSX.Element;
1722
+ children?: react.ReactNode;
1723
+ command?: react.ReactNode;
1724
+ icon?: ButtonProps["leftIcon"];
1725
+ leftIcon?: ButtonProps["leftIcon"];
1726
+ rightIcon?: ButtonProps["rightIcon"];
1727
+ fullWidth?: never;
1728
+ asChild?: never;
1729
+ variant?: never;
1730
+ size?: never;
1731
+ unstyled?: never;
1732
+ } & {
1733
+ /**
1734
+ * Treats the menu item as a link when provided
1735
+ */
1736
+ href?: MenuItemButtonProps["href"];
1737
+ }, "ref"> | Omit<DropdownMenuItemProps & BaseButtonProps & Omit<react.DetailedHTMLProps<react.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "ref"> & {
1738
+ ref?: ((instance: HTMLAnchorElement | null) => void | react.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof react.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | react.RefObject<HTMLAnchorElement> | null | undefined;
1739
+ } & {
1740
+ beforeAction?: (() => Promise<void>) | (() => void);
1741
+ children: react.ReactNode;
1742
+ colorScheme?: ColorSchemeTypes;
1743
+ disabled?: boolean;
1744
+ leftIcon?: react.JSX.Element | undefined;
1745
+ rightIcon?: react.JSX.Element | undefined;
1746
+ type?: LinkTypes | undefined;
1747
+ underline?: boolean;
1748
+ } & Omit<react.DetailedHTMLProps<react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
1749
+ ref?: ((instance: HTMLButtonElement | null) => void | react.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof react.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | react.RefObject<HTMLButtonElement> | null | undefined;
1750
+ } & {
1751
+ href?: never;
1752
+ type?: "button" | "reset" | "submit";
1636
1753
  } & {
1637
1754
  href: string | undefined;
1638
1755
  children: react.ReactNode;
@@ -2425,7 +2542,7 @@ type SelectOptionProps = {
2425
2542
  */
2426
2543
  children: ReactNode;
2427
2544
  /**
2428
- * The value to set
2545
+ * The value to set. Leave this empty to define a placeholder option.
2429
2546
  */
2430
2547
  value: string;
2431
2548
  /**
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as react from 'react';
3
3
  import { ReactNode, Dispatch, SetStateAction, ComponentPropsWithoutRef, JSX, ComponentPropsWithRef, MouseEvent, ElementType, ChangeEvent, ForwardedRef, Ref, InputHTMLAttributes, RefObject, ForwardRefExoticComponent, RefAttributes } from 'react';
4
+ import * as react_router from 'react-router';
4
5
  import { LinkProps as LinkProps$1 } from 'react-router-dom';
5
6
  import { CollapsibleContentProps as CollapsibleContentProps$1 } from '@radix-ui/react-collapsible';
6
7
  import * as styled_components from 'styled-components';
@@ -261,7 +262,7 @@ type BaseButtonProps = {
261
262
  */
262
263
  variant?: ButtonVariants;
263
264
  };
264
- type ButtonAsLinkProps = BaseButtonProps & ComponentPropsWithRef<'a'> & {
265
+ type ButtonAsLinkProps = BaseButtonProps & ComponentPropsWithRef<'a'> & LinkProps & {
265
266
  href: string | undefined;
266
267
  children: ReactNode;
267
268
  /**
@@ -287,7 +288,63 @@ type ButtonProps = ButtonAsButtonProps | ButtonAsLinkProps;
287
288
  * action, or performing a delete operation. It replaces the HTML `<button>` element,
288
289
  * unless an `href` attribute is passed, in which it will render an `<a>` element.
289
290
  */
290
- declare const Button: react.ForwardRefExoticComponent<(Omit<ButtonAsLinkProps, "ref"> | Omit<ButtonAsButtonProps, "ref">) & react.RefAttributes<HTMLAnchorElement | HTMLButtonElement>>;
291
+ declare const Button: react.ForwardRefExoticComponent<(Omit<BaseButtonProps & Omit<react.DetailedHTMLProps<react.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "ref"> & {
292
+ ref?: ((instance: HTMLAnchorElement | null) => void | react.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof react.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | react.RefObject<HTMLAnchorElement> | null | undefined;
293
+ } & {
294
+ beforeAction?: (() => Promise<void>) | (() => void);
295
+ children: ReactNode;
296
+ colorScheme?: ColorSchemeTypes;
297
+ disabled?: boolean;
298
+ leftIcon?: JSX.Element | undefined;
299
+ rightIcon?: JSX.Element | undefined;
300
+ type?: LinkTypes | undefined;
301
+ underline?: boolean;
302
+ } & Omit<react_router.LinkProps, "to"> & {
303
+ href: string | undefined;
304
+ type?: LinkTypes;
305
+ } & {
306
+ href: string | undefined;
307
+ children: ReactNode;
308
+ /**
309
+ * This just allows pathrough to beforeAction for link
310
+ * @ignore
311
+ */
312
+ beforeAction?: (() => Promise<void>) | (() => void);
313
+ /**
314
+ * This just allows pathrough to beforeAction for link
315
+ * @ignore
316
+ */
317
+ type?: LinkTypes;
318
+ }, "ref"> | Omit<BaseButtonProps & Omit<react.DetailedHTMLProps<react.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "ref"> & {
319
+ ref?: ((instance: HTMLAnchorElement | null) => void | react.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof react.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | react.RefObject<HTMLAnchorElement> | null | undefined;
320
+ } & {
321
+ beforeAction?: (() => Promise<void>) | (() => void);
322
+ children: ReactNode;
323
+ colorScheme?: ColorSchemeTypes;
324
+ disabled?: boolean;
325
+ leftIcon?: JSX.Element | undefined;
326
+ rightIcon?: JSX.Element | undefined;
327
+ type?: LinkTypes | undefined;
328
+ underline?: boolean;
329
+ } & Omit<react.DetailedHTMLProps<react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
330
+ ref?: ((instance: HTMLButtonElement | null) => void | react.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof react.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | react.RefObject<HTMLButtonElement> | null | undefined;
331
+ } & {
332
+ href?: never;
333
+ type?: "button" | "reset" | "submit";
334
+ } & {
335
+ href: string | undefined;
336
+ children: ReactNode;
337
+ /**
338
+ * This just allows pathrough to beforeAction for link
339
+ * @ignore
340
+ */
341
+ beforeAction?: (() => Promise<void>) | (() => void);
342
+ /**
343
+ * This just allows pathrough to beforeAction for link
344
+ * @ignore
345
+ */
346
+ type?: LinkTypes;
347
+ }, "ref"> | Omit<ButtonAsButtonProps, "ref">) & react.RefAttributes<HTMLAnchorElement | HTMLButtonElement>>;
291
348
 
292
349
  type ToastProps = ComponentPropsWithoutRef<'div'> & {
293
350
  /**
@@ -990,6 +1047,11 @@ type FormProps<T> = Omit<ComponentPropsWithoutRef<'form'>, 'action' | 'aria-labe
990
1047
  * The action to be performed when the form is submitted. It can be asynchronous.
991
1048
  */
992
1049
  action?: Action;
1050
+ /**
1051
+ * Sets the default label position for all `FormFields` within the form. Will be ignored if labelPosition
1052
+ * is set on the `FormField` itself.
1053
+ */
1054
+ labelPosition?: 'block' | 'inline';
993
1055
  /**
994
1056
  * The form elements used in the form
995
1057
  */
@@ -1015,7 +1077,7 @@ type FormProps<T> = Omit<ComponentPropsWithoutRef<'form'>, 'action' | 'aria-labe
1015
1077
  * x
1016
1078
  */
1017
1079
  declare const FormComponent: {
1018
- <T>({ children, action, values, validate, fullWidth, ...props }: FormProps<T>, forwardedRef?: Ref<HTMLFormElement>): JSX.Element;
1080
+ <T>({ children, action, values, labelPosition, validate, fullWidth, ...props }: FormProps<T>, forwardedRef?: Ref<HTMLFormElement>): JSX.Element;
1019
1081
  displayName: string;
1020
1082
  };
1021
1083
  declare const Form: <T>(props: FormProps<T> & {
@@ -1052,12 +1114,16 @@ type FormFieldProps = ComponentPropsWithoutRef<'div'> & {
1052
1114
  * A value that overrides the basic value. This should pair with `onChange`.
1053
1115
  */
1054
1116
  value?: string;
1117
+ /**
1118
+ * Setting to `inline` will have the label and input appear on the same line. Setting to `block` will have the label above the input.
1119
+ */
1120
+ labelPosition?: 'block' | 'inline';
1055
1121
  };
1056
1122
  /**
1057
1123
  * Component description goes here
1058
1124
  */
1059
1125
  declare const FormField: {
1060
- ({ children, label, name, error, value, ...props }: FormFieldProps): JSX.Element;
1126
+ ({ children, label, name, error, value, labelPosition, id, ...props }: FormFieldProps): JSX.Element;
1061
1127
  displayName: string;
1062
1128
  };
1063
1129
 
@@ -1633,6 +1699,57 @@ type MenuItemButtonProps = ButtonProps & {
1633
1699
 
1634
1700
  declare const MenuItem: react.ForwardRefExoticComponent<(Omit<DropdownMenuItemProps & BaseButtonProps & Omit<react.DetailedHTMLProps<react.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "ref"> & {
1635
1701
  ref?: ((instance: HTMLAnchorElement | null) => void | react.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof react.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | react.RefObject<HTMLAnchorElement> | null | undefined;
1702
+ } & {
1703
+ beforeAction?: (() => Promise<void>) | (() => void);
1704
+ children: react.ReactNode;
1705
+ colorScheme?: ColorSchemeTypes;
1706
+ disabled?: boolean;
1707
+ leftIcon?: react.JSX.Element | undefined;
1708
+ rightIcon?: react.JSX.Element | undefined;
1709
+ type?: LinkTypes | undefined;
1710
+ underline?: boolean;
1711
+ } & Omit<react_router.LinkProps, "to"> & {
1712
+ href: string | undefined;
1713
+ type?: LinkTypes;
1714
+ } & {
1715
+ href: string | undefined;
1716
+ children: react.ReactNode;
1717
+ beforeAction?: (() => Promise<void>) | (() => void);
1718
+ type?: LinkTypes;
1719
+ } & {
1720
+ appearance?: "dangerous" | "default" | "gated";
1721
+ badge?: react.JSX.Element;
1722
+ children?: react.ReactNode;
1723
+ command?: react.ReactNode;
1724
+ icon?: ButtonProps["leftIcon"];
1725
+ leftIcon?: ButtonProps["leftIcon"];
1726
+ rightIcon?: ButtonProps["rightIcon"];
1727
+ fullWidth?: never;
1728
+ asChild?: never;
1729
+ variant?: never;
1730
+ size?: never;
1731
+ unstyled?: never;
1732
+ } & {
1733
+ /**
1734
+ * Treats the menu item as a link when provided
1735
+ */
1736
+ href?: MenuItemButtonProps["href"];
1737
+ }, "ref"> | Omit<DropdownMenuItemProps & BaseButtonProps & Omit<react.DetailedHTMLProps<react.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "ref"> & {
1738
+ ref?: ((instance: HTMLAnchorElement | null) => void | react.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof react.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | react.RefObject<HTMLAnchorElement> | null | undefined;
1739
+ } & {
1740
+ beforeAction?: (() => Promise<void>) | (() => void);
1741
+ children: react.ReactNode;
1742
+ colorScheme?: ColorSchemeTypes;
1743
+ disabled?: boolean;
1744
+ leftIcon?: react.JSX.Element | undefined;
1745
+ rightIcon?: react.JSX.Element | undefined;
1746
+ type?: LinkTypes | undefined;
1747
+ underline?: boolean;
1748
+ } & Omit<react.DetailedHTMLProps<react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
1749
+ ref?: ((instance: HTMLButtonElement | null) => void | react.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof react.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | react.RefObject<HTMLButtonElement> | null | undefined;
1750
+ } & {
1751
+ href?: never;
1752
+ type?: "button" | "reset" | "submit";
1636
1753
  } & {
1637
1754
  href: string | undefined;
1638
1755
  children: react.ReactNode;
@@ -2425,7 +2542,7 @@ type SelectOptionProps = {
2425
2542
  */
2426
2543
  children: ReactNode;
2427
2544
  /**
2428
- * The value to set
2545
+ * The value to set. Leave this empty to define a placeholder option.
2429
2546
  */
2430
2547
  value: string;
2431
2548
  /**
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  /*
3
- * @license @wistia/ui v0.6.2
3
+ * @license @wistia/ui v0.6.3-beta.5b311d65.bf5ea63
4
4
  *
5
5
  * Copyright (c) 2024-2025, Wistia, Inc. and its affiliates.
6
6
  *
@@ -8044,9 +8044,18 @@ var FormContext = createContext2({
8044
8044
  values: {},
8045
8045
  errors: {},
8046
8046
  hasSubmitted: false,
8047
- formId: ""
8047
+ formId: "",
8048
+ labelPosition: "block"
8048
8049
  });
8049
- var FormComponent = ({ children, action, values = {}, validate, fullWidth = false, ...props }, forwardedRef) => {
8050
+ var FormComponent = ({
8051
+ children,
8052
+ action,
8053
+ values = {},
8054
+ labelPosition = "block",
8055
+ validate,
8056
+ fullWidth = false,
8057
+ ...props
8058
+ }, forwardedRef) => {
8050
8059
  const [errors, setErrors] = useState6({});
8051
8060
  const [hasSubmitted, setHasSubmitted] = useState6(false);
8052
8061
  const innerRef = useRef5();
@@ -8098,19 +8107,20 @@ var FormComponent = ({ children, action, values = {}, validate, fullWidth = fals
8098
8107
  values,
8099
8108
  errors,
8100
8109
  hasSubmitted,
8101
- formId: id
8110
+ formId: id,
8111
+ labelPosition
8102
8112
  };
8103
- }, [values, errors, id, hasSubmitted]);
8113
+ }, [labelPosition, values, errors, id, hasSubmitted]);
8104
8114
  return (
8105
8115
  // @ts-expect-error - generic context providers are a giant pain
8106
8116
  /* @__PURE__ */ jsx189(FormContext.Provider, { value: context, children: /* @__PURE__ */ jsx189(
8107
8117
  Stack,
8108
8118
  {
8109
- gap: "space-05",
8110
8119
  ...props,
8111
8120
  ref,
8112
8121
  $fullWidth: fullWidth,
8113
8122
  as: StyledForm,
8123
+ gap: "space-05",
8114
8124
  id,
8115
8125
  onBlur: handleBlur,
8116
8126
  onReset: handleReset,
@@ -8164,7 +8174,7 @@ import { useContext as useContext2, useRef as useRef6 } from "react";
8164
8174
  import { isArray, isNotUndefined as isNotUndefined6 } from "@wistia/type-guards";
8165
8175
  import { jsx as jsx190, jsxs as jsxs18 } from "react/jsx-runtime";
8166
8176
  var ErrorItem = ({ name, error, formId }) => {
8167
- return /* @__PURE__ */ jsx190("li", { children: /* @__PURE__ */ jsx190(Link, { href: `${formId}-${name}`, children: error }) }, name);
8177
+ return /* @__PURE__ */ jsx190("li", { children: /* @__PURE__ */ jsx190(Link, { href: `#${formId}-${name}`, children: error }) }, name);
8168
8178
  };
8169
8179
  var FormErrorSummary = ({ description }) => {
8170
8180
  const ref = useRef6(null);
@@ -8260,14 +8270,30 @@ var CheckboxGroup = ({
8260
8270
  CheckboxGroup.displayName = "CheckboxGroup";
8261
8271
 
8262
8272
  // src/components/FormField/FormField.tsx
8263
- import { jsx as jsx193, jsxs as jsxs20 } from "react/jsx-runtime";
8273
+ import { Fragment as Fragment6, jsx as jsx193, jsxs as jsxs20 } from "react/jsx-runtime";
8264
8274
  var StyledFormField = styled33.div`
8265
8275
  --form-field-spacing: var(--wui-space-01);
8276
+ --form-field-spacing-inline: var(--wui-space-02);
8266
8277
  --form-field-error-color: var(--wui-color-text-secondary-error);
8267
8278
 
8268
- display: flex;
8269
- flex-direction: column;
8279
+ display: grid;
8270
8280
  gap: var(--form-field-spacing);
8281
+ justify-content: flex-start;
8282
+ align-items: center;
8283
+ grid-template-columns: auto 1fr;
8284
+ grid-template-rows: auto 1fr;
8285
+
8286
+ &[data-label-position='inline'] {
8287
+ gap: var(--form-field-spacing-inline);
8288
+ grid-template-columns: minmax(auto, 1fr) 1fr;
8289
+ grid-template-rows: 1fr auto;
8290
+ }
8291
+
8292
+ &[data-label-position='block'] {
8293
+ gap: var(--form-field-spacing);
8294
+ grid-template-columns: 1fr;
8295
+ grid-template-rows: 1fr;
8296
+ }
8271
8297
  `;
8272
8298
  var StyledErrorList = styled33.ul`
8273
8299
  margin: 0;
@@ -8307,18 +8333,20 @@ var FormField = ({
8307
8333
  name,
8308
8334
  error,
8309
8335
  value,
8336
+ labelPosition,
8337
+ id,
8310
8338
  ...props
8311
8339
  }) => {
8312
8340
  const formState = useContext3(FormContext);
8313
8341
  const checkboxGroup = useContext3(CheckboxGroupContext);
8314
- const id = props.id ?? `${formState.formId}-${name}`;
8315
- const isInlineLabel = children.type === Checkbox;
8342
+ const isIntegratedLabel = children.type === Checkbox;
8343
+ const computedId = id ?? `${formState.formId}-${name}`;
8316
8344
  const computedError = error ?? formState.errors[name];
8317
8345
  const defaultValue = formState.values[name];
8318
8346
  let childProps = {
8319
8347
  name,
8320
- id,
8321
- label: isInlineLabel ? label : void 0,
8348
+ id: computedId,
8349
+ label: isIntegratedLabel ? label : void 0,
8322
8350
  ...props
8323
8351
  };
8324
8352
  if (isUndefined4(value) && isNotUndefined7(defaultValue)) {
@@ -8342,21 +8370,31 @@ var FormField = ({
8342
8370
  name: computedName,
8343
8371
  onChange: handleChange,
8344
8372
  "aria-invalid": isNotNil11(error),
8345
- "aria-describedby": isNotNil11(error) ? `${id}-error` : void 0
8373
+ "aria-describedby": isNotNil11(error) ? `${computedId}-error` : void 0
8346
8374
  };
8347
8375
  }
8348
8376
  Children4.only(children);
8349
- return /* @__PURE__ */ jsxs20(StyledFormField, { ...props, children: [
8350
- !isInlineLabel && /* @__PURE__ */ jsx193(Label, { htmlFor: id, children: label }),
8351
- cloneElement4(children, childProps),
8352
- isNotNil11(computedError) ? /* @__PURE__ */ jsx193(
8353
- ErrorMessages,
8354
- {
8355
- errors: computedError,
8356
- id: `${id}-error`
8357
- }
8358
- ) : null
8359
- ] });
8377
+ return /* @__PURE__ */ jsxs20(
8378
+ StyledFormField,
8379
+ {
8380
+ ...props,
8381
+ "data-label-position": labelPosition ?? formState.labelPosition,
8382
+ children: [
8383
+ !isIntegratedLabel && /* @__PURE__ */ jsx193(Label, { htmlFor: computedId, children: label }),
8384
+ cloneElement4(children, childProps),
8385
+ isNotNil11(computedError) ? /* @__PURE__ */ jsxs20(Fragment6, { children: [
8386
+ /* @__PURE__ */ jsx193("div", {}),
8387
+ /* @__PURE__ */ jsx193(
8388
+ ErrorMessages,
8389
+ {
8390
+ errors: computedError,
8391
+ id: `${computedId}-error`
8392
+ }
8393
+ )
8394
+ ] }) : null
8395
+ ]
8396
+ }
8397
+ );
8360
8398
  };
8361
8399
  FormField.displayName = "FormField";
8362
8400
 
@@ -9503,8 +9541,9 @@ var SelectedItemIndicatorDiv = styled47.div`
9503
9541
  left: 0;
9504
9542
  position: absolute;
9505
9543
  top: 0;
9544
+ box-shadow: var(--wui-elevation-01);
9506
9545
  transition:
9507
- transform var(--wui-motion-duration-03) var(--wui-motion-ease-out),
9546
+ transform var(--wui-motion-duration-02) var(--wui-motion-ease-out),
9508
9547
  width var(--wui-motion-duration-02) var(--wui-motion-ease-out);
9509
9548
  z-index: ${Z_INDEX_TO_SIT_BEHIND_SIBLINGS};
9510
9549
  `;
@@ -9612,13 +9651,16 @@ var segmentedControlItemStyles = css27`
9612
9651
  color: var(--wui-color-text-secondary);
9613
9652
  cursor: pointer;
9614
9653
  display: flex;
9654
+ gap: 2px;
9615
9655
  flex-grow: 1;
9616
9656
  flex-shrink: 1;
9617
9657
  font-size: var(--wui-typography-label-3-size);
9618
9658
  font-weight: var(--wui-typography-label-3-weight);
9659
+ line-height: var(--wui-typography-label-3-line-height);
9619
9660
  justify-content: center;
9620
- padding: 6px ${({ $hasLabel }) => $hasLabel ? "8px" : "6px"};
9661
+ padding: 6px ${({ $hasLabel }) => $hasLabel ? "12px" : "6px"};
9621
9662
  user-select: none;
9663
+ transition: background-color var(--wui-motion-duration-01) var(--wui-motion-ease);
9622
9664
 
9623
9665
  /* Icon component */
9624
9666
  svg {
@@ -9642,13 +9684,8 @@ var segmentedControlItemStyles = css27`
9642
9684
  &[data-state='active'] {
9643
9685
  color: var(--wui-color-text-selected);
9644
9686
  cursor: default;
9645
- }
9646
-
9647
- &:focus-visible,
9648
- &[data-state='on'],
9649
- &[data-state='active'] {
9650
9687
  svg path {
9651
- fill: var(--wui-color-focus-ring);
9688
+ fill: var(--wui-color-icon-selected);
9652
9689
  }
9653
9690
  }
9654
9691
 
@@ -9854,7 +9891,7 @@ var TabItem = forwardRef21(
9854
9891
  TabItem.displayName = "TabItem";
9855
9892
 
9856
9893
  // src/components/Tabs/extractTabItems.ts
9857
- import { Children as Children6, Fragment as Fragment6, isValidElement as isValidElement2 } from "react";
9894
+ import { Children as Children6, Fragment as Fragment7, isValidElement as isValidElement2 } from "react";
9858
9895
  var extractTabItems = (children) => {
9859
9896
  const tabItems = [];
9860
9897
  Children6.forEach(children, (child) => {
@@ -9863,7 +9900,7 @@ var extractTabItems = (children) => {
9863
9900
  }
9864
9901
  if (typeof child.type !== "string" && child.type.displayName === "Tab") {
9865
9902
  tabItems.push(child);
9866
- } else if (child.type === Fragment6) {
9903
+ } else if (child.type === Fragment7) {
9867
9904
  const fragmentElement = child;
9868
9905
  tabItems.push(...extractTabItems(fragmentElement.props.children));
9869
9906
  } else if ((child.props.children ?? null) != null) {
@@ -10024,7 +10061,7 @@ Tab.displayName = "Tab";
10024
10061
  import { forwardRef as forwardRef24 } from "react";
10025
10062
  import styled54 from "styled-components";
10026
10063
  import { isNil as isNil15, isNotNil as isNotNil22, isNonEmptyString as isNonEmptyString4 } from "@wistia/type-guards";
10027
- import { Fragment as Fragment7, jsx as jsx220, jsxs as jsxs34 } from "react/jsx-runtime";
10064
+ import { Fragment as Fragment8, jsx as jsx220, jsxs as jsxs34 } from "react/jsx-runtime";
10028
10065
  var TagLabel = styled54.a`
10029
10066
  ${({ $colorScheme }) => getColorScheme($colorScheme)};
10030
10067
  font-size: var(--wui-typography-label-4-size);
@@ -10109,7 +10146,7 @@ var RemoveButton = ({ onClickRemove, onClickRemoveLabel, colorScheme }) => {
10109
10146
  "for accessibility, onClickRemoveLabel must be provided if onClickRemove is provided"
10110
10147
  );
10111
10148
  }
10112
- return /* @__PURE__ */ jsxs34(Fragment7, { children: [
10149
+ return /* @__PURE__ */ jsxs34(Fragment8, { children: [
10113
10150
  /* @__PURE__ */ jsx220(TagDivider, { $colorScheme: colorScheme }),
10114
10151
  /* @__PURE__ */ jsxs34(
10115
10152
  StyledRemoveButton,
@@ -10340,6 +10377,7 @@ var StyledContent3 = styled56(Content4)`
10340
10377
  border-radius: var(--wui-select-content-border-radius);
10341
10378
  padding: var(--wui-select-option-padding);
10342
10379
  min-width: 200px;
10380
+ z-index: var(--wui-zindex-menu);
10343
10381
  `;
10344
10382
  var Select = forwardRef25(
10345
10383
  ({