@norges-domstoler/dds-components 21.13.0 → 21.15.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/dist/index.css +5 -3
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +23 -21
- package/dist/index.d.ts +23 -21
- package/dist/index.js +274 -140
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +289 -155
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -7
package/dist/index.d.mts
CHANGED
|
@@ -526,7 +526,7 @@ declare function createSizes<T extends Array<Size>>(...sizes: T): T;
|
|
|
526
526
|
declare const BORDER_RADII: readonly ["button", "input", "surface", "chip", "rounded", "0"];
|
|
527
527
|
declare const ELEVATIONS: readonly [1, 2, 3, 4];
|
|
528
528
|
declare const BORDER_COLORS: readonly ["border-default", "border-subtle", "border-inverse", "border-action-default", "border-action-hover", "border-success", "border-warning", "border-danger", "border-info", "border-on-action"];
|
|
529
|
-
declare const BACKGROUNDS: readonly ["surface-subtle", "surface-medium", "surface-inverse-default", "surface-danger-default", "surface-danger-strong", "surface-success-default", "surface-success-strong", "surface-warning-default", "surface-warning-strong", "surface-info-default", "surface-info-strong", "surface-paper-default", "surface-notification", "brand-primary-default", "brand-primary-subtle", "brand-primary-medium", "brand-primary-strong", "brand-secondary-default", "brand-secondary-subtle", "brand-secondary-medium", "brand-secondary-strong", "brand-tertiary-default", "brand-tertiary-subtle", "brand-tertiary-medium", "brand-tertiary-strong"];
|
|
529
|
+
declare const BACKGROUNDS: readonly ["surface-subtle", "surface-medium", "surface-inverse-default", "surface-danger-default", "surface-danger-strong", "surface-success-default", "surface-success-strong", "surface-warning-default", "surface-warning-strong", "surface-info-default", "surface-info-strong", "surface-paper-default", "surface-notification", "surface-field-disabled", "brand-primary-default", "brand-primary-subtle", "brand-primary-medium", "brand-primary-strong", "brand-secondary-default", "brand-secondary-subtle", "brand-secondary-medium", "brand-secondary-strong", "brand-tertiary-default", "brand-tertiary-subtle", "brand-tertiary-medium", "brand-tertiary-strong"];
|
|
530
530
|
type BorderRadius = (typeof BORDER_RADII)[number];
|
|
531
531
|
type Elevation = (typeof ELEVATIONS)[number];
|
|
532
532
|
type BorderColor = (typeof BORDER_COLORS)[number];
|
|
@@ -3048,8 +3048,7 @@ type MimeType = `image/${ImageMimeType | AnyMimeType}` | `video/${VideoMimeType
|
|
|
3048
3048
|
type FileUploaderAccept = MimeType | FileExtensionAccept;
|
|
3049
3049
|
type FileList = Array<File>;
|
|
3050
3050
|
|
|
3051
|
-
|
|
3052
|
-
id: string | undefined;
|
|
3051
|
+
type FileUploaderHookProps = {
|
|
3053
3052
|
/**Dersom komponenten skal styres internt. Utgangspunktet for filene som har blitt lastet opp. */
|
|
3054
3053
|
initialFiles: FileList | undefined;
|
|
3055
3054
|
/**Dersom komponenten styres utenfra. Filene som har blitt lastet opp. */
|
|
@@ -3058,13 +3057,14 @@ interface FileUploaderHookProps {
|
|
|
3058
3057
|
onChange: (newFiles: FileList) => void;
|
|
3059
3058
|
/**Hvilke filendelser eller mime-typer som filopplasteren skal akseptere. */
|
|
3060
3059
|
accept: Array<FileUploaderAccept> | undefined;
|
|
3061
|
-
/**Om filopplasteren er avslått eller ikke */
|
|
3062
|
-
disabled
|
|
3060
|
+
/**Om filopplasteren er avslått eller ikke. */
|
|
3061
|
+
disabled?: boolean;
|
|
3062
|
+
/**Om filopplasteren er read-only. */
|
|
3063
|
+
readOnly?: boolean;
|
|
3063
3064
|
/**Maks antall filer som tillates. */
|
|
3064
3065
|
maxFiles: number | undefined;
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
}
|
|
3066
|
+
onKeyDown?: ComponentProps<'input'>['onKeyDown'];
|
|
3067
|
+
} & Pick<InputProps, 'errorMessage' | 'id'>;
|
|
3068
3068
|
|
|
3069
3069
|
type FileUploaderProps = {
|
|
3070
3070
|
/**Id til filopplasteren. */
|
|
@@ -3079,8 +3079,6 @@ type FileUploaderProps = {
|
|
|
3079
3079
|
* @default Velg fil
|
|
3080
3080
|
*/
|
|
3081
3081
|
btnLabel?: string;
|
|
3082
|
-
/**Hjelpetekst. */
|
|
3083
|
-
tip?: string;
|
|
3084
3082
|
/**Om det er påkrevd med minst én fil. */
|
|
3085
3083
|
required?: boolean;
|
|
3086
3084
|
/**Callback for når fil-listen endres. */
|
|
@@ -3091,7 +3089,7 @@ type FileUploaderProps = {
|
|
|
3091
3089
|
withDragAndDrop?: boolean;
|
|
3092
3090
|
/**Om listen med opplastede filer skal skjules. Brukes kun hvis listen blir vist på egen måte. */
|
|
3093
3091
|
hideFileList?: boolean;
|
|
3094
|
-
} & Pick<ResponsiveProps, 'width'> & Partial<FileUploaderHookProps> & Omit<ComponentPropsWithRef<'div'>, 'onChange' | 'id'>;
|
|
3092
|
+
} & Pick<ResponsiveProps, 'width'> & Partial<FileUploaderHookProps> & Omit<ComponentPropsWithRef<'div'>, 'onChange' | 'id'> & Pick<InputProps, 'tip'>;
|
|
3095
3093
|
declare const FileUploader: {
|
|
3096
3094
|
(props: FileUploaderProps): react_jsx_runtime.JSX.Element;
|
|
3097
3095
|
displayName: string;
|
|
@@ -3448,25 +3446,27 @@ interface PaginationOption {
|
|
|
3448
3446
|
value: number;
|
|
3449
3447
|
}
|
|
3450
3448
|
type PaginationProps = BaseComponentProps<HTMLElement, {
|
|
3451
|
-
/**Totalt antall elementer
|
|
3449
|
+
/**Totalt antall elementer som skal pagineres. */
|
|
3452
3450
|
itemsAmount: number;
|
|
3453
|
-
/**Antall elementer per side ved innlastning
|
|
3451
|
+
/**Antall elementer per side ved innlastning.
|
|
3454
3452
|
* @default 10
|
|
3455
3453
|
*/
|
|
3456
3454
|
defaultItemsPerPage?: number;
|
|
3457
|
-
/**Den aktive siden ved innlastning
|
|
3455
|
+
/**Den aktive siden ved innlastning.
|
|
3458
3456
|
* @default 1
|
|
3459
3457
|
*/
|
|
3460
3458
|
defaultActivePage?: number;
|
|
3459
|
+
/**Den aktive siden. Brukes til kontrollert tilstand - når denne er satt styrer du siden utenfra. */
|
|
3460
|
+
activePage?: number;
|
|
3461
3461
|
/**Spesifiserer om selve pagineringen skal vises.
|
|
3462
3462
|
* @default true
|
|
3463
3463
|
*/
|
|
3464
3464
|
withPagination?: boolean;
|
|
3465
|
-
/**
|
|
3465
|
+
/**Om teksten `'Vis x-y av z'` skal vises. */
|
|
3466
3466
|
withCounter?: boolean;
|
|
3467
|
-
/**
|
|
3467
|
+
/**Om `<Select>` for å velge antall per side skal vises. */
|
|
3468
3468
|
withSelect?: boolean;
|
|
3469
|
-
/**Custom options for `<Select
|
|
3469
|
+
/**Custom options for `<Select>`. **OBS!** husk å inkludere "Alle"-alternativet hvis relevant - brukere forventer ofte den muligheten.
|
|
3470
3470
|
* @default [
|
|
3471
3471
|
{ label: '10', value: 10 },
|
|
3472
3472
|
{ label: '25', value: 25 },
|
|
@@ -3475,15 +3475,17 @@ type PaginationProps = BaseComponentProps<HTMLElement, {
|
|
|
3475
3475
|
]
|
|
3476
3476
|
*/
|
|
3477
3477
|
selectOptions?: Array<PaginationOption>;
|
|
3478
|
-
/**
|
|
3478
|
+
/**Kalles ved sideendring - henter ny aktiv side og kjører ekstra logikk. */
|
|
3479
3479
|
onChange?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>, page: number) => void;
|
|
3480
|
-
/**
|
|
3480
|
+
/**Kalles når `selectedOption` endres, hvis `withSelect="true"`.
|
|
3481
|
+
* Brukes til å hente valgt alternativ og evt. kjøre ekstra logikk.
|
|
3482
|
+
*/
|
|
3481
3483
|
onSelectOptionChange?: (option: PaginationOption | null) => void;
|
|
3482
|
-
/**
|
|
3484
|
+
/**Brekkpunkt for mobilvisning; den viser færre sideknapper og stacker delkomponentene. */
|
|
3483
3485
|
smallScreenBreakpoint?: Breakpoint;
|
|
3484
3486
|
}, Omit<HTMLAttributes<HTMLElement>, 'onChange'>>;
|
|
3485
3487
|
declare const Pagination: {
|
|
3486
|
-
({ itemsAmount, defaultItemsPerPage, defaultActivePage, withPagination, withCounter, withSelect, selectOptions, smallScreenBreakpoint, onChange, onSelectOptionChange, id, className, htmlProps, ref, ...rest }: PaginationProps): react_jsx_runtime.JSX.Element | null;
|
|
3488
|
+
({ itemsAmount, defaultItemsPerPage, defaultActivePage, activePage: activePageProp, withPagination, withCounter, withSelect, selectOptions, smallScreenBreakpoint, onChange, onSelectOptionChange, id, className, htmlProps, ref, ...rest }: PaginationProps): react_jsx_runtime.JSX.Element | null;
|
|
3487
3489
|
displayName: string;
|
|
3488
3490
|
};
|
|
3489
3491
|
|
package/dist/index.d.ts
CHANGED
|
@@ -526,7 +526,7 @@ declare function createSizes<T extends Array<Size>>(...sizes: T): T;
|
|
|
526
526
|
declare const BORDER_RADII: readonly ["button", "input", "surface", "chip", "rounded", "0"];
|
|
527
527
|
declare const ELEVATIONS: readonly [1, 2, 3, 4];
|
|
528
528
|
declare const BORDER_COLORS: readonly ["border-default", "border-subtle", "border-inverse", "border-action-default", "border-action-hover", "border-success", "border-warning", "border-danger", "border-info", "border-on-action"];
|
|
529
|
-
declare const BACKGROUNDS: readonly ["surface-subtle", "surface-medium", "surface-inverse-default", "surface-danger-default", "surface-danger-strong", "surface-success-default", "surface-success-strong", "surface-warning-default", "surface-warning-strong", "surface-info-default", "surface-info-strong", "surface-paper-default", "surface-notification", "brand-primary-default", "brand-primary-subtle", "brand-primary-medium", "brand-primary-strong", "brand-secondary-default", "brand-secondary-subtle", "brand-secondary-medium", "brand-secondary-strong", "brand-tertiary-default", "brand-tertiary-subtle", "brand-tertiary-medium", "brand-tertiary-strong"];
|
|
529
|
+
declare const BACKGROUNDS: readonly ["surface-subtle", "surface-medium", "surface-inverse-default", "surface-danger-default", "surface-danger-strong", "surface-success-default", "surface-success-strong", "surface-warning-default", "surface-warning-strong", "surface-info-default", "surface-info-strong", "surface-paper-default", "surface-notification", "surface-field-disabled", "brand-primary-default", "brand-primary-subtle", "brand-primary-medium", "brand-primary-strong", "brand-secondary-default", "brand-secondary-subtle", "brand-secondary-medium", "brand-secondary-strong", "brand-tertiary-default", "brand-tertiary-subtle", "brand-tertiary-medium", "brand-tertiary-strong"];
|
|
530
530
|
type BorderRadius = (typeof BORDER_RADII)[number];
|
|
531
531
|
type Elevation = (typeof ELEVATIONS)[number];
|
|
532
532
|
type BorderColor = (typeof BORDER_COLORS)[number];
|
|
@@ -3048,8 +3048,7 @@ type MimeType = `image/${ImageMimeType | AnyMimeType}` | `video/${VideoMimeType
|
|
|
3048
3048
|
type FileUploaderAccept = MimeType | FileExtensionAccept;
|
|
3049
3049
|
type FileList = Array<File>;
|
|
3050
3050
|
|
|
3051
|
-
|
|
3052
|
-
id: string | undefined;
|
|
3051
|
+
type FileUploaderHookProps = {
|
|
3053
3052
|
/**Dersom komponenten skal styres internt. Utgangspunktet for filene som har blitt lastet opp. */
|
|
3054
3053
|
initialFiles: FileList | undefined;
|
|
3055
3054
|
/**Dersom komponenten styres utenfra. Filene som har blitt lastet opp. */
|
|
@@ -3058,13 +3057,14 @@ interface FileUploaderHookProps {
|
|
|
3058
3057
|
onChange: (newFiles: FileList) => void;
|
|
3059
3058
|
/**Hvilke filendelser eller mime-typer som filopplasteren skal akseptere. */
|
|
3060
3059
|
accept: Array<FileUploaderAccept> | undefined;
|
|
3061
|
-
/**Om filopplasteren er avslått eller ikke */
|
|
3062
|
-
disabled
|
|
3060
|
+
/**Om filopplasteren er avslått eller ikke. */
|
|
3061
|
+
disabled?: boolean;
|
|
3062
|
+
/**Om filopplasteren er read-only. */
|
|
3063
|
+
readOnly?: boolean;
|
|
3063
3064
|
/**Maks antall filer som tillates. */
|
|
3064
3065
|
maxFiles: number | undefined;
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
}
|
|
3066
|
+
onKeyDown?: ComponentProps<'input'>['onKeyDown'];
|
|
3067
|
+
} & Pick<InputProps, 'errorMessage' | 'id'>;
|
|
3068
3068
|
|
|
3069
3069
|
type FileUploaderProps = {
|
|
3070
3070
|
/**Id til filopplasteren. */
|
|
@@ -3079,8 +3079,6 @@ type FileUploaderProps = {
|
|
|
3079
3079
|
* @default Velg fil
|
|
3080
3080
|
*/
|
|
3081
3081
|
btnLabel?: string;
|
|
3082
|
-
/**Hjelpetekst. */
|
|
3083
|
-
tip?: string;
|
|
3084
3082
|
/**Om det er påkrevd med minst én fil. */
|
|
3085
3083
|
required?: boolean;
|
|
3086
3084
|
/**Callback for når fil-listen endres. */
|
|
@@ -3091,7 +3089,7 @@ type FileUploaderProps = {
|
|
|
3091
3089
|
withDragAndDrop?: boolean;
|
|
3092
3090
|
/**Om listen med opplastede filer skal skjules. Brukes kun hvis listen blir vist på egen måte. */
|
|
3093
3091
|
hideFileList?: boolean;
|
|
3094
|
-
} & Pick<ResponsiveProps, 'width'> & Partial<FileUploaderHookProps> & Omit<ComponentPropsWithRef<'div'>, 'onChange' | 'id'>;
|
|
3092
|
+
} & Pick<ResponsiveProps, 'width'> & Partial<FileUploaderHookProps> & Omit<ComponentPropsWithRef<'div'>, 'onChange' | 'id'> & Pick<InputProps, 'tip'>;
|
|
3095
3093
|
declare const FileUploader: {
|
|
3096
3094
|
(props: FileUploaderProps): react_jsx_runtime.JSX.Element;
|
|
3097
3095
|
displayName: string;
|
|
@@ -3448,25 +3446,27 @@ interface PaginationOption {
|
|
|
3448
3446
|
value: number;
|
|
3449
3447
|
}
|
|
3450
3448
|
type PaginationProps = BaseComponentProps<HTMLElement, {
|
|
3451
|
-
/**Totalt antall elementer
|
|
3449
|
+
/**Totalt antall elementer som skal pagineres. */
|
|
3452
3450
|
itemsAmount: number;
|
|
3453
|
-
/**Antall elementer per side ved innlastning
|
|
3451
|
+
/**Antall elementer per side ved innlastning.
|
|
3454
3452
|
* @default 10
|
|
3455
3453
|
*/
|
|
3456
3454
|
defaultItemsPerPage?: number;
|
|
3457
|
-
/**Den aktive siden ved innlastning
|
|
3455
|
+
/**Den aktive siden ved innlastning.
|
|
3458
3456
|
* @default 1
|
|
3459
3457
|
*/
|
|
3460
3458
|
defaultActivePage?: number;
|
|
3459
|
+
/**Den aktive siden. Brukes til kontrollert tilstand - når denne er satt styrer du siden utenfra. */
|
|
3460
|
+
activePage?: number;
|
|
3461
3461
|
/**Spesifiserer om selve pagineringen skal vises.
|
|
3462
3462
|
* @default true
|
|
3463
3463
|
*/
|
|
3464
3464
|
withPagination?: boolean;
|
|
3465
|
-
/**
|
|
3465
|
+
/**Om teksten `'Vis x-y av z'` skal vises. */
|
|
3466
3466
|
withCounter?: boolean;
|
|
3467
|
-
/**
|
|
3467
|
+
/**Om `<Select>` for å velge antall per side skal vises. */
|
|
3468
3468
|
withSelect?: boolean;
|
|
3469
|
-
/**Custom options for `<Select
|
|
3469
|
+
/**Custom options for `<Select>`. **OBS!** husk å inkludere "Alle"-alternativet hvis relevant - brukere forventer ofte den muligheten.
|
|
3470
3470
|
* @default [
|
|
3471
3471
|
{ label: '10', value: 10 },
|
|
3472
3472
|
{ label: '25', value: 25 },
|
|
@@ -3475,15 +3475,17 @@ type PaginationProps = BaseComponentProps<HTMLElement, {
|
|
|
3475
3475
|
]
|
|
3476
3476
|
*/
|
|
3477
3477
|
selectOptions?: Array<PaginationOption>;
|
|
3478
|
-
/**
|
|
3478
|
+
/**Kalles ved sideendring - henter ny aktiv side og kjører ekstra logikk. */
|
|
3479
3479
|
onChange?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>, page: number) => void;
|
|
3480
|
-
/**
|
|
3480
|
+
/**Kalles når `selectedOption` endres, hvis `withSelect="true"`.
|
|
3481
|
+
* Brukes til å hente valgt alternativ og evt. kjøre ekstra logikk.
|
|
3482
|
+
*/
|
|
3481
3483
|
onSelectOptionChange?: (option: PaginationOption | null) => void;
|
|
3482
|
-
/**
|
|
3484
|
+
/**Brekkpunkt for mobilvisning; den viser færre sideknapper og stacker delkomponentene. */
|
|
3483
3485
|
smallScreenBreakpoint?: Breakpoint;
|
|
3484
3486
|
}, Omit<HTMLAttributes<HTMLElement>, 'onChange'>>;
|
|
3485
3487
|
declare const Pagination: {
|
|
3486
|
-
({ itemsAmount, defaultItemsPerPage, defaultActivePage, withPagination, withCounter, withSelect, selectOptions, smallScreenBreakpoint, onChange, onSelectOptionChange, id, className, htmlProps, ref, ...rest }: PaginationProps): react_jsx_runtime.JSX.Element | null;
|
|
3488
|
+
({ itemsAmount, defaultItemsPerPage, defaultActivePage, activePage: activePageProp, withPagination, withCounter, withSelect, selectOptions, smallScreenBreakpoint, onChange, onSelectOptionChange, id, className, htmlProps, ref, ...rest }: PaginationProps): react_jsx_runtime.JSX.Element | null;
|
|
3487
3489
|
displayName: string;
|
|
3488
3490
|
};
|
|
3489
3491
|
|