@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
@@ -4,6 +4,10 @@ type StatusIconProps = {
4
4
  status: StatusIconStatus;
5
5
  /** Rendered size in px. */
6
6
  size?: number;
7
+ /**
8
+ * Colour of the spinner and of the filled check.
9
+ * @default "primary"
10
+ */
7
11
  color?: AnimationColor;
8
12
  /**
9
13
  * Accessible name; defaults to the translated label for the current status in
@@ -1,6 +1,14 @@
1
1
  import { AnimationColor, AnimationSize } from '../shared';
2
2
  type CheckAnimationProps = {
3
+ /**
4
+ * `"sm"` is 90px, `"lg"` 150px.
5
+ * @default "lg"
6
+ */
3
7
  size?: AnimationSize;
8
+ /**
9
+ * Colour of the badge and its halo.
10
+ * @default "primary"
11
+ */
4
12
  color?: AnimationColor;
5
13
  /**
6
14
  * Accessible name for the illustration; defaults to the translated word for
@@ -1,5 +1,9 @@
1
1
  import { AnimationSize } from '../shared';
2
2
  type PulseAnimationProps = {
3
+ /**
4
+ * `"sm"` is 90px, `"lg"` 150px.
5
+ * @default "lg"
6
+ */
3
7
  size?: AnimationSize;
4
8
  /**
5
9
  * Accessible name for the spinner; defaults to the translated word for
@@ -8,5 +12,5 @@ type PulseAnimationProps = {
8
12
  */
9
13
  label?: string;
10
14
  };
11
- export declare const PulseAnimation: ({ size, label, }: PulseAnimationProps) => import("react").JSX.Element;
15
+ export declare const PulseAnimation: ({ size, label }: PulseAnimationProps) => import("react").JSX.Element;
12
16
  export {};
@@ -2,8 +2,15 @@ import { AnimationColor, AnimationSize } from '../shared';
2
2
  type StatusAnimationProps = {
3
3
  /** While `true`, shows the pulse; when it flips to `false`, transitions to the check. */
4
4
  loading: boolean;
5
+ /**
6
+ * `"sm"` is 90px, `"lg"` 150px.
7
+ * @default "lg"
8
+ */
5
9
  size?: AnimationSize;
6
- /** Colour of the resulting check (and its halo). */
10
+ /**
11
+ * Colour of the resulting check (and its halo).
12
+ * @default "primary"
13
+ */
7
14
  color?: AnimationColor;
8
15
  /**
9
16
  * Minimum time (ms) the pulse stays visible once mounted in the loading
@@ -1,31 +1,7 @@
1
- import { SxProps, Theme } from '@mui/material';
2
1
  import { ReactNode } from 'react';
3
- export type AnimationSize = "small" | "large";
4
- export type AnimationColor = "purple" | "green";
5
- export declare const colorMap: Record<AnimationColor, {
6
- base: string;
7
- contrast: string;
8
- }>;
9
- export declare const visuallyHidden: {
10
- readonly position: "absolute";
11
- readonly width: "1px";
12
- readonly height: "1px";
13
- readonly overflow: "hidden";
14
- readonly clip: "rect(0 0 0 0)";
15
- readonly whiteSpace: "nowrap";
16
- };
17
- export declare const reducedMotionOverride: {
18
- readonly "@media (prefers-reduced-motion: reduce)": {
19
- readonly animation: "none";
20
- };
21
- };
22
- export declare const reducedMotionHidden: {
23
- readonly "@media (prefers-reduced-motion: reduce)": {
24
- readonly animation: "none";
25
- readonly opacity: 0;
26
- };
27
- };
28
- export declare const illustrationBadgeShadow = "rgba(255, 255, 255, 0.1) 0px 1px 1px 0px inset, rgba(50, 50, 93, 0.25) 0px 30px 60px -20px, rgba(0, 0, 0, 0.25) 0px 18px 36px -18px";
2
+ import { ColorRoles } from '../color-roles';
3
+ export type AnimationSize = "sm" | "lg";
4
+ export type AnimationColor = ColorRoles<"primary" | "tertiary">;
29
5
  export type ConfettiParticle = {
30
6
  id: number;
31
7
  x: number;
@@ -55,13 +31,11 @@ type ConfettiParticlesProps = {
55
31
  };
56
32
  export declare const ConfettiParticles: ({ particles, variant, delay, duration, useCurrentColor, }: ConfettiParticlesProps) => import("react").JSX.Element[];
57
33
  type AnimationBadgeProps = {
34
+ /** Diameter in px. */
58
35
  size: number;
59
- base: string;
60
- contrast: string;
61
36
  iconSize: number;
62
- boxShadow?: string;
63
- sx?: SxProps<Theme>;
37
+ className?: string;
64
38
  children?: ReactNode;
65
39
  };
