@oslokommune/punkt-react 19.18.2 → 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 +10 -0
- package/dist/components/accordion/AccordionItem.js +1 -0
- package/dist/components/button/Button.js +1 -0
- package/dist/components/card/Card.js +1 -0
- package/dist/components/checkbox/Checkbox.js +1 -0
- package/dist/components/checkboxgroup/CheckboxGroup.js +1 -0
- package/dist/components/consent/Consent.js +1 -0
- package/dist/components/footer/Footer.js +1 -0
- package/dist/components/footerSimple/FooterSimple.js +1 -0
- package/dist/components/header/HeaderGlobal.js +1 -0
- package/dist/components/header/HeaderService.js +1 -0
- package/dist/components/header-menu/HeaderMenu.js +1 -0
- package/dist/components/icon/Icon.js +1 -0
- package/dist/components/inputwrapper/InputWrapper.js +1 -0
- package/dist/components/loader/Loader.d.ts +4 -32
- package/dist/components/loader/Loader.js +29 -27
- package/dist/components/messagebox/Messagebox.js +1 -0
- package/dist/components/modal/Modal.d.ts +2 -1
- package/dist/components/radio/RadioButton.js +1 -0
- package/dist/components/radiogroup/RadioGroup.js +1 -0
- package/dist/components/select/Select.js +1 -0
- package/dist/components/table/Table.js +1 -0
- package/dist/components/tag/Tag.d.ts +2 -2
- package/dist/components/textarea/Textarea.js +1 -0
- package/dist/components/timepicker/useTimepickerState.d.ts +1 -1
- package/dist/punkt-react.cjs +1 -1
- package/dist/shared-types/heading.d.ts +2 -1
- package/dist/shared-types/index.d.ts +4 -2
- package/dist/shared-types/index.js +19 -0
- package/dist/shared-types/loader.d.ts +48 -0
- package/dist/shared-types/loader.js +11 -0
- package/dist/shared-types/size.d.ts +4 -12
- package/dist/shared-types/size.js +9 -0
- package/package.json +2 -2
- package/src/components/loader/Loader.tsx +16 -39
- package/src/components/modal/Modal.tsx +2 -1
- package/src/components/tag/Tag.tsx +2 -2
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* Type definitions for heading-related types.
|
|
5
5
|
* These represent HTML heading semantics (h1-h6) and typography scales.
|
|
6
6
|
*/
|
|
7
|
+
import type { TPktSize } from './size';
|
|
7
8
|
export type THeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
|
|
8
|
-
export type THeadingSize =
|
|
9
|
+
export type THeadingSize = TPktSize;
|
|
9
10
|
export type THeadingWeight = 'light' | 'regular' | 'medium' | 'bold';
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export type { Booleanish } from './booleanish';
|
|
2
2
|
export { booleanishConverter, nullableBooleanishConverter } from './booleanish';
|
|
3
|
+
export { SIZES_BASE, SIZES, INPUT_SIZES } from './size';
|
|
4
|
+
export type { TPktSizeBase, TPktSize, TPktInputSize } from './size';
|
|
3
5
|
export { ARIA_LIVE_VALUES, type TAriaBoolean, type TAriaBooleanMixed, type TAriaCurrent, type TAriaHasPopup, type TAriaInvalid, type TAriaLive, type TAriaRelevant, type TAriaSort, type TAriaAutoComplete, type TAriaOrientation, type IAriaAttributes, type TAlertRole, } from './aria';
|
|
4
6
|
export { ALERT_SKINS, ALERT_SIZES, ALERT_DEFAULTS, type TAlertSkin, type TAlertSize, type IAlertSpecProps, } from './alert';
|
|
5
7
|
export type { THeadingLevel, THeadingSize, THeadingWeight } from './heading';
|
|
@@ -21,11 +23,11 @@ export { CONSENT_TRIGGER_TYPES, CONSENT_TRIGGER_TYPE_OPTIONS, CONSENT_DEFAULTS }
|
|
|
21
23
|
export type { TPktConsentTriggerType, IConsentItem, IConsentValue, ICookieConsentEvent, TConsentDetailsMap, TCookieEventHandler, ICookieEvents, ICookieBannerApi, IPktConsentBase, IConsentSpecProps, } from './consent';
|
|
22
24
|
export { ANIMATION_DEFAULT_PATH, ICON_DEFAULT_PATH, ICON_SIZE_CLASSES, ICON_DEFAULTS } from './icon';
|
|
23
25
|
export type { TIconSizeClass, IPktIconBase, IIconSpecProps } from './icon';
|
|
26
|
+
export { LOADER_VARIANTS, LOADER_DEFAULTS } from './loader';
|
|
27
|
+
export type { TPktLoaderVariant, IPktLoaderBase, ILoaderSpecProps } from './loader';
|
|
24
28
|
export { LAYOUT_DIRECTIONS } from './layout';
|
|
25
29
|
export type { TLayout, TVerticalPosition, THorizontalPosition, TPosition, TPositionWithCenter, } from './layout';
|
|
26
30
|
export type { THTMLButtonType, TSelectionMode } from './form';
|
|
27
|
-
export { INPUT_SIZES } from './size';
|
|
28
|
-
export type { TPktInputSize, TSize3, TSize5, TSize7 } from './size';
|
|
29
31
|
export { ACCORDION_LIGHT_ONLY_SKINS, ACCORDION_SKINS } from './accordion';
|
|
30
32
|
export type { TAccordionSkin, IPktAccordionBase, IPktAccordionItemBase, IAccordionSpecProps, IAccordionItemSpecProps, IAccordionVisualProps, } from './accordion';
|
|
31
33
|
export { BUTTON_SIZES, BUTTON_SKINS, BUTTON_COLORS, BUTTON_VARIANTS, BUTTON_STATES } from './button';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import "./size.js";
|
|
2
|
+
import { DEFAULT_HEADER_FOOTER_URL as e, DEFAULT_HEADER_LOGO_LINK as t } from "./header-footer.js";
|
|
3
|
+
import { DEFAULT_FOOTER_PERSONVERN_URL as n, DEFAULT_FOOTER_TILGJENGELIGHET_URL as r } from "./footer.js";
|
|
4
|
+
import { CARD_DEFAULTS as i } from "./card.js";
|
|
5
|
+
import { CHECKBOX_DEFAULTS as a } from "./checkbox.js";
|
|
6
|
+
import { RADIOBUTTON_DEFAULTS as o } from "./radiobutton.js";
|
|
7
|
+
import { OPTION_GROUP_DEFAULTS as s } from "./option-group.js";
|
|
8
|
+
import { CONSENT_DEFAULTS as c } from "./consent.js";
|
|
9
|
+
import { ANIMATION_DEFAULT_PATH as l, ICON_DEFAULTS as u } from "./icon.js";
|
|
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";
|
|
15
|
+
import "./calendar.js";
|
|
16
|
+
import "./combobox.js";
|
|
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
|
+
};
|
|
@@ -4,18 +4,10 @@
|
|
|
4
4
|
* Type definitions for sizing scales.
|
|
5
5
|
* These represent common size scales used across the design system.
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export type
|
|
11
|
-
/**
|
|
12
|
-
* Extended 5-level size scale
|
|
13
|
-
*/
|
|
14
|
-
export type TSize5 = 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge';
|
|
15
|
-
/**
|
|
16
|
-
* Full 7-level size scale
|
|
17
|
-
*/
|
|
18
|
-
export type TSize7 = 'xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge';
|
|
7
|
+
export declare const SIZES_BASE: readonly ['small', 'medium', 'large'];
|
|
8
|
+
export type TPktSizeBase = (typeof SIZES_BASE)[number];
|
|
9
|
+
export declare const SIZES: readonly ["xsmall", "small", "medium", "large", "xlarge"];
|
|
10
|
+
export type TPktSize = (typeof SIZES)[number];
|
|
19
11
|
/**
|
|
20
12
|
* Sizes used in our input components — shared runtime source for types, specs, and Preview.
|
|
21
13
|
*/
|
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
|
|
20
|
-
export type TPktLoaderSize =
|
|
25
|
+
export type { TPktLoaderVariant }
|
|
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,
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
useRef,
|
|
14
14
|
} from 'react'
|
|
15
15
|
|
|
16
|
+
import type { TPktSizeBase } from 'shared-types'
|
|
16
17
|
import type { IPktStringsProps } from 'shared-strings'
|
|
17
18
|
import { createScrollLockToken, setScrollLock } from 'shared-utils/scroll-lock'
|
|
18
19
|
|
|
@@ -29,7 +30,7 @@ export interface IPktModal
|
|
|
29
30
|
headingIconPath?: string
|
|
30
31
|
hideCloseButton?: boolean
|
|
31
32
|
closeOnBackdropClick?: boolean
|
|
32
|
-
size?:
|
|
33
|
+
size?: TPktSizeBase | 'fit-content'
|
|
33
34
|
removePadding?: boolean
|
|
34
35
|
closeButtonSkin?: 'blue' | 'yellow-filled'
|
|
35
36
|
variant?: 'dialog' | 'drawer'
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
useState,
|
|
15
15
|
} from 'react'
|
|
16
16
|
|
|
17
|
-
import type { TTagSkin } from 'shared-types'
|
|
17
|
+
import type { TPktSizeBase, TTagSkin } from 'shared-types'
|
|
18
18
|
|
|
19
19
|
import { PktIcon } from '../icon/Icon'
|
|
20
20
|
import { usePktStrings } from '../../hooks/usePktStrings'
|
|
@@ -23,7 +23,7 @@ import { formatString, type IPktStringsProps } from 'shared-strings'
|
|
|
23
23
|
interface BasePktTagProps extends IPktStringsProps<'tag'> {
|
|
24
24
|
skin?: TTagSkin
|
|
25
25
|
textStyle?: 'normal-text' | 'thin-text'
|
|
26
|
-
size?:
|
|
26
|
+
size?: TPktSizeBase
|
|
27
27
|
closeTag?: boolean
|
|
28
28
|
iconName?: string
|
|
29
29
|
ariaLabel?: string
|