@kystverket/styrbord 1.9.0 → 1.9.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.
@@ -0,0 +1,3 @@
1
+ import type { ClickableCardProps } from './ClickableCard.types';
2
+ declare const ClickableCard: (props: ClickableCardProps) => React.JSX.Element;
3
+ export default ClickableCard;
@@ -0,0 +1,44 @@
1
+ import type { StoryFn, StoryObj } from '@storybook/react-vite';
2
+ declare const meta: {
3
+ title: string;
4
+ component: (props: import("~/main").ClickableCardProps) => React.JSX.Element;
5
+ decorators: ((Story: import("storybook/internal/csf").PartialStoryFn, context: import("storybook/internal/csf").StoryContext) => React.JSX.Element)[];
6
+ tags: string[];
7
+ argTypes: {
8
+ variant: {
9
+ options: ("default" | "tinted")[];
10
+ control: {
11
+ type: "radio";
12
+ };
13
+ };
14
+ color: {
15
+ options: ("main" | "neutral")[];
16
+ control: {
17
+ type: "radio";
18
+ };
19
+ };
20
+ headingLevel: {
21
+ options: number[];
22
+ control: {
23
+ type: "select";
24
+ };
25
+ };
26
+ headingSize: {
27
+ options: string[];
28
+ control: {
29
+ type: "select";
30
+ };
31
+ };
32
+ icon: {
33
+ control: {
34
+ type: "text";
35
+ };
36
+ };
37
+ };
38
+ };
39
+ export default meta;
40
+ type Story = StoryObj<typeof meta>;
41
+ export declare const Default: Story;
42
+ export declare const ColorVariants: StoryFn;
43
+ export declare const Eksempel: StoryFn;
44
+ export declare const AsLink: Story;
@@ -0,0 +1,30 @@
1
+ import type { IconId } from '../Icon/icon.types';
2
+ export type ClickableCardColor = 'neutral' | 'main';
3
+ export type ClickableCardVariant = 'default' | 'tinted';
4
+ export type ClickableCardHeadingSize = '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';
5
+ type ClickableCardBaseProps = {
6
+ heading: string;
7
+ description?: string;
8
+ children?: React.ReactNode;
9
+ variant?: ClickableCardVariant;
10
+ color?: ClickableCardColor;
11
+ headingLevel?: 1 | 2 | 3 | 4 | 5 | 6;
12
+ headingSize?: ClickableCardHeadingSize;
13
+ icon?: IconId;
14
+ chevron?: boolean;
15
+ showBorder?: boolean;
16
+ className?: string;
17
+ 'aria-label'?: string;
18
+ };
19
+ type ClickableCardLinkProps = ClickableCardBaseProps & {
20
+ href: string;
21
+ target?: string;
22
+ rel?: string;
23
+ onClick?: React.MouseEventHandler<HTMLAnchorElement>;
24
+ };
25
+ type ClickableCardButtonProps = ClickableCardBaseProps & {
26
+ href?: never;
27
+ onClick?: React.MouseEventHandler<HTMLButtonElement>;
28
+ };
29
+ export type ClickableCardProps = ClickableCardLinkProps | ClickableCardButtonProps;
30
+ export {};
@@ -1,2 +1,2 @@
1
- export declare const iconIdList: readonly ["add", "add_box", "add_location", "add_location_alt", "adjust", "anchor", "apps", "archive", "arrow_back", "arrow_forward", "arrow_right_alt", "article", "calendar_month", "change_history", "chat", "check", "check_circle", "chevron_left", "chevron_right", "circle", "close", "cloud_alert", "cloud_done", "code_blocks", "content_copy", "data_table", "delete", "description", "directions_boat", "distance", "domain", "download", "edit", "edit_document", "edit_location", "edit_location_alt", "edit_square", "error", "event", "explore", "explore_nearby", "export_notes", "favorite", "file_map", "file_save", "folder_open", "format_align_center", "format_align_left", "format_align_right", "forward", "globe_uk", "groups", "image", "inbox", "info", "info_i", "keyboard_arrow_down", "keyboard_arrow_up", "language", "layers", "lightbulb", "link", "location_chip", "lock", "login", "logout", "mail", "map", "map_pin_heart", "menu", "mode_cool", "more_vert", "move", "numbers", "open_in_new", "pan_zoom", "pending_actions", "person", "person_add", "person_pin", "person_pin_circle", "photo_camera", "picture_as_pdf", "pin_drop", "radio_button_checked", "radio_button_unchecked", "sailing", "save", "send", "settings", "settings_input_antenna", "severe_cold", "source_environment", "stylus", "text_snippet", "timeline", "upload", "video_library", "videocam", "view_list", "warning", "zoom_in_map", "zoom_out_map", "format_italic", "format_bold", "format_list_bulleted", "format_list_numbered", "format_align_justify", "undo", "redo", "visibility", "left_panel_close", "left_panel_open", "right_panel_close", "right_panel_open"];
1
+ export declare const iconIdList: readonly ["add", "add_box", "add_location", "add_location_alt", "adjust", "anchor", "apps", "archive", "arrow_back", "arrow_forward", "arrow_right_alt", "article", "calendar_month", "change_history", "chat", "check", "check_circle", "chevron_left", "chevron_right", "circle", "close", "cloud_alert", "cloud_done", "code_blocks", "content_copy", "data_table", "delete", "description", "directions_boat", "distance", "domain", "download", "edit", "edit_document", "edit_location", "edit_location_alt", "edit_square", "error", "event", "explore", "explore_nearby", "export_notes", "favorite", "file_map", "file_save", "folder_open", "format_align_center", "format_align_left", "format_align_right", "forward", "globe_uk", "groups", "image", "inbox", "info", "info_i", "keep", "keep_off", "keyboard_arrow_down", "keyboard_arrow_up", "language", "layers", "lightbulb", "link", "location_chip", "lock", "login", "logout", "mail", "map", "map_pin_heart", "menu", "mode_cool", "more_vert", "move", "numbers", "open_in_new", "pan_zoom", "pending_actions", "person", "person_add", "person_pin", "person_pin_circle", "photo_camera", "picture_as_pdf", "pin_drop", "radio_button_checked", "radio_button_unchecked", "sailing", "save", "send", "settings", "settings_input_antenna", "severe_cold", "source_environment", "stylus", "text_snippet", "timeline", "upload", "video_library", "videocam", "view_list", "warning", "zoom_in_map", "zoom_out_map", "format_italic", "format_bold", "format_list_bulleted", "format_list_numbered", "format_align_justify", "undo", "redo", "visibility", "left_panel_close", "left_panel_open", "right_panel_close", "right_panel_open"];
2
2
  export type IconId = (typeof iconIdList)[number];
