@oslokommune/punkt-react 19.18.3 → 19.18.5
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 +5 -0
- package/dist/components/loader/Loader.d.ts +3 -32
- package/dist/components/loader/Loader.js +28 -27
- package/dist/punkt-react.cjs +1 -1
- package/dist/shared-types/index.d.ts +2 -0
- package/dist/shared-types/index.js +8 -7
- package/dist/shared-types/loader.d.ts +48 -0
- package/dist/shared-types/loader.js +11 -0
- package/package.json +2 -2
- package/src/components/loader/Loader.tsx +15 -38
|
@@ -23,6 +23,8 @@ export { CONSENT_TRIGGER_TYPES, CONSENT_TRIGGER_TYPE_OPTIONS, CONSENT_DEFAULTS }
|
|
|
23
23
|
export type { TPktConsentTriggerType, IConsentItem, IConsentValue, ICookieConsentEvent, TConsentDetailsMap, TCookieEventHandler, ICookieEvents, ICookieBannerApi, IPktConsentBase, IConsentSpecProps, } from './consent';
|
|
24
24
|
export { ANIMATION_DEFAULT_PATH, ICON_DEFAULT_PATH, ICON_SIZE_CLASSES, ICON_DEFAULTS } from './icon';
|
|
25
25
|
export type { TIconSizeClass, IPktIconBase, IIconSpecProps } from './icon';
|
|
26
|
+
export { LOADER_VARIANTS, LOADER_DEFAULTS } from './loader';
|
|
27
|
+
export type { TPktLoaderVariant, IPktLoaderBase, ILoaderSpecProps } from './loader';
|
|
26
28
|
export { LAYOUT_DIRECTIONS } from './layout';
|
|
27
29
|
export type { TLayout, TVerticalPosition, THorizontalPosition, TPosition, TPositionWithCenter, } from './layout';
|
|
28
30
|
export type { THTMLButtonType, TSelectionMode } from './form';
|
|
@@ -7,12 +7,13 @@ import { RADIOBUTTON_DEFAULTS as o } from "./radiobutton.js";
|
|
|
7
7
|
import { OPTION_GROUP_DEFAULTS as s } from "./option-group.js";
|
|
8
8
|
import { CONSENT_DEFAULTS as c } from "./consent.js";
|
|
9
9
|
import { ANIMATION_DEFAULT_PATH as l, ICON_DEFAULTS as u } from "./icon.js";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
10
|
+
import { LOADER_DEFAULTS as d } from "./loader.js";
|
|
11
|
+
import { ACCORDION_LIGHT_ONLY_SKINS as f } from "./accordion.js";
|
|
12
|
+
import { INPUT_WRAPPER_DEFAULTS as p } from "./input-wrapper.js";
|
|
13
|
+
import { TEXTAREA_DEFAULTS as m } from "./textarea.js";
|
|
14
|
+
import { MESSAGEBOX_DEFAULTS as h } from "./messagebox.js";
|
|
14
15
|
import "./calendar.js";
|
|
15
16
|
import "./combobox.js";
|
|
16
|
-
import { SELECT_DEFAULTS as
|
|
17
|
-
import { TABLE_DEFAULTS as
|
|
18
|
-
export {
|
|
17
|
+
import { SELECT_DEFAULTS as g } from "./select.js";
|
|
18
|
+
import { TABLE_DEFAULTS as _ } from "./table.js";
|
|
19
|
+
export { f as ACCORDION_LIGHT_ONLY_SKINS, l as ANIMATION_DEFAULT_PATH, i as CARD_DEFAULTS, a as CHECKBOX_DEFAULTS, c as CONSENT_DEFAULTS, n as DEFAULT_FOOTER_PERSONVERN_URL, r as DEFAULT_FOOTER_TILGJENGELIGHET_URL, e as DEFAULT_HEADER_FOOTER_URL, t as DEFAULT_HEADER_LOGO_LINK, u as ICON_DEFAULTS, p as INPUT_WRAPPER_DEFAULTS, d as LOADER_DEFAULTS, h as MESSAGEBOX_DEFAULTS, s as OPTION_GROUP_DEFAULTS, o as RADIOBUTTON_DEFAULTS, g as SELECT_DEFAULTS, _ as TABLE_DEFAULTS, m as TEXTAREA_DEFAULTS };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { TPktSizeBase } from './size';
|
|
2
|
+
/** Loader variants — shared runtime source for types, specs, and Preview. */
|
|
3
|
+
export declare const LOADER_VARIANTS: readonly ['rainbow', 'blue', 'shapes'];
|
|
4
|
+
export type TPktLoaderVariant = (typeof LOADER_VARIANTS)[number];
|
|
5
|
+
export interface IPktLoaderBase {
|
|
6
|
+
/**
|
|
7
|
+
* Tid i millisekunder før loader vises. Nyttig når lastetiden kan være
|
|
8
|
+
* så kort at loader ikke trengs.
|
|
9
|
+
*/
|
|
10
|
+
delay?: number;
|
|
11
|
+
/**
|
|
12
|
+
* Vises loader inline eller som blokk.
|
|
13
|
+
*/
|
|
14
|
+
inline?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Styrer om loader eller barnenoder vises. Når `false` vises barnenoder.
|
|
17
|
+
*/
|
|
18
|
+
isLoading?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Meldingstekst som vises sammen med loader.
|
|
21
|
+
*/
|
|
22
|
+
message?: string | null;
|
|
23
|
+
/**
|
|
24
|
+
* Størrelse på loader. Standard er "medium".
|
|
25
|
+
*/
|
|
26
|
+
size?: TPktSizeBase;
|
|
27
|
+
/**
|
|
28
|
+
* Loader-variant. Standard er "rainbow". "shapes" er Oslo-bølgene, "blue" en blå spinner.
|
|
29
|
+
*/
|
|
30
|
+
variant?: TPktLoaderVariant;
|
|
31
|
+
/**
|
|
32
|
+
* Overstyrer stien til loader-animasjoner.
|
|
33
|
+
*/
|
|
34
|
+
loadingAnimationPath?: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Documented Loader props (subset of `IPktLoaderBase`).
|
|
38
|
+
* Used for typed component specs in documentation.
|
|
39
|
+
*/
|
|
40
|
+
export type ILoaderSpecProps = Pick<IPktLoaderBase, 'message' | 'size' | 'variant' | 'delay' | 'inline' | 'isLoading' | 'loadingAnimationPath'>;
|
|
41
|
+
export declare const LOADER_DEFAULTS: {
|
|
42
|
+
readonly delay: 0;
|
|
43
|
+
readonly inline: false;
|
|
44
|
+
readonly isLoading: true;
|
|
45
|
+
readonly message: any;
|
|
46
|
+
readonly size: 'medium';
|
|
47
|
+
readonly variant: 'rainbow';
|
|
48
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oslokommune/punkt-react",
|
|
3
|
-
"version": "19.18.
|
|
3
|
+
"version": "19.18.5",
|
|
4
4
|
"description": "React komponentbibliotek til Punkt, designsystem for Oslo kommune",
|
|
5
5
|
"homepage": "https://punkt.oslo.kommune.no",
|
|
6
6
|
"author": "Team Designsystem, Oslo kommune",
|
|
@@ -103,5 +103,5 @@
|
|
|
103
103
|
"url": "https://github.com/oslokommune/punkt/issues"
|
|
104
104
|
},
|
|
105
105
|
"license": "MIT",
|
|
106
|
-
"gitHead": "
|
|
106
|
+
"gitHead": "cb396444142fc6b2bdcabfcfaf500ef5003bc7e1"
|
|
107
107
|
}
|
|
@@ -2,7 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
import classNames from 'classnames'
|
|
4
4
|
import { forwardRef, HTMLAttributes, ReactNode, useEffect, useState } from 'react'
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
ANIMATION_DEFAULT_PATH,
|
|
7
|
+
LOADER_DEFAULTS,
|
|
8
|
+
type IPktLoaderBase,
|
|
9
|
+
type TPktLoaderVariant,
|
|
10
|
+
type TPktSizeBase,
|
|
11
|
+
} from 'shared-types'
|
|
6
12
|
|
|
7
13
|
import { PktIcon } from '../icon/Icon'
|
|
8
14
|
|
|
@@ -16,39 +22,10 @@ if (typeof window !== 'undefined') {
|
|
|
16
22
|
window.pktAnimationPath = window.pktAnimationPath || ANIMATION_DEFAULT_PATH
|
|
17
23
|
}
|
|
18
24
|
|
|
19
|
-
export type TPktLoaderVariant
|
|
25
|
+
export type { TPktLoaderVariant }
|
|
20
26
|
export type TPktLoaderSize = TPktSizeBase
|
|
21
27
|
|
|
22
|
-
export interface IPktLoader extends HTMLAttributes<HTMLDivElement> {
|
|
23
|
-
/**
|
|
24
|
-
* Tid i millisekunder før loader vises. Nyttig når lastetiden kan være
|
|
25
|
-
* så kort at loader ikke trengs.
|
|
26
|
-
*/
|
|
27
|
-
delay?: number
|
|
28
|
-
/**
|
|
29
|
-
* Vises loader inline eller som blokk.
|
|
30
|
-
*/
|
|
31
|
-
inline?: boolean
|
|
32
|
-
/**
|
|
33
|
-
* Styrer om loader eller barnenoder vises. Når `false` vises barnenoder.
|
|
34
|
-
*/
|
|
35
|
-
isLoading?: boolean
|
|
36
|
-
/**
|
|
37
|
-
* Meldingstekst som vises sammen med loader.
|
|
38
|
-
*/
|
|
39
|
-
message?: string | null
|
|
40
|
-
/**
|
|
41
|
-
* Størrelse på loader. Standard er "medium".
|
|
42
|
-
*/
|
|
43
|
-
size?: TPktLoaderSize
|
|
44
|
-
/**
|
|
45
|
-
* Loader-variant. Standard er "rainbow". "shapes" er Oslo-bølgene, "blue" en blå spinner.
|
|
46
|
-
*/
|
|
47
|
-
variant?: TPktLoaderVariant
|
|
48
|
-
/**
|
|
49
|
-
* Overstyrer stien til loader-animasjoner.
|
|
50
|
-
*/
|
|
51
|
-
loadingAnimationPath?: string
|
|
28
|
+
export interface IPktLoader extends IPktLoaderBase, HTMLAttributes<HTMLDivElement> {
|
|
52
29
|
children?: ReactNode
|
|
53
30
|
}
|
|
54
31
|
|
|
@@ -65,12 +42,12 @@ const variantIcon = (variant: TPktLoaderVariant): string => {
|
|
|
65
42
|
|
|
66
43
|
export const PktLoader = forwardRef<HTMLDivElement, IPktLoader>(function PktLoader(
|
|
67
44
|
{
|
|
68
|
-
delay =
|
|
69
|
-
inline =
|
|
70
|
-
isLoading =
|
|
71
|
-
message =
|
|
72
|
-
size =
|
|
73
|
-
variant =
|
|
45
|
+
delay = LOADER_DEFAULTS.delay,
|
|
46
|
+
inline = LOADER_DEFAULTS.inline,
|
|
47
|
+
isLoading = LOADER_DEFAULTS.isLoading,
|
|
48
|
+
message = LOADER_DEFAULTS.message,
|
|
49
|
+
size = LOADER_DEFAULTS.size,
|
|
50
|
+
variant = LOADER_DEFAULTS.variant,
|
|
74
51
|
loadingAnimationPath = typeof window !== 'undefined' ? window.pktAnimationPath : ANIMATION_DEFAULT_PATH,
|
|
75
52
|
className,
|
|
76
53
|
children,
|