@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,46 @@
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[];
14
+ };
15
+ /**
16
+ * Select built on MUI's `Select`.
17
+ *
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.
24
+ */
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>>;
@@ -0,0 +1,23 @@
1
+ import { SliderProps as MuiSliderProps } from '@mui/material';
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`. */
7
+ helperText?: ReactNode;
8
+ /** Puts wrapper FormControl and helper text into error state. */
9
+ error?: boolean;
10
+ /** Marks wrapper FormControl as required. */
11
+ required?: boolean;
12
+ };
13
+ /**
14
+ * Slider built on MUI's `Slider`.
15
+ *
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.
22
+ */
23
+ export declare const Slider: import('react').ForwardRefExoticComponent<Omit<SliderProps, "ref"> & import('react').RefAttributes<HTMLSpanElement>>;
@@ -0,0 +1,19 @@
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`.
7
+ */
8
+ export declare const useAutocompleteLabels: () => Record<"clear" | "loading" | "open" | "close" | "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,11 @@
1
+ export * from './animations';
2
+ export * from './buttons';
3
+ export * from './data-display';
4
+ export * from './dev-panel';
5
+ export * from './feedback';
6
+ export * from './form';
7
+ export * from './navigation';
8
+ export * from './surfaces';
9
+ export * from './typography';
10
+ export * from './typography/text';
11
+ export * from './ui';
@@ -0,0 +1,63 @@
1
+ import { ReactNode } from 'react';
2
+ import { ProgressCircleColor } from './progress-circle';
3
+ import { StepperLabels } from './use-stepper-labels';
4
+ export type FormStepperProps = {
5
+ /** Active step (1-based). */
6
+ currentStep: number;
7
+ /** Total number of steps. */
8
+ totalSteps: number;
9
+ /** Title of the current step. Rendered as a heading by default (see `titleAs`). */
10
+ title: ReactNode;
11
+ /**
12
+ * Name of the next step. When set, a translated `"{Next}: {nextStep}"`
13
+ * subtitle is shown. Omit it on the last step.
14
+ */
15
+ nextStep?: ReactNode;
16
+ /**
17
+ * Called when the back button is pressed. The back button only renders when
18
+ * this is provided, so omit it on the first step or in forms without a back
19
+ * flow.
20
+ */
21
+ onBack?: () => void;
22
+ /** Progress circle colour. Defaults to `purple`. */
23
+ color?: ProgressCircleColor;
24
+ /**
25
+ * Render the title as a `heading` (default) or plain `text`. Prefer `heading`
26
+ * so screen-reader users can navigate to it; only use `text` when another
27
+ * heading already labels the view.
28
+ */
29
+ titleAs?: "heading" | "text";
30
+ /** Heading level when `titleAs="heading"`. Defaults to `h1`. */
31
+ headingLevel?: "h1" | "h2" | "h3";
32
+ /**
33
+ * Id applied to the title. Defaults to a generated id. Use it to move focus to
34
+ * the title when the step changes so the new step is announced.
35
+ */
36
+ titleId?: string;
37
+ /** Override the built-in translated labels per-instance. */
38
+ labels?: StepperLabels;
39
+ /** Show the divider below the header. Defaults to `true`. */
40
+ showDivider?: boolean;
41
+ };
42
+ /**
43
+ * Header for a multi-step form. Shows the current step title (as a heading by
44
+ * default), an optional `"Next: ..."` subtitle, an optional back button, and an
45
+ * animated `ProgressCircle`.
46
+ *
47
+ * Accessibility is wired internally: the step count (`"step X of Y"`) is added
48
+ * to the title as visually-hidden text and the circle is decorative, so the
49
+ * count is announced once. The title carries `tabIndex={-1}`; move focus to it
50
+ * (via `titleId`) whenever the step changes so screen-reader users hear the new
51
+ * step.
52
+ *
53
+ * ```tsx
54
+ * <FormStepper
55
+ * currentStep={2}
56
+ * totalSteps={5}
57
+ * title="Civil status"
58
+ * nextStep="Employment"
59
+ * onBack={() => history.back()}
60
+ * />
61
+ * ```
62
+ */
63
+ export declare const FormStepper: ({ currentStep, totalSteps, title, nextStep, onBack, color, titleAs, headingLevel, titleId, labels, showDivider, }: FormStepperProps) => import("react").JSX.Element;
@@ -0,0 +1,4 @@
1
+ export * from './form-stepper';
2
+ export * from './progress-circle';
3
+ export * from './tabs';
4
+ export * from './use-stepper-labels';
@@ -0,0 +1,34 @@
1
+ export type ProgressCircleColor = "purple" | "teal";
2
+ export type ProgressCircleProps = {
3
+ /** Current value, e.g. the active step (1-based). Clamped to `0..max`. */
4
+ value: number;
5
+ /** Maximum value, e.g. the total number of steps. */
6
+ max: number;
7
+ /** Ring colour. Defaults to `purple`. */
8
+ color?: ProgressCircleColor;
9
+ /** Rendered diameter in px. Defaults to `48`. */
10
+ size?: number;
11
+ /** Ring thickness in px. Defaults to `4`. */
12
+ strokeWidth?: number;
13
+ /** Show the `value/max` label in the centre. Defaults to `true`. */
14
+ showValue?: boolean;
15
+ /**
16
+ * Accessible name. When provided, the circle is exposed as a
17
+ * `role="progressbar"` (with `aria-valuetext={label}`) so it announces on its
18
+ * own. When omitted, the circle is decorative (`aria-hidden`) — use this when
19
+ * the surrounding component already conveys progress in text (as `FormStepper`
20
+ * does).
21
+ */
22
+ label?: string;
23
+ };
24
+ /**
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.
29
+ *
30
+ * ```tsx
31
+ * <ProgressCircle value={2} max={5} color="teal" label="Step 2 of 5" />
32
+ * ```
33
+ */
34
+ export declare const ProgressCircle: ({ value, max, color, size, strokeWidth, showValue, label, }: ProgressCircleProps) => import("react").JSX.Element;
@@ -0,0 +1,79 @@
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 & {
5
+ /**
6
+ * 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"
10
+ */
11
+ variant?: TabsVariant;
12
+ };
13
+ /**
14
+ * A segmented, pill-style tabs control built on Base UI's accessible `Tabs`
15
+ * primitive. Renders a beige track with a sliding pill behind the active tab.
16
+ *
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.
21
+ *
22
+ * The list scrolls horizontally when the tabs overflow (e.g. on mobile) and the
23
+ * pill slide respects `prefers-reduced-motion`.
24
+ *
25
+ * ```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>
34
+ * ```
35
+ */
36
+ export declare function Tabs({ variant, ...rest }: TabsProps): import("react").JSX.Element;
37
+ /**
38
+ * Requires an accessible name so the underlying `tablist` is never nameless.
39
+ * Provide exactly one of `aria-label` or `aria-labelledby`.
40
+ */
41
+ type TabsListAccessibleName = {
42
+ "aria-label": string;
43
+ "aria-labelledby"?: never;
44
+ } | {
45
+ "aria-labelledby": string;
46
+ "aria-label"?: never;
47
+ };
48
+ export type TabsListProps = Omit<BaseTabs.List.Props, "render" | "aria-label" | "aria-labelledby"> & TabsListAccessibleName;
49
+ /**
50
+ * Groups the `Tab` buttons into the pill track. The sliding indicator is
51
+ * rendered internally so it can never go missing.
52
+ */
53
+ export declare function TabsList({ children, ...rest }: TabsListProps): import("react").JSX.Element;
54
+ export type TabProps = Omit<BaseTabs.Tab.Props, "render">;
55
+ /**
56
+ * An individual tab. Pass an icon and label as children; mark decorative icons
57
+ * with `aria-hidden` so they aren't announced.
58
+ *
59
+ * ```tsx
60
+ * <Tab value="transactions">
61
+ * <Receipt size={18} aria-hidden />
62
+ * Transaksjoner
63
+ * </Tab>
64
+ * ```
65
+ */
66
+ export declare function Tab(props: TabProps): import("react").JSX.Element;
67
+ export type TabsIndicatorProps = Omit<BaseTabs.Indicator.Props, "render">;
68
+ /**
69
+ * The sliding pill behind the active tab. `TabsList` already renders one, so
70
+ * you only need this when composing a custom list.
71
+ */
72
+ export declare function TabsIndicator(props: TabsIndicatorProps): import("react").JSX.Element;
73
+ export type TabPanelProps = Omit<BaseTabs.Panel.Props, "render">;
74
+ /**
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`).
78
+ */
79
+ export declare function TabPanel(props: TabPanelProps): import("react").JSX.Element;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Translated labels for `FormStepper`: the back button's accessible name, the
3
+ * "Next" subtitle prefix, and the visually-hidden "step X of Y" context.
4
+ * Consumers can override any of these per-instance via the `labels` prop.
5
+ */
6
+ export declare const useStepperLabels: () => Record<"next" | "step" | "back" | "of", string>;
7
+ export type StepperLabels = Partial<ReturnType<typeof useStepperLabels>>;
@@ -0,0 +1,15 @@
1
+ import { AccordionProps as MuiAccordionProps } from '@mui/material/Accordion';
2
+ export type AccordionProps = Omit<MuiAccordionProps, "variant"> & {
3
+ /** `"outlined"` (default) keeps the border; `"filled"` removes it and fills white. */
4
+ variant?: "outlined" | "filled";
5
+ };
6
+ /**
7
+ * A surface that groups content behind an expandable summary. Wraps MUI
8
+ * `Accordion` with Lea's design tokens (radius, borders, typography, focus).
9
+ * Use `variant="filled"` for a borderless, white-filled panel.
10
+ */
11
+ export declare const Accordion: ({ variant, ...rest }: AccordionProps) => import("react").JSX.Element;
12
+ export { default as AccordionDetails } from '@mui/material/AccordionDetails';
13
+ export { default as AccordionSummary } from '@mui/material/AccordionSummary';
14
+ export type { AccordionDetailsProps } from '@mui/material/AccordionDetails';
15
+ export type { AccordionSummaryProps } from '@mui/material/AccordionSummary';
@@ -0,0 +1 @@
1
+ export * from './accordion';
@@ -0,0 +1,3 @@
1
+ export * from './link';
2
+ export * as List from './lists';
3
+ export * from './text';
@@ -0,0 +1,23 @@
1
+ import { LinkProps as MuiLinkProps } from '@mui/material';
2
+ import { ElementType } from 'react';
3
+ type LinkColor = "black" | "purple" | "teal" | "white";
4
+ type LinkProps<C extends ElementType = "a"> = Omit<MuiLinkProps<C>, "color"> & {
5
+ /** The component to render the link as. */
6
+ component?: C;
7
+ /** The colour of the link. */
8
+ color?: LinkColor;
9
+ };
10
+ /**
11
+ * A link component — link-only in styling and behaviour.
12
+ *
13
+ * Supports polymorphic rendering via the `component` prop, which enables
14
+ * type-safe usage with any router link component:
15
+ *
16
+ * ```tsx
17
+ * <Link href="/about">About</Link> // Plain anchor
18
+ * <Link component={RouterLink} to="/about">About</Link> // React Router
19
+ * <Link component={NextLink} href="/about">About</Link> // Next.js
20
+ * ```
21
+ */
22
+ export declare const Link: <C extends ElementType = "a">({ color, children, sx, ...rest }: LinkProps<C>) => import("react").JSX.Element;
23
+ export {};
@@ -0,0 +1,54 @@
1
+ import { SxProps, Theme } from '@mui/material';
2
+ import { ReactNode } from 'react';
3
+ /**
4
+ * List is a composition component for rendering ordered or unordered lists.
5
+ *
6
+ * `List.Root` renders the wrapping `<ul>` (default) or `<ol>` element via the
7
+ * `variant` prop. Each `List.Item` shows a marker: a dot for `ul`, an
8
+ * auto-incrementing number for `ol`, or a custom icon when one is passed.
9
+ *
10
+ * @example Unordered list with default dots
11
+ * <List.Root>
12
+ * <List.Item>Fast response</List.Item>
13
+ * <List.Item>Account data report</List.Item>
14
+ * </List.Root>
15
+ *
16
+ * @example Ordered list with auto-numbering
17
+ * <List.Root variant="ol">
18
+ * <List.Item>First step</List.Item>
19
+ * <List.Item>Second step</List.Item>
20
+ * </List.Root>
21
+ *
22
+ * @example Per-item icon marker
23
+ * <List.Root>
24
+ * <List.Item icon={<CircleCheck size={20} />}>Verified</List.Item>
25
+ * </List.Root>
26
+ */
27
+ type ListVariant = "ul" | "ol";
28
+ interface RootProps {
29
+ /** The type of list to render. */
30
+ variant?: ListVariant;
31
+ /** The content of the list. */
32
+ children: ReactNode;
33
+ /** The style of the list. */
34
+ sx?: SxProps<Theme>;
35
+ /** The class name of the list. */
36
+ className?: string;
37
+ /** The gap between the list items. */
38
+ gap?: number;
39
+ }
40
+ export declare const Root: ({ variant, children, sx, gap, ...rest }: RootProps) => import("react").JSX.Element;
41
+ interface ItemProps {
42
+ /** Custom marker rendered in place of the default dot/number. */
43
+ icon?: ReactNode;
44
+ /** The content of the list item. */
45
+ children: ReactNode;
46
+ /** The style of the list item. */
47
+ sx?: SxProps<Theme>;
48
+ /** The class name of the list item. */
49
+ className?: string;
50
+ /** The gap between the list items. */
51
+ gap?: number;
52
+ }
53
+ export declare const Item: ({ icon, children, sx, gap, ...rest }: ItemProps) => import("react").JSX.Element;
54
+ export {};
@@ -0,0 +1,18 @@
1
+ import { fontSizes, fontWeights } from '../../theme/tokens';
2
+ import { TypographyProps } from '@mui/material';
3
+ type FontSizeToken = keyof typeof fontSizes;
4
+ type FontWeightToken = keyof typeof fontWeights;
5
+ type TextProps = TypographyProps & {
6
+ fontWeight?: FontWeightToken;
7
+ component?: string;
8
+ fontSize?: FontSizeToken;
9
+ };
10
+ /**
11
+ * A token-aware wrapper around MUI `Typography`. The `fontSize` and
12
+ * `fontWeight` props accept Lea design tokens (resolved to their underlying
13
+ * values). `color` is applied through `sx`, so design-token palette paths
14
+ * (`text.base`, `purple.subtle`, …) and raw CSS colours work, and the MUI
15
+ * shorthands (`primary`, `error`, …) still map to their `.main` shade.
16
+ */
17
+ export declare const Text: ({ children, fontSize, fontWeight, component, color, sx, ...props }: TextProps) => import("react").JSX.Element;
18
+ export {};
@@ -0,0 +1,6 @@
1
+ /**
2
+ *
3
+ * Brand Divider in Lea colors
4
+ *
5
+ */
6
+ export declare const BrandDivider: () => import("react").JSX.Element;
@@ -0,0 +1 @@
1
+ export * from './brand-divider';
Binary file
Binary file
@@ -0,0 +1,8 @@
1
+ export type Country = "NO" | "SE" | "FI" | "ES";
2
+ export type Currency = "NOK" | "SEK" | "EUR";
3
+ export interface CountryConfig {
4
+ country: Country;
5
+ locale: string;
6
+ currency: Currency;
7
+ }
8
+ export declare const COUNTRIES: Record<Country, CountryConfig>;
@@ -0,0 +1,20 @@
1
+ import { ReactNode } from 'react';
2
+ import { Country, Currency } from './countries';
3
+ export interface CountryContextValue {
4
+ country: Country;
5
+ locale: string;
6
+ currency: Currency;
7
+ }
8
+ export interface CountryProviderProps {
9
+ country: Country;
10
+ children: ReactNode;
11
+ }
12
+ /**
13
+ * Supplies the active Lea Bank country to locale-aware formatting hooks.
14
+ */
15
+ export declare function CountryProvider({ country, children }: CountryProviderProps): import("react").JSX.Element;
16
+ /**
17
+ * Reads the active country, locale, and default currency from the nearest
18
+ * `CountryProvider`.
19
+ */
20
+ export declare function useCountry(): CountryContextValue;
@@ -0,0 +1,6 @@
1
+ export * from './country/countries';
2
+ export * from './country/country-context';
3
+ export * from './use-format-currency';
4
+ export * from './use-format-date';
5
+ export * from './use-format-number';
6
+ export * from './validation';
@@ -0,0 +1,9 @@
1
+ import { Currency } from './country/countries';
2
+ export type FormatCurrencyOptions = Omit<Intl.NumberFormatOptions, "style" | "currency"> & {
3
+ currency?: Currency;
4
+ };
5
+ /**
6
+ * Returns a locale-aware currency formatter using the active country's locale
7
+ * and default currency. Pass `currency` in options to override per call.
8
+ */
9
+ export declare function useFormatCurrency(): (value: number, options?: FormatCurrencyOptions) => string;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Returns a locale-aware date formatter using the active country's locale.
3
+ */
4
+ export declare function useFormatDate(): (value: Date | number | string, options?: Intl.DateTimeFormatOptions) => string;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Returns a locale-aware plain-number formatter using the active country's
3
+ * locale.
4
+ */
5
+ export declare function useFormatNumber(): (value: number, options?: Intl.NumberFormatOptions) => string;
6
+ /**
7
+ * Returns a locale-aware percentage formatter using the active country's
8
+ * locale.
9
+ */
10
+ export declare function useFormatPercentage(): (value: number, options?: Intl.NumberFormatOptions) => string;
@@ -0,0 +1 @@
1
+ export * from './use-validation';
@@ -0,0 +1,21 @@
1
+ import { ValidationResult } from '../../validation';
2
+ /**
3
+ * Returns a national-id validator bound to the active country (from
4
+ * `CountryProvider`). The returned function reports a boolean; use
5
+ * {@link useValidateNationalId}'s `.validate` for the normalized value.
6
+ */
7
+ export declare function useValidateNationalId(): ((value: string) => boolean) & {
8
+ validate: (value: string) => ValidationResult;
9
+ };
10
+ /**
11
+ * Returns a phone-number validator bound to the active country.
12
+ */
13
+ export declare function useValidatePhoneNumber(): ((value: string) => boolean) & {
14
+ validate: (value: string) => ValidationResult;
15
+ };
16
+ /**
17
+ * Returns a bank-account validator bound to the active country.
18
+ */
19
+ export declare function useValidateBankAccount(): ((value: string) => boolean) & {
20
+ validate: (value: string) => ValidationResult;
21
+ };
@@ -0,0 +1,28 @@
1
+ import { Language } from './languages';
2
+ /**
3
+ * Translations for a single string, keyed by language. The `no` key is required
4
+ * so the `DEFAULT_LANGUAGE` fallback always resolves; the others are optional.
5
+ */
6
+ export type TranslationMap = {
7
+ no: string;
8
+ } & Partial<Record<Language, string>>;
9
+ /** A named set of translatable strings, each keyed by language. */
10
+ export type TranslationSchema = Record<string, TranslationMap>;
11
+ /**
12
+ * Creates a hook that returns co-located strings for the current language,
13
+ * each falling back to `no`. Define the schema at module scope and call the
14
+ * returned hook inside a component:
15
+ *
16
+ * ```tsx
17
+ * const useLabels = createTranslation({
18
+ * increase: { no: "Øk", se: "Öka", fi: "Lisää", es: "Aumentar" },
19
+ * decrease: { no: "Reduser", se: "Minska", fi: "Vähennä", es: "Disminuir" },
20
+ * });
21
+ *
22
+ * function Stepper() {
23
+ * const t = useLabels();
24
+ * return <button aria-label={t.increase} />;
25
+ * }
26
+ * ```
27
+ */
28
+ export declare function createTranslation<T extends TranslationSchema>(schema: T): () => Record<keyof T, string>;
@@ -0,0 +1,3 @@
1
+ export * from './languages';
2
+ export * from './language-context';
3
+ export * from './create-translation';
@@ -0,0 +1,9 @@
1
+ import { Language } from './languages';
2
+ /**
3
+ * Holds the currently selected language. Provided by `LeaProvider` and read by
4
+ * components (typically via `createTranslation`). Defaults to `DEFAULT_LANGUAGE`
5
+ * so components still render sensibly when used without the provider.
6
+ */
7
+ export declare const LanguageContext: import('react').Context<"no" | "se" | "fi" | "es">;
8
+ /** Returns the language from the nearest `LeaProvider`, or `DEFAULT_LANGUAGE`. */
9
+ export declare const useLanguage: () => Language;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Languages supported by the component library's built-in translations. The
3
+ * consumer selects one via `LeaProvider`'s `language` prop; components read it
4
+ * with `useLanguage` (usually through `createTranslation`).
5
+ */
6
+ export declare const LANGUAGES: readonly ["no", "se", "fi", "es"];
7
+ export type Language = (typeof LANGUAGES)[number];
8
+ /** Fallback language used when no provider is present or a key is missing. */
9
+ export declare const DEFAULT_LANGUAGE = "no";
@@ -0,0 +1,9 @@
1
+ import "./theme/mui-augmentation";
2
+ export * from './components';
3
+ export * from './hooks';
4
+ export * from './i18n';
5
+ export * from './provider';
6
+ export * from './theme';
7
+ export * from './utils';
8
+ export * from './validation';
9
+ export type { ColorToken, BgColorToken, BorderColorToken, BrandColorToken, ColorPath, SpacingFactor, StatusColorToken, TextColorToken, TypographyColorToken, } from './theme/token-types';
Binary file
Binary file
@@ -0,0 +1 @@
1
+ export * from './lea-provider';
@@ -0,0 +1,16 @@
1
+ import { ReactNode } from 'react';
2
+ import { Language } from '../i18n/languages';
3
+ export type LeaProviderProps = {
4
+ /** Language for the library's built-in translations and date locales. @default "no" */
5
+ language?: Language;
6
+ /** Skip rendering MUI's `CssBaseline` (e.g. if the host app renders its own). */
7
+ disableCssBaseline?: boolean;
8
+ children: ReactNode;
9
+ };
10
+ /**
11
+ * The single provider for consuming the component library. Bundles the Lea Bank
12
+ * MUI theme (so consumers never wire `ThemeProvider` / the theme themselves) and
13
+ * the language context that drives `createTranslation` and locale-aware
14
+ * components. Forward only the `language` prop.
15
+ */
16
+ export declare function LeaProvider({ language, disableCssBaseline, children, }: LeaProviderProps): import("react").JSX.Element;
Binary file
@@ -0,0 +1,7 @@
1
+ import { Components, Theme } from '@mui/material';
2
+ /**
3
+ * Lea styling for MUI Accordion. Importing `Accordion` / `AccordionSummary` /
4
+ * `AccordionDetails` from `@mui/material` (with the app `ThemeProvider` + this theme)
5
+ * applies these defaults and style overrides.
6
+ */
7
+ export declare const accordionTheme: Pick<Components<Theme>, "MuiAccordion" | "MuiAccordionSummary" | "MuiAccordionDetails">;