66
- export declare const AnimationBadge: ({ size, base, contrast, iconSize, boxShadow, sx, children, }: AnimationBadgeProps) => import("react").JSX.Element;
40
+ export declare const AnimationBadge: ({ size, iconSize, className, children, }: AnimationBadgeProps) => import("react").JSX.Element;
67
41
  export {};
@@ -0,0 +1,18 @@
1
+ type SpinnerProps = {
2
+ /** Diameter in px. */
3
+ size: number;
4
+ /** Stroke width, in the units of a 44px circle. */
5
+ thickness?: number;
6
+ /**
7
+ * Accessible name. With one, the spinner is a `progressbar`; without, it is
8
+ * hidden from assistive tech and its parent says what is loading.
9
+ */
10
+ label?: string;
11
+ className?: string;
12
+ };
13
+ /**
14
+ * An indeterminate spinner: an arc in the current colour that turns at a
15
+ * constant speed. Internal to the animations.
16
+ */
17
+ export declare const Spinner: ({ size, thickness, label, className, }: SpinnerProps) => import("react").JSX.Element;
18
+ export {};
@@ -1,6 +1 @@
1
- /**
2
- * Translated accessible names for the status animations (`StatusIcon`,
3
- * `StatusAnimation`, `CheckAnimation`, `PulseAnimation`). Each component takes
4
- * a label prop so a consumer can say something more specific than "loading".
5
- */
6
1
  export declare const useAnimationLabels: () => Record<"pending" | "loading" | "done" | "confirmed", string>;
@@ -1,18 +1,16 @@
1
- import { ButtonProps as MuiButtonProps } from '@mui/material';
2
- import { ElementType } from 'react';
3
- type ActionButtonProps<C extends ElementType = "button"> = Omit<MuiButtonProps<C>, "variant"> & {
4
- component?: C;
5
- };
1
+ import { ButtonRootProps } from './button-base';
2
+ export type ActionButtonProps = Omit<ButtonRootProps, "loading">;
6
3
  /**
7
4
  * A pill-shaped call-to-action button with a built-in arrow icon.
8
5
  *
9
6
  * Used for primary navigation actions on the website, such as hero sections
10
- * and landing pages. Supports polymorphic rendering:
7
+ * and landing pages. To render a link, pass it through `render`; an element
8
+ * with `href` or `to` is rendered as a real link, without button semantics:
11
9
  *
12
10
  * ```tsx
13
- * <ActionButton component={Link} to="/loans">Se våra lån</ActionButton>
14
- * <ActionButton component={NextLink} href="/loans">Se våra lån</ActionButton>
11
+ * <ActionButton render={<a href="/lan" />}>Se våra lån</ActionButton>
12
+ * <ActionButton render={<NextLink href="/lan" />}>Se våra lån</ActionButton>
13
+ * <ActionButton render={<RouterLink to="/lan" />}>Se våra lån</ActionButton>
15
14
  * ```
16
15
  */
17
- export declare const ActionButton: ({ children, ...rest }: ActionButtonProps) => import("react").JSX.Element;
18
- export {};
16
+ export declare function ActionButton({ children, className, ...rest }: ActionButtonProps): import("react").JSX.Element;
@@ -1,8 +1,20 @@
1
1
  import { Button as BaseButton } from '@base-ui/react/button';
2
+ import { Ref } from 'react';
3
+ import { ColorRoles } from '../color-roles';
2
4
  export type ButtonVariant = "solid" | "outline" | "ghost";
