@oslokommune/punkt-react 16.25.1 → 16.26.3
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 +28 -0
- package/CONTRIBUTING.md +1 -1
- package/README.md +1 -1
- package/dist/components/accordion/Accordion.d.ts +21 -0
- package/dist/components/accordion/Accordion.test.d.ts +0 -0
- package/dist/components/accordion/AccordionItem.d.ts +17 -0
- package/dist/components/alert/Alert.d.ts +14 -0
- package/dist/components/alert/Alert.test.d.ts +0 -0
- package/dist/components/backlink/BackLink.d.ts +14 -0
- package/dist/components/backlink/BackLink.test.d.ts +0 -0
- package/dist/components/breadcrumbs/Breadcrumbs.d.ts +16 -0
- package/dist/components/breadcrumbs/Breadcrumbs.test.d.ts +1 -0
- package/dist/components/button/Button.d.ts +24 -0
- package/dist/components/button/Button.test.d.ts +0 -0
- package/dist/components/calendar/Calendar.accessibility.test.d.ts +0 -0
- package/dist/components/calendar/Calendar.constraints.test.d.ts +0 -0
- package/dist/components/calendar/Calendar.core.test.d.ts +0 -0
- package/dist/components/calendar/Calendar.d.ts +3 -0
- package/dist/components/calendar/Calendar.interaction.test.d.ts +0 -0
- package/dist/components/calendar/Calendar.selection.test.d.ts +0 -0
- package/dist/components/calendar/CalendarGrid.d.ts +4 -0
- package/dist/components/calendar/CalendarNav.d.ts +2 -0
- package/dist/components/calendar/calendar-utils.d.ts +20 -0
- package/dist/components/calendar/types.d.ts +104 -0
- package/dist/components/calendar/useCalendarState.d.ts +2 -0
- package/dist/components/card/Card.d.ts +37 -0
- package/dist/components/card/Card.test.d.ts +0 -0
- package/dist/components/checkbox/Checkbox.d.ts +23 -0
- package/dist/components/checkbox/Checkbox.test.d.ts +0 -0
- package/dist/components/combobox/Combobox.accessibility.test.d.ts +0 -0
- package/dist/components/combobox/Combobox.core.test.d.ts +0 -0
- package/dist/components/combobox/Combobox.d.ts +3 -0
- package/dist/components/combobox/Combobox.interaction.test.d.ts +0 -0
- package/dist/components/combobox/Combobox.selection.test.d.ts +0 -0
- package/dist/components/combobox/ComboboxInput.d.ts +6 -0
- package/dist/components/combobox/ComboboxTags.d.ts +11 -0
- package/dist/components/combobox/Listbox.d.ts +6 -0
- package/dist/components/combobox/types.d.ts +104 -0
- package/dist/components/combobox/useComboboxState.d.ts +2 -0
- package/dist/components/consent/Consent.d.ts +51 -0
- package/dist/components/consent/Consent.test.d.ts +0 -0
- package/dist/components/consent/strings.d.ts +85 -0
- package/dist/components/datepicker/DateTags.d.ts +10 -0
- package/dist/components/datepicker/Datepicker.accessibility.test.d.ts +0 -0
- package/dist/components/datepicker/Datepicker.core.test.d.ts +0 -0
- package/dist/components/datepicker/Datepicker.d.ts +3 -0
- package/dist/components/datepicker/Datepicker.input.test.d.ts +0 -0
- package/dist/components/datepicker/Datepicker.selection.test.d.ts +0 -0
- package/dist/components/datepicker/Datepicker.validation.test.d.ts +0 -0
- package/dist/components/datepicker/DatepickerInputs.d.ts +4 -0
- package/dist/components/datepicker/DatepickerPopup.d.ts +21 -0
- package/dist/components/datepicker/types.d.ts +109 -0
- package/dist/components/datepicker/useDatepickerState.d.ts +2 -0
- package/dist/components/fileupload/DropZone.d.ts +42 -0
- package/dist/components/fileupload/FileUpload.d.ts +84 -0
- package/dist/components/fileupload/FileUpload.test.d.ts +0 -0
- package/dist/components/fileupload/QueueDisplay.d.ts +19 -0
- package/dist/components/fileupload/QueueDisplay.test.d.ts +0 -0
- package/dist/components/fileupload/QueueItemContent.d.ts +44 -0
- package/dist/components/fileupload/Subcomponents.d.ts +36 -0
- package/dist/components/fileupload/Truncate.d.ts +20 -0
- package/dist/components/fileupload/Truncate.test.d.ts +0 -0
- package/dist/components/fileupload/extensions/Comments.d.ts +6 -0
- package/dist/components/fileupload/extensions/Remove.d.ts +2 -0
- package/dist/components/fileupload/extensions/Rename.d.ts +2 -0
- package/dist/components/fileupload/hooks/index.d.ts +4 -0
- package/dist/components/fileupload/hooks/useFileAttributes.d.ts +10 -0
- package/dist/components/fileupload/hooks/useImagePreview.d.ts +9 -0
- package/dist/components/fileupload/hooks/useOperationState.d.ts +6 -0
- package/dist/components/fileupload/hooks/useRequiredFormValidation.d.ts +16 -0
- package/dist/components/fileupload/hooks.d.ts +4 -0
- package/dist/components/fileupload/types.d.ts +88 -0
- package/dist/components/fileupload/utils.d.ts +5 -0
- package/dist/components/footer/Footer.d.ts +36 -0
- package/dist/components/footer/Footer.test.d.ts +0 -0
- package/dist/components/footerSimple/FooterSimple.d.ts +21 -0
- package/dist/components/footerSimple/FooterSimple.test.d.ts +0 -0
- package/dist/components/header/Header.d.ts +15 -0
- package/dist/components/header/Header.test.d.ts +0 -0
- package/dist/components/header/HeaderService.d.ts +9 -0
- package/dist/components/header/HeaderService.test.d.ts +0 -0
- package/dist/components/header/types.d.ts +93 -0
- package/dist/components/header-menu/HeaderMenu.d.ts +26 -0
- package/dist/components/header-menu/HeaderMenu.test.d.ts +0 -0
- package/dist/components/headerUserMenu/UserMenu.d.ts +11 -0
- package/dist/components/headerUserMenu/UserMenu.test.d.ts +0 -0
- package/dist/components/heading/Heading.d.ts +14 -0
- package/dist/components/heading/Heading.test.d.ts +0 -0
- package/dist/components/helptext/Helptext.d.ts +9 -0
- package/dist/components/helptext/Helptext.test.d.ts +0 -0
- package/dist/components/icon/Icon.d.ts +10 -0
- package/dist/components/icon/Icon.test.d.ts +9 -0
- package/dist/components/index.d.ts +50 -0
- package/dist/components/input/Input.d.ts +21 -0
- package/dist/components/inputwrapper/InputWrapper.d.ts +28 -0
- package/dist/components/interfaces.d.ts +30 -0
- package/dist/components/link/Link.d.ts +17 -0
- package/dist/components/link/Link.test.d.ts +1 -0
- package/dist/components/linkcard/LinkCard.d.ts +14 -0
- package/dist/components/linkcard/LinkCard.test.d.ts +0 -0
- package/dist/components/loader/Loader.d.ts +41 -0
- package/dist/components/loader/Loader.test.d.ts +0 -0
- package/dist/components/messagebox/Messagebox.d.ts +11 -0
- package/dist/components/messagebox/Messagebox.test.d.ts +1 -0
- package/dist/components/modal/Modal.d.ts +17 -0
- package/dist/components/modal/Modal.test.d.ts +0 -0
- package/dist/components/progressbar/Progressbar.d.ts +21 -0
- package/dist/components/progressbar/Progressbar.test.d.ts +0 -0
- package/dist/components/radio/RadioButton.d.ts +20 -0
- package/dist/components/radio/RadioButton.test.d.ts +0 -0
- package/dist/components/searchinput/SearchInput.d.ts +36 -0
- package/dist/components/searchinput/SearchInput.test.d.ts +0 -0
- package/dist/components/select/Select.d.ts +30 -0
- package/dist/components/select/Select.test.d.ts +0 -0
- package/dist/components/stepper/Step.d.ts +21 -0
- package/dist/components/stepper/Stepper.d.ts +32 -0
- package/dist/components/stepper/Stepper.test.d.ts +0 -0
- package/dist/components/table/Table.d.ts +11 -0
- package/dist/components/table/Table.test.d.ts +0 -0
- package/dist/components/table/TableBody.d.ts +7 -0
- package/dist/components/table/TableData.d.ts +7 -0
- package/dist/components/table/TableDataCell.d.ts +8 -0
- package/dist/components/table/TableHeader.d.ts +7 -0
- package/dist/components/table/TableHeaderCell.d.ts +7 -0
- package/dist/components/table/TableRow.d.ts +7 -0
- package/dist/components/tabs/TabItem.d.ts +15 -0
- package/dist/components/tabs/Tabs.d.ts +33 -0
- package/dist/components/tabs/Tabs.test.d.ts +0 -0
- package/dist/components/tag/Tag.d.ts +24 -0
- package/dist/components/tag/Tag.test.d.ts +0 -0
- package/dist/components/textarea/Textarea.d.ts +35 -0
- package/dist/components/textarea/Textarea.test.d.ts +0 -0
- package/dist/components/textinput/Textinput.d.ts +44 -0
- package/dist/components/textinput/Textinput.test.d.ts +0 -0
- package/dist/components/timepicker/Timepicker.d.ts +3 -0
- package/dist/components/timepicker/Timepicker.test.d.ts +0 -0
- package/dist/components/timepicker/types.d.ts +81 -0
- package/dist/components/timepicker/useTimepickerState.d.ts +58 -0
- package/dist/components/types.d.ts +2 -0
- package/dist/index.d.ts +1 -1366
- package/dist/punkt-react.cjs +1 -1
- package/dist/punkt-react.js +698 -684
- package/package.json +33 -32
- package/src/components/calendar/types.ts +1 -1
- package/src/components/card/Card.tsx +1 -1
- package/src/components/combobox/types.ts +5 -5
- package/src/components/datepicker/types.ts +5 -5
- package/src/components/fileupload/FileUpload.tsx +1 -1
- package/src/components/fileupload/Subcomponents.tsx +1 -1
- package/src/components/fileupload/Truncate.tsx +1 -1
- package/src/components/fileupload/hooks/useRequiredFormValidation.ts +1 -1
- package/src/components/header/HeaderService.tsx +1 -1
- package/src/components/tabs/Tabs.tsx +1 -0
- package/src/components/tag/Tag.tsx +1 -1
- package/src/components/timepicker/Timepicker.tsx +1 -2
- package/src/components/timepicker/types.ts +2 -5
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { ReactElement, ReactNode } from 'react';
|
|
2
|
+
import { IFileItem, IFileTransfer, IFileValidateDetail, TFileUploadStrategy, TTransferProgress } from '../../shared-types';
|
|
3
|
+
/** Unique identifier assigned to each selected file. */
|
|
4
|
+
export type TFileId = string;
|
|
5
|
+
/**
|
|
6
|
+
* A selected file plus metadata used by the FileUpload UI.
|
|
7
|
+
*
|
|
8
|
+
* Notes:
|
|
9
|
+
* - A `fileId` is generated automatically if omitted.
|
|
10
|
+
* - `attributes.targetFilename` is the filename shown in the queue and may be updated by extensions (e.g. rename).
|
|
11
|
+
*
|
|
12
|
+
* Implements the shared `IFileItem` type from `shared-types`.
|
|
13
|
+
*/
|
|
14
|
+
export declare class FileItem implements IFileItem {
|
|
15
|
+
fileId: TFileId;
|
|
16
|
+
file: File;
|
|
17
|
+
attributes: {
|
|
18
|
+
targetFilename: string;
|
|
19
|
+
} & Record<string, unknown>;
|
|
20
|
+
constructor(file: File, fileId?: TFileId);
|
|
21
|
+
}
|
|
22
|
+
/** Internal context used by queue item operations and hidden inputs. */
|
|
23
|
+
export type TPktFileUploadContext = {
|
|
24
|
+
name?: string;
|
|
25
|
+
multiple: boolean;
|
|
26
|
+
id?: string;
|
|
27
|
+
};
|
|
28
|
+
export declare const PktFileUploadContext: import('react').Context<TPktFileUploadContext>;
|
|
29
|
+
/** The value type for `PktFileUpload` (`value` / `defaultValue`). */
|
|
30
|
+
export type TFileItemList = Array<FileItem>;
|
|
31
|
+
/** Transfer status for a file when using `uploadStrategy="custom"` — aliased from `shared-types`. */
|
|
32
|
+
export type TFileTransfer = IFileTransfer;
|
|
33
|
+
/** Upload mode: `form` posts the files on submit, `custom` posts file IDs and uploads separately. */
|
|
34
|
+
export type TUploadStrategy = TFileUploadStrategy;
|
|
35
|
+
/** Detail payload passed to the React `onFileValidate` escape hatch. */
|
|
36
|
+
export type TFileValidateDetail = IFileValidateDetail;
|
|
37
|
+
/** Re-export for parity with Lit types. */
|
|
38
|
+
export type { TTransferProgress };
|
|
39
|
+
export type TFileAttribute<T> = {
|
|
40
|
+
get: (fileId: TFileId) => T | undefined;
|
|
41
|
+
set: (fileId: TFileId, attributeValue: T | undefined) => void;
|
|
42
|
+
};
|
|
43
|
+
export type TFileAttributes = <T>(attributeName: string) => TFileAttribute<T>;
|
|
44
|
+
/**
|
|
45
|
+
* Context passed to queue-item operations. Mirrors the Lit
|
|
46
|
+
* `TQueueOperationContext` so operations authored for one runtime are
|
|
47
|
+
* trivial to port to the other.
|
|
48
|
+
*/
|
|
49
|
+
export type TQueueOperationContext = {
|
|
50
|
+
file: FileItem;
|
|
51
|
+
inputName: string;
|
|
52
|
+
disabled: boolean;
|
|
53
|
+
isActive: boolean;
|
|
54
|
+
activate: () => void;
|
|
55
|
+
close: () => void;
|
|
56
|
+
getAttribute: <T>(name: string) => T | undefined;
|
|
57
|
+
setAttribute: (name: string, value: unknown) => void;
|
|
58
|
+
};
|
|
59
|
+
export type TQueueOperationLabel = string | ((fileItem: FileItem) => string);
|
|
60
|
+
/**
|
|
61
|
+
* An operation that can be attached to a queue item (rename, comment, remove, etc).
|
|
62
|
+
*
|
|
63
|
+
* Must carry a stable `id: string` — symbols are no longer supported.
|
|
64
|
+
*/
|
|
65
|
+
export type TQueueItemOperation = {
|
|
66
|
+
id: string;
|
|
67
|
+
title: TQueueOperationLabel;
|
|
68
|
+
ariaLabel?: TQueueOperationLabel;
|
|
69
|
+
onClick?: (context: TQueueOperationContext) => void;
|
|
70
|
+
renderInlineUI?: (context: TQueueOperationContext) => ReactNode;
|
|
71
|
+
renderExtendedUI?: (context: TQueueOperationContext) => ReactNode;
|
|
72
|
+
renderContent?: (context: TQueueOperationContext) => ReactNode;
|
|
73
|
+
renderHidden?: (context: TQueueOperationContext) => ReactNode;
|
|
74
|
+
};
|
|
75
|
+
export type TFileAndTransfer = FileItem & Pick<TFileTransfer, 'progress' | 'errorMessage' | 'showProgress' | 'lastProgress'>;
|
|
76
|
+
export type TTransferItemInProgress = TFileAndTransfer & {
|
|
77
|
+
progress: number;
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* Custom renderer for how a queue item is displayed (e.g. filename vs thumbnail grid).
|
|
81
|
+
*
|
|
82
|
+
* Must return a renderable React element (or `null`).
|
|
83
|
+
*/
|
|
84
|
+
export type TItemRenderer = (props: {
|
|
85
|
+
transferItem: TFileAndTransfer;
|
|
86
|
+
queueItemOperations: Array<TQueueItemOperation>;
|
|
87
|
+
onPreviewClick?: () => void;
|
|
88
|
+
}) => ReactElement | null;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { FC, HTMLAttributes } from 'react';
|
|
2
|
+
interface Link {
|
|
3
|
+
href: string;
|
|
4
|
+
text: string;
|
|
5
|
+
external?: boolean;
|
|
6
|
+
openInNewTab?: boolean;
|
|
7
|
+
}
|
|
8
|
+
interface Column {
|
|
9
|
+
title: string;
|
|
10
|
+
links?: Link[];
|
|
11
|
+
text?: string;
|
|
12
|
+
}
|
|
13
|
+
interface SocialLink {
|
|
14
|
+
href: string;
|
|
15
|
+
iconName?: string;
|
|
16
|
+
language?: string;
|
|
17
|
+
openInNewTab?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export interface IPktFooter extends HTMLAttributes<HTMLDivElement> {
|
|
20
|
+
columnOne: Column;
|
|
21
|
+
columnTwo: Column;
|
|
22
|
+
socialLinks?: SocialLink[];
|
|
23
|
+
personvernOgInfoLink?: string;
|
|
24
|
+
tilgjengelighetLink?: string;
|
|
25
|
+
openLinksInNewTab?: boolean;
|
|
26
|
+
includeConsent?: boolean;
|
|
27
|
+
hotjarId?: string | null;
|
|
28
|
+
googleAnalyticsId?: string | null;
|
|
29
|
+
devMode?: boolean;
|
|
30
|
+
cookieDomain?: string | null;
|
|
31
|
+
cookieSecure?: string | null;
|
|
32
|
+
cookieExpiryDays?: string | null;
|
|
33
|
+
onToggleConsent?: (e: CustomEvent) => void;
|
|
34
|
+
}
|
|
35
|
+
export declare const PktFooter: FC<IPktFooter>;
|
|
36
|
+
export {};
|
|
File without changes
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { FC, HTMLAttributes } from 'react';
|
|
2
|
+
export interface IPktFooterSimple extends HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
links?: Array<{
|
|
4
|
+
href: string;
|
|
5
|
+
text: string;
|
|
6
|
+
external?: boolean;
|
|
7
|
+
openInNewTab?: boolean;
|
|
8
|
+
}>;
|
|
9
|
+
personvernOgInfoLink?: string;
|
|
10
|
+
tilgjengelighetLink?: string;
|
|
11
|
+
openLinksInNewTab?: boolean;
|
|
12
|
+
includeConsent?: boolean;
|
|
13
|
+
hotjarId?: string | null;
|
|
14
|
+
googleAnalyticsId?: string | null;
|
|
15
|
+
devMode?: boolean;
|
|
16
|
+
cookieDomain?: string | null;
|
|
17
|
+
cookieSecure?: string | null;
|
|
18
|
+
cookieExpiryDays?: string | null;
|
|
19
|
+
onToggleConsent?: (e: CustomEvent) => void;
|
|
20
|
+
}
|
|
21
|
+
export declare const PktFooterSimple: FC<IPktFooterSimple>;
|
|
File without changes
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IPktHeader } from './types';
|
|
2
|
+
export * from './types';
|
|
3
|
+
/**
|
|
4
|
+
* PktHeader - Main header component for Oslo kommune services
|
|
5
|
+
*
|
|
6
|
+
* This component provides a complete header solution with:
|
|
7
|
+
* - Logo and service name
|
|
8
|
+
* - User menu with login/logout functionality
|
|
9
|
+
* - Search functionality
|
|
10
|
+
* - Responsive mobile menu
|
|
11
|
+
* - Fixed positioning with scroll-to-hide
|
|
12
|
+
*
|
|
13
|
+
* TODO: Add `type` prop to switch between `service` and `global` header types
|
|
14
|
+
*/
|
|
15
|
+
export declare const PktHeader: import('react').ForwardRefExoticComponent<IPktHeader & import('react').RefAttributes<HTMLDivElement>>;
|
|
File without changes
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IPktHeader, Representing, THeaderMenu, User, UserMenuFooterItem, UserMenuItem } from './types';
|
|
2
|
+
export type { Representing, THeaderMenu, User, UserMenuFooterItem, UserMenuItem };
|
|
3
|
+
export type IPktHeaderService = IPktHeader;
|
|
4
|
+
declare global {
|
|
5
|
+
interface Window {
|
|
6
|
+
pktLogoPath?: string;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export declare const PktHeaderService: import('react').ForwardRefExoticComponent<IPktHeader & import('react').RefAttributes<HTMLDivElement>>;
|
|
File without changes
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { MouseEvent, ReactNode } from 'react';
|
|
2
|
+
import { THeaderMenu, THeaderPosition, THeaderScrollBehavior, TLogOutButtonPlacement, TSlotMenuVariant } from '../../shared-types';
|
|
3
|
+
export type { THeaderMenu, THeaderPosition, THeaderScrollBehavior, TLogOutButtonPlacement, TSlotMenuVariant, };
|
|
4
|
+
/** User object for header components */
|
|
5
|
+
export interface User {
|
|
6
|
+
name: string;
|
|
7
|
+
/** @deprecated shortname is deprecated and will be removed in a future version */
|
|
8
|
+
shortname?: string;
|
|
9
|
+
lastLoggedIn?: string | Date;
|
|
10
|
+
}
|
|
11
|
+
/** Representing object for header components */
|
|
12
|
+
export interface Representing {
|
|
13
|
+
name: string;
|
|
14
|
+
/** @deprecated shortname is deprecated and will be removed in a future version */
|
|
15
|
+
shortname?: string;
|
|
16
|
+
orgNumber?: string | number;
|
|
17
|
+
}
|
|
18
|
+
/** User menu item for header components */
|
|
19
|
+
export interface UserMenuItem {
|
|
20
|
+
iconName?: string;
|
|
21
|
+
title: string;
|
|
22
|
+
target: string | (() => void);
|
|
23
|
+
}
|
|
24
|
+
/** @deprecated Use UserMenuItem instead */
|
|
25
|
+
export interface UserMenuFooterItem {
|
|
26
|
+
title: string;
|
|
27
|
+
target: string | (() => void);
|
|
28
|
+
}
|
|
29
|
+
export interface IPktHeader {
|
|
30
|
+
children?: ReactNode;
|
|
31
|
+
/** Additional CSS class name(s) to apply to the header */
|
|
32
|
+
className?: string;
|
|
33
|
+
/** Set dark mode on the header */
|
|
34
|
+
'data-mode'?: 'dark';
|
|
35
|
+
/** Hide the Oslo logo. Default: false (logo is shown) */
|
|
36
|
+
hideLogo?: boolean;
|
|
37
|
+
/** Link URL for the logo */
|
|
38
|
+
logoLink?: string;
|
|
39
|
+
/** Override CDN path for the logo */
|
|
40
|
+
logoPath?: string;
|
|
41
|
+
/** Callback when logo is clicked */
|
|
42
|
+
logoClick?: (event: MouseEvent) => void;
|
|
43
|
+
/** Name of the service displayed in the header */
|
|
44
|
+
serviceName?: string;
|
|
45
|
+
/** Link URL for the service name */
|
|
46
|
+
serviceLink?: string;
|
|
47
|
+
/** Callback when service name is clicked */
|
|
48
|
+
serviceClick?: (event: MouseEvent) => void;
|
|
49
|
+
/** Use compact header height */
|
|
50
|
+
compact?: boolean;
|
|
51
|
+
/** User object with name, shortname, and lastLoggedIn */
|
|
52
|
+
user?: User;
|
|
53
|
+
/** User menu items displayed in the dropdown */
|
|
54
|
+
userMenu?: UserMenuItem[];
|
|
55
|
+
/** Representing object with name, shortname, and orgNumber */
|
|
56
|
+
representing?: Representing;
|
|
57
|
+
/** Whether the user can change representation. Shows "Endre organisasjon" button */
|
|
58
|
+
canChangeRepresentation?: boolean;
|
|
59
|
+
/** Callback when user clicks "Endre organisasjon" */
|
|
60
|
+
changeRepresentation?: () => void;
|
|
61
|
+
/** @deprecated Use userMenu instead. Will show console.warn if used. */
|
|
62
|
+
userMenuFooter?: UserMenuFooterItem[];
|
|
63
|
+
/** @deprecated userOptions is no longer available. Use userMenu instead. */
|
|
64
|
+
userOptions?: UserMenuItem[];
|
|
65
|
+
/** Where to show the logout button: 'userMenu', 'header', 'both', or 'none' */
|
|
66
|
+
logOutButtonPlacement?: TLogOutButtonPlacement;
|
|
67
|
+
/** Callback when user clicks logout */
|
|
68
|
+
logOut?: () => void;
|
|
69
|
+
/** Show search input in the header */
|
|
70
|
+
showSearch?: boolean;
|
|
71
|
+
/** Callback when user submits search (presses Enter) */
|
|
72
|
+
onSearch?: (query: string) => void;
|
|
73
|
+
/** Callback when search input value changes */
|
|
74
|
+
onSearchChange?: (query: string) => void;
|
|
75
|
+
/** Controlled value for the search input */
|
|
76
|
+
searchValue?: string;
|
|
77
|
+
/** Placeholder text for the search input. Default: "Søk" */
|
|
78
|
+
searchPlaceholder?: string;
|
|
79
|
+
/** Custom breakpoint for responsive behavior (grid layout) in pixels. Default: 1024 */
|
|
80
|
+
mobileBreakpoint?: number;
|
|
81
|
+
/** Custom breakpoint for tablet responsive behavior (interaction pattern) in pixels. Default: 1280 */
|
|
82
|
+
tabletBreakpoint?: number;
|
|
83
|
+
/** Which menu is initially open */
|
|
84
|
+
openedMenu?: THeaderMenu;
|
|
85
|
+
/** Header position. 'fixed' fixes to top of viewport, 'relative' follows document flow. Default: 'fixed' */
|
|
86
|
+
position?: THeaderPosition;
|
|
87
|
+
/** Scroll behavior. 'hide' hides header on scroll down, 'none' keeps it visible. Default: 'hide' */
|
|
88
|
+
scrollBehavior?: THeaderScrollBehavior;
|
|
89
|
+
/** Variant for the slot menu button in tablet/mobile mode. Default: 'icon-only' */
|
|
90
|
+
slotMenuVariant?: TSlotMenuVariant;
|
|
91
|
+
/** Text for the slot menu button in tablet/mobile mode. Default: 'Meny' */
|
|
92
|
+
slotMenuText?: string;
|
|
93
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { HTMLAttributes, Ref } from 'react';
|
|
2
|
+
import { IHeaderMenuButton, IHeaderMenuLink, IHeaderMenuSection, IHeaderMenuServices, IPktHeaderMenu as ISharedPktHeaderMenu, THeaderFooterApi, THeaderMenuLocale } from '../../shared-types';
|
|
3
|
+
export type { THeaderFooterApi, THeaderMenuLocale, IHeaderMenuLink, IHeaderMenuButton, IHeaderMenuSection, IHeaderMenuServices, };
|
|
4
|
+
export interface IPktHeaderMenu extends Omit<HTMLAttributes<HTMLElement>, 'onError'>, ISharedPktHeaderMenu {
|
|
5
|
+
/** Forwarded to the host element. */
|
|
6
|
+
ref?: Ref<HTMLElement>;
|
|
7
|
+
/** Fired when the payload has been fetched (or `data` was supplied). */
|
|
8
|
+
onDataLoaded?: (data: THeaderFooterApi) => void;
|
|
9
|
+
/** Fired when the fetch fails. */
|
|
10
|
+
onDataError?: (error: Error) => void;
|
|
11
|
+
/** Optional id of the toggle button that controls this menu. */
|
|
12
|
+
ariaLabelledBy?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* `<PktHeaderMenu>` — global mega menu for Oslo kommune.
|
|
16
|
+
*
|
|
17
|
+
* Fetches the live header/footer payload on mount and renders the
|
|
18
|
+
* `megamenu` slice for the current locale. Mirrors `pkt-header-menu`
|
|
19
|
+
* (Punkt Elements) — both implementations share types and data
|
|
20
|
+
* helpers from `shared-utils/header-menu`.
|
|
21
|
+
*
|
|
22
|
+
* This component is purely presentational with respect to focus/scroll-lock;
|
|
23
|
+
* the parent header is expected to control `open` and own focus
|
|
24
|
+
* management.
|
|
25
|
+
*/
|
|
26
|
+
export declare const PktHeaderMenu: ({ dataUrl, data, locale, open, mobileBreakpoint, ariaLabelledBy, className, onDataLoaded, onDataError, ref, ...rest }: IPktHeaderMenu) => import("react").JSX.Element;
|
|
File without changes
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Representing, User, UserMenuItem } from '../header/types';
|
|
2
|
+
export interface IPktHeaderUserMenu {
|
|
3
|
+
user: User;
|
|
4
|
+
formattedLastLoggedIn?: string;
|
|
5
|
+
representing?: Representing;
|
|
6
|
+
userMenu?: UserMenuItem[];
|
|
7
|
+
canChangeRepresentation?: boolean;
|
|
8
|
+
changeRepresentation?: () => void;
|
|
9
|
+
logoutOnClick?: () => void;
|
|
10
|
+
}
|
|
11
|
+
export declare const PktHeaderUserMenu: import('react').ForwardRefExoticComponent<IPktHeaderUserMenu & import('react').RefAttributes<HTMLDivElement>>;
|
|
File without changes
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import { THeadingLevel, THeadingSize, THeadingWeight } from '../../shared-types';
|
|
3
|
+
export type TPktHeadingLevel = THeadingLevel;
|
|
4
|
+
export type TPktHeadingSize = THeadingSize;
|
|
5
|
+
export type TPktHeadingWeight = THeadingWeight;
|
|
6
|
+
export interface IPktHeading extends HTMLAttributes<HTMLHeadingElement> {
|
|
7
|
+
size?: TPktHeadingSize;
|
|
8
|
+
level?: TPktHeadingLevel;
|
|
9
|
+
weight?: TPktHeadingWeight;
|
|
10
|
+
visuallyHidden?: boolean;
|
|
11
|
+
align?: 'start' | 'center' | 'end';
|
|
12
|
+
children?: ReactNode;
|
|
13
|
+
}
|
|
14
|
+
export declare const PktHeading: import('react').ForwardRefExoticComponent<IPktHeading & import('react').RefAttributes<HTMLHeadingElement>>;
|
|
File without changes
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export interface IPktHelptextProps extends HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
helptext?: string | ReactNode;
|
|
4
|
+
helptextDropdown?: string | ReactNode;
|
|
5
|
+
helptextDropdownButton?: string;
|
|
6
|
+
forId?: string;
|
|
7
|
+
onToggleHelpText?: (isOpen: boolean) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const PktHelptext: import('react').ForwardRefExoticComponent<IPktHelptextProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
File without changes
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { HTMLAttributes } from 'react';
|
|
2
|
+
import { Booleanish } from '../../shared-types';
|
|
3
|
+
interface IPktIcon extends HTMLAttributes<HTMLElement> {
|
|
4
|
+
name?: string;
|
|
5
|
+
path?: string;
|
|
6
|
+
ariaHidden?: Booleanish;
|
|
7
|
+
ariaLabel?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const PktIcon: import('react').ForwardRefExoticComponent<IPktIcon & import('react').RefAttributes<HTMLSpanElement>>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export { PktAccordion } from './accordion/Accordion';
|
|
2
|
+
export { PktAccordionItem } from './accordion/AccordionItem';
|
|
3
|
+
export { PktAlert } from './alert/Alert';
|
|
4
|
+
export { PktBackLink } from './backlink/BackLink';
|
|
5
|
+
export { PktBreadcrumbs } from './breadcrumbs/Breadcrumbs';
|
|
6
|
+
export { PktButton } from './button/Button';
|
|
7
|
+
export { PktCalendar } from './calendar/Calendar';
|
|
8
|
+
export { PktCard } from './card/Card';
|
|
9
|
+
export { PktCheckbox } from './checkbox/Checkbox';
|
|
10
|
+
export { PktCombobox } from './combobox/Combobox';
|
|
11
|
+
export { PktConsent } from './consent/Consent';
|
|
12
|
+
export { PktDatepicker } from './datepicker/Datepicker';
|
|
13
|
+
export { PktFileUpload } from './fileupload/FileUpload';
|
|
14
|
+
export { ItemRenderers } from './fileupload/QueueDisplay';
|
|
15
|
+
export { PktFooter } from './footer/Footer';
|
|
16
|
+
export { PktFooterSimple } from './footerSimple/FooterSimple';
|
|
17
|
+
export { PktHeader } from './header/Header';
|
|
18
|
+
export { PktHeaderMenu } from './header-menu/HeaderMenu';
|
|
19
|
+
export { PktHeaderService } from './header/HeaderService';
|
|
20
|
+
export { PktHeading } from './heading/Heading';
|
|
21
|
+
export { PktHelptext } from './helptext/Helptext';
|
|
22
|
+
export { PktIcon } from './icon/Icon';
|
|
23
|
+
export { PktInput } from './input/Input';
|
|
24
|
+
export { PktInputWrapper } from './inputwrapper/InputWrapper';
|
|
25
|
+
export { PktLink } from './link/Link';
|
|
26
|
+
export { PktLinkCard } from './linkcard/LinkCard';
|
|
27
|
+
export { PktLoader } from './loader/Loader';
|
|
28
|
+
export { PktMessagebox } from './messagebox/Messagebox';
|
|
29
|
+
export { PktModal } from './modal/Modal';
|
|
30
|
+
export { PktProgressbar } from './progressbar/Progressbar';
|
|
31
|
+
export { PktRadioButton } from './radio/RadioButton';
|
|
32
|
+
export { PktSearchInput } from './searchinput/SearchInput';
|
|
33
|
+
export type { PktSearchInputSuggestion } from './searchinput/SearchInput';
|
|
34
|
+
export { PktSelect } from './select/Select';
|
|
35
|
+
export { PktStep } from './stepper/Step';
|
|
36
|
+
export { PktStepper } from './stepper/Stepper';
|
|
37
|
+
export { PktTable } from './table/Table';
|
|
38
|
+
export { PktTableBody } from './table/TableBody';
|
|
39
|
+
export { PktTableDataCell } from './table/TableDataCell';
|
|
40
|
+
export { PktTableHeader } from './table/TableHeader';
|
|
41
|
+
export { PktTableHeaderCell } from './table/TableHeaderCell';
|
|
42
|
+
export { PktTableRow } from './table/TableRow';
|
|
43
|
+
export { PktTabs } from './tabs/Tabs';
|
|
44
|
+
export { PktTabItem } from './tabs/TabItem';
|
|
45
|
+
export { PktTag } from './tag/Tag';
|
|
46
|
+
export { PktTextarea } from './textarea/Textarea';
|
|
47
|
+
export { PktTextinput } from './textinput/Textinput';
|
|
48
|
+
export { PktTimepicker } from './timepicker/Timepicker';
|
|
49
|
+
export * from './interfaces';
|
|
50
|
+
export * from './types';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { InputHTMLAttributes } from 'react';
|
|
2
|
+
interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
|
|
3
|
+
/** The input's label */
|
|
4
|
+
label?: string;
|
|
5
|
+
/** The input's id */
|
|
6
|
+
id: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Input component
|
|
10
|
+
* @param {string} label - Label for the input
|
|
11
|
+
* @param {string} id - Id for the input
|
|
12
|
+
* @param {string} validationMessage - Validation message for the input
|
|
13
|
+
* @param {InputHTMLAttributes<HTMLInputElement>} props - Other props to pass to the input
|
|
14
|
+
* @returns {ReactElement} - React element
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* <Input label="First name" id="firstName" validationMessage="First name is required" />
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
export declare const PktInput: import('react').ForwardRefExoticComponent<InputProps & import('react').RefAttributes<HTMLInputElement>>;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ReactNode, RefAttributes } from 'react';
|
|
2
|
+
export interface IPktInputWrapper extends RefAttributes<HTMLElement> {
|
|
3
|
+
forId: string;
|
|
4
|
+
label: string;
|
|
5
|
+
helptext?: string | ReactNode;
|
|
6
|
+
helptextDropdown?: string | ReactNode;
|
|
7
|
+
helptextDropdownButton?: string;
|
|
8
|
+
counter?: boolean;
|
|
9
|
+
counterCurrent?: number;
|
|
10
|
+
counterMaxLength?: number;
|
|
11
|
+
optionalTag?: boolean;
|
|
12
|
+
optionalText?: string;
|
|
13
|
+
requiredTag?: boolean;
|
|
14
|
+
requiredText?: string;
|
|
15
|
+
tagText?: string | null;
|
|
16
|
+
hasError?: boolean;
|
|
17
|
+
errorMessage?: string | ReactNode;
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
inline?: boolean;
|
|
20
|
+
ariaDescribedby?: string;
|
|
21
|
+
useWrapper?: boolean;
|
|
22
|
+
children?: ReactNode;
|
|
23
|
+
className?: string;
|
|
24
|
+
hasFieldset?: boolean;
|
|
25
|
+
role?: string;
|
|
26
|
+
counterPosition?: 'top' | 'bottom';
|
|
27
|
+
}
|
|
28
|
+
export declare const PktInputWrapper: import('react').ForwardRefExoticComponent<Omit<IPktInputWrapper, "ref"> & RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export type { IPktAccordion } from './accordion/Accordion';
|
|
2
|
+
export type { IPktAccordionItem } from './accordion/AccordionItem';
|
|
3
|
+
export type { IPktAlert } from './alert/Alert';
|
|
4
|
+
export type { IPktBackLink } from './backlink/BackLink';
|
|
5
|
+
export type { IPktBreadcrumbs } from './breadcrumbs/Breadcrumbs';
|
|
6
|
+
export type { IPktButton } from './button/Button';
|
|
7
|
+
export type { IPktCard } from './card/Card';
|
|
8
|
+
export type { IPktCheckbox } from './checkbox/Checkbox';
|
|
9
|
+
export type { IPktCombobox } from './combobox/Combobox';
|
|
10
|
+
export type { IPktDatepicker } from './datepicker/Datepicker';
|
|
11
|
+
export type { IPktFileUpload } from './fileupload/FileUpload';
|
|
12
|
+
export type { IPktFooter } from './footer/Footer';
|
|
13
|
+
export type { IPktFooterSimple } from './footerSimple/FooterSimple';
|
|
14
|
+
export type { IPktHeader } from './header/Header';
|
|
15
|
+
export type { IPktHeaderMenu } from './header-menu/HeaderMenu';
|
|
16
|
+
export type { IPktHeaderService } from './header/HeaderService';
|
|
17
|
+
export type { IPktInputWrapper } from './inputwrapper/InputWrapper';
|
|
18
|
+
export type { IPktLinkCard } from './linkcard/LinkCard';
|
|
19
|
+
export type { IPktLoader } from './loader/Loader';
|
|
20
|
+
export type { IPktMessagebox } from './messagebox/Messagebox';
|
|
21
|
+
export type { IPktModal } from './modal/Modal';
|
|
22
|
+
export type { IPktProgressbar } from './progressbar/Progressbar';
|
|
23
|
+
export type { IPktRadioButton } from './radio/RadioButton';
|
|
24
|
+
export type { IPktStep } from './stepper/Step';
|
|
25
|
+
export type { IPktStepper } from './stepper/Stepper';
|
|
26
|
+
export type { IPktTab } from './tabs/Tabs';
|
|
27
|
+
export type { IPktTag } from './tag/Tag';
|
|
28
|
+
export type { IPktTextarea } from './textarea/Textarea';
|
|
29
|
+
export type { IPktTextinput } from './textinput/Textinput';
|
|
30
|
+
export type { IPktTimepicker } from './timepicker/types';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { AnchorHTMLAttributes, FC, LinkHTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
interface IPktLink extends LinkHTMLAttributes<HTMLAnchorElement> {
|
|
3
|
+
href?: string;
|
|
4
|
+
iconName?: string | undefined;
|
|
5
|
+
className?: string | undefined;
|
|
6
|
+
iconPosition?: string | undefined;
|
|
7
|
+
external?: boolean;
|
|
8
|
+
target?: string | undefined;
|
|
9
|
+
renderLink?: (args: {
|
|
10
|
+
href: string;
|
|
11
|
+
className: string;
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
props: AnchorHTMLAttributes<HTMLAnchorElement>;
|
|
14
|
+
}) => ReactNode;
|
|
15
|
+
}
|
|
16
|
+
export declare const PktLink: FC<IPktLink>;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export interface IPktLinkCard extends Omit<HTMLAttributes<HTMLAnchorElement>, 'title'> {
|
|
3
|
+
skin?: 'normal' | 'no-padding' | 'blue' | 'beige' | 'green' | 'gray' | 'beige-outline' | 'gray-outline';
|
|
4
|
+
title?: string;
|
|
5
|
+
href?: string;
|
|
6
|
+
iconName?: string;
|
|
7
|
+
openInNewTab?: boolean;
|
|
8
|
+
external?: boolean;
|
|
9
|
+
children?: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
export declare const PktLinkCard: {
|
|
12
|
+
({ children, skin, title, href, iconName, openInNewTab, external, className, ...props }: IPktLinkCard): import("react").JSX.Element;
|
|
13
|
+
displayName: string;
|
|
14
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
declare global {
|
|
3
|
+
interface Window {
|
|
4
|
+
pktAnimationPath?: string;
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
export type TPktLoaderVariant = 'blue' | 'rainbow' | 'shapes';
|
|
8
|
+
export type TPktLoaderSize = 'small' | 'medium' | 'large';
|
|
9
|
+
export interface IPktLoader extends HTMLAttributes<HTMLDivElement> {
|
|
10
|
+
/**
|
|
11
|
+
* Tid i millisekunder før loader vises. Nyttig når lastetiden kan være
|
|
12
|
+
* så kort at loader ikke trengs.
|
|
13
|
+
*/
|
|
14
|
+
delay?: number;
|
|
15
|
+
/**
|
|
16
|
+
* Vises loader inline eller som blokk.
|
|
17
|
+
*/
|
|
18
|
+
inline?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Styrer om loader eller barnenoder vises. Når `false` vises barnenoder.
|
|
21
|
+
*/
|
|
22
|
+
isLoading?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Meldingstekst som vises sammen med loader.
|
|
25
|
+
*/
|
|
26
|
+
message?: string | null;
|
|
27
|
+
/**
|
|
28
|
+
* Størrelse på loader. Standard er "medium".
|
|
29
|
+
*/
|
|
30
|
+
size?: TPktLoaderSize;
|
|
31
|
+
/**
|
|
32
|
+
* Loader-variant. Standard er "shapes" (Oslo-bølger). Andre er "blue" og "rainbow" (spinner-varianter).
|
|
33
|
+
*/
|
|
34
|
+
variant?: TPktLoaderVariant;
|
|
35
|
+
/**
|
|
36
|
+
* Overstyrer stien til loader-animasjoner.
|
|
37
|
+
*/
|
|
38
|
+
loadingAnimationPath?: string;
|
|
39
|
+
children?: ReactNode;
|
|
40
|
+
}
|
|
41
|
+
export declare const PktLoader: import('react').ForwardRefExoticComponent<IPktLoader & import('react').RefAttributes<HTMLDivElement>>;
|
|
File without changes
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FC, HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import { TMessageboxSkin } from '../../shared-types';
|
|
3
|
+
export type { TMessageboxSkin };
|
|
4
|
+
export interface IPktMessagebox extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
5
|
+
skin?: TMessageboxSkin;
|
|
6
|
+
title?: ReactNode;
|
|
7
|
+
compact?: boolean;
|
|
8
|
+
closable?: boolean;
|
|
9
|
+
onClose?: () => void;
|
|
10
|
+
}
|
|
11
|
+
export declare const PktMessagebox: FC<IPktMessagebox>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode, Ref } from 'react';
|
|
2
|
+
export interface IPktModal extends Omit<HTMLAttributes<HTMLDialogElement>, 'onClose' | 'open'> {
|
|
3
|
+
open?: boolean;
|
|
4
|
+
headingText?: string;
|
|
5
|
+
hideCloseButton?: boolean;
|
|
6
|
+
closeOnBackdropClick?: boolean;
|
|
7
|
+
size?: 'small' | 'medium' | 'large' | 'fit-content';
|
|
8
|
+
removePadding?: boolean;
|
|
9
|
+
closeButtonSkin?: 'blue' | 'yellow-filled';
|
|
10
|
+
variant?: 'dialog' | 'drawer';
|
|
11
|
+
drawerPosition?: 'left' | 'right';
|
|
12
|
+
transparentBackdrop?: boolean;
|
|
13
|
+
onClose?: () => void;
|
|
14
|
+
children?: ReactNode;
|
|
15
|
+
ref?: Ref<HTMLDialogElement>;
|
|
16
|
+
}
|
|
17
|
+
export declare const PktModal: import('react').ForwardRefExoticComponent<Omit<IPktModal, "ref"> & import('react').RefAttributes<HTMLDialogElement>>;
|
|
File without changes
|