@leabankab/component-library 6.1.0 → 7.0.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.
@@ -0,0 +1,34 @@
1
+ import { Button as BaseButton } from '@base-ui/react/button';
2
+ export type ButtonVariant = "primary" | "secondary" | "tertiary";
3
+ export type ButtonColor = "accent" | "neutral" | "danger";
4
+ export type ButtonSize = "sm" | "md" | "lg";
5
+ export type ButtonBaseProps = Omit<BaseButton.Props, "color"> & {
6
+ /**
7
+ * Visual weight.
8
+ * - `"primary"` — solid fill, for the main action.
9
+ * - `"secondary"` — outlined.
10
+ * - `"tertiary"` — ghost: no border or fill until hovered.
11
+ * @default "primary"
12
+ */
13
+ variant?: ButtonVariant;
14
+ /**
15
+ * Colour scheme. `"danger"` is for destructive actions.
16
+ * @default "accent"
17
+ */
18
+ color?: ButtonColor;
19
+ /**
20
+ * @default "md"
21
+ */
22
+ size?: ButtonSize;
23
+ /**
24
+ * Shows the busy state: the button is disabled, keeps its colour at reduced
25
+ * opacity and sets `aria-busy`.
26
+ * @default false
27
+ */
28
+ loading?: boolean;
29
+ };
30
+ /**
31
+ * The root shared by `Button`, `IconButton`, `CloseButton` and
32
+ * `DownloadTrigger`. Internal — not exported from the package.
33
+ */
34
+ export declare const ButtonBase: import('react').ForwardRefExoticComponent<Omit<ButtonBaseProps, "ref"> & import('react').RefAttributes<HTMLElement>>;
@@ -1,20 +1,36 @@
1
- import { ButtonProps as MuiButtonProps } from '@mui/material';
2
- import { ElementType } from 'react';
3
- type ButtonProps<C extends ElementType = "button"> = MuiButtonProps<C> & {
4
- /** The component to render the button as. */
5
- component?: C;
1
+ import { ReactNode } from 'react';
2
+ import { ButtonBaseProps } from './button-base';
3
+ export type { ButtonColor, ButtonSize, ButtonVariant, } from './button-base';
4
+ export type ButtonProps = ButtonBaseProps & {
5
+ /** Icon before the label. Replaced by the spinner while `loading`. */
6
+ startIcon?: ReactNode;
7
+ /** Icon after the label. */
8
+ endIcon?: ReactNode;
9
+ /**
10
+ * Text announced to screen readers while `loading`, through a
11
+ * visually-hidden `role="status"` region, e.g. "Saving…".
12
+ */
13
+ loadingLabel?: string;
6
14
  };
7
15
  /**
8
- * A standard button component.
16
+ * A button built on Base UI's `Button` primitive and styled with Lea's design
17
+ * tokens. Pick a `variant` (`primary`, `secondary`, `tertiary`), a `color`
18
+ * (`accent`, `neutral`, `danger`) and a `size` (`sm`, `md`, `lg`).
9
19
  *
10
- * Supports polymorphic rendering via the `component` prop, which enables
11
- * type-safe usage with any router link component:
20
+ * ```tsx
21
+ * <Button variant="secondary" startIcon={<Plus aria-hidden />}>Add</Button>
22
+ * ```
23
+ *
24
+ * To render a link that looks like a button, pass the link through `render`.
25
+ * An element with `href` or `to` is rendered as a real link, without button
26
+ * semantics:
12
27
  *
13
28
  * ```tsx
14
- * <Button component={Link} to="/about">About</Button> // React Router
15
- * <Button component={NextLink} href="/about">About</Button> // Next.js
16
- * <Button href="/about">About</Button> // Plain anchor
29
+ * <Button render={<a href="/about" />}>About</Button>
30
+ * <Button render={<NextLink href="/about" />}>About</Button>
31
+ * <Button render={<RouterLink to="/about" />}>About</Button>
17
32
  * ```
33
+ *
34
+ * For a link inside running text, use `Link` instead.
18
35
  */
19
- export declare const Button: ({ variant, size, children, ...rest }: ButtonProps) => import("react").JSX.Element;
20
- export {};
36
+ export declare const Button: import('react').ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & import('react').RefAttributes<HTMLElement>>;
@@ -0,0 +1,14 @@
1
+ import { ButtonBaseProps } from './button-base';
2
+ export type CloseButtonProps = Omit<ButtonBaseProps, "children" | "aria-label" | "aria-labelledby"> & {
3
+ /** Accessible name. Defaults to a translated "Close". */
4
+ label?: string;
5
+ };
6
+ /**
7
+ * An `IconButton` with a built-in X icon. It always has an accessible name —
8
+ * a translated "Close" unless you pass `label`.
9
+ *
10
+ * ```tsx
11
+ * <CloseButton onClick={() => setOpen(false)} />
12
+ * ```
13
+ */
14
+ export declare const CloseButton: import('react').ForwardRefExoticComponent<Omit<CloseButtonProps, "ref"> & import('react').RefAttributes<HTMLElement>>;
@@ -1,8 +1,6 @@
1
1
  import { DownloadDataSource } from '../../utils/downloadFile';
2
- import { ButtonProps as MuiButtonProps } from '@mui/material';
3
- import { ElementType } from 'react';
4
- type DownloadTriggerProps<C extends ElementType = "button"> = Omit<MuiButtonProps<C>, "onClick"> & {
5
- component?: C;
2
+ import { ButtonProps } from './button';
3
+ type DownloadTriggerProps = Omit<ButtonProps, "onClick"> & {
6
4
  /** File contents, or a function/promise that resolves to them. */
7
5
  data: DownloadDataSource;
8
6
  /** File name. */
@@ -15,19 +13,11 @@ type DownloadTriggerProps<C extends ElementType = "button"> = Omit<MuiButtonProp
15
13
  onDownloadError?: (error: unknown) => void;
16
14
  };
17
15
  /**
18
- * A button that triggers a download of a file.
19
- *
20
- * Supports polymorphic rendering via the `component` prop, which enables
21
- * type-safe usage with any router link component:
22
- *
23
- * ```tsx
24
- * <DownloadTrigger component={Link} to="/about">About</DownloadTrigger>
25
- * <DownloadTrigger component={NextLink} href="/about">About</DownloadTrigger>
26
- * <DownloadTrigger href="/about">About</DownloadTrigger>
27
- * ```
16
+ * A button that triggers a download of a file. Shares `Button`'s variants,
17
+ * colours and sizes, and shows the loading state while `data` resolves.
28
18
  *
29
19
  * Without `children` the label is the translated word for "download" in the
30
20
  * `LeaProvider` language.
31
21
  */
32
- export declare const DownloadTrigger: ({ data, fileName, mimeType, onDownload, onDownloadError, loading: loadingProp, disabled, children, ...rest }: DownloadTriggerProps) => import("react").JSX.Element;
22
+ export declare const DownloadTrigger: ({ data, fileName, mimeType, onDownload, onDownloadError, loading: loadingProp, children, ...rest }: DownloadTriggerProps) => import("react").JSX.Element;
33
23
  export {};
@@ -1,12 +1,42 @@
1
- import { IconButtonProps as MuiIconButtonProps } from '@mui/material';
2
- import { ElementType } from 'react';
3
- type IconButtonProps<C extends ElementType = "button"> = MuiIconButtonProps<C> & {
4
- component?: C;
1
+ import { ReactNode } from 'react';
2
+ import { ButtonBaseProps } from './button-base';
3
+ /**
4
+ * Requires an accessible name so the button is never nameless. Provide exactly
5
+ * one of `aria-label` or `aria-labelledby`.
6
+ */
7
+ type IconButtonAccessibleName = {
8
+ "aria-label": string;
9
+ "aria-labelledby"?: never;
10
+ } | {
11
+ "aria-labelledby": string;
12
+ "aria-label"?: never;
13
+ };
14
+ export type IconButtonProps = Omit<ButtonBaseProps, "children" | "aria-label" | "aria-labelledby"> & IconButtonAccessibleName & {
15
+ /** The icon. Mark it `aria-hidden` — the name comes from `aria-label`. */
16
+ children: ReactNode;
5
17
  };
6
18
  /**
7
- * An icon-only button styled with Lea's design tokens. Because it has no
8
- * visible text, always pass an `aria-label` so the control has an accessible
9
- * name.
19
+ * A square, icon-only button with the same variants, colours and sizes as
20
+ * `Button`. Because it has no visible text, TypeScript requires an
21
+ * `aria-label` or `aria-labelledby`.
22
+ *
23
+ * ```tsx
24
+ * <IconButton aria-label="Add" variant="secondary">
25
+ * <Plus aria-hidden />
26
+ * </IconButton>
27
+ * ```
10
28
  */
11
- export declare const IconButton: ({ ...rest }: IconButtonProps) => import("react").JSX.Element;
29
+ export declare const IconButton: import('react').ForwardRefExoticComponent<(Omit<Omit<ButtonBaseProps, "children" | "aria-label" | "aria-labelledby"> & {
30
+ "aria-label": string;
31
+ "aria-labelledby"?: never;
32
+ } & {
33
+ /** The icon. Mark it `aria-hidden` — the name comes from `aria-label`. */
34
+ children: ReactNode;
35
+ }, "ref"> | Omit<Omit<ButtonBaseProps, "children" | "aria-label" | "aria-labelledby"> & {
36
+ "aria-labelledby": string;
37
+ "aria-label"?: never;
38
+ } & {
39
+ /** The icon. Mark it `aria-hidden` — the name comes from `aria-label`. */
40
+ children: ReactNode;
41
+ }, "ref">) & import('react').RefAttributes<HTMLElement>>;
12
42
  export {};
@@ -1,5 +1,6 @@
1
1
  export * from './action-button';
2
2
  export * from './button';
3
+ export * from './close-button';
3
4
  export * from './download-trigger';
4
5
  export * from './icon-button';
5
6
  export * from './skip-link';
@@ -4,4 +4,4 @@
4
4
  * announced to assistive tech). Every string is overridable per-instance via a
5
5
  * matching prop, so consumers can localise or reword without forking.
6
6
  */
7
- export declare const useDevPanelLabels: () => Record<"step" | "copy" | "copied" | "copyJson" | "close" | "minimise" | "expand" | "statusCompleted" | "statusCurrent" | "statusUpcoming" | "needsAttention", string>;
7
+ export declare const useDevPanelLabels: () => Record<"step" | "copy" | "close" | "copied" | "copyJson" | "minimise" | "expand" | "statusCompleted" | "statusCurrent" | "statusUpcoming" | "needsAttention", string>;
@@ -1,22 +1,82 @@
1
- import { DialogProps as MuiDialogProps } from '@mui/material';
2
- import { ReactNode } from 'react';
3
- export type DialogProps = MuiDialogProps;
4
- export declare function Dialog({ slots, slotProps, transitionDuration, ...rest }: DialogProps): import("react").JSX.Element;
5
- type DialogCloseReason = "backdropClick" | "escapeKeyDown" | "closeButtonClick";
6
- export type SimpleDialogProps = Omit<MuiDialogProps, "title" | "onClose"> & {
7
- /** Heading, wired to the dialog via `aria-labelledby`. */
8
- title: ReactNode;
9
- /** Optional supporting text, wired via `aria-describedby` when present. */
10
- description?: ReactNode;
11
- /** Body content rendered below the title / description. */
12
- children?: ReactNode;
1
+ import { Dialog as BaseDialog } from '@base-ui/react/dialog';
2
+ import { ComponentPropsWithRef } from 'react';
3
+ /**
4
+ * Maximum width of the popup. The names match the breakpoint scale the library
5
+ * used before, so `size="xs"` is still the compact confirm dialog.
6
+ */
7
+ export type Size = "xs" | "sm" | "md" | "lg";
8
+ /**
9
+ * Groups all parts of the dialog and owns the open state. Renders no element
10
+ * of its own. Control it with `open` + `onOpenChange`, or leave both off and
11
+ * let a `Dialog.Trigger` drive it.
12
+ */
13
+ export declare const Root: typeof BaseDialog.Root;
14
+ export type RootProps<Payload = unknown> = BaseDialog.Root.Props<Payload>;
15
+ /**
16
+ * Opens the dialog. Renders a bare `<button>`, so pass a styled control
17
+ * through `render` — `<Dialog.Trigger render={<Button />}>Open</Dialog.Trigger>`.
18
+ */
19
+ export declare const Trigger: BaseDialog.Trigger;
20
+ export type TriggerProps<Payload = unknown> = BaseDialog.Trigger.Props<Payload>;
21
+ /** Moves the backdrop and popup to the end of `<body>`. */
22
+ export declare const Portal: import('react').ForwardRefExoticComponent<Omit<import('@base-ui/react').AlertDialogPortalProps, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
23
+ export type PortalProps = BaseDialog.Portal.Props;
24
+ export type BackdropProps = BaseDialog.Backdrop.Props;
25
+ /** The dimmed overlay behind the popup. */
26
+ export declare function Backdrop({ className, ...rest }: BackdropProps): import("react").JSX.Element;
27
+ export type ViewportProps = BaseDialog.Viewport.Props;
28
+ /** Centres the popup in the window and keeps a gutter at the screen edges. */
29
+ export declare function Viewport({ className, ...rest }: ViewportProps): import("react").JSX.Element;
30
+ export type PopupProps = BaseDialog.Popup.Props & {
13
31
  /**
14
- * Called when the user dismisses the dialog. `reason` is `"backdropClick"`,
15
- * `"escapeKeyDown"`, or `"closeButtonClick"` (the header X).
32
+ * Maximum width of the surface.
33
+ * @default "sm"
16
34
  */
17
- onClose?: (event: object, reason: DialogCloseReason) => void;
18
- /** Accessible name for the close button. Defaults to a translated "Close". */
19
- closeLabel?: string;
35
+ size?: Size;
36
+ /**
37
+ * Fills the screen on narrow viewports (below 600px) instead of floating as
38
+ * a card. Use it for flows that need the whole screen, such as a multi-step
39
+ * form or a long consent list.
40
+ */
41
+ fullScreenOnMobile?: boolean;
42
+ };
43
+ /**
44
+ * The dialog surface. Lays its children out in a column so a `Dialog.Content`
45
+ * can scroll while the header stays put.
46
+ */
47
+ export declare function Popup({ size, fullScreenOnMobile, className, ...rest }: PopupProps): import("react").JSX.Element;
48
+ export type HeaderProps = ComponentPropsWithRef<"div">;
49
+ /**
50
+ * The title row. Anything after the `Dialog.Title` sits on the same line,
51
+ * which is where `Dialog.CloseButton` belongs. Stays fixed while
52
+ * `Dialog.Content` scrolls.
53
+ */
54
+ export declare function Header({ className, ...rest }: HeaderProps): import("react").JSX.Element;
55
+ export type TitleProps = BaseDialog.Title.Props;
56
+ /**
57
+ * The heading. Base UI links it to the popup as the accessible name, so no id
58
+ * wiring is needed.
59
+ */
60
+ export declare function Title({ className, ...rest }: TitleProps): import("react").JSX.Element;
61
+ export type DescriptionProps = BaseDialog.Description.Props;
62
+ /** Supporting text, linked to the popup as its accessible description. */
63
+ export declare function Description({ className, ...rest }: DescriptionProps): import("react").JSX.Element;
64
+ export type ContentProps = ComponentPropsWithRef<"div">;
65
+ /** The body. Scrolls on its own once the popup runs out of height. */
66
+ export declare function Content({ className, ...rest }: ContentProps): import("react").JSX.Element;
67
+ /**
68
+ * Closes the dialog. Renders a bare `<button>` for text actions — use
69
+ * `render` for a styled one: `<Dialog.Close render={<Button />}>Cancel</Dialog.Close>`.
70
+ * For the X in the header corner, use `Dialog.CloseButton`.
71
+ */
72
+ export declare const Close: import('react').ForwardRefExoticComponent<Omit<import('@base-ui/react').AlertDialogCloseProps, "ref"> & import('react').RefAttributes<HTMLButtonElement>>;
73
+ export type CloseProps = BaseDialog.Close.Props;
74
+ export type CloseButtonProps = Omit<BaseDialog.Close.Props, "children" | "aria-label"> & {
75
+ /** Accessible name. Defaults to a translated "Close". */
76
+ label?: string;
20
77
  };
21
- export declare function SimpleDialog({ title, description, children, onClose, closeLabel, "aria-labelledby": ariaLabelledby, "aria-describedby": ariaDescribedby, ...rest }: SimpleDialogProps): import("react").JSX.Element;
22
- export {};
78
+ /**
79
+ * The round X in the header corner. It renders its own icon and always has an
80
+ * accessible name, so it cannot be built without one.
81
+ */
82
+ export declare function CloseButton({ label, className, ...rest }: CloseButtonProps): import("react").JSX.Element;
@@ -1,22 +1,87 @@
1
- import { DrawerProps as MuiDrawerProps } from '@mui/material';
2
- import { ReactNode } from 'react';
3
- export type DrawerProps = MuiDrawerProps;
4
- export declare function Drawer({ transitionDuration, ...rest }: DrawerProps): import("react").JSX.Element;
5
- type DrawerCloseReason = "backdropClick" | "escapeKeyDown" | "closeButtonClick";
6
- export type SimpleDrawerProps = Omit<MuiDrawerProps, "title" | "onClose"> & {
7
- /** Heading, wired to the drawer via `aria-labelledby`. */
8
- title: ReactNode;
9
- /** Optional supporting text, wired via `aria-describedby` when present. */
10
- description?: ReactNode;
11
- /** Body content rendered below the title / description. */
12
- children?: ReactNode;
1
+ import { Drawer as BaseDrawer } from '@base-ui/react/drawer';
2
+ import { ComponentPropsWithRef } from 'react';
3
+ /** Screen edge the panel slides in from. */
4
+ export type Side = "left" | "right" | "top" | "bottom";
5
+ export type RootProps<Payload = unknown> = Omit<BaseDrawer.Root.Props<Payload>, "swipeDirection"> & {
13
6
  /**
14
- * Called when the user dismisses the drawer. `reason` is `"backdropClick"`,
15
- * `"escapeKeyDown"`, or `"closeButtonClick"` (the header X).
7
+ * Screen edge the panel slides in from. Also sets the swipe-to-dismiss
8
+ * direction, so the two can never disagree.
9
+ * @default "right"
16
10
  */
17
- onClose?: (event: object, reason: DrawerCloseReason) => void;
18
- /** Accessible name for the close button. Defaults to a translated "Close". */
19
- closeLabel?: string;
11
+ side?: Side;
20
12
  };
21
- export declare function SimpleDrawer({ title, description, children, onClose, closeLabel, slotProps, "aria-labelledby": ariaLabelledby, "aria-describedby": ariaDescribedby, ...rest }: SimpleDrawerProps): import("react").JSX.Element;
22
- export {};
13
+ /**
14
+ * Groups all parts of the drawer and owns the open state. Renders no element
15
+ * of its own. Control it with `open` + `onOpenChange`, or leave both off and
16
+ * let a `Drawer.Trigger` drive it.
17
+ */
18
+ export declare function Root<Payload = unknown>({ side, ...rest }: RootProps<Payload>): import("react").JSX.Element;
19
+ /**
20
+ * Opens the drawer. Renders a bare `<button>`, so pass a styled control
21
+ * through `render` — `<Drawer.Trigger render={<Button />}>Open</Drawer.Trigger>`.
22
+ */
23
+ export declare const Trigger: BaseDrawer.Trigger;
24
+ export type TriggerProps<Payload = unknown> = BaseDrawer.Trigger.Props<Payload>;
25
+ /** Moves the backdrop and popup to the end of `<body>`. */
26
+ export declare const Portal: BaseDrawer.Portal;
27
+ export type PortalProps = BaseDrawer.Portal.Props;
28
+ export type BackdropProps = BaseDrawer.Backdrop.Props;
29
+ /** The dimmed overlay behind the panel. Fades out as the panel is swiped away. */
30
+ export declare function Backdrop({ className, ...rest }: BackdropProps): import("react").JSX.Element;
31
+ export type ViewportProps = BaseDrawer.Viewport.Props;
32
+ /**
33
+ * Positioning container for the panel. Also the element Base UI offsets when
34
+ * the on-screen keyboard appears.
35
+ */
36
+ export declare function Viewport({ className, ...rest }: ViewportProps): import("react").JSX.Element;
37
+ export type PopupProps = BaseDrawer.Popup.Props;
38
+ /**
39
+ * The panel surface, pinned to the edge given by `side` on `Drawer.Root`.
40
+ * Side panels are `min(22.5rem, 100vw)` wide and sheets are at most 90% of the
41
+ * screen height; override either with the `--drawer-size` custom property.
42
+ */
43
+ export declare function Popup({ className, ...rest }: PopupProps): import("react").JSX.Element;
44
+ export type HandleProps = ComponentPropsWithRef<"div">;
45
+ /**
46
+ * The grab bar at the top of a bottom sheet. Decorative — the panel is
47
+ * swipe-dismissable anywhere, so this is a hint rather than a control.
48
+ */
49
+ export declare function Handle({ className, ...rest }: HandleProps): import("react").JSX.Element;
50
+ export type HeaderProps = ComponentPropsWithRef<"div">;
51
+ /**
52
+ * The title row. Anything after the `Drawer.Title` sits on the same line,
53
+ * which is where `Drawer.CloseButton` belongs. Stays fixed while
54
+ * `Drawer.Content` scrolls.
55
+ */
56
+ export declare function Header({ className, ...rest }: HeaderProps): import("react").JSX.Element;
57
+ export type TitleProps = BaseDrawer.Title.Props;
58
+ /**
59
+ * The heading. Base UI links it to the panel as the accessible name, so no id
60
+ * wiring is needed.
61
+ */
62
+ export declare function Title({ className, ...rest }: TitleProps): import("react").JSX.Element;
63
+ export type DescriptionProps = BaseDrawer.Description.Props;
64
+ /** Supporting text, linked to the panel as its accessible description. */
65
+ export declare function Description({ className, ...rest }: DescriptionProps): import("react").JSX.Element;
66
+ export type ContentProps = BaseDrawer.Content.Props;
67
+ /**
68
+ * The body. Scrolls on its own once the panel runs out of height, and lets a
69
+ * mouse select text inside it without starting a swipe.
70
+ */
71
+ export declare function Content({ className, ...rest }: ContentProps): import("react").JSX.Element;
72
+ /**
73
+ * Closes the drawer. Renders a bare `<button>` for text actions — use
74
+ * `render` for a styled one: `<Drawer.Close render={<Button />}>Cancel</Drawer.Close>`.
75
+ * For the X in the header corner, use `Drawer.CloseButton`.
76
+ */
77
+ export declare const Close: BaseDrawer.Close;
78
+ export type CloseProps = BaseDrawer.Close.Props;
79
+ export type CloseButtonProps = Omit<BaseDrawer.Close.Props, "children" | "aria-label"> & {
80
+ /** Accessible name. Defaults to a translated "Close". */
81
+ label?: string;
82
+ };
83
+ /**
84
+ * The round X in the header corner. It renders its own icon and always has an
85
+ * accessible name, so it cannot be built without one.
86
+ */
87
+ export declare function CloseButton({ label, className, ...rest }: CloseButtonProps): import("react").JSX.Element;
@@ -1,3 +1,5 @@
1
1
  export * from './alert';
2
- export * from './dialog';
3
- export * from './drawer';
2
+ export * as Dialog from './dialog';
3
+ export * as Drawer from './drawer';
4
+ export * from './simple-dialog';
5
+ export * from './simple-drawer';
@@ -0,0 +1,40 @@
1
+ import { ReactNode } from 'react';
2
+ import * as Dialog from "./dialog";
3
+ export type SimpleDialogProps = Omit<Dialog.RootProps, "children"> & {
4
+ /** Heading. Becomes the dialog's accessible name. */
5
+ title: ReactNode;
6
+ /** Optional supporting text. Becomes the accessible description. */
7
+ description?: ReactNode;
8
+ /** Body content rendered below the title / description. */
9
+ children?: ReactNode;
10
+ /** Accessible name for the close button. Defaults to a translated "Close". */
11
+ closeLabel?: string;
12
+ /**
13
+ * Maximum width of the surface.
14
+ * @default "sm"
15
+ */
16
+ size?: Dialog.Size;
17
+ /** Fills the screen below 600px instead of floating as a card. */
18
+ fullScreenOnMobile?: boolean;
19
+ /** Hide close button. */
20
+ hideCloseButton?: boolean;
21
+ };
22
+ /**
23
+ * The ready-made modal: pass `title`, an optional `description` and
24
+ * `children`, and it renders the Lea chrome — a white, large-radius surface
25
+ * over a dark overlay, a title row with a close button, and a scrollable body.
26
+ *
27
+ * Reach for `Dialog` (the parts) when you need a different layout.
28
+ *
29
+ * ```tsx
30
+ * <SimpleDialog
31
+ * open={open}
32
+ * onOpenChange={setOpen}
33
+ * title="Update your details"
34
+ * description="Keep your contact information up to date."
35
+ * >
36
+ * <TextField label="Phone" />
37
+ * </SimpleDialog>
38
+ * ```
39
+ */
40
+ export declare function SimpleDialog({ title, description, children, closeLabel, size, fullScreenOnMobile, hideCloseButton, ...rest }: SimpleDialogProps): import("react").JSX.Element;
@@ -0,0 +1,30 @@
1
+ import { ReactNode } from 'react';
2
+ import * as Drawer from "./drawer";
3
+ export type SimpleDrawerProps = Omit<Drawer.RootProps, "children"> & {
4
+ /** Heading. Becomes the drawer's accessible name. */
5
+ title: ReactNode;
6
+ /** Optional supporting text. Becomes the accessible description. */
7
+ description?: ReactNode;
8
+ /** Body content rendered below the title / description. */
9
+ children?: ReactNode;
10
+ /** Accessible name for the close button. Defaults to a translated "Close". */
11
+ closeLabel?: string;
12
+ };
13
+ /**
14
+ * The ready-made side panel: pass `title`, an optional `description` and
15
+ * `children`, and it renders the Lea chrome — a white surface that slides in
16
+ * from the edge over a dark overlay, a header row with a close button, and a
17
+ * scrollable body. Swipe-to-dismiss comes for free, towards `side`.
18
+ *
19
+ * Bottom and top sheets (`side="bottom"` / `"top"`) get a grab handle and
20
+ * round the edge that faces the content.
21
+ *
22
+ * Reach for `Drawer` (the parts) when you need a different layout.
23
+ *
24
+ * ```tsx
25
+ * <SimpleDrawer open={open} onOpenChange={setOpen} title="Filters">
26
+ * <FilterForm />
27
+ * </SimpleDrawer>
28
+ * ```
29
+ */
30
+ export declare function SimpleDrawer({ title, description, children, closeLabel, side, ...rest }: SimpleDrawerProps): import("react").JSX.Element;
@@ -3,5 +3,5 @@
3
3
  * `role="group"` accessible name. Consumers can override any of these
4
4
  * per-instance via `DatePicker`'s `viewToggleLabels` prop.
5
5
  */
6
- export declare const useViewToggleLabels: () => Record<"month" | "year" | "selectView", string>;
6
+ export declare const useViewToggleLabels: () => Record<"year" | "month" | "selectView", string>;
7
7
  export type ViewToggleLabels = Partial<ReturnType<typeof useViewToggleLabels>>;
@@ -15,4 +15,5 @@ export * from './radio-card';
15
15
  export * from './radio-circle';
16
16
  export * from './select';
17
17
  export * from './slider';
18
+ export * from './switch';
18
19
  export { FormControlLabel, InputAdornment, type FormControlLabelProps, type InputAdornmentProps, } from '@mui/material';
@@ -0,0 +1,33 @@
1
+ import { Switch as BaseSwitch } from '@base-ui/react/switch';
2
+ /**
3
+ * Requires an accessible name so the switch is never nameless. Provide exactly
4
+ * one of `aria-label` or `aria-labelledby`.
5
+ */
6
+ type SwitchAccessibleName = {
7
+ "aria-label": string;
8
+ "aria-labelledby"?: never;
9
+ } | {
10
+ "aria-labelledby": string;
11
+ "aria-label"?: never;
12
+ };
13
+ export type SwitchProps = Omit<BaseSwitch.Root.Props, "children" | "aria-label" | "aria-labelledby"> & SwitchAccessibleName;
14
+ /**
15
+ * An on/off toggle built on Base UI's accessible `Switch` primitive.
16
+ *
17
+ * Base UI renders the `switch` role, keeps `aria-checked` in sync and submits
18
+ * a hidden input when `name` is set. The thumb is rendered internally so it
19
+ * can never be left out, and the slide respects `prefers-reduced-motion`.
20
+ *
21
+ * Unlike a checkbox, a switch takes effect immediately — use it for settings
22
+ * that apply on toggle, not for values confirmed by a submit button.
23
+ *
24
+ * ```tsx
25
+ * <Switch
26
+ * aria-label="Analyse-informasjonskapsler"
27
+ * defaultChecked
28
+ * onCheckedChange={(checked) => save(checked)}
29
+ * />
30
+ * ```
31
+ */
32
+ export declare function Switch({ className, ...rest }: SwitchProps): import("react").JSX.Element;
33
+ export {};
@@ -5,7 +5,7 @@
5
5
  * every language. Consumers can still override any of them per-instance with
6
6
  * MUI's `noOptionsText` / `loadingText` / `openText` / `closeText` / `clearText`.
7
7
  */
8
- export declare const useAutocompleteLabels: () => Record<"clear" | "loading" | "open" | "close" | "noOptions", string>;
8
+ export declare const useAutocompleteLabels: () => Record<"clear" | "loading" | "close" | "open" | "noOptions", string>;
9
9
  /**
10
10
  * The same labels mapped onto MUI's `Autocomplete` prop names, ready to spread
11
11
  * before `...rest` so a consumer-supplied value still wins.