@kystverket/styrbord 2.17.0 → 2.18.1

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.
@@ -19,6 +19,10 @@ export type AvatarProps = MergeRight<DsAvatarProps, (AriaLabel | AriaHidden) & {
19
19
  * `aria-label` when unset or blank.
20
20
  */
21
21
  'auto-seed'?: string;
22
+ /**
23
+ * Prefer `accent`, `extra1`, `extra2`, `lyng` or `sol`: their base colors are balanced with
24
+ * each other, and they are the ones `auto="solid"` picks from. `primary` and `neutral` work too.
25
+ */
22
26
  'data-color'?: DataColor;
23
27
  'data-color-variant'?: DataColorVariant;
24
28
  'data-size'?: '2xs' | '3xs' | DsAvatarProps['data-size'];
@@ -1,4 +1,5 @@
1
1
  import { AvatarAuto, AvatarBoringVariant } from './Avatar';
2
+ import type { DataColor } from '~/main';
2
3
  /**
3
4
  * Kystverket's avatar palette. boring-avatars needs hex strings (some variants compute
4
5
  * contrast from them), so these are resolved token values rather than CSS variables.
@@ -11,11 +12,18 @@ export declare const matchReservedSeed: (seed: string | undefined, reservedSeed:
11
12
  export declare const sizeClasses: (size: string) => string;
12
13
  export declare const borderStyleClasses: (borderStyle: string | undefined) => string | undefined;
13
14
  /**
15
+ * The `data-color` a `solid` avatar gets, so its base and contrast colors come from the tokens
16
+ * and follow the color scheme. `undefined` without a seed: see `noSeedStyles`.
14
17
  * @param isReserved From `matchReservedSeed`: `true` gets the reserved color, `false` never does,
15
18
  * `undefined` (no reservation) picks from the full palette.
16
19
  * @param reservedIndex Which palette color is reserved, wrapped to the palette's length.
17
20
  */
18
- export declare const autoSolidStyles: (ariaLabel?: string, isReserved?: boolean, reservedIndex?: number) => Record<string, string>;
21
+ export declare const autoSolidColor: (seed?: string, isReserved?: boolean, reservedIndex?: number) => DataColor | undefined;
22
+ /**
23
+ * A `solid` avatar without a seed, e.g. one that stands for "not assigned", is muted so it stands
24
+ * apart from the colored ones next to it.
25
+ */
26
+ export declare const noSeedStyles: Record<string, string>;
19
27
  /**
20
28
  * `undefined` means auto is explicitly disabled (`auto={false}`): no generated colors at all.
21
29
  */
@@ -1,5 +1,7 @@
1
1
  import { InputSize } from '~/main';
2
2
  export interface DateTimePickerProps {
3
+ /** Id on the underlying `<input>`, e.g. for linking from an ErrorSummary. Generated if omitted. */
4
+ id?: string;
3
5
  className?: string;
4
6
  optional?: boolean | string | undefined;
5
7
  required?: boolean | string | undefined;
@@ -5,6 +5,7 @@ declare const meta: {
5
5
  title: string;
6
6
  component: (props: DateTimePickerProps) => React.JSX.Element;
7
7
  decorators: (((Story: import("storybook/internal/csf").PartialStoryFn, context: import("storybook/internal/csf").StoryContext) => React.JSX.Element) | ((Story: import("storybook/internal/csf").PartialStoryFn<import("@storybook/react").ReactRenderer, {
8
+ id?: string | undefined;
8
9
  className?: string | undefined;
9
10
  optional?: boolean | string | undefined | undefined;
10
11
  required?: boolean | string | undefined | undefined;
@@ -1,5 +1,7 @@
1
1
  import { InputSize } from '~/main';
2
2
  export interface DatepickerProps {
3
+ /** Id on the underlying `<input>`, e.g. for linking from an ErrorSummary. Generated if omitted. */
4
+ id?: string;
3
5
  className?: string;
4
6
  loading?: boolean;
5
7
  /** Defaults to a fixed width that fits a date. */
@@ -5,6 +5,7 @@ declare const meta: {
5
5
  title: string;
6
6
  component: (props: DatepickerProps) => React.JSX.Element;
7
7
  decorators: (((Story: import("storybook/internal/csf").PartialStoryFn, context: import("storybook/internal/csf").StoryContext) => React.JSX.Element) | ((Story: import("storybook/internal/csf").PartialStoryFn<import("@storybook/react").ReactRenderer, {
8
+ id?: string | undefined;
8
9
  className?: string | undefined;
9
10
  loading?: boolean | undefined;
10
11
  width?: InputSize | undefined;
@@ -1,5 +1,7 @@
1
1
  import { InputSize } from '~/main';
2
2
  export interface TimePickerProps {
3
+ /** Id on the underlying `<input>`, e.g. for linking from an ErrorSummary. Generated if omitted. */
4
+ id?: string;
3
5
  className?: string;
4
6
  loading?: boolean;
5
7
  width?: InputSize;
@@ -5,6 +5,7 @@ declare const meta: {
5
5
  title: string;
6
6
  component: (props: TimePickerProps) => React.JSX.Element;
7
7
  decorators: (((Story: import("storybook/internal/csf").PartialStoryFn, context: import("storybook/internal/csf").StoryContext) => React.JSX.Element) | ((Story: import("storybook/internal/csf").PartialStoryFn<import("@storybook/react").ReactRenderer, {
8
+ id?: string | undefined;
8
9
  className?: string | undefined;
9
10
  loading?: boolean | undefined;
10
11
  width?: InputSize | undefined;
@@ -10,6 +10,13 @@ export interface ExistingFilesProviderItem {
10
10
  files: FileInfo[];
11
11
  }
12
12
  export interface FileUploaderProps {
13
+ /**
14
+ * Id on the visible control the user uploads with (upload button, dropzone or camera button),
15
+ * so an ErrorSummary link to `#id` moves focus there. The hidden file input gets `${id}-input`.
16
+ * When no control is shown (max files reached, or a file is uploading) the id moves to the field itself.
17
+ * Generated if omitted, so several uploaders on one page don't collide.
18
+ */
19
+ id?: string;
13
20
  label: string;
14
21
  description?: string | string[] | ReactNode;
15
22
  error?: string | null;
@@ -49,4 +56,4 @@ export interface FileUploaderProps {
49
56
  */
50
57
  fileActions?: (file: FileInfo) => FileUploaderFileAction[];
51
58
  }
52
- export declare const FileUploader: ({ label, maxSizeInBytes, required, optional, description, error, multiple, files, maxFiles, onChange, allowedFileTypes, withCaptureButton, existingFilesProvider, variant, allowFilePreview, uploadActions, fileActions, }: FileUploaderProps) => React.JSX.Element;
59
+ export declare const FileUploader: ({ id, label, maxSizeInBytes, required, optional, description, error, multiple, files, maxFiles, onChange, allowedFileTypes, withCaptureButton, existingFilesProvider, variant, allowFilePreview, uploadActions, fileActions, }: FileUploaderProps) => React.JSX.Element;
@@ -5,6 +5,7 @@ declare const meta: {
5
5
  title: string;
6
6
  component: (props: FileUploaderProps) => React.JSX.Element;
7
7
  decorators: (((Story: import("storybook/internal/csf").PartialStoryFn, context: import("storybook/internal/csf").StoryContext) => React.JSX.Element) | ((Story: import("storybook/internal/csf").PartialStoryFn<import("@storybook/react").ReactRenderer, {
8
+ id?: string | undefined;
8
9
  label: string;
9
10
  description?: string[] | React.ReactNode;
10
11
  error?: string | null | undefined;
@@ -6,7 +6,11 @@ type FileUploadActionsProps = {
6
6
  dialogRef: React.RefObject<ExistingFilesDialogHandle | null>;
7
7
  t: (key: string) => string;
8
8
  onUploadFile: (uploadedFiles: File[]) => void;
9
+ /** Goes on the primary visible control; the hidden inputs derive their ids from it. */
10
+ controlId: string;
11
+ /** Space-separated ids for the visible controls' aria-describedby (label, error, description). */
12
+ describedBy: string;
9
13
  allowedFileTypes: string[];
10
14
  } & Pick<FileUploaderProps, 'variant' | 'existingFilesProvider' | 'withCaptureButton' | 'multiple' | 'uploadActions'>;
11
- export declare function FileUploadActions({ variant, fileInputRef, onUploadFile, existingFilesProvider, fileCameraInputRef, dialogRef, allowedFileTypes, withCaptureButton, multiple, uploadActions, t, }: FileUploadActionsProps): React.JSX.Element;
15
+ export declare function FileUploadActions({ controlId, describedBy, variant, fileInputRef, onUploadFile, existingFilesProvider, fileCameraInputRef, dialogRef, allowedFileTypes, withCaptureButton, multiple, uploadActions, t, }: FileUploadActionsProps): React.JSX.Element;
12
16
  export {};
@@ -53,7 +53,7 @@ type HeaderProfile = {
53
53
  /**
54
54
  * Props for the profile avatar. Every `Avatar` prop is accepted except those the header sets
55
55
  * itself, so new `Avatar` props reach the header without changes here.
56
- * Without it, the avatar is `data-color="success"` unless an `AvatarProvider` sets `auto`.
56
+ * Without it, the avatar is `data-color="extra1"` unless an `AvatarProvider` sets `auto`.
57
57
  */
58
58
  avatarStyle?: Omit<AvatarProps, 'aria-label' | 'aria-hidden' | 'initials' | 'children' | 'data-size'>;
59
59
  };