@oslokommune/punkt-react 19.18.0 → 19.18.2
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 +32 -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/calendar/CalendarGrid.d.ts +1 -1
- package/dist/components/calendar/CalendarNav.d.ts +1 -1
- package/dist/components/combobox/ComboboxInput.d.ts +1 -1
- package/dist/components/combobox/ComboboxTags.d.ts +2 -2
- package/dist/components/combobox/Listbox.d.ts +1 -1
- package/dist/components/datepicker/DateTags.d.ts +1 -1
- package/dist/components/datepicker/DatepickerInputs.d.ts +1 -1
- package/dist/components/datepicker/DatepickerPopup.d.ts +1 -1
- package/dist/components/fileupload/Subcomponents.d.ts +6 -6
- package/dist/components/fileupload/types.js +6 -8
- package/dist/components/header-menu/HeaderMenu.d.ts +1 -1
- package/dist/components/icon/Icon.js +7 -1
- package/dist/components/linkcard/LinkCard.d.ts +1 -1
- package/dist/components/messagebox/Messagebox.js +24 -25
- package/dist/components/stepper/Step.d.ts +1 -1
- package/dist/components/strings/PktStringsProvider.d.ts +1 -1
- package/dist/components/table/Table.d.ts +1 -1
- package/dist/components/table/TableBody.d.ts +1 -1
- package/dist/components/table/TableDataCell.d.ts +1 -1
- package/dist/components/table/TableHeader.d.ts +1 -1
- package/dist/components/table/TableHeaderCell.d.ts +1 -1
- package/dist/components/table/TableRow.d.ts +1 -1
- package/dist/punkt-react.cjs +1 -1
- package/package.json +5 -4
- package/src/components/combobox/useComboboxState.ts +1 -0
- package/src/components/icon/Icon.test.tsx +22 -0
- package/src/components/icon/Icon.tsx +7 -1
- package/src/components/inputwrapper/InputWrapper.tsx +0 -2
- package/src/components/messagebox/Messagebox.tsx +2 -4
- package/src/components/stepper/Stepper.tsx +2 -0
- package/src/components/tabs/Tabs.tsx +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oslokommune/punkt-react",
|
|
3
|
-
"version": "19.18.
|
|
3
|
+
"version": "19.18.2",
|
|
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",
|
|
@@ -43,7 +44,7 @@
|
|
|
43
44
|
"@eslint/js": "^10.0.1",
|
|
44
45
|
"@oslokommune/punkt-assets": "^19.14.2",
|
|
45
46
|
"@oslokommune/punkt-css": "^19.16.2",
|
|
46
|
-
"@testing-library/jest-dom": "^
|
|
47
|
+
"@testing-library/jest-dom": "^7.0.1",
|
|
47
48
|
"@testing-library/react": "^16.3.2",
|
|
48
49
|
"@testing-library/user-event": "^14.6.1",
|
|
49
50
|
"@types/jest-axe": "^3.5.9",
|
|
@@ -58,7 +59,7 @@
|
|
|
58
59
|
"eslint-plugin-react-hooks": "^7.1.1",
|
|
59
60
|
"eslint-plugin-simple-import-sort": "^13.0.0",
|
|
60
61
|
"globals": "^17.6.0",
|
|
61
|
-
"jest-axe": "^
|
|
62
|
+
"jest-axe": "^11.0.0",
|
|
62
63
|
"jsdom": "^29.1.1",
|
|
63
64
|
"prettier": "^3.8.4",
|
|
64
65
|
"react-hook-form": "^7.79.0",
|
|
@@ -102,5 +103,5 @@
|
|
|
102
103
|
"url": "https://github.com/oslokommune/punkt/issues"
|
|
103
104
|
},
|
|
104
105
|
"license": "MIT",
|
|
105
|
-
"gitHead": "
|
|
106
|
+
"gitHead": "365dcae5072b21d9508448b2d541932ae7dee859"
|
|
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 {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import '@testing-library/jest-dom'
|
|
2
|
+
import { vi } from 'vitest'
|
|
2
3
|
|
|
3
4
|
import { render, screen, waitFor } from '../../utils/test-utils'
|
|
4
5
|
import { PktIcon } from './Icon'
|
|
@@ -109,4 +110,25 @@ describe('PktIcon', () => {
|
|
|
109
110
|
expect(svg).toHaveAttribute('aria-label', 'chevron-right')
|
|
110
111
|
})
|
|
111
112
|
})
|
|
113
|
+
|
|
114
|
+
describe('Restricted storage', () => {
|
|
115
|
+
test('loads when reading sessionStorage throws', async () => {
|
|
116
|
+
const original = Object.getOwnPropertyDescriptor(globalThis, 'sessionStorage')
|
|
117
|
+
Object.defineProperty(globalThis, 'sessionStorage', {
|
|
118
|
+
configurable: true,
|
|
119
|
+
get() {
|
|
120
|
+
throw new DOMException('Access is denied for this document.', 'SecurityError')
|
|
121
|
+
},
|
|
122
|
+
})
|
|
123
|
+
const warn = vi.spyOn(console, 'warn').mockImplementation(() => {})
|
|
124
|
+
vi.resetModules()
|
|
125
|
+
try {
|
|
126
|
+
await expect(import('./Icon')).resolves.toHaveProperty('PktIcon')
|
|
127
|
+
} finally {
|
|
128
|
+
if (original) Object.defineProperty(globalThis, 'sessionStorage', original)
|
|
129
|
+
else delete (globalThis as { sessionStorage?: Storage }).sessionStorage
|
|
130
|
+
warn.mockRestore()
|
|
131
|
+
}
|
|
132
|
+
})
|
|
133
|
+
})
|
|
112
134
|
})
|
|
@@ -22,7 +22,13 @@ const dlCache: { [key: string]: Promise<string> } = {}
|
|
|
22
22
|
const MAX_RETRIES = 2
|
|
23
23
|
const RETRY_DELAY = 1500
|
|
24
24
|
|
|
25
|
-
const isSessionStorageAvailable =
|
|
25
|
+
const isSessionStorageAvailable = (() => {
|
|
26
|
+
try {
|
|
27
|
+
return typeof Storage !== 'undefined' && typeof sessionStorage !== 'undefined'
|
|
28
|
+
} catch {
|
|
29
|
+
return false
|
|
30
|
+
}
|
|
31
|
+
})()
|
|
26
32
|
|
|
27
33
|
const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect
|
|
28
34
|
|
|
@@ -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'
|
|
@@ -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
|
|
@@ -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
|