@leabankab/component-library 5.6.1

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 (190) hide show
  1. package/CHANGELOG.md +408 -0
  2. package/README.md +22 -0
  3. package/dist/bankidlogo.png +0 -0
  4. package/dist/component-library.es.js +6143 -0
  5. package/dist/component-library.es.js.map +1 -0
  6. package/dist/component-library.umd.js +35 -0
  7. package/dist/component-library.umd.js.map +1 -0
  8. package/dist/components/animations/icons/index.d.ts +1 -0
  9. package/dist/components/animations/icons/status-icon.d.ts +21 -0
  10. package/dist/components/animations/illustrations/check-animation.d.ts +12 -0
  11. package/dist/components/animations/illustrations/index.d.ts +3 -0
  12. package/dist/components/animations/illustrations/pulse-animation.d.ts +12 -0
  13. package/dist/components/animations/illustrations/status-animation.d.ts +32 -0
  14. package/dist/components/animations/index.d.ts +2 -0
  15. package/dist/components/animations/shared.d.ts +67 -0
  16. package/dist/components/animations/use-animation-labels.d.ts +6 -0
  17. package/dist/components/buttons/action-button.d.ts +18 -0
  18. package/dist/components/buttons/button.d.ts +20 -0
  19. package/dist/components/buttons/download-trigger.d.ts +33 -0
  20. package/dist/components/buttons/icon-button.d.ts +12 -0
  21. package/dist/components/buttons/index.d.ts +5 -0
  22. package/dist/components/buttons/skip-link.d.ts +6 -0
  23. package/dist/components/buttons/use-download-labels.d.ts +5 -0
  24. package/dist/components/data-display/card.d.ts +6 -0
  25. package/dist/components/data-display/chip.d.ts +11 -0
  26. package/dist/components/data-display/data-field.d.ts +12 -0
  27. package/dist/components/data-display/index.d.ts +4 -0
  28. package/dist/components/data-display/tooltip.d.ts +37 -0
  29. package/dist/components/data-display/use-chip-labels.d.ts +6 -0
  30. package/dist/components/dev-panel/dev-panel-country.d.ts +26 -0
  31. package/dist/components/dev-panel/dev-panel-flow.d.ts +28 -0
  32. package/dist/components/dev-panel/dev-panel-footer.d.ts +26 -0
  33. package/dist/components/dev-panel/dev-panel-payload.d.ts +47 -0
  34. package/dist/components/dev-panel/dev-panel-status.d.ts +31 -0
  35. package/dist/components/dev-panel/dev-panel-step-state.d.ts +28 -0
  36. package/dist/components/dev-panel/dev-panel-steps.d.ts +39 -0
  37. package/dist/components/dev-panel/dev-panel-variant.d.ts +21 -0
  38. package/dist/components/dev-panel/dev-panel.d.ts +61 -0
  39. package/dist/components/dev-panel/index.d.ts +9 -0
  40. package/dist/components/dev-panel/json-highlight.d.ts +15 -0
  41. package/dist/components/dev-panel/segmented-control.d.ts +38 -0
  42. package/dist/components/dev-panel/use-copy.d.ts +9 -0
  43. package/dist/components/dev-panel/use-dev-panel-labels.d.ts +7 -0
  44. package/dist/components/dev-panel/use-roving-radio.d.ts +34 -0
  45. package/dist/components/feedback/alert.d.ts +27 -0
  46. package/dist/components/feedback/dialog.d.ts +22 -0
  47. package/dist/components/feedback/drawer.d.ts +22 -0
  48. package/dist/components/feedback/index.d.ts +3 -0
  49. package/dist/components/feedback/use-close-label.d.ts +6 -0
  50. package/dist/components/form/autocomplete.d.ts +71 -0
  51. package/dist/components/form/checkbox.d.ts +12 -0
  52. package/dist/components/form/datepicker/calendar-header.d.ts +12 -0
  53. package/dist/components/form/datepicker/datepicker.d.ts +99 -0
  54. package/dist/components/form/datepicker/drawer-toolbar.d.ts +17 -0
  55. package/dist/components/form/datepicker/index.d.ts +1 -0
  56. package/dist/components/form/datepicker/use-calendar-header-labels.d.ts +8 -0
  57. package/dist/components/form/datepicker/use-datepicker-title-labels.d.ts +5 -0
  58. package/dist/components/form/datepicker/use-view-toggle-labels.d.ts +7 -0
  59. package/dist/components/form/datepicker/view-renderers.d.ts +10 -0
  60. package/dist/components/form/datepicker/view-toggle.d.ts +21 -0
  61. package/dist/components/form/email-input.d.ts +35 -0
  62. package/dist/components/form/fields/autocomplete-field.d.ts +17 -0
  63. package/dist/components/form/fields/boolean-radio-field.d.ts +3 -0
  64. package/dist/components/form/fields/checkbox-field.d.ts +12 -0
  65. package/dist/components/form/fields/datepicker-field.d.ts +9 -0
  66. package/dist/components/form/fields/email-field.d.ts +10 -0
  67. package/dist/components/form/fields/field-types.d.ts +18 -0
  68. package/dist/components/form/fields/index.d.ts +14 -0
  69. package/dist/components/form/fields/input-field.d.ts +9 -0
  70. package/dist/components/form/fields/multi-select-field.d.ts +9 -0
  71. package/dist/components/form/fields/number-field.d.ts +10 -0
  72. package/dist/components/form/fields/phone-number-field.d.ts +11 -0
  73. package/dist/components/form/fields/radio-card-field.d.ts +22 -0
  74. package/dist/components/form/fields/radio-field.d.ts +16 -0
  75. package/dist/components/form/fields/select-field.d.ts +9 -0
  76. package/dist/components/form/fields/use-field-control.d.ts +6 -0
  77. package/dist/components/form/fields/use-tooltip-trigger-labels.d.ts +5 -0
  78. package/dist/components/form/form-control/form-control-context.d.ts +35 -0
  79. package/dist/components/form/form-control/form-control-label.d.ts +1 -0
  80. package/dist/components/form/form-control/form-control.d.ts +13 -0
  81. package/dist/components/form/form-control/form-helper-text.d.ts +9 -0
  82. package/dist/components/form/form-control/form-label.d.ts +9 -0
  83. package/dist/components/form/form-control/index.d.ts +5 -0
  84. package/dist/components/form/index.d.ts +18 -0
  85. package/dist/components/form/input-label.d.ts +9 -0
  86. package/dist/components/form/input.d.ts +19 -0
  87. package/dist/components/form/multi-select.d.ts +32 -0
  88. package/dist/components/form/number-input.d.ts +52 -0
  89. package/dist/components/form/phone-number-input/countries.d.ts +33 -0
  90. package/dist/components/form/phone-number-input/index.d.ts +2 -0
  91. package/dist/components/form/phone-number-input/phone-number-input.d.ts +53 -0
  92. package/dist/components/form/radio-card.d.ts +77 -0
  93. package/dist/components/form/radio-circle.d.ts +19 -0
  94. package/dist/components/form/radio.d.ts +36 -0
  95. package/dist/components/form/select.d.ts +46 -0
  96. package/dist/components/form/slider.d.ts +23 -0
  97. package/dist/components/form/use-autocomplete-labels.d.ts +19 -0
  98. package/dist/components/index.d.ts +11 -0
  99. package/dist/components/navigation/form-stepper.d.ts +63 -0
  100. package/dist/components/navigation/index.d.ts +4 -0
  101. package/dist/components/navigation/progress-circle.d.ts +34 -0
  102. package/dist/components/navigation/tabs.d.ts +79 -0
  103. package/dist/components/navigation/use-stepper-labels.d.ts +7 -0
  104. package/dist/components/surfaces/accordion.d.ts +15 -0
  105. package/dist/components/surfaces/index.d.ts +1 -0
  106. package/dist/components/typography/index.d.ts +3 -0
  107. package/dist/components/typography/link.d.ts +23 -0
  108. package/dist/components/typography/lists.d.ts +54 -0
  109. package/dist/components/typography/text.d.ts +18 -0
  110. package/dist/components/ui/brand-divider.d.ts +6 -0
  111. package/dist/components/ui/index.d.ts +1 -0
  112. package/dist/creditcard.png +0 -0
  113. package/dist/favicon.ico +0 -0
  114. package/dist/hooks/country/countries.d.ts +8 -0
  115. package/dist/hooks/country/country-context.d.ts +20 -0
  116. package/dist/hooks/index.d.ts +6 -0
  117. package/dist/hooks/use-format-currency.d.ts +9 -0
  118. package/dist/hooks/use-format-date.d.ts +4 -0
  119. package/dist/hooks/use-format-number.d.ts +10 -0
  120. package/dist/hooks/validation/index.d.ts +1 -0
  121. package/dist/hooks/validation/use-validation.d.ts +21 -0
  122. package/dist/i18n/create-translation.d.ts +28 -0
  123. package/dist/i18n/index.d.ts +3 -0
  124. package/dist/i18n/language-context.d.ts +9 -0
  125. package/dist/i18n/languages.d.ts +9 -0
  126. package/dist/index.d.ts +9 -0
  127. package/dist/leabank-logo-square.png +0 -0
  128. package/dist/leabank-logo.png +0 -0
  129. package/dist/provider/index.d.ts +1 -0
  130. package/dist/provider/lea-provider.d.ts +16 -0
  131. package/dist/success-icon.png +0 -0
  132. package/dist/theme/components/accordion.theme.d.ts +7 -0
  133. package/dist/theme/components/action-button.theme.d.ts +45 -0
  134. package/dist/theme/components/alert.theme.d.ts +2 -0
  135. package/dist/theme/components/autocomplete.theme.d.ts +2 -0
  136. package/dist/theme/components/baseline-css.d.ts +2 -0
  137. package/dist/theme/components/button.theme.d.ts +2 -0
  138. package/dist/theme/components/card.theme.d.ts +2 -0
  139. package/dist/theme/components/checkbox.theme.d.ts +2 -0
  140. package/dist/theme/components/chip.theme.d.ts +2 -0
  141. package/dist/theme/components/date-picker.theme.d.ts +15 -0
  142. package/dist/theme/components/dev-panel.theme.d.ts +95 -0
  143. package/dist/theme/components/dialog.theme.d.ts +2 -0
  144. package/dist/theme/components/drawer.theme.d.ts +4 -0
  145. package/dist/theme/components/field-base.d.ts +31 -0
  146. package/dist/theme/components/form-control-label.theme.d.ts +2 -0
  147. package/dist/theme/components/form-control.theme.d.ts +2 -0
  148. package/dist/theme/components/icon-button.theme.d.ts +2 -0
  149. package/dist/theme/components/index.d.ts +2 -0
  150. package/dist/theme/components/input.theme.d.ts +3 -0
  151. package/dist/theme/components/link.theme.d.ts +2 -0
  152. package/dist/theme/components/menu-item.theme.d.ts +2 -0
  153. package/dist/theme/components/number-input.theme.d.ts +23 -0
  154. package/dist/theme/components/phone-number-input.theme.d.ts +43 -0
  155. package/dist/theme/components/radio.theme.d.ts +2 -0
  156. package/dist/theme/components/select.theme.d.ts +2 -0
  157. package/dist/theme/components/slider.theme.d.ts +2 -0
  158. package/dist/theme/components/tabs.theme.d.ts +34 -0
  159. package/dist/theme/components/tooltip.theme.d.ts +110 -0
  160. package/dist/theme/components/typography.theme.d.ts +2 -0
  161. package/dist/theme/index.d.ts +6 -0
  162. package/dist/theme/mui-augmentation.d.ts +147 -0
  163. package/dist/theme/sx-config.d.ts +10 -0
  164. package/dist/theme/token-types.d.ts +11 -0
  165. package/dist/theme/tokens/colors.d.ts +95 -0
  166. package/dist/theme/tokens/font-sizes.d.ts +12 -0
  167. package/dist/theme/tokens/font-weights.d.ts +9 -0
  168. package/dist/theme/tokens/index.d.ts +9 -0
  169. package/dist/theme/tokens/palette.d.ts +2 -0
  170. package/dist/theme/tokens/shadows.d.ts +9 -0
  171. package/dist/theme/tokens/shape.d.ts +12 -0
  172. package/dist/theme/tokens/spacing.d.ts +1 -0
  173. package/dist/theme/tokens/transitions.d.ts +10 -0
  174. package/dist/theme/tokens/typography.d.ts +43 -0
  175. package/dist/theme/types.d.ts +80 -0
  176. package/dist/theme/utils/focus-visible-styles.d.ts +6 -0
  177. package/dist/theme/utils/index.d.ts +1 -0
  178. package/dist/utils/downloadFile.d.ts +4 -0
  179. package/dist/utils/formatDecimal.d.ts +16 -0
  180. package/dist/utils/formatDecimalString.d.ts +12 -0
  181. package/dist/utils/formatPercentage.d.ts +1 -0
  182. package/dist/utils/index.d.ts +5 -0
  183. package/dist/utils/parseExpirationDate.d.ts +4 -0
  184. package/dist/validation/bank-account.d.ts +29 -0
  185. package/dist/validation/email.d.ts +24 -0
  186. package/dist/validation/index.d.ts +5 -0
  187. package/dist/validation/national-id.d.ts +30 -0
  188. package/dist/validation/phone.d.ts +16 -0
  189. package/dist/validation/types.d.ts +10 -0
  190. package/package.json +107 -0
