@oslokommune/punkt-react 14.5.3 → 15.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 +33 -0
- package/dist/index.d.ts +64 -21
- package/dist/punkt-react.es.js +7198 -4674
- package/dist/punkt-react.umd.js +573 -569
- package/package.json +5 -5
- package/src/components/calendar/Calendar.accessibility.test.tsx +75 -0
- package/src/components/calendar/Calendar.constraints.test.tsx +84 -0
- package/src/components/calendar/Calendar.core.test.tsx +272 -0
- package/src/components/calendar/Calendar.interaction.test.tsx +96 -0
- package/src/components/calendar/Calendar.selection.test.tsx +227 -0
- package/src/components/calendar/Calendar.tsx +54 -0
- package/src/components/calendar/CalendarGrid.tsx +192 -0
- package/src/components/calendar/CalendarNav.tsx +111 -0
- package/src/components/calendar/calendar-utils.ts +90 -0
- package/src/components/calendar/types.ts +160 -0
- package/src/components/calendar/useCalendarState.ts +426 -0
- package/src/components/datepicker/DateTags.tsx +43 -0
- package/src/components/datepicker/Datepicker.accessibility.test.tsx +404 -0
- package/src/components/datepicker/Datepicker.core.test.tsx +270 -0
- package/src/components/datepicker/Datepicker.input.test.tsx +218 -0
- package/src/components/datepicker/Datepicker.selection.test.tsx +302 -0
- package/src/components/datepicker/Datepicker.tsx +61 -79
- package/src/components/datepicker/Datepicker.validation.test.tsx +317 -0
- package/src/components/datepicker/DatepickerInputs.tsx +184 -0
- package/src/components/datepicker/DatepickerPopup.tsx +90 -0
- package/src/components/datepicker/types.ts +139 -0
- package/src/components/datepicker/useDatepickerState.ts +502 -0
- package/src/components/index.ts +1 -0
- package/src/components/datepicker/Datepicker.test.tsx +0 -395
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,39 @@ og skriver commits ca etter [Conventional Commits](https://conventionalcommits.o
|
|
|
5
5
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
+
## [15.0.0](https://github.com/oslokommune/punkt/compare/14.5.4...15.0.0) (2026-02-12)
|
|
9
|
+
|
|
10
|
+
### ⚠ BREAKING CHANGES
|
|
11
|
+
* PktDatepicker er nå en ren React-komponent - pluss endringer i Elements pkt-datepicker (#3241). BREAKING CHANGE: **React datepicker bruker ikke Custom Event i onValueChange, men returnerer array direkte**
|
|
12
|
+
|
|
13
|
+
BREAKING CHANGE: **Endringer i HTML-attributter for Punkt Elements `<pkt-datepicker>`**
|
|
14
|
+
|
|
15
|
+
`showRangeLabels` er nå `show-range-labels`
|
|
16
|
+
`calendarOpen` er nå `calendar-open`
|
|
17
|
+
|
|
18
|
+
JavaScript-properties og React-props (`showRangeLabels`, `calendarOpen`) er uendret — kun HTML-attributtene i Punkt Elements-varianten er endret.
|
|
19
|
+
|
|
20
|
+
**Andre endringer:**
|
|
21
|
+
|
|
22
|
+
Lagt til til en metode for å overstyre `today`, slik at dagens dato i kalenderen kan være markert som en annen dato enn dagens faktiske dato (nyttig om man har snapshot-tester som daglig vil vike fra gårsdagens snapshots.
|
|
23
|
+
|
|
24
|
+
Fikset en drøss med små visuelle bugs som er rapportert fra brukere og designer.
|
|
25
|
+
|
|
26
|
+
Datepicker støtter endelig attributten `fullwidth`.
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### Features
|
|
30
|
+
Ingen
|
|
31
|
+
|
|
32
|
+
### Bug Fixes
|
|
33
|
+
Ingen
|
|
34
|
+
|
|
35
|
+
### Chores
|
|
36
|
+
Ingen
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
|
|
8
41
|
## [14.5.3](https://github.com/oslokommune/punkt/compare/14.5.2...14.5.3) (2026-02-09)
|
|
9
42
|
|
|
10
43
|
### ⚠ BREAKING CHANGES
|
package/dist/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { FocusEventHandler } from 'react';
|
|
|
10
10
|
import { ForwardRefExoticComponent } from 'react';
|
|
11
11
|
import { HTMLAttributes } from 'react';
|
|
12
12
|
import { HTMLProps } from 'react';
|
|
13
|
+
import { IDatepickerStrings } from '../../../../../shared-types/datepicker';
|
|
13
14
|
import { InputHTMLAttributes } from 'react';
|
|
14
15
|
import { IPktBackLink as IPktBackLink_2 } from '@oslokommune/punkt-elements';
|
|
15
16
|
import { IPktCombobox as IPktCombobox_2 } from '@oslokommune/punkt-elements';
|
|
@@ -160,6 +161,37 @@ export declare interface IPktButton extends ButtonHTMLAttributes<HTMLButtonEleme
|
|
|
160
161
|
loadingAnimationPath?: string;
|
|
161
162
|
}
|
|
162
163
|
|
|
164
|
+
declare interface IPktCalendar {
|
|
165
|
+
selected?: string[];
|
|
166
|
+
multiple?: boolean;
|
|
167
|
+
maxMultiple?: number;
|
|
168
|
+
range?: boolean;
|
|
169
|
+
earliest?: string | null;
|
|
170
|
+
latest?: string | null;
|
|
171
|
+
excludedates?: Date[] | string[];
|
|
172
|
+
excludeweekdays?: string[];
|
|
173
|
+
weeknumbers?: boolean;
|
|
174
|
+
withcontrols?: boolean;
|
|
175
|
+
currentmonth?: Date | string | null;
|
|
176
|
+
today?: string;
|
|
177
|
+
strings?: IPktCalendarStrings;
|
|
178
|
+
onDateSelected?: (selected: string[]) => void;
|
|
179
|
+
onClose?: () => void;
|
|
180
|
+
id?: string;
|
|
181
|
+
className?: string;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
declare interface IPktCalendarStrings {
|
|
185
|
+
month?: string;
|
|
186
|
+
year?: string;
|
|
187
|
+
days?: string[];
|
|
188
|
+
daysShort?: string[];
|
|
189
|
+
months?: string[];
|
|
190
|
+
week?: string;
|
|
191
|
+
prevMonth?: string;
|
|
192
|
+
nextMonth?: string;
|
|
193
|
+
}
|
|
194
|
+
|
|
163
195
|
export declare interface IPktCard extends PktElType {
|
|
164
196
|
ariaLabel?: string;
|
|
165
197
|
metaLead?: string | null;
|
|
@@ -224,41 +256,41 @@ declare interface IPktConsent extends IPktConsent_2 {
|
|
|
224
256
|
onToggleConsent?: (e: CustomEvent) => void;
|
|
225
257
|
}
|
|
226
258
|
|
|
227
|
-
export declare interface IPktDatepicker extends InputHTMLAttributes<HTMLInputElement> {
|
|
259
|
+
export declare interface IPktDatepicker extends Omit<InputHTMLAttributes<HTMLInputElement>, 'value' | 'onChange'> {
|
|
260
|
+
id: string;
|
|
261
|
+
label: string;
|
|
228
262
|
value?: string | string[];
|
|
229
|
-
label?: string;
|
|
230
263
|
dateformat?: string;
|
|
231
264
|
multiple?: boolean;
|
|
232
265
|
maxlength?: number;
|
|
233
266
|
range?: boolean;
|
|
267
|
+
showRangeLabels?: boolean;
|
|
234
268
|
weeknumbers?: boolean;
|
|
235
269
|
withcontrols?: boolean;
|
|
236
|
-
fullwidth?: boolean;
|
|
237
270
|
excludedates?: string[];
|
|
238
271
|
excludeweekdays?: string[];
|
|
239
272
|
currentmonth?: string;
|
|
273
|
+
today?: string;
|
|
240
274
|
calendarOpen?: boolean;
|
|
241
|
-
|
|
242
|
-
|
|
275
|
+
timezone?: string;
|
|
276
|
+
fullwidth?: boolean;
|
|
277
|
+
hasFieldset?: boolean;
|
|
278
|
+
inline?: boolean;
|
|
279
|
+
helptext?: string | ReactNode;
|
|
280
|
+
helptextDropdown?: string | ReactNode;
|
|
281
|
+
helptextDropdownButton?: string;
|
|
282
|
+
hasError?: boolean;
|
|
283
|
+
errorMessage?: string | ReactNode;
|
|
243
284
|
optionalTag?: boolean;
|
|
244
285
|
optionalText?: string;
|
|
286
|
+
requiredTag?: boolean;
|
|
287
|
+
requiredText?: string;
|
|
245
288
|
tagText?: string;
|
|
246
289
|
useWrapper?: boolean;
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
errorMessage?: string | ReactNode | ReactNode[];
|
|
252
|
-
strings?: any;
|
|
253
|
-
ref?: LegacyRef<HTMLInputElement>;
|
|
254
|
-
onChange?: ChangeEventHandler<HTMLInputElement>;
|
|
255
|
-
onInput?: ChangeEventHandler<HTMLInputElement>;
|
|
256
|
-
onBlur?: FocusEventHandler<HTMLInputElement>;
|
|
257
|
-
onFocus?: FocusEventHandler<HTMLInputElement>;
|
|
258
|
-
onValueChange?: (e: CustomEvent) => void;
|
|
259
|
-
onToggleHelpText?: (e: CustomEvent) => void;
|
|
260
|
-
dataTestid?: string;
|
|
261
|
-
skipForwardTestid?: boolean;
|
|
290
|
+
strings?: IDatepickerStrings;
|
|
291
|
+
onChange?: (e: Event) => void;
|
|
292
|
+
onValueChange?: (values: string[]) => void;
|
|
293
|
+
className?: string;
|
|
262
294
|
}
|
|
263
295
|
|
|
264
296
|
export declare interface IPktFooter extends HTMLAttributes<HTMLDivElement> {
|
|
@@ -742,6 +774,17 @@ export declare const PktBreadcrumbs: ForwardRefExoticComponent<IPktBreadcrumbs &
|
|
|
742
774
|
|
|
743
775
|
export declare const PktButton: ForwardRefExoticComponent<IPktButton & RefAttributes<HTMLButtonElement>>;
|
|
744
776
|
|
|
777
|
+
export declare const PktCalendar: ForwardRefExoticComponent<IPktCalendar & RefAttributes<PktCalendarHandle>>;
|
|
778
|
+
|
|
779
|
+
declare interface PktCalendarHandle {
|
|
780
|
+
handleDateSelect: (selectedDate: Date | null) => void;
|
|
781
|
+
addToSelected: (selectedDate: Date) => void;
|
|
782
|
+
removeFromSelected: (selectedDate: Date) => void;
|
|
783
|
+
toggleSelected: (selectedDate: Date) => void;
|
|
784
|
+
focusOnCurrentDate: () => void;
|
|
785
|
+
close: () => void;
|
|
786
|
+
}
|
|
787
|
+
|
|
745
788
|
export declare const PktCard: FC<IPktCard>;
|
|
746
789
|
|
|
747
790
|
export declare const PktCheckbox: ForwardRefExoticComponent<IPktCheckbox & RefAttributes<HTMLInputElement>>;
|
|
@@ -750,7 +793,7 @@ export declare const PktCombobox: FC<IPktCombobox>;
|
|
|
750
793
|
|
|
751
794
|
export declare const PktConsent: ForwardRefExoticComponent<IPktConsent>;
|
|
752
795
|
|
|
753
|
-
export declare const PktDatepicker:
|
|
796
|
+
export declare const PktDatepicker: ForwardRefExoticComponent<IPktDatepicker & RefAttributes<HTMLDivElement>>;
|
|
754
797
|
|
|
755
798
|
declare interface PktElType extends HTMLAttributes<HTMLElement> {
|
|
756
799
|
className?: string;
|