@oslokommune/punkt-react 19.3.0 → 19.4.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 (64) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/components/card/Card.d.ts +2 -1
  3. package/dist/components/consent/Consent.d.ts +6 -38
  4. package/dist/components/datepicker/types.d.ts +1 -1
  5. package/dist/components/fileupload/extensions/Comments.d.ts +2 -1
  6. package/dist/components/fileupload/extensions/Remove.d.ts +2 -1
  7. package/dist/components/fileupload/extensions/Rename.d.ts +2 -1
  8. package/dist/components/fileupload/hooks/index.d.ts +1 -0
  9. package/dist/components/fileupload/hooks/useImageObjectUrl.d.ts +1 -0
  10. package/dist/components/fileupload/hooks.d.ts +1 -0
  11. package/dist/components/fileupload/types.d.ts +2 -0
  12. package/dist/components/header-menu/HeaderMenu.d.ts +3 -2
  13. package/dist/components/messagebox/Messagebox.d.ts +2 -1
  14. package/dist/components/modal/Modal.d.ts +2 -1
  15. package/dist/punkt-react.cjs +1 -1
  16. package/dist/punkt-react.js +1986 -1955
  17. package/dist/shared-strings/nb.d.ts +34 -0
  18. package/dist/shared-types/consent.d.ts +69 -0
  19. package/dist/shared-types/index.d.ts +2 -0
  20. package/package.json +2 -2
  21. package/src/components/alert/Alert.test.tsx +5 -5
  22. package/src/components/alert/Alert.tsx +2 -4
  23. package/src/components/breadcrumbs/Breadcrumbs.tsx +15 -12
  24. package/src/components/calendar/Calendar.core.test.tsx +22 -16
  25. package/src/components/calendar/CalendarNav.tsx +11 -6
  26. package/src/components/calendar/useCalendarState.ts +42 -55
  27. package/src/components/card/Card.tsx +17 -5
  28. package/src/components/combobox/ComboboxTags.tsx +3 -3
  29. package/src/components/combobox/Listbox.tsx +7 -5
  30. package/src/components/combobox/useComboboxState.ts +22 -18
  31. package/src/components/consent/Consent.test.tsx +6 -0
  32. package/src/components/consent/Consent.tsx +30 -55
  33. package/src/components/datepicker/DatepickerInputs.tsx +3 -9
  34. package/src/components/datepicker/types.ts +1 -1
  35. package/src/components/datepicker/useDatepickerState.ts +22 -17
  36. package/src/components/fileupload/DropZone.tsx +10 -10
  37. package/src/components/fileupload/FileUpload.tsx +9 -14
  38. package/src/components/fileupload/Subcomponents.tsx +78 -84
  39. package/src/components/fileupload/extensions/Comments.tsx +56 -50
  40. package/src/components/fileupload/extensions/Remove.tsx +8 -3
  41. package/src/components/fileupload/extensions/Rename.tsx +12 -8
  42. package/src/components/fileupload/hooks/index.ts +1 -0
  43. package/src/components/fileupload/hooks/useImageObjectUrl.ts +15 -0
  44. package/src/components/fileupload/hooks/useOperationState.ts +9 -16
  45. package/src/components/fileupload/hooks.ts +1 -0
  46. package/src/components/fileupload/types.ts +7 -1
  47. package/src/components/formAttribute.test.tsx +1 -0
  48. package/src/components/header/HeaderGlobal.tsx +8 -2
  49. package/src/components/header/HeaderService.test.tsx +5 -2
  50. package/src/components/header/HeaderService.tsx +5 -5
  51. package/src/components/header-menu/HeaderMenu.tsx +8 -3
  52. package/src/components/headerUserMenu/UserMenu.tsx +3 -2
  53. package/src/components/inputwrapper/InputWrapper.tsx +20 -27
  54. package/src/components/loader/Loader.tsx +12 -9
  55. package/src/components/messagebox/Messagebox.tsx +6 -2
  56. package/src/components/modal/Modal.tsx +13 -9
  57. package/src/components/searchinput/SearchInput.tsx +10 -6
  58. package/src/components/tabs/Tabs.test.tsx +1 -1
  59. package/src/components/tabs/Tabs.tsx +30 -35
  60. package/src/components/tag/Tag.tsx +7 -6
  61. package/src/components/textarea/Textarea.test.tsx +9 -0
  62. package/src/components/textarea/Textarea.tsx +6 -10
  63. package/src/components/textinput/Textinput.tsx +3 -9
  64. package/src/components/timepicker/useTimepickerState.ts +25 -21
