@oslokommune/punkt-react 18.0.0 → 18.2.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 +34 -0
- package/dist/components/accordion/Accordion.d.ts +2 -12
- package/dist/components/accordion/AccordionItem.d.ts +2 -8
- package/dist/components/alert/Alert.d.ts +4 -3
- package/dist/components/backlink/BackLink.d.ts +3 -13
- package/dist/components/breadcrumbs/Breadcrumbs.d.ts +7 -16
- package/dist/components/calendar/types.d.ts +2 -4
- package/dist/components/checkbox/Checkbox.d.ts +2 -4
- package/dist/components/combobox/types.d.ts +3 -5
- package/dist/components/datepicker/DateTags.d.ts +2 -3
- package/dist/components/datepicker/types.d.ts +4 -5
- package/dist/components/fileupload/DropZone.d.ts +2 -4
- package/dist/components/fileupload/FileUpload.d.ts +9 -64
- package/dist/components/header/types.d.ts +3 -7
- package/dist/components/index.d.ts +1 -1
- package/dist/components/inputwrapper/InputWrapper.d.ts +2 -4
- package/dist/components/link/Link.d.ts +2 -6
- package/dist/components/radio/RadioButton.d.ts +2 -4
- package/dist/components/searchinput/SearchInput.d.ts +2 -4
- package/dist/components/select/Select.d.ts +2 -4
- package/dist/components/tag/Tag.d.ts +2 -4
- package/dist/components/textarea/Textarea.d.ts +2 -4
- package/dist/components/textinput/Textinput.d.ts +2 -4
- package/dist/components/timepicker/types.d.ts +2 -5
- package/dist/components/timepicker/useTimepickerState.d.ts +1 -1
- package/dist/punkt-react.cjs +1 -1
- package/dist/punkt-react.js +1208 -1203
- package/dist/shared-strings/index.d.ts +1 -1
- package/dist/shared-strings/nb.d.ts +3 -0
- package/dist/shared-strings/types.d.ts +17 -0
- package/dist/shared-types/accordion.d.ts +58 -0
- package/dist/shared-types/alert.d.ts +20 -0
- package/dist/shared-types/aria.d.ts +2 -1
- package/dist/shared-types/backlink.d.ts +23 -0
- package/dist/shared-types/breadcrumbs.d.ts +33 -0
- package/dist/shared-types/fileupload.d.ts +56 -2
- package/dist/shared-types/footer.d.ts +10 -0
- package/dist/shared-types/form-field.d.ts +46 -0
- package/dist/shared-types/header-footer.d.ts +2 -0
- package/dist/shared-types/index.d.ts +15 -5
- package/dist/shared-types/render-link.d.ts +22 -0
- package/dist/shared-types/searchinput.d.ts +2 -1
- package/dist/shared-types/skin.d.ts +2 -9
- package/package.json +2 -2
- package/src/components/accordion/Accordion.tsx +2 -12
- package/src/components/accordion/AccordionItem.tsx +2 -8
- package/src/components/alert/Alert.tsx +12 -5
- package/src/components/backlink/BackLink.tsx +7 -16
- package/src/components/breadcrumbs/Breadcrumbs.tsx +14 -16
- package/src/components/calendar/types.ts +2 -6
- package/src/components/checkbox/Checkbox.tsx +2 -4
- package/src/components/combobox/types.ts +3 -5
- package/src/components/datepicker/DateTags.tsx +2 -4
- package/src/components/datepicker/types.ts +6 -7
- package/src/components/fileupload/DropZone.tsx +3 -4
- package/src/components/fileupload/FileUpload.tsx +25 -68
- package/src/components/header/types.ts +3 -8
- package/src/components/index.ts +1 -1
- package/src/components/inputwrapper/InputWrapper.tsx +2 -4
- package/src/components/link/Link.tsx +2 -6
- package/src/components/radio/RadioButton.tsx +2 -4
- package/src/components/searchinput/SearchInput.tsx +2 -5
- package/src/components/select/Select.tsx +3 -4
- package/src/components/tag/Tag.tsx +2 -5
- package/src/components/textarea/Textarea.tsx +3 -4
- package/src/components/textinput/Textinput.tsx +3 -4
- package/src/components/timepicker/types.ts +2 -6
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,40 @@ og skriver commits ca etter [Conventional Commits](https://conventionalcommits.o
|
|
|
5
5
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
+
## [18.2.0](https://github.com/oslokommune/punkt/compare/18.1.0...18.2.0) (2026-09-01)
|
|
9
|
+
|
|
10
|
+
### ⚠ BREAKING CHANGES
|
|
11
|
+
Ingen
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
Ingen
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
Ingen
|
|
18
|
+
|
|
19
|
+
### Chores
|
|
20
|
+
Ingen
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
## [18.1.0](https://github.com/oslokommune/punkt/compare/18.0.0...18.1.0) (2026-08-31)
|
|
26
|
+
|
|
27
|
+
### ⚠ BREAKING CHANGES
|
|
28
|
+
Ingen
|
|
29
|
+
|
|
30
|
+
### Features
|
|
31
|
+
Ingen
|
|
32
|
+
|
|
33
|
+
### Bug Fixes
|
|
34
|
+
Ingen
|
|
35
|
+
|
|
36
|
+
### Chores
|
|
37
|
+
Ingen
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
|
|
8
42
|
## [18.0.0](https://github.com/oslokommune/punkt/compare/17.1.3...18.0.0) (2026-08-27)
|
|
9
43
|
|
|
10
44
|
### ⚠ BREAKING CHANGES
|
|
@@ -1,18 +1,8 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { TAccordionSkin } from '../../shared-types';
|
|
2
|
+
import { IPktAccordionBase, TAccordionSkin } from '../../shared-types';
|
|
3
3
|
export type TPktAccordionSkin = TAccordionSkin;
|
|
4
|
-
export interface IPktAccordion {
|
|
5
|
-
compact?: boolean;
|
|
6
|
-
/**
|
|
7
|
-
* @default skin: "borderless"
|
|
8
|
-
*/
|
|
9
|
-
skin?: TPktAccordionSkin;
|
|
10
|
-
/**
|
|
11
|
-
* @description A unique identifier to connect the accordion with a heading
|
|
12
|
-
*/
|
|
13
|
-
ariaLabelledBy?: string;
|
|
4
|
+
export interface IPktAccordion extends IPktAccordionBase {
|
|
14
5
|
children?: ReactNode;
|
|
15
|
-
name?: string;
|
|
16
6
|
className?: string;
|
|
17
7
|
}
|
|
18
8
|
export declare const useAccordionContext: () => {
|
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
import { MouseEvent, ReactNode, SyntheticEvent } from 'react';
|
|
2
|
-
import { TAccordionSkin } from '../../shared-types';
|
|
2
|
+
import { IPktAccordionItemBase, TAccordionSkin } from '../../shared-types';
|
|
3
3
|
export type TPktAccordionSkin = TAccordionSkin;
|
|
4
|
-
export interface IPktAccordionItem {
|
|
5
|
-
defaultOpen?: boolean;
|
|
6
|
-
id: string;
|
|
4
|
+
export interface IPktAccordionItem extends Omit<IPktAccordionItemBase, 'title'> {
|
|
7
5
|
title: string | ReactNode;
|
|
8
|
-
skin?: TPktAccordionSkin;
|
|
9
|
-
compact?: boolean;
|
|
10
|
-
isOpen?: boolean;
|
|
11
6
|
children?: ReactNode;
|
|
12
|
-
name?: string;
|
|
13
7
|
className?: string;
|
|
14
8
|
onClick?: (e: MouseEvent<HTMLDetailsElement>) => void;
|
|
15
9
|
onToggle?: (e: SyntheticEvent<HTMLDetailsElement>) => void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { FC, HTMLAttributes, ReactNode } from 'react';
|
|
2
|
-
import { TAlertRole, TAlertSkin, TAriaLive } from '../../shared-types';
|
|
3
|
-
|
|
2
|
+
import { TAlertRole, TAlertSkin, TAlertSize, TAriaLive } from '../../shared-types';
|
|
3
|
+
import { IPktStringsProps } from '../../shared-strings';
|
|
4
|
+
export interface IPktAlert extends Omit<HTMLAttributes<HTMLDivElement>, 'title'>, IPktStringsProps<'alert' | 'generic'> {
|
|
4
5
|
skin?: TAlertSkin;
|
|
5
6
|
closeAlert?: boolean;
|
|
6
7
|
title?: ReactNode;
|
|
@@ -16,7 +17,7 @@ export interface IPktAlert extends Omit<HTMLAttributes<HTMLDivElement>, 'title'>
|
|
|
16
17
|
*
|
|
17
18
|
* @default medium
|
|
18
19
|
*/
|
|
19
|
-
size?:
|
|
20
|
+
size?: TAlertSize;
|
|
20
21
|
onClose?: (e: CustomEvent) => void;
|
|
21
22
|
}
|
|
22
23
|
export type { TAlertSkin };
|
|
@@ -1,17 +1,7 @@
|
|
|
1
1
|
import { AnchorHTMLAttributes, ReactNode, Ref } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
export interface IPktBackLink extends Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'href'
|
|
4
|
-
|
|
5
|
-
strings?: TPktStringsOverride;
|
|
6
|
-
href?: string;
|
|
7
|
-
text?: string;
|
|
8
|
-
ariaLabel?: string;
|
|
9
|
-
renderLink?: (args: {
|
|
10
|
-
href: string;
|
|
11
|
-
className: string;
|
|
12
|
-
children: ReactNode;
|
|
13
|
-
props: AnchorHTMLAttributes<HTMLAnchorElement>;
|
|
14
|
-
}) => ReactNode;
|
|
2
|
+
import { IPktBackLinkBase, TRenderLink } from '../../shared-types';
|
|
3
|
+
export interface IPktBackLink extends Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'href'>, IPktBackLinkBase {
|
|
4
|
+
renderLink?: TRenderLink<ReactNode, AnchorHTMLAttributes<HTMLAnchorElement>>;
|
|
15
5
|
ref?: Ref<HTMLElement>;
|
|
16
6
|
}
|
|
17
7
|
export declare const PktBackLink: import('react').ForwardRefExoticComponent<Omit<IPktBackLink, "ref"> & import('react').RefAttributes<HTMLElement>>;
|
|
@@ -1,19 +1,10 @@
|
|
|
1
1
|
import { AnchorHTMLAttributes, ReactNode } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
strings?: TPktStringsOverride;
|
|
10
|
-
breadcrumbs: IBreadcrumbs[];
|
|
11
|
-
navigationType?: 'router' | 'anchor';
|
|
12
|
-
renderLink?: (args: {
|
|
13
|
-
href: string;
|
|
14
|
-
className: string;
|
|
15
|
-
children: ReactNode;
|
|
16
|
-
props: AnchorHTMLAttributes<HTMLAnchorElement>;
|
|
17
|
-
}) => ReactNode;
|
|
2
|
+
import { IBreadcrumb, IPktBreadcrumbsBase, TBreadcrumbsNavigationType, TRenderLink } from '../../shared-types';
|
|
3
|
+
export type { IBreadcrumb };
|
|
4
|
+
/** @deprecated Use `IBreadcrumb`. */
|
|
5
|
+
export type IBreadcrumbs = IBreadcrumb;
|
|
6
|
+
export interface IPktBreadcrumbs extends Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'children'>, IPktBreadcrumbsBase {
|
|
7
|
+
navigationType?: TBreadcrumbsNavigationType;
|
|
8
|
+
renderLink?: TRenderLink<ReactNode, AnchorHTMLAttributes<HTMLAnchorElement>>;
|
|
18
9
|
}
|
|
19
10
|
export declare const PktBreadcrumbs: import('react').ForwardRefExoticComponent<IPktBreadcrumbs & import('react').RefAttributes<HTMLAnchorElement>>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IDateConstraints, TDateRangeMap } from '../../shared-types/calendar';
|
|
2
|
-
import {
|
|
2
|
+
import { IPktStringsProps } from '../../shared-strings';
|
|
3
3
|
/** Datonavn og navigasjonstekster slik kalender-underkomponentene forventer dem. */
|
|
4
4
|
export interface IPktCalendarStrings {
|
|
5
5
|
month: string;
|
|
@@ -19,7 +19,7 @@ export interface PktCalendarHandle {
|
|
|
19
19
|
focusOnCurrentDate: () => void;
|
|
20
20
|
close: () => void;
|
|
21
21
|
}
|
|
22
|
-
export interface IPktCalendar {
|
|
22
|
+
export interface IPktCalendar extends IPktStringsProps<'dates' | 'calendar'> {
|
|
23
23
|
selected?: string[];
|
|
24
24
|
multiple?: boolean;
|
|
25
25
|
maxMultiple?: number;
|
|
@@ -32,8 +32,6 @@ export interface IPktCalendar {
|
|
|
32
32
|
withcontrols?: boolean;
|
|
33
33
|
currentmonth?: Date | string | null;
|
|
34
34
|
today?: string;
|
|
35
|
-
/** Overstyrer tekster for denne komponenten. */
|
|
36
|
-
strings?: TPktStringsOverride;
|
|
37
35
|
onDateSelected?: (selected: string[]) => void;
|
|
38
36
|
onClose?: () => void;
|
|
39
37
|
id?: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ChangeEventHandler, InputHTMLAttributes, ReactNode } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
export interface IPktCheckbox extends InputHTMLAttributes<HTMLInputElement> {
|
|
2
|
+
import { IPktStringsProps } from '../../shared-strings';
|
|
3
|
+
export interface IPktCheckbox extends InputHTMLAttributes<HTMLInputElement>, IPktStringsProps<'forms'> {
|
|
4
4
|
id: string;
|
|
5
5
|
hasTile?: boolean;
|
|
6
6
|
disabled?: boolean;
|
|
@@ -20,8 +20,6 @@ export interface IPktCheckbox extends InputHTMLAttributes<HTMLInputElement> {
|
|
|
20
20
|
requiredTag?: boolean;
|
|
21
21
|
/** @deprecated Bruk `strings={{ forms: { required: '…' } }}` eller `setPktStrings()`. */
|
|
22
22
|
requiredText?: string;
|
|
23
|
-
/** Overstyrer tekster for denne komponenten. */
|
|
24
|
-
strings?: TPktStringsOverride;
|
|
25
23
|
tagText?: string | null;
|
|
26
24
|
onChange?: ChangeEventHandler<HTMLInputElement>;
|
|
27
25
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { TPktStringsOverride } from '../../shared-strings';
|
|
1
|
+
import { IPktStringsProps, TPktStringsOverride } from '../../shared-strings';
|
|
2
2
|
import { ChangeEvent, ChangeEventHandler, FocusEvent, KeyboardEvent, MouseEvent as ReactMouseEvent, KeyboardEvent as ReactKeyboardEvent, ReactNode, RefObject } from 'react';
|
|
3
3
|
import { IPktComboboxOption, TPktComboboxDisplayValue, TPktComboboxTagPlacement } from '../../shared-types/combobox';
|
|
4
|
-
export interface IPktCombobox {
|
|
4
|
+
export interface IPktCombobox extends IPktStringsProps<'combobox' | 'listbox' | 'forms' | 'validation'> {
|
|
5
5
|
value?: string | string[];
|
|
6
6
|
defaultValue?: string | string[];
|
|
7
7
|
options?: IPktComboboxOption[];
|
|
@@ -34,8 +34,6 @@ export interface IPktCombobox {
|
|
|
34
34
|
useWrapper?: boolean;
|
|
35
35
|
inline?: boolean;
|
|
36
36
|
counter?: boolean;
|
|
37
|
-
/** Overstyrer tekster for denne komponenten. */
|
|
38
|
-
strings?: TPktStringsOverride;
|
|
39
37
|
hasFieldset?: boolean;
|
|
40
38
|
inputSize?: 'small' | 'medium' | 'xsmall';
|
|
41
39
|
onChange?: ChangeEventHandler<HTMLInputElement>;
|
|
@@ -45,7 +43,7 @@ export interface IPktCombobox {
|
|
|
45
43
|
}
|
|
46
44
|
export interface IComboboxState {
|
|
47
45
|
/** Tekstoverstyring sendt inn på komponenten. */
|
|
48
|
-
strings?: TPktStringsOverride
|
|
46
|
+
strings?: TPktStringsOverride<'combobox' | 'listbox' | 'forms' | 'validation'>;
|
|
49
47
|
id: string;
|
|
50
48
|
inputId: string;
|
|
51
49
|
listboxId: string;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
interface DateTagsProps {
|
|
1
|
+
import { IPktStringsProps } from '../../shared-strings';
|
|
2
|
+
interface DateTagsProps extends IPktStringsProps<'datepicker'> {
|
|
3
3
|
dates: string[];
|
|
4
4
|
dateformat: string;
|
|
5
5
|
idBase: string;
|
|
6
|
-
strings?: TPktStringsOverride;
|
|
7
6
|
onDateRemoved: (date: string) => void;
|
|
8
7
|
}
|
|
9
8
|
export declare const DateTags: ({ dates, dateformat, idBase, strings, onDateRemoved, }: DateTagsProps) => import("react").JSX.Element;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { TPktStrings, TPktStringsOverride } from '../../shared-strings';
|
|
1
|
+
import { TPktStrings, IPktStringsProps, TPktStringsOverride } from '../../shared-strings';
|
|
2
2
|
import { ChangeEvent, InputHTMLAttributes, ReactNode } from 'react';
|
|
3
3
|
import { TPktInputSize } from '../../shared-types/size';
|
|
4
|
-
export
|
|
4
|
+
export type TDatepickerStrings = 'generic' | 'datepicker' | 'validation' | 'forms' | 'dates' | 'calendar';
|
|
5
|
+
export interface IPktDatepicker extends Omit<InputHTMLAttributes<HTMLInputElement>, 'value' | 'onChange'>, IPktStringsProps<TDatepickerStrings> {
|
|
5
6
|
id: string;
|
|
6
7
|
label: string;
|
|
7
8
|
ariaDescribedby?: string;
|
|
@@ -35,8 +36,6 @@ export interface IPktDatepicker extends Omit<InputHTMLAttributes<HTMLInputElemen
|
|
|
35
36
|
requiredText?: string;
|
|
36
37
|
tagText?: string;
|
|
37
38
|
useWrapper?: boolean;
|
|
38
|
-
/** Overstyrer tekster for denne komponenten. */
|
|
39
|
-
strings?: TPktStringsOverride;
|
|
40
39
|
onChange?: (e: ChangeEvent<HTMLInputElement>) => void;
|
|
41
40
|
onValueChange?: (values: string[]) => void;
|
|
42
41
|
className?: string;
|
|
@@ -85,7 +84,7 @@ export interface IDatepickerState {
|
|
|
85
84
|
isIOSDevice: boolean;
|
|
86
85
|
strings: Pick<TPktStrings, 'generic' | 'datepicker' | 'validation'>;
|
|
87
86
|
/** Rå tekstoverstyring, til videresending til underkomponenter. */
|
|
88
|
-
stringsOverride?: TPktStringsOverride
|
|
87
|
+
stringsOverride?: TPktStringsOverride<TDatepickerStrings>;
|
|
89
88
|
inputClasses: string;
|
|
90
89
|
buttonClasses: string;
|
|
91
90
|
rangeLabelClasses: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { InputHTMLAttributes } from 'react';
|
|
2
2
|
import { TFileItemList, TUploadStrategy } from './types';
|
|
3
|
-
import {
|
|
3
|
+
import { IPktStringsProps } from '../../shared-strings';
|
|
4
4
|
/**
|
|
5
5
|
* Props for the internal `DropZone` building block.
|
|
6
6
|
*
|
|
@@ -9,9 +9,7 @@ import { TPktStringsOverride } from '../../shared-strings';
|
|
|
9
9
|
* - handling drag & drop + file dialog selection
|
|
10
10
|
* - optionally rendering hidden inputs with file IDs when `uploadStrategy="custom"`
|
|
11
11
|
*/
|
|
12
|
-
interface IDropZoneProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'checked' | 'size' | 'type' | 'value' | 'onChange' | 'width'> {
|
|
13
|
-
/** Overstyrer tekster for denne komponenten. */
|
|
14
|
-
strings?: TPktStringsOverride;
|
|
12
|
+
interface IDropZoneProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'checked' | 'size' | 'type' | 'value' | 'onChange' | 'width'>, IPktStringsProps<'fileupload'> {
|
|
15
13
|
/** Called with `FileItem`s created from dropped/selected files. */
|
|
16
14
|
onFilesAdded?: (files: TFileItemList) => void;
|
|
17
15
|
/** Used for the native input `id` and related label/ARIA wiring. */
|
|
@@ -1,86 +1,31 @@
|
|
|
1
1
|
import { FC, HTMLAttributes, InputHTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import { IPktFileUploadBase } from '../../shared-types';
|
|
2
3
|
import { ItemRenderers } from './QueueDisplay';
|
|
3
|
-
import { FileItem, TFileItemList, TFileTransfer,
|
|
4
|
-
import { TPktStringsOverride } from '../../shared-strings';
|
|
4
|
+
import { FileItem, TFileItemList, TFileTransfer, TItemRenderer, TQueueItemOperation } from './types';
|
|
5
5
|
export { formatFileSize, parseFileSize } from '../../shared-utils/fileupload';
|
|
6
6
|
/**
|
|
7
7
|
* Shared props for `PktFileUpload` (both `form` and `custom` strategies).
|
|
8
8
|
*/
|
|
9
|
-
interface IBaseFileUploadProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'checked' | 'size' | 'type' | 'value' | 'onChange' | 'width' | 'defaultValue'> {
|
|
9
|
+
interface IBaseFileUploadProps extends Omit<IPktFileUploadBase, 'helptext' | 'helptextDropdown' | 'itemRenderer' | 'extraOperations' | 'value' | 'defaultValue' | 'onFilesChanged' | 'onFileUploadRequested'>, Omit<InputHTMLAttributes<HTMLInputElement>, 'checked' | 'size' | 'type' | 'value' | 'onChange' | 'width' | 'defaultValue' | 'name'> {
|
|
10
10
|
/** Called with the next file list when files are added/removed/updated. */
|
|
11
11
|
onFilesChanged?: (files: TFileItemList) => void;
|
|
12
|
-
/** Allow selecting/dropping multiple files. */
|
|
13
|
-
multiple?: boolean;
|
|
14
|
-
/** Controlled value (recommended). */
|
|
15
|
-
value?: TFileItemList;
|
|
16
|
-
/** Upload mode. Defaults to `"form"`. */
|
|
17
|
-
uploadStrategy?: TUploadStrategy;
|
|
18
|
-
/** Field name. Used for native input (`form`) or hidden ID inputs (`custom`). */
|
|
19
|
-
name: string;
|
|
20
|
-
/** Enable comment operation (disabled automatically in thumbnail view). */
|
|
21
|
-
addCommentsEnabled?: boolean;
|
|
22
|
-
/** Enable rename operation (disabled automatically in thumbnail view). */
|
|
23
|
-
renameFilesEnabled?: boolean;
|
|
24
|
-
/** Renderer for queue items (`filename`, `thumbnail`, or custom function). */
|
|
25
|
-
itemRenderer?: keyof typeof ItemRenderers | TItemRenderer;
|
|
26
|
-
/** Number of trailing characters to keep when truncating long filenames. */
|
|
27
|
-
truncateTail?: number;
|
|
28
12
|
/**
|
|
29
13
|
* Called immediately when a file is added in `uploadStrategy="custom"`.
|
|
30
14
|
* Use it to start uploading the file and update `transfers`.
|
|
31
15
|
*/
|
|
32
16
|
onFileUploadRequested?: (fileItem: FileItem) => void;
|
|
17
|
+
/** Controlled value (recommended). */
|
|
18
|
+
value?: TFileItemList;
|
|
33
19
|
/** Uncontrolled initial value (use either `value` or `defaultValue`, not both). */
|
|
34
20
|
defaultValue?: TFileItemList;
|
|
35
|
-
/**
|
|
36
|
-
|
|
37
|
-
/** Stretch to full container width (drop zone + queue). */
|
|
38
|
-
fullwidth?: boolean;
|
|
39
|
-
/** Allowed formats for built-in validation (extensions like `pdf`, or MIME patterns like `image/*`). */
|
|
40
|
-
allowedFormats?: string[];
|
|
41
|
-
/** Custom message for invalid format. Use `{formats}` placeholder. */
|
|
42
|
-
formatErrorMessage?: string;
|
|
43
|
-
/** Max file size (e.g. `"5MB"` or bytes). */
|
|
44
|
-
maxFileSize?: string | number;
|
|
45
|
-
/** Custom message for size validation. Use `{maxSize}` placeholder. */
|
|
46
|
-
sizeErrorMessage?: string;
|
|
47
|
-
/** Optional additional validation hook (runs after built-in format/size checks). Return string to block. */
|
|
48
|
-
onFileValidation?: (file: File) => string | null;
|
|
49
|
-
/**
|
|
50
|
-
* Low-level validation escape hatch — Lit parity with the `file-validate` CustomEvent.
|
|
51
|
-
* Receives a detail object whose `errorMessage` can be mutated; set it to reject the file.
|
|
52
|
-
*/
|
|
53
|
-
onFileValidate?: (detail: TFileValidateDetail) => void;
|
|
54
|
-
/** External/programmatic error message shown under the component. */
|
|
55
|
-
errorMessage?: string;
|
|
56
|
-
/** External error flag (combined with internal validation errors). */
|
|
57
|
-
hasError?: boolean;
|
|
58
|
-
/** Disable the whole component (no interaction). */
|
|
59
|
-
disabled?: boolean;
|
|
60
|
-
/** Optional label/title (wraps the component in `PktInputWrapper`). */
|
|
61
|
-
label?: string;
|
|
21
|
+
/** Renderer for queue items (`filename`, `thumbnail`, or custom function). */
|
|
22
|
+
itemRenderer?: keyof typeof ItemRenderers | TItemRenderer;
|
|
62
23
|
/** Help text under the label. */
|
|
63
24
|
helptext?: string | ReactNode;
|
|
64
25
|
/** Expandable help text (dropdown). */
|
|
65
26
|
helptextDropdown?: string | ReactNode;
|
|
66
|
-
/**
|
|
67
|
-
|
|
68
|
-
/** Shows an "optional" tag. */
|
|
69
|
-
optionalTag?: boolean;
|
|
70
|
-
/** Label text for the optional tag. */
|
|
71
|
-
optionalText?: string;
|
|
72
|
-
/** Shows a "required" tag. */
|
|
73
|
-
requiredTag?: boolean;
|
|
74
|
-
/** Label text for the required tag. */
|
|
75
|
-
requiredText?: string;
|
|
76
|
-
/** Extra tag next to the label. */
|
|
77
|
-
tagText?: string | null;
|
|
78
|
-
/** Marks the upload as required. Native validation is used in `form`; submit validation in `custom`. */
|
|
79
|
-
required?: boolean;
|
|
80
|
-
/** Overstyrer tekster for denne komponenten. */
|
|
81
|
-
strings?: TPktStringsOverride;
|
|
82
|
-
/** Enable image preview modal (only applies to thumbnail renderer). */
|
|
83
|
-
enableImagePreview?: boolean;
|
|
27
|
+
/** Extra operations appended after built-ins (rename/comment). */
|
|
28
|
+
extraOperations?: Array<TQueueItemOperation>;
|
|
84
29
|
}
|
|
85
30
|
interface IFileInputFileUploadProps extends IBaseFileUploadProps, Omit<HTMLAttributes<HTMLInputElement>, 'value' | 'onChange' | 'defaultValue'> {
|
|
86
31
|
uploadStrategy?: 'form';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MouseEvent, ReactNode } from 'react';
|
|
2
2
|
import { THeaderMenu, THeaderPosition, THeaderScrollBehavior, TLogOutButtonPlacement, TSlotMenuVariant, THeaderFooterApi, THeaderMenuLocale, IPktHeaderGlobal as ISharedPktHeaderGlobal } from '../../shared-types';
|
|
3
|
-
import {
|
|
3
|
+
import { IPktStringsProps } from '../../shared-strings';
|
|
4
4
|
export type { THeaderMenu, THeaderPosition, THeaderScrollBehavior, TLogOutButtonPlacement, TSlotMenuVariant, THeaderFooterApi, THeaderMenuLocale, };
|
|
5
5
|
/** Which header variant `<PktHeader>` renders. */
|
|
6
6
|
export type THeaderType = 'service' | 'global';
|
|
@@ -29,9 +29,7 @@ export interface UserMenuFooterItem {
|
|
|
29
29
|
title: string;
|
|
30
30
|
target: string | (() => void);
|
|
31
31
|
}
|
|
32
|
-
export interface IPktHeader {
|
|
33
|
-
/** Overstyrer tekster for denne komponenten. */
|
|
34
|
-
strings?: TPktStringsOverride;
|
|
32
|
+
export interface IPktHeader extends IPktStringsProps<'header'> {
|
|
35
33
|
children?: ReactNode;
|
|
36
34
|
/** Additional CSS class name(s) to apply to the header */
|
|
37
35
|
className?: string;
|
|
@@ -104,9 +102,7 @@ export interface IPktHeader {
|
|
|
104
102
|
* Extends the framework-agnostic {@link ISharedPktHeaderGlobal} base
|
|
105
103
|
* (in shared-types) with React-specific callbacks and DOM props.
|
|
106
104
|
*/
|
|
107
|
-
export interface IPktHeaderGlobal extends ISharedPktHeaderGlobal {
|
|
108
|
-
/** Overstyrer tekster for denne komponenten. */
|
|
109
|
-
strings?: TPktStringsOverride;
|
|
105
|
+
export interface IPktHeaderGlobal extends ISharedPktHeaderGlobal, IPktStringsProps<'header'> {
|
|
110
106
|
/** Additional CSS class name(s) to apply to the header */
|
|
111
107
|
className?: string;
|
|
112
108
|
/** Set dark mode on the header */
|
|
@@ -55,4 +55,4 @@ export * from './types';
|
|
|
55
55
|
export { PktStringsProvider } from './strings/PktStringsProvider';
|
|
56
56
|
export type { IPktStringsProvider } from './strings/PktStringsProvider';
|
|
57
57
|
export { getPktStrings, nb as pktStringsNb, resetPktStrings, setPktStrings, subscribePktStrings, } from '../shared-strings';
|
|
58
|
-
export type { TPktStrings, TPktStringsNamespace, TPktStringsOverride } from '../shared-strings';
|
|
58
|
+
export type { TPktStrings, TPktStringsNamespace, TPktStringsOverride, IPktStringsProps } from '../shared-strings';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode, RefAttributes } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
export interface IPktInputWrapper extends RefAttributes<HTMLElement> {
|
|
2
|
+
import { IPktStringsProps } from '../../shared-strings';
|
|
3
|
+
export interface IPktInputWrapper extends RefAttributes<HTMLElement>, IPktStringsProps<'forms' | 'validation'> {
|
|
4
4
|
forId: string;
|
|
5
5
|
label: string;
|
|
6
6
|
helptext?: string | ReactNode;
|
|
@@ -29,7 +29,5 @@ export interface IPktInputWrapper extends RefAttributes<HTMLElement> {
|
|
|
29
29
|
role?: string;
|
|
30
30
|
counterPosition?: 'top' | 'bottom';
|
|
31
31
|
size?: 'small' | 'medium' | 'xsmall';
|
|
32
|
-
/** Overstyrer tekster for denne komponenten. */
|
|
33
|
-
strings?: TPktStringsOverride;
|
|
34
32
|
}
|
|
35
33
|
export declare const PktInputWrapper: import('react').ForwardRefExoticComponent<Omit<IPktInputWrapper, "ref"> & RefAttributes<HTMLDivElement>>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AnchorHTMLAttributes, FC, LinkHTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import { TRenderLink } from '../../shared-types';
|
|
2
3
|
interface IPktLink extends LinkHTMLAttributes<HTMLAnchorElement> {
|
|
3
4
|
href?: string;
|
|
4
5
|
iconName?: string | undefined;
|
|
@@ -6,12 +7,7 @@ interface IPktLink extends LinkHTMLAttributes<HTMLAnchorElement> {
|
|
|
6
7
|
iconPosition?: string | undefined;
|
|
7
8
|
external?: boolean;
|
|
8
9
|
target?: string | undefined;
|
|
9
|
-
renderLink?:
|
|
10
|
-
href: string;
|
|
11
|
-
className: string;
|
|
12
|
-
children: ReactNode;
|
|
13
|
-
props: AnchorHTMLAttributes<HTMLAnchorElement>;
|
|
14
|
-
}) => ReactNode;
|
|
10
|
+
renderLink?: TRenderLink<ReactNode, AnchorHTMLAttributes<HTMLAnchorElement>>;
|
|
15
11
|
}
|
|
16
12
|
export declare const PktLink: FC<IPktLink>;
|
|
17
13
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ChangeEventHandler, InputHTMLAttributes, ReactNode } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
export interface IPktRadioButton extends InputHTMLAttributes<HTMLInputElement> {
|
|
2
|
+
import { IPktStringsProps } from '../../shared-strings';
|
|
3
|
+
export interface IPktRadioButton extends InputHTMLAttributes<HTMLInputElement>, IPktStringsProps<'forms'> {
|
|
4
4
|
id: string;
|
|
5
5
|
name: string;
|
|
6
6
|
label: string;
|
|
@@ -17,8 +17,6 @@ export interface IPktRadioButton extends InputHTMLAttributes<HTMLInputElement> {
|
|
|
17
17
|
requiredTag?: boolean;
|
|
18
18
|
/** @deprecated Bruk `strings={{ forms: { required: '…' } }}` eller `setPktStrings()`. */
|
|
19
19
|
requiredText?: string;
|
|
20
|
-
/** Overstyrer tekster for denne komponenten. */
|
|
21
|
-
strings?: TPktStringsOverride;
|
|
22
20
|
tagText?: string | null;
|
|
23
21
|
onChange?: ChangeEventHandler<HTMLInputElement>;
|
|
24
22
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ChangeEvent, HTMLProps, ReactNode } from 'react';
|
|
2
2
|
import { IPktSearchInputSuggestion } from '../../shared-types/searchinput';
|
|
3
|
-
import {
|
|
3
|
+
import { IPktStringsProps } from '../../shared-strings';
|
|
4
4
|
/**
|
|
5
5
|
* React suggestion item: portable fields from {@link IPktSearchInputSuggestion}
|
|
6
6
|
* plus optional rich content and per-row handler.
|
|
@@ -10,9 +10,7 @@ export type PktSearchInputSuggestion = Omit<IPktSearchInputSuggestion, 'title' |
|
|
|
10
10
|
text?: string | ReactNode;
|
|
11
11
|
onClick?: () => void;
|
|
12
12
|
};
|
|
13
|
-
interface ISearch extends HTMLProps<HTMLInputElement> {
|
|
14
|
-
/** Overstyrer tekster for denne komponenten. */
|
|
15
|
-
strings?: TPktStringsOverride;
|
|
13
|
+
interface ISearch extends HTMLProps<HTMLInputElement>, IPktStringsProps<'searchinput'> {
|
|
16
14
|
appearance?: 'local' | 'local-with-button' | 'global';
|
|
17
15
|
inputSize?: 'small' | 'medium' | 'xsmall';
|
|
18
16
|
disabled?: boolean;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { ReactNode, SelectHTMLAttributes } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { IPktStringsProps } from '../../shared-strings';
|
|
3
3
|
export type { IPktSelectOption, TSelectOption } from '../../shared-types/select';
|
|
4
|
-
export interface IPktSelectProps extends SelectHTMLAttributes<HTMLSelectElement> {
|
|
5
|
-
/** Overstyrer tekster for denne komponenten. */
|
|
6
|
-
strings?: TPktStringsOverride;
|
|
4
|
+
export interface IPktSelectProps extends SelectHTMLAttributes<HTMLSelectElement>, IPktStringsProps<'forms' | 'validation'> {
|
|
7
5
|
ariaDescribedby?: string;
|
|
8
6
|
ariaLabelledby?: string;
|
|
9
7
|
children?: ReactNode | ReactNode[];
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
2
|
import { TTagSkin } from '../../shared-types';
|
|
3
|
-
import {
|
|
4
|
-
interface BasePktTagProps {
|
|
5
|
-
/** Overstyrer tekster for denne komponenten. */
|
|
6
|
-
strings?: TPktStringsOverride;
|
|
3
|
+
import { IPktStringsProps } from '../../shared-strings';
|
|
4
|
+
interface BasePktTagProps extends IPktStringsProps<'tag'> {
|
|
7
5
|
skin?: TTagSkin;
|
|
8
6
|
textStyle?: 'normal-text' | 'thin-text';
|
|
9
7
|
size?: 'small' | 'medium' | 'large';
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { ChangeEventHandler, ReactNode, TextareaHTMLAttributes } from 'react';
|
|
2
2
|
import { TPktInputSize } from '../../shared-types/size';
|
|
3
|
-
import {
|
|
4
|
-
export interface IPktTextarea extends TextareaHTMLAttributes<HTMLTextAreaElement> {
|
|
5
|
-
/** Overstyrer tekster for denne komponenten. */
|
|
6
|
-
strings?: TPktStringsOverride;
|
|
3
|
+
import { IPktStringsProps } from '../../shared-strings';
|
|
4
|
+
export interface IPktTextarea extends TextareaHTMLAttributes<HTMLTextAreaElement>, IPktStringsProps<'forms' | 'validation'> {
|
|
7
5
|
id: string;
|
|
8
6
|
ariaDescribedby?: string;
|
|
9
7
|
ariaLabelledby?: string;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { ChangeEventHandler, InputHTMLAttributes, ReactNode } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
export interface IPktTextinput extends InputHTMLAttributes<HTMLInputElement> {
|
|
4
|
-
/** Overstyrer tekster for denne komponenten. */
|
|
5
|
-
strings?: TPktStringsOverride;
|
|
2
|
+
import { IPktStringsProps } from '../../shared-strings';
|
|
3
|
+
export interface IPktTextinput extends InputHTMLAttributes<HTMLInputElement>, IPktStringsProps<'forms' | 'validation'> {
|
|
6
4
|
id: string;
|
|
7
5
|
ariaDescribedby?: string;
|
|
8
6
|
ariaLabelledby?: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IPktStringsProps } from '../../shared-strings';
|
|
2
2
|
import { ChangeEvent, FocusEvent, InputHTMLAttributes, ReactNode } from 'react';
|
|
3
3
|
import { TPktInputSize } from '../../shared-types/size';
|
|
4
4
|
/**
|
|
@@ -7,7 +7,7 @@ import { TPktInputSize } from '../../shared-types/size';
|
|
|
7
7
|
* The value is submitted via a hidden `input type="time"`; hour/minute fields are the editing UI. Use `value`
|
|
8
8
|
* or `defaultValue` for controlled vs. uncontrolled mode.
|
|
9
9
|
*/
|
|
10
|
-
export interface IPktTimepicker extends Omit<InputHTMLAttributes<HTMLInputElement>, 'value' | 'onChange' | 'onInput' | 'min' | 'max' | 'step' | 'onFocus' | 'onBlur'> {
|
|
10
|
+
export interface IPktTimepicker extends Omit<InputHTMLAttributes<HTMLInputElement>, 'value' | 'onChange' | 'onInput' | 'min' | 'max' | 'step' | 'onFocus' | 'onBlur'>, IPktStringsProps<'timepicker' | 'forms' | 'validation'> {
|
|
11
11
|
/** Unique id; used for hour, minute, popup, and hidden input ids. */
|
|
12
12
|
id: string;
|
|
13
13
|
/** Visible label (InputWrapper). */
|
|
@@ -66,9 +66,6 @@ export interface IPktTimepicker extends Omit<InputHTMLAttributes<HTMLInputElemen
|
|
|
66
66
|
hasFieldset?: boolean;
|
|
67
67
|
/** Passed through to InputWrapper as `aria-describedby`. */
|
|
68
68
|
ariaDescribedby?: string;
|
|
69
|
-
/** Copy for hours, minutes, buttons, and popup. */
|
|
70
|
-
/** Overstyrer tekster for denne komponenten. */
|
|
71
|
-
strings?: TPktStringsOverride;
|
|
72
69
|
/** Change event from the hidden input (`e.target.value` is `HH:MM`). In React, `onChange` already fires on input. */
|
|
73
70
|
onChange?: (e: ChangeEvent<HTMLInputElement>) => void;
|
|
74
71
|
/** Callback with the committed `HH:MM` string. */
|
|
@@ -14,7 +14,7 @@ export declare function useTimepickerState(props: IPktTimepicker, ref: React.For
|
|
|
14
14
|
nextTime: string;
|
|
15
15
|
selectTime: string;
|
|
16
16
|
};
|
|
17
|
-
stringsOverride: import('../../shared-strings').TPktStringsOverride | undefined;
|
|
17
|
+
stringsOverride: import('../../shared-strings').TPktStringsOverride<"forms" | "validation" | "timepicker"> | undefined;
|
|
18
18
|
label: string;
|
|
19
19
|
disabled: boolean;
|
|
20
20
|
required: boolean;
|