@oslokommune/punkt-react 19.8.0 → 19.9.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 +27 -0
- package/dist/components/checkboxgroup/CheckboxGroup.d.ts +17 -0
- package/dist/components/checkboxgroup/CheckboxGroup.forms.test.d.ts +0 -0
- package/dist/components/checkboxgroup/CheckboxGroup.test.d.ts +0 -0
- package/dist/components/checkboxgroup/CheckboxGroupContext.d.ts +12 -0
- package/dist/components/index.d.ts +3 -1
- package/dist/components/inputwrapper/InputWrapper.d.ts +4 -1
- package/dist/components/interfaces.d.ts +2 -0
- package/dist/components/radio/RadioButton.d.ts +1 -1
- package/dist/components/radiogroup/RadioGroup.d.ts +17 -0
- package/dist/components/radiogroup/RadioGroup.forms.test.d.ts +0 -0
- package/dist/components/radiogroup/RadioGroup.test.d.ts +0 -0
- package/dist/components/radiogroup/RadioGroupContext.d.ts +13 -0
- package/dist/punkt-react.cjs +1 -1
- package/dist/punkt-react.js +2416 -2164
- package/dist/shared-strings/nb.d.ts +1 -0
- package/dist/shared-types/index.d.ts +4 -2
- package/dist/shared-types/option-group.d.ts +50 -0
- package/package.json +3 -3
- package/src/components/checkbox/Checkbox.test.tsx +77 -0
- package/src/components/checkbox/Checkbox.tsx +40 -6
- package/src/components/checkboxgroup/CheckboxGroup.forms.test.tsx +149 -0
- package/src/components/checkboxgroup/CheckboxGroup.test.tsx +495 -0
- package/src/components/checkboxgroup/CheckboxGroup.tsx +162 -0
- package/src/components/checkboxgroup/CheckboxGroupContext.ts +15 -0
- package/src/components/index.ts +3 -7
- package/src/components/inputwrapper/InputWrapper.tsx +21 -2
- package/src/components/interfaces.ts +2 -0
- package/src/components/radio/RadioButton.test.tsx +70 -0
- package/src/components/radio/RadioButton.tsx +52 -9
- package/src/components/radiogroup/RadioGroup.forms.test.tsx +145 -0
- package/src/components/radiogroup/RadioGroup.test.tsx +472 -0
- package/src/components/radiogroup/RadioGroup.tsx +123 -0
- package/src/components/radiogroup/RadioGroupContext.ts +16 -0
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,33 @@ og skriver commits ca etter [Conventional Commits](https://conventionalcommits.o
|
|
|
5
5
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
+
## [19.9.0](https://github.com/oslokommune/punkt/compare/19.8.0...19.9.0) (2026-10-05)
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
* Nye komponenter PktCheckboxGroup og PktRadioGroup (#3695). **PktCheckboxGroup + PktRadioGroup**
|
|
12
|
+
- Nye komponenter i både React og Elements
|
|
13
|
+
- Gruppene fungerer som skjemafelt, så man setter verdi, feilmeldinger, navn og innstillinger på selve gruppen
|
|
14
|
+
- Validering på gruppene, dersom man har required eller liknende
|
|
15
|
+
- Dokumentert en måte å ha "Annet" med et tekstfelt som et av valgene
|
|
16
|
+
- Massevis av nye tester for å sørge for at alt funker som det skal
|
|
17
|
+
|
|
18
|
+
**Bugfikser underveis**
|
|
19
|
+
- Radioer med samme navn i forskjellige skjemaer påvirker ikke lenger hverandre
|
|
20
|
+
- ElementsInternal polyfill trengte litt kjærlighet når man flytter skjemaelementer
|
|
21
|
+
- Rekkefølge på events i skjemaelementer er nå likt som i HTML
|
|
22
|
+
- `disabled` på input-wrapper med fieldset gir disabled-status til alle elementer inni
|
|
23
|
+
- `hidden`-attributt funker (Punkt overstyrte den tildels før)
|
|
24
|
+
|
|
25
|
+
**Dokumentasjon**
|
|
26
|
+
- Endret dokumentasjon for Checkbox og Radio buttons til å anbefale bruk av gruppene
|
|
27
|
+
- Kuttet ned teksten noe på de sidene
|
|
28
|
+
- Fikset Preview så vi kan vise gruppene på ordentlig vis, med reflektert tilstand i innstillinger
|
|
29
|
+
- La til Preview på switch-siden
|
|
30
|
+
- Oppdaterte alle skills
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
|
|
8
35
|
## [19.8.0](https://github.com/oslokommune/punkt/compare/19.7.0...19.8.0) (2026-10-05)
|
|
9
36
|
|
|
10
37
|
### Features
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ChangeEvent, FocusEvent, ReactNode } from 'react';
|
|
2
|
+
import { IPktCheckboxGroupBase } from '../../shared-types';
|
|
3
|
+
import { TPktOptionGroupElement } from '../../hooks/useOptionGroupField';
|
|
4
|
+
export type TPktCheckboxGroupElement = TPktOptionGroupElement<string[]>;
|
|
5
|
+
export interface IPktCheckboxGroup extends Omit<IPktCheckboxGroupBase, 'label' | 'helptext' | 'helptextDropdown' | 'errorMessage'> {
|
|
6
|
+
label: string;
|
|
7
|
+
helptext?: string | ReactNode;
|
|
8
|
+
helptextDropdown?: string | ReactNode;
|
|
9
|
+
errorMessage?: string | ReactNode;
|
|
10
|
+
className?: string;
|
|
11
|
+
children?: ReactNode;
|
|
12
|
+
onChange?: (event: ChangeEvent<TPktCheckboxGroupElement>) => void;
|
|
13
|
+
onValueChange?: (value: string[]) => void;
|
|
14
|
+
onFocus?: (event: FocusEvent<TPktCheckboxGroupElement>) => void;
|
|
15
|
+
onBlur?: (event: FocusEvent<TPktCheckboxGroupElement>) => void;
|
|
16
|
+
}
|
|
17
|
+
export declare const PktCheckboxGroup: import('react').ForwardRefExoticComponent<IPktCheckboxGroup & import('react').RefAttributes<TPktCheckboxGroupElement>>;
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ChangeEvent } from 'react';
|
|
2
|
+
export interface ICheckboxGroupContext {
|
|
3
|
+
name: string;
|
|
4
|
+
hasTile: boolean;
|
|
5
|
+
hasError: boolean;
|
|
6
|
+
disabled: boolean;
|
|
7
|
+
value: string[] | undefined;
|
|
8
|
+
defaultValue: string[] | undefined;
|
|
9
|
+
onOptionChange: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
10
|
+
}
|
|
11
|
+
export declare const CheckboxGroupContext: import('react').Context<ICheckboxGroupContext | null>;
|
|
12
|
+
export declare const useCheckboxGroupContext: () => ICheckboxGroupContext | null;
|
|
@@ -7,6 +7,7 @@ export { PktButton } from './button/Button';
|
|
|
7
7
|
export { PktCalendar } from './calendar/Calendar';
|
|
8
8
|
export { PktCard } from './card/Card';
|
|
9
9
|
export { PktCheckbox } from './checkbox/Checkbox';
|
|
10
|
+
export { PktCheckboxGroup } from './checkboxgroup/CheckboxGroup';
|
|
10
11
|
export { PktCombobox } from './combobox/Combobox';
|
|
11
12
|
export { PktConsent } from './consent/Consent';
|
|
12
13
|
export { PktDatepicker } from './datepicker/Datepicker';
|
|
@@ -32,6 +33,7 @@ export { PktMessagebox } from './messagebox/Messagebox';
|
|
|
32
33
|
export { PktModal } from './modal/Modal';
|
|
33
34
|
export { PktProgressbar } from './progressbar/Progressbar';
|
|
34
35
|
export { PktRadioButton } from './radio/RadioButton';
|
|
36
|
+
export { PktRadioGroup } from './radiogroup/RadioGroup';
|
|
35
37
|
export { PktSearchInput } from './searchinput/SearchInput';
|
|
36
38
|
export type { PktSearchInputSuggestion } from './searchinput/SearchInput';
|
|
37
39
|
export { PktSelect } from './select/Select';
|
|
@@ -54,5 +56,5 @@ export * from './interfaces';
|
|
|
54
56
|
export * from './types';
|
|
55
57
|
export { PktStringsProvider } from './strings/PktStringsProvider';
|
|
56
58
|
export type { IPktStringsProvider } from './strings/PktStringsProvider';
|
|
57
|
-
export { getPktStrings, nb as pktStringsNb, resetPktStrings, setPktStrings, subscribePktStrings
|
|
59
|
+
export { getPktStrings, nb as pktStringsNb, resetPktStrings, setPktStrings, subscribePktStrings } from '../shared-strings';
|
|
58
60
|
export type { TPktStrings, TPktStringsNamespace, TPktStringsOverride, IPktStringsProps } from '../shared-strings';
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { ReactNode, RefAttributes } from 'react';
|
|
1
|
+
import { FocusEventHandler, ReactNode, RefAttributes } from 'react';
|
|
2
2
|
import { IPktStringsProps } from '../../shared-strings';
|
|
3
3
|
import { TLayout } from '../../shared-types';
|
|
4
4
|
export interface IPktInputWrapper extends RefAttributes<HTMLElement>, IPktStringsProps<'forms' | 'validation'> {
|
|
5
|
+
id?: string;
|
|
5
6
|
forId: string;
|
|
6
7
|
label: string;
|
|
7
8
|
helptext?: string | ReactNode;
|
|
@@ -31,5 +32,7 @@ export interface IPktInputWrapper extends RefAttributes<HTMLElement>, IPktString
|
|
|
31
32
|
role?: string;
|
|
32
33
|
counterPosition?: 'top' | 'bottom';
|
|
33
34
|
size?: 'small' | 'medium' | 'xsmall';
|
|
35
|
+
onFocus?: FocusEventHandler<HTMLDivElement>;
|
|
36
|
+
onBlur?: FocusEventHandler<HTMLDivElement>;
|
|
34
37
|
}
|
|
35
38
|
export declare const PktInputWrapper: import('react').ForwardRefExoticComponent<Omit<IPktInputWrapper, "ref"> & RefAttributes<HTMLDivElement>>;
|
|
@@ -6,6 +6,7 @@ export type { IPktBreadcrumbs } from './breadcrumbs/Breadcrumbs';
|
|
|
6
6
|
export type { IPktButton } from './button/Button';
|
|
7
7
|
export type { IPktCard } from './card/Card';
|
|
8
8
|
export type { IPktCheckbox } from './checkbox/Checkbox';
|
|
9
|
+
export type { IPktCheckboxGroup } from './checkboxgroup/CheckboxGroup';
|
|
9
10
|
export type { IPktCombobox } from './combobox/Combobox';
|
|
10
11
|
export type { IPktDatepicker } from './datepicker/Datepicker';
|
|
11
12
|
export type { IPktFileUpload } from './fileupload/FileUpload';
|
|
@@ -21,6 +22,7 @@ export type { IPktMessagebox } from './messagebox/Messagebox';
|
|
|
21
22
|
export type { IPktModal } from './modal/Modal';
|
|
22
23
|
export type { IPktProgressbar } from './progressbar/Progressbar';
|
|
23
24
|
export type { IPktRadioButton } from './radio/RadioButton';
|
|
25
|
+
export type { IPktRadioGroup } from './radiogroup/RadioGroup';
|
|
24
26
|
export type { IPktStep } from './stepper/Step';
|
|
25
27
|
export type { IPktStepper } from './stepper/Stepper';
|
|
26
28
|
export type { IPktTab } from './tabs/Tabs';
|
|
@@ -3,7 +3,7 @@ import { IPktStringsProps } from '../../shared-strings';
|
|
|
3
3
|
import { TPktInputSize } from '../../shared-types';
|
|
4
4
|
export interface IPktRadioButton extends InputHTMLAttributes<HTMLInputElement>, IPktStringsProps<'forms'> {
|
|
5
5
|
id: string;
|
|
6
|
-
name
|
|
6
|
+
name?: string;
|
|
7
7
|
label: string;
|
|
8
8
|
hasTile?: boolean;
|
|
9
9
|
inputSize?: TPktInputSize;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ChangeEvent, FocusEvent, ReactNode } from 'react';
|
|
2
|
+
import { IPktRadioGroupBase } from '../../shared-types';
|
|
3
|
+
import { TPktOptionGroupElement } from '../../hooks/useOptionGroupField';
|
|
4
|
+
export type TPktRadioGroupElement = TPktOptionGroupElement<string>;
|
|
5
|
+
export interface IPktRadioGroup extends Omit<IPktRadioGroupBase, 'label' | 'helptext' | 'helptextDropdown' | 'errorMessage'> {
|
|
6
|
+
label: string;
|
|
7
|
+
helptext?: string | ReactNode;
|
|
8
|
+
helptextDropdown?: string | ReactNode;
|
|
9
|
+
errorMessage?: string | ReactNode;
|
|
10
|
+
className?: string;
|
|
11
|
+
children?: ReactNode;
|
|
12
|
+
onChange?: (event: ChangeEvent<TPktRadioGroupElement>) => void;
|
|
13
|
+
onValueChange?: (value: string) => void;
|
|
14
|
+
onFocus?: (event: FocusEvent<TPktRadioGroupElement>) => void;
|
|
15
|
+
onBlur?: (event: FocusEvent<TPktRadioGroupElement>) => void;
|
|
16
|
+
}
|
|
17
|
+
export declare const PktRadioGroup: import('react').ForwardRefExoticComponent<IPktRadioGroup & import('react').RefAttributes<TPktRadioGroupElement>>;
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ChangeEvent } from 'react';
|
|
2
|
+
export interface IRadioGroupContext {
|
|
3
|
+
name: string;
|
|
4
|
+
hasTile: boolean;
|
|
5
|
+
hasError: boolean;
|
|
6
|
+
disabled: boolean;
|
|
7
|
+
required: boolean;
|
|
8
|
+
value: string | undefined;
|
|
9
|
+
defaultValue: string | undefined;
|
|
10
|
+
onOptionChange: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
11
|
+
}
|
|
12
|
+
export declare const RadioGroupContext: import('react').Context<IRadioGroupContext | null>;
|
|
13
|
+
export declare const useRadioGroupContext: () => IRadioGroupContext | null;
|