@mond-design-system/react 4.6.1 → 4.8.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.
package/dist/index.d.cts CHANGED
@@ -698,6 +698,15 @@ interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "typ
698
698
  /** Inline label — part of the click target. Rich content welcome (an
699
699
  inline link, a Text run); the label element names the box either way. */
700
700
  label: ReactNode;
701
+ /** Keep the name for readers and take it off the screen. A box in a table's
702
+ select column has no room for the word and the column header says it
703
+ anyway, but a reader who cannot see which row they are in still needs
704
+ to be told. Naming it is not optional; showing it is. */
705
+ labelHidden?: boolean;
706
+ /** Neither checked nor unchecked: the third thing a box governing a set of
707
+ others has to say. Only the DOM property carries it — there is no
708
+ attribute — so a caller cannot set it without this. */
709
+ indeterminate?: boolean;
701
710
  ref?: Ref<HTMLInputElement>;
702
711
  }
703
712
  /**
@@ -712,7 +721,7 @@ interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "typ
712
721
  * />
713
722
  * ```
714
723
  */
715
- declare function Checkbox({ label, className, ...rest }: CheckboxProps): ReactElement;
724
+ declare function Checkbox({ label, labelHidden, indeterminate, className, ref, ...rest }: CheckboxProps): ReactElement;
716
725
 
