@leabankab/component-library 7.3.0 → 8.1.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 (193) hide show
  1. package/CHANGELOG.md +745 -0
  2. package/README.md +2 -5
  3. package/dist/component-library.es.js +2948 -5676
  4. package/dist/component-library.es.js.map +1 -1
  5. package/dist/component-library.umd.js +2 -28
  6. package/dist/component-library.umd.js.map +1 -1
  7. package/dist/components/animations/icons/status-icon.d.ts +4 -0
  8. package/dist/components/animations/illustrations/check-animation.d.ts +8 -0
  9. package/dist/components/animations/illustrations/pulse-animation.d.ts +5 -1
  10. package/dist/components/animations/illustrations/status-animation.d.ts +8 -1
  11. package/dist/components/animations/shared.d.ts +6 -32
  12. package/dist/components/animations/spinner.d.ts +18 -0
  13. package/dist/components/animations/use-animation-labels.d.ts +0 -5
  14. package/dist/components/buttons/action-button.d.ts +8 -10
  15. package/dist/components/buttons/button-base.d.ts +26 -12
  16. package/dist/components/buttons/button.d.ts +2 -2
  17. package/dist/components/buttons/close-button.d.ts +1 -1
  18. package/dist/components/buttons/icon-button.d.ts +1 -13
  19. package/dist/components/buttons/skip-link.d.ts +21 -4
  20. package/dist/components/color-roles.d.ts +8 -0
  21. package/dist/components/data-display/card.d.ts +54 -4
  22. package/dist/components/data-display/chip.d.ts +50 -8
  23. package/dist/components/data-display/data-field.d.ts +15 -4
  24. package/dist/components/data-display/tooltip.d.ts +74 -22
  25. package/dist/components/feedback/alert-parts.d.ts +10 -9
  26. package/dist/components/feedback/alert.d.ts +1 -1
  27. package/dist/components/feedback/simple-dialog.d.ts +1 -1
  28. package/dist/components/form/amount-slider.d.ts +68 -0
  29. package/dist/components/form/autocomplete.d.ts +56 -59
  30. package/dist/components/form/checkbox-box.d.ts +11 -0
  31. package/dist/components/form/checkbox.d.ts +67 -7
  32. package/dist/components/form/combo-field.d.ts +68 -0
  33. package/dist/components/form/email-input.d.ts +28 -26
  34. package/dist/components/form/field-parts.d.ts +50 -0
  35. package/dist/components/form/index.d.ts +3 -9
  36. package/dist/components/form/input.d.ts +57 -13
  37. package/dist/components/form/multi-select.d.ts +12 -14
  38. package/dist/components/form/number-input-unit.d.ts +28 -0
  39. package/dist/components/form/number-input.d.ts +46 -18
  40. package/dist/components/form/phone-number-input/phone-number-input.d.ts +44 -14
  41. package/dist/components/form/radio-card.d.ts +94 -43
  42. package/dist/components/form/radio-circle.d.ts +14 -13
  43. package/dist/components/form/radio-group-root.d.ts +88 -0
  44. package/dist/components/form/radio.d.ts +68 -24
  45. package/dist/components/form/select-field.d.ts +78 -0
  46. package/dist/components/form/select.d.ts +30 -42
  47. package/dist/components/form/slider-parts.d.ts +34 -0
  48. package/dist/components/form/slider.d.ts +40 -16
  49. package/dist/components/form/use-autocomplete-labels.d.ts +3 -16
  50. package/dist/components/form/use-blur-outside.d.ts +7 -0
  51. package/dist/components/form/use-focus-target-ref.d.ts +11 -0
  52. package/dist/components/form/use-tooltip-trigger-labels.d.ts +5 -0
  53. package/dist/components/index.d.ts +0 -1
  54. package/dist/components/navigation/form-stepper.d.ts +1 -1
  55. package/dist/components/navigation/index.d.ts +1 -1
  56. package/dist/components/navigation/linear-form-stepper.d.ts +1 -1
  57. package/dist/components/navigation/progress-circle.d.ts +14 -8
  58. package/dist/components/navigation/tabs.d.ts +37 -34
  59. package/dist/components/navigation/use-stepper-labels.d.ts +1 -1
  60. package/dist/components/typography/link.d.ts +25 -16
  61. package/dist/components/typography/lists.d.ts +20 -23
  62. package/dist/components/typography/text.d.ts +46 -10
  63. package/dist/components/ui/app-header.d.ts +9 -1
  64. package/dist/cookie-consent/react.d.ts +0 -1
  65. package/dist/cookie-consent-react.cjs +1 -1
  66. package/dist/cookie-consent-react.cjs.map +1 -1
  67. package/dist/cookie-consent-react.mjs +106 -96
  68. package/dist/cookie-consent-react.mjs.map +1 -1
  69. package/dist/cookie-consent.css +1 -1
  70. package/dist/date-picker/datepicker.d.ts +140 -0
  71. package/dist/date-picker/index.d.ts +18 -0
  72. package/dist/date-picker/theme/field-base.d.ts +23 -0
  73. package/dist/date-picker/theme/form-control.theme.d.ts +7 -0
  74. package/dist/date-picker/theme/index.d.ts +12 -0
  75. package/dist/date-picker/theme/input.theme.d.ts +6 -0
  76. package/dist/{components/form/datepicker → date-picker}/use-view-toggle-labels.d.ts +1 -1
  77. package/dist/date-picker.cjs +2 -0
  78. package/dist/date-picker.cjs.map +1 -0
  79. package/dist/date-picker.mjs +1012 -0
  80. package/dist/date-picker.mjs.map +1 -0
  81. package/dist/{components/dev-panel → dev-panel}/dev-panel-payload.d.ts +1 -1
  82. package/dist/{components/dev-panel → dev-panel}/dev-panel-status.d.ts +2 -2
  83. package/dist/{components/dev-panel → dev-panel}/dev-panel-steps.d.ts +2 -1
  84. package/dist/dev-panel/dev-panel.d.ts +118 -0
  85. package/dist/dev-panel/index.d.ts +10 -0
  86. package/dist/{components/dev-panel → dev-panel}/json-highlight.d.ts +2 -2
  87. package/dist/dev-panel/parts.d.ts +9 -0
  88. package/dist/{components/dev-panel → dev-panel}/segmented-control.d.ts +5 -4
  89. package/dist/{components/dev-panel → dev-panel}/use-dev-panel-labels.d.ts +1 -1
  90. package/dist/{components/dev-panel → dev-panel}/use-roving-radio.d.ts +2 -2
  91. package/dist/dev-panel.cjs +3 -0
  92. package/dist/dev-panel.cjs.map +1 -0
  93. package/dist/dev-panel.css +1 -0
  94. package/dist/dev-panel.mjs +919 -0
  95. package/dist/dev-panel.mjs.map +1 -0
  96. package/dist/fonts/ClashGrotesk-Variable.woff2 +0 -0
  97. package/dist/index.css +1 -1
  98. package/dist/index.d.ts +1 -3
  99. package/dist/provider/lea-provider.d.ts +4 -7
  100. package/dist/react-hook-form/form-field.d.ts +76 -0
  101. package/dist/react-hook-form/index.d.ts +1 -0
  102. package/dist/react-hook-form.cjs +2 -0
  103. package/dist/react-hook-form.cjs.map +1 -0
  104. package/dist/react-hook-form.mjs +33 -0
  105. package/dist/react-hook-form.mjs.map +1 -0
  106. package/dist/tailwind.css +103 -17
  107. package/dist/theme/index.d.ts +0 -4
  108. package/dist/theme/token-types.d.ts +15 -3
  109. package/dist/theme/tokens/colors.d.ts +13 -0
  110. package/dist/theme/tokens/font-family.d.ts +9 -0
  111. package/dist/theme/tokens/font-sizes.d.ts +8 -0
  112. package/dist/theme/tokens/index.d.ts +4 -1
  113. package/dist/theme/tokens/line-heights.d.ts +11 -0
  114. package/dist/theme/tokens/spacing.d.ts +6 -0
  115. package/dist/theme/tokens/text-styles.d.ts +61 -0
  116. package/dist/theme/tokens/type-scale.d.ts +21 -0
  117. package/dist/theme/types.d.ts +19 -30
  118. package/dist/validation/email.d.ts +18 -0
  119. package/dist/validation/mobile-patterns.d.ts +10 -0
  120. package/dist/validation/national-id.d.ts +26 -0
  121. package/dist/validation/phone.d.ts +30 -0
  122. package/package.json +45 -6
  123. package/dist/components/dev-panel/dev-panel.d.ts +0 -61
  124. package/dist/components/dev-panel/index.d.ts +0 -9
  125. package/dist/components/form/datepicker/datepicker.d.ts +0 -99
  126. package/dist/components/form/datepicker/index.d.ts +0 -1
  127. package/dist/components/form/fields/autocomplete-field.d.ts +0 -17
  128. package/dist/components/form/fields/boolean-radio-field.d.ts +0 -3
  129. package/dist/components/form/fields/checkbox-field.d.ts +0 -12
  130. package/dist/components/form/fields/datepicker-field.d.ts +0 -9
  131. package/dist/components/form/fields/email-field.d.ts +0 -10
  132. package/dist/components/form/fields/field-types.d.ts +0 -18
  133. package/dist/components/form/fields/index.d.ts +0 -14
  134. package/dist/components/form/fields/input-field.d.ts +0 -9
  135. package/dist/components/form/fields/multi-select-field.d.ts +0 -9
  136. package/dist/components/form/fields/number-field.d.ts +0 -10
  137. package/dist/components/form/fields/phone-number-field.d.ts +0 -11
  138. package/dist/components/form/fields/radio-card-field.d.ts +0 -22
  139. package/dist/components/form/fields/radio-field.d.ts +0 -16
  140. package/dist/components/form/fields/select-field.d.ts +0 -9
  141. package/dist/components/form/fields/use-field-control.d.ts +0 -6
  142. package/dist/components/form/fields/use-tooltip-trigger-labels.d.ts +0 -5
  143. package/dist/components/form/form-control/form-control-context.d.ts +0 -35
  144. package/dist/components/form/form-control/form-control-label.d.ts +0 -1
  145. package/dist/components/form/form-control/form-control.d.ts +0 -13
  146. package/dist/components/form/form-control/form-helper-text.d.ts +0 -9
  147. package/dist/components/form/form-control/form-label.d.ts +0 -9
  148. package/dist/components/form/form-control/index.d.ts +0 -5
  149. package/dist/components/form/input-label.d.ts +0 -9
  150. package/dist/theme/components/accordion.theme.d.ts +0 -7
  151. package/dist/theme/components/action-button.theme.d.ts +0 -45
  152. package/dist/theme/components/alert.theme.d.ts +0 -2
  153. package/dist/theme/components/autocomplete.theme.d.ts +0 -2
  154. package/dist/theme/components/baseline-css.d.ts +0 -2
  155. package/dist/theme/components/button.theme.d.ts +0 -2
  156. package/dist/theme/components/card.theme.d.ts +0 -2
  157. package/dist/theme/components/checkbox.theme.d.ts +0 -2
  158. package/dist/theme/components/chip.theme.d.ts +0 -2
  159. package/dist/theme/components/dev-panel.theme.d.ts +0 -95
  160. package/dist/theme/components/dialog.theme.d.ts +0 -2
  161. package/dist/theme/components/drawer.theme.d.ts +0 -4
  162. package/dist/theme/components/field-base.d.ts +0 -31
  163. package/dist/theme/components/form-control-label.theme.d.ts +0 -2
  164. package/dist/theme/components/form-control.theme.d.ts +0 -2
  165. package/dist/theme/components/index.d.ts +0 -2
  166. package/dist/theme/components/input.theme.d.ts +0 -3
  167. package/dist/theme/components/link.theme.d.ts +0 -2
  168. package/dist/theme/components/menu-item.theme.d.ts +0 -2
  169. package/dist/theme/components/number-input.theme.d.ts +0 -23
  170. package/dist/theme/components/phone-number-input.theme.d.ts +0 -43
  171. package/dist/theme/components/radio.theme.d.ts +0 -2
  172. package/dist/theme/components/select.theme.d.ts +0 -2
  173. package/dist/theme/components/slider.theme.d.ts +0 -2
  174. package/dist/theme/components/tabs.theme.d.ts +0 -34
  175. package/dist/theme/components/tooltip.theme.d.ts +0 -110
  176. package/dist/theme/components/typography.theme.d.ts +0 -2
  177. package/dist/theme/mui-augmentation.d.ts +0 -147
  178. package/dist/theme/sx-config.d.ts +0 -10
  179. /package/dist/{components/form/datepicker → date-picker}/calendar-header.d.ts +0 -0
  180. /package/dist/{components/form/datepicker → date-picker}/drawer-toolbar.d.ts +0 -0
  181. /package/dist/{theme/components → date-picker/theme}/date-picker.theme.d.ts +0 -0
  182. /package/dist/{theme/components → date-picker/theme}/icon-button.theme.d.ts +0 -0
  183. /package/dist/{theme/tokens → date-picker/theme}/typography.d.ts +0 -0
  184. /package/dist/{components/form/datepicker → date-picker}/use-calendar-header-labels.d.ts +0 -0
  185. /package/dist/{components/form/datepicker → date-picker}/use-datepicker-title-labels.d.ts +0 -0
  186. /package/dist/{components/form/datepicker → date-picker}/view-renderers.d.ts +0 -0
  187. /package/dist/{components/form/datepicker → date-picker}/view-toggle.d.ts +0 -0
  188. /package/dist/{components/dev-panel → dev-panel}/dev-panel-country.d.ts +0 -0
  189. /package/dist/{components/dev-panel → dev-panel}/dev-panel-flow.d.ts +0 -0
  190. /package/dist/{components/dev-panel → dev-panel}/dev-panel-footer.d.ts +0 -0
  191. /package/dist/{components/dev-panel → dev-panel}/dev-panel-step-state.d.ts +0 -0
  192. /package/dist/{components/dev-panel → dev-panel}/dev-panel-variant.d.ts +0 -0
  193. /package/dist/{components/dev-panel → dev-panel}/use-copy.d.ts +0 -0