@@ -0,0 +1,61 @@
1
+ import { SxProps, Theme } from '@mui/material';
2
+ import { ReactNode } from 'react';
3
+ /** Reads the enclosing `DevPanelSection` heading id, if any. */
4
+ export declare function useDevPanelSectionLabelId(): string | undefined;
5
+ export type DevPanelProps = {
6
+ /** Panel title shown in the header. Defaults to `"Dev controls"`. */
7
+ title?: ReactNode;
8
+ /** Optional pill beside the title, e.g. `"MOCK"` or `"live"`. */
9
+ badge?: ReactNode;
10
+ /** Show the small status dot before the title. Defaults to `true`. */
11
+ showStatusDot?: boolean;
12
+ /** Render the minimise control. Defaults to `true`. */
13
+ minimisable?: boolean;
14
+ /** Controlled minimised state. Omit for uncontrolled. */
15
+ minimised?: boolean;
16
+ /** Initial minimised state when uncontrolled. Defaults to `false`. */
17
+ defaultMinimised?: boolean;
18
+ /** Called whenever the minimised state changes. */
19
+ onMinimisedChange?: (minimised: boolean) => void;
20
+ /** Accessible name for the minimise button. Defaults to a translated label. */
21
+ minimiseLabel?: string;
22
+ /** Accessible name for the restore button. Defaults to a translated label. */
23
+ expandLabel?: string;
24
+ /** Section content: compose the `DevPanel*` sub-components here. */
25
+ children?: ReactNode;
26
+ sx?: SxProps<Theme>;
27
+ };
28
+ /**
29
+ * The root of the reusable dev panel: a self-contained, content-only card that
30
+ * form apps compose from the `DevPanel*` sub-components. It owns the chrome
31
+ * (title, optional badge, minimise control) and layout; every section is fully
32
+ * controlled by the consumer via `value` + `onChange`/callback props.
33
+ *
34
+ * It renders only the panel — placement (fixed corner, drawer, …) is left to the
35
+ * consuming app.
36
+ *
37
+ * ```tsx
38
+ * <DevPanel badge="MOCK">
39
+ * <DevPanelCountry value={country} onChange={setCountry} options={countries} />
40
+ * <DevPanelStatus value={status} onChange={setStatus} options={statuses} />
41
+ * <DevPanelPayload value={payload} />
42
+ * <DevPanelFooter onReseed={reseed} onCopyUrl={() => {}} url={url} />
43
+ * </DevPanel>
44
+ * ```
45
+ */
46
+ export declare function DevPanel({ title, badge, showStatusDot, minimisable, minimised, defaultMinimised, onMinimisedChange, minimiseLabel, expandLabel, children, sx, }: DevPanelProps): import("react").JSX.Element;
47
+ export type DevPanelSectionProps = {
48
+ /** The uppercase section heading (e.g. `"Country"`). */
49
+ label: ReactNode;
50
+ /** Optional trailing meta shown on the heading row (e.g. a `6 / 10` count). */
51
+ meta?: ReactNode;
52
+ children?: ReactNode;
53
+ sx?: SxProps<Theme>;
54
+ };
55
+ /**
56
+ * A labelled section wrapper. Renders the uppercase heading and exposes its
57
+ * generated id through context so a nested interactive group can reference it
58
+ * via `aria-labelledby`. Used internally by every `DevPanel*` section; exported
59
+ * so consumers can build bespoke sections with the same look and wiring.
60
+ */
61
+ export declare function DevPanelSection({ label, meta, children, sx, }: DevPanelSectionProps): import("react").JSX.Element;
@@ -0,0 +1,9 @@
1
+ export * from './dev-panel';
2
+ export * from './dev-panel-country';
3
+ export * from './dev-panel-variant';
4
+ export * from './dev-panel-step-state';
5
+ export * from './dev-panel-steps';
6
+ export * from './dev-panel-status';
7
+ export * from './dev-panel-flow';
8
+ export * from './dev-panel-payload';
9
+ export * from './dev-panel-footer';
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Returns `true` when `value` should be syntax-highlighted as JSON: any non-null
3
+ * non-string value (objects, arrays, numbers, booleans), or a string that parses
4
+ * cleanly as JSON. Plain prose strings return `false` so they render verbatim.
5
+ */
6
+ export declare function looksLikeJson(value: unknown): boolean;
7
+ /**
8
+ * Renders a serialised JSON string as coloured spans. Output is built from React
9
+ * nodes (never `dangerouslySetInnerHTML`), so a string value such as `"<img>"`
10
+ * is shown as text and can never inject markup. Colours come from the theme's
11
+ * `payloadTokenColors` and are applied inline to keep the many spans cheap.
12
+ */
13
+ export declare function JsonHighlight({ code }: {
14
+ code: string;
15
+ }): import("react").JSX.Element;
@@ -0,0 +1,38 @@
1
+ import { ReactNode } from 'react';
2
+ /** A single option in a segmented single-select. */
3
+ export type SegmentedOption<T extends string> = {
4
+ /** The value reported to `onChange` when this option is selected. */
5
+ value: T;
6
+ /** Visible label. */
7
+ label: ReactNode;
8
+ /** Optional leading icon (mark decorative icons `aria-hidden`). */
9
+ icon?: ReactNode;
10
+ disabled?: boolean;
11
+ };
12
+ /**
13
+ * Requires an accessible name for the `radiogroup`. When rendered inside a
14
+ * `DevPanelSection` the group is labelled by the section heading automatically,
15
+ * so a name is only required when used standalone.
16
+ */
17
+ type SegmentedAccessibleName = {
18
+ "aria-label"?: string;
19
+ "aria-labelledby"?: string;
20
+ };
21
+ export type SegmentedRadioGroupProps<T extends string> = {
22
+ /** The selected value (fully controlled). */
23
+ value: T;
24
+ /** Called with the newly selected value. */
25
+ onChange: (value: T) => void;
26
+ options: SegmentedOption<T>[];
27
+ /**
28
+ * `"pill"` (default) — options fill the beige track, selected flips to a white
29
+ * pill. `"chip"` — options hug their content and carry a small leading dot.
30
+ */
31
+ variant?: "pill" | "chip";
32
+ } & SegmentedAccessibleName;
33
+ /**
34
+ * An accessible single-select segmented control built on the roving-radiogroup
35
+ * pattern. Internal to `DevPanel`; Country / Variant / Step state compose it.
36
+ */
37
+ export declare function SegmentedRadioGroup<T extends string>({ value, onChange, options, variant, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, }: SegmentedRadioGroupProps<T>): import("react").JSX.Element;
38
+ export {};
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Writes text to the clipboard and tracks a short-lived `copied` flag so the
3
+ * caller can announce success (via a `role="status"` live region) and flip an
4
+ * icon. The flag auto-resets after ~2s; the pending timer is cleared on unmount.
5
+ */
6
+ export declare function useCopy(): {
7
+ copied: boolean;
8
+ copy: (text: string) => Promise<void>;
9
+ };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Translated accessible names and status words used across the `DevPanel`
3
+ * sub-components (copy buttons, the minimise control, and the per-step status
4
+ * announced to assistive tech). Every string is overridable per-instance via a
5
+ * matching prop, so consumers can localise or reword without forking.
6
+ */
7
+ export declare const useDevPanelLabels: () => Record<"step" | "copy" | "copied" | "copyJson" | "close" | "minimise" | "expand" | "statusCompleted" | "statusCurrent" | "statusUpcoming" | "needsAttention", string>;
@@ -0,0 +1,34 @@
1
+ import { KeyboardEvent, Ref } from 'react';
2
+ type RovingRadioItemProps = {
3
+ ref: Ref<HTMLElement>;
4
+ role: "radio";
5
+ "aria-checked": boolean;
6
+ "aria-disabled": true | undefined;
7
+ tabIndex: 0 | -1;
8
+ onClick: () => void;
9
+ onKeyDown: (event: KeyboardEvent<HTMLElement>) => void;
10
+ };
11
+ type UseRovingRadioOptions<T> = {
12
+ /** All selectable values, in DOM order. */
13
+ values: readonly T[];
14
+ /** The currently selected value (or `undefined` when nothing is selected). */
15
+ selected: T | undefined;
16
+ /** Called with the value to select on click / keyboard activation. */
17
+ onSelect: (value: T) => void;
18
+ /** Optional per-value disabled predicate; disabled items are skipped. */
19
+ isDisabled?: (value: T, index: number) => boolean;
20
+ };
21
+ /**
22
+ * Wires the WAI-ARIA radiogroup keyboard pattern for a set of custom option
23
+ * elements: a single roving `tabIndex`, arrow / Home / End navigation that moves
24
+ * focus *and* selection (activation follows focus), and Space / Enter to
25
+ * (re)select the focused item. Disabled items are skipped.
26
+ *
27
+ * The consuming component owns the markup and styling; it just spreads
28
+ * `getItemProps(index)` onto each option and renders the group with
29
+ * `role="radiogroup"`.
30
+ */
31
+ export declare function useRovingRadio<T>({ values, selected, onSelect, isDisabled, }: UseRovingRadioOptions<T>): {
32
+ getItemProps: (index: number) => RovingRadioItemProps;
33
+ };
34
+ export {};
@@ -0,0 +1,27 @@
1
+ import { AlertProps as MuiAlertProps, AlertColor } from '@mui/material';
2
+ export type AlertSize = "sm" | "lg";
3
+ export type AlertProps = Omit<MuiAlertProps, "severity"> & {
4
+ /** Semantic meaning — picks the icon and how screen readers announce it. */
5
+ severity?: AlertColor;
6
+ /** `"lg"` (default) or `"sm"` for tighter padding and smaller text. */
7
+ size?: AlertSize;
8
+ };
9
+ /**
10
+ * Alert wraps MUI's `Alert` with Lea Bank's status colours and border radius
11
+ * (applied via the theme). The ARIA `role` is derived from `severity`:
12
+ * `error` / `warning` announce assertively (`role="alert"`) while `info` /
13
+ * `success` announce politely (`role="status"`). Pass an explicit `role` to
14
+ * override.
15
+ *
16
+ * Status icons come from Lucide via `iconMapping` (`alertIcons` in this file).
17
+ * With `onClose`, the dismiss button's accessible name is translated — override
18
+ * it per-instance with MUI's `closeText`.
19
+ *
20
+ * ```tsx
21
+ * <Alert color="purple" size="sm">
22
+ * Lånet forutsetter at du løser skulder for totalt 80 000 kr.
23
+ * </Alert>
24
+ * ```
25
+ */
26
+ export declare function Alert({ color, severity, role, size, iconMapping, ...rest }: AlertProps): import("react").JSX.Element;
27
+ export { AlertTitle } from '@mui/material';
@@ -0,0 +1,22 @@
1
+ import { DialogProps as MuiDialogProps } from '@mui/material';
2
+ import { ReactNode } from 'react';
3
+ export type DialogProps = MuiDialogProps;
4
+ export declare function Dialog({ slots, slotProps, transitionDuration, ...rest }: DialogProps): import("react").JSX.Element;
5
+ type DialogCloseReason = "backdropClick" | "escapeKeyDown" | "closeButtonClick";
6
+ export type SimpleDialogProps = Omit<MuiDialogProps, "title" | "onClose"> & {
7
+ /** Heading, wired to the dialog via `aria-labelledby`. */
8
+ title: ReactNode;
9
+ /** Optional supporting text, wired via `aria-describedby` when present. */
10
+ description?: ReactNode;
11
+ /** Body content rendered below the title / description. */
12
+ children?: ReactNode;
13
+ /**
14
+ * Called when the user dismisses the dialog. `reason` is `"backdropClick"`,
15
+ * `"escapeKeyDown"`, or `"closeButtonClick"` (the header X).
16
+ */
17
+ onClose?: (event: object, reason: DialogCloseReason) => void;
18
+ /** Accessible name for the close button. Defaults to a translated "Close". */
19
+ closeLabel?: string;
20
+ };
21
+ export declare function SimpleDialog({ title, description, children, onClose, closeLabel, "aria-labelledby": ariaLabelledby, "aria-describedby": ariaDescribedby, ...rest }: SimpleDialogProps): import("react").JSX.Element;
22
+ export {};
@@ -0,0 +1,22 @@
1
+ import { DrawerProps as MuiDrawerProps } from '@mui/material';
2
+ import { ReactNode } from 'react';
3
+ export type DrawerProps = MuiDrawerProps;
4
+ export declare function Drawer({ transitionDuration, ...rest }: DrawerProps): import("react").JSX.Element;
5
+ type DrawerCloseReason = "backdropClick" | "escapeKeyDown" | "closeButtonClick";
6
+ export type SimpleDrawerProps = Omit<MuiDrawerProps, "title" | "onClose"> & {
7
+ /** Heading, wired to the drawer via `aria-labelledby`. */
8
+ title: ReactNode;
9
+ /** Optional supporting text, wired via `aria-describedby` when present. */
10
+ description?: ReactNode;
11
+ /** Body content rendered below the title / description. */
12
+ children?: ReactNode;
13
+ /**
14
+ * Called when the user dismisses the drawer. `reason` is `"backdropClick"`,
15
+ * `"escapeKeyDown"`, or `"closeButtonClick"` (the header X).
16
+ */
17
+ onClose?: (event: object, reason: DrawerCloseReason) => void;
18
+ /** Accessible name for the close button. Defaults to a translated "Close". */
19
+ closeLabel?: string;
20
+ };
21
+ export declare function SimpleDrawer({ title, description, children, onClose, closeLabel, slotProps, "aria-labelledby": ariaLabelledby, "aria-describedby": ariaDescribedby, ...rest }: SimpleDrawerProps): import("react").JSX.Element;
22
+ export {};
@@ -0,0 +1,3 @@
1
+ export * from './alert';
2
+ export * from './dialog';
3
+ export * from './drawer';
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Translated accessible name for the close (X) button shared by the feedback
3
+ * overlays (`SimpleDialog`, `SimpleDrawer`). Consumers can override per-instance
4
+ * via a `closeLabel` prop.
5
+ */
6
+ export declare const useCloseLabel: () => Record<"close", string>;
@@ -0,0 +1,71 @@
1
+ import { AutocompleteProps as MuiAutocompleteProps } from '@mui/material';
2
+ import { ReactNode } from 'react';
3
+ import { SelectOption } from './select';
4
+ type AutocompleteOption = SelectOption | string;
5
+ /** MUI props we forward untouched (free-solo so both modes type-check). */
6
+ type ForwardedMuiProps = Omit<MuiAutocompleteProps<AutocompleteOption, false, false, true>, "ref" | "renderInput" | "renderValue" | "options" | "value" | "defaultValue" | "onChange" | "onInputChange" | "inputValue" | "freeSolo" | "multiple" | "getOptionLabel" | "getOptionDisabled" | "isOptionEqualToValue" | "filterOptions">;
7
+ type AutocompleteBaseProps = ForwardedMuiProps & {
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
+ /** Searchable options. Ignored in `email` mode, where suggestions are derived from the input. */
13
+ options?: SelectOption[];
14
+ /** Puts the control in an error state. */
15
+ error?: boolean;
16
+ /** Marks the control as required. */
17
+ required?: boolean;
18
+ /** Placeholder shown in the text input. */
19
+ placeholder?: string;
20
+ };
21
+ type AutocompleteSingleProps = {
22
+ /** Enable selecting multiple values. Omit (or `false`) for single-select. */
23
+ multiple?: false;
24
+ /** Selected value (controlled). */
25
+ value?: string;
26
+ /** Initial value (uncontrolled). */
27
+ defaultValue?: string;
28
+ /** Called with the next string value. */
29
+ onChange?: (value: string) => void;
30
+ /**
31
+ * Email mode: lets the user type freely and, once they type `@`, suggests
32
+ * completions from common providers (gmail, outlook, …).
33
+ */
34
+ email?: boolean;
35
+ /** Domains offered in `email` mode. @default COMMON_EMAIL_DOMAINS */
36
+ domains?: readonly string[];
37
+ /** Maximum number of email suggestions to show. @default 6 */
38
+ maxSuggestions?: number;
39
+ };
40
+ type AutocompleteMultipleProps = {
41
+ /** Enable selecting multiple values, rendered as removable chips. */
42
+ multiple: true;
43
+ /** Currently selected values (controlled). */
44
+ value?: string[];
45
+ /** Initially selected values (uncontrolled). */
46
+ defaultValue?: string[];
47
+ /** Called with the next array of selected values. */
48
+ onChange?: (value: string[]) => void;
49
+ /** Minimum number of values that must stay selected. @default 1 */
50
+ min?: number;
51
+ /** Maximum number of values that can be selected. Unlimited when omitted. */
52
+ max?: number;
53
+ };
54
+ export type AutocompleteProps = AutocompleteBaseProps & (AutocompleteSingleProps | AutocompleteMultipleProps);
55
+ /**
56
+ * Searchable select built on MUI's `Autocomplete`.
57
+ *
58
+ * Works two ways:
59
+ * - **Standalone (all-in-one):** pass `label` / `helperText` and `options` and
60
+ * it renders its own `FormControl`, label and helper text, generating and
61
+ * wiring all ids for you.
62
+ * - **Composed:** drop it inside a `FormControl` next to `InputLabel` /
63
+ * `FormHelperText` and it picks up the shared ids from context.
64
+ *
65
+ * Pass `multiple` to select several values at once, shown as removable chips and
66
+ * bounded by `min` (default 1) and `max`. Pass `email` (single mode only) to
67
+ * turn it into an email field that suggests common domains once the user types
68
+ * `@` — the same autocomplete behaviour, driven by free text.
69
+ */
70
+ export declare const Autocomplete: import('react').ForwardRefExoticComponent<AutocompleteProps & import('react').RefAttributes<HTMLDivElement>>;
71
+ export {};
@@ -0,0 +1,12 @@
1
+ import { CheckboxProps as MuiCheckboxProps } from '@mui/material';
2
+ export type CheckboxProps = Omit<MuiCheckboxProps, "color" | "size">;
3
+ /**
4
+ * Checkbox built on MUI's `Checkbox`, styled by the global theme
5
+ * (`checkbox.theme.tsx`). Kept composite — pair it with `FormControlLabel` for a
6
+ * label instead of forwarding label / typography props:
7
+ *
8
+ * ```tsx
9
+ * <FormControlLabel control={<Checkbox />} label="Label" />
10
+ * ```
11
+ */
12
+ export declare const Checkbox: import('react').ForwardRefExoticComponent<Omit<CheckboxProps, "ref"> & import('react').RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,12 @@
1
+ import { PickersCalendarHeaderProps } from '@mui/x-date-pickers/PickersCalendarHeader';
2
+ import { CalendarHeaderLabels } from './use-calendar-header-labels';
3
+ /**
4
+ * Replaces MUI's default calendar header for the day picker with the Lea Bank
5
+ * layout: a previous / next month chevron on each side and a centered, clickable
6
+ * month-year label (with a caret) that switches to the year view. The chevrons
7
+ * are muted at the `minDate` / `maxDate` bounds. Month navigation is only shown
8
+ * while the day grid is visible; in the year view only the label remains.
9
+ */
10
+ export declare function CalendarHeader({ currentMonth, onMonthChange, onViewChange, view, minDate, maxDate, disabled, labels, }: PickersCalendarHeaderProps & {
11
+ labels?: CalendarHeaderLabels;
12
+ }): import("react").JSX.Element;
@@ -0,0 +1,99 @@
1
+ import { DatePickerProps as MuiDatePickerProps } from '@mui/x-date-pickers/DatePicker';
2
+ import { Locale } from 'date-fns';
3
+ import { ReactNode } from 'react';
4
+ import { MonthYearOrder } from './view-toggle';
5
+ import { ViewToggleLabels } from './use-view-toggle-labels';
6
+ import { CalendarHeaderLabels } from './use-calendar-header-labels';
7
+ export { type ViewToggleLabels, type CalendarHeaderLabels };
8
+ export type DatePickerProps = MuiDatePickerProps & {
9
+ /** Helper / error text shown below the control and linked via `aria-describedby`. */
10
+ helperText?: ReactNode;
11
+ /** Puts the control in an error state and styles the helper text accordingly. */
12
+ error?: boolean;
13
+ /** Marks the control as required. */
14
+ required?: boolean;
15
+ /**
16
+ * `date-fns` locale used by the internal `LocalizationProvider`. Defaults to
17
+ * the `LeaProvider` language (`no`->`nb`, `se`->`sv`, `fi`->`fi`, `es`->`es`);
18
+ * set this to override.
19
+ */
20
+ adapterLocale?: Locale;
21
+ /** Small uppercase context label shown above the drawer title on mobile. */
22
+ eyebrow?: ReactNode;
23
+ /** Drawer heading on mobile. Defaults from `views` ("Velg dato" or "Velg måned og år"). */
24
+ title?: ReactNode;
25
+ /** Order of month and year in the month/year picker. Default: "month-year" */
26
+ monthYearOrder?: MonthYearOrder;
27
+ /**
28
+ * Override the month/year toggle's translated labels (`month`, `year`,
29
+ * `selectView`) per-instance. Only used by the month/year picker
30
+ * (`views={["year", "month"]}`).
31
+ */
32
+ viewToggleLabels?: ViewToggleLabels;
33
+ /**
34
+ * Override the day calendar header's translated labels (`previousMonth`,
35
+ * `nextMonth`, `switchToYearView`, `switchToDayView`) per-instance. Only
36
+ * used by the day picker (default `views`).
37
+ */
38
+ calendarHeaderLabels?: CalendarHeaderLabels;
39
+ };
40
+ /**
41
+ * DatePicker built on MUI's responsive `DatePicker` (`@mui/x-date-pickers`),
42
+ * styled to the Lea Bank design.
43
+ *
44
+ * Two calendar designs, chosen by `views`:
45
+ * - **Day picker** (default): MUI's `DateCalendar` day grid with a centered Lea
46
+ * Bank header (prev/next month chevrons either side of a clickable month-year
47
+ * label that switches to the year list) and lowercase Monday-first weekdays.
48
+ * - **Month/year picker** (`views={["year", "month"]}`): a Måned / År segmented
49
+ * toggle above the month / year grids. Control the order via `monthYearOrder`:
50
+ * "month-year" (default) or "year-month" (for Sweden and other locales).
51
+ * Opens on the first view and drills through to the second.
52
+ *
53
+ * - **Desktop:** a compact popover ("dropdown").
54
+ * - **Mobile:** a bottom `Drawer` with an `eyebrow` + `title` header. The switch
55
+ * happens at `theme.breakpoints.up("sm")` by default; override with
56
+ * `desktopModeMediaQuery`.
57
+ *
58
+ * Selecting a value commits immediately (`closeOnSelect`) in both modes.
59
+ * Configure which views are shown via `views` (e.g. `views={["year", "month"]}`).
60
+ * The trigger is the picker's accessible field,
61
+ * themed to match the library's other inputs (see `date-picker.theme.ts`), and a
62
+ * `LocalizationProvider` + `AdapterDateFns` are bundled in (locale follows the
63
+ * `LeaProvider` language, defaulting to Norwegian `nb`; set `adapterLocale` to
64
+ * override). MUI X's own texts (the open-picker button, month navigation,
65
+ * action bar) come from its bundled locale pack for that language — override
66
+ * them per-instance with `localeText`.
67
+ */
68
+ export declare const DatePicker: import('react').ForwardRefExoticComponent<MuiDatePickerProps & {
69
+ /** Helper / error text shown below the control and linked via `aria-describedby`. */
70
+ helperText?: ReactNode;
71
+ /** Puts the control in an error state and styles the helper text accordingly. */
72
+ error?: boolean;
73
+ /** Marks the control as required. */
74
+ required?: boolean;
75
+ /**
76
+ * `date-fns` locale used by the internal `LocalizationProvider`. Defaults to
77
+ * the `LeaProvider` language (`no`->`nb`, `se`->`sv`, `fi`->`fi`, `es`->`es`);
78
+ * set this to override.
79
+ */
80
+ adapterLocale?: Locale;
81
+ /** Small uppercase context label shown above the drawer title on mobile. */
82
+ eyebrow?: ReactNode;
83
+ /** Drawer heading on mobile. Defaults from `views` ("Velg dato" or "Velg måned og år"). */
84
+ title?: ReactNode;
85
+ /** Order of month and year in the month/year picker. Default: "month-year" */
86
+ monthYearOrder?: MonthYearOrder;
87
+ /**
88
+ * Override the month/year toggle's translated labels (`month`, `year`,
89
+ * `selectView`) per-instance. Only used by the month/year picker
90
+ * (`views={["year", "month"]}`).
91
+ */
92
+ viewToggleLabels?: ViewToggleLabels;
93
+ /**
94
+ * Override the day calendar header's translated labels (`previousMonth`,
95
+ * `nextMonth`, `switchToYearView`, `switchToDayView`) per-instance. Only
96
+ * used by the day picker (default `views`).
97
+ */
98
+ calendarHeaderLabels?: CalendarHeaderLabels;
99
+ } & import('react').RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,17 @@
1
+ import { ReactNode } from 'react';
2
+ export type DrawerToolbarProps = {
3
+ /** Small uppercase context label shown above the title. */
4
+ eyebrow?: ReactNode;
5
+ /** Drawer heading. */
6
+ title?: ReactNode;
7
+ /** id set on the title so the drawer dialog can reference it via `aria-labelledby`. */
8
+ titleId?: string;
9
+ /** Set by MUI's layout; when true the toolbar must not render. */
10
+ hidden?: boolean;
11
+ };
12
+ /**
13
+ * Replaces the default `DatePickerToolbar`. Renders the Lea Bank drawer header:
14
+ * an optional purple uppercase eyebrow and a large title. Both are supplied by
15
+ * `DatePicker` through `slotProps.toolbar`.
16
+ */
17
+ export declare function DrawerToolbar({ eyebrow, title, titleId, hidden }: DrawerToolbarProps): import("react").JSX.Element | null;
@@ -0,0 +1 @@
1
+ export * from './datepicker';
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Translated labels for `CalendarHeader`: the prev/next month button names and
3
+ * the month-year label's "switch to year/day view" suffix. Consumers can
4
+ * override any of these per-instance via `DatePicker`'s `calendarHeaderLabels`
5
+ * prop.
6
+ */
7
+ export declare const useCalendarHeaderLabels: () => Record<"previousMonth" | "nextMonth" | "switchToYearView" | "switchToDayView", string>;
8
+ export type CalendarHeaderLabels = Partial<ReturnType<typeof useCalendarHeaderLabels>>;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Translated default titles for `DatePicker`'s mobile drawer header, used when
3
+ * the `title` prop is omitted.
4
+ */
5
+ export declare const useDatePickerTitleLabels: () => Record<"selectDate" | "selectMonthYear", string>;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Translated labels for `ViewToggle`: the month/year segment labels and the
3
+ * `role="group"` accessible name. Consumers can override any of these
4
+ * per-instance via `DatePicker`'s `viewToggleLabels` prop.
5
+ */
6
+ export declare const useViewToggleLabels: () => Record<"month" | "year" | "selectView", string>;
7
+ export type ViewToggleLabels = Partial<ReturnType<typeof useViewToggleLabels>>;
@@ -0,0 +1,10 @@
1
+ import { DatePickerProps } from '@mui/x-date-pickers/DatePicker';
2
+ import { MonthYearOrder } from './view-toggle';
3
+ import { ViewToggleLabels } from './use-view-toggle-labels';
4
+ /**
5
+ * Factory function that creates `viewRenderers` for the month/year-only picker.
6
+ * The day view is intentionally absent (that mode uses MUI's standard `DateCalendar`);
7
+ * these only drive the `views={["year", "month"]}` configuration with the Måned / År toggle
8
+ * and a month to year drill. Supports configurable order via `monthYearOrder`.
9
+ */
10
+ export declare const createDateViewRenderers: (order?: MonthYearOrder, labels?: ViewToggleLabels) => DatePickerProps["viewRenderers"];
@@ -0,0 +1,21 @@
1
+ import { ViewToggleLabels } from './use-view-toggle-labels';
2
+ export type ToggleView = "month" | "year";
3
+ export type MonthYearOrder = "month-year" | "year-month";
4
+ export type ViewToggleProps = {
5
+ /** The currently active view. */
6
+ currentView: ToggleView;
7
+ /** Called with the view the user switched to. */
8
+ onViewChange: (view: ToggleView) => void;
9
+ /** Order of month and year segments. Default: "month-year" */
10
+ order?: MonthYearOrder;
11
+ /** Override the built-in translated labels per-instance. */
12
+ labels?: ViewToggleLabels;
13
+ };
14
+ /**
15
+ * Segmented control for the month/year-only picker. Shows two pill segments,
16
+ * month first then year, with the active segment raised on a white pill. Used as
17
+ * the header of the month/year `viewRenderers`; switching segments changes the
18
+ * picker view. Each segment is a toggle button exposing `aria-pressed`, grouped
19
+ * under a labelled `role="group"`.
20
+ */
21
+ export declare function ViewToggle({ currentView, onViewChange, order, labels, }: ViewToggleProps): import("react").JSX.Element;
@@ -0,0 +1,35 @@
1
+ import { FocusEventHandler, ReactNode } from 'react';
2
+ export type EmailInputProps = {
3
+ /** Current value (controlled). */
4
+ value?: string;
5
+ /** Initial value (uncontrolled). */
6
+ defaultValue?: string;
7
+ /** Called with the next string value. */
8
+ onChange?: (value: string) => void;
9
+ /** Domains offered once the user types `@`. Defaults to common providers. */
10
+ domains?: readonly string[];
11
+ /** Maximum number of suggestions to show. @default 6 */
12
+ maxSuggestions?: number;
13
+ /** Floating label. Rendered as an `InputLabel` and linked automatically. */
14
+ label?: ReactNode;
15
+ /** Helper / error text shown below the control and linked via `aria-describedby`. */
16
+ helperText?: ReactNode;
17
+ /** Placeholder shown in the text input. */
18
+ placeholder?: string;
19
+ /** Puts the control in an error state. */
20
+ error?: boolean;
21
+ /** Marks the control as required. */
22
+ required?: boolean;
23
+ /** Disables the control. */
24
+ disabled?: boolean;
25
+ /** Blur handler (e.g. for react-hook-form touched state). */
26
+ onBlur?: FocusEventHandler<HTMLDivElement>;
27
+ };
28
+ /**
29
+ * Email text field that suggests common domains in a dropdown once the user
30
+ * types `@`. Works controlled (`value` + `onChange`) or uncontrolled
31
+ * (`defaultValue`), standalone (`label` / `helperText`) or inside a
32
+ * `FormControl`.
33
+ *
34
+ */
35
+ export declare const EmailInput: import('react').ForwardRefExoticComponent<EmailInputProps & import('react').RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,17 @@
1
+ import { FieldValues } from 'react-hook-form';
2
+ import { AutocompleteProps } from '../autocomplete';
3
+ import { BaseFieldProps } from './field-types';
4
+ /**
5
+ * Distributes `Omit` across the `AutocompleteProps` union so the single- and
6
+ * multiple-select props (e.g. `email`, `min`, `max`) survive rather than
7
+ * collapsing to the keys common to both branches.
8
+ */
9
+ type DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never;
10
+ export type AutocompleteFieldProps<T extends FieldValues> = BaseFieldProps<T> & DistributiveOmit<AutocompleteProps, "name" | "value" | "defaultValue" | "onChange" | "error">;
11
+ /**
12
+ * `Autocomplete` connected to react-hook-form via `Controller`. Reads `control`
13
+ * from the nearest `FormProvider` when the prop is omitted. Supports both
14
+ * single (`string`) and `multiple` (`string[]`) selection.
15
+ */
16
+ export declare const AutocompleteField: <T extends FieldValues>({ name, control, rules, disabled, label, helperText, ...rest }: AutocompleteFieldProps<T>) => import("react").JSX.Element;
17
+ export {};
@@ -0,0 +1,3 @@
1
+ import { FieldValues } from 'react-hook-form';
2
+ import { RadioCardFieldProps } from './radio-card-field';
3
+ export declare const BooleanRadioCardField: <T extends FieldValues>(props: Omit<RadioCardFieldProps<T>, "format" | "parse">) => import("react").JSX.Element;
@@ -0,0 +1,12 @@
1
+ import { ReactNode } from 'react';
2
+ import { FieldValues } from 'react-hook-form';
3
+ import { BaseFieldProps } from './field-types';
4
+ export type CheckboxFieldProps<T extends FieldValues> = BaseFieldProps<T> & {
5
+ label: ReactNode;
6
+ };
7
+ /**
8
+ * `Checkbox` connected to react-hook-form via `Controller`, composed with
9
+ * `FormControlLabel`. Reads `control` from the nearest `FormProvider` when the
10
+ * prop is omitted.
11
+ */
12
+ export declare const CheckboxField: <T extends FieldValues>({ name, control, rules, disabled, label, }: CheckboxFieldProps<T>) => import("react").JSX.Element;
@@ -0,0 +1,9 @@
1
+ import { FieldValues } from 'react-hook-form';
2
+ import { DatePickerProps } from '../datepicker';
3
+ import { BaseFieldProps } from './field-types';
4
+ export type DatePickerFieldProps<T extends FieldValues> = BaseFieldProps<T> & Omit<DatePickerProps, "name" | "value" | "defaultValue" | "error" | "onChange">;
5
+ /**
6
+ * `DatePicker` connected to react-hook-form via `Controller`. Reads `control`
7
+ * from the nearest `FormProvider` when the prop is omitted.
8
+ */
9
+ export declare const DatePickerField: <T extends FieldValues>({ name, control, rules, disabled, helperText, ...rest }: DatePickerFieldProps<T>) => import("react").JSX.Element;