@oslokommune/punkt-react 19.18.5 → 19.19.1
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 +25 -0
- package/dist/components/stepper/Step.js +1 -1
- package/dist/components/table/Table.js +9 -8
- package/dist/components/textinput/Textinput.d.ts +6 -36
- package/dist/components/textinput/Textinput.js +80 -78
- package/dist/punkt-react.cjs +1 -1
- package/dist/shared-types/index.d.ts +2 -0
- package/dist/shared-types/index.js +5 -4
- package/dist/shared-types/table.d.ts +3 -2
- package/dist/shared-types/textinput.d.ts +82 -0
- package/dist/shared-types/textinput.js +18 -0
- package/package.json +4 -4
- package/src/components/stepper/Step.tsx +1 -1
- package/src/components/table/Table.test.tsx +44 -3
- package/src/components/table/Table.tsx +11 -0
- package/src/components/textinput/Textinput.test.tsx +26 -0
- package/src/components/textinput/Textinput.tsx +26 -51
|
@@ -43,6 +43,8 @@ export type { IHelptextProps, ITagOptionalRequiredProps, IFormFieldLabelProps, I
|
|
|
43
43
|
export { COUNTER_POSITIONS, INPUT_WRAPPER_DEFAULTS } from './input-wrapper';
|
|
44
44
|
export { TEXTAREA_DEFAULTS } from './textarea';
|
|
45
45
|
export type { IPktTextareaBase, ITextareaSpecProps } from './textarea';
|
|
46
|
+
export { TEXTINPUT_DEFAULTS, TEXTINPUT_TYPES } from './textinput';
|
|
47
|
+
export type { TPktTextinputType, IPktTextinputBase, ITextinputSpecProps } from './textinput';
|
|
46
48
|
export type { TPktCounterPosition, IPktInputWrapperBase, IInputWrapperSpecProps, } from './input-wrapper';
|
|
47
49
|
export type { TTagSkin } from './skin';
|
|
48
50
|
export { MESSAGEBOX_SKINS, MESSAGEBOX_DEFAULTS } from './messagebox';
|
|
@@ -11,9 +11,10 @@ import { LOADER_DEFAULTS as d } from "./loader.js";
|
|
|
11
11
|
import { ACCORDION_LIGHT_ONLY_SKINS as f } from "./accordion.js";
|
|
12
12
|
import { INPUT_WRAPPER_DEFAULTS as p } from "./input-wrapper.js";
|
|
13
13
|
import { TEXTAREA_DEFAULTS as m } from "./textarea.js";
|
|
14
|
-
import {
|
|
14
|
+
import { TEXTINPUT_DEFAULTS as h } from "./textinput.js";
|
|
15
|
+
import { MESSAGEBOX_DEFAULTS as g } from "./messagebox.js";
|
|
15
16
|
import "./calendar.js";
|
|
16
17
|
import "./combobox.js";
|
|
17
|
-
import { SELECT_DEFAULTS as
|
|
18
|
-
import { TABLE_DEFAULTS as
|
|
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,
|
|
18
|
+
import { SELECT_DEFAULTS as _ } from "./select.js";
|
|
19
|
+
import { TABLE_DEFAULTS as v } from "./table.js";
|
|
20
|
+
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, g as MESSAGEBOX_DEFAULTS, s as OPTION_GROUP_DEFAULTS, o as RADIOBUTTON_DEFAULTS, _ as SELECT_DEFAULTS, v as TABLE_DEFAULTS, m as TEXTAREA_DEFAULTS, h as TEXTINPUT_DEFAULTS };
|
|
@@ -8,13 +8,14 @@
|
|
|
8
8
|
/**
|
|
9
9
|
* Visual skins for pkt-table — shared runtime source for types, specs, and Preview.
|
|
10
10
|
*/
|
|
11
|
-
export declare const TABLE_SKINS: readonly ['basic', 'zebra
|
|
12
|
-
export type TPktTableSkin = (typeof TABLE_SKINS)[number];
|
|
11
|
+
export declare const TABLE_SKINS: readonly ['basic', 'zebra'];
|
|
12
|
+
export type TPktTableSkin = (typeof TABLE_SKINS)[number] | 'zebra-blue';
|
|
13
13
|
/**
|
|
14
14
|
* Table props shared by React and typed component specs.
|
|
15
15
|
*/
|
|
16
16
|
export interface IPktTableBase {
|
|
17
17
|
compact?: boolean;
|
|
18
|
+
/** `'zebra-blue'` er deprecated og fjernes i en kommende versjon. Bruk `'zebra'`. */
|
|
18
19
|
skin?: TPktTableSkin;
|
|
19
20
|
responsiveView?: boolean;
|
|
20
21
|
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* textinput.ts
|
|
3
|
+
*
|
|
4
|
+
* Type definitions for pkt-textinput.
|
|
5
|
+
* Used by React, Elements, and typed component specs.
|
|
6
|
+
*/
|
|
7
|
+
import type { IFormFieldCommonProps } from './form-field';
|
|
8
|
+
import type { TPktInputSize } from './size';
|
|
9
|
+
/** `type`-verdier som dokumenteres for pkt-textinput. Komponenten godtar fortsatt en vanlig streng. */
|
|
10
|
+
export declare const TEXTINPUT_TYPES: readonly ['color', 'date', 'datetime-local', 'email', 'file', 'month', 'number', 'password', 'search', 'tel', 'text', 'time', 'url', 'week'];
|
|
11
|
+
export type TPktTextinputType = (typeof TEXTINPUT_TYPES)[number];
|
|
12
|
+
/**
|
|
13
|
+
* Textinput props shared by React, Elements, and typed component specs.
|
|
14
|
+
*
|
|
15
|
+
* @remarks Keys follow the React prop names. Elements uses lowercase properties instead:
|
|
16
|
+
* `autocomplete`, `minlength`, `maxlength` and `readonly`.
|
|
17
|
+
*
|
|
18
|
+
* React requires `id` and `label`, and widens `helptext`, `helptextDropdown` and
|
|
19
|
+
* `errorMessage` to `ReactNode`.
|
|
20
|
+
* Elements widens `label`, `placeholder`, `size`,
|
|
21
|
+
* `prefix`, `suffix`, `iconNameRight`, `ariaDescribedby`, `ariaLabelledby` and
|
|
22
|
+
* `helptextDropdownButton` to `| null`, `useWrapper` to `Booleanish`, and omits
|
|
23
|
+
* `form`. On Elements `form` is a getter that returns the associated
|
|
24
|
+
* `HTMLFormElement`, not the form id.
|
|
25
|
+
*
|
|
26
|
+
* `counter` and `hasFieldset` are tri-state: `null` means the component derives the value.
|
|
27
|
+
*/
|
|
28
|
+
export interface IPktTextinputBase extends IFormFieldCommonProps<'forms' | 'validation'> {
|
|
29
|
+
id?: string;
|
|
30
|
+
name?: string;
|
|
31
|
+
form?: string;
|
|
32
|
+
value?: string;
|
|
33
|
+
placeholder?: string;
|
|
34
|
+
type?: string;
|
|
35
|
+
/** Bredde i antall tegn (HTML-attributtet `size`), ikke den visuelle `inputSize`. */
|
|
36
|
+
size?: number;
|
|
37
|
+
omitSearchIcon?: boolean;
|
|
38
|
+
prefix?: string;
|
|
39
|
+
suffix?: string;
|
|
40
|
+
iconNameRight?: string;
|
|
41
|
+
min?: number | string;
|
|
42
|
+
max?: number | string;
|
|
43
|
+
minLength?: number;
|
|
44
|
+
maxLength?: number;
|
|
45
|
+
step?: number | string;
|
|
46
|
+
readOnly?: boolean;
|
|
47
|
+
autoComplete?: string;
|
|
48
|
+
required?: boolean;
|
|
49
|
+
ariaDescribedby?: string;
|
|
50
|
+
ariaLabelledby?: string;
|
|
51
|
+
inline?: boolean;
|
|
52
|
+
fullwidth?: boolean;
|
|
53
|
+
useWrapper?: boolean;
|
|
54
|
+
counter?: boolean | null;
|
|
55
|
+
counterMaxLength?: number;
|
|
56
|
+
inputSize?: TPktInputSize;
|
|
57
|
+
hasFieldset?: boolean | null;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Documented Textinput props (subset of `IPktTextinputBase`).
|
|
61
|
+
* Used for typed component specs in documentation.
|
|
62
|
+
*/
|
|
63
|
+
export type ITextinputSpecProps = Pick<IPktTextinputBase, 'label' | 'name' | 'form' | 'placeholder' | 'helptext' | 'helptextDropdown' | 'helptextDropdownButton' | 'size' | 'type' | 'omitSearchIcon' | 'value' | 'autoComplete' | 'suffix' | 'prefix' | 'iconNameRight' | 'min' | 'max' | 'minLength' | 'maxLength' | 'step' | 'readOnly' | 'ariaLabelledby' | 'ariaDescribedby' | 'required' | 'requiredTag' | 'requiredText' | 'optionalTag' | 'optionalText' | 'tagText' | 'hasError' | 'errorMessage' | 'disabled' | 'inline' | 'fullwidth' | 'useWrapper' | 'id' | 'counter' | 'counterMaxLength' | 'inputSize' | 'hasFieldset'>;
|
|
64
|
+
/**
|
|
65
|
+
* Default values for pkt-textinput. Single source of truth for both frameworks.
|
|
66
|
+
* `counter` and `hasFieldset` are intentionally absent — `null` lets the component derive them.
|
|
67
|
+
*/
|
|
68
|
+
export declare const TEXTINPUT_DEFAULTS: {
|
|
69
|
+
readonly type: 'text';
|
|
70
|
+
readonly autoComplete: 'off';
|
|
71
|
+
readonly omitSearchIcon: false;
|
|
72
|
+
readonly required: false;
|
|
73
|
+
readonly readOnly: false;
|
|
74
|
+
readonly requiredTag: false;
|
|
75
|
+
readonly optionalTag: false;
|
|
76
|
+
readonly hasError: false;
|
|
77
|
+
readonly disabled: false;
|
|
78
|
+
readonly inline: false;
|
|
79
|
+
readonly fullwidth: false;
|
|
80
|
+
readonly useWrapper: true;
|
|
81
|
+
readonly inputSize: 'medium';
|
|
82
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//#region ../../shared-types/textinput.ts
|
|
2
|
+
var e = {
|
|
3
|
+
type: "text",
|
|
4
|
+
autoComplete: "off",
|
|
5
|
+
omitSearchIcon: !1,
|
|
6
|
+
required: !1,
|
|
7
|
+
readOnly: !1,
|
|
8
|
+
requiredTag: !1,
|
|
9
|
+
optionalTag: !1,
|
|
10
|
+
hasError: !1,
|
|
11
|
+
disabled: !1,
|
|
12
|
+
inline: !1,
|
|
13
|
+
fullwidth: !1,
|
|
14
|
+
useWrapper: !0,
|
|
15
|
+
inputSize: "medium"
|
|
16
|
+
};
|
|
17
|
+
//#endregion
|
|
18
|
+
export { e as TEXTINPUT_DEFAULTS };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oslokommune/punkt-react",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.19.1",
|
|
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",
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"@eslint/compat": "^2.1.0",
|
|
43
43
|
"@eslint/eslintrc": "^3.3.5",
|
|
44
44
|
"@eslint/js": "^10.0.1",
|
|
45
|
-
"@oslokommune/punkt-assets": "^19.
|
|
46
|
-
"@oslokommune/punkt-css": "^19.
|
|
45
|
+
"@oslokommune/punkt-assets": "^19.19.0",
|
|
46
|
+
"@oslokommune/punkt-css": "^19.19.0",
|
|
47
47
|
"@testing-library/jest-dom": "^7.0.1",
|
|
48
48
|
"@testing-library/react": "^16.3.2",
|
|
49
49
|
"@testing-library/user-event": "^14.6.1",
|
|
@@ -103,5 +103,5 @@
|
|
|
103
103
|
"url": "https://github.com/oslokommune/punkt/issues"
|
|
104
104
|
},
|
|
105
105
|
"license": "MIT",
|
|
106
|
-
"gitHead": "
|
|
106
|
+
"gitHead": "8373ea76c93221f22496eb298b2382b41bef53ab"
|
|
107
107
|
}
|
|
@@ -24,7 +24,7 @@ export interface IPktStep {
|
|
|
24
24
|
|
|
25
25
|
const incompleteStepSVG = (
|
|
26
26
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none">
|
|
27
|
-
<circle cx="12" cy="12" r="7"
|
|
27
|
+
<circle cx="12" cy="12" r="7" fill="#CCC" />
|
|
28
28
|
</svg>
|
|
29
29
|
)
|
|
30
30
|
|
|
@@ -2,6 +2,7 @@ import '@testing-library/jest-dom'
|
|
|
2
2
|
|
|
3
3
|
import { render, screen } from '@testing-library/react'
|
|
4
4
|
import { axe, toHaveNoViolations } from 'jest-axe'
|
|
5
|
+
import { vi } from 'vitest'
|
|
5
6
|
|
|
6
7
|
import { PktTable } from './Table'
|
|
7
8
|
import { PktTableBody } from './TableBody'
|
|
@@ -39,9 +40,9 @@ describe('<PktTable />', () => {
|
|
|
39
40
|
expect(screen.getByText('Table data 2')).toBeInTheDocument()
|
|
40
41
|
})
|
|
41
42
|
|
|
42
|
-
test('renders correctly with skin "zebra
|
|
43
|
+
test('renders correctly with skin "zebra" and compact set to true', () => {
|
|
43
44
|
render(
|
|
44
|
-
<PktTable skin="zebra
|
|
45
|
+
<PktTable skin="zebra" compact>
|
|
45
46
|
<PktTableHeader>
|
|
46
47
|
<PktTableRow>
|
|
47
48
|
<PktTableHeaderCell>Header 1</PktTableHeaderCell>
|
|
@@ -59,6 +60,46 @@ describe('<PktTable />', () => {
|
|
|
59
60
|
|
|
60
61
|
// Assert that the component applies the props correctly
|
|
61
62
|
expect(screen.getByTestId('pkt-table')).toHaveClass('pkt-table--compact')
|
|
62
|
-
expect(screen.getByTestId('pkt-table')).toHaveClass('pkt-table--zebra
|
|
63
|
+
expect(screen.getByTestId('pkt-table')).toHaveClass('pkt-table--zebra')
|
|
64
|
+
expect(screen.getByTestId('pkt-table')).not.toHaveClass('pkt-table--zebra-blue')
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
describe('deprecated skin "zebra-blue"', () => {
|
|
68
|
+
afterEach(() => vi.restoreAllMocks())
|
|
69
|
+
|
|
70
|
+
test('renders both the zebra and the zebra-blue class', () => {
|
|
71
|
+
vi.spyOn(console, 'warn').mockImplementation(() => {})
|
|
72
|
+
render(
|
|
73
|
+
<PktTable skin="zebra-blue">
|
|
74
|
+
<PktTableBody>
|
|
75
|
+
<PktTableRow>
|
|
76
|
+
<PktTableDataCell>Table data</PktTableDataCell>
|
|
77
|
+
</PktTableRow>
|
|
78
|
+
</PktTableBody>
|
|
79
|
+
</PktTable>,
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
expect(screen.getByTestId('pkt-table')).toHaveClass('pkt-table--zebra')
|
|
83
|
+
expect(screen.getByTestId('pkt-table')).toHaveClass('pkt-table--zebra-blue')
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
test('warns once, however many tables use it', async () => {
|
|
87
|
+
const warn = vi.spyOn(console, 'warn').mockImplementation(() => {})
|
|
88
|
+
vi.resetModules()
|
|
89
|
+
const { PktTable: FreshTable } = await import('./Table')
|
|
90
|
+
render(
|
|
91
|
+
<>
|
|
92
|
+
<FreshTable skin="zebra-blue">
|
|
93
|
+
<tbody />
|
|
94
|
+
</FreshTable>
|
|
95
|
+
<FreshTable skin="zebra-blue">
|
|
96
|
+
<tbody />
|
|
97
|
+
</FreshTable>
|
|
98
|
+
</>,
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
expect(warn).toHaveBeenCalledTimes(1)
|
|
102
|
+
expect(warn).toHaveBeenCalledWith(expect.stringContaining('skin="zebra"'))
|
|
103
|
+
})
|
|
63
104
|
})
|
|
64
105
|
})
|
|
@@ -9,6 +9,8 @@ export interface IPktTable extends IPktTableBase, HTMLAttributes<HTMLTableElemen
|
|
|
9
9
|
children: ReactNode
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
+
let hasWarnedZebraBlue = false
|
|
13
|
+
|
|
12
14
|
export const PktTable = ({
|
|
13
15
|
className,
|
|
14
16
|
compact = TABLE_DEFAULTS.compact,
|
|
@@ -17,6 +19,14 @@ export const PktTable = ({
|
|
|
17
19
|
children,
|
|
18
20
|
...props
|
|
19
21
|
}: IPktTable) => {
|
|
22
|
+
if (skin === 'zebra-blue' && !hasWarnedZebraBlue) {
|
|
23
|
+
hasWarnedZebraBlue = true
|
|
24
|
+
// eslint-disable-next-line no-console
|
|
25
|
+
console.warn(
|
|
26
|
+
'PktTable: skin="zebra-blue" is deprecated and will be removed in a future version. Please use skin="zebra" instead.',
|
|
27
|
+
)
|
|
28
|
+
}
|
|
29
|
+
|
|
20
30
|
return (
|
|
21
31
|
<table
|
|
22
32
|
data-testid="pkt-table"
|
|
@@ -24,6 +34,7 @@ export const PktTable = ({
|
|
|
24
34
|
'pkt-table--responsive': responsiveView,
|
|
25
35
|
'pkt-table--compact': compact,
|
|
26
36
|
'pkt-table--basic': skin === 'basic',
|
|
37
|
+
'pkt-table--zebra': skin === 'zebra' || skin === 'zebra-blue',
|
|
27
38
|
'pkt-table--zebra-blue': skin === 'zebra-blue',
|
|
28
39
|
})}
|
|
29
40
|
role="table"
|
|
@@ -75,6 +75,32 @@ describe('PktTextinput', () => {
|
|
|
75
75
|
})
|
|
76
76
|
})
|
|
77
77
|
|
|
78
|
+
describe('autocomplete', () => {
|
|
79
|
+
test('defaults to off', () => {
|
|
80
|
+
render(<PktTextinput label={label} id={inputId} />)
|
|
81
|
+
|
|
82
|
+
expect(screen.getByRole('textbox')).toHaveAttribute('autocomplete', 'off')
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
test('sets autocomplete from autoComplete', () => {
|
|
86
|
+
render(<PktTextinput label={label} id={inputId} autoComplete="email" />)
|
|
87
|
+
|
|
88
|
+
expect(screen.getByRole('textbox')).toHaveAttribute('autocomplete', 'email')
|
|
89
|
+
})
|
|
90
|
+
|
|
91
|
+
test('still accepts the autocomplete prop', () => {
|
|
92
|
+
render(<PktTextinput label={label} id={inputId} autocomplete="tel" />)
|
|
93
|
+
|
|
94
|
+
expect(screen.getByRole('textbox')).toHaveAttribute('autocomplete', 'tel')
|
|
95
|
+
})
|
|
96
|
+
|
|
97
|
+
test('autoComplete wins when both props are set', () => {
|
|
98
|
+
render(<PktTextinput label={label} id={inputId} autoComplete="email" autocomplete="tel" />)
|
|
99
|
+
|
|
100
|
+
expect(screen.getByRole('textbox')).toHaveAttribute('autocomplete', 'email')
|
|
101
|
+
})
|
|
102
|
+
})
|
|
103
|
+
|
|
78
104
|
describe('accessibility', () => {
|
|
79
105
|
it('renders with no wcag errors with axe', async () => {
|
|
80
106
|
const { container } = render(<PktTextinput label={label} id={inputId} />)
|
|
@@ -12,53 +12,26 @@ import {
|
|
|
12
12
|
|
|
13
13
|
import { PktIcon } from '../icon/Icon'
|
|
14
14
|
import { PktInputWrapper } from '../inputwrapper/InputWrapper'
|
|
15
|
+
import { TEXTINPUT_DEFAULTS, type IPktTextinputBase } from 'shared-types'
|
|
15
16
|
import { describedByIds } from 'shared-utils/forms/described-by'
|
|
16
17
|
import { useGeneratedId } from '../../hooks/useGeneratedId'
|
|
17
|
-
import type { IPktStringsProps } from 'shared-strings'
|
|
18
18
|
|
|
19
|
-
export interface IPktTextinput
|
|
19
|
+
export interface IPktTextinput
|
|
20
|
+
extends
|
|
21
|
+
Omit<IPktTextinputBase, 'helptext' | 'helptextDropdown' | 'errorMessage'>,
|
|
22
|
+
Omit<InputHTMLAttributes<HTMLInputElement>, keyof IPktTextinputBase> {
|
|
20
23
|
id: string
|
|
21
|
-
|
|
22
|
-
ariaLabelledby?: string
|
|
23
|
-
autocomplete?: string
|
|
24
|
-
counter?: boolean
|
|
25
|
-
hasFieldset?: boolean
|
|
26
|
-
counterMaxLength?: number
|
|
27
|
-
disabled?: boolean
|
|
24
|
+
label: string
|
|
28
25
|
errorMessage?: string | ReactNode | ReactNode[]
|
|
29
|
-
hasError?: boolean
|
|
30
26
|
helptext?: string | ReactNode | ReactNode[]
|
|
31
27
|
helptextDropdown?: string | ReactNode | ReactNode[]
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
fullwidth?: boolean
|
|
36
|
-
label: string
|
|
37
|
-
name?: string
|
|
38
|
-
optionalTag?: boolean
|
|
39
|
-
optionalText?: string
|
|
40
|
-
requiredTag?: boolean
|
|
41
|
-
requiredText?: string
|
|
42
|
-
tagText?: string | null
|
|
43
|
-
placeholder?: string
|
|
44
|
-
prefix?: string
|
|
45
|
-
suffix?: string
|
|
46
|
-
type?: string
|
|
47
|
-
useWrapper?: boolean
|
|
48
|
-
value?: string
|
|
49
|
-
omitSearchIcon?: boolean
|
|
50
|
-
min?: number | string
|
|
51
|
-
max?: number | string
|
|
52
|
-
minLength?: number
|
|
53
|
-
maxLength?: number
|
|
54
|
-
step?: string
|
|
55
|
-
size?: number
|
|
28
|
+
/** @deprecated Bruk `autoComplete`. */
|
|
29
|
+
autocomplete?: string
|
|
30
|
+
/** @deprecated Bruk `readOnly`. */
|
|
56
31
|
readonly?: boolean
|
|
57
|
-
required?: boolean
|
|
58
32
|
dataTestid?: string
|
|
59
33
|
onChange?: ChangeEventHandler<HTMLInputElement>
|
|
60
34
|
skipForwardTestid?: boolean
|
|
61
|
-
inputSize?: 'small' | 'medium' | 'xsmall'
|
|
62
35
|
}
|
|
63
36
|
|
|
64
37
|
export const PktTextinput = forwardRef(
|
|
@@ -67,33 +40,34 @@ export const PktTextinput = forwardRef(
|
|
|
67
40
|
id: idProp,
|
|
68
41
|
ariaDescribedby,
|
|
69
42
|
ariaLabelledby,
|
|
70
|
-
|
|
43
|
+
autoComplete,
|
|
44
|
+
autocomplete,
|
|
71
45
|
counter,
|
|
72
46
|
hasFieldset,
|
|
73
47
|
counterMaxLength,
|
|
74
48
|
className,
|
|
75
|
-
disabled =
|
|
49
|
+
disabled = TEXTINPUT_DEFAULTS.disabled,
|
|
76
50
|
errorMessage,
|
|
77
|
-
hasError =
|
|
51
|
+
hasError = TEXTINPUT_DEFAULTS.hasError,
|
|
78
52
|
helptext,
|
|
79
53
|
helptextDropdown,
|
|
80
54
|
helptextDropdownButton,
|
|
81
55
|
iconNameRight,
|
|
82
|
-
inline =
|
|
83
|
-
fullwidth =
|
|
56
|
+
inline = TEXTINPUT_DEFAULTS.inline,
|
|
57
|
+
fullwidth = TEXTINPUT_DEFAULTS.fullwidth,
|
|
84
58
|
label,
|
|
85
59
|
name,
|
|
86
|
-
optionalTag =
|
|
60
|
+
optionalTag = TEXTINPUT_DEFAULTS.optionalTag,
|
|
87
61
|
optionalText,
|
|
88
|
-
requiredTag =
|
|
62
|
+
requiredTag = TEXTINPUT_DEFAULTS.requiredTag,
|
|
89
63
|
requiredText,
|
|
90
64
|
tagText = null,
|
|
91
65
|
placeholder,
|
|
92
66
|
prefix,
|
|
93
67
|
suffix,
|
|
94
|
-
type =
|
|
95
|
-
useWrapper =
|
|
96
|
-
omitSearchIcon =
|
|
68
|
+
type = TEXTINPUT_DEFAULTS.type,
|
|
69
|
+
useWrapper = TEXTINPUT_DEFAULTS.useWrapper,
|
|
70
|
+
omitSearchIcon = TEXTINPUT_DEFAULTS.omitSearchIcon,
|
|
97
71
|
value,
|
|
98
72
|
minLength,
|
|
99
73
|
maxLength,
|
|
@@ -101,12 +75,13 @@ export const PktTextinput = forwardRef(
|
|
|
101
75
|
max,
|
|
102
76
|
step,
|
|
103
77
|
size,
|
|
104
|
-
|
|
105
|
-
|
|
78
|
+
readOnly,
|
|
79
|
+
readonly: readOnlyLegacy,
|
|
80
|
+
required = TEXTINPUT_DEFAULTS.required,
|
|
106
81
|
dataTestid,
|
|
107
82
|
onChange,
|
|
108
83
|
skipForwardTestid = false,
|
|
109
|
-
inputSize =
|
|
84
|
+
inputSize = TEXTINPUT_DEFAULTS.inputSize,
|
|
110
85
|
strings,
|
|
111
86
|
...props
|
|
112
87
|
}: IPktTextinput,
|
|
@@ -178,7 +153,7 @@ export const PktTextinput = forwardRef(
|
|
|
178
153
|
value={isoValue}
|
|
179
154
|
id={inputId}
|
|
180
155
|
placeholder={placeholder}
|
|
181
|
-
autoComplete={autocomplete}
|
|
156
|
+
autoComplete={autoComplete ?? autocomplete ?? TEXTINPUT_DEFAULTS.autoComplete}
|
|
182
157
|
disabled={disabled}
|
|
183
158
|
aria-invalid={hasError}
|
|
184
159
|
aria-errormessage={hasError ? `${id}-error` : undefined}
|
|
@@ -196,7 +171,7 @@ export const PktTextinput = forwardRef(
|
|
|
196
171
|
minLength={minLength}
|
|
197
172
|
maxLength={maxLength}
|
|
198
173
|
size={size}
|
|
199
|
-
readOnly={readOnly}
|
|
174
|
+
readOnly={readOnly ?? readOnlyLegacy ?? TEXTINPUT_DEFAULTS.readOnly}
|
|
200
175
|
required={required}
|
|
201
176
|
/>
|
|
202
177
|
{suffix && (
|