3
- export type ButtonColor = "accent" | "neutral" | "danger";
5
+ export type ButtonColor = ColorRoles<"primary" | "secondary" | "error">;
4
6
  export type ButtonSize = "sm" | "md" | "lg";
5
- export type ButtonBaseProps = Omit<BaseButton.Props, "color"> & {
7
+ export type ButtonRootProps = Omit<BaseButton.Props, "color" | "ref"> & {
8
+ /**
9
+ * Shows the busy state: the button is disabled, keeps its colour at reduced
10
+ * opacity and sets `aria-busy`.
11
+ * @default false
12
+ */
13
+ loading?: boolean;
14
+ /** The rendered element: the `<button>`, or the link passed to `render`. */
15
+ ref?: Ref<HTMLElement>;
16
+ };
17
+ export type ButtonBaseProps = ButtonRootProps & {
6
18
  /**
7
19
  * Visual weight.
8
20
  * - `"solid"` — filled, for the main action.
@@ -12,23 +24,25 @@ export type ButtonBaseProps = Omit<BaseButton.Props, "color"> & {
12
24
  */
13
25
  variant?: ButtonVariant;
14
26
  /**
15
- * Colour scheme. `"danger"` is for destructive actions.
16
- * @default "accent"
27
+ * Colour scheme: `"primary"` is the brand purple, `"secondary"` the
28
+ * near-black, `"error"` is for destructive actions.
29
+ * @default "primary"
17
30
  */
18
31
  color?: ButtonColor;
19
32
  /**
20
33
  * @default "md"
21
34
  */
22
35
  size?: ButtonSize;
23
- /**
24
- * Shows the busy state: the button is disabled, keeps its colour at reduced
25
- * opacity and sets `aria-busy`.
26
- * @default false
27
- */
28
- loading?: boolean;
29
36
  };
37
+ /**
38
+ * A button, or the link passed to `render`, with the disabled and busy states
39
+ * wired. It has no look of its own: the class comes from the caller. Internal
40
+ * — not exported from the package.
41
+ */
42
+ export declare function ButtonRoot({ loading, disabled, className, render, nativeButton, focusableWhenDisabled, ref, ...rest }: ButtonRootProps): import("react").JSX.Element;
30
43
  /**
31
44
  * The root shared by `Button`, `IconButton`, `CloseButton` and
32
- * `DownloadTrigger`. Internal — not exported from the package.
45
+ * `DownloadTrigger`: `ButtonRoot` with the button look. Internal — not
46
+ * exported from the package.
33
47
  */
34
- export declare const ButtonBase: import('react').ForwardRefExoticComponent<Omit<ButtonBaseProps, "ref"> & import('react').RefAttributes<HTMLElement>>;
48
+ export declare function ButtonBase({ variant, color, size, className, ...rest }: ButtonBaseProps): import("react").JSX.Element;
@@ -15,7 +15,7 @@ export type ButtonProps = ButtonBaseProps & {
15
15
  /**
16
16
  * A button built on Base UI's `Button` primitive and styled with Lea's design
17
17
  * tokens. Pick a `variant` (`solid`, `outline`, `ghost`), a `color`
18
- * (`accent`, `neutral`, `danger`) and a `size` (`sm`, `md`, `lg`).
18
+ * (`primary`, `secondary`, `error`) and a `size` (`sm`, `md`, `lg`).
19
19
  *
20
20
  * ```tsx
21
21
  * <Button variant="outline" startIcon={<Plus aria-hidden />}>Add</Button>
@@ -33,4 +33,4 @@ export type ButtonProps = ButtonBaseProps & {
33
33
  *
34
34
  * For a link inside running text, use `Link` instead.
35
35
  */
36
- export declare const Button: import('react').ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & import('react').RefAttributes<HTMLElement>>;
36
+ export declare function Button({ startIcon, endIcon, loading, loadingLabel, children, ...rest }: ButtonProps): import("react").JSX.Element;
@@ -11,4 +11,4 @@ export type CloseButtonProps = Omit<ButtonBaseProps, "children" | "aria-label" |
11
11
  * <CloseButton onClick={() => setOpen(false)} />
12
12
  * ```
13
13
  */
14
- export declare const CloseButton: import('react').ForwardRefExoticComponent<Omit<CloseButtonProps, "ref"> & import('react').RefAttributes<HTMLElement>>;
14
+ export declare function CloseButton({ label, variant, color, ...rest }: CloseButtonProps): import("react").JSX.Element;
@@ -26,17 +26,5 @@ export type IconButtonProps = Omit<ButtonBaseProps, "children" | "aria-label" |
26
26
  * </IconButton>
27
27
  * ```
28
28
  */
29
- export declare const IconButton: import('react').ForwardRefExoticComponent<(Omit<Omit<ButtonBaseProps, "children" | "aria-label" | "aria-labelledby"> & {
30
- "aria-label": string;
31
- "aria-labelledby"?: never;
32
- } & {
33
- /** The icon. Mark it `aria-hidden` — the name comes from `aria-label`. */
34
- children: ReactNode;
35
- }, "ref"> | Omit<Omit<ButtonBaseProps, "children" | "aria-label" | "aria-labelledby"> & {
36
- "aria-labelledby": string;
37
- "aria-label"?: never;
38
- } & {
39
- /** The icon. Mark it `aria-hidden` — the name comes from `aria-label`. */
40
- children: ReactNode;
41
- }, "ref">) & import('react').RefAttributes<HTMLElement>>;
29
+ export declare function IconButton({ loading, className, children, ...rest }: IconButtonProps): import("react").JSX.Element;
42
30
  export {};
@@ -1,6 +1,23 @@
1
- type SkipLinkProps = {
1
+ import { ReactNode } from 'react';
2
+ import { ButtonBaseProps } from './button-base';
3
+ export type SkipLinkProps = Pick<ButtonBaseProps, "className" | "style"> & {
4
+ /** The id of the main content, as a fragment: `#main`. */
2
5
  href: string;
3
- children: React.ReactNode;
6
+ children: ReactNode;
4
7
  };
5
- export default function SkipLink({ href, children }: SkipLinkProps): import("react").JSX.Element;
6
- export {};
8
+ /**
9
+ * A link for keyboard users to jump past the header to the main content. It
10
+ * stays hidden until it receives focus, so place it first in the page and it
11
+ * is the first thing the Tab key reaches:
12
+ *
13
+ * ```tsx
14
+ * <body>
15
+ * <SkipLink href="#main">Hopp til hovedinnhold</SkipLink>
16
+ * <AppHeader />
17
+ * <main id="main" tabIndex={-1}>…</main>
18
+ * </body>
19
+ * ```
20
+ *
21
+ * It is positioned against the page, so no ancestor should be positioned.
22
+ */
23
+ export declare function SkipLink({ href, children, className, style }: SkipLinkProps): import("react").JSX.Element;
@@ -0,0 +1,8 @@
1
+ import { ColorRole } from '../theme/token-types';
2
+ /**
3
+ * A component's own subset of `ColorRole`:
4
+ * `ColorRoles<"primary" | "secondary" | "error">`. A name outside the shared
5
+ * vocabulary is a type error, where `Extract` would quietly drop it. Internal:
6
+ * not exported from the package.
7
+ */
8
+ export type ColorRoles<Role extends ColorRole> = Role;
@@ -1,6 +1,56 @@
1
- import { CardProps as MuiCardProps } from '@mui/material';
1
+ import { useRender } from '@base-ui/react/use-render';
2
+ import { Ref } from 'react';
3
+ import { ColorRoles } from '../color-roles';
4
+ export type CardColor = ColorRoles<"primary" | "tertiary" | "neutral" | "success" | "info" | "warning" | "error">;
5
+ export type CardVariant = "outlined" | "filled";
6
+ export type CardProps = Omit<useRender.ComponentProps<"div">, "ref" | "color"> & {
7
+ /** The rendered element: the `<div>`, or the element passed to `render`. */
8
+ ref?: Ref<HTMLElement>;
9
+ /**
10
+ * A tint for the card. Left out, the card is white.
11
+ * - A brand tint: `"primary"` (purple), `"tertiary"` (teal) or `"neutral"`
12
+ * (grey).
13
+ * - A status: `"success"` (teal), `"info"` (blue), `"warning"` (amber) or
14
+ * `"error"` (red).
15
+ */
16
+ color?: CardColor;
17
+ /**
18
+ * With a 1px border, or without one. The card keeps its size either way, so
19
+ * the two line up in a row.
20
+ * @default "outlined"
21
+ */
22
+ variant?: CardVariant;
23
+ };
2
24
  /**
3
- * A surface container that wraps MUI `Card` with Lea's design tokens for
4
- * radius, elevation, and colours. Use it to group related content on a page.
25
+ * A flat surface that groups related content: white, with a 1px border and
26
+ * rounded corners. It has no padding of its own, so an image or a divider can
27
+ * run edge to edge; put text in `CardContent`.
28
+ *
29
+ * Set `color` for a tint, and `variant="filled"` to drop the border:
30
+ *
31
+ * ```tsx
32
+ * <Card color="primary" variant="filled">…</Card>
33
+ * ```
34
+ *
35
+ * ```tsx
36
+ * <Card>
37
+ * <CardContent>
38
+ * <Text textStyle="heading-sm">Forbrukslån</Text>
39
+ * <Text color="text.subtle">150 000 kr over 10 år</Text>
40
+ * </CardContent>
41
+ * </Card>
42
+ * ```
43
+ *
44
+ * Renders a `div`; pass `render` for another element, e.g.
45
+ * `render={<section />}` or `render={<li />}`.
5
46
  */
6
- export declare const Card: ({ ...props }: MuiCardProps) => import("react").JSX.Element;
47
+ export declare function Card({ render, ref, className, color, variant, ...rest }: CardProps): import('react').ReactElement<unknown, string | import('react').JSXElementConstructor<any>>;
48
+ export type CardContentProps = Omit<useRender.ComponentProps<"div">, "ref"> & {
49
+ /** The rendered element: the `<div>`, or the element passed to `render`. */
50
+ ref?: Ref<HTMLElement>;
51
+ };
52
+ /**
53
+ * The padded area of a `Card`. A card can hold several, separated by whatever
54
+ * sits between them.
55
+ */
56
+ export declare function CardContent({ render, ref, className, ...rest }: CardContentProps): import('react').ReactElement<unknown, string | import('react').JSXElementConstructor<any>>;
@@ -1,11 +1,53 @@
1
- import { ChipProps as MuiChipProps } from '@mui/material';
2
- export type ChipProps = MuiChipProps;
1
+ import { ComponentProps, MouseEvent, ReactNode } from 'react';
2
+ import { ColorRoles } from '../color-roles';
3
+ export type ChipColor = ColorRoles<"primary" | "tertiary" | "neutral" | "success" | "info" | "warning" | "error">;
4
+ export type ChipVariant = "filled" | "outlined";
5
+ export type ChipSize = "sm" | "md";
6
+ export type ChipProps = Omit<ComponentProps<"span">, "children" | "color"> & {
7
+ /** The text of the chip. */
8
+ label: ReactNode;
9
+ /**
10
+ * What the chip stands for.
11
+ * - A tag without a status: `"primary"` (purple), `"tertiary"` (teal) or
12
+ * `"neutral"` (grey).
13
+ * - A status: `"success"` (teal), `"info"` (blue), `"warning"` (amber) or
14
+ * `"error"` (red).
15
+ * @default "primary"
16
+ */
17
+ color?: ChipColor;
18
+ /**
19
+ * Tinted fill, or a border on a transparent background.
20
+ * @default "filled"
21
+ */
22
+ variant?: ChipVariant;
23
+ /**
24
+ * @default "md"
25
+ */
26
+ size?: ChipSize;
27
+ /** Icon before the label. Mark a decorative icon `aria-hidden`. */
28
+ icon?: ReactNode;
29
+ /**
30
+ * Shows a remove button after the label and is called when it is pressed.
31
+ * The button is named in the `LeaProvider` language and includes the label,
32
+ * so a row of chips reads unambiguously: "Fjern Medlånetaker".
33
+ */
34
+ onDelete?: (event: MouseEvent<HTMLButtonElement>) => void;
35
+ /** Accessible name of the remove button, when the default does not fit. */
36
+ deleteLabel?: string;
37
+ /** Dims the chip and disables its remove button. */
38
+ disabled?: boolean;
39
+ };
3
40
  /**
4
- * A compact label for tags, statuses, or filter selections, styled with Lea's
5
- * design tokens on top of MUI `Chip`.
41
+ * A compact label for tags, statuses, or filter selections.
6
42
  *
7
- * With `onDelete`, the delete affordance is named in the `LeaProvider` language
8
- * and includes the chip's own label, so a row of chips reads unambiguously.
9
- * Pass `deleteIcon` to supply a different glyph and name.
43
+ * ```tsx
44
+ * <Chip label="Medlånetaker" />
45
+ * <Chip label="Verifisert" color="success" icon={<CircleCheck size={16} aria-hidden />} />
46
+ * <Chip label="Oslo" variant="outlined" onDelete={() => remove("oslo")} />
47
+ * ```
48
+ *
49
+ * The chip itself is not interactive; only its remove button is. Inside a
50
+ * widget that moves focus itself, `tabIndex={-1}` takes the chip and its
51
+ * remove button out of the tab order.
10
52
  */
11
- export declare const Chip: ({ label, onDelete, deleteIcon, ...rest }: ChipProps) => import("react").JSX.Element;
53
+ export declare function Chip({ label, color, variant, size, icon, onDelete, deleteLabel, disabled, className, tabIndex, ...rest }: ChipProps): import("react").JSX.Element;
@@ -1,12 +1,23 @@
1
- import { BoxProps } from '@mui/material';
2
- import { ReactNode } from 'react';
3
- export type DataFieldProps = Omit<BoxProps, "children"> & {
1
+ import { ComponentProps, ReactNode } from 'react';
2
+ export type DataFieldProps = Omit<ComponentProps<"div">, "children"> & {
4
3
  label: ReactNode;
5
4
  value: ReactNode;
5
+ /**
6
+ * Draws a line under the row, for stacking several into a summary.
7
+ * @default true
8
+ */
6
9
  divider?: boolean;
7
10
  };
8
11
  /**
9
12
  * A single label/value row for presenting read-only details, with an optional
10
13
  * bottom divider so several fields can be stacked into a summary list.
14
+ *
15
+ * ```tsx
16
+ * <DataField label="Lånebeløp" value="150 000 kr" />
17
+ * <DataField label="Månedsbeløp" value="1 316 kr" divider={false} />
18
+ * ```
19
+ *
20
+ * Text passed as `label` or `value` is set in the label and value styles. Any
21
+ * other element is rendered as it is, for a side that needs richer content.
11
22
  */
12
- export declare const DataField: ({ label, value, divider, sx, ...rest }: DataFieldProps) => import("react").JSX.Element;
23
+ export declare const DataField: ({ label, value, divider, className, ...rest }: DataFieldProps) => import("react").JSX.Element;
@@ -1,37 +1,89 @@
1
- import { TooltipProps as MuiTooltipProps } from '@mui/material';
2
- import { SxProps, Theme } from '@mui/material/styles';
3
- import { ReactElement, ReactNode } from 'react';
4
- import { TooltipSurfaceVariant, TooltipTriggerVariant } from '../../theme/components/tooltip.theme';
5
- export type { TooltipSurfaceVariant, TooltipTriggerVariant };
6
- type WrappedTooltipProps = Omit<MuiTooltipProps, "children"> & {
7
- children: ReactElement;
1
+ import { CSSProperties, ReactElement, ReactNode } from 'react';
2
+ export type TooltipTriggerVariant = "icon" | "filled" | "outlined";
3
+ export type TooltipSurfaceVariant = "light" | "dark";
4
+ export type TooltipOpenOn = "hover" | "click";
5
+ type Side = "top" | "bottom" | "left" | "right";
6
+ export type TooltipPlacement = Side | `${Side}-start` | `${Side}-end`;
7
+ type SharedProps = {
8
+ /** What the tooltip says. Nothing is shown while it is empty. */
9
+ title: ReactNode;
10
+ /**
11
+ * How the tooltip opens.
12
+ * - `"hover"`: on mouse hover and on keyboard focus. It does not open on
13
+ * touch, so use it for a hint the control works without.
14
+ * - `"click"`: on click, tap, Enter or Space, and on mouse hover too. It
15
+ * stays open until dismissed, so use it for information people need.
16
+ *
17
+ * Defaults to `"hover"` around `children` and to `"click"` for the
18
+ * built-in trigger.
19
+ */
20
+ openOn?: TooltipOpenOn;
21
+ /**
22
+ * Where the tooltip sits against its trigger. It moves to another side when
23
+ * there is no room.
24
+ * @default "top"
25
+ */
26
+ placement?: TooltipPlacement;
27
+ /**
28
+ * Colours of the bubble: black text on white, or white text on black.
29
+ * @default "light"
30
+ */
31
+ surfaceVariant?: TooltipSurfaceVariant;
32
+ };
33
+ type WrappedTooltipProps = SharedProps & {
34
+ /**
35
+ * The trigger: one element that takes a `ref` and spreads its props, such
36
+ * as a `Button`. It needs an accessible name of its own.
37
+ */
38
+ children: ReactElement<TriggerElementProps>;
8
39
  ariaLabel?: never;
9
40
  triggerIcon?: never;
10
41
  triggerVariant?: never;
11
- triggerSx?: never;
12
- surfaceVariant?: TooltipSurfaceVariant;
42
+ className?: never;
43
+ style?: never;
13
44
  };
14
- type TriggerTooltipProps = Omit<MuiTooltipProps, "children"> & {
45
+ type TriggerTooltipProps = SharedProps & {
15
46
  children?: never;
16
47
  /** Accessible name for the built-in trigger button. */
17
48
  ariaLabel: string;
18
- /** Trigger icon or content. Defaults to `InfoIcon`. */
49
+ /** Trigger icon or content. Defaults to an "i" in a circle. */
19
50
  triggerIcon?: ReactNode;
20
- /** Visual style of the built-in trigger button. @default "icon" */
51
+ /**
52
+ * Visual style of the built-in trigger button.
53
+ * @default "icon"
54
+ */
21
55
  triggerVariant?: TooltipTriggerVariant;
22
- /** Optional `sx` override for the built-in trigger button. */
23
- triggerSx?: SxProps<Theme>;
24
- /** Tooltip bubble colour treatment. @default "light" */
25
- surfaceVariant?: TooltipSurfaceVariant;
56
+ /** Class on the built-in trigger button. */
57
+ className?: string;
58
+ /** Inline style on the built-in trigger button. */
59
+ style?: CSSProperties;
26
60
  };
27
61
  export type TooltipProps = WrappedTooltipProps | TriggerTooltipProps;
62
+ type TriggerElementProps = {
63
+ id?: string;
64
+ "aria-describedby"?: string;
65
+ };
28
66
  /**
29
- * Tooltip wrapper around MUI's `Tooltip`.
67
+ * A small bubble of text anchored to a trigger, on Base UI's `Tooltip` and
68
+ * `Popover`.
30
69
  *
31
70
  * Use it two ways:
32
- * - **Wrapped child:** pass `children` to decorate any trigger you already have.
33
- * - **Built-in trigger:** omit `children` and pass `ariaLabel`; a small trigger
34
- * button is rendered for you, styled by `triggerVariant` and optionally
35
- * extended via `triggerSx`.
71
+ * - **Around a child:** pass `children` to add a hint to a control you already
72
+ * have. It opens on hover and keyboard focus and describes the control.
73
+ * - **Built-in trigger:** omit `children` and pass `ariaLabel`; a small info
74
+ * button is rendered for you. It opens on click, so it works on touch.
75
+ *
76
+ * ```tsx
77
+ * <Tooltip title="Kopier kontonummer">
78
+ * <IconButton aria-label="Kopier">…</IconButton>
79
+ * </Tooltip>
80
+ *
81
+ * <Tooltip title="Beløpet du betaler hver måned." ariaLabel="Mer informasjon" />
82
+ * ```
83
+ *
84
+ * `openOn` switches either one: `openOn="click"` around a button makes it a
85
+ * disclosure, and `openOn="hover"` makes the info button a plain hint. On
86
+ * hover the trigger must work without the tooltip, since touch never shows it.
36
87
  */
37
- export declare const Tooltip: ({ title, placement, children, ariaLabel, triggerIcon, triggerVariant, triggerSx, surfaceVariant, slotProps, id: suppliedId, ...rest }: TooltipProps) => import("react").JSX.Element;
88
+ export declare function Tooltip({ title, openOn, placement, surfaceVariant, children, ariaLabel, triggerIcon, triggerVariant, className, style, }: TooltipProps): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import('react').ReactPortal | ReactElement<unknown, string | import('react').JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | import("react").JSX.Element | null | undefined;
89
+ export {};
@@ -1,6 +1,7 @@
1
1
  import { ComponentPropsWithRef, ReactNode, SyntheticEvent } from 'react';
2
- export type AlertSeverity = "success" | "info" | "warning" | "error";
3
- export type AlertColor = AlertSeverity | "purple" | "grey";
2
+ import { ColorRoles } from '../color-roles';
3
+ export type AlertSeverity = ColorRoles<"success" | "info" | "warning" | "error">;
4
+ export type AlertColor = AlertSeverity | ColorRoles<"primary" | "neutral">;
4
5
  export type AlertVariant = "standard" | "filled" | "outlined";
5
6
  export type AlertSize = "sm" | "lg";
6
7
  export type AlertProps = Omit<ComponentPropsWithRef<"div">, "color"> & {
@@ -10,8 +11,8 @@ export type AlertProps = Omit<ComponentPropsWithRef<"div">, "color"> & {
10
11
  */
11
12
  severity?: AlertSeverity;
12
13
  /**
13
- * Colour scheme. Defaults to the colour of `severity`. `"purple"` and
14
- * `"grey"` carry no status meaning.
14
+ * Colour scheme. Defaults to the colour of `severity`. `"primary"` (the
15
+ * brand purple) and `"neutral"` (grey) carry no status meaning.
15
16
  */
16
17
  color?: AlertColor;
17
18
  /**
@@ -41,12 +42,10 @@ export type AlertProps = Omit<ComponentPropsWithRef<"div">, "color"> & {
41
42
  export declare function resolveAlert({ severity, color, variant, size, icon, action, onClose, closeLabel, role, children, ...rest }: AlertProps): {
42
43
  rootProps: {
43
44
  role: import('react').AriaRole;
44
- "data-color": "purple" | "grey" | "success" | "error" | "info" | "warning";
45
+ "data-color": AlertColor;
45
46
  "data-variant": AlertVariant;
46
47
  "data-size": AlertSize;
47
- content?: string | undefined | undefined;
48
- translate?: "yes" | "no" | undefined | undefined;
49
- hidden?: boolean | undefined | undefined;
48
+ className?: string | undefined | undefined;
50
49
  slot?: string | undefined | undefined;
51
50
  style?: import('react').CSSProperties | undefined;
52
51
  title?: string | undefined | undefined;
@@ -63,19 +62,21 @@ export declare function resolveAlert({ severity, color, variant, size, icon, act
63
62
  accessKey?: string | undefined | undefined;
64
63
  autoCapitalize?: "off" | "none" | "on" | "sentences" | "words" | "characters" | undefined | (string & {}) | undefined;
65
64
  autoFocus?: boolean | undefined | undefined;
66
- className?: string | undefined | undefined;
67
65
  contentEditable?: "inherit" | (boolean | "true" | "false") | "plaintext-only" | undefined;
68
66
  contextMenu?: string | undefined | undefined;
69
67
  dir?: string | undefined | undefined;
70
68
  draggable?: (boolean | "true" | "false") | undefined;
71
69
  enterKeyHint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined | undefined;
70
+ hidden?: boolean | undefined | undefined;
72
71
  id?: string | undefined | undefined;
73
72
  lang?: string | undefined | undefined;
74
73
  nonce?: string | undefined | undefined;
75
74
  spellCheck?: (boolean | "true" | "false") | undefined;
76
75
  tabIndex?: number | undefined | undefined;
76
+ translate?: "yes" | "no" | undefined | undefined;
77
77
  radioGroup?: string | undefined | undefined;
78
78
  about?: string | undefined | undefined;
79
+ content?: string | undefined | undefined;
79
80
  datatype?: string | undefined | undefined;
80
81
  inlist?: any;
81
82
  prefix?: string | undefined | undefined;