@@ -1,36 +1,80 @@
1
- import { RadioProps as MuiRadioProps, RadioGroupProps as MuiRadioGroupProps } from '@mui/material';
1
+ import { CSSProperties, ReactNode, Ref } from 'react';
2
2
  import { RadioSize } from './radio-circle';
3
- export type { RadioSize };
4
- /** Reads the `size` set on the surrounding `RadioGroup`, if any. */
5
- export declare const useRadioGroupSize: () => RadioSize | undefined;
6
- export type RadioProps = Omit<MuiRadioProps, "color" | "size"> & {
7
- size?: RadioSize;
3
+ import { RadioGroupBaseProps, RadioValue } from './radio-group-root';
4
+ export type { RadioSize as Size, RadioValue as Value };
5
+ /**
6
+ * One choice in the `options` list of a `RadioGroup.Root` or `RadioCard.Group`.
7
+ */
8
+ export type Option<T extends RadioValue = string> = {
9
+ value: T;
10
+ label: ReactNode;
11
+ disabled?: boolean;
8
12
  };
9
- export type RadioGroupProps = MuiRadioGroupProps & {
10
- /** Size applied to all child `Radio` components unless overridden per-item. */
13
+ export type ItemProps<T extends RadioValue = RadioValue> = {
14
+ /** What `onValueChange` on the group is called with when this radio is picked. */
15
+ value: T;
16
+ /** The text next to the radio. Without it, pass `aria-label`. */
17
+ label?: ReactNode;
18
+ /** Disables this radio only. */
19
+ disabled?: boolean;
20
+ /** Size of the circle. Defaults to the group's `size`. */
11
21
  size?: RadioSize;
22
+ /** Id of the radio itself, the element with the `radio` role. */
23
+ id?: string;
24
+ /** Names the radio when it has no `label`. */
25
+ "aria-label"?: string;
26
+ /** Class on the outermost element. */
27
+ className?: string;
28
+ /** Inline style on the outermost element. */
29
+ style?: CSSProperties;
30
+ /**
31
+ * The `<input type="radio">` that holds the value. It is hidden, but
32
+ * `ref.current.focus()` moves focus to the visible radio.
33
+ */
34
+ ref?: Ref<HTMLInputElement>;
12
35
  };
13
36
  /**
14
- * Radio built on MUI's `Radio`, styled by the global theme (`radio.theme.ts`).
15
- * Kept composite — pair it with `FormControlLabel` for a label instead of
16
- * forwarding label / typography props, and place it inside a `RadioGroup` so
17
- * selection stays mutually exclusive:
37
+ * One choice in a `RadioGroup.Root`, for when the `options` list is not enough:
38
+ * a label with markup in it, or content between the choices. The group holds
39
+ * the value, so a `RadioGroup.Item` only works inside one.
18
40
  *
19
41
  * ```tsx
20
- * <RadioGroup value={value} onChange={(_, v) => setValue(v)}>
21
- * <FormControlLabel value="a" control={<Radio />} label="A" />
22
- * <FormControlLabel value="b" control={<Radio />} label="B" />
23
- * </RadioGroup>
42
+ * <RadioGroup.Root label="Betaling" value={value} onValueChange={setValue}>
43
+ * <RadioGroup.Item value="monthly" label="Månedlig" />
44
+ * <RadioGroup.Item value="yearly" label={<>Årlig <Chip label="Spar 10 %" /></>} />
45
+ * </RadioGroup.Root>
24
46
  * ```
25
47
  */
26
- export declare const Radio: import('react').ForwardRefExoticComponent<Omit<RadioProps, "ref"> & import('react').RefAttributes<HTMLButtonElement>>;
48
+ export declare function Item<T extends RadioValue = RadioValue>({ value, label, disabled, size, id, "aria-label": ariaLabel, className, style, ref, }: ItemProps<T>): import("react").JSX.Element;
49
+ export type RootProps<T extends RadioValue = string> = RadioGroupBaseProps<T> & {
50
+ /** The choices, each rendered as a radio with its label. */
51
+ options?: Option<T>[];
52
+ /**
53
+ * Size of the radio circles. A `size` on a `RadioGroup.Item` wins.
54
+ * @default "md"
55
+ */
56
+ size?: RadioSize;
57
+ };
27
58
  /**
28
- * Thin wrapper around MUI's `RadioGroup`. Radios are only meaningful as a
29
- * mutually-exclusive set, so reach for this rather than placing a bare `Radio`.
59
+ * A question with one answer, as a list of radios, on Base UI's accessible
60
+ * `RadioGroup` primitive. The label, the helper text and the error state are
61
+ * handled for you. Arrow keys move between the choices.
62
+ *
63
+ * Pass the choices as `options`. Values are compared with `===` and can be
64
+ * strings, numbers or booleans, so a yes / no question can hold a real
65
+ * `boolean`. For choices that need more than a label, pass `RadioGroup.Item`
66
+ * children.
30
67
  *
31
- * When rendered inside our `FormControl` it points its `aria-labelledby` at the
32
- * surrounding `FormLabel` automatically (via the shared label id), so the group
33
- * gets an accessible name without the consumer wiring it. Also applies a default
34
- * gap between rows, overridable via `sx`.
68
+ * ```tsx
69
+ * <RadioGroup.Root
70
+ * label="Hvor ofte vil du betale?"
71
+ * options={[
72
+ * { value: "monthly", label: "Månedlig" },
73
+ * { value: "yearly", label: "Årlig" },
74
+ * ]}
75
+ * value={value}
76
+ * onValueChange={setValue}
77
+ * />
78
+ * ```
35
79
  */
36
- export declare const RadioGroup: import('react').ForwardRefExoticComponent<Omit<RadioGroupProps, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
80
+ export declare function Root<T extends RadioValue = string>({ options, children, ...rest }: RootProps<T>): import("react").JSX.Element;
@@ -0,0 +1,78 @@
1
+ import { CSSProperties, FocusEvent, ReactNode, Ref } from 'react';
2
+ /** One choice in a `Select` or `MultiSelect`. */
3
+ export type SelectOption<Value extends string = string> = {
4
+ value: Value;
5
+ label: string;
6
+ /** Shown, but not selectable. */
7
+ disabled?: boolean;
8
+ };
9
+ /** The props `Select` and `MultiSelect` have in common. */
10
+ export type SelectFieldBaseProps = {
11
+ /** Floating label, linked to the select for you. */
12
+ label?: ReactNode;
13
+ /** Helper / error text shown below the control and linked via `aria-describedby`. */
14
+ helperText?: ReactNode;
15
+ /** Puts the select, its label and its helper text into the error state. */
16
+ error?: boolean;
17
+ /** Marks the select as required, with an asterisk after the label. */
18
+ required?: boolean;
19
+ disabled?: boolean;
20
+ /**
21
+ * Text shown while nothing is chosen. With a `label` it appears once the
22
+ * label has floated up: on focus and while the list is open.
23
+ */
24
+ placeholder?: string;
25
+ /** Content before the value, inside the field, e.g. an icon. */
26
+ startAdornment?: ReactNode;
27
+ /** Content after the value, inside the field, left of the dropdown arrow. */
28
+ endAdornment?: ReactNode;
29
+ /** Whether the list is open (controlled). Pair with `onOpenChange`. */
30
+ open?: boolean;
31
+ /** Called when the list opens or closes. */
32
+ onOpenChange?: (open: boolean) => void;
33
+ /** Called when focus leaves the select, the open list included. */
34
+ onBlur?: (event: FocusEvent<HTMLElement>) => void;
35
+ /** Submits the value under this name in a native form. */
36
+ name?: string;
37
+ /** Id of the element with the `combobox` role. */
38
+ id?: string;
39
+ /** Names the select when there is no visible `label`. */
40
+ "aria-label"?: string;
41
+ "aria-labelledby"?: string;
42
+ "aria-describedby"?: string;
43
+ /** Class on the outermost element, for layout. */
44
+ className?: string;
45
+ /** Inline style on the outermost element, for layout. */
46
+ style?: CSSProperties;
47
+ /** The element that takes focus, the one with the `combobox` role. */
48
+ ref?: Ref<HTMLElement>;
49
+ };
50
+ type SelectFieldProps = SelectFieldBaseProps & {
51
+ multiple: boolean;
52
+ /** The value as Base UI holds it: `null` or an array when empty. */
53
+ value: string | string[] | null;
54
+ onValueChange: (value: string | string[] | null) => void;
55
+ /** Whether something is chosen, which is what floats the label. */
56
+ filled: boolean;
57
+ /** What the field shows for the value: text, or the chips. */
58
+ display: ReactNode;
59
+ /**
60
+ * Hides `display` from assistive tech, when it only repeats `valueText`.
61
+ * Not for chips: their remove buttons are controls.
62
+ */
63
+ displayHidden?: boolean;
64
+ /** The value as plain text, for assistive tech, inside the trigger. */
65
+ valueText: string;
66
+ /** The `SelectFieldItem`s. */
67
+ children: ReactNode;
68
+ };
69
+ export declare function SelectField({ label, helperText, error, required, disabled, placeholder, startAdornment, endAdornment, open: openProp, onOpenChange, onBlur, name, id, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, className, style, ref, multiple, value, onValueChange, filled, display, displayHidden, valueText, children, }: SelectFieldProps): import("react").JSX.Element;
70
+ type SelectFieldItemProps = {
71
+ option: SelectOption;
72
+ disabled?: boolean;
73
+ /** Content before the label, e.g. the checkbox of `MultiSelect`. */
74
+ children?: ReactNode;
75
+ };
76
+ /** One option in the list. */
77
+ export declare function SelectFieldItem({ option, disabled, children, }: SelectFieldItemProps): import("react").JSX.Element;
78
+ export {};
@@ -1,46 +1,34 @@
1
- import { SelectProps as MuiSelectProps } from '@mui/material';
2
- import { ReactNode } from 'react';
3
- export type SelectOption = {
4
- label: string;
5
- value: string;
6
- };
7
- export type SelectProps = MuiSelectProps & {
8
- /** Floating label. Rendered as an `InputLabel` and linked automatically. */
9
- label?: ReactNode;
10
- /** Helper / error text shown below the control and linked via `aria-describedby`. */
11
- helperText?: ReactNode;
12
- /** Convenience: render `MenuItem`s from a list instead of passing children. */
13
- options?: SelectOption[];
1
+ import { SelectFieldBaseProps, SelectOption } from './select-field';
2
+ export type { SelectOption };
3
+ export type SelectProps<Value extends string = string> = SelectFieldBaseProps & {
4
+ /** The choices. */
5
+ options: readonly SelectOption<Value>[];
6
+ /** The chosen value (controlled). `""` means nothing is chosen. */
7
+ value?: Value | "";
8
+ /** The chosen value when first rendered, for uncontrolled use. */
9
+ defaultValue?: Value | "";
10
+ /** Called with the value of the option the user picks. */
11
+ onValueChange?: (value: Value) => void;
14
12
  };
15
13
  /**
16
- * Select built on MUI's `Select`.
14
+ * Select on Base UI's `Select`, in the same box as `Input`. The label, the
15
+ * helper text and the ids that link them to the control are all rendered and
16
+ * wired for you.
17
+ *
18
+ * ```tsx
19
+ * <Select
20
+ * label="Land"
21
+ * options={[
22
+ * { value: "no", label: "Norge" },
23
+ * { value: "se", label: "Sverige" },
24
+ * ]}
25
+ * value={country}
26
+ * onValueChange={setCountry}
27
+ * />
28
+ * ```
17
29
  *
18
- * Works two ways:
19
- * - **Standalone (all-in-one):** pass `label` / `helperText` and `options` (or
20
- * `MenuItem` children) and it renders its own `FormControl`, label and helper
21
- * text, generating and wiring all ids for you.
22
- * - **Composed:** drop it inside a `FormControl` next to `InputLabel` /
23
- * `FormHelperText` and it picks up the shared ids from context.
30
+ * Values are strings, and `""` means nothing is chosen. Written with
31
+ * `as const`, the options give `value` and `onValueChange` their type:
32
+ * `"no" | "se"` here.
24
33
  */
25
- export declare const Select: import('react').ForwardRefExoticComponent<(Omit<import('@mui/material').FilledSelectProps & import('@mui/material').BaseSelectProps<unknown> & {
26
- /** Floating label. Rendered as an `InputLabel` and linked automatically. */
27
- label?: ReactNode;
28
- /** Helper / error text shown below the control and linked via `aria-describedby`. */
29
- helperText?: ReactNode;
30
- /** Convenience: render `MenuItem`s from a list instead of passing children. */
31
- options?: SelectOption[];
32
- }, "ref"> | Omit<import('@mui/material').StandardSelectProps & import('@mui/material').BaseSelectProps<unknown> & {
33
- /** Floating label. Rendered as an `InputLabel` and linked automatically. */
34
- label?: ReactNode;
35
- /** Helper / error text shown below the control and linked via `aria-describedby`. */
36
- helperText?: ReactNode;
37
- /** Convenience: render `MenuItem`s from a list instead of passing children. */
38
- options?: SelectOption[];
39
- }, "ref"> | Omit<import('@mui/material').OutlinedSelectProps & import('@mui/material').BaseSelectProps<unknown> & {
40
- /** Floating label. Rendered as an `InputLabel` and linked automatically. */
41
- label?: ReactNode;
42
- /** Helper / error text shown below the control and linked via `aria-describedby`. */
43
- helperText?: ReactNode;
44
- /** Convenience: render `MenuItem`s from a list instead of passing children. */
45
- options?: SelectOption[];
46
- }, "ref">) & import('react').RefAttributes<HTMLDivElement>>;
34
+ export declare function Select<Value extends string = string>({ options, value, defaultValue, onValueChange, ...rest }: SelectProps<Value>): import("react").JSX.Element;
@@ -0,0 +1,34 @@
1
+ import { Field } from '@base-ui/react/field';
2
+ import { ReactNode } from 'react';
3
+ /**
4
+ * `render` for a `Field.Root` that is only there to hand a control its
5
+ * validity state, which is how Base UI puts `aria-invalid` on the slider's
6
+ * nested range input. It makes the field render no element of its own.
7
+ */
8
+ export declare const renderWithoutElement: Field.Root.Props["render"];
9
+ type SliderTrackProps = {
10
+ "aria-label"?: string;
11
+ "aria-describedby"?: string;
12
+ };
13
+ /**
14
+ * The clickable control with its track, fill and thumb. The thumb is rendered
15
+ * here so it can never be left out. Must sit inside a Base UI `Slider.Root`.
16
+ */
17
+ export declare function SliderTrack({ "aria-label": ariaLabel, "aria-describedby": ariaDescribedBy, }: SliderTrackProps): import("react").JSX.Element;
18
+ type SliderRangeProps = {
19
+ min: number;
20
+ max: number;
21
+ format?: Intl.NumberFormatOptions;
22
+ locale?: Intl.LocalesArgument;
23
+ };
24
+ /** `min` and `max` under each end of the track, written like the value. */
25
+ export declare function SliderRange({ min, max, format, locale }: SliderRangeProps): import("react").JSX.Element;
26
+ type SliderHelperTextProps = {
27
+ /** Id the controls point at with `aria-describedby`. */
28
+ id: string;
29
+ error: boolean;
30
+ children: ReactNode;
31
+ };
32
+ /** Helper text below the slider. Announced as an alert while in error. */
33
+ export declare function SliderHelperText({ id, error, children, }: SliderHelperTextProps): import("react").JSX.Element;
34
+ export {};
@@ -1,23 +1,47 @@
1
- import { SliderProps as MuiSliderProps } from '@mui/material';
1
+ import { Slider as BaseSlider } from '@base-ui/react/slider';
2
2
  import { ReactNode } from 'react';
3
- export type SliderProps = MuiSliderProps & {
4
- /** Group label shown above the slider and linked via `aria-labelledby`. */
5
- label?: ReactNode;
6
- /** Helper / error text shown below the control and linked via `aria-describedby`. */
3
+ /**
4
+ * Requires an accessible name so the slider is never nameless. Provide a
5
+ * visible `label`, or an `aria-label` when the design has none.
6
+ */
7
+ type SliderAccessibleName = {
8
+ label: ReactNode;
9
+ "aria-label"?: never;
10
+ } | {
11
+ label?: never;
12
+ "aria-label": string;
13
+ };
14
+ export type SliderProps = Omit<BaseSlider.Root.Props<number>, "children" | "orientation" | "minStepsBetweenValues" | "thumbAlignment" | "thumbCollisionBehavior" | "aria-label" | "aria-labelledby"> & SliderAccessibleName & {
15
+ /** Helper / error text shown below the slider and linked via `aria-describedby`. */
7
16
  helperText?: ReactNode;
8
- /** Puts wrapper FormControl and helper text into error state. */
17
+ /** Puts the slider and its helper text into the error state. */
9
18
  error?: boolean;
10
- /** Marks wrapper FormControl as required. */
11
- required?: boolean;
12
19
  };
13
20
  /**
14
- * Slider built on MUI's `Slider`.
21
+ * A single-value slider built on Base UI's accessible `Slider` primitive.
22
+ *
23
+ * The label, the current value, the `min` / `max` under each end of the track
24
+ * and the helper text are all rendered and wired internally: the label names
25
+ * the control, the helper text describes it, and `error` marks it invalid and
26
+ * announces the helper text. Base UI renders a native range input, so arrow
27
+ * keys, Page Up / Down, Home and End work, and the value is submitted when
28
+ * `name` is set.
29
+ *
30
+ * Pass `format` and `locale` to control how the value, `min` and `max` are
31
+ * written and announced.
15
32
  *
16
- * Works two ways:
17
- * - **Standalone (all-in-one):** pass `label` / `helperText` and it renders its
18
- * own `FormControl`, label and helper text, wiring `aria-labelledby` /
19
- * `aria-describedby` for you.
20
- * - **Composed:** drop it inside a `FormControl` next to `FormLabel` /
21
- * `FormHelperText` and it picks up the shared ids from context.
33
+ * ```tsx
34
+ * <Slider
35
+ * label="Lånebeløp"
36
+ * min={50000}
37
+ * max={600000}
38
+ * step={5000}
39
+ * defaultValue={150000}
40
+ * locale="nb-NO"
41
+ * format={{ style: "currency", currency: "NOK", maximumFractionDigits: 0 }}
42
+ * onValueChange={(value) => setAmount(value)}
43
+ * />
44
+ * ```
22
45
  */
23
- export declare const Slider: import('react').ForwardRefExoticComponent<Omit<SliderProps, "ref"> & import('react').RefAttributes<HTMLSpanElement>>;
46
+ export declare function Slider({ label, "aria-label": ariaLabel, helperText, error, min, max, format, locale, className, ...rest }: SliderProps): import("react").JSX.Element;
47
+ export {};
@@ -1,19 +1,6 @@
1
1
  /**
2
- * Translated labels for the searchable selects built on MUI's `Autocomplete`
3
- * (`Autocomplete`, `AutocompleteField`, `EmailInput`, and the country picker in
4
- * `PhoneNumberInput`). MUI's own defaults are English, so these are applied for
5
- * every language. Consumers can still override any of them per-instance with
6
- * MUI's `noOptionsText` / `loadingText` / `openText` / `closeText` / `clearText`.
2
+ * Translated texts for the controls with a list to search in (`Autocomplete`
3
+ * and `EmailInput`): what the list says when it has nothing to show, and the
4
+ * names of the open and clear buttons.
7
5
  */
8
6
  export declare const useAutocompleteLabels: () => Record<"clear" | "loading" | "close" | "open" | "noOptions", string>;
9
- /**
10
- * The same labels mapped onto MUI's `Autocomplete` prop names, ready to spread
11
- * before `...rest` so a consumer-supplied value still wins.
12
- */
13
- export declare const useAutocompleteTextProps: () => {
14
- noOptionsText: string;
15
- loadingText: string;
16
- openText: string;
17
- closeText: string;
18
- clearText: string;
19
- };
@@ -0,0 +1,7 @@
1
+ import { FocusEvent, RefObject } from 'react';
2
+ /**
3
+ * `onBlur` for a field that is made of several elements, some of them in a
4
+ * popup: it is called once focus has left them all, not when it moves from
5
+ * one to another. Put the returned handler on each element in `refs`.
6
+ */
7
+ export declare function useBlurOutside(onBlur: ((event: FocusEvent<HTMLElement>) => void) | undefined, refs: readonly RefObject<HTMLElement | null>[]): (event: FocusEvent<HTMLElement>) => void;
@@ -0,0 +1,11 @@
1
+ import { Ref, RefObject } from 'react';
2
+ /**
3
+ * Internal. Points a control's `ref` at the element inside `rootRef` that
4
+ * takes focus, for controls where that element is rendered by another library
5
+ * or is one of several (the radios of a group). `selectors` are tried in
6
+ * order and the first match wins.
7
+ *
8
+ * This is what lets `ref.current.focus()` work on those controls, which
9
+ * react-hook-form relies on to move focus to the first invalid field.
10
+ */
11
+ export declare function useFocusTargetRef<T extends HTMLElement>(ref: Ref<T> | undefined, rootRef: RefObject<HTMLElement | null>, selectors: readonly string[]): void;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Translated accessible name for the info trigger a control renders next to
3
+ * its label when given a `tooltip`.
4
+ */
5
+ export declare const useTooltipTriggerLabels: () => Record<"moreInformation", string>;
@@ -1,7 +1,6 @@
1
1
  export * from './animations';
2
2
  export * from './buttons';
3
3
  export * from './data-display';
4
- export * from './dev-panel';
5
4
  export * from './feedback';
6
5
  export * from './form';
7
6
  export * from './layout';
@@ -19,7 +19,7 @@ export type FormStepperProps = {
19
19
  * flow.
20
20
  */
21
21
  onBack?: () => void;
22
- /** Progress circle colour. Defaults to `purple`. */
22
+ /** Progress circle colour. Defaults to `primary`. */
23
23
  color?: ProgressCircleColor;
24
24
  /**
25
25
  * Render the title as a `heading` (default) or plain `text`. Prefer `heading`
@@ -2,5 +2,5 @@ export * from './form-stepper';
2
2
  export * from './linear-form-stepper';
3
3
  export * from './progress-circle';
4
4
  export * from './step-progress';
5
- export * from './tabs';
5
+ export * as Tabs from './tabs';
6
6
  export * from './use-stepper-labels';
@@ -19,7 +19,7 @@ export type LinearFormStepperProps = {
19
19
  onBack?: () => void;
20
20
  /**
21
21
  * Bar colour.
22
- * @default "purple"
22
+ * @default "primary"
23
23
  */
24
24
  color?: ProgressCircleColor;
25
25
  /**
@@ -1,16 +1,22 @@
1
- export type ProgressCircleColor = "purple" | "teal";
1
+ import { ColorRoles } from '../color-roles';
2
+ export type ProgressCircleColor = ColorRoles<"primary" | "tertiary">;
2
3
  export type ProgressCircleProps = {
3
4
  /** Current value, e.g. the active step (1-based). Clamped to `0..max`. */
4
5
  value: number;
5
6
  /** Maximum value, e.g. the total number of steps. */
6
7
  max: number;
7
- /** Ring colour. Defaults to `purple`. */
8
+ /** Ring colour. Defaults to `primary`. */
8
9
  color?: ProgressCircleColor;
9
10
  /** Rendered diameter in px. Defaults to `48`. */
10
11
  size?: number;
11
12
  /** Ring thickness in px. Defaults to `4`. */
12
13
  strokeWidth?: number;
13
- /** Show the `value/max` label in the centre. Defaults to `true`. */
14
+ /**
15
+ * Show the `value/max` label in the centre. Defaults to `true`. The label
16
+ * is set smaller when it would otherwise touch the ring, in a small circle
17
+ * or with many digits. Below about 32px it is too small to read: leave it
18
+ * out there.
19
+ */
14
20
  showValue?: boolean;
15
21
  /**
16
22
  * Accessible name. When provided, the circle is exposed as a
@@ -22,13 +28,13 @@ export type ProgressCircleProps = {
22
28
  label?: string;
23
29
  };
24
30
  /**
25
- * An animated circular progress indicator. Not a MUI component: the ring is an
26
- * SVG whose stroke animates as `value` changes, respecting
27
- * `prefers-reduced-motion`. Colour is limited to the brand `purple` / `teal`
28
- * tokens so contrast stays owned by the theme.
31
+ * An animated circular progress indicator: the ring is an SVG whose stroke
32
+ * animates as `value` changes, respecting `prefers-reduced-motion`. Colour is
33
+ * limited to `primary` (purple) and `tertiary` (teal) so contrast stays owned
34
+ * by the theme.
29
35
  *
30
36
  * ```tsx
31
- * <ProgressCircle value={2} max={5} color="teal" label="Step 2 of 5" />
37
+ * <ProgressCircle value={2} max={5} color="tertiary" label="Step 2 of 5" />
32
38
  * ```
33
39
  */
34
40
  export declare const ProgressCircle: ({ value, max, color, size, strokeWidth, showValue, label, }: ProgressCircleProps) => import("react").JSX.Element;
@@ -1,39 +1,41 @@
1
1
  import { Tabs as BaseTabs } from '@base-ui/react/tabs';
2
- import { TabsVariant } from '../../theme/components/tabs.theme';
3
- export type { TabsVariant };
4
- export type TabsProps = BaseTabs.Root.Props & {
2
+ import { ColorRoles } from '../color-roles';
3
+ /** The colours of the active "pill". */
4
+ export type Color = ColorRoles<"primary" | "secondary">;
5
+ export type RootProps = Omit<BaseTabs.Root.Props, "color"> & {
5
6
  /**
6
7
  * Colour of the active-tab "pill".
7
- * - `"brand"` — filled with the brand purple (default).
8
- * - `"greyscale"` — filled with near-black, for a neutral surface.
9
- * @default "brand"
8
+ * - `"primary"` — filled with the brand purple (default).
9
+ * - `"secondary"` — filled with near-black, for a neutral surface.
10
+ * @default "primary"
10
11
  */
11
- variant?: TabsVariant;
12
+ color?: Color;
12
13
  };
13
14
  /**
14
15
  * A segmented, pill-style tabs control built on Base UI's accessible `Tabs`
15
16
  * primitive. Renders a beige track with a sliding pill behind the active tab.
16
17
  *
17
- * Compose it from `TabsList` + `Tab` (the tab bar) and, optionally, `TabPanel`
18
- * for built-in content. Roles (`tablist`/`tab`/`tabpanel`), roving `tabindex`,
19
- * arrow-key navigation, `aria-selected` and the `tab`↔`tabpanel` links are all
20
- * wired by Base UI, so relationships never dangle.
18
+ * Compose it from `Tabs.Root`, `Tabs.List` + `Tabs.Tab` (the tab bar) and,
19
+ * optionally, `Tabs.Panel` for built-in content. Roles
20
+ * (`tablist`/`tab`/`tabpanel`), roving `tabindex`, arrow-key navigation,
21
+ * `aria-selected` and the `tab`↔`tabpanel` links are all wired by Base UI, so
22
+ * relationships never dangle.
21
23
  *
22
24
  * The list scrolls horizontally when the tabs overflow (e.g. on mobile) and the
23
25
  * pill slide respects `prefers-reduced-motion`.
24
26
  *
25
27
  * ```tsx
26
- * <Tabs defaultValue="overview">
27
- * <TabsList aria-label="Account sections">
28
- * <Tab value="overview">Overview</Tab>
29
- * <Tab value="activity">Activity</Tab>
30
- * </TabsList>
31
- * <TabPanel value="overview">Workspace stats and activity.</TabPanel>
32
- * <TabPanel value="activity">Recent activity.</TabPanel>
33
- * </Tabs>
28
+ * <Tabs.Root defaultValue="overview">
29
+ * <Tabs.List aria-label="Account sections">
30
+ * <Tabs.Tab value="overview">Overview</Tabs.Tab>
31
+ * <Tabs.Tab value="activity">Activity</Tabs.Tab>
32
+ * </Tabs.List>
33
+ * <Tabs.Panel value="overview">Workspace stats and activity.</Tabs.Panel>
34
+ * <Tabs.Panel value="activity">Recent activity.</Tabs.Panel>
35
+ * </Tabs.Root>
34
36
  * ```
35
37
  */
36
- export declare function Tabs({ variant, ...rest }: TabsProps): import("react").JSX.Element;
38
+ export declare function Root({ color, className, ...rest }: RootProps): import("react").JSX.Element;
37
39
  /**
38
40
  * Requires an accessible name so the underlying `tablist` is never nameless.
39
41
  * Provide exactly one of `aria-label` or `aria-labelledby`.
@@ -45,35 +47,36 @@ type TabsListAccessibleName = {
45
47
  "aria-labelledby": string;
46
48
  "aria-label"?: never;
47
49
  };
48
- export type TabsListProps = Omit<BaseTabs.List.Props, "render" | "aria-label" | "aria-labelledby"> & TabsListAccessibleName;
50
+ export type ListProps = Omit<BaseTabs.List.Props, "render" | "aria-label" | "aria-labelledby"> & TabsListAccessibleName;
49
51
  /**
50
- * Groups the `Tab` buttons into the pill track. The sliding indicator is
52
+ * Groups the `Tabs.Tab` buttons into the pill track. The sliding indicator is
51
53
  * rendered internally so it can never go missing.
52
54
  */
53
- export declare function TabsList({ children, ...rest }: TabsListProps): import("react").JSX.Element;
55
+ export declare function List({ children, className, ...rest }: ListProps): import("react").JSX.Element;
54
56
  export type TabProps = Omit<BaseTabs.Tab.Props, "render">;
55
57
  /**
56
58
  * An individual tab. Pass an icon and label as children; mark decorative icons
57
59
  * with `aria-hidden` so they aren't announced.
58
60
  *
59
61
  * ```tsx
60
- * <Tab value="transactions">
62
+ * <Tabs.Tab value="transactions">
61
63
  * <Receipt size={18} aria-hidden />
62
64
  * Transaksjoner
63
- * </Tab>
65
+ * </Tabs.Tab>
64
66
  * ```
65
67
  */
66
- export declare function Tab(props: TabProps): import("react").JSX.Element;
67
- export type TabsIndicatorProps = Omit<BaseTabs.Indicator.Props, "render">;
68
+ export declare function Tab({ className, ...rest }: TabProps): import("react").JSX.Element;
69
+ export type IndicatorProps = Omit<BaseTabs.Indicator.Props, "render">;
68
70
  /**
69
- * The sliding pill behind the active tab. `TabsList` already renders one, so
71
+ * The sliding pill behind the active tab. `Tabs.List` already renders one, so
70
72
  * you only need this when composing a custom list.
71
73
  */
72
- export declare function TabsIndicator(props: TabsIndicatorProps): import("react").JSX.Element;
73
- export type TabPanelProps = Omit<BaseTabs.Panel.Props, "render">;
74
+ export declare function Indicator({ className, ...rest }: IndicatorProps): import("react").JSX.Element;
75
+ export type PanelProps = Omit<BaseTabs.Panel.Props, "render">;
74
76
  /**
75
- * Content shown when the `Tab` with the matching `value` is active. Optional —
76
- * omit it to use `Tabs` purely as a bar that toggles content you render
77
- * elsewhere (drive it with `value`/`onValueChange`).
77
+ * Content shown when the `Tabs.Tab` with the matching `value` is active.
78
+ * Optional — omit it to use `Tabs` purely as a bar that toggles content you
79
+ * render elsewhere (drive it with `value`/`onValueChange`).
78
80
  */
79
- export declare function TabPanel(props: TabPanelProps): import("react").JSX.Element;
81
+ export declare function Panel({ className, ...rest }: PanelProps): import("react").JSX.Element;
82
+ export {};
@@ -3,5 +3,5 @@
3
3
  * "Next" subtitle prefix, and the visually-hidden "step X of Y" context.
4
4
  * Consumers can override any of these per-instance via the `labels` prop.
5
5
  */
6
- export declare const useStepperLabels: () => Record<"next" | "step" | "back" | "of", string>;
6
+ export declare const useStepperLabels: () => Record<"step" | "next" | "back" | "of", string>;
7
7
  export type StepperLabels = Partial<ReturnType<typeof useStepperLabels>>;