package/CHANGELOG.md CHANGED
@@ -5,6 +5,19 @@ og skriver commits ca etter [Conventional Commits](https://conventionalcommits.o
5
5
 
6
6
  ---
7
7
 
8
+ ## [19.4.0](https://github.com/oslokommune/punkt/compare/19.3.1...19.4.0) (2026-09-29)
9
+
10
+ ---
11
+
12
+
13
+ ## [19.3.1](https://github.com/oslokommune/punkt/compare/19.3.0...19.3.1) (2026-09-29)
14
+
15
+ ### Bug Fixes
16
+ * Ryddesjau på shared-string og linting-varsler (#3679).
17
+
18
+ ---
19
+
20
+
8
21
  ## [19.3.0](https://github.com/oslokommune/punkt/compare/19.2.0...19.3.0) (2026-09-29)
9
22
 
10
23
  ---
@@ -1,7 +1,8 @@
1
1
  import { HTMLAttributes, ReactNode, Ref } from 'react';
2
+ import { IPktStringsProps } from '../../shared-strings';
2
3
  import { IPktCardBase, TCardSkin, TLayout } from '../../shared-types';
3
4
  export type { TCardSkin, TLayout };
4
- export interface IPktCard extends IPktCardBase, Omit<HTMLAttributes<HTMLElement>, 'title'> {
5
+ export interface IPktCard extends IPktCardBase, Omit<HTMLAttributes<HTMLElement>, 'title'>, IPktStringsProps<'card'> {
5
6
  children?: ReactNode;
6
7
  ref?: Ref<HTMLElement>;
7
8
  }
@@ -1,27 +1,6 @@
1
1
  import { HTMLAttributes } from 'react';
2
- interface ConsentItem {
3
- name: string;
4
- consent: boolean;
5
- }
6
- interface ConsentValue {
7
- items: ConsentItem[];
8
- }
9
- interface CookieConsentEvent {
10
- value: string | ConsentValue;
11
- }
12
- type ConsentDetailsMap = Record<string, boolean>;
13
- type CookieEventHandler = (consent: CookieConsentEvent) => void;
14
- interface CookieEvents {
15
- on(eventName: string, handler: CookieEventHandler): void;
16
- off(eventName: string, handler: CookieEventHandler): void;
17
- }
18
- interface CookieBannerApi {
19
- cookieConsent: {
20
- validateConsentCookie(): Promise<boolean>;
21
- getConsentCookie(): string | ConsentValue;
22
- };
23
- openCookieModal(): void;
24
- }
2
+ import { ICookieBannerApi, ICookieEvents, IPktConsentBase, TConsentDetailsMap, TPktConsentTriggerType } from '../../shared-types';
3
+ export type { TPktConsentTriggerType };
25
4
  declare global {
26
5
  interface Window {
27
6
  cookieBanner_devMode?: boolean;
@@ -30,22 +9,11 @@ declare global {
30
9
  cookieBanner_cookieExpiryDays?: string | null;
31
10
  cookieBanner_googleAnalyticsId?: string | null;
32
11
  cookieBanner_hotjarId?: string | null;
33
- cookieBanner?: CookieBannerApi;
34
- __cookieEvents?: CookieEvents;
12
+ cookieBanner?: ICookieBannerApi;
13
+ __cookieEvents?: ICookieEvents;
35
14
  }
36
15
  }
37
- export type TPktConsentTriggerType = 'button' | 'link' | 'footerlink' | 'icon';
38
- export interface IPktConsent extends HTMLAttributes<HTMLElement> {
39
- devMode?: boolean;
40
- cookieDomain?: string | null;
41
- cookieSecure?: string | null;
42
- cookieExpiryDays?: string | null;
43
- hotjarId?: string | null;
44
- googleAnalyticsId?: string | null;
45
- i18nLanguage?: string;
46
- triggerType?: TPktConsentTriggerType | null;
47
- triggerText?: string | null;
48
- onToggleConsent?: (e: CustomEvent<ConsentDetailsMap>) => void;
16
+ export interface IPktConsent extends IPktConsentBase, HTMLAttributes<HTMLElement> {
17
+ onToggleConsent?: (e: CustomEvent<TConsentDetailsMap>) => void;
49
18
  }
50
19
  export declare const PktConsent: import('react').ForwardRefExoticComponent<IPktConsent & import('react').RefAttributes<HTMLElement>>;
51
- export {};
@@ -92,7 +92,7 @@ export interface IDatepickerState {
92
92
  isInputDisabled: boolean;
93
93
  hasCounter: boolean;
94
94
  inputRef: React.RefObject<HTMLInputElement | null>;
95
- inputRefTo: React.RefObject<HTMLInputElement | null>;
95
+ inputToRef: React.RefObject<HTMLInputElement | null>;
96
96
  changeInputRef: React.RefObject<HTMLInputElement | null>;
97
97
  btnRef: React.RefObject<HTMLButtonElement | null>;
98
98
  wrapperRef: React.RefObject<HTMLDivElement | null>;
@@ -1,6 +1,7 @@
1
+ import { TPktStrings } from '../../../shared-strings';
1
2
  import { TQueueItemOperation } from '../types';
2
3
  export interface IComment {
3
4
  text: string;
4
5
  timestamp: string;
5
6
  }
6
- export declare const addCommentOperation: TQueueItemOperation;
7
+ export declare const addCommentOperation: (strings: TPktStrings["fileupload"]) => TQueueItemOperation;
@@ -1,2 +1,3 @@
1
+ import { TPktStrings } from '../../../shared-strings';
1
2
  import { TFileId, TQueueItemOperation } from '../types';
2
- export declare const removeFileOperation: (onFileRemoved: (fileId: TFileId) => void) => TQueueItemOperation;
3
+ export declare const removeFileOperation: (onFileRemoved: (fileId: TFileId) => void, strings: TPktStrings["fileupload"]) => TQueueItemOperation;
@@ -1,2 +1,3 @@
1
+ import { TPktStrings } from '../../../shared-strings';
1
2
  import { TQueueItemOperation } from '../types';
2
- export declare const renameFileOperation: TQueueItemOperation;
3
+ export declare const renameFileOperation: (strings: TPktStrings["fileupload"]) => TQueueItemOperation;
@@ -1,4 +1,5 @@
1
1
  export { useFileAttributes } from './useFileAttributes';
2
2
  export { useImagePreview } from './useImagePreview';
3
+ export { useImageObjectUrl } from './useImageObjectUrl';
3
4
  export { useOperationState } from './useOperationState';
4
5
  export { useRequiredFormValidation } from './useRequiredFormValidation';
@@ -0,0 +1 @@
1
+ export declare const useImageObjectUrl: (file: File | undefined) => string | null;
@@ -1,4 +1,5 @@
1
1
  export { useFileAttributes } from './hooks/useFileAttributes';
2
2
  export { useImagePreview } from './hooks/useImagePreview';
3
+ export { useImageObjectUrl } from './hooks/useImageObjectUrl';
3
4
  export { useOperationState } from './hooks/useOperationState';
4
5
  export { useRequiredFormValidation } from './hooks/useRequiredFormValidation';
@@ -1,5 +1,6 @@
1
1
  import { ReactElement, ReactNode } from 'react';
2
2
  import { IFileItem, IFileTransfer, IFileValidateDetail, TFileUploadStrategy, TTransferProgress } from '../../shared-types';
3
+ import { TPktStrings } from '../../shared-strings';
3
4
  /** Unique identifier assigned to each selected file. */
4
5
  export type TFileId = string;
5
6
  /**
@@ -24,6 +25,7 @@ export type TPktFileUploadContext = {
24
25
  name?: string;
25
26
  multiple: boolean;
26
27
  id?: string;
28
+ strings: TPktStrings['fileupload'];
27
29
  };
28
30
  export declare const PktFileUploadContext: import('react').Context<TPktFileUploadContext>;
29
31
  /** The value type for `PktFileUpload` (`value` / `defaultValue`). */
@@ -1,7 +1,8 @@
1
1
  import { HTMLAttributes, Ref } from 'react';
2
2
  import { IHeaderMenuButton, IHeaderMenuLink, IHeaderMenuSection, IHeaderMenuServices, IPktHeaderMenu as ISharedPktHeaderMenu, THeaderFooterApi, THeaderMenuLocale } from '../../shared-types';
3
+ import { IPktStringsProps } from '../../shared-strings';
3
4
  export type { THeaderFooterApi, THeaderMenuLocale, IHeaderMenuLink, IHeaderMenuButton, IHeaderMenuSection, IHeaderMenuServices, };
4
- export interface IPktHeaderMenu extends Omit<HTMLAttributes<HTMLElement>, 'onError'>, ISharedPktHeaderMenu {
5
+ export interface IPktHeaderMenu extends Omit<HTMLAttributes<HTMLElement>, 'onError'>, ISharedPktHeaderMenu, IPktStringsProps<'header'> {
5
6
  /** Forwarded to the host element. */
6
7
  ref?: Ref<HTMLElement>;
7
8
  /** Fired when the payload has been fetched (or `data` was supplied). */
@@ -21,4 +22,4 @@ export interface IPktHeaderMenu extends Omit<HTMLAttributes<HTMLElement>, 'onErr
21
22
  * the parent header is expected to control `open` and own focus
22
23
  * management.
23
24
  */
24
- export declare const PktHeaderMenu: ({ dataUrl, data, locale, open, mobileBreakpoint, className, onDataLoaded, onDataError, ref, ...rest }: IPktHeaderMenu) => import("react").JSX.Element;
25
+ export declare const PktHeaderMenu: ({ dataUrl, data, locale, open, mobileBreakpoint, className, onDataLoaded, onDataError, ref, strings, ...rest }: IPktHeaderMenu) => import("react").JSX.Element;
@@ -1,7 +1,8 @@
1
1
  import { FC, HTMLAttributes, ReactNode } from 'react';
2
+ import { IPktStringsProps } from '../../shared-strings';
2
3
  import { TMessageboxSkin } from '../../shared-types';
3
4
  export type { TMessageboxSkin };
4
- export interface IPktMessagebox extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
5
+ export interface IPktMessagebox extends Omit<HTMLAttributes<HTMLDivElement>, 'title'>, IPktStringsProps<'generic'> {
5
6
  skin?: TMessageboxSkin;
6
7
  title?: ReactNode;
7
8
  compact?: boolean;
@@ -1,5 +1,6 @@
1
1
  import { HTMLAttributes, ReactNode, Ref } from 'react';
2
- export interface IPktModal extends Omit<HTMLAttributes<HTMLDialogElement>, 'onClose' | 'open'> {
2
+ import { IPktStringsProps } from '../../shared-strings';
3
+ export interface IPktModal extends Omit<HTMLAttributes<HTMLDialogElement>, 'onClose' | 'open'>, IPktStringsProps<'generic'> {
3
4
  open?: boolean;
4
5
  headingText?: string;
5
6
  hideCloseButton?: boolean;