@oslokommune/punkt-react 12.43.1 → 13.0.0
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 +28 -0
- package/dist/index.d.ts +57 -61
- package/dist/punkt-react.es.js +12898 -12547
- package/dist/punkt-react.umd.js +374 -372
- package/package.json +5 -5
- package/src/components/checkbox/Checkbox.test.tsx +1 -10
- package/src/components/checkbox/Checkbox.tsx +47 -36
- package/src/components/inputwrapper/InputWrapper.tsx +177 -27
- package/src/components/radio/RadioButton.test.tsx +4 -8
- package/src/components/radio/RadioButton.tsx +47 -36
- package/src/components/select/Select.test.tsx +27 -35
- package/src/components/select/Select.tsx +72 -53
- package/src/components/textarea/Textarea.test.tsx +4 -4
- package/src/components/textarea/Textarea.tsx +122 -43
- package/src/components/textinput/Textinput.test.tsx +12 -11
- package/src/components/textinput/Textinput.tsx +167 -43
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,34 @@ og skriver commits ca etter [Conventional Commits](https://conventionalcommits.o
|
|
|
5
5
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
+
## [13.0.0](https://github.com/oslokommune/punkt/compare/12.43.2...13.0.0) (2025-07-04)
|
|
9
|
+
|
|
10
|
+
### ⚠ BREAKING CHANGES
|
|
11
|
+
* Skjemaelementer tilbake til ren React. BREAKING CHANGE: select vil ikke lenger ta i mot et options-array, await window.customElements.whenDefined('pkt-xxx) må fjernes fra React-tester (ellers vil testene feile), mulig behov for justeringer i tester, ta gjerne en visuell og funksjonell avsjekk ved oppdatering
|
|
12
|
+
|
|
13
|
+
Skjemaelementer i React-pakken:
|
|
14
|
+
- Inputwrapper: Skriv tilbake til React, oppdater tester, oppdatere JSON med nye props tatt fra inputwrapper-elements
|
|
15
|
+
- TextInput: Skriv tilbake til React, oppdater tester
|
|
16
|
+
- Select: Skriv tilbake til React, oppdater tester (vil ikke lenger ta i mot et options-array)
|
|
17
|
+
- Checkbox: Skriv tilbake til React, oppdater tester
|
|
18
|
+
- TextArea: Skriv tilbake til React, oppdater tester
|
|
19
|
+
- RadioButton: Skriv tilbake til React, oppdater tester
|
|
20
|
+
- Switch: Skriv tilbake til React, oppdater tester
|
|
21
|
+
- Oppdatere test-utils for nevnte komponenter
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### Features
|
|
25
|
+
Ingen
|
|
26
|
+
|
|
27
|
+
### Bug Fixes
|
|
28
|
+
Ingen
|
|
29
|
+
|
|
30
|
+
### Chores
|
|
31
|
+
Ingen
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
|
|
8
36
|
## [12.42.12](https://github.com/oslokommune/punkt/compare/12.42.11...12.42.12) (2025-06-23)
|
|
9
37
|
|
|
10
38
|
### ⚠ BREAKING CHANGES
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
|
|
3
3
|
import { AnchorHTMLAttributes } from 'react';
|
|
4
|
+
import { ChangeEvent } from 'react';
|
|
4
5
|
import { ChangeEventHandler } from 'react';
|
|
5
6
|
import { default as default_2 } from 'react';
|
|
6
7
|
import { FC } from 'react';
|
|
7
8
|
import { FocusEventHandler } from 'react';
|
|
8
|
-
import { ForwardedRef } from 'react';
|
|
9
9
|
import { ForwardRefExoticComponent } from 'react';
|
|
10
10
|
import { HTMLAttributes } from 'react';
|
|
11
11
|
import { HTMLProps } from 'react';
|
|
@@ -20,14 +20,13 @@ import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
|
20
20
|
import { LegacyRef } from 'react';
|
|
21
21
|
import { LinkHTMLAttributes } from 'react';
|
|
22
22
|
import { MouseEventHandler } from 'react';
|
|
23
|
-
import { PktInputWrapper as PktInputWrapper_2 } from '@oslokommune/punkt-elements';
|
|
24
23
|
import * as React_2 from 'react';
|
|
25
24
|
import { ReactElement } from 'react';
|
|
26
25
|
import { ReactNode } from 'react';
|
|
26
|
+
import { RefAttributes } from 'react';
|
|
27
27
|
import { SelectHTMLAttributes } from 'react';
|
|
28
28
|
import { TextareaHTMLAttributes } from 'react';
|
|
29
29
|
import { TPktAccordionSkin } from '@oslokommune/punkt-elements';
|
|
30
|
-
import { TSelectOption } from '@oslokommune/punkt-elements';
|
|
31
30
|
|
|
32
31
|
declare type Booleanish = boolean | 'true' | 'false';
|
|
33
32
|
|
|
@@ -145,26 +144,19 @@ export declare interface IPktCard extends PktElType {
|
|
|
145
144
|
})[];
|
|
146
145
|
}
|
|
147
146
|
|
|
148
|
-
export declare interface IPktCheckbox extends InputHTMLAttributes<HTMLInputElement> {
|
|
147
|
+
export declare interface IPktCheckbox extends default_2.InputHTMLAttributes<HTMLInputElement> {
|
|
149
148
|
id: string;
|
|
150
|
-
name?: string;
|
|
151
|
-
label: string;
|
|
152
149
|
hasTile?: boolean;
|
|
150
|
+
disabled?: boolean;
|
|
151
|
+
label?: string;
|
|
152
|
+
checkHelptext?: string;
|
|
153
153
|
hasError?: boolean;
|
|
154
154
|
defaultChecked?: boolean;
|
|
155
|
-
disabled?: boolean;
|
|
156
155
|
value?: string;
|
|
157
|
-
checkHelptext?: string | ReactNode | ReactNode[];
|
|
158
156
|
isSwitch?: boolean;
|
|
159
157
|
hideLabel?: boolean;
|
|
160
158
|
labelPosition?: 'right' | 'left';
|
|
161
159
|
checked?: boolean;
|
|
162
|
-
ref?: ForwardedRef<HTMLInputElement>;
|
|
163
|
-
onChange?: ChangeEventHandler<HTMLInputElement>;
|
|
164
|
-
onInput?: ChangeEventHandler<HTMLInputElement>;
|
|
165
|
-
onBlur?: FocusEventHandler<HTMLInputElement>;
|
|
166
|
-
onFocus?: FocusEventHandler<HTMLInputElement>;
|
|
167
|
-
onValueChange?: (e: CustomEvent) => void;
|
|
168
160
|
}
|
|
169
161
|
|
|
170
162
|
export declare interface IPktCombobox extends ExtendedCombobox {
|
|
@@ -291,11 +283,11 @@ declare interface IPktIcon extends PktElType {
|
|
|
291
283
|
'aria-hidden'?: Booleanish | undefined;
|
|
292
284
|
}
|
|
293
285
|
|
|
294
|
-
export declare interface IPktInputWrapper extends
|
|
286
|
+
export declare interface IPktInputWrapper extends RefAttributes<HTMLElement> {
|
|
295
287
|
forId: string;
|
|
296
288
|
label: string;
|
|
297
|
-
helptext?: string | ReactNode
|
|
298
|
-
helptextDropdown?: string | ReactNode
|
|
289
|
+
helptext?: string | ReactNode;
|
|
290
|
+
helptextDropdown?: string | ReactNode;
|
|
299
291
|
helptextDropdownButton?: string;
|
|
300
292
|
counter?: boolean;
|
|
301
293
|
counterCurrent?: number;
|
|
@@ -305,14 +297,16 @@ export declare interface IPktInputWrapper extends Omit<PktElType, 'ref'> {
|
|
|
305
297
|
requiredTag?: boolean;
|
|
306
298
|
requiredText?: string;
|
|
307
299
|
hasError?: boolean;
|
|
308
|
-
errorMessage?: string | ReactNode
|
|
300
|
+
errorMessage?: string | ReactNode;
|
|
309
301
|
disabled?: boolean;
|
|
310
302
|
inline?: boolean;
|
|
311
303
|
ariaDescribedby?: string;
|
|
312
304
|
useWrapper?: boolean;
|
|
305
|
+
children?: ReactNode;
|
|
306
|
+
className?: string;
|
|
313
307
|
hasFieldset?: boolean;
|
|
314
|
-
|
|
315
|
-
|
|
308
|
+
role?: string;
|
|
309
|
+
counterPosition?: 'top' | 'bottom';
|
|
316
310
|
}
|
|
317
311
|
|
|
318
312
|
declare interface IPktLink extends LinkHTMLAttributes<HTMLAnchorElement> {
|
|
@@ -359,22 +353,15 @@ export declare interface IPktModal extends PktElType {
|
|
|
359
353
|
export declare interface IPktProgressbar extends ExtendedProgressbar {
|
|
360
354
|
}
|
|
361
355
|
|
|
362
|
-
export declare interface IPktRadioButton extends InputHTMLAttributes<HTMLInputElement> {
|
|
356
|
+
export declare interface IPktRadioButton extends default_2.InputHTMLAttributes<HTMLInputElement> {
|
|
363
357
|
id: string;
|
|
364
358
|
name: string;
|
|
365
359
|
label: string;
|
|
366
360
|
hasTile?: boolean;
|
|
367
|
-
hasError?: boolean;
|
|
368
|
-
defaultChecked?: boolean;
|
|
369
361
|
disabled?: boolean;
|
|
362
|
+
checkHelptext?: string | default_2.ReactNode | default_2.ReactNode[];
|
|
363
|
+
hasError?: boolean;
|
|
370
364
|
value?: string;
|
|
371
|
-
checkHelptext?: string | ReactNode | ReactNode[];
|
|
372
|
-
ref?: ForwardedRef<HTMLInputElement>;
|
|
373
|
-
onChange?: ChangeEventHandler<HTMLInputElement>;
|
|
374
|
-
onInput?: ChangeEventHandler<HTMLInputElement>;
|
|
375
|
-
onBlur?: FocusEventHandler<HTMLInputElement>;
|
|
376
|
-
onFocus?: FocusEventHandler<HTMLInputElement>;
|
|
377
|
-
onValueChange?: (e: CustomEvent) => void;
|
|
378
365
|
}
|
|
379
366
|
|
|
380
367
|
declare interface IPktSelectProps extends SelectHTMLAttributes<HTMLSelectElement> {
|
|
@@ -392,18 +379,15 @@ declare interface IPktSelectProps extends SelectHTMLAttributes<HTMLSelectElement
|
|
|
392
379
|
fullwidth?: boolean;
|
|
393
380
|
label: string;
|
|
394
381
|
name?: string;
|
|
395
|
-
options?: TSelectOption[];
|
|
396
382
|
optionalTag?: boolean;
|
|
397
383
|
optionalText?: string;
|
|
398
384
|
requiredTag?: boolean;
|
|
399
385
|
requiredText?: string;
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
onValueChange?: (e: CustomEvent) => void;
|
|
406
|
-
onToggleHelpText?: (e: CustomEvent) => void;
|
|
386
|
+
options?: Array<{
|
|
387
|
+
value: string;
|
|
388
|
+
label: string;
|
|
389
|
+
disabled?: boolean;
|
|
390
|
+
}>;
|
|
407
391
|
}
|
|
408
392
|
|
|
409
393
|
export declare interface IPktStep {
|
|
@@ -485,10 +469,12 @@ export declare interface IPktTag extends PktElType {
|
|
|
485
469
|
}
|
|
486
470
|
|
|
487
471
|
export declare interface IPktTextarea extends TextareaHTMLAttributes<HTMLTextAreaElement> {
|
|
472
|
+
id: string;
|
|
488
473
|
ariaDescribedby?: string;
|
|
489
474
|
ariaLabelledby?: string;
|
|
490
475
|
counter?: boolean;
|
|
491
476
|
counterMaxLength?: number;
|
|
477
|
+
disabled?: boolean;
|
|
492
478
|
errorMessage?: string | ReactNode | ReactNode[];
|
|
493
479
|
hasError?: boolean;
|
|
494
480
|
helptext?: string | ReactNode | ReactNode[];
|
|
@@ -496,28 +482,33 @@ export declare interface IPktTextarea extends TextareaHTMLAttributes<HTMLTextAre
|
|
|
496
482
|
helptextDropdownButton?: string;
|
|
497
483
|
inline?: boolean;
|
|
498
484
|
fullwidth?: boolean;
|
|
499
|
-
label
|
|
485
|
+
label: string;
|
|
486
|
+
name?: string;
|
|
500
487
|
optionalTag?: boolean;
|
|
501
488
|
optionalText?: string;
|
|
502
489
|
requiredTag?: boolean;
|
|
503
490
|
requiredText?: string;
|
|
491
|
+
placeholder?: string;
|
|
492
|
+
rows?: number;
|
|
504
493
|
useWrapper?: boolean;
|
|
505
494
|
value?: string;
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
onValueChange?: (e: CustomEvent) => void;
|
|
512
|
-
onToggleHelpText?: (e: CustomEvent) => void;
|
|
513
|
-
dataTestid?: string;
|
|
495
|
+
autocomplete?: string;
|
|
496
|
+
minLength?: number;
|
|
497
|
+
maxLength?: number;
|
|
498
|
+
readOnly?: boolean;
|
|
499
|
+
required?: boolean;
|
|
514
500
|
skipForwardTestid?: boolean;
|
|
501
|
+
onChange?: (event: ChangeEvent<HTMLTextAreaElement>) => void;
|
|
515
502
|
}
|
|
516
503
|
|
|
517
504
|
export declare interface IPktTextinput extends InputHTMLAttributes<HTMLInputElement> {
|
|
505
|
+
id: string;
|
|
506
|
+
ariaDescribedby?: string;
|
|
518
507
|
ariaLabelledby?: string;
|
|
508
|
+
autocomplete?: string;
|
|
519
509
|
counter?: boolean;
|
|
520
510
|
counterMaxLength?: number;
|
|
511
|
+
disabled?: boolean;
|
|
521
512
|
errorMessage?: string | ReactNode | ReactNode[];
|
|
522
513
|
hasError?: boolean;
|
|
523
514
|
helptext?: string | ReactNode | ReactNode[];
|
|
@@ -526,24 +517,29 @@ export declare interface IPktTextinput extends InputHTMLAttributes<HTMLInputElem
|
|
|
526
517
|
iconNameRight?: string;
|
|
527
518
|
inline?: boolean;
|
|
528
519
|
fullwidth?: boolean;
|
|
529
|
-
label
|
|
520
|
+
label: string;
|
|
521
|
+
name?: string;
|
|
530
522
|
optionalTag?: boolean;
|
|
531
523
|
optionalText?: string;
|
|
532
524
|
requiredTag?: boolean;
|
|
533
525
|
requiredText?: string;
|
|
526
|
+
placeholder?: string;
|
|
534
527
|
prefix?: string;
|
|
535
528
|
suffix?: string;
|
|
529
|
+
type?: string;
|
|
536
530
|
useWrapper?: boolean;
|
|
537
531
|
value?: string;
|
|
538
532
|
omitSearchIcon?: boolean;
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
533
|
+
min?: number | string;
|
|
534
|
+
max?: number | string;
|
|
535
|
+
minLength?: number;
|
|
536
|
+
maxLength?: number;
|
|
537
|
+
step?: string;
|
|
538
|
+
size?: number;
|
|
539
|
+
readonly?: boolean;
|
|
540
|
+
required?: boolean;
|
|
546
541
|
dataTestid?: string;
|
|
542
|
+
onChange?: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
547
543
|
skipForwardTestid?: boolean;
|
|
548
544
|
}
|
|
549
545
|
|
|
@@ -639,7 +635,7 @@ export declare const PktButton: default_2.ForwardRefExoticComponent<IPktButton &
|
|
|
639
635
|
|
|
640
636
|
export declare const PktCard: FC<IPktCard>;
|
|
641
637
|
|
|
642
|
-
export declare const PktCheckbox: default_2.ForwardRefExoticComponent<IPktCheckbox
|
|
638
|
+
export declare const PktCheckbox: default_2.ForwardRefExoticComponent<IPktCheckbox & default_2.RefAttributes<HTMLInputElement>>;
|
|
643
639
|
|
|
644
640
|
export declare const PktCombobox: FC<IPktCombobox>;
|
|
645
641
|
|
|
@@ -683,7 +679,7 @@ export declare const PktIcon: FC<IPktIcon>;
|
|
|
683
679
|
*/
|
|
684
680
|
export declare const PktInput: default_2.ForwardRefExoticComponent<InputProps & default_2.RefAttributes<HTMLInputElement>>;
|
|
685
681
|
|
|
686
|
-
export declare const PktInputWrapper:
|
|
682
|
+
export declare const PktInputWrapper: ForwardRefExoticComponent<Omit<IPktInputWrapper, "ref"> & RefAttributes<HTMLDivElement>>;
|
|
687
683
|
|
|
688
684
|
export declare const PktLink: FC<IPktLink>;
|
|
689
685
|
|
|
@@ -699,11 +695,11 @@ export declare const PktPreview: default_2.FC<PreviewProps>;
|
|
|
699
695
|
|
|
700
696
|
export declare const PktProgressbar: default_2.ForwardRefExoticComponent<Omit<IPktProgressbar, "ref"> & default_2.RefAttributes<HTMLElement>>;
|
|
701
697
|
|
|
702
|
-
export declare const PktRadioButton: default_2.ForwardRefExoticComponent<IPktRadioButton
|
|
698
|
+
export declare const PktRadioButton: default_2.ForwardRefExoticComponent<IPktRadioButton & default_2.RefAttributes<HTMLInputElement>>;
|
|
703
699
|
|
|
704
700
|
export declare const PktSearchInput: default_2.ForwardRefExoticComponent<(Omit<ISearchForm, "ref"> | Omit<ISearchInput, "ref">) & default_2.RefAttributes<HTMLInputElement>>;
|
|
705
701
|
|
|
706
|
-
export declare const PktSelect:
|
|
702
|
+
export declare const PktSelect: ForwardRefExoticComponent<IPktSelectProps & RefAttributes<HTMLSelectElement>>;
|
|
707
703
|
|
|
708
704
|
export declare const PktStep: ({ children, className, status, title }: IPktStep) => JSX_2.Element;
|
|
709
705
|
|
|
@@ -725,9 +721,9 @@ export declare const PktTabs: default_2.ForwardRefExoticComponent<IPktTabs & def
|
|
|
725
721
|
|
|
726
722
|
export declare const PktTag: FC<IPktTag>;
|
|
727
723
|
|
|
728
|
-
export declare const PktTextarea:
|
|
724
|
+
export declare const PktTextarea: ForwardRefExoticComponent<IPktTextarea & RefAttributes<HTMLTextAreaElement>>;
|
|
729
725
|
|
|
730
|
-
export declare const PktTextinput: default_2.ForwardRefExoticComponent<
|
|
726
|
+
export declare const PktTextinput: default_2.ForwardRefExoticComponent<IPktTextinput & default_2.RefAttributes<HTMLInputElement>>;
|
|
731
727
|
|
|
732
728
|
declare interface PreviewProps {
|
|
733
729
|
children?: ReactNode;
|