@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 @@
|
|
|
1
|
+
export * from './status-icon';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { AnimationColor } from '../shared';
|
|
2
|
+
type StatusIconStatus = "pending" | "loading" | "done";
|
|
3
|
+
type StatusIconProps = {
|
|
4
|
+
status: StatusIconStatus;
|
|
5
|
+
/** Rendered size in px. */
|
|
6
|
+
size?: number;
|
|
7
|
+
color?: AnimationColor;
|
|
8
|
+
/**
|
|
9
|
+
* Accessible name; defaults to the translated label for the current status in
|
|
10
|
+
* the `LeaProvider` language.
|
|
11
|
+
*/
|
|
12
|
+
label?: string;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* A small, inline status icon for step / progress lists. Transitions through
|
|
16
|
+
* `pending` (empty ring) → `loading` (spinner) → `done` (filled check with a
|
|
17
|
+
* one-time confetti pop). One-shot, not infinite. Respects
|
|
18
|
+
* `prefers-reduced-motion`.
|
|
19
|
+
*/
|
|
20
|
+
export declare const StatusIcon: ({ status, size, color, label, }: StatusIconProps) => import("react").JSX.Element;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AnimationColor, AnimationSize } from '../shared';
|
|
2
|
+
type CheckAnimationProps = {
|
|
3
|
+
size?: AnimationSize;
|
|
4
|
+
color?: AnimationColor;
|
|
5
|
+
/**
|
|
6
|
+
* Accessible name for the illustration; defaults to the translated word for
|
|
7
|
+
* "confirmed" in the `LeaProvider` language.
|
|
8
|
+
*/
|
|
9
|
+
label?: string;
|
|
10
|
+
};
|
|
11
|
+
export declare const CheckAnimation: ({ size, color, label, }: CheckAnimationProps) => import("react").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AnimationSize } from '../shared';
|
|
2
|
+
type PulseAnimationProps = {
|
|
3
|
+
size?: AnimationSize;
|
|
4
|
+
/**
|
|
5
|
+
* Accessible name for the spinner; defaults to the translated word for
|
|
6
|
+
* "loading" in the `LeaProvider` language. `StatusAnimation` hides the pulse
|
|
7
|
+
* from assistive tech and announces its own status text instead.
|
|
8
|
+
*/
|
|
9
|
+
label?: string;
|
|
10
|
+
};
|
|
11
|
+
export declare const PulseAnimation: ({ size, label, }: PulseAnimationProps) => import("react").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { AnimationColor, AnimationSize } from '../shared';
|
|
2
|
+
type StatusAnimationProps = {
|
|
3
|
+
/** While `true`, shows the pulse; when it flips to `false`, transitions to the check. */
|
|
4
|
+
loading: boolean;
|
|
5
|
+
size?: AnimationSize;
|
|
6
|
+
/** Colour of the resulting check (and its halo). */
|
|
7
|
+
color?: AnimationColor;
|
|
8
|
+
/**
|
|
9
|
+
* Minimum time (ms) the pulse stays visible once mounted in the loading
|
|
10
|
+
* state, so a very fast response doesn't make the spinner flash. The check
|
|
11
|
+
* appears as soon as `loading` is `false` *and* this minimum has elapsed.
|
|
12
|
+
*/
|
|
13
|
+
minLoadingMs?: number;
|
|
14
|
+
/**
|
|
15
|
+
* Visually-hidden status text announced while loading. Defaults to the
|
|
16
|
+
* translated word for "loading" in the `LeaProvider` language.
|
|
17
|
+
*/
|
|
18
|
+
loadingLabel?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Visually-hidden status text announced once done. Defaults to the translated
|
|
21
|
+
* word for "done".
|
|
22
|
+
*/
|
|
23
|
+
doneLabel?: string;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* A controlled loading → success indicator: shows {@link PulseAnimation} while
|
|
27
|
+
* `loading`, then cross-fades into {@link CheckAnimation} (firing its one-time
|
|
28
|
+
* confetti) once `loading` becomes `false`. Announces state changes politely
|
|
29
|
+
* and respects `prefers-reduced-motion`.
|
|
30
|
+
*/
|
|
31
|
+
export declare const StatusAnimation: ({ loading, size, color, minLoadingMs, loadingLabel, doneLabel, }: StatusAnimationProps) => import("react").JSX.Element;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { SxProps, Theme } from '@mui/material';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
export type AnimationSize = "small" | "large";
|
|
4
|
+
export type AnimationColor = "purple" | "green";
|
|
5
|
+
export declare const colorMap: Record<AnimationColor, {
|
|
6
|
+
base: string;
|
|
7
|
+
contrast: string;
|
|
8
|
+
}>;
|
|
9
|
+
export declare const visuallyHidden: {
|
|
10
|
+
readonly position: "absolute";
|
|
11
|
+
readonly width: "1px";
|
|
12
|
+
readonly height: "1px";
|
|
13
|
+
readonly overflow: "hidden";
|
|
14
|
+
readonly clip: "rect(0 0 0 0)";
|
|
15
|
+
readonly whiteSpace: "nowrap";
|
|
16
|
+
};
|
|
17
|
+
export declare const reducedMotionOverride: {
|
|
18
|
+
readonly "@media (prefers-reduced-motion: reduce)": {
|
|
19
|
+
readonly animation: "none";
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export declare const reducedMotionHidden: {
|
|
23
|
+
readonly "@media (prefers-reduced-motion: reduce)": {
|
|
24
|
+
readonly animation: "none";
|
|
25
|
+
readonly opacity: 0;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
export declare const illustrationBadgeShadow = "rgba(255, 255, 255, 0.1) 0px 1px 1px 0px inset, rgba(50, 50, 93, 0.25) 0px 30px 60px -20px, rgba(0, 0, 0, 0.25) 0px 18px 36px -18px";
|
|
29
|
+
export type ConfettiParticle = {
|
|
30
|
+
id: number;
|
|
31
|
+
x: number;
|
|
32
|
+
y: number;
|
|
33
|
+
dotSize: number;
|
|
34
|
+
round: boolean;
|
|
35
|
+
colour?: string;
|
|
36
|
+
spin?: number;
|
|
37
|
+
};
|
|
38
|
+
type BuildParticlesOptions = {
|
|
39
|
+
count: number;
|
|
40
|
+
burst: number;
|
|
41
|
+
distanceAt: (index: number) => number;
|
|
42
|
+
dotSizeAt: (index: number) => number;
|
|
43
|
+
colourAt?: (index: number) => string | undefined;
|
|
44
|
+
withSpin?: boolean;
|
|
45
|
+
};
|
|
46
|
+
export declare const buildParticles: ({ count, burst, distanceAt, dotSizeAt, colourAt, withSpin, }: BuildParticlesOptions) => ConfettiParticle[];
|
|
47
|
+
type ConfettiParticlesProps = {
|
|
48
|
+
particles: ConfettiParticle[];
|
|
49
|
+
/** Illustration confetti drifts down slightly and spins. */
|
|
50
|
+
variant?: "illustration" | "icon";
|
|
51
|
+
delay?: number;
|
|
52
|
+
duration?: number;
|
|
53
|
+
/** When set, particles use currentColor instead of per-particle colours. */
|
|
54
|
+
useCurrentColor?: boolean;
|
|
55
|
+
};
|
|
56
|
+
export declare const ConfettiParticles: ({ particles, variant, delay, duration, useCurrentColor, }: ConfettiParticlesProps) => import("react").JSX.Element[];
|
|
57
|
+
type AnimationBadgeProps = {
|
|
58
|
+
size: number;
|
|
59
|
+
base: string;
|
|
60
|
+
contrast: string;
|
|
61
|
+
iconSize: number;
|
|
62
|
+
boxShadow?: string;
|
|
63
|
+
sx?: SxProps<Theme>;
|
|
64
|
+
children?: ReactNode;
|
|
65
|
+
};
|
|
66
|
+
export declare const AnimationBadge: ({ size, base, contrast, iconSize, boxShadow, sx, children, }: AnimationBadgeProps) => import("react").JSX.Element;
|
|
67
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Translated accessible names for the status animations (`StatusIcon`,
|
|
3
|
+
* `StatusAnimation`, `CheckAnimation`, `PulseAnimation`). Each component takes
|
|
4
|
+
* a label prop so a consumer can say something more specific than "loading".
|
|
5
|
+
*/
|
|
6
|
+
export declare const useAnimationLabels: () => Record<"pending" | "loading" | "done" | "confirmed", string>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ButtonProps as MuiButtonProps } from '@mui/material';
|
|
2
|
+
import { ElementType } from 'react';
|
|
3
|
+
type ActionButtonProps<C extends ElementType = "button"> = Omit<MuiButtonProps<C>, "variant"> & {
|
|
4
|
+
component?: C;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* A pill-shaped call-to-action button with a built-in arrow icon.
|
|
8
|
+
*
|
|
9
|
+
* Used for primary navigation actions on the website, such as hero sections
|
|
10
|
+
* and landing pages. Supports polymorphic rendering:
|
|
11
|
+
*
|
|
12
|
+
* ```tsx
|
|
13
|
+
* <ActionButton component={Link} to="/loans">Se våra lån</ActionButton>
|
|
14
|
+
* <ActionButton component={NextLink} href="/loans">Se våra lån</ActionButton>
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export declare const ActionButton: ({ children, ...rest }: ActionButtonProps) => import("react").JSX.Element;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ButtonProps as MuiButtonProps } from '@mui/material';
|
|
2
|
+
import { ElementType } from 'react';
|
|
3
|
+
type ButtonProps<C extends ElementType = "button"> = MuiButtonProps<C> & {
|
|
4
|
+
/** The component to render the button as. */
|
|
5
|
+
component?: C;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* A standard button component.
|
|
9
|
+
*
|
|
10
|
+
* Supports polymorphic rendering via the `component` prop, which enables
|
|
11
|
+
* type-safe usage with any router link component:
|
|
12
|
+
*
|
|
13
|
+
* ```tsx
|
|
14
|
+
* <Button component={Link} to="/about">About</Button> // React Router
|
|
15
|
+
* <Button component={NextLink} href="/about">About</Button> // Next.js
|
|
16
|
+
* <Button href="/about">About</Button> // Plain anchor
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare const Button: ({ variant, size, children, ...rest }: ButtonProps) => import("react").JSX.Element;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { DownloadDataSource } from '../../utils/downloadFile';
|
|
2
|
+
import { ButtonProps as MuiButtonProps } from '@mui/material';
|
|
3
|
+
import { ElementType } from 'react';
|
|
4
|
+
type DownloadTriggerProps<C extends ElementType = "button"> = Omit<MuiButtonProps<C>, "onClick"> & {
|
|
5
|
+
component?: C;
|
|
6
|
+
/** File contents, or a function/promise that resolves to them. */
|
|
7
|
+
data: DownloadDataSource;
|
|
8
|
+
/** File name. */
|
|
9
|
+
fileName: string;
|
|
10
|
+
/** MIME type. */
|
|
11
|
+
mimeType?: string;
|
|
12
|
+
/** Callback for when the download starts. */
|
|
13
|
+
onDownload?: () => void;
|
|
14
|
+
/** Callback for when the download fails. */
|
|
15
|
+
onDownloadError?: (error: unknown) => void;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* A button that triggers a download of a file.
|
|
19
|
+
*
|
|
20
|
+
* Supports polymorphic rendering via the `component` prop, which enables
|
|
21
|
+
* type-safe usage with any router link component:
|
|
22
|
+
*
|
|
23
|
+
* ```tsx
|
|
24
|
+
* <DownloadTrigger component={Link} to="/about">About</DownloadTrigger>
|
|
25
|
+
* <DownloadTrigger component={NextLink} href="/about">About</DownloadTrigger>
|
|
26
|
+
* <DownloadTrigger href="/about">About</DownloadTrigger>
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* Without `children` the label is the translated word for "download" in the
|
|
30
|
+
* `LeaProvider` language.
|
|
31
|
+
*/
|
|
32
|
+
export declare const DownloadTrigger: ({ data, fileName, mimeType, onDownload, onDownloadError, loading: loadingProp, disabled, children, ...rest }: DownloadTriggerProps) => import("react").JSX.Element;
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IconButtonProps as MuiIconButtonProps } from '@mui/material';
|
|
2
|
+
import { ElementType } from 'react';
|
|
3
|
+
type IconButtonProps<C extends ElementType = "button"> = MuiIconButtonProps<C> & {
|
|
4
|
+
component?: C;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* An icon-only button styled with Lea's design tokens. Because it has no
|
|
8
|
+
* visible text, always pass an `aria-label` so the control has an accessible
|
|
9
|
+
* name.
|
|
10
|
+
*/
|
|
11
|
+
export declare const IconButton: ({ ...rest }: IconButtonProps) => import("react").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { CardProps as MuiCardProps } from '@mui/material';
|
|
2
|
+
/**
|
|
3
|
+
* A surface container that wraps MUI `Card` with Lea's design tokens for
|
|
4
|
+
* radius, elevation, and colours. Use it to group related content on a page.
|
|
5
|
+
*/
|
|
6
|
+
export declare const Card: ({ ...props }: MuiCardProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ChipProps as MuiChipProps } from '@mui/material';
|
|
2
|
+
export type ChipProps = MuiChipProps;
|
|
3
|
+
/**
|
|
4
|
+
* A compact label for tags, statuses, or filter selections, styled with Lea's
|
|
5
|
+
* design tokens on top of MUI `Chip`.
|
|
6
|
+
*
|
|
7
|
+
* With `onDelete`, the delete affordance is named in the `LeaProvider` language
|
|
8
|
+
* and includes the chip's own label, so a row of chips reads unambiguously.
|
|
9
|
+
* Pass `deleteIcon` to supply a different glyph and name.
|
|
10
|
+
*/
|
|
11
|
+
export declare const Chip: ({ label, onDelete, deleteIcon, ...rest }: ChipProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BoxProps } from '@mui/material';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
export type DataFieldProps = Omit<BoxProps, "children"> & {
|
|
4
|
+
label: ReactNode;
|
|
5
|
+
value: ReactNode;
|
|
6
|
+
divider?: boolean;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* A single label/value row for presenting read-only details, with an optional
|
|
10
|
+
* bottom divider so several fields can be stacked into a summary list.
|
|
11
|
+
*/
|
|
12
|
+
export declare const DataField: ({ label, value, divider, sx, ...rest }: DataFieldProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { TooltipProps as MuiTooltipProps } from '@mui/material';
|
|
2
|
+
import { SxProps, Theme } from '@mui/material/styles';
|
|
3
|
+
import { ReactElement, ReactNode } from 'react';
|
|
4
|
+
import { TooltipSurfaceVariant, TooltipTriggerVariant } from '../../theme/components/tooltip.theme';
|
|
5
|
+
export type { TooltipSurfaceVariant, TooltipTriggerVariant };
|
|
6
|
+
type WrappedTooltipProps = Omit<MuiTooltipProps, "children"> & {
|
|
7
|
+
children: ReactElement;
|
|
8
|
+
ariaLabel?: never;
|
|
9
|
+
triggerIcon?: never;
|
|
10
|
+
triggerVariant?: never;
|
|
11
|
+
triggerSx?: never;
|
|
12
|
+
surfaceVariant?: TooltipSurfaceVariant;
|
|
13
|
+
};
|
|
14
|
+
type TriggerTooltipProps = Omit<MuiTooltipProps, "children"> & {
|
|
15
|
+
children?: never;
|
|
16
|
+
/** Accessible name for the built-in trigger button. */
|
|
17
|
+
ariaLabel: string;
|
|
18
|
+
/** Trigger icon or content. Defaults to `InfoIcon`. */
|
|
19
|
+
triggerIcon?: ReactNode;
|
|
20
|
+
/** Visual style of the built-in trigger button. @default "icon" */
|
|
21
|
+
triggerVariant?: TooltipTriggerVariant;
|
|
22
|
+
/** Optional `sx` override for the built-in trigger button. */
|
|
23
|
+
triggerSx?: SxProps<Theme>;
|
|
24
|
+
/** Tooltip bubble colour treatment. @default "light" */
|
|
25
|
+
surfaceVariant?: TooltipSurfaceVariant;
|
|
26
|
+
};
|
|
27
|
+
export type TooltipProps = WrappedTooltipProps | TriggerTooltipProps;
|
|
28
|
+
/**
|
|
29
|
+
* Tooltip wrapper around MUI's `Tooltip`.
|
|
30
|
+
*
|
|
31
|
+
* Use it two ways:
|
|
32
|
+
* - **Wrapped child:** pass `children` to decorate any trigger you already have.
|
|
33
|
+
* - **Built-in trigger:** omit `children` and pass `ariaLabel`; a small trigger
|
|
34
|
+
* button is rendered for you, styled by `triggerVariant` and optionally
|
|
35
|
+
* extended via `triggerSx`.
|
|
36
|
+
*/
|
|
37
|
+
export declare const Tooltip: ({ title, placement, children, ariaLabel, triggerIcon, triggerVariant, triggerSx, surfaceVariant, slotProps, id: suppliedId, ...rest }: TooltipProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
/** A selectable country. Provide between 2 and 4. */
|
|
3
|
+
export type DevPanelCountryOption<T extends string> = {
|
|
4
|
+
/** The value reported to `onChange` (e.g. an ISO code). */
|
|
5
|
+
value: T;
|
|
6
|
+
/** Country name shown in the pill. */
|
|
7
|
+
label: ReactNode;
|
|
8
|
+
/** Optional short code shown, muted, before the name (e.g. `"SE"`). */
|
|
9
|
+
code?: ReactNode;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
};
|
|
12
|
+
export type DevPanelCountryProps<T extends string> = {
|
|
13
|
+
/** The selected country (fully controlled). */
|
|
14
|
+
value: T;
|
|
15
|
+
/** Called with the newly selected country. */
|
|
16
|
+
onChange: (value: T) => void;
|
|
17
|
+
/** 2-4 country options. */
|
|
18
|
+
options: DevPanelCountryOption<T>[];
|
|
19
|
+
/** Section heading. Defaults to `"Country"`. */
|
|
20
|
+
label?: ReactNode;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Segmented country selector. Renders each option as a pill with an optional
|
|
24
|
+
* muted code before the name. Single-select and fully controlled.
|
|
25
|
+
*/
|
|
26
|
+
export declare function DevPanelCountry<T extends string>({ value, onChange, options, label, }: DevPanelCountryProps<T>): import("react").JSX.Element;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export type DevPanelFlowProps = {
|
|
3
|
+
/** Flow identifier (e.g. a short hash). */
|
|
4
|
+
flowId?: ReactNode;
|
|
5
|
+
/** Process name (e.g. `"loan-se"`). */
|
|
6
|
+
process?: ReactNode;
|
|
7
|
+
/** Variant name (e.g. `"refinance"`). */
|
|
8
|
+
variant?: ReactNode;
|
|
9
|
+
/** Leading label. Defaults to `"Flow"`. */
|
|
10
|
+
label?: ReactNode;
|
|
11
|
+
/** Show the copy button. Defaults to `true`. */
|
|
12
|
+
showCopy?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* String written to the clipboard. Defaults to the string parts joined by
|
|
15
|
+
* `" · "`.
|
|
16
|
+
*/
|
|
17
|
+
copyValue?: string;
|
|
18
|
+
/** Accessible name for the copy button. Defaults to a translated label. */
|
|
19
|
+
copyLabel?: string;
|
|
20
|
+
/** Called after a successful copy. */
|
|
21
|
+
onCopy?: () => void;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* The flow header row: an uppercase label followed by the `id · process ·
|
|
25
|
+
* variant` breadcrumb and a copy button. Copy success is announced via a
|
|
26
|
+
* `role="status"` live region.
|
|
27
|
+
*/
|
|
28
|
+
export declare function DevPanelFlow({ flowId, process, variant, label, showCopy, copyValue, copyLabel, onCopy, }: DevPanelFlowProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export type DevPanelFooterProps = {
|
|
3
|
+
/** Called when "Reseed" is pressed. Omit to hide the button. */
|
|
4
|
+
onReseed?: () => void;
|
|
5
|
+
/** Label for the reseed button. Defaults to `"Reseed"`. */
|
|
6
|
+
reseedLabel?: ReactNode;
|
|
7
|
+
/** Called when "Copy URL" is pressed. Omit to hide the button. */
|
|
8
|
+
onCopyUrl?: () => void;
|
|
9
|
+
/** When set, this URL is written to the clipboard before `onCopyUrl` fires. */
|
|
10
|
+
url?: string;
|
|
11
|
+
/** Label for the copy-URL button. Defaults to `"Copy URL"`. */
|
|
12
|
+
copyUrlLabel?: ReactNode;
|
|
13
|
+
/** Called when "Console" is pressed. Omit to hide the button. */
|
|
14
|
+
onConsole?: () => void;
|
|
15
|
+
/** Label for the console button. Defaults to `"Console"`. */
|
|
16
|
+
consoleLabel?: ReactNode;
|
|
17
|
+
/** Extra actions appended after the built-in buttons. */
|
|
18
|
+
children?: ReactNode;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* The footer action row. Renders a button only for each callback provided, so
|
|
22
|
+
* apps opt into just the actions they support. `Copy URL` writes `url` to the
|
|
23
|
+
* clipboard (when given) before invoking `onCopyUrl`. Extra `children` are
|
|
24
|
+
* appended after the built-ins.
|
|
25
|
+
*/
|
|
26
|
+
export declare function DevPanelFooter({ onReseed, reseedLabel, onCopyUrl, url, copyUrlLabel, onConsole, consoleLabel, children, }: DevPanelFooterProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export type DevPanelPayloadProps = {
|
|
3
|
+
/**
|
|
4
|
+
* The payload to preview. Objects are pretty-printed as JSON; strings are
|
|
5
|
+
* shown verbatim.
|
|
6
|
+
*/
|
|
7
|
+
value: unknown;
|
|
8
|
+
/** Label on the toggle. Defaults to `"Payload preview"`. */
|
|
9
|
+
label?: ReactNode;
|
|
10
|
+
/** Heading of the expanded dark panel. Defaults to `label`. */
|
|
11
|
+
title?: ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* Where the payload opens. `"inline"` (default) expands a dark panel below the
|
|
14
|
+
* toggle; `"side"` opens a floating panel beside the `DevPanel` as a dialog
|
|
15
|
+
* (dismissed with Escape or a click outside).
|
|
16
|
+
*/
|
|
17
|
+
placement?: "inline" | "side";
|
|
18
|
+
/** Optional pill in the side flyout header, e.g. `"live"`. Ignored inline. */
|
|
19
|
+
badge?: ReactNode;
|
|
20
|
+
/** Controlled open state. Omit for uncontrolled. */
|
|
21
|
+
open?: boolean;
|
|
22
|
+
/** Initial open state when uncontrolled. Defaults to `false`. */
|
|
23
|
+
defaultOpen?: boolean;
|
|
24
|
+
/** Called whenever the open state changes. */
|
|
25
|
+
onOpenChange?: (open: boolean) => void;
|
|
26
|
+
/** Accessible name for the copy button. Defaults to a translated label. */
|
|
27
|
+
copyLabel?: string;
|
|
28
|
+
/** Visible label for the side flyout's copy action. Defaults to a translated label. */
|
|
29
|
+
copyJsonLabel?: string;
|
|
30
|
+
/** Accessible name for the side flyout's close button. Defaults to a translated label. */
|
|
31
|
+
closeLabel?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Syntax-highlight JSON payloads. Defaults to `true`. Non-JSON strings always
|
|
34
|
+
* render verbatim. Set `false` for the plain single-colour view.
|
|
35
|
+
*/
|
|
36
|
+
highlight?: boolean;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* A payload preview. The toggle is a disclosure (`aria-expanded`/`aria-controls`)
|
|
40
|
+
* that reveals the pretty-printed JSON with a copy control; copy success is
|
|
41
|
+
* announced via a `role="status"` live region. With `placement="inline"`
|
|
42
|
+
* (default) it expands a dark panel below the toggle; with `placement="side"` it
|
|
43
|
+
* opens a floating dialog beside the panel (Escape / click-outside to close,
|
|
44
|
+
* focus moves in and returns to the toggle on close). Uncontrolled by default;
|
|
45
|
+
* drive it with `open`/`onOpenChange` when needed.
|
|
46
|
+
*/
|
|
47
|
+
export declare function DevPanelPayload({ value, label, title, placement, badge, open, defaultOpen, onOpenChange, copyLabel, copyJsonLabel, closeLabel, highlight, }: DevPanelPayloadProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { DevPanelStatusColor } from '../../theme/components/dev-panel.theme';
|
|
3
|
+
export type { DevPanelStatusColor };
|
|
4
|
+
/** A selectable application status. */
|
|
5
|
+
export type DevPanelStatusOption<T extends string> = {
|
|
6
|
+
value: T;
|
|
7
|
+
label: ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* Colour of the leading dot / selected border. Defaults to `"neutral"`. The
|
|
10
|
+
* dot is decorative — status is always conveyed by the label text too, so it
|
|
11
|
+
* never relies on colour alone.
|
|
12
|
+
*/
|
|
13
|
+
color?: DevPanelStatusColor;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
};
|
|
16
|
+
export type DevPanelStatusProps<T extends string> = {
|
|
17
|
+
/** The selected status (fully controlled). */
|
|
18
|
+
value: T;
|
|
19
|
+
/** Called with the newly selected status. */
|
|
20
|
+
onChange: (value: T) => void;
|
|
21
|
+
options: DevPanelStatusOption<T>[];
|
|
22
|
+
/** Section heading. Defaults to `"Application status"`. */
|
|
23
|
+
label?: ReactNode;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* A radio grid for the application status. Each card carries a decorative
|
|
27
|
+
* coloured dot mapped to a status token; the status is always spelled out in the
|
|
28
|
+
* label so it is never signalled by colour alone. Single-select and fully
|
|
29
|
+
* controlled.
|
|
30
|
+
*/
|
|
31
|
+
export declare function DevPanelStatus<T extends string>({ value, onChange, options, label, }: DevPanelStatusProps<T>): import("react").JSX.Element;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
/** A selectable variation of the current step. */
|
|
3
|
+
export type DevPanelStepStateOption<T extends string> = {
|
|
4
|
+
value: T;
|
|
5
|
+
label: ReactNode;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export type DevPanelStepStateProps<T extends string> = {
|
|
9
|
+
/** The selected step-state variation (fully controlled). */
|
|
10
|
+
value: T;
|
|
11
|
+
/** Called with the newly selected variation. */
|
|
12
|
+
onChange: (value: T) => void;
|
|
13
|
+
options: DevPanelStepStateOption<T>[];
|
|
14
|
+
/** Section heading. Defaults to `"Step state"`. */
|
|
15
|
+
label?: ReactNode;
|
|
16
|
+
/**
|
|
17
|
+
* Name of the step the variations belong to (e.g. `"Skulder"`). When set, a
|
|
18
|
+
* `"{variationsLabel} {stepLabel}"` line is shown above the chips.
|
|
19
|
+
*/
|
|
20
|
+
stepLabel?: ReactNode;
|
|
21
|
+
/** Prefix for the step-label line. Defaults to `"Variations for"`. */
|
|
22
|
+
variationsLabel?: ReactNode;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Segmented chips for the different states/variations of the current step (e.g.
|
|
26
|
+
* required debts / voluntary / no debts). Single-select and fully controlled.
|
|
27
|
+
*/
|
|
28
|
+
export declare function DevPanelStepState<T extends string>({ value, onChange, options, label, stepLabel, variationsLabel, }: DevPanelStepStateProps<T>): import("react").JSX.Element;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { StepCircleState } from '../../theme/components/dev-panel.theme';
|
|
3
|
+
/** A single step in the jump-to-step grid. */
|
|
4
|
+
export type DevPanelStep = {
|
|
5
|
+
/** Short label shown beneath the circle (e.g. `"Skulder"`). */
|
|
6
|
+
label: ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* Explicit visual state. When omitted it is derived from `currentStep`
|
|
9
|
+
* (before → `complete`, at → `current`, after → `upcoming`).
|
|
10
|
+
*/
|
|
11
|
+
status?: StepCircleState;
|
|
12
|
+
/** Marks the step with a warning dot (e.g. it needs attention). */
|
|
13
|
+
flagged?: boolean;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
};
|
|
16
|
+
export type DevPanelStepsProps = {
|
|
17
|
+
/** The ordered steps. */
|
|
18
|
+
steps: DevPanelStep[];
|
|
19
|
+
/**
|
|
20
|
+
* The active step (1-based). Drives the count and, for any step without an
|
|
21
|
+
* explicit `status`, the derived complete/current/upcoming state.
|
|
22
|
+
*/
|
|
23
|
+
currentStep?: number;
|
|
24
|
+
/** Called when a step is chosen, with its 1-based number and the step. */
|
|
25
|
+
onStepSelect?: (step: number, item: DevPanelStep) => void;
|
|
26
|
+
/** Section heading. Defaults to `"Jump to step"`. */
|
|
27
|
+
label?: ReactNode;
|
|
28
|
+
/** Show the `currentStep / total` count in the heading. Defaults to `true`. */
|
|
29
|
+
showCount?: boolean;
|
|
30
|
+
/** Number of step circles per row. Defaults to `4`. */
|
|
31
|
+
columns?: number;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* A grid of numbered step circles for jumping between form steps. Completed
|
|
35
|
+
* steps show a check, the current step is filled, and a warning dot flags steps
|
|
36
|
+
* that need attention. Fully controlled: the consumer supplies the steps and the
|
|
37
|
+
* active step, and handles selection.
|
|
38
|
+
*/
|
|
39
|
+
export declare function DevPanelSteps({ steps, currentStep, onStepSelect, label, showCount, columns, }: DevPanelStepsProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
/** A selectable flow variant. */
|
|
3
|
+
export type DevPanelVariantOption<T extends string> = {
|
|
4
|
+
value: T;
|
|
5
|
+
label: ReactNode;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export type DevPanelVariantProps<T extends string> = {
|
|
9
|
+
/** The selected variant (fully controlled). */
|
|
10
|
+
value: T;
|
|
11
|
+
/** Called with the newly selected variant. */
|
|
12
|
+
onChange: (value: T) => void;
|
|
13
|
+
options: DevPanelVariantOption<T>[];
|
|
14
|
+
/** Section heading. Defaults to `"Variant"`. */
|
|
15
|
+
label?: ReactNode;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Segmented flow-variant selector (e.g. cash loan / refinance / top-up).
|
|
19
|
+
* Single-select and fully controlled.
|
|
20
|
+
*/
|
|
21
|
+
export declare function DevPanelVariant<T extends string>({ value, onChange, options, label, }: DevPanelVariantProps<T>): import("react").JSX.Element;
|