@ostack.tech/ui 0.6.5 → 0.8.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.
Files changed (72) hide show
  1. package/dist/chunks/{en-C2peM913.js → en-BfgHKQwn.js} +2 -1
  2. package/dist/chunks/en-BfgHKQwn.js.map +1 -0
  3. package/dist/locales/en-GB.js +1 -1
  4. package/dist/locales/en-US.js +1 -1
  5. package/dist/locales/fr-FR.js +1 -0
  6. package/dist/locales/fr-FR.js.map +1 -1
  7. package/dist/locales/pt-PT.js +1 -0
  8. package/dist/locales/pt-PT.js.map +1 -1
  9. package/dist/ostack-ui.css +15 -12
  10. package/dist/ostack-ui.css.map +1 -1
  11. package/dist/ostack-ui.js +1266 -1086
  12. package/dist/ostack-ui.js.map +1 -1
  13. package/dist/types/components/Alert/Alert.d.ts +1 -1
  14. package/dist/types/components/Alert/AlertTitle.d.ts +7 -3
  15. package/dist/types/components/AlertDialog/AlertDialogTitle.d.ts +7 -2
  16. package/dist/types/components/Button/Button.d.ts +43 -13
  17. package/dist/types/components/Calendar/Calendar.d.ts +2 -2
  18. package/dist/types/components/Card/CardTitle.d.ts +8 -11
  19. package/dist/types/components/Checkbox/Checkbox.d.ts +26 -2
  20. package/dist/types/components/CheckboxGroup/CheckboxGroup.d.ts +29 -2
  21. package/dist/types/components/CheckboxGroup/CheckboxGroupContext.d.ts +4 -0
  22. package/dist/types/components/CloseButton/CloseButton.d.ts +1 -1
  23. package/dist/types/components/CommandMenu/CommandMenuItem.d.ts +1 -1
  24. package/dist/types/components/DataTable/DataTablePagination.d.ts +2 -2
  25. package/dist/types/components/DataTable/DataTableSelectionTrigger.d.ts +1 -1
  26. package/dist/types/components/DateRangeInput/DateRangeInput.d.ts +47 -12
  27. package/dist/types/components/Dialog/DialogTitle.d.ts +7 -2
  28. package/dist/types/components/DropdownMenu/DropdownMenuCheckboxItem.d.ts +1 -1
  29. package/dist/types/components/DropdownMenu/DropdownMenuItem.d.ts +1 -1
  30. package/dist/types/components/DropdownMenu/DropdownMenuRadioItem.d.ts +1 -1
  31. package/dist/types/components/ErrorBoundary/ErrorBoundary.d.ts +1 -1
  32. package/dist/types/components/FeedbackPopover/FeedbackPopover.d.ts +1 -1
  33. package/dist/types/components/Field/FieldContext.d.ts +1 -0
  34. package/dist/types/components/FieldGroup/FieldGroupTitle.d.ts +7 -10
  35. package/dist/types/components/Heading/Heading.d.ts +13 -6
  36. package/dist/types/components/IconButton/IconButton.d.ts +44 -12
  37. package/dist/types/components/Input/Input.d.ts +32 -2
  38. package/dist/types/components/Label/Label.d.ts +1 -1
  39. package/dist/types/components/Link/Link.d.ts +8 -3
  40. package/dist/types/components/MenuList/MenuListItem.d.ts +36 -17
  41. package/dist/types/components/Output/Output.d.ts +20 -2
  42. package/dist/types/components/RadioGroup/Radio.d.ts +26 -2
  43. package/dist/types/components/RadioGroup/RadioGroup.d.ts +26 -2
  44. package/dist/types/components/Select/Select.d.ts +2 -2
  45. package/dist/types/components/Table/TableColumn.d.ts +2 -2
  46. package/dist/types/index.d.ts +3 -1
  47. package/dist/types/providers/AlertDialogProvider/AlertDialogProviderContext.d.ts +2 -2
  48. package/dist/types/providers/LocalizationProvider/LocalizationObject.d.ts +1 -1
  49. package/dist/types/utils/combineAriaIds.d.ts +2 -0
  50. package/dist/types/utils/control.d.ts +1 -0
  51. package/dist/types/utils/polymorphicTypes.d.ts +23 -0
  52. package/dist/types/utils/setNativeProperty.d.ts +8 -0
  53. package/package.json +1 -1
  54. package/scss/components/Checkbox/_Checkbox.scss +1 -1
  55. package/scss/components/ControlAddon/_ControlAddon.scss +3 -3
  56. package/scss/components/DropdownMenu/_DropdownMenu.scss +1 -1
  57. package/scss/components/FieldGroup/_FieldGroup-variables.scss +3 -3
  58. package/scss/components/RadioGroup/_Radio.scss +1 -1
  59. package/scss/components/Select/_Select-variables.scss +1 -1
  60. package/scss/components/Select/_Select.scss +1 -1
  61. package/scss/scss/placeholders/checkable/_checkable.scss +3 -3
  62. package/scss/scss/placeholders/control/_control.scss +1 -1
  63. package/scss/scss/placeholders/menu/_menu.scss +8 -3
  64. package/scss/scss/placeholders/popover/_popover.scss +10 -12
  65. package/scss/scss/utils/_breakpoints.scss +4 -5
  66. package/scss/scss/utils/_css-color-functions.scss +10 -6
  67. package/scss/scss/utils/_declare-var.scss +1 -1
  68. package/scss/scss/utils/_maybe-important.scss +1 -1
  69. package/scss/scss/utils/_spacing.scss +10 -5
  70. package/dist/chunks/en-C2peM913.js.map +0 -1
  71. package/dist/types/utils/mergeAriaIds.d.ts +0 -2
  72. package/dist/types/utils/setNativeValue.d.ts +0 -7
