@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.
- package/CHANGELOG.md +408 -0
- package/README.md +22 -0
- package/dist/bankidlogo.png +0 -0
- package/dist/component-library.es.js +6143 -0
- package/dist/component-library.es.js.map +1 -0
- package/dist/component-library.umd.js +35 -0
- package/dist/component-library.umd.js.map +1 -0
- package/dist/components/animations/icons/index.d.ts +1 -0
- package/dist/components/animations/icons/status-icon.d.ts +21 -0
- package/dist/components/animations/illustrations/check-animation.d.ts +12 -0
- package/dist/components/animations/illustrations/index.d.ts +3 -0
- package/dist/components/animations/illustrations/pulse-animation.d.ts +12 -0
- package/dist/components/animations/illustrations/status-animation.d.ts +32 -0
- package/dist/components/animations/index.d.ts +2 -0
- package/dist/components/animations/shared.d.ts +67 -0
- package/dist/components/animations/use-animation-labels.d.ts +6 -0
- package/dist/components/buttons/action-button.d.ts +18 -0
- package/dist/components/buttons/button.d.ts +20 -0
- package/dist/components/buttons/download-trigger.d.ts +33 -0
- package/dist/components/buttons/icon-button.d.ts +12 -0
- package/dist/components/buttons/index.d.ts +5 -0
- package/dist/components/buttons/skip-link.d.ts +6 -0
- package/dist/components/buttons/use-download-labels.d.ts +5 -0
- package/dist/components/data-display/card.d.ts +6 -0
- package/dist/components/data-display/chip.d.ts +11 -0
- package/dist/components/data-display/data-field.d.ts +12 -0
- package/dist/components/data-display/index.d.ts +4 -0
- package/dist/components/data-display/tooltip.d.ts +37 -0
- package/dist/components/data-display/use-chip-labels.d.ts +6 -0
- package/dist/components/dev-panel/dev-panel-country.d.ts +26 -0
- package/dist/components/dev-panel/dev-panel-flow.d.ts +28 -0
- package/dist/components/dev-panel/dev-panel-footer.d.ts +26 -0
- package/dist/components/dev-panel/dev-panel-payload.d.ts +47 -0
- package/dist/components/dev-panel/dev-panel-status.d.ts +31 -0
- package/dist/components/dev-panel/dev-panel-step-state.d.ts +28 -0
- package/dist/components/dev-panel/dev-panel-steps.d.ts +39 -0
- package/dist/components/dev-panel/dev-panel-variant.d.ts +21 -0
- package/dist/components/dev-panel/dev-panel.d.ts +61 -0
- package/dist/components/dev-panel/index.d.ts +9 -0
- package/dist/components/dev-panel/json-highlight.d.ts +15 -0
- package/dist/components/dev-panel/segmented-control.d.ts +38 -0
- package/dist/components/dev-panel/use-copy.d.ts +9 -0
- package/dist/components/dev-panel/use-dev-panel-labels.d.ts +7 -0
- package/dist/components/dev-panel/use-roving-radio.d.ts +34 -0
- package/dist/components/feedback/alert.d.ts +27 -0
- package/dist/components/feedback/dialog.d.ts +22 -0
- package/dist/components/feedback/drawer.d.ts +22 -0
- package/dist/components/feedback/index.d.ts +3 -0
- package/dist/components/feedback/use-close-label.d.ts +6 -0
- package/dist/components/form/autocomplete.d.ts +71 -0
- package/dist/components/form/checkbox.d.ts +12 -0
- package/dist/components/form/datepicker/calendar-header.d.ts +12 -0
- package/dist/components/form/datepicker/datepicker.d.ts +99 -0
- package/dist/components/form/datepicker/drawer-toolbar.d.ts +17 -0
- package/dist/components/form/datepicker/index.d.ts +1 -0
- package/dist/components/form/datepicker/use-calendar-header-labels.d.ts +8 -0
- package/dist/components/form/datepicker/use-datepicker-title-labels.d.ts +5 -0
- package/dist/components/form/datepicker/use-view-toggle-labels.d.ts +7 -0
- package/dist/components/form/datepicker/view-renderers.d.ts +10 -0
- package/dist/components/form/datepicker/view-toggle.d.ts +21 -0
- package/dist/components/form/email-input.d.ts +35 -0
- package/dist/components/form/fields/autocomplete-field.d.ts +17 -0
- package/dist/components/form/fields/boolean-radio-field.d.ts +3 -0
- package/dist/components/form/fields/checkbox-field.d.ts +12 -0
- package/dist/components/form/fields/datepicker-field.d.ts +9 -0
- package/dist/components/form/fields/email-field.d.ts +10 -0
- package/dist/components/form/fields/field-types.d.ts +18 -0
- package/dist/components/form/fields/index.d.ts +14 -0
- package/dist/components/form/fields/input-field.d.ts +9 -0
- package/dist/components/form/fields/multi-select-field.d.ts +9 -0
- package/dist/components/form/fields/number-field.d.ts +10 -0
- package/dist/components/form/fields/phone-number-field.d.ts +11 -0
- package/dist/components/form/fields/radio-card-field.d.ts +22 -0
- package/dist/components/form/fields/radio-field.d.ts +16 -0
- package/dist/components/form/fields/select-field.d.ts +9 -0
- package/dist/components/form/fields/use-field-control.d.ts +6 -0
- package/dist/components/form/fields/use-tooltip-trigger-labels.d.ts +5 -0
- package/dist/components/form/form-control/form-control-context.d.ts +35 -0
- package/dist/components/form/form-control/form-control-label.d.ts +1 -0
- package/dist/components/form/form-control/form-control.d.ts +13 -0
- package/dist/components/form/form-control/form-helper-text.d.ts +9 -0
- package/dist/components/form/form-control/form-label.d.ts +9 -0
- package/dist/components/form/form-control/index.d.ts +5 -0
- package/dist/components/form/index.d.ts +18 -0
- package/dist/components/form/input-label.d.ts +9 -0
- package/dist/components/form/input.d.ts +19 -0
- package/dist/components/form/multi-select.d.ts +32 -0
- package/dist/components/form/number-input.d.ts +52 -0
- package/dist/components/form/phone-number-input/countries.d.ts +33 -0
- package/dist/components/form/phone-number-input/index.d.ts +2 -0
- package/dist/components/form/phone-number-input/phone-number-input.d.ts +53 -0
- package/dist/components/form/radio-card.d.ts +77 -0
- package/dist/components/form/radio-circle.d.ts +19 -0
- package/dist/components/form/radio.d.ts +36 -0
- package/dist/components/form/select.d.ts +46 -0
- package/dist/components/form/slider.d.ts +23 -0
- package/dist/components/form/use-autocomplete-labels.d.ts +19 -0
- package/dist/components/index.d.ts +11 -0
- package/dist/components/navigation/form-stepper.d.ts +63 -0
- package/dist/components/navigation/index.d.ts +4 -0
- package/dist/components/navigation/progress-circle.d.ts +34 -0
- package/dist/components/navigation/tabs.d.ts +79 -0
- package/dist/components/navigation/use-stepper-labels.d.ts +7 -0
- package/dist/components/surfaces/accordion.d.ts +15 -0
- package/dist/components/surfaces/index.d.ts +1 -0
- package/dist/components/typography/index.d.ts +3 -0
- package/dist/components/typography/link.d.ts +23 -0
- package/dist/components/typography/lists.d.ts +54 -0
- package/dist/components/typography/text.d.ts +18 -0
- package/dist/components/ui/brand-divider.d.ts +6 -0
- package/dist/components/ui/index.d.ts +1 -0
- package/dist/creditcard.png +0 -0
- package/dist/favicon.ico +0 -0
- package/dist/hooks/country/countries.d.ts +8 -0
- package/dist/hooks/country/country-context.d.ts +20 -0
- package/dist/hooks/index.d.ts +6 -0
- package/dist/hooks/use-format-currency.d.ts +9 -0
- package/dist/hooks/use-format-date.d.ts +4 -0
- package/dist/hooks/use-format-number.d.ts +10 -0
- package/dist/hooks/validation/index.d.ts +1 -0
- package/dist/hooks/validation/use-validation.d.ts +21 -0
- package/dist/i18n/create-translation.d.ts +28 -0
- package/dist/i18n/index.d.ts +3 -0
- package/dist/i18n/language-context.d.ts +9 -0
- package/dist/i18n/languages.d.ts +9 -0
- package/dist/index.d.ts +9 -0
- package/dist/leabank-logo-square.png +0 -0
- package/dist/leabank-logo.png +0 -0
- package/dist/provider/index.d.ts +1 -0
- package/dist/provider/lea-provider.d.ts +16 -0
- package/dist/success-icon.png +0 -0
- package/dist/theme/components/accordion.theme.d.ts +7 -0
- package/dist/theme/components/action-button.theme.d.ts +45 -0
- package/dist/theme/components/alert.theme.d.ts +2 -0
- package/dist/theme/components/autocomplete.theme.d.ts +2 -0
- package/dist/theme/components/baseline-css.d.ts +2 -0
- package/dist/theme/components/button.theme.d.ts +2 -0
- package/dist/theme/components/card.theme.d.ts +2 -0
- package/dist/theme/components/checkbox.theme.d.ts +2 -0
- package/dist/theme/components/chip.theme.d.ts +2 -0
- package/dist/theme/components/date-picker.theme.d.ts +15 -0
- package/dist/theme/components/dev-panel.theme.d.ts +95 -0
- package/dist/theme/components/dialog.theme.d.ts +2 -0
- package/dist/theme/components/drawer.theme.d.ts +4 -0
- package/dist/theme/components/field-base.d.ts +31 -0
- package/dist/theme/components/form-control-label.theme.d.ts +2 -0
- package/dist/theme/components/form-control.theme.d.ts +2 -0
- package/dist/theme/components/icon-button.theme.d.ts +2 -0
- package/dist/theme/components/index.d.ts +2 -0
- package/dist/theme/components/input.theme.d.ts +3 -0
- package/dist/theme/components/link.theme.d.ts +2 -0
- package/dist/theme/components/menu-item.theme.d.ts +2 -0
- package/dist/theme/components/number-input.theme.d.ts +23 -0
- package/dist/theme/components/phone-number-input.theme.d.ts +43 -0
- package/dist/theme/components/radio.theme.d.ts +2 -0
- package/dist/theme/components/select.theme.d.ts +2 -0
- package/dist/theme/components/slider.theme.d.ts +2 -0
- package/dist/theme/components/tabs.theme.d.ts +34 -0
- package/dist/theme/components/tooltip.theme.d.ts +110 -0
- package/dist/theme/components/typography.theme.d.ts +2 -0
- package/dist/theme/index.d.ts +6 -0
- package/dist/theme/mui-augmentation.d.ts +147 -0
- package/dist/theme/sx-config.d.ts +10 -0
- package/dist/theme/token-types.d.ts +11 -0
- package/dist/theme/tokens/colors.d.ts +95 -0
- package/dist/theme/tokens/font-sizes.d.ts +12 -0
- package/dist/theme/tokens/font-weights.d.ts +9 -0
- package/dist/theme/tokens/index.d.ts +9 -0
- package/dist/theme/tokens/palette.d.ts +2 -0
- package/dist/theme/tokens/shadows.d.ts +9 -0
- package/dist/theme/tokens/shape.d.ts +12 -0
- package/dist/theme/tokens/spacing.d.ts +1 -0
- package/dist/theme/tokens/transitions.d.ts +10 -0
- package/dist/theme/tokens/typography.d.ts +43 -0
- package/dist/theme/types.d.ts +80 -0
- package/dist/theme/utils/focus-visible-styles.d.ts +6 -0
- package/dist/theme/utils/index.d.ts +1 -0
- package/dist/utils/downloadFile.d.ts +4 -0
- package/dist/utils/formatDecimal.d.ts +16 -0
- package/dist/utils/formatDecimalString.d.ts +12 -0
- package/dist/utils/formatPercentage.d.ts +1 -0
- package/dist/utils/index.d.ts +5 -0
- package/dist/utils/parseExpirationDate.d.ts +4 -0
- package/dist/validation/bank-account.d.ts +29 -0
- package/dist/validation/email.d.ts +24 -0
- package/dist/validation/index.d.ts +5 -0
- package/dist/validation/national-id.d.ts +30 -0
- package/dist/validation/phone.d.ts +16 -0
- package/dist/validation/types.d.ts +10 -0
- 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,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,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 @@
|
|
|
1
|
+
export * from './brand-divider';
|
|
Binary file
|
package/dist/favicon.ico
ADDED
|
Binary file
|
|
@@ -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,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,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,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";
|
package/dist/index.d.ts
ADDED
|
@@ -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">;
|