717
726
  interface RadioProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "size"> {
718
727
  /** Inline label — part of the click target. */
@@ -894,6 +903,81 @@ interface ListItemProps extends Omit<HTMLAttributes<HTMLElement>, "title" | "onC
894
903
  */
895
904
  declare function ListItem({ title, description, leading, trailing, actions, onClick, pressed, href, as, surface, className, ref, ...rest }: ListItemProps): ReactElement;
896
905
 
906
+ interface DataColumn<Row> {
907
+ key: string;
908
+ /** Read in the header row, and echoed beside the cell once the table has
909
+ folded into cards. */
910
+ header: ReactNode;
911
+ /** CSS width for the column, applied through the colgroup. */
912
+ width?: string;
913
+ cell: (row: Row) => ReactNode;
914
+ }
915
+ interface DataTableSelectionLabels {
916
+ /** Names one row's box — "Select Ada Lovelace". The row's own label is
917
+ handed in, so the sentence is the app's to build. */
918
+ row: (label: string) => string;
919
+ /** Names the header box, which takes or lets go of every row at once. */
920
+ all: string;
921
+ /** "3 selected" — a function, because only the app knows how its language
922
+ counts. */
923
+ count: (selected: number) => string;
924
+ }
925
+ type DataTableSelection = {
926
+ /** Row keys currently taken. Held by the caller: the table draws it and
927
+ says what changed, and never keeps a second copy. */
928
+ selected: string[];
929
+ onSelectedChange: (keys: string[]) => void;
930
+ selectionLabels: DataTableSelectionLabels;
931
+ /** What can be done to the taken rows, shown with the count of them. */
932
+ bulkActions?: ReactNode;
933
+ } | {
934
+ selected?: undefined;
935
+ onSelectedChange?: undefined;
936
+ selectionLabels?: undefined;
937
+ bulkActions?: undefined;
938
+ };
939
+ type DataTableProps<Row> = Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
940
+ /** Names the table. Required: a table of rows with no name is a grid of
941
+ values with nothing saying what they are a list of. */
942
+ label: string;
943
+ columns: DataColumn<Row>[];
944
+ rows: Row[];
945
+ rowKey: (row: Row) => string;
946
+ /** Names one row where its first cell will not do — a row led by an avatar,
947
+ or by a title that repeats down the table. */
948
+ rowLabel?: (row: Row) => string;
949
+ /** What can be done to one row, in a column of its own at the end. */
950
+ rowActions?: (row: Row) => ReactNode;
951
+ /** Names that column. */
952
+ actionsHeader?: ReactNode;
953
+ /** A row the table still lists but no longer counts — suspended, hidden. */
954
+ rowMuted?: (row: Row) => boolean;
955
+ /** Shown in place of the rows when there are none. */
956
+ empty?: ReactNode;
957
+ ref?: Ref<HTMLDivElement>;
958
+ } & DataTableSelection;
959
+ /**
960
+ * Rows and columns, folded into cards on a narrow screen.
961
+ *
962
+ * Below the wide breakpoint a table cannot be read across, so each row becomes
963
+ * a card and every cell carries its column's header beside it. The markup is
964
+ * one table either way: what changes is the layout, never the semantics.
965
+ *
966
+ * ```tsx
967
+ * <DataTable
968
+ * label={t("admin.members.table")}
969
+ * columns={[
970
+ * { key: "name", header: t("admin.name"), cell: (m) => m.name },
971
+ * { key: "role", header: t("admin.role"), cell: (m) => <Tag>{m.role}</Tag> },
972
+ * ]}
973
+ * rows={members}
974
+ * rowKey={(m) => m.id}
975
+ * empty={t("admin.members.none")}
976
+ * />
977
+ * ```
978
+ */
979
+ declare function DataTable<Row>({ label, columns, rows, rowKey, rowLabel, rowActions, actionsHeader, rowMuted, empty, ref, selected, onSelectedChange, selectionLabels, bulkActions, className, ...rest }: DataTableProps<Row>): ReactElement;
980
+
897
981
  interface EmptyStateProps {
898
982
  title: string;
899
983
  description?: string;
@@ -1365,6 +1449,66 @@ interface TabBarActionProps {
1365
1449
  it is a peer child, and the bar's flex layout leaves it its own width. */
1366
1450
  declare function TabBarAction({ label, icon, onClick }: TabBarActionProps): react.JSX.Element;
1367
1451
 
1452
+ interface SideNavProps extends Omit<HTMLAttributes<HTMLElement>, "children"> {
1453
+ /** Accessible name of the navigation landmark. There is more than one
1454
+ navigation on a page wide enough to show this one. */
1455
+ label: string;
1456
+ children: ReactNode;
1457
+ ref?: Ref<HTMLElement>;
1458
+ }
1459
+ /**
1460
+ * The standing column of destinations, from the width where it costs nothing.
1461
+ * TabBar is the same list on a phone; both are navigation landmarks whose
1462
+ * items stay in the natural tab order — roving focus is for composite
1463
+ * widgets, not for navigation.
1464
+ *
1465
+ * ```tsx
1466
+ * <SideNav label="Primary">
1467
+ * <SideNavItem label="Home" icon={<Icon name="home" />} href="/" active />
1468
+ * <Divider />
1469
+ * <SideNavGroup label="More">
1470
+ * <SideNavItem label="Settings" icon={<Icon name="settings" />} href="/settings" />
1471
+ * </SideNavGroup>
1472
+ * <Button fullWidth iconLeft={<Icon name="plus" />} onClick={compose}>New post</Button>
1473
+ * </SideNav>
1474
+ * ```
1475
+ *
1476
+ * The column's own placement is the host's — a sticky offset under a header,
1477
+ * a fixed rail, a plain block — so it takes a className and sets none of it.
1478
+ */
1479
+ declare function SideNav({ label, className, children, ref, ...rest }: SideNavProps): ReactElement;
1480
+ interface SideNavGroupProps extends HTMLAttributes<HTMLDivElement> {
1481
+ /** Heading over the run, which also names it to a screen reader. Without
1482
+ one the rows are still a run on screen and nothing to be told about, so
1483
+ the group takes no role. */
1484
+ label?: ReactNode;
1485
+ children: ReactNode;
1486
+ ref?: Ref<HTMLDivElement>;
1487
+ }
1488
+ /** A run of destinations under one heading, or none. */
1489
+ declare function SideNavGroup({ label, className, children, ref, ...rest }: SideNavGroupProps): ReactElement;
1490
+ interface SideNavItemProps {
1491
+ label: ReactNode;
1492
+ icon?: ReactNode;
1493
+ href?: string | undefined;
1494
+ onClick?: MouseEventHandler | undefined;
1495
+ /** The destination the reader is on. Lands as aria-current="page". */
1496
+ active?: boolean | undefined;
1497
+ /** How many are waiting, at the far end of the row. Nothing at zero: an
1498
+ absence needs no mark. */
1499
+ count?: number | undefined;
1500
+ /** What the count counts, in words — the badge is read as this, and a bare
1501
+ number is read as nothing. */
1502
+ countLabel?: string | undefined;
1503
+ /** The last number worth printing; above it the badge says `99+`, because
1504
+ the column's width is fixed and a fourth digit takes it from the word. */
1505
+ max?: number | undefined;
1506
+ /** Element override for the link, e.g. a router's Link. */
1507
+ as?: ElementType;
1508
+ }
1509
+ /** One destination. A link where it has one, a button where it does not. */
1510
+ declare function SideNavItem({ label, icon, href, onClick, active, count, countLabel, max, as, }: SideNavItemProps): ReactElement;
1511
+
1368
1512
  interface MediaPlaceholderProps extends Omit<HTMLAttributes<HTMLDivElement>, "children"> {
1369
1513
  /** CSS aspect-ratio for the box, e.g. "4 / 5". Default 16 / 9. */
1370
1514
  aspect?: string;
@@ -1728,4 +1872,4 @@ interface RovingGroupOptions {
1728
1872
  */
1729
1873
  declare function useRovingGroup(ref: RefObject<HTMLElement | null>, { selector, orientation }: RovingGroupOptions): (event: KeyboardEvent<HTMLElement>) => void;
1730
1874
 
1731
- export { AppBar, type AppBarProps, Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, type AvatarSize, Badge, type BadgeProps, type BadgeTone, Breadcrumb, type BreadcrumbProps, Button, type ButtonProps, type ButtonShape, type ButtonSize, type ButtonVariant, type CSSVars, Card, CardBody, CardFooter, CardHeader, type CardProps, type CardSectionProps, type CardVariant, type CarouselPager, type CarouselSlide, Checkbox, type CheckboxProps, Chip, ChipBar, type ChipBarGap, type ChipBarProps, ChipGroup, type ChipGroupGap, type ChipGroupProps, type ChipProps, type ChipVariant, ConfirmDialog, type ConfirmDialogProps, type ConfirmDialogTone, Container, type ContainerProps, type ContainerWidth, CountButton, type CountButtonProps, type CountButtonTone, type Crumb, DateTimePicker, type DateTimePickerLabels, type DateTimePickerProps, Divider, type DividerProps, EmptyState, type EmptyStateProps, Field, type FieldContextValue, type FieldProps, Heading, type HeadingLevel, type HeadingProps, type HeadingTone, Icon, type IconProps, IconProvider, type IconProviderProps, type IconRender, type IconRenderProps, type IconSize, ImageCarousel, type ImageCarouselLabels, type ImageCarouselProps, Inline, type InlineAlign, type InlineGap, type InlineJustify, type InlineProps, Input, type InputProps, type InputSize, Lightbox, type LightboxLabels, type LightboxProps, Link, type LinkProps, type LinkVariant, ListGroup, type ListGroupProps, ListItem, type ListItemProps, MediaPlaceholder, type MediaPlaceholderProps, Modal, ModalBody, ModalFooter, ModalHeader, type ModalProps, type OverlayHistory, OverlayHistoryContext, PasswordInput, type PasswordInputProps, type Presence, ProgressBar, type ProgressBarProps, Radio, type RadioProps, type RovingGroupOptions, Screen, ScreenContent, type ScreenContentProps, SearchField, type SearchFieldProps, type SegmentOption, SegmentedControl, type SegmentedControlProps, type SegmentedControlSize, Select, type SelectProps, type SelectSize, Sheet, SheetBody, SheetFooter, SheetHeader, type SheetProps, Skeleton, type SkeletonProps, type SkeletonVariant, Spinner, type SpinnerProps, Stack, type StackAlign, type StackGap, type StackProps, Switch, type SwitchProps, Tab, TabBar, TabBarAction, type TabBarActionProps, TabBarItem, type TabBarItemProps, type TabBarProps, TabList, type TabListProps, TabPanel, type TabPanelProps, type TabProps, Tabs, type TabsProps, Tag, type TagProps, type TagTone, Text, type TextProps, type TextTone, type TextVariant, Textarea, type TextareaProps, type ToastAction, type ToastOptions, ToastProvider, type ToastProviderProps, type ToastTone, UploadProgress, type UploadProgressLabels, type UploadProgressProps, type UploadStatus, type UseOverlayOptions, type VideoCaptions, type VideoChapter, VideoPlayer, type VideoPlayerLabels, type VideoPlayerProps, VisuallyHidden, type VisuallyHiddenProps, cx, useFieldContext, useOverlay, usePresence, useRovingGroup, useToast };
1875
+ export { AppBar, type AppBarProps, Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, type AvatarSize, Badge, type BadgeProps, type BadgeTone, Breadcrumb, type BreadcrumbProps, Button, type ButtonProps, type ButtonShape, type ButtonSize, type ButtonVariant, type CSSVars, Card, CardBody, CardFooter, CardHeader, type CardProps, type CardSectionProps, type CardVariant, type CarouselPager, type CarouselSlide, Checkbox, type CheckboxProps, Chip, ChipBar, type ChipBarGap, type ChipBarProps, ChipGroup, type ChipGroupGap, type ChipGroupProps, type ChipProps, type ChipVariant, ConfirmDialog, type ConfirmDialogProps, type ConfirmDialogTone, Container, type ContainerProps, type ContainerWidth, CountButton, type CountButtonProps, type CountButtonTone, type Crumb, type DataColumn, DataTable, type DataTableProps, type DataTableSelectionLabels, DateTimePicker, type DateTimePickerLabels, type DateTimePickerProps, Divider, type DividerProps, EmptyState, type EmptyStateProps, Field, type FieldContextValue, type FieldProps, Heading, type HeadingLevel, type HeadingProps, type HeadingTone, Icon, type IconProps, IconProvider, type IconProviderProps, type IconRender, type IconRenderProps, type IconSize, ImageCarousel, type ImageCarouselLabels, type ImageCarouselProps, Inline, type InlineAlign, type InlineGap, type InlineJustify, type InlineProps, Input, type InputProps, type InputSize, Lightbox, type LightboxLabels, type LightboxProps, Link, type LinkProps, type LinkVariant, ListGroup, type ListGroupProps, ListItem, type ListItemProps, MediaPlaceholder, type MediaPlaceholderProps, Modal, ModalBody, ModalFooter, ModalHeader, type ModalProps, type OverlayHistory, OverlayHistoryContext, PasswordInput, type PasswordInputProps, type Presence, ProgressBar, type ProgressBarProps, Radio, type RadioProps, type RovingGroupOptions, Screen, ScreenContent, type ScreenContentProps, SearchField, type SearchFieldProps, type SegmentOption, SegmentedControl, type SegmentedControlProps, type SegmentedControlSize, Select, type SelectProps, type SelectSize, Sheet, SheetBody, SheetFooter, SheetHeader, type SheetProps, SideNav, SideNavGroup, type SideNavGroupProps, SideNavItem, type SideNavItemProps, type SideNavProps, Skeleton, type SkeletonProps, type SkeletonVariant, Spinner, type SpinnerProps, Stack, type StackAlign, type StackGap, type StackProps, Switch, type SwitchProps, Tab, TabBar, TabBarAction, type TabBarActionProps, TabBarItem, type TabBarItemProps, type TabBarProps, TabList, type TabListProps, TabPanel, type TabPanelProps, type TabProps, Tabs, type TabsProps, Tag, type TagProps, type TagTone, Text, type TextProps, type TextTone, type TextVariant, Textarea, type TextareaProps, type ToastAction, type ToastOptions, ToastProvider, type ToastProviderProps, type ToastTone, UploadProgress, type UploadProgressLabels, type UploadProgressProps, type UploadStatus, type UseOverlayOptions, type VideoCaptions, type VideoChapter, VideoPlayer, type VideoPlayerLabels, type VideoPlayerProps, VisuallyHidden, type VisuallyHiddenProps, cx, useFieldContext, useOverlay, usePresence, useRovingGroup, useToast };
package/dist/index.d.ts CHANGED
@@ -698,6 +698,15 @@ interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "typ
698
698
  /** Inline label — part of the click target. Rich content welcome (an
699
699
  inline link, a Text run); the label element names the box either way. */
700
700
  label: ReactNode;
701
+ /** Keep the name for readers and take it off the screen. A box in a table's
702
+ select column has no room for the word and the column header says it
703
+ anyway, but a reader who cannot see which row they are in still needs
704
+ to be told. Naming it is not optional; showing it is. */
705
+ labelHidden?: boolean;
706
+ /** Neither checked nor unchecked: the third thing a box governing a set of
707
+ others has to say. Only the DOM property carries it — there is no
708
+ attribute — so a caller cannot set it without this. */
709
+ indeterminate?: boolean;
701
710
  ref?: Ref<HTMLInputElement>;
702
711
  }
703
712
  /**
@@ -712,7 +721,7 @@ interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "typ
712
721
  * />
713
722
  * ```
714
723
  */
715
- declare function Checkbox({ label, className, ...rest }: CheckboxProps): ReactElement;
724
+ declare function Checkbox({ label, labelHidden, indeterminate, className, ref, ...rest }: CheckboxProps): ReactElement;
716
725
 
717
726
  interface RadioProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "size"> {
718
727
  /** Inline label — part of the click target. */
@@ -894,6 +903,81 @@ interface ListItemProps extends Omit<HTMLAttributes<HTMLElement>, "title" | "onC
894
903
  */
895
904
  declare function ListItem({ title, description, leading, trailing, actions, onClick, pressed, href, as, surface, className, ref, ...rest }: ListItemProps): ReactElement;
896
905
 
906
+ interface DataColumn<Row> {
907
+ key: string;
908
+ /** Read in the header row, and echoed beside the cell once the table has
909
+ folded into cards. */
910
+ header: ReactNode;
911
+ /** CSS width for the column, applied through the colgroup. */
912
+ width?: string;
913
+ cell: (row: Row) => ReactNode;
914
+ }
915
+ interface DataTableSelectionLabels {
916
+ /** Names one row's box — "Select Ada Lovelace". The row's own label is
917
+ handed in, so the sentence is the app's to build. */
918
+ row: (label: string) => string;
919
+ /** Names the header box, which takes or lets go of every row at once. */
920
+ all: string;
921
+ /** "3 selected" — a function, because only the app knows how its language
922
+ counts. */
923
+ count: (selected: number) => string;
924
+ }
925
+ type DataTableSelection = {
926
+ /** Row keys currently taken. Held by the caller: the table draws it and
927
+ says what changed, and never keeps a second copy. */
928
+ selected: string[];
929
+ onSelectedChange: (keys: string[]) => void;
930
+ selectionLabels: DataTableSelectionLabels;
931
+ /** What can be done to the taken rows, shown with the count of them. */
932
+ bulkActions?: ReactNode;
933
+ } | {
934
+ selected?: undefined;
935
+ onSelectedChange?: undefined;
936
+ selectionLabels?: undefined;
937
+ bulkActions?: undefined;
938
+ };
939
+ type DataTableProps<Row> = Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
940
+ /** Names the table. Required: a table of rows with no name is a grid of
941
+ values with nothing saying what they are a list of. */
942
+ label: string;
943
+ columns: DataColumn<Row>[];
944
+ rows: Row[];
945
+ rowKey: (row: Row) => string;
946
+ /** Names one row where its first cell will not do — a row led by an avatar,
947
+ or by a title that repeats down the table. */
948
+ rowLabel?: (row: Row) => string;
949
+ /** What can be done to one row, in a column of its own at the end. */
950
+ rowActions?: (row: Row) => ReactNode;
951
+ /** Names that column. */
952
+ actionsHeader?: ReactNode;
953
+ /** A row the table still lists but no longer counts — suspended, hidden. */
954
+ rowMuted?: (row: Row) => boolean;
955
+ /** Shown in place of the rows when there are none. */
956
+ empty?: ReactNode;
957
+ ref?: Ref<HTMLDivElement>;
958
+ } & DataTableSelection;
959
+ /**
960
+ * Rows and columns, folded into cards on a narrow screen.
961
+ *
962
+ * Below the wide breakpoint a table cannot be read across, so each row becomes
963
+ * a card and every cell carries its column's header beside it. The markup is
964
+ * one table either way: what changes is the layout, never the semantics.
965
+ *
966
+ * ```tsx
967
+ * <DataTable
968
+ * label={t("admin.members.table")}
969
+ * columns={[
970
+ * { key: "name", header: t("admin.name"), cell: (m) => m.name },
971
+ * { key: "role", header: t("admin.role"), cell: (m) => <Tag>{m.role}</Tag> },
972
+ * ]}
973
+ * rows={members}
974
+ * rowKey={(m) => m.id}
975
+ * empty={t("admin.members.none")}
976
+ * />
977
+ * ```
978
+ */
979
+ declare function DataTable<Row>({ label, columns, rows, rowKey, rowLabel, rowActions, actionsHeader, rowMuted, empty, ref, selected, onSelectedChange, selectionLabels, bulkActions, className, ...rest }: DataTableProps<Row>): ReactElement;
980
+
897
981
  interface EmptyStateProps {
898
982
  title: string;
899
983
  description?: string;
@@ -1365,6 +1449,66 @@ interface TabBarActionProps {
1365
1449
  it is a peer child, and the bar's flex layout leaves it its own width. */
1366
1450
  declare function TabBarAction({ label, icon, onClick }: TabBarActionProps): react.JSX.Element;
1367
1451
 
1452
+ interface SideNavProps extends Omit<HTMLAttributes<HTMLElement>, "children"> {
1453
+ /** Accessible name of the navigation landmark. There is more than one
1454
+ navigation on a page wide enough to show this one. */
1455
+ label: string;
1456
+ children: ReactNode;
1457
+ ref?: Ref<HTMLElement>;
1458
+ }
1459
+ /**
1460
+ * The standing column of destinations, from the width where it costs nothing.
1461
+ * TabBar is the same list on a phone; both are navigation landmarks whose
1462
+ * items stay in the natural tab order — roving focus is for composite
1463
+ * widgets, not for navigation.
1464
+ *
1465
+ * ```tsx
1466
+ * <SideNav label="Primary">
1467
+ * <SideNavItem label="Home" icon={<Icon name="home" />} href="/" active />
1468
+ * <Divider />
1469
+ * <SideNavGroup label="More">
1470
+ * <SideNavItem label="Settings" icon={<Icon name="settings" />} href="/settings" />
1471
+ * </SideNavGroup>
1472
+ * <Button fullWidth iconLeft={<Icon name="plus" />} onClick={compose}>New post</Button>
1473
+ * </SideNav>
1474
+ * ```
1475
+ *
1476
+ * The column's own placement is the host's — a sticky offset under a header,
1477
+ * a fixed rail, a plain block — so it takes a className and sets none of it.
1478
+ */
1479
+ declare function SideNav({ label, className, children, ref, ...rest }: SideNavProps): ReactElement;
1480
+ interface SideNavGroupProps extends HTMLAttributes<HTMLDivElement> {
1481
+ /** Heading over the run, which also names it to a screen reader. Without
1482
+ one the rows are still a run on screen and nothing to be told about, so
1483
+ the group takes no role. */
1484
+ label?: ReactNode;
1485
+ children: ReactNode;
1486
+ ref?: Ref<HTMLDivElement>;
1487
+ }
1488
+ /** A run of destinations under one heading, or none. */
1489
+ declare function SideNavGroup({ label, className, children, ref, ...rest }: SideNavGroupProps): ReactElement;
1490
+ interface SideNavItemProps {
1491
+ label: ReactNode;
1492
+ icon?: ReactNode;
1493
+ href?: string | undefined;
1494
+ onClick?: MouseEventHandler | undefined;
1495
+ /** The destination the reader is on. Lands as aria-current="page". */
1496
+ active?: boolean | undefined;
1497
+ /** How many are waiting, at the far end of the row. Nothing at zero: an
1498
+ absence needs no mark. */
1499
+ count?: number | undefined;
1500
+ /** What the count counts, in words — the badge is read as this, and a bare
1501
+ number is read as nothing. */
1502
+ countLabel?: string | undefined;
1503
+ /** The last number worth printing; above it the badge says `99+`, because
1504
+ the column's width is fixed and a fourth digit takes it from the word. */
1505
+ max?: number | undefined;
1506
+ /** Element override for the link, e.g. a router's Link. */
1507
+ as?: ElementType;
1508
+ }
1509
+ /** One destination. A link where it has one, a button where it does not. */
1510
+ declare function SideNavItem({ label, icon, href, onClick, active, count, countLabel, max, as, }: SideNavItemProps): ReactElement;
1511
+
1368
1512
  interface MediaPlaceholderProps extends Omit<HTMLAttributes<HTMLDivElement>, "children"> {
1369
1513
  /** CSS aspect-ratio for the box, e.g. "4 / 5". Default 16 / 9. */
1370
1514
  aspect?: string;
@@ -1728,4 +1872,4 @@ interface RovingGroupOptions {
1728
1872
  */
1729
1873
  declare function useRovingGroup(ref: RefObject<HTMLElement | null>, { selector, orientation }: RovingGroupOptions): (event: KeyboardEvent<HTMLElement>) => void;
1730
1874
 
1731
- export { AppBar, type AppBarProps, Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, type AvatarSize, Badge, type BadgeProps, type BadgeTone, Breadcrumb, type BreadcrumbProps, Button, type ButtonProps, type ButtonShape, type ButtonSize, type ButtonVariant, type CSSVars, Card, CardBody, CardFooter, CardHeader, type CardProps, type CardSectionProps, type CardVariant, type CarouselPager, type CarouselSlide, Checkbox, type CheckboxProps, Chip, ChipBar, type ChipBarGap, type ChipBarProps, ChipGroup, type ChipGroupGap, type ChipGroupProps, type ChipProps, type ChipVariant, ConfirmDialog, type ConfirmDialogProps, type ConfirmDialogTone, Container, type ContainerProps, type ContainerWidth, CountButton, type CountButtonProps, type CountButtonTone, type Crumb, DateTimePicker, type DateTimePickerLabels, type DateTimePickerProps, Divider, type DividerProps, EmptyState, type EmptyStateProps, Field, type FieldContextValue, type FieldProps, Heading, type HeadingLevel, type HeadingProps, type HeadingTone, Icon, type IconProps, IconProvider, type IconProviderProps, type IconRender, type IconRenderProps, type IconSize, ImageCarousel, type ImageCarouselLabels, type ImageCarouselProps, Inline, type InlineAlign, type InlineGap, type InlineJustify, type InlineProps, Input, type InputProps, type InputSize, Lightbox, type LightboxLabels, type LightboxProps, Link, type LinkProps, type LinkVariant, ListGroup, type ListGroupProps, ListItem, type ListItemProps, MediaPlaceholder, type MediaPlaceholderProps, Modal, ModalBody, ModalFooter, ModalHeader, type ModalProps, type OverlayHistory, OverlayHistoryContext, PasswordInput, type PasswordInputProps, type Presence, ProgressBar, type ProgressBarProps, Radio, type RadioProps, type RovingGroupOptions, Screen, ScreenContent, type ScreenContentProps, SearchField, type SearchFieldProps, type SegmentOption, SegmentedControl, type SegmentedControlProps, type SegmentedControlSize, Select, type SelectProps, type SelectSize, Sheet, SheetBody, SheetFooter, SheetHeader, type SheetProps, Skeleton, type SkeletonProps, type SkeletonVariant, Spinner, type SpinnerProps, Stack, type StackAlign, type StackGap, type StackProps, Switch, type SwitchProps, Tab, TabBar, TabBarAction, type TabBarActionProps, TabBarItem, type TabBarItemProps, type TabBarProps, TabList, type TabListProps, TabPanel, type TabPanelProps, type TabProps, Tabs, type TabsProps, Tag, type TagProps, type TagTone, Text, type TextProps, type TextTone, type TextVariant, Textarea, type TextareaProps, type ToastAction, type ToastOptions, ToastProvider, type ToastProviderProps, type ToastTone, UploadProgress, type UploadProgressLabels, type UploadProgressProps, type UploadStatus, type UseOverlayOptions, type VideoCaptions, type VideoChapter, VideoPlayer, type VideoPlayerLabels, type VideoPlayerProps, VisuallyHidden, type VisuallyHiddenProps, cx, useFieldContext, useOverlay, usePresence, useRovingGroup, useToast };
1875
+ export { AppBar, type AppBarProps, Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, type AvatarSize, Badge, type BadgeProps, type BadgeTone, Breadcrumb, type BreadcrumbProps, Button, type ButtonProps, type ButtonShape, type ButtonSize, type ButtonVariant, type CSSVars, Card, CardBody, CardFooter, CardHeader, type CardProps, type CardSectionProps, type CardVariant, type CarouselPager, type CarouselSlide, Checkbox, type CheckboxProps, Chip, ChipBar, type ChipBarGap, type ChipBarProps, ChipGroup, type ChipGroupGap, type ChipGroupProps, type ChipProps, type ChipVariant, ConfirmDialog, type ConfirmDialogProps, type ConfirmDialogTone, Container, type ContainerProps, type ContainerWidth, CountButton, type CountButtonProps, type CountButtonTone, type Crumb, type DataColumn, DataTable, type DataTableProps, type DataTableSelectionLabels, DateTimePicker, type DateTimePickerLabels, type DateTimePickerProps, Divider, type DividerProps, EmptyState, type EmptyStateProps, Field, type FieldContextValue, type FieldProps, Heading, type HeadingLevel, type HeadingProps, type HeadingTone, Icon, type IconProps, IconProvider, type IconProviderProps, type IconRender, type IconRenderProps, type IconSize, ImageCarousel, type ImageCarouselLabels, type ImageCarouselProps, Inline, type InlineAlign, type InlineGap, type InlineJustify, type InlineProps, Input, type InputProps, type InputSize, Lightbox, type LightboxLabels, type LightboxProps, Link, type LinkProps, type LinkVariant, ListGroup, type ListGroupProps, ListItem, type ListItemProps, MediaPlaceholder, type MediaPlaceholderProps, Modal, ModalBody, ModalFooter, ModalHeader, type ModalProps, type OverlayHistory, OverlayHistoryContext, PasswordInput, type PasswordInputProps, type Presence, ProgressBar, type ProgressBarProps, Radio, type RadioProps, type RovingGroupOptions, Screen, ScreenContent, type ScreenContentProps, SearchField, type SearchFieldProps, type SegmentOption, SegmentedControl, type SegmentedControlProps, type SegmentedControlSize, Select, type SelectProps, type SelectSize, Sheet, SheetBody, SheetFooter, SheetHeader, type SheetProps, SideNav, SideNavGroup, type SideNavGroupProps, SideNavItem, type SideNavItemProps, type SideNavProps, Skeleton, type SkeletonProps, type SkeletonVariant, Spinner, type SpinnerProps, Stack, type StackAlign, type StackGap, type StackProps, Switch, type SwitchProps, Tab, TabBar, TabBarAction, type TabBarActionProps, TabBarItem, type TabBarItemProps, type TabBarProps, TabList, type TabListProps, TabPanel, type TabPanelProps, type TabProps, Tabs, type TabsProps, Tag, type TagProps, type TagTone, Text, type TextProps, type TextTone, type TextVariant, Textarea, type TextareaProps, type ToastAction, type ToastOptions, ToastProvider, type ToastProviderProps, type ToastTone, UploadProgress, type UploadProgressLabels, type UploadProgressProps, type UploadStatus, type UseOverlayOptions, type VideoCaptions, type VideoChapter, VideoPlayer, type VideoPlayerLabels, type VideoPlayerProps, VisuallyHidden, type VisuallyHiddenProps, cx, useFieldContext, useOverlay, usePresence, useRovingGroup, useToast };
package/dist/index.js CHANGED
@@ -1185,12 +1185,40 @@ function Textarea({ rows = 3, showCount = false, className, ...rest }) {
1185
1185
  ] });
1186
1186
  }
1187
1187
 
1188
+ // src/internal/forkRef.ts
1189
+ function forkRef(own, given) {
1190
+ return (node) => {
1191
+ own.current = node;
1192
+ if (typeof given === "function") given(node);
1193
+ else if (given != null) given.current = node;
1194
+ };
1195
+ }
1196
+
1188
1197
  // mds-cssmod:/home/runner/work/mond-design-system/mond-design-system/packages/react/src/components/Checkbox/Checkbox.module.css?mds-scoped
1189
- var Checkbox_module_default = { "root": "mds-Checkbox__root", "box": "mds-Checkbox__box mds-hit-area__hitArea", "label": "mds-Checkbox__label" };
1190
- function Checkbox({ label, className, ...rest }) {
1191
- return /* @__PURE__ */ jsxs("label", { className: cx(Checkbox_module_default.root, className), children: [
1192
- /* @__PURE__ */ jsx("input", { type: "checkbox", className: Checkbox_module_default.box, ...rest }),
1193
- /* @__PURE__ */ jsx("span", { className: Checkbox_module_default.label, children: label })
1198
+ var Checkbox_module_default = { "root": "mds-Checkbox__root", "box": "mds-Checkbox__box mds-hit-area__hitArea", "bare": "mds-Checkbox__bare", "label": "mds-Checkbox__label" };
1199
+ function Checkbox({
1200
+ label,
1201
+ labelHidden = false,
1202
+ indeterminate = false,
1203
+ className,
1204
+ ref,
1205
+ ...rest
1206
+ }) {
1207
+ const own = useRef(null);
1208
+ useEffect(() => {
1209
+ if (own.current !== null) own.current.indeterminate = indeterminate;
1210
+ }, [indeterminate]);
1211
+ return /* @__PURE__ */ jsxs("label", { className: cx(Checkbox_module_default.root, labelHidden && Checkbox_module_default.bare, className), children: [
1212
+ /* @__PURE__ */ jsx(
1213
+ "input",
1214
+ {
1215
+ type: "checkbox",
1216
+ className: Checkbox_module_default.box,
1217
+ ref: forkRef(own, ref),
1218
+ ...rest
1219
+ }
1220
+ ),
1221
+ labelHidden ? /* @__PURE__ */ jsx(VisuallyHidden, { className: Checkbox_module_default.label, children: label }) : /* @__PURE__ */ jsx("span", { className: Checkbox_module_default.label, children: label })
1194
1222
  ] });
1195
1223
  }
1196
1224
 
@@ -1397,6 +1425,97 @@ function ListItem({
1397
1425
  );
1398
1426
  }
1399
1427
 
1428
+ // mds-cssmod:/home/runner/work/mond-design-system/mond-design-system/packages/react/src/components/DataTable/DataTable.module.css?mds-scoped
1429
+ var DataTable_module_default = { "root": "mds-DataTable__root", "table": "mds-DataTable__table", "body": "mds-DataTable__body", "row": "mds-DataTable__row", "cell": "mds-DataTable__cell", "select": "mds-DataTable__select", "actions": "mds-DataTable__actions", "key": "mds-DataTable__key", "lead": "mds-DataTable__lead", "selected": "mds-DataTable__selected", "muted": "mds-DataTable__muted", "empty": "mds-DataTable__empty", "bulk": "mds-DataTable__bulk", "bulkActions": "mds-DataTable__bulkActions", "head": "mds-DataTable__head" };
1430
+ function DataTable({
1431
+ label,
1432
+ columns,
1433
+ rows,
1434
+ rowKey,
1435
+ rowLabel,
1436
+ rowActions,
1437
+ actionsHeader,
1438
+ rowMuted,
1439
+ empty,
1440
+ ref,
1441
+ selected,
1442
+ onSelectedChange,
1443
+ selectionLabels,
1444
+ bulkActions,
1445
+ className,
1446
+ ...rest
1447
+ }) {
1448
+ const selectable = selected !== void 0;
1449
+ const keys = rows.map(rowKey);
1450
+ const all = selectable && keys.length > 0 && keys.every((key) => selected.includes(key));
1451
+ const some = selectable && !all && keys.some((key) => selected.includes(key));
1452
+ const span = columns.length + (selectable ? 1 : 0) + (rowActions ? 1 : 0);
1453
+ const toggle = (key, taken) => {
1454
+ if (selected === void 0) return;
1455
+ const next = taken ? [...selected, key] : selected.filter((each) => each !== key);
1456
+ onSelectedChange(keys.filter((each) => next.includes(each)));
1457
+ };
1458
+ const nameOf = (row) => {
1459
+ if (rowLabel !== void 0) return rowLabel(row);
1460
+ const first = columns[0]?.cell(row);
1461
+ return typeof first === "string" ? first : rowKey(row);
1462
+ };
1463
+ return /* @__PURE__ */ jsxs("div", { className: cx(DataTable_module_default.root, className), ref, ...rest, children: [
1464
+ /* @__PURE__ */ jsxs("table", { className: DataTable_module_default.table, "aria-label": label, children: [
1465
+ /* @__PURE__ */ jsxs("colgroup", { children: [
1466
+ selectable && /* @__PURE__ */ jsx("col", {}),
1467
+ columns.map((column) => /* @__PURE__ */ jsx("col", { style: column.width !== void 0 ? { width: column.width } : void 0 }, column.key)),
1468
+ rowActions && /* @__PURE__ */ jsx("col", {})
1469
+ ] }),
1470
+ /* @__PURE__ */ jsx(VisuallyHidden, { as: "thead", className: DataTable_module_default.head, children: /* @__PURE__ */ jsxs("tr", { className: DataTable_module_default.row, children: [
1471
+ selectable && /* @__PURE__ */ jsx("th", { scope: "col", className: DataTable_module_default.select, children: /* @__PURE__ */ jsx(
1472
+ Checkbox,
1473
+ {
1474
+ label: selectionLabels.all,
1475
+ labelHidden: true,
1476
+ checked: all,
1477
+ indeterminate: some,
1478
+ onChange: (event) => onSelectedChange(event.target.checked ? keys : [])
1479
+ }
1480
+ ) }),
1481
+ columns.map((column) => /* @__PURE__ */ jsx("th", { scope: "col", className: DataTable_module_default.cell, children: column.header }, column.key)),
1482
+ rowActions && /* @__PURE__ */ jsx("th", { scope: "col", className: DataTable_module_default.actions, children: actionsHeader })
1483
+ ] }) }),
1484
+ /* @__PURE__ */ jsx("tbody", { className: DataTable_module_default.body, children: rows.length > 0 ? rows.map((row) => {
1485
+ const key = rowKey(row);
1486
+ const taken = selected?.includes(key) ?? false;
1487
+ return /* @__PURE__ */ jsxs(
1488
+ "tr",
1489
+ {
1490
+ className: cx(DataTable_module_default.row, taken && DataTable_module_default.selected, rowMuted?.(row) === true && DataTable_module_default.muted),
1491
+ children: [
1492
+ selectable && /* @__PURE__ */ jsx("td", { className: DataTable_module_default.select, children: /* @__PURE__ */ jsx(
1493
+ Checkbox,
1494
+ {
1495
+ label: selectionLabels.row(nameOf(row)),
1496
+ labelHidden: true,
1497
+ checked: taken,
1498
+ onChange: (event) => toggle(key, event.target.checked)
1499
+ }
1500
+ ) }),
1501
+ columns.map((column, index) => /* @__PURE__ */ jsxs("td", { className: cx(DataTable_module_default.cell, index === 0 && DataTable_module_default.lead), children: [
1502
+ index > 0 && /* @__PURE__ */ jsx("span", { className: DataTable_module_default.key, "aria-hidden": "true", children: column.header }),
1503
+ column.cell(row)
1504
+ ] }, column.key)),
1505
+ rowActions && /* @__PURE__ */ jsx("td", { className: DataTable_module_default.actions, children: rowActions(row) })
1506
+ ]
1507
+ },
1508
+ key
1509
+ );
1510
+ }) : empty !== void 0 && /* @__PURE__ */ jsx("tr", { className: DataTable_module_default.row, children: /* @__PURE__ */ jsx("td", { className: DataTable_module_default.empty, colSpan: span, children: /* @__PURE__ */ jsx(Text, { variant: "note", children: empty }) }) }) })
1511
+ ] }),
1512
+ selectable && selected.length > 0 && bulkActions !== void 0 && /* @__PURE__ */ jsxs("div", { className: DataTable_module_default.bulk, role: "status", children: [
1513
+ /* @__PURE__ */ jsx(Text, { variant: "meta", children: selectionLabels.count(selected.length) }),
1514
+ /* @__PURE__ */ jsx("div", { className: DataTable_module_default.bulkActions, children: bulkActions })
1515
+ ] })
1516
+ ] });
1517
+ }
1518
+
1400
1519
  // mds-cssmod:/home/runner/work/mond-design-system/mond-design-system/packages/react/src/components/EmptyState/EmptyState.module.css?mds-scoped
1401
1520
  var EmptyState_module_default = { "root": "mds-EmptyState__root", "icon": "mds-EmptyState__icon", "action": "mds-EmptyState__action" };
1402
1521
  function EmptyState({ title, description, icon, action, className }) {
@@ -1823,6 +1942,59 @@ function TabBarAction({ label, icon, onClick }) {
1823
1942
  return /* @__PURE__ */ jsx("button", { type: "button", "aria-label": label, className: TabBar_module_default.action, onClick, children: /* @__PURE__ */ jsx("span", { className: TabBar_module_default.icon, "aria-hidden": "true", children: icon }) });
1824
1943
  }
1825
1944
 
1945
+ // mds-cssmod:/home/runner/work/mond-design-system/mond-design-system/packages/react/src/components/SideNav/SideNav.module.css?mds-scoped
1946
+ var SideNav_module_default = { "nav": "mds-SideNav__nav", "group": "mds-SideNav__group", "heading": "mds-SideNav__heading", "item": "mds-SideNav__item", "active": "mds-SideNav__active", "icon": "mds-SideNav__icon", "label": "mds-SideNav__label", "count": "mds-SideNav__count" };
1947
+ function SideNav({ label, className, children, ref, ...rest }) {
1948
+ return /* @__PURE__ */ jsx("nav", { ref, "aria-label": label, className: cx(SideNav_module_default.nav, className), ...rest, children });
1949
+ }
1950
+ function SideNavGroup({
1951
+ label,
1952
+ className,
1953
+ children,
1954
+ ref,
1955
+ ...rest
1956
+ }) {
1957
+ const headingId = useId();
1958
+ return /* @__PURE__ */ jsxs(
1959
+ "div",
1960
+ {
1961
+ ref,
1962
+ className: cx(SideNav_module_default.group, className),
1963
+ role: label != null ? "group" : void 0,
1964
+ "aria-labelledby": label != null ? headingId : void 0,
1965
+ ...rest,
1966
+ children: [
1967
+ label != null && /* @__PURE__ */ jsx("span", { className: SideNav_module_default.heading, id: headingId, children: label }),
1968
+ children
1969
+ ]
1970
+ }
1971
+ );
1972
+ }
1973
+ function SideNavItem({
1974
+ label,
1975
+ icon,
1976
+ href,
1977
+ onClick,
1978
+ active = false,
1979
+ count,
1980
+ countLabel,
1981
+ max = 99,
1982
+ as
1983
+ }) {
1984
+ const className = cx(SideNav_module_default.item, active && SideNav_module_default.active);
1985
+ const current = active ? "page" : void 0;
1986
+ const content = /* @__PURE__ */ jsxs(Fragment, { children: [
1987
+ icon != null && /* @__PURE__ */ jsx("span", { className: SideNav_module_default.icon, "aria-hidden": "true", children: icon }),
1988
+ /* @__PURE__ */ jsx("span", { className: SideNav_module_default.label, children: label }),
1989
+ count !== void 0 && count > 0 && /* @__PURE__ */ jsx(Badge, { tone: "accent", role: "status", "aria-label": countLabel, className: SideNav_module_default.count, children: count > max ? `${max}+` : count })
1990
+ ] });
1991
+ if (href !== void 0) {
1992
+ const Element = as ?? "a";
1993
+ return /* @__PURE__ */ jsx(Element, { href, className, "aria-current": current, onClick, children: content });
1994
+ }
1995
+ return /* @__PURE__ */ jsx("button", { type: "button", className, "aria-current": current, onClick, children: content });
1996
+ }
1997
+
1826
1998
  // mds-cssmod:/home/runner/work/mond-design-system/mond-design-system/packages/react/src/components/MediaPlaceholder/MediaPlaceholder.module.css?mds-scoped
1827
1999
  var MediaPlaceholder_module_default = { "media": "mds-MediaPlaceholder__media", "fill": "mds-MediaPlaceholder__fill", "image": "mds-MediaPlaceholder__image", "caption": "mds-MediaPlaceholder__caption", "cover": "mds-MediaPlaceholder__cover", "blurred": "mds-MediaPlaceholder__blurred" };
1828
2000
  function MediaPlaceholder({
@@ -2341,11 +2513,7 @@ function VideoPlayer({
2341
2513
  {
2342
2514
  className: cx(VideoPlayer_module_default.player, covered && VideoPlayer_module_default.covered, className),
2343
2515
  "aria-label": labels.region,
2344
- ref: (node) => {
2345
- root.current = node;
2346
- if (typeof ref === "function") ref(node);
2347
- else if (ref) ref.current = node;
2348
- },
2516
+ ref: forkRef(root, ref),
2349
2517
  ...rest,
2350
2518
  children: [
2351
2519
  /* @__PURE__ */ jsxs("div", { className: VideoPlayer_module_default.frame, children: [
@@ -2493,6 +2661,6 @@ function useRovingGroup(ref, { selector, orientation = "horizontal" }) {
2493
2661
  );
2494
2662
  }
2495
2663
 
2496
- export { AppBar, Avatar, AvatarGroup, Badge, Breadcrumb, Button, Card, CardBody, CardFooter, CardHeader, Checkbox, Chip, ChipBar, ChipGroup, ConfirmDialog, Container, CountButton, DateTimePicker, Divider, EmptyState, Field, Heading, Icon, IconProvider, ImageCarousel, Inline, Input, Lightbox, Link, ListGroup, ListItem, MediaPlaceholder, Modal, ModalBody, ModalFooter, ModalHeader, OverlayHistoryContext, PasswordInput, ProgressBar, Radio, Screen, ScreenContent, SearchField, SegmentedControl, Select, Sheet, SheetBody, SheetFooter, SheetHeader, Skeleton, Spinner, Stack, Switch, Tab, TabBar, TabBarAction, TabBarItem, TabList, TabPanel, Tabs, Tag, Text, Textarea, ToastProvider, UploadProgress, VideoPlayer, VisuallyHidden, cx, useFieldContext, useOverlay, usePresence, useRovingGroup, useToast };
2664
+ export { AppBar, Avatar, AvatarGroup, Badge, Breadcrumb, Button, Card, CardBody, CardFooter, CardHeader, Checkbox, Chip, ChipBar, ChipGroup, ConfirmDialog, Container, CountButton, DataTable, DateTimePicker, Divider, EmptyState, Field, Heading, Icon, IconProvider, ImageCarousel, Inline, Input, Lightbox, Link, ListGroup, ListItem, MediaPlaceholder, Modal, ModalBody, ModalFooter, ModalHeader, OverlayHistoryContext, PasswordInput, ProgressBar, Radio, Screen, ScreenContent, SearchField, SegmentedControl, Select, Sheet, SheetBody, SheetFooter, SheetHeader, SideNav, SideNavGroup, SideNavItem, Skeleton, Spinner, Stack, Switch, Tab, TabBar, TabBarAction, TabBarItem, TabList, TabPanel, Tabs, Tag, Text, Textarea, ToastProvider, UploadProgress, VideoPlayer, VisuallyHidden, cx, useFieldContext, useOverlay, usePresence, useRovingGroup, useToast };
2497
2665
  //# sourceMappingURL=index.js.map
2498
2666
  //# sourceMappingURL=index.js.map