@@ -69,7 +69,7 @@ export interface AlertProps extends ComponentPropsWithoutRef<"div"> {
69
69
  * ```tsx
70
70
  * import { Alert, AlertTitle } from "@ostack.tech/ui";
71
71
  *
72
- * function TermAndConditionsNotice {
72
+ * function TermsAndConditionsNotice {
73
73
  * return (
74
74
  * <Alert>
75
75
  * <AlertTitle>Notice</AlertTitle>
@@ -1,6 +1,10 @@
1
- import { ComponentPropsWithoutRef } from 'react';
1
+ import { PolymorphicComponent, PolymorphicProps } from '../../utils/polymorphicTypes.ts';
2
+ /** Element an alert title can be rendered as. */
3
+ export type AlertTitleAs = "div" | "span" | "h2" | "h3" | "h4" | "h5" | "h6";
2
4
  /** Properties of the alert title component. */
3
- export interface AlertTitleProps extends ComponentPropsWithoutRef<"div"> {
5
+ export type AlertTitleProps<TAs extends AlertTitleAs = "div"> = PolymorphicProps<AlertTitleAs, TAs, "div", AlertTitleOwnProps>;
6
+ /** Own properties of the alert title component. */
7
+ export interface AlertTitleOwnProps {
4
8
  /**
5
9
  * Change the component to the HTML tag or custom component of the only child.
6
10
  * This will merge the original component props with the props of the supplied
@@ -9,4 +13,4 @@ export interface AlertTitleProps extends ComponentPropsWithoutRef<"div"> {
9
13
  asChild?: boolean;
10
14
  }
11
15
  /** Title of the alert. */
12
- export declare const AlertTitle: import('react').ForwardRefExoticComponent<AlertTitleProps & import('react').RefAttributes<HTMLDivElement>>;
16
+ export declare const AlertTitle: PolymorphicComponent<AlertTitleAs, "div", AlertTitleOwnProps>;
@@ -1,7 +1,12 @@
1
1
  import { AlertDialog as AlertDialogPrimitive } from 'radix-ui';
2
2
  import { ComponentPropsWithoutRef } from 'react';
3
+ import { PolymorphicComponent, PolymorphicProps } from '../../utils/polymorphicTypes.ts';
4
+ /** Element an alert dialog title can be rendered as. */
5
+ export type AlertDialogTitleAs = "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "div" | "span";
3
6
  /** Properties of the alert dialog title component. */
4
- export interface AlertDialogTitleProps extends ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Title> {
7
+ export type AlertDialogTitleProps<TAs extends AlertDialogTitleAs = "h2"> = PolymorphicProps<AlertDialogTitleAs, TAs, "h2", AlertDialogTitleOwnProps>;
8
+ /** Own properties of the alert dialog title component. */
9
+ export interface AlertDialogTitleOwnProps extends Pick<ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Title>, "asChild"> {
5
10
  }
6
11
  /** Accessible title to be announced when the alert dialog is opened. */
7
- export declare const AlertDialogTitle: import('react').ForwardRefExoticComponent<AlertDialogTitleProps & import('react').RefAttributes<HTMLHeadingElement>>;
12
+ export declare const AlertDialogTitle: PolymorphicComponent<AlertDialogTitleAs, "h2", AlertDialogTitleOwnProps>;
@@ -1,7 +1,10 @@
1
- import { ComponentPropsWithoutRef, ComponentPropsWithRef, ReactElement, ReactNode } from 'react';
1
+ import { ComponentPropsWithRef, ReactElement, ReactNode } from 'react';
2
2
  import { AccentColor } from '../../utils/accent.ts';
3
+ import { PolymorphicComponent, PolymorphicProps } from '../../utils/polymorphicTypes.ts';
3
4
  import { Icon, IconProp } from '../Icon';
4
5
  import { Spinner } from '../Spinner';
6
+ /** Elements a button can be rendered as. */
7
+ export type ButtonAs = "button" | "a";
5
8
  /** Button variants. */
6
9
  export type ButtonVariant = "solid" | "subtle" | "outlined" | "ghost";
7
10
  /** Button colours. */
@@ -11,7 +14,9 @@ export type ButtonSize = "sm" | "md" | "lg" | "xl";
11
14
  /** Button's icon placement. */
12
15
  export type ButtonIconPlacement = "start" | "end";
13
16
  /** Properties of the button component. */
14
- export interface ButtonProps extends ComponentPropsWithoutRef<"button"> {
17
+ export type ButtonProps<TAs extends ButtonAs = "button"> = PolymorphicProps<ButtonAs, TAs, "button", ButtonOwnProps>;
18
+ /** Own properties of the button component. */
19
+ export interface ButtonOwnProps {
15
20
  /**
16
21
  * Change the component to the HTML tag or custom component of the only child.
17
22
  * This will merge the original component props with the props of the supplied
@@ -70,25 +75,50 @@ export interface ButtonProps extends ComponentPropsWithoutRef<"button"> {
70
75
  */
71
76
  disabled?: boolean;
72
77
  /**
73
- * Whether to display the button in "loading" state by presenting a spinner as
74
- * icon. The position of the spinner may be controlled via `iconPlacement`.
78
+ * Renders the button in a **loading** state.
75
79
  *
76
- * Setting this property will automatically disable the button.
80
+ * When `true`, the button is “soft-disabled”: it looks disabled and ignores
81
+ * user interaction but remains focusable. By default, a spinner is shown as
82
+ * the button's icon (_i.e._, `showSpinner` is set to `true` unless
83
+ * overridden).
77
84
  *
78
- * @default false
79
- */
80
- loading?: boolean;
81
- /**
82
- * Whether the button should be enabled when `loading` is `true`.
85
+ * The button's content while loading can be controlled via `loadingContent`.
86
+ * The position of the spinner may be controlled via `iconPlacement`.
87
+ *
88
+ * To only show a spinner without “soft-disabling” the button, set
89
+ * `showSpinner` instead.
90
+ *
91
+ * @example
92
+ *
93
+ * ```tsx
94
+ * <Button loading={saving} loadingContent="Saving…">
95
+ * Save
96
+ * </Button>;
97
+ * ```
83
98
  *
84
99
  * @default false
85
100
  */
86
- enabledWhenLoading?: boolean;
101
+ loading?: boolean;
87
102
  /**
88
- * Content of the button when it is in "loading" state. If not provided, the
103
+ * Content of the button when it is in loading state. If not provided, the
89
104
  * button content will remain unchanged.
90
105
  */
91
106
  loadingContent?: ReactNode;
107
+ /**
108
+ * Whether to show a spinner as the button's icon.
109
+ *
110
+ * Defaults to the value of the `loading` property. In most cases, prefer
111
+ * `loading`, which also “soft-disables” the button.
112
+ *
113
+ * Use `showSpinner` when you want a spinner **without** “soft-disabling” the
114
+ * button. To “soft-disable” **without** a spinner, set `loading` to `true`
115
+ * and `showSpinner` to `false`.
116
+ *
117
+ * The position of the spinner may be controlled via `iconPlacement`.
118
+ *
119
+ * @default loading
120
+ */
121
+ showSpinner?: boolean;
92
122
  /** Properties to pass to the icon component. */
93
123
  iconProps?: Omit<ComponentPropsWithRef<typeof Icon>, "icon">;
94
124
  /** Properties to pass to the spinner component. */
@@ -108,4 +138,4 @@ export interface ButtonProps extends ComponentPropsWithoutRef<"button"> {
108
138
  * }
109
139
  * ```
110
140
  */
111
- export declare const Button: import('react').ForwardRefExoticComponent<ButtonProps & import('react').RefAttributes<HTMLButtonElement>>;
141
+ export declare const Button: PolymorphicComponent<ButtonAs, "button", ButtonOwnProps>;
@@ -26,9 +26,9 @@ export interface CalendarProps extends Omit<DayPickerProps, "mode" | "selected"
26
26
  /** Properties to pass to the caption element. */
27
27
  captionProps?: ComponentPropsWithRef<"div">;
28
28
  /** Properties to pass to the previous button component. */
29
- previousButtonProps?: ComponentPropsWithRef<typeof IconButton>;
29
+ previousButtonProps?: ComponentPropsWithRef<typeof IconButton<"button">>;
30
30
  /** Properties to pass to the next button component. */
31
- nextButtonProps?: ComponentPropsWithRef<typeof IconButton>;
31
+ nextButtonProps?: ComponentPropsWithRef<typeof IconButton<"button">>;
32
32
  /** Properties to pass to the month select component. */
33
33
  monthSelectProps?: Omit<ComponentPropsWithRef<typeof Select>, "multiple" | "defaultValue" | "value">;
34
34
  /** Properties to pass to the year select component. */
@@ -1,19 +1,16 @@
1
- import { ComponentPropsWithoutRef } from 'react';
2
- import { HeadingLevel } from '../Heading';
3
- /** Properties of the card title component. */
4
- export interface CardTitleProps extends ComponentPropsWithoutRef<"h2"> {
1
+ import { PolymorphicComponent, PolymorphicProps } from '../../utils/polymorphicTypes.ts';
2
+ /** Elements a card title can be rendered as. */
3
+ export type CardTitleAs = "div" | "span" | "h2" | "h3" | "h4" | "h5" | "h6";
4
+ /** Properties of the button component. */
5
+ export type CardTitleProps<TAs extends CardTitleAs = "div"> = PolymorphicProps<CardTitleAs, TAs, "div", CardTitleOwnProps>;
6
+ /** Own properties of the card title component. */
7
+ export interface CardTitleOwnProps {
5
8
  /**
6
9
  * Change the component to the HTML tag or custom component of the only child.
7
10
  * This will merge the original component props with the props of the supplied
8
11
  * element/component and change the underlying DOM node.
9
12
  */
10
13
  asChild?: boolean;
11
- /**
12
- * Heading level.
13
- *
14
- * @default 2
15
- */
16
- level?: HeadingLevel;
17
14
  }
18
15
  /** Title of the `Card` component. */
19
- export declare const CardTitle: import('react').ForwardRefExoticComponent<CardTitleProps & import('react').RefAttributes<HTMLHeadingElement>>;
16
+ export declare const CardTitle: PolymorphicComponent<CardTitleAs, "div", CardTitleOwnProps>;
@@ -21,12 +21,36 @@ export interface CheckboxProps extends Omit<ComponentPropsWithoutRef<typeof Chec
21
21
  /** Sets the checkbox as read-only. */
22
22
  readOnly?: boolean;
23
23
  /**
24
- * Adds a spinner to the checkbox to indicate activity. Note that it doesn't
25
- * automatically disable the checkbox.
24
+ * Renders the checkbox in a **loading** state.
25
+ *
26
+ * When `true`, the checkbox is “soft-disabled”: it looks disabled and ignores
27
+ * user interaction but remains focusable. By default, a spinner is shown
28
+ * (_i.e._, `showSpinner` is set to `true` unless overridden).
29
+ *
30
+ * The checkbox's accessible description while loading can be controlled via
31
+ * `loadingDescription`.
32
+ *
33
+ * To only show a spinner without “soft-disabling” the checkbox, set
34
+ * `showSpinner` instead.
26
35
  *
27
36
  * @default false
28
37
  */
29
38
  loading?: boolean;
39
+ /** Accessible description of the checkbox when it is in a “loading” state. */
40
+ loadingDescription?: ReactNode;
41
+ /**
42
+ * Whether to show a spinner next to the checkbox.
43
+ *
44
+ * Defaults to the value of the `loading` property. In most cases, prefer
45
+ * `loading`, which also “soft-disables” the checkbox.
46
+ *
47
+ * Use `showSpinner` when you want a spinner **without** “soft-disabling” the
48
+ * checkbox. To “soft-disable” **without** a spinner, set `loading` to `true`
49
+ * and `showSpinner` to `false`.
50
+ *
51
+ * @default loading
52
+ */
53
+ showSpinner?: boolean;
30
54
  /**
31
55
  * Function called when the focus moves out of the control as a whole.
32
56
  *
@@ -21,12 +21,39 @@ export interface CheckboxGroupProps extends ComponentPropsWithoutRef<"div"> {
21
21
  /** Checkbox group name. */
22
22
  name?: string;
23
23
  /**
24
- * Adds a spinner to the checkbox group to indicate activity. Note that it
25
- * doesn't automatically disable the control.
24
+ * Renders the checkbox group in a **loading** state.
25
+ *
26
+ * When `true`, the checkbox group is “soft-disabled”: it looks disabled and
27
+ * ignores user interaction but remains focusable. By default, a spinner is
28
+ * shown (_i.e._, `showSpinner` is set to `true` unless overridden).
29
+ *
30
+ * The checkbox group's accessible description while loading can be controlled
31
+ * via `loadingDescription`.
32
+ *
33
+ * To only show a spinner without “soft-disabling” the checkbox group, set
34
+ * `showSpinner` instead.
26
35
  *
27
36
  * @default false
28
37
  */
29
38
  loading?: boolean;
39
+ /**
40
+ * Accessible description of the checkbox group when it is in a “loading”
41
+ * state.
42
+ */
43
+ loadingDescription?: ReactNode;
44
+ /**
45
+ * Whether to show a spinner next to the checkbox group.
46
+ *
47
+ * Defaults to the value of the `loading` property. In most cases, prefer
48
+ * `loading`, which also “soft-disables” the checkbox group.
49
+ *
50
+ * Use `showSpinner` when you want a spinner **without** “soft-disabling” the
51
+ * checkbox group. To “soft-disable” **without** a spinner, set `loading` to
52
+ * `true` and `showSpinner` to `false`.
53
+ *
54
+ * @default loading
55
+ */
56
+ showSpinner?: boolean;
30
57
  /** Whether the field is required. */
31
58
  required?: boolean;
32
59
  /** Whether to disable the checkbox group. */
@@ -2,6 +2,10 @@ export interface CheckboxGroupContextValue {
2
2
  name?: string;
3
3
  value: string[];
4
4
  onCheckedChange: (value: string, checked: boolean) => void;
5
+ loadingDescriptionId?: string;
6
+ errorMessageIds?: string[];
7
+ ariaDescribedBy?: string;
8
+ descriptionIds?: string[];
5
9
  }
6
10
  /** Checkbox group context. */
7
11
  export declare const CheckboxGroupContext: import('react').Context<CheckboxGroupContextValue | null>;
@@ -1,7 +1,7 @@
1
1
  import { ComponentPropsWithoutRef } from 'react';
2
2
  import { IconButton } from '../IconButton';
3
3
  /** Properties of the close button component. */
4
- export interface CloseButtonProps extends Partial<ComponentPropsWithoutRef<typeof IconButton>> {
4
+ export interface CloseButtonProps extends Partial<ComponentPropsWithoutRef<typeof IconButton<"button">>> {
5
5
  }
6
6
  /** Component rendering a “close” button. */
7
7
  export declare const CloseButton: import('react').ForwardRefExoticComponent<CloseButtonProps & import('react').RefAttributes<HTMLButtonElement>>;
@@ -1,7 +1,7 @@
1
1
  import { Command as CommandPrimitive } from 'cmdk';
2
2
  import { ComponentPropsWithoutRef } from 'react';
3
3
  import { MenuListItemProps } from '../MenuList';
4
- export interface CommandMenuItemProps extends Omit<ComponentPropsWithoutRef<typeof CommandPrimitive.Item>, "asChild" | "color">, Pick<MenuListItemProps, "selected" | "color" | "loading" | "enabledWhenLoading" | "loadingContent" | "icon" | "iconPlacement" | "href" | "target" | "rel" | "actionProps" | "contentProps" | "iconProps" | "spinnerProps"> {
4
+ export interface CommandMenuItemProps extends Omit<ComponentPropsWithoutRef<typeof CommandPrimitive.Item>, "asChild" | "color">, Pick<MenuListItemProps, "selected" | "color" | "loading" | "loadingContent" | "showSpinner" | "icon" | "iconPlacement" | "href" | "target" | "rel" | "actionProps" | "contentProps" | "iconProps" | "spinnerProps"> {
5
5
  /**
6
6
  * Render the item as a link. When set, you can pass `href`, `target`, and
7
7
  * `rel` properties to the item.
@@ -25,9 +25,9 @@ export interface DataTablePaginationProps extends ComponentPropsWithoutRef<"div"
25
25
  * Properties to pass to the previous page button (only relevant in paged
26
26
  * mode).
27
27
  */
28
- previousPageButtonProps?: ComponentPropsWithRef<typeof IconButton>;
28
+ previousPageButtonProps?: ComponentPropsWithRef<typeof IconButton<"button">>;
29
29
  /** Properties to pass to the next page button (only relevant in paged mode). */
30
- nextPageButtonProps?: ComponentPropsWithRef<typeof IconButton>;
30
+ nextPageButtonProps?: ComponentPropsWithRef<typeof IconButton<"button">>;
31
31
  }
32
32
  /** Component used to provide pagination to the data table. */
33
33
  export declare const DataTablePagination: import('react').ForwardRefExoticComponent<DataTablePaginationProps & import('react').RefAttributes<HTMLDivElement>>;
@@ -1,7 +1,7 @@
1
1
  import { ComponentPropsWithoutRef, Key, MouseEvent, ReactNode } from 'react';
2
2
  import { Button } from '../Button';
3
3
  /** Properties of the data table selection trigger component. */
4
- export interface DataTableSelectionTriggerProps extends Omit<ComponentPropsWithoutRef<typeof Button>, "onClick"> {
4
+ export interface DataTableSelectionTriggerProps extends Omit<ComponentPropsWithoutRef<typeof Button<"button">>, "onClick"> {
5
5
  /**
6
6
  * Whether the component should preferably be aligned to the right. This only
7
7
  * has an effect when the component is nested directly under the `DataTable`.
@@ -54,26 +54,61 @@ export interface DateRangeInputProps extends Omit<ComponentPropsWithoutRef<"div"
54
54
  /** Maximum year allowed. */
55
55
  maxYear?: number;
56
56
  /**
57
- * Adds a spinner to the start/end inputs to indicate activity. Note that it
58
- * doesn't automatically disable the input.
57
+ * Renders the date-range input in a **loading** state.
58
+ *
59
+ * When `true`, the date-range input is “soft-disabled”: it looks disabled and
60
+ * ignores user interaction but remains focusable. By default, spinners are
61
+ * shown (_i.e._, `showSpinners` is set to `true` unless overridden).
62
+ *
63
+ * The date-range input's accessible description while loading can be
64
+ * controlled via `loadingDescription`.
65
+ *
66
+ * To only show spinners without “soft-disabling” the date-range input, set
67
+ * `showSpinners` instead.
68
+ *
69
+ * @example
70
+ *
71
+ * ```tsx
72
+ * <DateRangeInput loading={fetching} loadingDescription="Fetching…" />;
73
+ * ```
59
74
  *
60
75
  * @default false
61
76
  */
62
77
  loading?: boolean;
63
78
  /**
64
- * Adds a spinner to the start input to indicate activity. Note that it
65
- * doesn't automatically disable the input.
79
+ * Accessible description of the date-range input when it is in a “loading”
80
+ * state.
81
+ */
82
+ loadingDescription?: ReactNode;
83
+ /**
84
+ * Whether to show spinners in the start and end parts of the date-range
85
+ * input.
86
+ *
87
+ * Defaults to the value of the `loading` property. In most cases, prefer
88
+ * `loading`, which also “soft-disables” the date-range input.
89
+ *
90
+ * Use `showSpinners` when you want spinners **without** “soft-disabling” the
91
+ * date-range input. To “soft-disable” **without** spinners, set `loading` to
92
+ * `true` and `showSpinners` to `false`.
93
+ *
94
+ * Use `showStartSpinner` or `showEndSpinner` to individually control whether
95
+ * to show a spinner in the start or end parts of the date-range input.
66
96
  *
67
97
  * @default loading
68
98
  */
69
- startLoading?: boolean;
99
+ showSpinners?: boolean;
70
100
  /**
71
- * Adds a spinner to the end input to indicate activity. Note that it doesn't
72
- * automatically disable the input.
101
+ * Whether to show the start input spinner.
73
102
  *
74
- * @default loading
103
+ * @default showSpinners
104
+ */
105
+ showStartSpinner?: boolean;
106
+ /**
107
+ * Whether to show the end input spinner.
108
+ *
109
+ * @default showSpinners
75
110
  */
76
- endLoading?: boolean;
111
+ showEndSpinner?: boolean;
77
112
  /** Sets the inputs' text align. */
78
113
  align?: Responsive<CSSProperties["textAlign"]>;
79
114
  /** Date-range input's start adornment. */
@@ -104,17 +139,17 @@ export interface DateRangeInputProps extends Omit<ComponentPropsWithoutRef<"div"
104
139
  */
105
140
  fullFormat?: string;
106
141
  /** Description of the short format provided to assistive technologies. */
107
- formatDescription?: string;
142
+ formatDescription?: ReactNode;
108
143
  /**
109
144
  * Label announced to assistive technologies for the start input (so that the
110
145
  * user knows that they are interacting with the start input).
111
146
  */
112
- startInputLabel?: string;
147
+ startInputLabel?: ReactNode;
113
148
  /**
114
149
  * Label announced to assistive technologies for the end input (so that the
115
150
  * user knows that they are interacting with the end input).
116
151
  */
117
- endInputLabel?: string;
152
+ endInputLabel?: ReactNode;
118
153
  /**
119
154
  * Function that should return the label to provide to the button that opens
120
155
  * the input's calendar.
@@ -1,7 +1,12 @@
1
1
  import { Dialog as DialogPrimitive } from 'radix-ui';
2
2
  import { ComponentPropsWithoutRef } from 'react';
3
+ import { PolymorphicComponent, PolymorphicProps } from '../../utils/polymorphicTypes.ts';
4
+ /** Element a dialog title can be rendered as. */
5
+ export type DialogTitleAs = "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "div" | "span";
3
6
  /** Properties of the dialog title component. */
4
- export interface DialogTitleProps extends ComponentPropsWithoutRef<typeof DialogPrimitive.Title> {
7
+ export type DialogTitleProps<TAs extends DialogTitleAs = "h2"> = PolymorphicProps<DialogTitleAs, TAs, "h2", DialogTitleOwnProps>;
8
+ /** Own properties of the dialog title component. */
9
+ export interface DialogTitleOwnProps extends Pick<ComponentPropsWithoutRef<typeof DialogPrimitive.Title>, "asChild"> {
5
10
  }
6
11
  /** Accessible title to be announced when the dialog is opened. */
7
- export declare const DialogTitle: import('react').ForwardRefExoticComponent<DialogTitleProps & import('react').RefAttributes<HTMLHeadingElement>>;
12
+ export declare const DialogTitle: PolymorphicComponent<DialogTitleAs, "h2", DialogTitleOwnProps>;
@@ -4,7 +4,7 @@ import { CheckboxChecked } from '../Checkbox';
4
4
  import { Icon } from '../Icon';
5
5
  import { MenuListItemProps } from '../MenuList';
6
6
  /** Properties of the dropdown menu checkbox item. */
7
- export interface DropdownMenuCheckboxItemProps extends Omit<ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>, "asChild" | "color">, Pick<MenuListItemProps, "color" | "loading" | "enabledWhenLoading" | "loadingContent" | "iconPlacement" | "actionProps" | "contentProps" | "iconProps" | "spinnerProps"> {
7
+ export interface DropdownMenuCheckboxItemProps extends Omit<ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>, "asChild" | "color">, Pick<MenuListItemProps, "color" | "loading" | "loadingContent" | "showSpinner" | "iconPlacement" | "actionProps" | "contentProps" | "iconProps" | "spinnerProps"> {
8
8
  /**
9
9
  * Whether to show the checkbox.
10
10
  *
@@ -2,7 +2,7 @@ import { DropdownMenu as DropdownMenuPrimitive } from 'radix-ui';
2
2
  import { ComponentPropsWithoutRef } from 'react';
3
3
  import { MenuListItemProps } from '../MenuList';
4
4
  /** Properties of the dropdown menu item. */
5
- export interface DropdownMenuItemProps extends Omit<ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item>, "asChild" | "color">, Pick<MenuListItemProps, "selected" | "color" | "loading" | "enabledWhenLoading" | "loadingContent" | "icon" | "iconPlacement" | "href" | "target" | "rel" | "actionProps" | "contentProps" | "iconProps" | "spinnerProps"> {
5
+ export interface DropdownMenuItemProps extends Omit<ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item>, "asChild" | "color">, Pick<MenuListItemProps, "selected" | "color" | "loading" | "loadingContent" | "showSpinner" | "icon" | "iconPlacement" | "href" | "target" | "rel" | "actionProps" | "contentProps" | "iconProps" | "spinnerProps"> {
6
6
  /**
7
7
  * Render the item as a link. When set, you can pass `href`, `target`, and
8
8
  * `rel` properties to the item.
@@ -2,7 +2,7 @@ import { DropdownMenu as DropdownMenuPrimitive } from 'radix-ui';
2
2
  import { ComponentPropsWithoutRef, ComponentPropsWithRef } from 'react';
3
3
  import { MenuListItemProps } from '../MenuList';
4
4
  /** Properties of the dropdown menu radio item. */
5
- export interface DropdownMenuRadioItemProps extends Omit<ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>, "asChild" | "color">, Pick<MenuListItemProps, "color" | "loading" | "enabledWhenLoading" | "loadingContent" | "iconPlacement" | "actionProps" | "contentProps" | "iconProps" | "spinnerProps"> {
5
+ export interface DropdownMenuRadioItemProps extends Omit<ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>, "asChild" | "color">, Pick<MenuListItemProps, "color" | "loading" | "loadingContent" | "showSpinner" | "iconPlacement" | "actionProps" | "contentProps" | "iconProps" | "spinnerProps"> {
6
6
  /**
7
7
  * Whether to show the radio.
8
8
  *
@@ -68,7 +68,7 @@ export interface ErrorBoundaryProps extends Pick<ComponentPropsWithoutRef<typeof
68
68
  * Properties to pass to the `IconButton` component used to reset the error
69
69
  * boundary.
70
70
  */
71
- resetButtonProps?: ComponentPropsWithRef<typeof IconButton>;
71
+ resetButtonProps?: ComponentPropsWithRef<typeof IconButton<"button">>;
72
72
  children?: ReactNode;
73
73
  }
74
74
  /**
@@ -25,7 +25,7 @@ export interface FeedbackPopoverProps extends ComponentPropsWithoutRef<typeof Po
25
25
  /** Properties to pass to the element containing the button. */
26
26
  buttonContainerProps?: ComponentPropsWithRef<"div">;
27
27
  /** Properties to pass to the `IconButton` component. */
28
- iconButtonProps?: Omit<ComponentPropsWithRef<typeof IconButton>, "size" | "icon" | "label">;
28
+ iconButtonProps?: Omit<ComponentPropsWithRef<typeof IconButton<"button">>, "size" | "icon" | "label">;
29
29
  }
30
30
  /**
31
31
  * Component used to provide feedback to a form control, where the feedback is
@@ -61,6 +61,7 @@ export declare function useFieldDescriptionIds(): string[] | undefined;
61
61
  export declare function useFieldErrorMessageIds(): string[] | undefined;
62
62
  /** Hook that makes a field aware of its control's information. */
63
63
  export declare function useSetFieldControl(controlId: string | undefined, controlTagName: string | undefined, controlCodeId: string | undefined, controlHasCode?: boolean | undefined, controlRequired?: boolean | undefined): {
64
+ generatedId: string;
64
65
  controlId: string;
65
66
  codeId: string | undefined;
66
67
  };
@@ -1,19 +1,16 @@
1
- import { ComponentPropsWithoutRef } from 'react';
2
- import { HeadingLevel } from '../Heading';
1
+ import { PolymorphicComponent, PolymorphicProps } from '../../utils/polymorphicTypes.ts';
2
+ /** Element a field group title can be rendered as. */
3
+ export type FieldGroupTitleAs = "div" | "span" | "label" | "h2" | "h3" | "h4" | "h5" | "h6";
3
4
  /** Properties of the field group title component. */
4
- export interface FieldGroupTitleProps extends ComponentPropsWithoutRef<"h2"> {
5
+ export type FieldGroupTitleProps<TAs extends FieldGroupTitleAs = "div"> = PolymorphicProps<FieldGroupTitleAs, TAs, "div", FieldGroupTitleOwnProps>;
6
+ /** Own properties of the field group title component. */
7
+ export interface FieldGroupTitleOwnProps {
5
8
  /**
6
9
  * Change the component to the HTML tag or custom component of the only child.
7
10
  * This will merge the original component props with the props of the supplied
8
11
  * element/component and change the underlying DOM node.
9
12
  */
10
13
  asChild?: boolean;
11
- /**
12
- * Heading level.
13
- *
14
- * @default 2
15
- */
16
- level?: HeadingLevel;
17
14
  }
18
15
  /** Component used to display the caption of a field group. */
19
- export declare const FieldGroupTitle: import('react').ForwardRefExoticComponent<FieldGroupTitleProps & import('react').RefAttributes<HTMLHeadingElement>>;
16
+ export declare const FieldGroupTitle: PolymorphicComponent<FieldGroupTitleAs, "div", FieldGroupTitleOwnProps>;
@@ -1,8 +1,12 @@
1
- import { ComponentPropsWithoutRef } from 'react';
1
+ import { PolymorphicComponent, PolymorphicProps } from '../../utils/polymorphicTypes.ts';
2
+ /** Elements a heading can be rendered as. */
3
+ export type HeadingAs = "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "div" | "span" | "label";
2
4
  /** Heading levels. */
3
5
  export type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
4
6
  /** Properties of the heading component. */
5
- export interface HeadingProps extends ComponentPropsWithoutRef<`h${HeadingLevel}`> {
7
+ export type HeadingProps<TAs extends HeadingAs = "h2"> = PolymorphicProps<HeadingAs, TAs, "h2", HeadingOwnProps>;
8
+ /** Own properties of the heading component. */
9
+ export interface HeadingOwnProps {
6
10
  /**
7
11
  * Change the component to the HTML tag or custom component of the only child.
8
12
  * This will merge the original component props with the props of the supplied
@@ -10,9 +14,12 @@ export interface HeadingProps extends ComponentPropsWithoutRef<`h${HeadingLevel}
10
14
  */
11
15
  asChild?: boolean;
12
16
  /**
13
- * Heading level. By default, if `asChild` is not provided, the level is used
14
- * to determine which HTML element to render, so a level of `2` causes an
15
- * `<h2>` element to be rendered.
17
+ * Heading level, the larger the level, the smaller the font-size (level `1`
18
+ * is largest, `6` smallest).
19
+ *
20
+ * By default, if `as` and `asChild` are not provided, the level is used to
21
+ * determine which HTML element to render, so a level of `2` causes a `<h2>`
22
+ * element to be rendered.
16
23
  *
17
24
  * @default 2
18
25
  */
@@ -31,4 +38,4 @@ export interface HeadingProps extends ComponentPropsWithoutRef<`h${HeadingLevel}
31
38
  * }
32
39
  * ```
33
40
  */
34
- export declare const Heading: import('react').ForwardRefExoticComponent<HeadingProps & import('react').RefAttributes<HTMLHeadingElement>>;
41
+ export declare const Heading: PolymorphicComponent<HeadingAs, "h2", HeadingOwnProps>;