@leabankab/component-library 8.10.0 → 8.12.0
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 +17 -0
- package/dist/component-library.es.js +1247 -1225
- package/dist/component-library.es.js.map +1 -1
- package/dist/component-library.umd.js +2 -2
- package/dist/component-library.umd.js.map +1 -1
- package/dist/components/animations/index.d.ts +5 -2
- package/dist/components/animations/loader/loader.d.ts +43 -0
- package/dist/components/animations/pulse-animation/pulse-animation.d.ts +21 -0
- package/dist/components/animations/{illustrations → status-animation}/status-animation.d.ts +7 -6
- package/dist/components/feedback/alert-parts.d.ts +1 -1
- package/dist/i18n/languages.d.ts +34 -0
- package/dist/index.css +1 -1
- package/dist/next-intl/index.d.ts +21 -0
- package/dist/next-intl/lea-intl-provider.d.ts +35 -0
- package/dist/next-intl/server.d.ts +24 -0
- package/dist/next-intl/texts.d.ts +77 -0
- package/dist/next-intl/use-texts.d.ts +28 -0
- package/dist/next-intl-server.mjs +11 -0
- package/dist/next-intl-server.mjs.map +1 -0
- package/dist/next-intl-texts-De3tiuSm.mjs +25 -0
- package/dist/next-intl-texts-De3tiuSm.mjs.map +1 -0
- package/dist/next-intl.mjs +37 -0
- package/dist/next-intl.mjs.map +1 -0
- package/dist/theme/tokens/text-styles.d.ts +1 -1
- package/package.json +15 -2
- package/dist/components/animations/icons/index.d.ts +0 -1
- package/dist/components/animations/illustrations/index.d.ts +0 -3
- package/dist/components/animations/illustrations/pulse-animation.d.ts +0 -16
- /package/dist/components/animations/{illustrations → check-animation}/check-animation.d.ts +0 -0
- /package/dist/components/animations/{icons → status-icon}/status-icon.d.ts +0 -0
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './
|
|
1
|
+
export * from './check-animation/check-animation';
|
|
2
|
+
export * from './loader/loader';
|
|
3
|
+
export * from './pulse-animation/pulse-animation';
|
|
4
|
+
export * from './status-animation/status-animation';
|
|
5
|
+
export * from './status-icon/status-icon';
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { AnimationColor, AnimationSize } from '../shared';
|
|
2
|
+
export type LoaderStatus = "loading" | "done";
|
|
3
|
+
export type LoaderProps = {
|
|
4
|
+
/**
|
|
5
|
+
* `"loading"` shows the pulse. `"done"` cross-fades into the check and fires
|
|
6
|
+
* its one-time confetti.
|
|
7
|
+
* @default "loading"
|
|
8
|
+
*/
|
|
9
|
+
status?: LoaderStatus;
|
|
10
|
+
/**
|
|
11
|
+
* `"sm"` is 90px, `"lg"` 150px.
|
|
12
|
+
* @default "lg"
|
|
13
|
+
*/
|
|
14
|
+
size?: AnimationSize;
|
|
15
|
+
/**
|
|
16
|
+
* Colour of the pulse and of the check (and its halo).
|
|
17
|
+
* @default "primary"
|
|
18
|
+
*/
|
|
19
|
+
color?: AnimationColor;
|
|
20
|
+
/**
|
|
21
|
+
* Minimum time (ms) the pulse stays visible once mounted in the loading
|
|
22
|
+
* state, so a very fast response doesn't make the spinner flash. The check
|
|
23
|
+
* appears as soon as `status` is `"done"` *and* this minimum has elapsed.
|
|
24
|
+
*/
|
|
25
|
+
minLoadingMs?: number;
|
|
26
|
+
/**
|
|
27
|
+
* Visually-hidden status text announced while loading. Defaults to the
|
|
28
|
+
* translated word for "loading" in the `LeaProvider` language.
|
|
29
|
+
*/
|
|
30
|
+
loadingLabel?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Visually-hidden status text announced once done. Defaults to the translated
|
|
33
|
+
* word for "done".
|
|
34
|
+
*/
|
|
35
|
+
doneLabel?: string;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* The library's loading indicator: shows {@link PulseAnimation} while
|
|
39
|
+
* `status` is `"loading"`, then cross-fades into {@link CheckAnimation}
|
|
40
|
+
* (firing its one-time confetti) once `status` becomes `"done"`. Announces
|
|
41
|
+
* state changes politely and respects `prefers-reduced-motion`.
|
|
42
|
+
*/
|
|
43
|
+
export declare const Loader: ({ status, size, color, minLoadingMs, loadingLabel, doneLabel, }: LoaderProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { AnimationColor, AnimationSize } from '../shared';
|
|
2
|
+
type PulseAnimationProps = {
|
|
3
|
+
/**
|
|
4
|
+
* `"sm"` is 90px, `"lg"` 150px.
|
|
5
|
+
* @default "lg"
|
|
6
|
+
*/
|
|
7
|
+
size?: AnimationSize;
|
|
8
|
+
/**
|
|
9
|
+
* Colour of the rings and the centre circle.
|
|
10
|
+
* @default "primary"
|
|
11
|
+
*/
|
|
12
|
+
color?: AnimationColor;
|
|
13
|
+
/**
|
|
14
|
+
* Accessible name for the spinner; defaults to the translated word for
|
|
15
|
+
* "loading" in the `LeaProvider` language. `Loader` hides the pulse from
|
|
16
|
+
* assistive tech and announces its own status text instead.
|
|
17
|
+
*/
|
|
18
|
+
label?: string;
|
|
19
|
+
};
|
|
20
|
+
export declare const PulseAnimation: ({ size, color, label, }: PulseAnimationProps) => import("react").JSX.Element;
|
|
21
|
+
export {};
|
|
@@ -8,7 +8,7 @@ type StatusAnimationProps = {
|
|
|
8
8
|
*/
|
|
9
9
|
size?: AnimationSize;
|
|
10
10
|
/**
|
|
11
|
-
* Colour of the resulting check (and its halo).
|
|
11
|
+
* Colour of the pulse and of the resulting check (and its halo).
|
|
12
12
|
* @default "primary"
|
|
13
13
|
*/
|
|
14
14
|
color?: AnimationColor;
|
|
@@ -30,10 +30,11 @@ type StatusAnimationProps = {
|
|
|
30
30
|
doneLabel?: string;
|
|
31
31
|
};
|
|
32
32
|
/**
|
|
33
|
-
* A controlled loading → success indicator:
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
33
|
+
* A controlled loading → success indicator: the pulse while `loading`, then
|
|
34
|
+
* the check once `loading` becomes `false`.
|
|
35
|
+
*
|
|
36
|
+
* @deprecated Use {@link Loader}, which renders the same thing:
|
|
37
|
+
* `<Loader status={loading ? "loading" : "done"} />`.
|
|
37
38
|
*/
|
|
38
|
-
export declare const StatusAnimation: ({ loading,
|
|
39
|
+
export declare const StatusAnimation: ({ loading, ...rest }: StatusAnimationProps) => import("react").JSX.Element;
|
|
39
40
|
export {};
|
|
@@ -52,10 +52,10 @@ export declare function resolveAlert({ severity, color, variant, size, icon, act
|
|
|
52
52
|
"data-color": AlertColor;
|
|
53
53
|
"data-variant": AlertVariant;
|
|
54
54
|
"data-size": AlertSize;
|
|
55
|
+
title?: string | undefined | undefined;
|
|
55
56
|
className?: string | undefined | undefined;
|
|
56
57
|
slot?: string | undefined | undefined;
|
|
57
58
|
style?: import('react').CSSProperties | undefined;
|
|
58
|
-
title?: string | undefined | undefined;
|
|
59
59
|
onAnimationStart?: import('react').AnimationEventHandler<HTMLDivElement> | undefined;
|
|
60
60
|
onDragStart?: import('react').DragEventHandler<HTMLDivElement> | undefined;
|
|
61
61
|
onDragEnd?: import('react').DragEventHandler<HTMLDivElement> | undefined;
|
package/dist/i18n/languages.d.ts
CHANGED
|
@@ -7,3 +7,37 @@ export declare const LANGUAGES: readonly ["no", "se", "fi", "es"];
|
|
|
7
7
|
export type Language = (typeof LANGUAGES)[number];
|
|
8
8
|
/** Fallback language used when no provider is present or a key is missing. */
|
|
9
9
|
export declare const DEFAULT_LANGUAGE = "no";
|
|
10
|
+
/**
|
|
11
|
+
* The language each first part of a locale code stands for. Bokmål, Nynorsk
|
|
12
|
+
* and Norwegian are all `no`. Swedish is `se`, the library's name for it,
|
|
13
|
+
* which some apps also use as their locale.
|
|
14
|
+
*/
|
|
15
|
+
declare const LANGUAGE_BY_SUBTAG: {
|
|
16
|
+
readonly no: "no";
|
|
17
|
+
readonly nb: "no";
|
|
18
|
+
readonly nn: "no";
|
|
19
|
+
readonly sv: "se";
|
|
20
|
+
readonly se: "se";
|
|
21
|
+
readonly fi: "fi";
|
|
22
|
+
readonly es: "es";
|
|
23
|
+
};
|
|
24
|
+
type LanguageSubtag = keyof typeof LANGUAGE_BY_SUBTAG;
|
|
25
|
+
/**
|
|
26
|
+
* The library language a locale code stands for, read from its first part:
|
|
27
|
+
* `nb`, `nb-NO`, `nn` and `no` are `"no"`; `sv`, `sv-SE` and `se` are `"se"`;
|
|
28
|
+
* `fi-FI` is `"fi"` and `es-ES` is `"es"`. `never` for a code the library has
|
|
29
|
+
* no language for, such as `en`. The type of what `toLanguage` returns.
|
|
30
|
+
*/
|
|
31
|
+
export type LanguageOfLocale<L extends string> = L extends `${infer Subtag}-${string}` ? Subtag extends LanguageSubtag ? (typeof LANGUAGE_BY_SUBTAG)[Subtag] : never : L extends LanguageSubtag ? (typeof LANGUAGE_BY_SUBTAG)[L] : never;
|
|
32
|
+
/**
|
|
33
|
+
* The library language for a locale code as an app writes it for next-intl
|
|
34
|
+
* or `Intl`, by the rules of `LanguageOfLocale`, in upper or lower case. A
|
|
35
|
+
* code the library has no language for gives `DEFAULT_LANGUAGE`.
|
|
36
|
+
*
|
|
37
|
+
* ```tsx
|
|
38
|
+
* toLanguage("nb"); // "no"
|
|
39
|
+
* toLanguage("sv-SE"); // "se"
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export declare function toLanguage(locale: string): Language;
|
|
43
|
+
export {};
|