@oslokommune/punkt-react 16.9.0 → 16.10.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.
Files changed (40) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/dist/index.d.ts +24 -24
  3. package/dist/punkt-react.es.js +14 -14
  4. package/dist/punkt-react.umd.js +8 -9
  5. package/dist/shared-types/aria.d.ts +65 -0
  6. package/dist/shared-types/booleanish.d.ts +13 -0
  7. package/dist/shared-types/calendar.d.ts +41 -0
  8. package/dist/shared-types/combobox.d.ts +34 -0
  9. package/dist/shared-types/datepicker.d.ts +46 -0
  10. package/dist/shared-types/form.d.ts +16 -0
  11. package/dist/shared-types/header.d.ts +88 -0
  12. package/dist/shared-types/heading.d.ts +9 -0
  13. package/dist/shared-types/index.d.ts +17 -0
  14. package/dist/shared-types/layout.d.ts +26 -0
  15. package/dist/shared-types/progressbar.d.ts +5 -0
  16. package/dist/shared-types/size.d.ts +18 -0
  17. package/dist/shared-types/skin.d.ts +24 -0
  18. package/dist/shared-types/timepicker.d.ts +20 -0
  19. package/dist/shared-utils/calendar/calendar-grid.d.ts +16 -0
  20. package/dist/shared-utils/calendar/date-validation.d.ts +22 -0
  21. package/dist/shared-utils/calendar/index.d.ts +10 -0
  22. package/dist/shared-utils/calendar/keyboard-navigation.d.ts +16 -0
  23. package/dist/shared-utils/calendar/selection-manager.d.ts +30 -0
  24. package/dist/shared-utils/combobox/index.d.ts +10 -0
  25. package/dist/shared-utils/combobox/input-utils.d.ts +38 -0
  26. package/dist/shared-utils/combobox/keyboard-navigation.d.ts +39 -0
  27. package/dist/shared-utils/combobox/option-utils.d.ts +50 -0
  28. package/dist/shared-utils/combobox/selection-manager.d.ts +71 -0
  29. package/dist/shared-utils/combobox/typeahead.d.ts +24 -0
  30. package/dist/shared-utils/date-utils.d.ts +138 -0
  31. package/dist/shared-utils/datepicker-utils.d.ts +73 -0
  32. package/dist/shared-utils/device-utils.d.ts +10 -0
  33. package/dist/shared-utils/timepicker/index.d.ts +6 -0
  34. package/dist/shared-utils/timepicker/options.d.ts +19 -0
  35. package/dist/shared-utils/timepicker/stepper.d.ts +20 -0
  36. package/dist/shared-utils/timepicker/time-utils.d.ts +19 -0
  37. package/dist/shared-utils/utils.d.ts +16 -0
  38. package/dist/shared-utils/value-utils.d.ts +17 -0
  39. package/package.json +5 -5
  40. package/src/components/modal/Modal.tsx +1 -1
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Shared combobox option utility functions used by both Elements and React packages.
3
+ * Only framework-agnostic functions belong here.
4
+ */
5
+ import type { IPktComboboxOption, TPktComboboxDisplayValue } from '../../shared-types/combobox';
6
+ /**
7
+ * Finds an option by its value, falling back to label match.
8
+ * Value matches are prioritized over label matches to avoid ambiguity
9
+ * when an option's label matches another option's value.
10
+ */
11
+ export declare const findOptionByValue: (options: IPktComboboxOption[], value: string | null) => IPktComboboxOption | null;
12
+ /**
13
+ * Finds the index of an option by its value, falling back to label match.
14
+ */
15
+ export declare const findOptionIndex: (options: IPktComboboxOption[], value: string | null) => number;
16
+ /**
17
+ * Filters options by a search string, matching against fulltext.
18
+ */
19
+ export declare const filterOptionsBySearch: (options: IPktComboboxOption[], search: string | null) => IPktComboboxOption[];
20
+ /**
21
+ * Builds the fulltext search string for an option.
22
+ */
23
+ export declare const buildFulltext: (option: IPktComboboxOption) => string;
24
+ /**
25
+ * Checks if the maximum number of selections has been reached.
26
+ */
27
+ export declare const isMaxSelectionReached: (selectedCount: number, maxlength: number | null) => boolean;
28
+ /**
29
+ * Returns the display text for an option based on the displayValueAs setting.
30
+ */
31
+ export declare const getOptionDisplayText: (option: IPktComboboxOption | null, displayValueAs: TPktComboboxDisplayValue) => string;
32
+ /**
33
+ * Parses a value prop (string or string[]) into a normalized array.
34
+ */
35
+ export declare const parseValueToArray: (value: string | string[] | null | undefined, multiple: boolean) => string[];
36
+ /**
37
+ * Finds typeahead matches from options based on search input.
38
+ * Returns filtered options and the best autocomplete suggestion.
39
+ */
40
+ export declare const findTypeaheadMatches: (options: IPktComboboxOption[], search: string) => {
41
+ filtered: IPktComboboxOption[];
42
+ suggestion: IPktComboboxOption | null;
43
+ };
44
+ /**
45
+ * Determines the user info message based on search state and matches.
46
+ */
47
+ export declare const getSearchInfoMessage: (searchValue: string, selectedValues: string[], options: IPktComboboxOption[], allowUserInput: boolean) => {
48
+ addValueText: string | null;
49
+ userInfoMessage: string;
50
+ };
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Shared combobox selection management functions used by both Elements and React packages.
3
+ * Only framework-agnostic functions belong here.
4
+ */
5
+ import type { IPktComboboxOption } from '../../shared-types/combobox';
6
+ /**
7
+ * Configuration for the toggleSelection function.
8
+ */
9
+ export interface IToggleSelectionConfig {
10
+ multiple: boolean;
11
+ allowUserInput: boolean;
12
+ maxlength: number | null;
13
+ }
14
+ /**
15
+ * Result of a toggle selection operation.
16
+ * Describes what happened and what the new state should be.
17
+ */
18
+ export interface IToggleSelectionResult {
19
+ values: string[];
20
+ options: IPktComboboxOption[];
21
+ shouldOptionsBeOpen: boolean;
22
+ shouldResetInput: boolean;
23
+ userInfoMessage: string;
24
+ searchValue: string;
25
+ newUserOption: IPktComboboxOption | null;
26
+ }
27
+ /**
28
+ * Marks an option as selected in the options array.
29
+ * Returns new arrays (immutable).
30
+ */
31
+ export declare const selectOption: (value: string | null, currentValues: string[], options: IPktComboboxOption[], maxlength: number | null, multiple: boolean) => {
32
+ values: string[];
33
+ options: IPktComboboxOption[];
34
+ };
35
+ /**
36
+ * Removes an option from the selection.
37
+ * Returns new arrays (immutable).
38
+ */
39
+ export declare const deselectOption: (value: string | null, currentValues: string[], options: IPktComboboxOption[]) => {
40
+ values: string[];
41
+ options: IPktComboboxOption[];
42
+ };
43
+ /**
44
+ * Selects all options (for multiple mode).
45
+ * Returns new arrays (immutable).
46
+ */
47
+ export declare const selectAllOptions: (options: IPktComboboxOption[], maxlength: number | null) => {
48
+ values: string[];
49
+ options: IPktComboboxOption[];
50
+ userInfoMessage: string;
51
+ };
52
+ /**
53
+ * Clears all selections.
54
+ * Returns new arrays (immutable).
55
+ */
56
+ export declare const clearAllSelections: (options: IPktComboboxOption[]) => {
57
+ values: string[];
58
+ options: IPktComboboxOption[];
59
+ };
60
+ /**
61
+ * Creates a new user-added option object.
62
+ */
63
+ export declare const createUserOption: (value: string) => IPktComboboxOption;
64
+ /**
65
+ * Core toggle selection logic.
66
+ *
67
+ * Given a value to toggle and the current state, returns the new state
68
+ * describing what happened. This is the framework-agnostic version of
69
+ * the combobox's toggleValue method.
70
+ */
71
+ export declare const toggleSelection: (value: string | null, currentValues: string[], options: IPktComboboxOption[], config: IToggleSelectionConfig) => IToggleSelectionResult;
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Shared combobox typeahead utility functions used by both Elements and React packages.
3
+ * Only framework-agnostic functions belong here.
4
+ */
5
+ /**
6
+ * Checks if a character is a letter or space (Unicode-aware).
7
+ */
8
+ export declare const isLetterOrSpace: (char: string) => boolean;
9
+ /**
10
+ * Creates a typeahead handler that manages debounced character accumulation.
11
+ * Returns a stateful handler — call destroy() when done to clear timeouts.
12
+ */
13
+ export declare const createTypeaheadHandler: (timeout?: number) => {
14
+ append: (char: string) => string;
15
+ reset: () => void;
16
+ getBuffer: () => string;
17
+ };
18
+ /**
19
+ * Finds the first option element whose text content starts with the search string.
20
+ * Works with an array of elements, matching against textContent.
21
+ */
22
+ export declare const findTypeaheadOptionMatch: (options: {
23
+ textContent: string | null;
24
+ }[], searchString: string) => number;
@@ -0,0 +1,138 @@
1
+ import { TZDate } from '@date-fns/tz';
2
+ declare global {
3
+ interface Window {
4
+ pktTz: string;
5
+ }
6
+ }
7
+ /**
8
+ * Returns the current date in the specified timezone, with time set to 00:00:00
9
+ * @param tz - Timezone string (default: window.pktTz)
10
+ * @returns Date object representing today's date in the specified timezone
11
+ */
12
+ export declare const todayInTz: (tz?: string) => Date;
13
+ /**
14
+ * Parses an ISO date string and returns a Date object.
15
+ * Handles "YYYY-MM-DD", "YYYY-MM", and "YYYY" formats as local dates.
16
+ * @param date - The ISO date string to parse
17
+ * @returns A Date object
18
+ */
19
+ export declare function parseISODateString(date: string | null | undefined): Date;
20
+ /**
21
+ * Formats a Date or TZDate object to an ISO date string (YYYY-MM-DD).
22
+ * Uses local time, not UTC.
23
+ * @param date - The Date or TZDate object to format
24
+ * @returns An ISO date string
25
+ */
26
+ export declare const formatISODate: (date: Date | TZDate) => string;
27
+ /**
28
+ * Converts an ISO date string to a Date object
29
+ * @param date - The ISO date string to convert
30
+ * @returns A Date object or null if invalid
31
+ */
32
+ export declare const fromISOToDate: (date: string | null) => Date | null;
33
+ /**
34
+ * Converts an ISO date string to a formatted date string
35
+ * @param date - The ISO date string to convert
36
+ * @param dateformat - The desired date format
37
+ * @returns A formatted date string
38
+ */
39
+ export declare const fromISOtoLocal: (date: string, dateformat: string) => string;
40
+ /**
41
+ * Creates a new Date object based on the provided date string or Date object.
42
+ * Optionally sets the time to the start or end of the day.
43
+ * @param date - The date string or Date object
44
+ * @param timeOfDay - 'start' to set time to 00:00:00, 'end' to set time to 23:59:59
45
+ * @returns A Date object
46
+ */
47
+ export declare const newDate: (date?: string | Date, timeOfDay?: "start" | "end") => Date;
48
+ /**
49
+ * Creates a new Date object based on the provided year, month, and day.
50
+ * If the inputs are invalid, returns the current date.
51
+ * @param year - The year
52
+ * @param month - The month (0-11)
53
+ * @param day - The day of the month (default: 1)
54
+ * @returns A Date object
55
+ */
56
+ export declare const newDateYMD: (year: number, month: number, day?: number) => Date;
57
+ /**
58
+ * Creates a new Date object based on the provided date string or Date object.
59
+ * Sets the time to noon (12:00:00) to avoid timezone issues.
60
+ * @param date - The date string or Date object
61
+ * @returns A Date object with time set to noon
62
+ */
63
+ export declare const newDateFromDate: (date: Date | TZDate | number) => Date;
64
+ export declare const formatReadableDate: (date: Date | TZDate) => string;
65
+ /**
66
+ * Validates if a date is within the specified range
67
+ * @param date - The date to validate
68
+ * @param min - The minimum date (ISO string)
69
+ * @param max - The maximum date (ISO string)
70
+ * @returns boolean indicating if the date is in range
71
+ */
72
+ export declare const isDateInRange: (date: Date, min?: string | null, max?: string | null) => boolean;
73
+ /**
74
+ * Checks if a date is in the list of excluded dates
75
+ * @param date - The date to check
76
+ * @param excludedDates - Array of excluded date strings (ISO format)
77
+ * @returns boolean indicating if the date is excluded
78
+ */
79
+ export declare const isDateExcluded: (date: Date, excludedDates: string[]) => boolean;
80
+ /**
81
+ * Checks if a date's weekday is excluded
82
+ * @param date - The date to check
83
+ * @param excludedWeekdays - Array of excluded weekdays (0 = Sunday, 1 = Monday, etc.)
84
+ * @returns boolean indicating if the weekday is excluded
85
+ */
86
+ export declare const isWeekdayExcluded: (date: Date, excludedWeekdays: string[]) => boolean;
87
+ /**
88
+ * Validates if a date can be selected based on all constraints
89
+ * @param date - The date to validate
90
+ * @param min - The minimum date (ISO string)
91
+ * @param max - The maximum date (ISO string)
92
+ * @param excludedDates - Array of excluded date strings (ISO format)
93
+ * @param excludedWeekdays - Array of excluded weekdays (0 = Sunday, 1 = Monday, etc.)
94
+ * @returns boolean indicating if the date is selectable
95
+ */
96
+ export declare const isDateSelectable: (date: Date, min?: string | null, max?: string | null, excludedDates?: string[], excludedWeekdays?: string[]) => boolean;
97
+ /**
98
+ * Filters an array of date strings to only include selectable dates
99
+ * @param dates - Array of date strings (ISO format)
100
+ * @param min - The minimum date (ISO string)
101
+ * @param max - The maximum date (ISO string)
102
+ * @param excludedDates - Array of excluded date strings (ISO format)
103
+ * @param excludedWeekdays - Array of excluded weekdays (0 = Sunday, 1 = Monday, etc.)
104
+ * @returns Array of selectable date strings
105
+ */
106
+ export declare const filterSelectableDates: (dates: string[], min?: string | null, max?: string | null, excludedDates?: string[], excludedWeekdays?: string[]) => string[];
107
+ /**
108
+ * Sorts an array of ISO date strings chronologically
109
+ * @param dates - Array of date strings (ISO format)
110
+ * @returns Sorted array of date strings
111
+ */
112
+ export declare const sortDateStrings: (dates: string[]) => string[];
113
+ /**
114
+ * Validates a date range (start should be before or equal to end)
115
+ * @param startDate - The start date (ISO string)
116
+ * @param endDate - The end date (ISO string)
117
+ * @returns boolean indicating if the date range is valid
118
+ */
119
+ export declare const isValidDateRange: (startDate: string, endDate: string) => boolean;
120
+ declare const _default: {
121
+ todayInTz: (tz?: string) => Date;
122
+ parseISODateString: typeof parseISODateString;
123
+ formatISODate: (date: Date | TZDate) => string;
124
+ fromISOToDate: (date: string | null) => Date | null;
125
+ fromISOtoLocal: (date: string, dateformat: string) => string;
126
+ newDate: (date?: string | Date, timeOfDay?: "start" | "end") => Date;
127
+ newDateYMD: (year: number, month: number, day?: number) => Date;
128
+ newDateFromDate: (date: Date | TZDate | number) => Date;
129
+ formatReadableDate: (date: Date | TZDate) => string;
130
+ isDateInRange: (date: Date, min?: string | null, max?: string | null) => boolean;
131
+ isDateExcluded: (date: Date, excludedDates: string[]) => boolean;
132
+ isWeekdayExcluded: (date: Date, excludedWeekdays: string[]) => boolean;
133
+ isDateSelectable: (date: Date, min?: string | null, max?: string | null, excludedDates?: string[], excludedWeekdays?: string[]) => boolean;
134
+ filterSelectableDates: (dates: string[], min?: string | null, max?: string | null, excludedDates?: string[], excludedWeekdays?: string[]) => string[];
135
+ sortDateStrings: (dates: string[]) => string[];
136
+ isValidDateRange: (startDate: string, endDate: string) => boolean;
137
+ };
138
+ export default _default;
@@ -0,0 +1,73 @@
1
+ /**
2
+ * Shared datepicker utility functions used by both Elements and React packages.
3
+ * Only framework-agnostic functions belong here.
4
+ */
5
+ /**
6
+ * Determines the appropriate input type based on device.
7
+ * Returns 'text' on iOS to avoid native date picker conflicts.
8
+ */
9
+ export declare const getDatepickerInputType: () => string;
10
+ /**
11
+ * Validates that a range has valid order (start <= end).
12
+ * Returns true if range is valid or incomplete.
13
+ */
14
+ export declare const validateRangeOrder: (values: string[]) => boolean;
15
+ /**
16
+ * Sorts date strings chronologically.
17
+ */
18
+ export declare const sortDates: (dates: string[]) => string[];
19
+ /**
20
+ * Filters dates to only include selectable ones based on constraints.
21
+ */
22
+ export declare const filterDates: (dates: string[], min?: string | null, max?: string | null, excludedDates?: string[], excludedWeekdays?: string[]) => string[];
23
+ /**
24
+ * Generates input CSS classes for datepicker.
25
+ */
26
+ export declare const getDatepickerInputClasses: (fullwidth: boolean, showRangeLabels: boolean, multiple: boolean, range: boolean, readonly?: boolean, inputType?: string) => Record<string, boolean>;
27
+ /**
28
+ * Generates button CSS classes for calendar toggle button.
29
+ */
30
+ export declare const getDatepickerButtonClasses: () => Record<string, boolean>;
31
+ /**
32
+ * Generates range label CSS classes.
33
+ */
34
+ export declare const getRangeLabelClasses: (showRangeLabels: boolean) => Record<string, boolean>;
35
+ /**
36
+ * Processes date selection from calendar events.
37
+ * Converts the calendar's date selection into the appropriate string format.
38
+ */
39
+ export declare const processDateSelection: (detail: string | string[], multiple: boolean, range: boolean) => string;
40
+ /**
41
+ * Handles calendar positioning based on viewport and input position.
42
+ * Positions calendar below input by default, flips above if overflowing.
43
+ *
44
+ * Accepts plain DOM elements (not framework-specific refs).
45
+ */
46
+ export declare const handleCalendarPosition: (popup: HTMLElement | null, input: HTMLElement | null, hasCounter?: boolean) => void;
47
+ /**
48
+ * Handles common keyboard interactions for datepicker inputs.
49
+ *
50
+ * - Space: Opens calendar
51
+ * - Enter: Submits form, focuses next input, or blurs
52
+ * - Comma: Adds date to selection (multiple) or blurs input
53
+ */
54
+ export declare const handleDatepickerKeydown: (event: KeyboardEvent, toggleCalendar: (e: Event) => void, submitForm?: () => void, focusNextInput?: () => void, blurInput?: () => void, commaHandler?: (e: KeyboardEvent) => void) => void;
55
+ /**
56
+ * Handles keyboard interactions for calendar button.
57
+ * Responds to Enter and Space keys.
58
+ */
59
+ export declare const handleDatepickerButtonKeydown: (event: KeyboardEvent, toggleCalendar: (e: Event) => void) => void;
60
+ declare const _default: {
61
+ getDatepickerInputType: () => string;
62
+ validateRangeOrder: (values: string[]) => boolean;
63
+ sortDates: (dates: string[]) => string[];
64
+ filterDates: (dates: string[], min?: string | null, max?: string | null, excludedDates?: string[], excludedWeekdays?: string[]) => string[];
65
+ getDatepickerInputClasses: (fullwidth: boolean, showRangeLabels: boolean, multiple: boolean, range: boolean, readonly?: boolean, inputType?: string) => Record<string, boolean>;
66
+ getDatepickerButtonClasses: () => Record<string, boolean>;
67
+ getRangeLabelClasses: (showRangeLabels: boolean) => Record<string, boolean>;
68
+ processDateSelection: (detail: string | string[], multiple: boolean, range: boolean) => string;
69
+ handleCalendarPosition: (popup: HTMLElement | null, input: HTMLElement | null, hasCounter?: boolean) => void;
70
+ handleDatepickerKeydown: (event: KeyboardEvent, toggleCalendar: (e: Event) => void, submitForm?: () => void, focusNextInput?: () => void, blurInput?: () => void, commaHandler?: (e: KeyboardEvent) => void) => void;
71
+ handleDatepickerButtonKeydown: (event: KeyboardEvent, toggleCalendar: (e: Event) => void) => void;
72
+ };
73
+ export default _default;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Detects if the current device is iOS (iPhone, iPad, iPod)
3
+ * Handles modern iPad Safari which uses desktop user agent since iOS 13
4
+ * @returns boolean indicating if the device is iOS
5
+ */
6
+ export declare const isIOS: () => boolean;
7
+ declare const _default: {
8
+ isIOS: () => boolean;
9
+ };
10
+ export default _default;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Shared timepicker utilities for use by both Elements and React packages.
3
+ */
4
+ export { isValidTimeString, parseTimeString, timeToMinutes } from './time-utils';
5
+ export { getMinuteStep, getHourOptions, getMinuteOptions } from './options';
6
+ export { stepTime } from './stepper';
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Shared timepicker option generation utilities.
3
+ * Used by both Elements and React implementations.
4
+ * Only framework-agnostic functions belong here.
5
+ */
6
+ /**
7
+ * Converts a step value in seconds to a step value in minutes.
8
+ * Defaults to 1 if step is null/undefined/zero.
9
+ */
10
+ export declare const getMinuteStep: (stepSeconds?: number | null) => number;
11
+ /**
12
+ * Returns an array of valid hour values (0–23) based on min/max constraints.
13
+ * min and max should be HH:MM strings; invalid/missing values fall back to 0 and 23.
14
+ */
15
+ export declare const getHourOptions: (min?: string | number | null, max?: string | number | null) => number[];
16
+ /**
17
+ * Returns an array of valid minute values based on step constraints.
18
+ */
19
+ export declare const getMinuteOptions: (stepSeconds?: number | null) => number[];
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Shared timepicker stepper logic.
3
+ * Used by both Elements and React implementations.
4
+ * Only framework-agnostic functions belong here.
5
+ */
6
+ /**
7
+ * Increments or decrements the time by one minute-step.
8
+ * Rolls over: incrementing past 23:59 wraps to 00:00, and decrementing past 00:00 wraps to 23:59.
9
+ * Falls back to sensible defaults when hours/minutes are empty strings.
10
+ *
11
+ * @param hours - Current hours display value ('09', '', etc.)
12
+ * @param minutes - Current minutes display value ('30', '', etc.)
13
+ * @param direction - 1 for next, -1 for previous
14
+ * @param minuteStep - Step size in minutes
15
+ * @returns Zero-padded { hours, minutes } strings
16
+ */
17
+ export declare const stepTime: (hours: string, minutes: string, direction: 1 | -1, minuteStep: number) => {
18
+ hours: string;
19
+ minutes: string;
20
+ };
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Shared timepicker time utility functions.
3
+ * Used by both Elements and React implementations.
4
+ * Only framework-agnostic functions belong here.
5
+ */
6
+ /**
7
+ * Returns true if the string matches the HH:MM format with valid hour/minute ranges.
8
+ */
9
+ export declare const isValidTimeString: (value: string) => boolean;
10
+ /**
11
+ * Parses an HH:MM string into zero-padded [hours, minutes] strings.
12
+ * Returns null for empty or invalid values.
13
+ */
14
+ export declare const parseTimeString: (value: string) => [string, string] | null;
15
+ /**
16
+ * Converts an HH:MM string to total minutes since midnight.
17
+ * Assumes a valid time string.
18
+ */
19
+ export declare const timeToMinutes: (time: string) => number;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Sleep utility function for async delays
3
+ * @param ms - Number of milliseconds to sleep
4
+ * @returns A promise that resolves after the specified delay
5
+ */
6
+ export declare const sleep: (ms: number) => Promise<void>;
7
+ /**
8
+ * UUID-like string generator for very random identifiers
9
+ * @returns A UUID-like string (Not actually a valid UUID)
10
+ */
11
+ export declare const uuidish: () => string;
12
+ declare const _default: {
13
+ sleep: (ms: number) => Promise<void>;
14
+ uuidish: () => string;
15
+ };
16
+ export default _default;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Converts a value (string or string array) into an array of strings
3
+ * @param value - The value to convert
4
+ * @returns An array of strings
5
+ */
6
+ export declare const valueToArray: (value: string | string[] | null | undefined) => string[];
7
+ /**
8
+ * Converts an array of strings into a CSV string
9
+ * @param array - The array of strings to convert
10
+ * @returns A CSV string
11
+ */
12
+ export declare const arrayToCsv: (array: string[]) => string;
13
+ declare const _default: {
14
+ valueToArray: (value: string | string[] | null | undefined) => string[];
15
+ arrayToCsv: (array: string[]) => string;
16
+ };
17
+ export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oslokommune/punkt-react",
3
- "version": "16.9.0",
3
+ "version": "16.10.0",
4
4
  "description": "React komponentbibliotek til Punkt, et designsystem laget av Oslo Origo",
