@oslokommune/punkt-react 19.18.1 → 19.18.3
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 +27 -0
- package/dist/_virtual/_@oxc-project_runtime@0.154.0/helpers/esm/defineProperty.js +12 -0
- package/dist/_virtual/_@oxc-project_runtime@0.154.0/helpers/esm/toPrimitive.js +14 -0
- package/dist/_virtual/_@oxc-project_runtime@0.154.0/helpers/esm/toPropertyKey.js +9 -0
- package/dist/_virtual/_@oxc-project_runtime@0.154.0/helpers/esm/typeof.js +11 -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/fileupload/types.js +6 -8
- 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 +2 -1
- package/dist/components/loader/Loader.js +1 -0
- package/dist/components/messagebox/Messagebox.js +25 -25
- 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 +2 -2
- package/dist/shared-types/index.js +18 -0
- package/dist/shared-types/size.d.ts +4 -12
- package/dist/shared-types/size.js +9 -0
- package/package.json +3 -2
- package/src/components/combobox/useComboboxState.ts +1 -0
- package/src/components/inputwrapper/InputWrapper.tsx +0 -2
- package/src/components/loader/Loader.tsx +2 -2
- package/src/components/messagebox/Messagebox.tsx +2 -4
- package/src/components/modal/Modal.tsx +2 -1
- package/src/components/stepper/Stepper.tsx +2 -0
- package/src/components/tabs/Tabs.tsx +1 -0
- 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';
|
|
@@ -24,8 +26,6 @@ export type { TIconSizeClass, IPktIconBase, IIconSpecProps } from './icon';
|
|
|
24
26
|
export { LAYOUT_DIRECTIONS } from './layout';
|
|
25
27
|
export type { TLayout, TVerticalPosition, THorizontalPosition, TPosition, TPositionWithCenter, } from './layout';
|
|
26
28
|
export type { THTMLButtonType, TSelectionMode } from './form';
|
|
27
|
-
export { INPUT_SIZES } from './size';
|
|
28
|
-
export type { TPktInputSize, TSize3, TSize5, TSize7 } from './size';
|
|
29
29
|
export { ACCORDION_LIGHT_ONLY_SKINS, ACCORDION_SKINS } from './accordion';
|
|
30
30
|
export type { TAccordionSkin, IPktAccordionBase, IPktAccordionItemBase, IAccordionSpecProps, IAccordionItemSpecProps, IAccordionVisualProps, } from './accordion';
|
|
31
31
|
export { BUTTON_SIZES, BUTTON_SKINS, BUTTON_COLORS, BUTTON_VARIANTS, BUTTON_STATES } from './button';
|
|
@@ -0,0 +1,18 @@
|
|
|
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 { ACCORDION_LIGHT_ONLY_SKINS as d } from "./accordion.js";
|
|
11
|
+
import { INPUT_WRAPPER_DEFAULTS as f } from "./input-wrapper.js";
|
|
12
|
+
import { TEXTAREA_DEFAULTS as p } from "./textarea.js";
|
|
13
|
+
import { MESSAGEBOX_DEFAULTS as m } from "./messagebox.js";
|
|
14
|
+
import "./calendar.js";
|
|
15
|
+
import "./combobox.js";
|
|
16
|
+
import { SELECT_DEFAULTS as h } from "./select.js";
|
|
17
|
+
import { TABLE_DEFAULTS as g } from "./table.js";
|
|
18
|
+
export { d 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, f as INPUT_WRAPPER_DEFAULTS, m as MESSAGEBOX_DEFAULTS, s as OPTION_GROUP_DEFAULTS, o as RADIOBUTTON_DEFAULTS, h as SELECT_DEFAULTS, g as TABLE_DEFAULTS, p as TEXTAREA_DEFAULTS };
|
|
@@ -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.3",
|
|
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",
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"build": "tsc && vite build && node scripts/bundle-shared-types.js",
|
|
28
28
|
"build-app": "tsc && vite build --config vite.config-app.ts",
|
|
29
29
|
"check-tree-shaking": "node scripts/check-tree-shaking.mjs",
|
|
30
|
+
"check-browser-support": "node ../../scripts/check-browser-support.mjs dist",
|
|
30
31
|
"lint": "eslint 'src/**/*.{js,jsx,ts,tsx}'",
|
|
31
32
|
"lint:fix": "eslint --fix 'src/**/*.{jsx,ts,tsx}'",
|
|
32
33
|
"format": "prettier --write src//**/*.{ts,tsx,css} --config ./.prettierrc",
|
|
@@ -102,5 +103,5 @@
|
|
|
102
103
|
"url": "https://github.com/oslokommune/punkt/issues"
|
|
103
104
|
},
|
|
104
105
|
"license": "MIT",
|
|
105
|
-
"gitHead": "
|
|
106
|
+
"gitHead": "f09029c699dc13de6b5a631caa1616e1a6f36e00"
|
|
106
107
|
}
|
|
@@ -125,6 +125,7 @@ export function useComboboxState(props: IPktCombobox, ref: React.ForwardedRef<HT
|
|
|
125
125
|
// Parse <option> children into options
|
|
126
126
|
const optionsFromChildren = useMemo(() => {
|
|
127
127
|
const result: IPktComboboxOption[] = []
|
|
128
|
+
// eslint-disable-next-line @eslint-react/no-children-for-each
|
|
128
129
|
Children.forEach(children, (child) => {
|
|
129
130
|
if (isValidElement(child) && child.type === 'option') {
|
|
130
131
|
const childProps = child.props as {
|
|
@@ -7,9 +7,7 @@ import { useGeneratedId } from '../../hooks/useGeneratedId'
|
|
|
7
7
|
import { usePktStrings } from '../../hooks/usePktStrings'
|
|
8
8
|
import { formatString } from 'shared-strings'
|
|
9
9
|
import { counterStatusId, isCounterExceeded } from 'shared-utils/forms/described-by'
|
|
10
|
-
import { uuidish } from 'shared-utils/utils'
|
|
11
10
|
import { INPUT_WRAPPER_DEFAULTS, type IPktInputWrapperBase } from 'shared-types'
|
|
12
|
-
import type { TLayout } from 'shared-types'
|
|
13
11
|
|
|
14
12
|
import { PktAlert } from '../alert/Alert'
|
|
15
13
|
import { PktHelptext } from '../helptext/Helptext'
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import classNames from 'classnames'
|
|
4
4
|
import { forwardRef, HTMLAttributes, ReactNode, useEffect, useState } from 'react'
|
|
5
|
-
import { ANIMATION_DEFAULT_PATH } from 'shared-types'
|
|
5
|
+
import { ANIMATION_DEFAULT_PATH, type TPktSizeBase } from 'shared-types'
|
|
6
6
|
|
|
7
7
|
import { PktIcon } from '../icon/Icon'
|
|
8
8
|
|
|
@@ -17,7 +17,7 @@ if (typeof window !== 'undefined') {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
export type TPktLoaderVariant = 'blue' | 'rainbow' | 'shapes'
|
|
20
|
-
export type TPktLoaderSize =
|
|
20
|
+
export type TPktLoaderSize = TPktSizeBase
|
|
21
21
|
|
|
22
22
|
export interface IPktLoader extends HTMLAttributes<HTMLDivElement> {
|
|
23
23
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
3
|
import classNames from 'classnames'
|
|
4
|
-
import {
|
|
4
|
+
import { FC, HTMLAttributes, ReactNode, useCallback, useState } from 'react'
|
|
5
5
|
import type { IPktStringsProps } from 'shared-strings'
|
|
6
6
|
import { MESSAGEBOX_DEFAULTS, type IPktMessageboxBase, type TMessageboxSkin } from 'shared-types'
|
|
7
7
|
|
|
@@ -41,8 +41,6 @@ export const PktMessagebox: FC<IPktMessagebox> = ({
|
|
|
41
41
|
'pkt-hide': closed,
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
const componentRootRef = createRef<HTMLDivElement>()
|
|
45
|
-
|
|
46
44
|
const close = useCallback(() => {
|
|
47
45
|
setClosed(true)
|
|
48
46
|
if (onClose) {
|
|
@@ -51,7 +49,7 @@ export const PktMessagebox: FC<IPktMessagebox> = ({
|
|
|
51
49
|
}, [setClosed, onClose])
|
|
52
50
|
|
|
53
51
|
return (
|
|
54
|
-
<div {...props} className={classNames(classes, className)}
|
|
52
|
+
<div {...props} className={classNames(classes, className)}>
|
|
55
53
|
{closable && (
|
|
56
54
|
<div className={'pkt-messagebox__close'}>
|
|
57
55
|
<button
|
|
@@ -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'
|
|
@@ -53,8 +53,10 @@ export const PktStepper = forwardRef(
|
|
|
53
53
|
orientation === 'horizontal' ? 'pkt-stepper--horizontal' : 'pkt-stepper--vertical',
|
|
54
54
|
)
|
|
55
55
|
|
|
56
|
+
// eslint-disable-next-line @eslint-react/no-children-map
|
|
56
57
|
const childrenWithProps = Children.map(children, (child, index) => {
|
|
57
58
|
if (isValidElement(child)) {
|
|
59
|
+
// eslint-disable-next-line @eslint-react/no-clone-element
|
|
58
60
|
return cloneElement(child, {
|
|
59
61
|
className: classNames(child.props.className, {
|
|
60
62
|
'pkt-step--hideStep': hideNonActiveSteps && index !== activeStep,
|
|
@@ -80,6 +80,7 @@ export const PktTabs = forwardRef(
|
|
|
80
80
|
const useArrowNav = arrowNav && !disableArrowNav
|
|
81
81
|
|
|
82
82
|
// Determine if we're using children or tabs array
|
|
83
|
+
// eslint-disable-next-line @eslint-react/no-children-to-array
|
|
83
84
|
const childItems = Children.toArray(children)
|
|
84
85
|
const hasChildren = childItems.length > 0
|
|
85
86
|
const tabCount = hasChildren ? childItems.length : tabs?.length || 0
|
|
@@ -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
|