@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,11 @@
1
+ export type ColorToken = "base" | "subtle" | "muted" | "contrast" | "accent";
2
+ export type BgColorToken = ColorToken;
3
+ export type TextColorToken = ColorToken;
4
+ export type BorderColorToken = ColorToken;
5
+ export type BrandColorToken = ColorToken;
6
+ export type StatusColorToken = "base" | "subtle";
7
+ export type ColorPath = `bg.${BgColorToken}` | `text.${TextColorToken}` | `border.${BorderColorToken}` | `primary.${BrandColorToken}` | `secondary.${BrandColorToken}` | `status.error.${StatusColorToken}` | `status.warning.${StatusColorToken}` | `status.info.${StatusColorToken}` | `status.success.${StatusColorToken}`;
8
+ /** Allowed values for MUI `Typography` `color` prop (semantic text tokens). */
9
+ export type TypographyColorToken = `text.${TextColorToken}`;
10
+ /** Common spacing scale factors (8px base via `theme.spacing` / `theme.space`). */
11
+ export type SpacingFactor = 0 | 0.5 | 1 | 1.25 | 1.5 | 2 | 2.5 | 3 | 4 | 5 | 6 | 8;
@@ -0,0 +1,95 @@
1
+ export declare const colors: {
2
+ readonly purple: {
3
+ readonly 50: "#FAF7FB";
4
+ readonly 100: "#E2D8E4";
5
+ readonly 200: "#C5B1CA";
6
+ readonly 300: "#C29AC2";
7
+ readonly 400: "#9E6DA8";
8
+ readonly 500: "#855888";
9
+ readonly 600: "#70427B";
10
+ readonly 700: "#5A3463";
11
+ readonly 800: "#422349";
12
+ readonly 900: "#2E1834";
13
+ readonly 950: "#1A0E1E";
14
+ };
15
+ readonly teal: {
16
+ readonly 50: "#F0FCFA";
17
+ readonly 100: "#DAF6F1";
18
+ readonly 200: "#CEF3ED";
19
+ readonly 300: "#08C2A7";
20
+ readonly 400: "#46D1BD";
21
+ readonly 500: "#06A892";
22
+ readonly 600: "#058F7D";
23
+ readonly 700: "#047568";
24
+ readonly 800: "#035C53";
25
+ readonly 900: "#02433E";
26
+ readonly 950: "#012A28";
27
+ };
28
+ readonly blue: {
29
+ readonly 50: "#EFF6FF";
30
+ readonly 100: "#CBE5FD";
31
+ readonly 200: "#93CBFC";
32
+ readonly 300: "#4DA8F7";
33
+ readonly 400: "#057EF2";
34
+ readonly 500: "#0468C9";
35
+ readonly 600: "#0354A3";
36
+ readonly 700: "#02417D";
37
+ readonly 800: "#012E57";
38
+ readonly 900: "#011B31";
39
+ readonly 950: "#000E19";
40
+ };
41
+ readonly orange: {
42
+ readonly 50: "#FFF5F2";
43
+ readonly 100: "#FFDFD7";
44
+ readonly 200: "#FFC4B5";
45
+ readonly 300: "#FF9E87";
46
+ readonly 400: "#FE653E";
47
+ readonly 500: "#E54E28";
48
+ readonly 600: "#C43E1C";
49
+ readonly 700: "#A33218";
50
+ readonly 800: "#822814";
51
+ readonly 900: "#611E0F";
52
+ readonly 950: "#401408";
53
+ };
54
+ readonly red: {
55
+ readonly 50: "#FEF2F2";
56
+ readonly 100: "#FCDCDC";
57
+ readonly 200: "#F9BBBB";
58
+ readonly 300: "#F28888";
59
+ readonly 400: "#E85555";
60
+ readonly 500: "#D32F2F";
61
+ readonly 600: "#AD2121";
62
+ readonly 700: "#8A1919";
63
+ readonly 800: "#6F1313";
64
+ readonly 900: "#4D0E0E";
65
+ readonly 950: "#2E0808";
66
+ };
67
+ readonly beige: {
68
+ readonly 50: "#FAF7F5";
69
+ readonly 100: "#F0E9E5";
70
+ readonly 200: "#E0D4CD";
71
+ readonly 300: "#C9B8AD";
72
+ readonly 400: "#B09A8C";
73
+ readonly 500: "#977C6B";
74
+ readonly 600: "#7E6556";
75
+ readonly 700: "#654F42";
76
+ readonly 800: "#4C3A32";
77
+ readonly 900: "#332722";
78
+ readonly 950: "#1A1411";
79
+ };
80
+ readonly neutral: {
81
+ readonly 50: "#F7F7F6";
82
+ readonly 100: "#EBEBEB";
83
+ readonly 200: "#DBDBDB";
84
+ readonly 300: "#C4C4C4";
85
+ readonly 400: "#A2A2A2";
86
+ readonly 500: "#757575";
87
+ readonly 600: "#5E5E5E";
88
+ readonly 700: "#454545";
89
+ readonly 800: "#2E2E2E";
90
+ readonly 900: "#1A1A1A";
91
+ readonly 950: "#0F1010";
92
+ };
93
+ readonly white: "#FFFFFF";
94
+ readonly black: "#0F1010";
95
+ };
@@ -0,0 +1,12 @@
1
+ export declare const fontSizes: {
2
+ readonly xs: "0.75rem";
3
+ readonly sm: "0.875rem";
4
+ readonly md: "1rem";
5
+ readonly lg: "1.25rem";
6
+ readonly xl: "1.5rem";
7
+ readonly "2xl": "2rem";
8
+ readonly "3xl": "2.5rem";
9
+ readonly "4xl": "3rem";
10
+ readonly "5xl": "3.5rem";
11
+ readonly "6xl": "4rem";
12
+ };
@@ -0,0 +1,9 @@
1
+ export declare const fontWeights: {
2
+ readonly thin: 200;
3
+ readonly light: 300;
4
+ readonly regular: 400;
5
+ readonly medium: 500;
6
+ readonly semibold: 600;
7
+ readonly bold: 700;
8
+ readonly black: 800;
9
+ };
@@ -0,0 +1,9 @@
1
+ export * from './colors';
2
+ export * from './font-sizes';
3
+ export * from './font-weights';
4
+ export * from './palette';
5
+ export * from './shadows';
6
+ export * from './shape';
7
+ export * from './spacing';
8
+ export * from './transitions';
9
+ export * from './typography';
@@ -0,0 +1,2 @@
1
+ import { Palette } from '../types';
2
+ export declare const palette: Palette;
@@ -0,0 +1,9 @@
1
+ export declare const shadows: {
2
+ readonly xs: "0 1px 2px 0 rgb(0 0 0 / 0.05)";
3
+ readonly sm: "0px 1px 3px 0px rgba(0, 0, 0, 0.10), 0px 1px 2px -1px rgba(0, 0, 0, 0.10)";
4
+ readonly md: "0px 4px 6px -1px rgba(0, 0, 0, 0.10), 0px 2px 4px -2px rgba(0, 0, 0, 0.10)";
5
+ readonly lg: "0px 10px 15px -3px rgba(0, 0, 0, 0.10), 0px 4px 6px -4px rgba(0, 0, 0, 0.10)";
6
+ readonly xl: "0px 20px 25px -5px rgba(0, 0, 0, 0.10), 0px 8px 10px -6px rgba(0, 0, 0, 0.10)";
7
+ readonly "2xl": "0px 25px 50px -12px rgba(0, 0, 0, 0.25)";
8
+ readonly inner: "0px 2px 4px 0px rgba(0, 0, 0, 0.05) inset";
9
+ };
@@ -0,0 +1,12 @@
1
+ export declare const shape: {
2
+ readonly sm: 4;
3
+ readonly md: 5;
4
+ readonly lg: 6;
5
+ readonly xl: 8;
6
+ readonly "2xl": 10;
7
+ readonly "3xl": 12;
8
+ readonly "4xl": 16;
9
+ readonly "5xl": 32;
10
+ readonly huge: 64;
11
+ readonly full: 100;
12
+ };
@@ -0,0 +1 @@
1
+ export declare const spacing: (factor: number) => string;
@@ -0,0 +1,10 @@
1
+ export declare const easings: {
2
+ readonly standard: "ease-in-out";
3
+ readonly spring: "cubic-bezier(0.34, 1.56, 0.64, 1)";
4
+ };
5
+ export declare const durations: {
6
+ readonly fast: "0.15s";
7
+ readonly normal: "0.2s";
8
+ readonly emphasis: "0.3s";
9
+ };
10
+ export declare const transition: (properties: string[], duration?: string, easing?: string) => string;
@@ -0,0 +1,43 @@
1
+ /**
2
+ *
3
+ * We are not following the MUI typography tokens because
4
+ * sometimes we need the size of an h1 but not the h1 component.
5
+ * Overriding it here at the root will give us more control over the typography.
6
+ *
7
+ */
8
+ export declare const typography: {
9
+ fontFamily: string;
10
+ fontWeight: 400;
11
+ color: string;
12
+ "& strong": {
13
+ fontWeight: 500;
14
+ };
15
+ "& a": {
16
+ color: string;
17
+ textDecorationColor: string;
18
+ fontWeight: 400;
19
+ };
20
+ h1: undefined;
21
+ h2: undefined;
22
+ h3: undefined;
23
+ h4: undefined;
24
+ h5: undefined;
25
+ h6: undefined;
26
+ subtitle1: undefined;
27
+ subtitle2: undefined;
28
+ heading: {
29
+ fontFamily: string;
30
+ fontWeight: 500;
31
+ letterSpacing: string;
32
+ };
33
+ body1: {
34
+ fontSize: "1rem";
35
+ fontWeight: 400;
36
+ };
37
+ body2: {
38
+ fontSize: "0.875rem";
39
+ fontWeight: 400;
40
+ };
41
+ button: undefined;
42
+ caption: undefined;
43
+ };
@@ -0,0 +1,80 @@
1
+ import { SxProps } from '@mui/material/styles';
2
+ export type ColorScaleTokens = typeof import('./tokens/colors').colors;
3
+ export type ColorScaleStep = keyof ColorScaleTokens["purple"];
4
+ export type Palette = {
5
+ bg: {
6
+ base: string;
7
+ subtle: string;
8
+ muted: string;
9
+ contrast: string;
10
+ accent: string;
11
+ };
12
+ text: {
13
+ base: string;
14
+ subtle: string;
15
+ muted: string;
16
+ accent: string;
17
+ contrast: string;
18
+ };
19
+ border: {
20
+ base: string;
21
+ subtle: string;
22
+ strong: string;
23
+ accent: string;
24
+ contrast: string;
25
+ };
26
+ purple: {
27
+ base: string;
28
+ hover: string;
29
+ subtle: string;
30
+ contrast: string;
31
+ };
32
+ primary: {
33
+ main: string;
34
+ dark: string;
35
+ light: string;
36
+ contrastText: string;
37
+ };
38
+ teal: {
39
+ base: string;
40
+ hover: string;
41
+ subtle: string;
42
+ contrast: string;
43
+ };
44
+ secondary: {
45
+ main: string;
46
+ dark: string;
47
+ light: string;
48
+ contrastText: string;
49
+ };
50
+ status: {
51
+ error: {
52
+ base: string;
53
+ subtle: string;
54
+ };
55
+ warning: {
56
+ base: string;
57
+ subtle: string;
58
+ };
59
+ info: {
60
+ base: string;
61
+ subtle: string;
62
+ };
63
+ success: {
64
+ base: string;
65
+ subtle: string;
66
+ };
67
+ };
68
+ };
69
+ export type PaletteTokens = typeof import('./tokens/palette').palette;
70
+ /** MUI `Theme` after this library's module augmentation (use with `useTheme`, `SxProps`, etc.). */
71
+ export type LeaBankTheme = import('@mui/material/styles').Theme;
72
+ /** Typed `SxProps` bound to the Lea Bank theme. */
73
+ export type LeaSxProps = SxProps<LeaBankTheme>;
74
+ export type FontSizeToken = keyof typeof import('./tokens/font-sizes').fontSizes;
75
+ export type ShapeToken = keyof typeof import('./tokens/shape').shape;
76
+ export type ShadowToken = keyof typeof import('./tokens/shadows').shadows;
77
+ export type FontWeightToken = keyof typeof import('./tokens/font-weights').fontWeights;
78
+ export type EasingToken = keyof typeof import('./tokens/transitions').easings;
79
+ export type DurationToken = keyof typeof import('./tokens/transitions').durations;
80
+ export type { BgColorToken, BorderColorToken, BrandColorToken, ColorPath, ColorToken, SpacingFactor, StatusColorToken, TextColorToken, TypographyColorToken, } from './token-types';
@@ -0,0 +1,6 @@
1
+ export declare const focusVisibleStyles: {
2
+ "&:focus-visible": {
3
+ outline: string;
4
+ outlineColor: string;
5
+ };
6
+ };
@@ -0,0 +1 @@
1
+ export * from './focus-visible-styles';
@@ -0,0 +1,4 @@
1
+ export type DownloadableData = string | Blob | File | ArrayBuffer | Uint8Array;
2
+ export type DownloadDataSource = DownloadableData | (() => DownloadableData | Promise<DownloadableData>);
3
+ export declare function resolveDownloadData(data: DownloadDataSource): Promise<DownloadableData>;
4
+ export declare function downloadFile(data: DownloadableData, fileName: string, mimeType?: string): void;
@@ -0,0 +1,16 @@
1
+ export type FormatDecimals = {
2
+ value: number;
3
+ decimalPlaces?: number;
4
+ };
5
+ /**
6
+
7
+ * Formats a number to a fixed number of decimal places (default is 2)
8
+ * by using exponential notation
9
+ *
10
+ * ⚠️ Note: We avoid using `toFixed` for rounding because it can introduce rounding errors.
11
+ *
12
+ * @param value - The number to format.
13
+ * @param decimalPlaces - Number of decimal places to show (default: 2).
14
+ * @returns The number with fixed decimal places.
15
+ */
16
+ export declare const fixDecimals: ({ value, decimalPlaces }: FormatDecimals) => number;
@@ -0,0 +1,12 @@
1
+ import { FormatDecimals } from './formatDecimal';
2
+ /**
3
+ * Formats a number to a fixed number of decimal places (default is 2).
4
+ *
5
+ * Ensures that string representation of number always has the set number of decimals (even eg. .00)
6
+ *
7
+ * @param value - The number or string to format.
8
+ * @param decimalPlaces - Number of decimal places to show (default: 2).
9
+ * @returns A string representation of the number with fixed decimal places.
10
+ */
11
+ export declare const fixDecimalsToString: ({ value, decimalPlaces, }: FormatDecimals) => string;
12
+ export declare const formatDecimalString: ({ value, decimalPlaces, }: FormatDecimals) => string;
@@ -0,0 +1 @@
1
+ export declare const formatPercentage: (value: number, decimalPlaces?: number) => string;
@@ -0,0 +1,5 @@
1
+ export * from './downloadFile';
2
+ export * from './formatDecimal';
3
+ export * from './formatDecimalString';
4
+ export * from './formatPercentage';
5
+ export * from './parseExpirationDate';
@@ -0,0 +1,4 @@
1
+ export declare function parseExpirationDate(expirationDate: string): {
2
+ month: string;
3
+ year: string;
4
+ };
@@ -0,0 +1,29 @@
1
+ import { Country } from '../hooks/country/countries';
2
+ import { ValidationResult } from './types';
3
+ /**
4
+ * Generic IBAN check: structure, country length and the ISO 7064 mod-97
5
+ * checksum.
6
+ */
7
+ export declare function isValidIban(value: string, country?: Country): boolean;
8
+ /**
9
+ * Norwegian kontonummer: 11 digits with a mod-11 control digit.
10
+ */
11
+ export declare function isValidNorwegianAccount(value: string): boolean;
12
+ /**
13
+ * Swedish clearing + account number. Bank-specific checksums vary, so this is a
14
+ * structural check: a 4-5 digit clearing number followed by a 6-10 digit
15
+ * account number.
16
+ */
17
+ export declare function isValidSwedishAccount(value: string): boolean;
18
+ /**
19
+ * Validates a bank account number for the given country.
20
+ *
21
+ * - **FI / ES** require a valid IBAN.
22
+ * - **NO** accepts a domestic kontonummer or a Norwegian IBAN.
23
+ * - **SE** accepts a domestic clearing + account number or a Swedish IBAN.
24
+ */
25
+ export declare function validateBankAccount(country: Country, value: string): ValidationResult;
26
+ /**
27
+ * Boolean convenience wrapper around {@link validateBankAccount}.
28
+ */
29
+ export declare function isValidBankAccount(country: Country, value: string): boolean;
@@ -0,0 +1,24 @@
1
+ import { ValidationResult } from './types';
2
+ /**
3
+ * Common consumer email domains across the Nordics and Spain, used to power the
4
+ * `@`-triggered autocomplete dropdown.
5
+ */
6
+ export declare const COMMON_EMAIL_DOMAINS: readonly string[];
7
+ /**
8
+ * Validates an email address and returns the lowercased value when valid.
9
+ */
10
+ export declare function validateEmail(value: string): ValidationResult;
11
+ /**
12
+ * Boolean convenience wrapper around {@link validateEmail}.
13
+ */
14
+ export declare function isValidEmail(value: string): boolean;
15
+ /**
16
+ * Given the current email input, returns a list of completed email suggestions
17
+ * based on common domains. Suggestions only appear once an `@` has been typed,
18
+ * and are filtered by whatever partial domain follows it.
19
+ *
20
+ * @example
21
+ * getEmailDomainSuggestions("alice@") // → ["alice@gmail.com", ...]
22
+ * getEmailDomainSuggestions("alice@gm") // → ["alice@gmail.com"]
23
+ */
24
+ export declare function getEmailDomainSuggestions(value: string, domains?: readonly string[]): string[];
@@ -0,0 +1,5 @@
1
+ export * from './types';
2
+ export * from './national-id';
3
+ export * from './phone';
4
+ export * from './bank-account';
5
+ export * from './email';
@@ -0,0 +1,30 @@
1
+ import { Country } from '../hooks/country/countries';
2
+ import { ValidationResult } from './types';
3
+ /**
4
+ * Swedish personnummer. Accepts 10 or 12 digit forms (with or without
5
+ * separators) and validates the trailing Luhn check digit.
6
+ */
7
+ export declare function isValidSwedishNationalId(value: string): boolean;
8
+ /**
9
+ * Finnish henkilötunnus (HETU). Validates structure, date, century marker and
10
+ * the mod-31 check character.
11
+ */
12
+ export declare function isValidFinnishNationalId(value: string): boolean;
13
+ /**
14
+ * Norwegian fødselsnummer. 11 digits with two mod-11 control digits.
15
+ */
16
+ export declare function isValidNorwegianNationalId(value: string): boolean;
17
+ /**
18
+ * Spanish DNI / NIE. Validates the control letter (mod-23). NIE prefixes
19
+ * (X/Y/Z) are mapped to their numeric equivalents before the check.
20
+ */
21
+ export declare function isValidSpanishNationalId(value: string): boolean;
22
+ /**
23
+ * Validates a national identity number for the given country.
24
+ */
25
+ export declare function isValidNationalId(country: Country, value: string): boolean;
26
+ /**
27
+ * Validates a national identity number and returns the normalized (uppercased,
28
+ * separator-free) value when valid.
29
+ */
30
+ export declare function validateNationalId(country: Country, value: string): ValidationResult;
@@ -0,0 +1,16 @@
1
+ import { CountryCode } from 'libphonenumber-js';
2
+ import { ValidationResult } from './types';
3
+ export type { CountryCode };
4
+ /**
5
+ * Validates a phone number for the given country, delegating to
6
+ * `libphonenumber-js` so every country's rules stay accurate and maintained.
7
+ *
8
+ * Accepts national format (with or without a leading trunk `0`) and
9
+ * international format (`+CC` / `00CC`). On success, `normalized` holds the
10
+ * canonical E.164 form (e.g. `+358401234567`).
11
+ */
12
+ export declare function validatePhoneNumber(country: CountryCode, value: string): ValidationResult;
13
+ /**
14
+ * Boolean convenience wrapper around {@link validatePhoneNumber}.
15
+ */
16
+ export declare function isValidPhoneNumber(country: CountryCode, value: string): boolean;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Result of a validation check. `normalized` holds the canonical form of the
3
+ * input (e.g. digits only, or E.164 phone) when the value is valid.
4
+ */
5
+ export interface ValidationResult {
6
+ valid: boolean;
7
+ normalized?: string;
8
+ }
9
+ export declare const invalid: () => ValidationResult;
10
+ export declare const valid: (normalized: string) => ValidationResult;
package/package.json ADDED
@@ -0,0 +1,107 @@
1
+ {
2
+ "name": "@leabankab/component-library",
3
+ "version": "5.6.1",
4
+ "description": "@leabankab/component-library — Lea Bank's React component library built on MUI.",
5
+ "engines": {
6
+ "node": ">=20"
7
+ },
8
+ "license": "UNLICENSED",
9
+ "author": "Lea Bank",
10
+ "main": "dist/component-library.umd.js",
11
+ "module": "dist/component-library.es.js",
12
+ "types": "dist/index.d.ts",
13
+ "exports": {
14
+ ".": {
15
+ "types": "./dist/index.d.ts",
16
+ "import": "./dist/component-library.es.js",
17
+ "require": "./dist/component-library.umd.js"
18
+ },
19
+ "./package.json": "./package.json",
20
+ "./dist/*": "./dist/*"
21
+ },
22
+ "files": [
23
+ "dist",
24
+ "README.md",
25
+ "CHANGELOG.md"
26
+ ],
27
+ "publishConfig": {
28
+ "access": "public",
29
+ "registry": "https://registry.npmjs.org/"
30
+ },
31
+ "dependencies": {
32
+ "@base-ui/react": "^1.6.0",
33
+ "@storybook/addon-a11y": "^10.5.5",
34
+ "libphonenumber-js": "^1.13.10",
35
+ "lucide-react": "^1.28.0",
36
+ "motion": "^12.43.0"
37
+ },
38
+ "peerDependencies": {
39
+ "@emotion/react": "^11.0.0",
40
+ "@emotion/styled": "^11.0.0",
41
+ "@mui/material": "^9.0.0",
42
+ "@mui/system": "^9.0.0",
43
+ "@mui/x-date-pickers": "^9.0.0",
44
+ "date-fns": "^4.0.0",
45
+ "react": "^18.0.0 || ^19.0.0",
46
+ "react-dom": "^18.0.0 || ^19.0.0",
47
+ "react-hook-form": "^7.56.0"
48
+ },
49
+ "devDependencies": {
50
+ "@changesets/changelog-git": "^0.2.1",
51
+ "@changesets/cli": "^2.31.1",
52
+ "@chromatic-com/storybook": "^5.2.1",
53
+ "@emotion/react": "^11.14.0",
54
+ "@emotion/styled": "^11.14.1",
55
+ "@eslint/js": "^9.39.5",
56
+ "@mui/icons-material": "^9.2.0",
57
+ "@mui/material": "^9.2.0",
58
+ "@mui/system": "^9.2.0",
59
+ "@mui/x-date-pickers": "^9.10.1",
60
+ "@storybook/addon-docs": "^10.5.5",
61
+ "@storybook/addon-links": "^10.5.5",
62
+ "@storybook/addon-mcp": "^0.6.0",
63
+ "@storybook/addon-vitest": "^10.5.5",
64
+ "@storybook/react": "^10.5.5",
65
+ "@storybook/react-vite": "^10.5.5",
66
+ "@types/node": "^25.9.5",
67
+ "@types/react": "^19.2.17",
68
+ "@types/react-dom": "^19.2.3",
69
+ "@vitejs/plugin-react": "^6.0.5",
70
+ "@vitest/browser-playwright": "^4.1.10",
71
+ "@vitest/coverage-v8": "^4.1.10",
72
+ "cross-env": "^10.1.0",
73
+ "date-fns": "^4.4.0",
74
+ "eslint": "^9.39.5",
75
+ "eslint-plugin-react": "^7.37.5",
76
+ "eslint-plugin-storybook": "^10.5.5",
77
+ "husky": "^9.1.7",
78
+ "playwright": "^1.62.1",
79
+ "react": "^19.2.8",
80
+ "react-dom": "^19.2.8",
81
+ "react-hook-form": "^7.83.0",
82
+ "remark-gfm": "^4.0.1",
83
+ "rollup-preserve-directives": "^1.1.3",
84
+ "storybook": "^10.5.5",
85
+ "typescript": "^6.0.3",
86
+ "typescript-eslint": "^8.65.0",
87
+ "vite": "^8.2.0",
88
+ "vite-plugin-dts": "^5.0.3",
89
+ "vitest": "^4.1.10"
90
+ },
91
+ "scripts": {
92
+ "preinstall": "npx only-allow pnpm",
93
+ "dev": "storybook dev -p 6006",
94
+ "build": "cross-env NODE_OPTIONS=--max-old-space-size=4096 vite build",
95
+ "watch": "cross-env NODE_OPTIONS=--max-old-space-size=4096 vite build --watch",
96
+ "storybook": "storybook dev -p 6006",
97
+ "build-storybook": "cross-env NODE_OPTIONS=--max-old-space-size=4096 storybook build",
98
+ "lint": "eslint .",
99
+ "lint:ci": "eslint . --max-warnings=0",
100
+ "typecheck": "tsc --noEmit",
101
+ "ci:check": "tsc --noEmit && eslint . --max-warnings=0",
102
+ "changeset": "changeset",
103
+ "changeset:status": "changeset status --since=origin/main",
104
+ "version-packages": "changeset version",
105
+ "release": "changeset publish"
106
+ }
107
+ }