5
5
  "homepage": "https://punkt.oslo.kommune.no",
6
6
  "author": "Team Designsystem, Oslo Origo",
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "scripts": {
29
29
  "dev": "vite",
30
- "build": "tsc && vite build",
30
+ "build": "tsc && vite build && node scripts/bundle-shared-types.js",
31
31
  "build-app": "tsc && vite build --config vite.config-app.ts",
32
32
  "lint": "eslint 'src/**/*.{js,jsx,ts,tsx}'",
33
33
  "lint:fix": "eslint --fix 'src/**/*.{jsx,ts,tsx}'",
@@ -39,7 +39,7 @@
39
39
  "dependencies": {
40
40
  "@lit-labs/ssr-dom-shim": "^1.2.1",
41
41
  "@lit/react": "^1.0.7",
42
- "@oslokommune/punkt-elements": "^16.9.0",
42
+ "@oslokommune/punkt-elements": "^16.10.0",
43
43
  "classnames": "^2.5.1",
44
44
  "prettier": "^3.3.3",
45
45
  "react-hook-form": "^7.53.0"
@@ -50,7 +50,7 @@
50
50
  "@eslint/eslintrc": "^3.3.3",
51
51
  "@eslint/js": "^9.37.0",
52
52
  "@oslokommune/punkt-assets": "^16.0.0",
53
- "@oslokommune/punkt-css": "^16.8.2",
53
+ "@oslokommune/punkt-css": "^16.10.0",
54
54
  "@testing-library/jest-dom": "^6.5.0",
55
55
  "@testing-library/react": "^16.0.1",
56
56
  "@testing-library/user-event": "^14.5.2",
@@ -109,5 +109,5 @@
109
109
  "url": "https://github.com/oslokommune/punkt/issues"
110
110
  },
111
111
  "license": "MIT",
112
- "gitHead": "b5986d27e787fefda72f847d65bb9b7de2ab5316"
112
+ "gitHead": "7d339c3bc11d0da4291536496aebb6761dd519cb"
113
113
  }
@@ -20,7 +20,7 @@ export interface IPktModal
20
20
  headingText?: string
21
21
  hideCloseButton?: boolean
22
22
  closeOnBackdropClick?: boolean
23
- size?: 'small' | 'medium' | 'large'
23
+ size?: 'small' | 'medium' | 'large' | 'fit-content'
24
24
  removePadding?: boolean
25
25
  closeButtonSkin?: 'blue' | 'yellow-filled'
26
26
  variant?: 'dialog' | 'drawer'