@mond-design-system/react 4.6.1 → 4.7.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;
@@ -1728,4 +1812,4 @@ interface RovingGroupOptions {
1728
1812
  */
1729
1813
  declare function useRovingGroup(ref: RefObject<HTMLElement | null>, { selector, orientation }: RovingGroupOptions): (event: KeyboardEvent<HTMLElement>) => void;
1730
1814
 
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 };
1815
+ 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, 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;
@@ -1728,4 +1812,4 @@ interface RovingGroupOptions {
1728
1812
  */
1729
1813
  declare function useRovingGroup(ref: RefObject<HTMLElement | null>, { selector, orientation }: RovingGroupOptions): (event: KeyboardEvent<HTMLElement>) => void;
1730
1814
 
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 };
1815
+ 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, 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 }) {
@@ -2341,11 +2460,7 @@ function VideoPlayer({
2341
2460
  {
2342
2461
  className: cx(VideoPlayer_module_default.player, covered && VideoPlayer_module_default.covered, className),
2343
2462
  "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
- },
2463
+ ref: forkRef(root, ref),
2349
2464
  ...rest,
2350
2465
  children: [
2351
2466
  /* @__PURE__ */ jsxs("div", { className: VideoPlayer_module_default.frame, children: [
@@ -2493,6 +2608,6 @@ function useRovingGroup(ref, { selector, orientation = "horizontal" }) {
2493
2608
  );
2494
2609
  }
2495
2610
 
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 };
2611
+ 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, 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
2612
  //# sourceMappingURL=index.js.map
2498
2613
  //# sourceMappingURL=index.js.map