@@ -0,0 +1,10 @@
1
+ import { ReactNode, SetStateAction } from 'react';
2
+ type SideSheetButtonsContextType = {
3
+ setButtons: React.Dispatch<SetStateAction<ReactNode>> | null;
4
+ buttons: ReactNode | null;
5
+ };
6
+ export declare const SideSheetButtonsContext: React.Context<SideSheetButtonsContextType>;
7
+ export declare function SideSheetButtonsProvider({ children }: Readonly<{
8
+ children: ReactNode;
9
+ }>): React.JSX.Element;
10
+ export {};
@@ -0,0 +1,8 @@
1
+ import { ReactNode } from 'react';
2
+ /**
3
+ * Registers footer button content inside a `<SideSheet>`.
4
+ * If rendered outside a SideSheet it falls back to rendering children directly.
5
+ */
6
+ export declare function SideSheetButtons({ children }: {
7
+ children: ReactNode;
8
+ }): ReactNode;
@@ -0,0 +1,18 @@
1
+ import type { SideSheetLayoutProps } from '~/components/kystverket/SideSheet/SideSheet.types';
2
+ /** Internal context so SideSheet can warn when rendered outside a layout wrapper. */
3
+ export declare const SideSheetLayoutContext: React.Context<boolean>;
4
+ export declare function useSideSheetLayoutContext(): boolean;
5
+ /**
6
+ * Required wrapper when using `pinnable` or `mode="push"`.
7
+ *
8
+ * Renders as a flex container so that a pinned SideSheet takes a fixed width
9
+ * and the remaining content fills the rest of the row.
10
+ *
11
+ * ```tsx
12
+ * <SideSheet.Layout>
13
+ * <main>…page content…</main>
14
+ * <SideSheet open={isOpen} onClose={() => setOpen(false)} pinnable title="Details" />
15
+ * </SideSheet.Layout>
16
+ * ```
17
+ */
18
+ export declare function SideSheetLayout({ children, className, style }: SideSheetLayoutProps): React.JSX.Element;
@@ -0,0 +1,12 @@
1
+ import { SideSheetButtons } from './Buttons/SideSheetButtons';
2
+ import { SideSheetLayout } from './Layout/SideSheetLayout';
3
+ import type { SideSheetProps } from './SideSheet.types';
4
+ export type { SideSheetProps };
5
+ declare function SideSheetWithProvider(props: SideSheetProps & {
6
+ ref?: React.Ref<HTMLElement>;
7
+ }): React.JSX.Element;
8
+ type SideSheetComponent = typeof SideSheetWithProvider & {
9
+ Layout: typeof SideSheetLayout;
10
+ Buttons: typeof SideSheetButtons;
11
+ };
12
+ export declare const SideSheet: SideSheetComponent;
@@ -0,0 +1,34 @@
1
+ import type { StoryFn } from '@storybook/react-vite';
2
+ import { SideSheet } from '~/main';
3
+ declare const _default: {
4
+ title: string;
5
+ component: ((props: import("~/main").SideSheetProps & {
6
+ ref?: React.Ref<HTMLElement>;
7
+ }) => React.JSX.Element) & {
8
+ Layout: typeof import("./Layout/SideSheetLayout").SideSheetLayout;
9
+ Buttons: typeof import("./Buttons/SideSheetButtons").SideSheetButtons;
10
+ };
11
+ tags: string[];
12
+ parameters: {
13
+ layout: string;
14
+ docs: {
15
+ source: {
16
+ type: string;
17
+ };
18
+ };
19
+ };
20
+ };
21
+ export default _default;
22
+ export declare const Default: StoryFn<typeof SideSheet>;
23
+ export declare const OpenInNewWindow: StoryFn<typeof SideSheet>;
24
+ export declare const WithBackButton: StoryFn<typeof SideSheet>;
25
+ export declare const WithActionsScrollbarDividers: StoryFn<typeof SideSheet>;
26
+ export declare const Pinnable: StoryFn<typeof SideSheet>;
27
+ export declare const LeftPlacement: StoryFn<typeof SideSheet>;
28
+ export declare const SmallSize: StoryFn<typeof SideSheet>;
29
+ export declare const LargeSize: StoryFn<typeof SideSheet>;
30
+ export declare const HalfWidth: StoryFn<typeof SideSheet>;
31
+ export declare const PinnedWithContent: StoryFn<typeof SideSheet>;
32
+ export declare const NoBackdrop: StoryFn<typeof SideSheet>;
33
+ export declare const TwoSheets: StoryFn<typeof SideSheet>;
34
+ export declare const WithTabs: StoryFn<typeof SideSheet>;
@@ -0,0 +1,70 @@
1
+ import { CSSProperties, ReactNode } from 'react';
2
+ export type SideSheetSize = 'sm' | 'md' | 'lg' | '33%' | '50%' | '66%';
3
+ export type SideSheetPlacement = 'left' | 'right';
4
+ /**
5
+ * - `overlay`: sheet slides over content (default). Can be pinned by the user via `pinnable`.
6
+ * - `push`: sheet starts pinned and reflowing content inside `<SideSheet.Layout>`.
7
+ */
8
+ export type SideSheetMode = 'overlay' | 'push';
9
+ export type SideSheetHeadingSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
10
+ export interface SideSheetProps {
11
+ open?: boolean;
12
+ onClose?: () => void;
13
+ placement?: SideSheetPlacement;
14
+ size?: SideSheetSize;
15
+ /**
16
+ * overlay: sheet floats over content (default).
17
+ * push: sheet starts pinned/expanded, reflowing content inside `<SideSheet.Layout>`.
18
+ */
19
+ mode?: SideSheetMode;
20
+ /**
21
+ * Show a pin button in the header that lets the user toggle overlay/push.
22
+ * Default: `false`.
23
+ */
24
+ pinnable?: boolean;
25
+ /**
26
+ * Controlled pinned state. When `true` the sheet expands as a flex child (push mode).
27
+ * When `false` it overlays content. Combine with `onPinnedChange` for controlled usage.
28
+ */
29
+ pinned?: boolean;
30
+ /** Called when the user toggles the pin button. */
31
+ onPinnedChange?: (pinned: boolean) => void;
32
+ /**
33
+ * Default pinned state for uncontrolled usage. Defaults to `true` when `mode='push'`,
34
+ * `false` otherwise.
35
+ */
36
+ defaultPinned?: boolean;
37
+ /**
38
+ * Show a dim backdrop and trap focus when in overlay mode.
39
+ * Default: `true` (only applies in overlay/non-pinned state).
40
+ */
41
+ backdrop?: boolean;
42
+ /** Sheet heading text. */
43
+ title?: ReactNode;
44
+ /** Font size of the heading. Default: `'xs'`. */
45
+ headingSize?: SideSheetHeadingSize;
46
+ /** Show the close (×) button. Default: `true`. */
47
+ showCloseButton?: boolean;
48
+ /** Show a back (←) button in the header. Default: `false`. */
49
+ showBackButton?: boolean;
50
+ /** Called when the back button is clicked. */
51
+ onBack?: () => void;
52
+ /**
53
+ * An optional extra element rendered in the header between the title and the
54
+ * pin/close buttons (e.g. an "open in new tab" button).
55
+ */
56
+ headerAction?: ReactNode;
57
+ /** Show a divider line below the header. Default: `true`. */
58
+ headerDivider?: boolean;
59
+ /** Show a divider line above the footer. Default: `true`. */
60
+ footerDivider?: boolean;
61
+ children?: ReactNode;
62
+ className?: string;
63
+ style?: CSSProperties;
64
+ ref?: React.Ref<HTMLElement>;
65
+ }
66
+ export interface SideSheetLayoutProps {
67
+ children?: ReactNode;
68
+ className?: string;
69
+ style?: CSSProperties;
70
+ }
@@ -48,6 +48,8 @@ export { FileUploaderContext, type FileUploaderContextProps, } from './component
48
48
  export type * from './components/kystverket/FileUploader/FileUploader.types';
