@oslokommune/punkt-react 14.5.0 → 14.5.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 +18 -0
- package/dist/index.d.ts +16 -19
- package/dist/punkt-react.es.js +1308 -1382
- package/dist/punkt-react.umd.js +154 -182
- package/package.json +9 -3
- package/src/components/accordion/Accordion.test.tsx +4 -2
- package/src/components/accordion/Accordion.tsx +1 -1
- package/src/components/accordion/AccordionItem.tsx +3 -3
- package/src/components/alert/Alert.test.tsx +4 -5
- package/src/components/alert/Alert.tsx +5 -4
- package/src/components/backlink/BackLink.tsx +3 -3
- package/src/components/breadcrumbs/Breadcrumbs.test.tsx +4 -1
- package/src/components/breadcrumbs/Breadcrumbs.tsx +3 -5
- package/src/components/button/Button.test.tsx +5 -3
- package/src/components/button/Button.tsx +1 -2
- package/src/components/card/Card.tsx +6 -3
- package/src/components/checkbox/Checkbox.test.tsx +1 -1
- package/src/components/checkbox/Checkbox.tsx +10 -2
- package/src/components/combobox/Combobox.tsx +9 -8
- package/src/components/consent/Consent.tsx +3 -3
- package/src/components/datepicker/Datepicker.test.tsx +3 -1
- package/src/components/datepicker/Datepicker.tsx +11 -8
- package/src/components/footer/Footer.test.tsx +1 -1
- package/src/components/footer/Footer.tsx +3 -3
- package/src/components/footerSimple/FooterSimple.test.tsx +1 -1
- package/src/components/footerSimple/FooterSimple.tsx +3 -3
- package/src/components/header/Header.test.tsx +0 -1
- package/src/components/header/Header.tsx +1 -0
- package/src/components/header/HeaderService.test.tsx +2 -2
- package/src/components/header/HeaderService.tsx +34 -15
- package/src/components/header/types.ts +8 -8
- package/src/components/headerUserMenu/UserMenu.test.tsx +3 -3
- package/src/components/headerUserMenu/UserMenu.tsx +6 -2
- package/src/components/heading/Heading.test.tsx +4 -2
- package/src/components/heading/Heading.tsx +6 -5
- package/src/components/helptext/Helptext.tsx +3 -2
- package/src/components/icon/Icon.test.tsx +0 -1
- package/src/components/icon/Icon.tsx +4 -5
- package/src/components/input/Input.tsx +4 -5
- package/src/components/inputwrapper/InputWrapper.tsx +2 -1
- package/src/components/interfaces.ts +1 -1
- package/src/components/loader/Loader.test.tsx +0 -1
- package/src/components/loader/Loader.tsx +6 -4
- package/src/components/messagebox/Messagebox.tsx +1 -1
- package/src/components/modal/Modal.test.tsx +5 -6
- package/src/components/modal/Modal.tsx +4 -2
- package/src/components/progressbar/Progressbar.test.tsx +5 -3
- package/src/components/progressbar/Progressbar.tsx +6 -4
- package/src/components/radio/RadioButton.tsx +9 -3
- package/src/components/searchinput/SearchInput.test.tsx +3 -3
- package/src/components/searchinput/SearchInput.tsx +5 -1
- package/src/components/select/Select.test.tsx +0 -1
- package/src/components/select/Select.tsx +2 -0
- package/src/components/stepper/Step.tsx +2 -1
- package/src/components/stepper/Stepper.test.tsx +5 -3
- package/src/components/stepper/Stepper.tsx +5 -3
- package/src/components/table/Table.test.tsx +6 -6
- package/src/components/table/Table.tsx +2 -3
- package/src/components/table/TableBody.tsx +2 -3
- package/src/components/table/TableData.tsx +2 -3
- package/src/components/table/TableDataCell.tsx +2 -3
- package/src/components/table/TableHeader.tsx +2 -3
- package/src/components/table/TableHeaderCell.tsx +2 -3
- package/src/components/table/TableRow.tsx +2 -3
- package/src/components/tabs/TabItem.tsx +4 -4
- package/src/components/tabs/Tabs.test.tsx +5 -4
- package/src/components/tabs/Tabs.tsx +8 -5
- package/src/components/textarea/Textarea.test.tsx +0 -1
- package/src/components/textarea/Textarea.tsx +9 -4
- package/src/components/textinput/Textinput.tsx +11 -6
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
|
+
import classNames from 'classnames'
|
|
3
4
|
import { ForwardedRef, forwardRef } from 'react'
|
|
5
|
+
|
|
6
|
+
import { Representing, User, UserMenuItem } from '../header/types'
|
|
4
7
|
import { PktIcon } from '../icon/Icon'
|
|
5
8
|
import { PktLink } from '../link/Link'
|
|
6
|
-
import { User, Representing, UserMenuItem } from '../header/types'
|
|
7
|
-
import classNames from 'classnames'
|
|
8
9
|
|
|
9
10
|
// Internal type for rendering links/buttons (supports both href and onClick)
|
|
10
11
|
interface IInternalMenuItemBase {
|
|
@@ -60,6 +61,7 @@ const LinkOrButtonComponent = ({ item, className }: { item: TInternalMenuItem; c
|
|
|
60
61
|
if ('onClick' in item && typeof item.onClick === 'function') {
|
|
61
62
|
item.onClick()
|
|
62
63
|
} else {
|
|
64
|
+
// eslint-disable-next-line no-console
|
|
63
65
|
console.error('UserMenuButton item is missing onClick handler or onClick is not a function:', item)
|
|
64
66
|
}
|
|
65
67
|
}}
|
|
@@ -171,3 +173,5 @@ export const PktHeaderUserMenu = forwardRef(
|
|
|
171
173
|
)
|
|
172
174
|
},
|
|
173
175
|
)
|
|
176
|
+
|
|
177
|
+
PktHeaderUserMenu.displayName = 'PktHeaderUserMenu'
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import '@testing-library/jest-dom'
|
|
2
|
+
|
|
3
|
+
import { render, screen, waitFor } from '@testing-library/react'
|
|
2
4
|
import { axe, toHaveNoViolations } from 'jest-axe'
|
|
5
|
+
import { createRef } from 'react'
|
|
6
|
+
|
|
3
7
|
import { PktHeading } from './Heading'
|
|
4
|
-
import { render, screen, waitFor } from '@testing-library/react'
|
|
5
|
-
import React, { createRef } from 'react'
|
|
6
8
|
|
|
7
9
|
expect.extend(toHaveNoViolations)
|
|
8
10
|
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
3
|
import { createComponent } from '@lit/react'
|
|
4
|
-
import {
|
|
4
|
+
import { IPktHeading as IPktElHeading, PktHeading as PktElHeading } from '@oslokommune/punkt-elements'
|
|
5
|
+
// eslint-disable-next-line no-restricted-syntax -- React is required for createComponent
|
|
6
|
+
import React, { FC, forwardRef, ForwardRefExoticComponent, type LegacyRef, type ReactNode } from 'react'
|
|
7
|
+
|
|
5
8
|
import { PktElConstructor } from '@/interfaces/IPktElements'
|
|
6
|
-
import { PktHeading as PktElHeading, IPktHeading as IPktElHeading } from '@oslokommune/punkt-elements'
|
|
7
|
-
import React, { ForwardRefExoticComponent } from 'react'
|
|
8
9
|
|
|
9
10
|
export interface IPktHeading extends IPktElHeading {
|
|
10
|
-
children?:
|
|
11
|
-
ref?:
|
|
11
|
+
children?: ReactNode | ReactNode[]
|
|
12
|
+
ref?: LegacyRef<HTMLElement>
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
const LitComponent: FC<IPktHeading> = createComponent({
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
|
-
import React, { ForwardRefExoticComponent, ReactNode, LegacyRef, FC, forwardRef, HTMLAttributes } from 'react'
|
|
4
|
-
import { PktHelptext as PktElHelptext } from '@oslokommune/punkt-elements'
|
|
5
3
|
import { createComponent, EventName } from '@lit/react'
|
|
4
|
+
import { PktHelptext as PktElHelptext } from '@oslokommune/punkt-elements'
|
|
5
|
+
// eslint-disable-next-line no-restricted-syntax -- React is required for createComponent
|
|
6
|
+
import React, { FC, forwardRef, ForwardRefExoticComponent, HTMLAttributes, LegacyRef, type ReactNode } from 'react'
|
|
6
7
|
|
|
7
8
|
export interface IPktHelptextProps extends HTMLAttributes<HTMLDivElement> {
|
|
8
9
|
helptext?: string | ReactNode | ReactNode[]
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
|
-
import React, { FC } from 'react'
|
|
4
|
-
|
|
5
|
-
import { PktElConstructor, PktElType } from '@/interfaces/IPktElements'
|
|
6
3
|
import { createComponent } from '@lit/react'
|
|
7
4
|
import { PktIcon as PktEl } from '@oslokommune/punkt-elements'
|
|
5
|
+
// eslint-disable-next-line no-restricted-syntax -- React is required for createComponent
|
|
6
|
+
import React, { FC } from 'react'
|
|
8
7
|
import type { Booleanish } from 'shared-types'
|
|
9
8
|
|
|
9
|
+
import { PktElConstructor, PktElType } from '@/interfaces/IPktElements'
|
|
10
|
+
|
|
10
11
|
interface IPktIcon extends PktElType {
|
|
11
12
|
name?: string
|
|
12
13
|
path?: string
|
|
@@ -20,5 +21,3 @@ export const PktIcon: FC<IPktIcon> = createComponent({
|
|
|
20
21
|
displayName: 'PktIcon',
|
|
21
22
|
events: {},
|
|
22
23
|
})
|
|
23
|
-
|
|
24
|
-
export default PktIcon
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
|
-
import { ForwardedRef, forwardRef } from 'react'
|
|
4
|
-
import type { InputHTMLAttributes } from 'react'
|
|
3
|
+
import { ForwardedRef, forwardRef, type InputHTMLAttributes, type ReactElement } from 'react'
|
|
5
4
|
|
|
6
5
|
interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
|
|
7
6
|
/** The input's label */
|
|
@@ -15,15 +14,15 @@ interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
|
|
|
15
14
|
* @param {string} label - Label for the input
|
|
16
15
|
* @param {string} id - Id for the input
|
|
17
16
|
* @param {string} validationMessage - Validation message for the input
|
|
18
|
-
* @param {
|
|
19
|
-
* @returns {
|
|
17
|
+
* @param {InputHTMLAttributes<HTMLInputElement>} props - Other props to pass to the input
|
|
18
|
+
* @returns {ReactElement} - React element
|
|
20
19
|
*
|
|
21
20
|
* @example
|
|
22
21
|
* <Input label="First name" id="firstName" validationMessage="First name is required" />
|
|
23
22
|
*
|
|
24
23
|
*/
|
|
25
24
|
export const PktInput = forwardRef(
|
|
26
|
-
({ label, id, children, ...props }: InputProps, ref: ForwardedRef<HTMLInputElement>):
|
|
25
|
+
({ label, id, children, ...props }: InputProps, ref: ForwardedRef<HTMLInputElement>): ReactElement => {
|
|
27
26
|
return (
|
|
28
27
|
<div className="pkt-form-group">
|
|
29
28
|
<label htmlFor={id} className="pkt-form-label">
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
|
-
import { ForwardedRef, forwardRef, ReactNode, RefAttributes, useState
|
|
3
|
+
import { ForwardedRef, forwardRef, type ReactNode, RefAttributes, useState } from 'react'
|
|
4
|
+
|
|
4
5
|
import { PktAlert } from '../alert/Alert'
|
|
5
6
|
import { PktButton } from '../button/Button'
|
|
6
7
|
|
|
@@ -19,8 +19,8 @@ export type { IPktMessagebox } from './messagebox/Messagebox'
|
|
|
19
19
|
export type { IPktModal } from './modal/Modal'
|
|
20
20
|
export type { IPktProgressbar } from './progressbar/Progressbar'
|
|
21
21
|
export type { IPktRadioButton } from './radio/RadioButton'
|
|
22
|
-
export type { IPktStepper } from './stepper/Stepper'
|
|
23
22
|
export type { IPktStep } from './stepper/Step'
|
|
23
|
+
export type { IPktStepper } from './stepper/Stepper'
|
|
24
24
|
export type { IPktTab } from './tabs/Tabs'
|
|
25
25
|
export type { IPktTag } from './tag/Tag'
|
|
26
26
|
export type { IPktTextarea } from './textarea/Textarea'
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
|
-
import React, { forwardRef, ForwardedRef, FC, ReactElement } from 'react'
|
|
4
3
|
import { createComponent } from '@lit/react'
|
|
5
|
-
import { PktLoader as PktElLoader } from '@oslokommune/punkt-elements'
|
|
6
|
-
|
|
7
|
-
import
|
|
4
|
+
import { type IPktLoader as IPktElLoader, PktLoader as PktElLoader } from '@oslokommune/punkt-elements'
|
|
5
|
+
// eslint-disable-next-line no-restricted-syntax -- React is required for createComponent
|
|
6
|
+
import React, { FC, ForwardedRef, forwardRef, type ReactElement } from 'react'
|
|
7
|
+
|
|
8
|
+
import type { PktElConstructor, PktElType } from '@/interfaces/IPktElements'
|
|
8
9
|
|
|
9
10
|
type ExtendedLoader = IPktElLoader & PktElType
|
|
10
11
|
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
11
13
|
export interface IPktLoader extends ExtendedLoader {}
|
|
12
14
|
|
|
13
15
|
const LitComponent: FC<IPktLoader> = createComponent({
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
import classNames from 'classnames'
|
|
4
4
|
import { createRef, FC, HTMLAttributes, ReactNode, useCallback, useState } from 'react'
|
|
5
|
+
import type { TMessageboxSkin } from 'shared-types'
|
|
5
6
|
|
|
6
7
|
import { PktIcon } from '..'
|
|
7
|
-
import type { TMessageboxSkin } from 'shared-types'
|
|
8
8
|
|
|
9
9
|
export type { TMessageboxSkin }
|
|
10
10
|
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { render } from '@testing-library/react'
|
|
3
|
-
import { axe, toHaveNoViolations } from 'jest-axe'
|
|
4
|
-
import { PktModal } from './Modal'
|
|
1
|
+
import '@testing-library/jest-dom'
|
|
5
2
|
|
|
6
|
-
import { cleanup } from '@testing-library/react'
|
|
3
|
+
import { cleanup, render } from '@testing-library/react'
|
|
4
|
+
import { axe, toHaveNoViolations } from 'jest-axe'
|
|
5
|
+
import { createRef } from 'react'
|
|
7
6
|
|
|
8
|
-
import '
|
|
7
|
+
import { PktModal } from './Modal'
|
|
9
8
|
|
|
10
9
|
expect.extend(toHaveNoViolations)
|
|
11
10
|
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
|
-
import React, { FC, ForwardedRef, forwardRef, ReactElement } from 'react'
|
|
4
3
|
import { createComponent } from '@lit/react'
|
|
5
4
|
import { PktModal as PktElModal } from '@oslokommune/punkt-elements'
|
|
6
|
-
|
|
5
|
+
// eslint-disable-next-line no-restricted-syntax -- React is required for createComponent
|
|
6
|
+
import React, { FC, ForwardedRef, forwardRef, type ReactElement } from 'react'
|
|
7
|
+
|
|
8
|
+
import type { PktElConstructor,PktElType } from '@/interfaces/IPktElements'
|
|
7
9
|
|
|
8
10
|
export interface IPktModal extends PktElType {
|
|
9
11
|
headingText?: string
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import React, { createRef } from 'react'
|
|
2
|
-
import { render, screen } from '@testing-library/react'
|
|
3
1
|
import '@testing-library/jest-dom'
|
|
2
|
+
|
|
3
|
+
import { render, screen } from '@testing-library/react'
|
|
4
|
+
import exp from 'constants'
|
|
4
5
|
import { axe, toHaveNoViolations } from 'jest-axe'
|
|
6
|
+
import { createRef } from 'react'
|
|
7
|
+
|
|
5
8
|
import { PktProgressbar } from './Progressbar'
|
|
6
|
-
import exp from 'constants'
|
|
7
9
|
|
|
8
10
|
expect.extend(toHaveNoViolations)
|
|
9
11
|
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
|
-
import React, { forwardRef, ForwardedRef, ReactElement } from 'react'
|
|
4
3
|
import { createComponent } from '@lit/react'
|
|
5
|
-
import { PktProgressbar as PktElProgressbar } from '@oslokommune/punkt-elements'
|
|
6
|
-
|
|
7
|
-
import
|
|
4
|
+
import { type IPktProgressbar as IPktElProgressbar, PktProgressbar as PktElProgressbar } from '@oslokommune/punkt-elements'
|
|
5
|
+
// eslint-disable-next-line no-restricted-syntax -- React is required for createComponent
|
|
6
|
+
import React, { ForwardedRef, forwardRef, type ReactElement } from 'react'
|
|
7
|
+
|
|
8
|
+
import type { PktElConstructor, PktElType } from '@/interfaces/IPktElements'
|
|
8
9
|
|
|
9
10
|
type ExtendedProgressbar = IPktElProgressbar & PktElType
|
|
10
11
|
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
11
13
|
export interface IPktProgressbar extends ExtendedProgressbar {}
|
|
12
14
|
|
|
13
15
|
const LitComponent = createComponent({
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
ChangeEventHandler,
|
|
3
|
+
ForwardedRef,
|
|
4
|
+
forwardRef,
|
|
5
|
+
type InputHTMLAttributes,
|
|
6
|
+
ReactElement,
|
|
7
|
+
ReactNode,
|
|
8
|
+
} from 'react'
|
|
3
9
|
|
|
4
10
|
export interface IPktRadioButton extends InputHTMLAttributes<HTMLInputElement> {
|
|
5
11
|
id: string
|
|
@@ -41,7 +47,7 @@ export const PktRadioButton = forwardRef(
|
|
|
41
47
|
...props
|
|
42
48
|
}: IPktRadioButton,
|
|
43
49
|
ref: ForwardedRef<HTMLInputElement>,
|
|
44
|
-
):
|
|
50
|
+
): ReactElement => {
|
|
45
51
|
const classes = [className, 'pkt-input-check'].filter(Boolean).join(' ')
|
|
46
52
|
|
|
47
53
|
const inputTileClasses = [
|
|
@@ -2,14 +2,14 @@ import '@testing-library/jest-dom'
|
|
|
2
2
|
|
|
3
3
|
import { fireEvent, render, screen } from '@testing-library/react'
|
|
4
4
|
import { axe, toHaveNoViolations } from 'jest-axe'
|
|
5
|
-
import
|
|
5
|
+
import { ChangeEvent, useState } from 'react'
|
|
6
6
|
|
|
7
7
|
import { PktSearchInput } from './SearchInput'
|
|
8
8
|
|
|
9
9
|
expect.extend(toHaveNoViolations)
|
|
10
10
|
|
|
11
|
-
const Wrapper = (props: { onChange: (e:
|
|
12
|
-
const [value, setValue] =
|
|
11
|
+
const Wrapper = (props: { onChange: (e: ChangeEvent) => void }) => {
|
|
12
|
+
const [value, setValue] = useState('')
|
|
13
13
|
return (
|
|
14
14
|
<PktSearchInput
|
|
15
15
|
id="test-search-input"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
|
-
import { ChangeEvent, forwardRef, HTMLProps, ReactNode
|
|
3
|
+
import { ChangeEvent, createElement, forwardRef, HTMLProps, ReactNode } from 'react'
|
|
4
4
|
|
|
5
5
|
import { PktButton } from '../button/Button'
|
|
6
6
|
|
|
@@ -76,12 +76,14 @@ export const PktSearchInput = forwardRef<HTMLInputElement, ISearchInput | ISearc
|
|
|
76
76
|
|
|
77
77
|
let WrapperElement
|
|
78
78
|
if (action) {
|
|
79
|
+
// eslint-disable-next-line react/display-name
|
|
79
80
|
WrapperElement = (children: ReactNode) => (
|
|
80
81
|
<form role="search" className={wrapperClass} action={action} method={method}>
|
|
81
82
|
{children}
|
|
82
83
|
</form>
|
|
83
84
|
)
|
|
84
85
|
} else {
|
|
86
|
+
// eslint-disable-next-line react/display-name
|
|
85
87
|
WrapperElement = (children: ReactNode) => (
|
|
86
88
|
<div role="search" className={wrapperClass}>
|
|
87
89
|
{children}
|
|
@@ -170,3 +172,5 @@ export const PktSearchInput = forwardRef<HTMLInputElement, ISearchInput | ISearc
|
|
|
170
172
|
)
|
|
171
173
|
},
|
|
172
174
|
)
|
|
175
|
+
|
|
176
|
+
PktSearchInput.displayName = 'PktSearchInput'
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
3
|
import cn from 'classnames'
|
|
4
|
+
import type { ReactNode } from 'react'
|
|
4
5
|
|
|
5
6
|
export type TStepStatus = 'completed' | 'incomplete' | 'current'
|
|
6
7
|
|
|
@@ -8,7 +9,7 @@ export interface IPktStep {
|
|
|
8
9
|
/**
|
|
9
10
|
* Step content. Can be a string, a React component or an element.
|
|
10
11
|
*/
|
|
11
|
-
children?:
|
|
12
|
+
children?: ReactNode
|
|
12
13
|
/**
|
|
13
14
|
* Additional class names
|
|
14
15
|
*/
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import '@testing-library/jest-dom'
|
|
2
|
-
|
|
3
|
-
import { PktStepper } from './Stepper'
|
|
4
|
-
import { PktStep } from './Step'
|
|
2
|
+
|
|
5
3
|
import { render, screen } from '@testing-library/react'
|
|
4
|
+
import { axe, toHaveNoViolations } from 'jest-axe'
|
|
6
5
|
import { createRef } from 'react'
|
|
7
6
|
|
|
7
|
+
import { PktStep } from './Step'
|
|
8
|
+
import { PktStepper } from './Stepper'
|
|
9
|
+
|
|
8
10
|
expect.extend(toHaveNoViolations)
|
|
9
11
|
|
|
10
12
|
describe('PktStepper', () => {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
|
-
import { ReactElement, Ref, forwardRef, Children, isValidElement, cloneElement } from 'react'
|
|
4
|
-
import type { HTMLAttributes } from 'react'
|
|
5
|
-
import { IPktStep } from './Step'
|
|
6
3
|
import classNames from 'classnames'
|
|
4
|
+
import { Children, cloneElement, forwardRef, type HTMLAttributes, isValidElement, ReactElement, Ref } from 'react'
|
|
5
|
+
|
|
6
|
+
import { IPktStep } from './Step'
|
|
7
7
|
|
|
8
8
|
export interface IPktStepper extends HTMLAttributes<HTMLOListElement> {
|
|
9
9
|
/**
|
|
@@ -74,3 +74,5 @@ export const PktStepper = forwardRef(
|
|
|
74
74
|
)
|
|
75
75
|
},
|
|
76
76
|
)
|
|
77
|
+
|
|
78
|
+
PktStepper.displayName = 'PktStepper'
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import * as React from 'react'
|
|
2
|
-
import { axe, toHaveNoViolations } from 'jest-axe'
|
|
3
|
-
import { render, screen } from '@testing-library/react'
|
|
4
1
|
import '@testing-library/jest-dom'
|
|
5
2
|
|
|
3
|
+
import { render, screen } from '@testing-library/react'
|
|
4
|
+
import { axe, toHaveNoViolations } from 'jest-axe'
|
|
5
|
+
|
|
6
6
|
import { PktTable } from './Table'
|
|
7
|
-
import { PktTableHeader } from './TableHeader'
|
|
8
|
-
import { PktTableRow } from './TableRow'
|
|
9
7
|
import { PktTableBody } from './TableBody'
|
|
10
|
-
import { PktTableHeaderCell } from './TableHeaderCell'
|
|
11
8
|
import { PktTableDataCell } from './TableDataCell'
|
|
9
|
+
import { PktTableHeader } from './TableHeader'
|
|
10
|
+
import { PktTableHeaderCell } from './TableHeaderCell'
|
|
11
|
+
import { PktTableRow } from './TableRow'
|
|
12
12
|
|
|
13
13
|
expect.extend(toHaveNoViolations)
|
|
14
14
|
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
3
|
import classNames from 'classnames'
|
|
4
|
-
import
|
|
5
|
-
import type { HTMLAttributes } from 'react'
|
|
4
|
+
import type { HTMLAttributes, ReactNode } from 'react'
|
|
6
5
|
|
|
7
6
|
export type TTableSkin = 'basic' | 'zebra-blue'
|
|
8
7
|
|
|
@@ -11,7 +10,7 @@ interface ITableProps extends HTMLAttributes<HTMLTableElement> {
|
|
|
11
10
|
skin?: 'basic' | 'zebra-blue'
|
|
12
11
|
responsiveView?: boolean
|
|
13
12
|
className?: string
|
|
14
|
-
children:
|
|
13
|
+
children: ReactNode
|
|
15
14
|
}
|
|
16
15
|
|
|
17
16
|
export const PktTable = ({
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
3
|
import classNames from 'classnames'
|
|
4
|
-
import
|
|
5
|
-
import type { HTMLAttributes } from 'react'
|
|
4
|
+
import type { HTMLAttributes, ReactNode } from 'react'
|
|
6
5
|
|
|
7
6
|
interface ITableBodyProps extends HTMLAttributes<HTMLTableSectionElement> {
|
|
8
7
|
className?: string
|
|
9
|
-
children:
|
|
8
|
+
children: ReactNode
|
|
10
9
|
}
|
|
11
10
|
|
|
12
11
|
export const PktTableBody = ({ id, children, className, ...props }: ITableBodyProps) => (
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
3
|
import classNames from 'classnames'
|
|
4
|
-
import
|
|
5
|
-
import type { HTMLAttributes } from 'react'
|
|
4
|
+
import type { HTMLAttributes, ReactNode } from 'react'
|
|
6
5
|
|
|
7
6
|
interface TableDataProps extends HTMLAttributes<HTMLTableCellElement> {
|
|
8
7
|
className?: string
|
|
9
|
-
children:
|
|
8
|
+
children: ReactNode | ReactNode[]
|
|
10
9
|
}
|
|
11
10
|
|
|
12
11
|
export const PktTableData = ({ children, className, ...props }: TableDataProps) => (
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
3
|
import classNames from 'classnames'
|
|
4
|
-
import
|
|
5
|
-
import type { HTMLAttributes } from 'react'
|
|
4
|
+
import type { HTMLAttributes, ReactNode } from 'react'
|
|
6
5
|
|
|
7
6
|
interface ITableDataCellProps extends HTMLAttributes<HTMLTableCellElement> {
|
|
8
7
|
className?: string
|
|
9
|
-
children?:
|
|
8
|
+
children?: ReactNode
|
|
10
9
|
dataLabel?: string
|
|
11
10
|
}
|
|
12
11
|
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
3
|
import classNames from 'classnames'
|
|
4
|
-
import
|
|
5
|
-
import type { HTMLAttributes } from 'react'
|
|
4
|
+
import type { HTMLAttributes, ReactNode } from 'react'
|
|
6
5
|
|
|
7
6
|
interface ITableHeaderProps extends HTMLAttributes<HTMLTableSectionElement> {
|
|
8
7
|
className?: string
|
|
9
|
-
children:
|
|
8
|
+
children: ReactNode
|
|
10
9
|
}
|
|
11
10
|
|
|
12
11
|
export const PktTableHeader = ({ className, children, ...props }: ITableHeaderProps) => (
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
3
|
import classNames from 'classnames'
|
|
4
|
-
import
|
|
5
|
-
import type { HTMLAttributes } from 'react'
|
|
4
|
+
import type { HTMLAttributes, ReactNode } from 'react'
|
|
6
5
|
|
|
7
6
|
interface ITableHeaderCellProps extends HTMLAttributes<HTMLTableCellElement> {
|
|
8
7
|
className?: string
|
|
9
|
-
children:
|
|
8
|
+
children: ReactNode
|
|
10
9
|
}
|
|
11
10
|
|
|
12
11
|
export const PktTableHeaderCell = ({ className, children, ...props }: ITableHeaderCellProps) => (
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
3
|
import classNames from 'classnames'
|
|
4
|
-
import
|
|
5
|
-
import type { HTMLAttributes } from 'react'
|
|
4
|
+
import type { HTMLAttributes, ReactNode } from 'react'
|
|
6
5
|
|
|
7
6
|
interface ITableRowProps extends HTMLAttributes<HTMLTableRowElement> {
|
|
8
7
|
className?: string
|
|
9
|
-
children:
|
|
8
|
+
children: ReactNode
|
|
10
9
|
}
|
|
11
10
|
|
|
12
11
|
export const PktTableRow = ({ className, children, ...props }: ITableRowProps) => (
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { forwardRef, type KeyboardEvent, type MouseEvent, type ReactNode } from 'react'
|
|
4
|
+
|
|
4
5
|
import { PktIcon } from '../icon/Icon'
|
|
5
|
-
import { PktTag } from '../tag/Tag'
|
|
6
|
-
import type { IPktTag } from '../tag/Tag'
|
|
6
|
+
import { type IPktTag, PktTag } from '../tag/Tag'
|
|
7
7
|
import { useTabsContext } from './Tabs'
|
|
8
8
|
|
|
9
9
|
export type TSkin = IPktTag['skin']
|
|
@@ -33,7 +33,7 @@ export const PktTabItem = forwardRef<HTMLAnchorElement | HTMLButtonElement, IPkt
|
|
|
33
33
|
'aria-selected': arrowNav ? !!active : undefined,
|
|
34
34
|
'aria-controls': controls,
|
|
35
35
|
role: arrowNav ? 'tab' : undefined,
|
|
36
|
-
onKeyUp: (event:
|
|
36
|
+
onKeyUp: (event: KeyboardEvent) => handleKeyPress(index, event),
|
|
37
37
|
onClick: handleClick,
|
|
38
38
|
tabIndex: active || !arrowNav ? undefined : -1,
|
|
39
39
|
ref: (el: HTMLAnchorElement | HTMLButtonElement | null) => {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { render, fireEvent } from '@testing-library/react'
|
|
3
|
-
import { axe, toHaveNoViolations } from 'jest-axe'
|
|
4
1
|
import '@testing-library/jest-dom'
|
|
5
|
-
|
|
2
|
+
|
|
3
|
+
import { fireEvent, render } from '@testing-library/react'
|
|
4
|
+
import { axe, toHaveNoViolations } from 'jest-axe'
|
|
5
|
+
|
|
6
|
+
import { PktTabItem, PktTabs } from './Tabs'
|
|
6
7
|
|
|
7
8
|
expect.extend(toHaveNoViolations)
|
|
8
9
|
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
|
+
Children,
|
|
5
|
+
createContext,
|
|
4
6
|
forwardRef,
|
|
5
|
-
Ref,
|
|
6
|
-
useRef,
|
|
7
|
-
useEffect,
|
|
8
7
|
KeyboardEvent,
|
|
9
8
|
ReactNode,
|
|
10
|
-
|
|
11
|
-
createContext,
|
|
9
|
+
Ref,
|
|
12
10
|
useContext,
|
|
11
|
+
useEffect,
|
|
12
|
+
useRef,
|
|
13
13
|
} from 'react'
|
|
14
|
+
|
|
14
15
|
import { PktTabItem } from './TabItem'
|
|
15
16
|
|
|
16
17
|
export type TSkin = 'blue' | 'green' | 'red' | 'beige' | 'yellow' | 'grey' | 'gray' | 'blue-light'
|
|
@@ -127,3 +128,5 @@ export const PktTabs = forwardRef(
|
|
|
127
128
|
)
|
|
128
129
|
|
|
129
130
|
export { PktTabItem } from './TabItem'
|
|
131
|
+
|
|
132
|
+
PktTabs.displayName = 'PktTabs'
|