49
49
  export type { DeriveFileInfosFromStorageIds } from './utils/fileInfoResolver';
50
50
  export { default as CardTitle, type CardTitleProps } from './components/designsystemet/CardTitle/CardTitle';
51
+ export { default as ClickableCard } from './components/kystverket/ClickableCard/ClickableCard';
52
+ export type { ClickableCardProps, ClickableCardColor, ClickableCardVariant, } from './components/kystverket/ClickableCard/ClickableCard.types';
51
53
  export { Button } from './components/designsystemet/Button/Button';
52
54
  export type { ButtonProps } from './components/designsystemet/Button/Button';
53
55
  export { TextInput } from './components/designsystemet/TextInput/TextInput';
@@ -72,6 +74,8 @@ export { Avatar } from './components/designsystemet/Avatar/Avatar';
72
74
  export type { AvatarProps } from './components/designsystemet/Avatar/Avatar';
73
75
  export { IdProvider, useIdProvider } from './utils/idContext';
74
76
  export { SlotDialog, type SlotDialogProps } from './components/kystverket/SlotDialog/SlotDialog';
77
+ export { SideSheet, type SideSheetProps } from './components/kystverket/SideSheet/SideSheet';
78
+ export type { SideSheetSize, SideSheetPlacement, SideSheetMode, SideSheetHeadingSize, SideSheetLayoutProps, } from './components/kystverket/SideSheet/SideSheet.types';
75
79
  export { Suggestion } from './components/designsystemet/Suggestion/Suggestion';
76
80
  export type { SuggestionProps } from './components/designsystemet/Suggestion/Suggestion';
77
81
  export { RovingFocusItem, RovingFocusRoot, omit, useCheckboxGroup, useDebounceCallback, useIsomorphicLayoutEffect, useMediaQuery, usePagination, useRadioGroup, useSynchronizedAnimation, } from '@digdir/designsystemet-react';