eidos-ui 1.2.0 → 2.1.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/Avatar.types-BY-C09Ke.d.cts +23 -0
- package/dist/Avatar.types-BY-C09Ke.d.ts +23 -0
- package/dist/{Header.types-BZi80bWz.d.cts → Header.types-B3QtuiL-.d.cts} +7 -3
- package/dist/{Header.types-DJt-q01P.d.ts → Header.types-C6w0FBY8.d.ts} +7 -3
- package/dist/Table.types-CPj-udMc.d.cts +278 -0
- package/dist/Table.types-CZZ7QWAI.d.ts +278 -0
- package/dist/Toolbar.types-DSk8z2iy.d.cts +38 -0
- package/dist/Toolbar.types-RN0klQzu.d.ts +38 -0
- package/dist/alert/index.cjs +4 -4
- package/dist/alert/index.d.cts +2 -1
- package/dist/alert/index.d.ts +2 -1
- package/dist/alert/index.js +3 -3
- package/dist/avatar/index.d.cts +3 -21
- package/dist/avatar/index.d.ts +3 -21
- package/dist/button/index.cjs +3 -3
- package/dist/button/index.js +2 -2
- package/dist/chip/index.cjs +3 -3
- package/dist/chip/index.js +2 -2
- package/dist/{chunk-KIXFSXIN.cjs → chunk-3E7TKBQI.cjs} +5 -3
- package/dist/chunk-3E7TKBQI.cjs.map +1 -0
- package/dist/{chunk-ZBKJ3EMK.cjs → chunk-442U3W6R.cjs} +3 -3
- package/dist/{chunk-ZBKJ3EMK.cjs.map → chunk-442U3W6R.cjs.map} +1 -1
- package/dist/{chunk-YQLCPKGV.js → chunk-5HUZYY54.js} +6 -4
- package/dist/chunk-5HUZYY54.js.map +1 -0
- package/dist/{chunk-G5IGADJI.cjs → chunk-5VM2256W.cjs} +7 -11
- package/dist/chunk-5VM2256W.cjs.map +1 -0
- package/dist/{chunk-Z4ZY7L7W.js → chunk-5ZL6PYU3.js} +3 -3
- package/dist/{chunk-A3NE2C7C.js → chunk-67RFMV6K.js} +2 -2
- package/dist/{chunk-2U7UJOOB.cjs → chunk-6HUHH6Y4.cjs} +17 -15
- package/dist/chunk-6HUHH6Y4.cjs.map +1 -0
- package/dist/{chunk-5WROPW7Z.js → chunk-A7WQINIG.js} +3 -3
- package/dist/{chunk-DKZTDYH5.cjs → chunk-AAA6TR5I.cjs} +3 -3
- package/dist/{chunk-DKZTDYH5.cjs.map → chunk-AAA6TR5I.cjs.map} +1 -1
- package/dist/{chunk-A7Z2QAFZ.cjs → chunk-APK5OQRV.cjs} +5 -5
- package/dist/{chunk-A7Z2QAFZ.cjs.map → chunk-APK5OQRV.cjs.map} +1 -1
- package/dist/{chunk-ISABZ2VX.cjs → chunk-AXBYJ2OY.cjs} +9 -9
- package/dist/{chunk-ISABZ2VX.cjs.map → chunk-AXBYJ2OY.cjs.map} +1 -1
- package/dist/{chunk-6RGJAQCU.cjs → chunk-B5G5XVFJ.cjs} +5 -5
- package/dist/{chunk-6RGJAQCU.cjs.map → chunk-B5G5XVFJ.cjs.map} +1 -1
- package/dist/{chunk-MW2S7PZ7.cjs → chunk-D5IY2HUV.cjs} +5 -5
- package/dist/{chunk-MW2S7PZ7.cjs.map → chunk-D5IY2HUV.cjs.map} +1 -1
- package/dist/{chunk-FMPXSF3H.cjs → chunk-DAXZRNNO.cjs} +4 -4
- package/dist/{chunk-FMPXSF3H.cjs.map → chunk-DAXZRNNO.cjs.map} +1 -1
- package/dist/{chunk-6DBCT5MK.js → chunk-EXITZVB2.js} +24 -9
- package/dist/chunk-EXITZVB2.js.map +1 -0
- package/dist/{chunk-AYMD4D4M.cjs → chunk-EZME5CLK.cjs} +3 -3
- package/dist/{chunk-AYMD4D4M.cjs.map → chunk-EZME5CLK.cjs.map} +1 -1
- package/dist/{chunk-IV4LM3MB.js → chunk-F26VIKNF.js} +9 -11
- package/dist/chunk-F26VIKNF.js.map +1 -0
- package/dist/{chunk-WPTMMOA6.cjs → chunk-G77YR73R.cjs} +10 -13
- package/dist/chunk-G77YR73R.cjs.map +1 -0
- package/dist/chunk-GEHL4LKK.cjs +32 -0
- package/dist/chunk-GEHL4LKK.cjs.map +1 -0
- package/dist/chunk-GGSII6Y2.cjs +921 -0
- package/dist/chunk-GGSII6Y2.cjs.map +1 -0
- package/dist/{chunk-3VRMTWUS.js → chunk-GHQ6SQPI.js} +7 -10
- package/dist/chunk-GHQ6SQPI.js.map +1 -0
- package/dist/{chunk-56B6RLOE.js → chunk-GI6VJYOS.js} +4 -4
- package/dist/{chunk-56B6RLOE.js.map → chunk-GI6VJYOS.js.map} +1 -1
- package/dist/{chunk-UGMONQGH.cjs → chunk-GR2PMCVN.cjs} +10 -12
- package/dist/chunk-GR2PMCVN.cjs.map +1 -0
- package/dist/{chunk-7AHZTHXR.cjs → chunk-GT22EGJP.cjs} +5 -5
- package/dist/{chunk-7AHZTHXR.cjs.map → chunk-GT22EGJP.cjs.map} +1 -1
- package/dist/{chunk-ALGX5X4N.js → chunk-IFVT5UCY.js} +3 -3
- package/dist/{chunk-5CLC3FJO.js → chunk-KBG77JHC.js} +13 -2
- package/dist/chunk-KBG77JHC.js.map +1 -0
- package/dist/{chunk-HLNKIAE5.cjs → chunk-KJZUYC4X.cjs} +5 -5
- package/dist/{chunk-HLNKIAE5.cjs.map → chunk-KJZUYC4X.cjs.map} +1 -1
- package/dist/{chunk-4BQM5F76.cjs → chunk-LFWPQYWX.cjs} +3 -3
- package/dist/{chunk-4BQM5F76.cjs.map → chunk-LFWPQYWX.cjs.map} +1 -1
- package/dist/{chunk-TKLWQWMT.cjs → chunk-LIFUHQH5.cjs} +35 -20
- package/dist/chunk-LIFUHQH5.cjs.map +1 -0
- package/dist/{chunk-PJC7NZUV.cjs → chunk-LUL6RZ4M.cjs} +3 -3
- package/dist/{chunk-PJC7NZUV.cjs.map → chunk-LUL6RZ4M.cjs.map} +1 -1
- package/dist/{chunk-4UJ7LG4W.cjs → chunk-N2IGZIEX.cjs} +3 -3
- package/dist/{chunk-4UJ7LG4W.cjs.map → chunk-N2IGZIEX.cjs.map} +1 -1
- package/dist/{chunk-3LHQUOGP.js → chunk-NGVOXM7P.js} +3 -3
- package/dist/{chunk-WTXASLBB.js → chunk-O5WEKLNF.js} +2 -2
- package/dist/{chunk-BOB5JJ7F.js → chunk-P7IQY5YH.js} +2 -2
- package/dist/{chunk-VZYLJSV5.js → chunk-R4PU2TBM.js} +2 -2
- package/dist/{chunk-P2GCAVUZ.js → chunk-RAZRQ57B.js} +2 -2
- package/dist/{chunk-K7IFNKMN.js → chunk-REVK7IGN.js} +2 -2
- package/dist/{chunk-6U2H26A4.cjs → chunk-RHOT7AEI.cjs} +3 -3
- package/dist/{chunk-6U2H26A4.cjs.map → chunk-RHOT7AEI.cjs.map} +1 -1
- package/dist/{chunk-P2ZHWFK4.js → chunk-RKA2OJRT.js} +228 -119
- package/dist/chunk-RKA2OJRT.js.map +1 -0
- package/dist/{chunk-JC4WLVBG.js → chunk-RWOX2NJN.js} +2 -2
- package/dist/{chunk-4LM33LDV.js → chunk-S3CT536K.js} +2 -2
- package/dist/{chunk-4M3LZLOH.js → chunk-SHYSLWQG.js} +2 -2
- package/dist/{chunk-EQEV7GPT.cjs → chunk-SKEWTQJ7.cjs} +5 -5
- package/dist/{chunk-EQEV7GPT.cjs.map → chunk-SKEWTQJ7.cjs.map} +1 -1
- package/dist/{chunk-6XB3QTHO.cjs → chunk-SKTDGCWJ.cjs} +268 -159
- package/dist/chunk-SKTDGCWJ.cjs.map +1 -0
- package/dist/{chunk-2BXCIWL7.js → chunk-SN6EWQDJ.js} +3 -3
- package/dist/{chunk-DW2YDWGN.js → chunk-TEJIPPZR.js} +2 -2
- package/dist/{chunk-OGKD5PLS.cjs → chunk-TRLBYA5G.cjs} +4 -4
- package/dist/{chunk-OGKD5PLS.cjs.map → chunk-TRLBYA5G.cjs.map} +1 -1
- package/dist/{chunk-WE5FTQGD.js → chunk-VHMOKXUT.js} +3 -7
- package/dist/chunk-VHMOKXUT.js.map +1 -0
- package/dist/{chunk-S77GR5YQ.cjs → chunk-VHQTDITV.cjs} +3 -3
- package/dist/{chunk-S77GR5YQ.cjs.map → chunk-VHQTDITV.cjs.map} +1 -1
- package/dist/{chunk-3HMKE2GJ.js → chunk-VSTQEHVZ.js} +6 -4
- package/dist/chunk-VSTQEHVZ.js.map +1 -0
- package/dist/{chunk-HNUTV3HR.cjs → chunk-WUBQJVB7.cjs} +3 -3
- package/dist/{chunk-HNUTV3HR.cjs.map → chunk-WUBQJVB7.cjs.map} +1 -1
- package/dist/{chunk-S7TWEVC3.js → chunk-Y53HCLGW.js} +2 -2
- package/dist/{chunk-WIE7HDIM.js → chunk-YJXZR7RL.js} +2 -2
- package/dist/{chunk-IJYYHBZC.cjs → chunk-Z4SLV6WG.cjs} +3 -3
- package/dist/{chunk-IJYYHBZC.cjs.map → chunk-Z4SLV6WG.cjs.map} +1 -1
- package/dist/chunk-ZEZK664O.js +921 -0
- package/dist/chunk-ZEZK664O.js.map +1 -0
- package/dist/{chunk-JMD3P4CY.js → chunk-ZHFPV43D.js} +2 -2
- package/dist/combobox/index.cjs +4 -4
- package/dist/combobox/index.js +3 -3
- package/dist/context-menu/index.cjs +4 -4
- package/dist/context-menu/index.js +3 -3
- package/dist/data-grid/index.cjs +13 -13
- package/dist/data-grid/index.d.cts +169 -51
- package/dist/data-grid/index.d.ts +169 -51
- package/dist/data-grid/index.js +12 -12
- package/dist/date-picker/index.cjs +6 -6
- package/dist/date-picker/index.js +5 -5
- package/dist/drawer/index.cjs +4 -4
- package/dist/drawer/index.d.cts +2 -1
- package/dist/drawer/index.d.ts +2 -1
- package/dist/drawer/index.js +3 -3
- package/dist/empty-state/index.d.cts +2 -2
- package/dist/empty-state/index.d.ts +2 -2
- package/dist/header/index.cjs +4 -4
- package/dist/header/index.d.cts +2 -2
- package/dist/header/index.d.ts +2 -2
- package/dist/header/index.js +3 -3
- package/dist/index.cjs +29 -29
- package/dist/index.css +318 -73
- package/dist/index.d.cts +6 -5
- package/dist/index.d.ts +6 -5
- package/dist/index.js +28 -28
- package/dist/inline-edit/index.cjs +4 -4
- package/dist/inline-edit/index.js +3 -3
- package/dist/input/index.cjs +3 -3
- package/dist/input/index.js +2 -2
- package/dist/menu/index.cjs +3 -3
- package/dist/menu/index.js +2 -2
- package/dist/modal/index.cjs +4 -4
- package/dist/modal/index.d.cts +2 -1
- package/dist/modal/index.d.ts +2 -1
- package/dist/modal/index.js +3 -3
- package/dist/navigation/index.cjs +4 -4
- package/dist/navigation/index.js +3 -3
- package/dist/page-layout/index.cjs +8 -8
- package/dist/page-layout/index.d.cts +3 -2
- package/dist/page-layout/index.d.ts +3 -2
- package/dist/page-layout/index.js +7 -7
- package/dist/pagination/index.cjs +6 -6
- package/dist/pagination/index.js +5 -5
- package/dist/popover/index.cjs +2 -2
- package/dist/popover/index.d.cts +2 -2
- package/dist/popover/index.d.ts +2 -2
- package/dist/popover/index.js +1 -1
- package/dist/segmented-control/index.cjs +3 -3
- package/dist/segmented-control/index.js +2 -2
- package/dist/select/index.cjs +4 -4
- package/dist/select/index.js +3 -3
- package/dist/snackbar/index.cjs +4 -4
- package/dist/snackbar/index.js +3 -3
- package/dist/split-button/index.cjs +4 -4
- package/dist/split-button/index.js +3 -3
- package/dist/table/index.cjs +11 -11
- package/dist/table/index.d.cts +5 -5
- package/dist/table/index.d.ts +5 -5
- package/dist/table/index.js +10 -10
- package/dist/tabs/index.cjs +3 -3
- package/dist/tabs/index.js +2 -2
- package/dist/tag-input/index.cjs +4 -4
- package/dist/tag-input/index.js +3 -3
- package/dist/textarea/index.cjs +3 -3
- package/dist/textarea/index.js +2 -2
- package/dist/toolbar/index.cjs +5 -5
- package/dist/toolbar/index.d.cts +3 -2
- package/dist/toolbar/index.d.ts +3 -2
- package/dist/toolbar/index.js +4 -4
- package/package.json +6 -5
- package/dist/Table.types-Bv9l7qxd.d.ts +0 -103
- package/dist/Table.types-DQ0ReOLj.d.cts +0 -103
- package/dist/Toolbar.types-BGD57Uhm.d.ts +0 -22
- package/dist/Toolbar.types-tQkLmPIu.d.cts +0 -22
- package/dist/chunk-2KO5ZCZC.js +0 -744
- package/dist/chunk-2KO5ZCZC.js.map +0 -1
- package/dist/chunk-2U7UJOOB.cjs.map +0 -1
- package/dist/chunk-3HMKE2GJ.js.map +0 -1
- package/dist/chunk-3VRMTWUS.js.map +0 -1
- package/dist/chunk-5CLC3FJO.js.map +0 -1
- package/dist/chunk-6DBCT5MK.js.map +0 -1
- package/dist/chunk-6XB3QTHO.cjs.map +0 -1
- package/dist/chunk-G5IGADJI.cjs.map +0 -1
- package/dist/chunk-GOR642KK.cjs +0 -21
- package/dist/chunk-GOR642KK.cjs.map +0 -1
- package/dist/chunk-IV4LM3MB.js.map +0 -1
- package/dist/chunk-KIXFSXIN.cjs.map +0 -1
- package/dist/chunk-NUK4NT5Q.cjs +0 -744
- package/dist/chunk-NUK4NT5Q.cjs.map +0 -1
- package/dist/chunk-P2ZHWFK4.js.map +0 -1
- package/dist/chunk-TKLWQWMT.cjs.map +0 -1
- package/dist/chunk-UGMONQGH.cjs.map +0 -1
- package/dist/chunk-WE5FTQGD.js.map +0 -1
- package/dist/chunk-WPTMMOA6.cjs.map +0 -1
- package/dist/chunk-YQLCPKGV.js.map +0 -1
- /package/dist/{chunk-Z4ZY7L7W.js.map → chunk-5ZL6PYU3.js.map} +0 -0
- /package/dist/{chunk-A3NE2C7C.js.map → chunk-67RFMV6K.js.map} +0 -0
- /package/dist/{chunk-5WROPW7Z.js.map → chunk-A7WQINIG.js.map} +0 -0
- /package/dist/{chunk-ALGX5X4N.js.map → chunk-IFVT5UCY.js.map} +0 -0
- /package/dist/{chunk-3LHQUOGP.js.map → chunk-NGVOXM7P.js.map} +0 -0
- /package/dist/{chunk-WTXASLBB.js.map → chunk-O5WEKLNF.js.map} +0 -0
- /package/dist/{chunk-BOB5JJ7F.js.map → chunk-P7IQY5YH.js.map} +0 -0
- /package/dist/{chunk-VZYLJSV5.js.map → chunk-R4PU2TBM.js.map} +0 -0
- /package/dist/{chunk-P2GCAVUZ.js.map → chunk-RAZRQ57B.js.map} +0 -0
- /package/dist/{chunk-K7IFNKMN.js.map → chunk-REVK7IGN.js.map} +0 -0
- /package/dist/{chunk-JC4WLVBG.js.map → chunk-RWOX2NJN.js.map} +0 -0
- /package/dist/{chunk-4LM33LDV.js.map → chunk-S3CT536K.js.map} +0 -0
- /package/dist/{chunk-4M3LZLOH.js.map → chunk-SHYSLWQG.js.map} +0 -0
- /package/dist/{chunk-2BXCIWL7.js.map → chunk-SN6EWQDJ.js.map} +0 -0
- /package/dist/{chunk-DW2YDWGN.js.map → chunk-TEJIPPZR.js.map} +0 -0
- /package/dist/{chunk-S7TWEVC3.js.map → chunk-Y53HCLGW.js.map} +0 -0
- /package/dist/{chunk-WIE7HDIM.js.map → chunk-YJXZR7RL.js.map} +0 -0
- /package/dist/{chunk-JMD3P4CY.js.map → chunk-ZHFPV43D.js.map} +0 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
|
|
3
|
+
type AvatarSize = 'sm' | 'md' | 'lg';
|
|
4
|
+
type AvatarColor = 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'gray';
|
|
5
|
+
interface AvatarProps {
|
|
6
|
+
src?: string;
|
|
7
|
+
alt?: string;
|
|
8
|
+
name?: string;
|
|
9
|
+
size?: AvatarSize;
|
|
10
|
+
color?: AvatarColor;
|
|
11
|
+
shape?: 'circle' | 'square';
|
|
12
|
+
fallback?: React__default.ReactNode;
|
|
13
|
+
className?: string;
|
|
14
|
+
onClick?: () => void;
|
|
15
|
+
}
|
|
16
|
+
interface AvatarGroupProps {
|
|
17
|
+
children: React__default.ReactNode;
|
|
18
|
+
max?: number;
|
|
19
|
+
size?: AvatarSize;
|
|
20
|
+
className?: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export type { AvatarColor as A, AvatarGroupProps as a, AvatarProps as b, AvatarSize as c };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
|
|
3
|
+
type AvatarSize = 'sm' | 'md' | 'lg';
|
|
4
|
+
type AvatarColor = 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'gray';
|
|
5
|
+
interface AvatarProps {
|
|
6
|
+
src?: string;
|
|
7
|
+
alt?: string;
|
|
8
|
+
name?: string;
|
|
9
|
+
size?: AvatarSize;
|
|
10
|
+
color?: AvatarColor;
|
|
11
|
+
shape?: 'circle' | 'square';
|
|
12
|
+
fallback?: React__default.ReactNode;
|
|
13
|
+
className?: string;
|
|
14
|
+
onClick?: () => void;
|
|
15
|
+
}
|
|
16
|
+
interface AvatarGroupProps {
|
|
17
|
+
children: React__default.ReactNode;
|
|
18
|
+
max?: number;
|
|
19
|
+
size?: AvatarSize;
|
|
20
|
+
className?: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export type { AvatarColor as A, AvatarGroupProps as a, AvatarProps as b, AvatarSize as c };
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { T as TextButtonProps, I as IconButtonProps } from './Button.types-DZRCVqyN.cjs';
|
|
2
2
|
|
|
3
3
|
interface HeaderProps {
|
|
4
|
-
/**
|
|
5
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Page or section title. Accepts inline nodes alongside the text - a
|
|
6
|
+
* status `Pill`/`Chip` beside the title is the common case - not just a
|
|
7
|
+
* string. Keep the children inline-level; the title is a heading.
|
|
8
|
+
*/
|
|
9
|
+
title: React.ReactNode;
|
|
6
10
|
/** Supporting text rendered below the title. */
|
|
7
|
-
subtitle?:
|
|
11
|
+
subtitle?: React.ReactNode;
|
|
8
12
|
/** Trailing action buttons, rendered right-aligned. */
|
|
9
13
|
actions?: HeaderActionProps[];
|
|
10
14
|
className?: string;
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { T as TextButtonProps, I as IconButtonProps } from './Button.types-BH0CPyPx.js';
|
|
2
2
|
|
|
3
3
|
interface HeaderProps {
|
|
4
|
-
/**
|
|
5
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Page or section title. Accepts inline nodes alongside the text - a
|
|
6
|
+
* status `Pill`/`Chip` beside the title is the common case - not just a
|
|
7
|
+
* string. Keep the children inline-level; the title is a heading.
|
|
8
|
+
*/
|
|
9
|
+
title: React.ReactNode;
|
|
6
10
|
/** Supporting text rendered below the title. */
|
|
7
|
-
subtitle?:
|
|
11
|
+
subtitle?: React.ReactNode;
|
|
8
12
|
/** Trailing action buttons, rendered right-aligned. */
|
|
9
13
|
actions?: HeaderActionProps[];
|
|
10
14
|
className?: string;
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { I as IconType } from './renderIcon-C2lEMMzb.cjs';
|
|
3
|
+
import { B as ButtonColorProps, b as ButtonVariantProps } from './Button.types-DZRCVqyN.cjs';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A field name of a row-data type, as a string-literal union.
|
|
7
|
+
*
|
|
8
|
+
* Shared by every data component that addresses row fields by name
|
|
9
|
+
* (`Table`, `DataGrid`) so the same concept is typed one way everywhere -
|
|
10
|
+
* `TableColumn.key`, `DataGridColumn.key`, `rowKey`, sort keys, and the
|
|
11
|
+
* filter/quick-filter schemas.
|
|
12
|
+
*
|
|
13
|
+
* Degrades to `string` for the untyped default (`Record<string, unknown>`),
|
|
14
|
+
* which is what keeps callers who never specify `T` compiling unchanged.
|
|
15
|
+
*
|
|
16
|
+
* `Extract<keyof T, string>` rather than `keyof T`: keys are compared against
|
|
17
|
+
* and rendered as strings throughout (`data-col-key`, React keys, filter
|
|
18
|
+
* state objects), so numeric and symbol keys are excluded deliberately.
|
|
19
|
+
*
|
|
20
|
+
* ## Why this only works when `T` has no index signature
|
|
21
|
+
*
|
|
22
|
+
* An index signature widens `keyof T` to `string`, at which point this
|
|
23
|
+
* resolves to `string` and every key-narrowing and per-key value type built
|
|
24
|
+
* on it silently degrades to the old, unchecked behaviour. That is exactly
|
|
25
|
+
* what `T extends Record<string, unknown>` used to force on consumers:
|
|
26
|
+
* TypeScript only grants *implicit* index signatures to object type aliases,
|
|
27
|
+
* so anyone modelling rows with an `interface` had to write
|
|
28
|
+
* `interface Row extends Record<string, unknown>` to satisfy it - and thereby
|
|
29
|
+
* opted out of all of this without knowing.
|
|
30
|
+
*
|
|
31
|
+
* Both components now constrain `T extends object` instead, so a plain
|
|
32
|
+
* interface is accepted and keeps its literal keys. Don't tighten that
|
|
33
|
+
* constraint back to `Record<string, unknown>`: it would not fail loudly, it
|
|
34
|
+
* would just quietly stop checking.
|
|
35
|
+
*/
|
|
36
|
+
type RowKey<T> = Extract<keyof T, string>;
|
|
37
|
+
|
|
38
|
+
/** A secondary action inside a `type: 'split-button'` bulk action's dropdown. */
|
|
39
|
+
interface BulkActionSplitOption<T> {
|
|
40
|
+
id: string;
|
|
41
|
+
label: string;
|
|
42
|
+
icon?: IconType;
|
|
43
|
+
disabled?: boolean;
|
|
44
|
+
/** Receives the full array of currently selected row objects. */
|
|
45
|
+
onClick: (selectedRows: T[]) => void;
|
|
46
|
+
}
|
|
47
|
+
interface BulkActionCommon<T> {
|
|
48
|
+
/** Only needs to be unique within this `bulkActions` array. */
|
|
49
|
+
id: string;
|
|
50
|
+
color?: ButtonColorProps;
|
|
51
|
+
disabled?: boolean | ((selectedRows: T[]) => boolean);
|
|
52
|
+
/** Primary action - fired on click for `'button'`, or on the primary (left) segment for `'split-button'`. */
|
|
53
|
+
onClick: (selectedRows: T[]) => void;
|
|
54
|
+
}
|
|
55
|
+
interface BulkActionButton<T> extends BulkActionCommon<T> {
|
|
56
|
+
/** @default 'button' */
|
|
57
|
+
type?: 'button';
|
|
58
|
+
/** Omit to render an icon-only button - `icon` becomes the sole icon in that case. */
|
|
59
|
+
label?: string;
|
|
60
|
+
icon?: IconType;
|
|
61
|
+
posIcon?: IconType;
|
|
62
|
+
variant?: ButtonVariantProps;
|
|
63
|
+
}
|
|
64
|
+
interface BulkActionSplitButton<T> extends BulkActionCommon<T> {
|
|
65
|
+
type: 'split-button';
|
|
66
|
+
/** Required - SplitButton always renders a primary label. */
|
|
67
|
+
label: string;
|
|
68
|
+
icon?: IconType;
|
|
69
|
+
/** SplitButton has no `text` variant. */
|
|
70
|
+
variant?: Exclude<ButtonVariantProps, 'text'>;
|
|
71
|
+
/** Secondary actions shown in the split-button's dropdown. */
|
|
72
|
+
options: BulkActionSplitOption<T>[];
|
|
73
|
+
}
|
|
74
|
+
type BulkAction<T> = BulkActionButton<T> | BulkActionSplitButton<T>;
|
|
75
|
+
/** Members shared by every column variant, field-addressing or not. */
|
|
76
|
+
interface TableColumnCommon {
|
|
77
|
+
label: string;
|
|
78
|
+
sortable?: boolean;
|
|
79
|
+
filterable?: boolean;
|
|
80
|
+
filterType?: 'text' | 'select' | 'date' | 'boolean';
|
|
81
|
+
filterOptions?: {
|
|
82
|
+
id: string;
|
|
83
|
+
value: string;
|
|
84
|
+
label: string;
|
|
85
|
+
}[];
|
|
86
|
+
dateFilterMode?: 'single' | 'multiple' | 'range';
|
|
87
|
+
width?: string;
|
|
88
|
+
/**
|
|
89
|
+
* Cell text alignment. Applies in table mode only: card view renders each
|
|
90
|
+
* field as a label above its value, where aligning the value away from its
|
|
91
|
+
* own label reads as a misalignment rather than a choice.
|
|
92
|
+
*
|
|
93
|
+
* Ignored on `type: 'icon'` and `type: 'action'` columns, which are always
|
|
94
|
+
* centred - they hold a single control in a fixed-width cell, so there is
|
|
95
|
+
* nothing to align it within. `DataGrid`'s actions column behaves the same.
|
|
96
|
+
*/
|
|
97
|
+
align?: 'left' | 'center' | 'right';
|
|
98
|
+
/** Enables position:sticky on this column */
|
|
99
|
+
pin?: 'left' | 'right';
|
|
100
|
+
/**
|
|
101
|
+
* Render this column's value as the card's title instead of a label:value
|
|
102
|
+
* field row. Only the first column with `cardHeader` set is used - if
|
|
103
|
+
* several are marked, the rest render as normal fields.
|
|
104
|
+
*/
|
|
105
|
+
cardHeader?: boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Render this column's value as the card's subtitle, directly under the
|
|
108
|
+
* `cardHeader` value. Only the first column with `cardSubheader` set is
|
|
109
|
+
* used. Has no effect without a `cardHeader` column also being set.
|
|
110
|
+
*/
|
|
111
|
+
cardSubheader?: boolean;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* A column bound to the row field named by `key`, which is what lets `render`
|
|
115
|
+
* receive `T[K]` rather than `unknown`.
|
|
116
|
+
*
|
|
117
|
+
* Not used directly - `TableColumn` distributes this over `keyof T` so each
|
|
118
|
+
* entry correlates its own `key` with its own value type.
|
|
119
|
+
*/
|
|
120
|
+
interface TableValueColumn<T extends object, K extends RowKey<T>> extends TableColumnCommon {
|
|
121
|
+
key: K;
|
|
122
|
+
/** @default 'data' */
|
|
123
|
+
type?: 'data';
|
|
124
|
+
render?: (value: T[K], item: T) => ReactNode;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* A column that renders from the whole row rather than one field - an icon or
|
|
128
|
+
* action cell, or a computed/composite value. `key` is free-form here because
|
|
129
|
+
* nothing reads `row[key]`: it's only an identity for React keys, sorting and
|
|
130
|
+
* `data-col-key`.
|
|
131
|
+
*
|
|
132
|
+
* `'icon'` and `'action'` carry their existing cell styling; `'custom'` styles
|
|
133
|
+
* like a normal data cell but takes a free-form key, which is the home for a
|
|
134
|
+
* derived column (previously expressible only by pointing `key` at a field
|
|
135
|
+
* that didn't exist).
|
|
136
|
+
*/
|
|
137
|
+
interface TableCustomColumn<T extends object> extends TableColumnCommon {
|
|
138
|
+
/** Free-form - must only be unique within `columns`. */
|
|
139
|
+
key: string;
|
|
140
|
+
type: 'icon' | 'action' | 'custom';
|
|
141
|
+
/** `value` is always `undefined`; render from `item`. */
|
|
142
|
+
render?: (value: undefined, item: T) => ReactNode;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* One column definition. A union of two variants, discriminated on `type`:
|
|
146
|
+
*
|
|
147
|
+
* - **value column** (default, `type` omitted or `'data'`) - `key` must be a
|
|
148
|
+
* field of `T`, and `render` receives that field's type instead of `unknown`.
|
|
149
|
+
* - **`type: 'icon' | 'action' | 'custom'`** - renders from the whole row;
|
|
150
|
+
* `key` is free-form.
|
|
151
|
+
*
|
|
152
|
+
* With the untyped default `T`, `RowKey<T>` is `string` and `T[K]` is
|
|
153
|
+
* `unknown`, which is byte-identical to the pre-2.0 behaviour.
|
|
154
|
+
*
|
|
155
|
+
* Replaces `key: keyof T | string`, which looked constrained but wasn't:
|
|
156
|
+
* `keyof T` is assignable to `string`, so that union collapsed to plain
|
|
157
|
+
* `string` and checked nothing.
|
|
158
|
+
*/
|
|
159
|
+
type TableColumn<T extends object = Record<string, unknown>> = {
|
|
160
|
+
[K in RowKey<T>]: TableValueColumn<T, K>;
|
|
161
|
+
}[RowKey<T>] | TableCustomColumn<T>;
|
|
162
|
+
type FilterValue = string | string[] | boolean | {
|
|
163
|
+
start: string | null;
|
|
164
|
+
end: string | null;
|
|
165
|
+
} | undefined;
|
|
166
|
+
interface TableFilters {
|
|
167
|
+
[key: string]: FilterValue;
|
|
168
|
+
}
|
|
169
|
+
interface TableProps<T extends object = Record<string, unknown>> {
|
|
170
|
+
data: T[];
|
|
171
|
+
columns: TableColumn<T>[];
|
|
172
|
+
loading?: boolean;
|
|
173
|
+
emptyMessage?: string;
|
|
174
|
+
onRowClick?: (item: T) => void;
|
|
175
|
+
className?: string;
|
|
176
|
+
showFooter?: boolean;
|
|
177
|
+
totalItems?: number;
|
|
178
|
+
showPagination?: boolean;
|
|
179
|
+
pageSize?: number;
|
|
180
|
+
pageSizeOptions?: number[];
|
|
181
|
+
onSortChange?: (sortBy: RowKey<T>, sortDirection: 'asc' | 'desc') => void;
|
|
182
|
+
currentSort?: {
|
|
183
|
+
key: RowKey<T>;
|
|
184
|
+
direction: 'asc' | 'desc';
|
|
185
|
+
};
|
|
186
|
+
filters?: TableFilters;
|
|
187
|
+
onFiltersChange?: (filters: TableFilters) => void;
|
|
188
|
+
defaultFilters?: TableFilters;
|
|
189
|
+
showFilters?: boolean;
|
|
190
|
+
selectable?: boolean;
|
|
191
|
+
rowKey?: RowKey<T>;
|
|
192
|
+
selectedRows?: string[];
|
|
193
|
+
defaultSelectedRows?: string[];
|
|
194
|
+
/**
|
|
195
|
+
* Fires with every selected key, plus the row object for each of those keys.
|
|
196
|
+
*
|
|
197
|
+
* `selectedKeys` is authoritative; `selectedRows` is best-effort. The row
|
|
198
|
+
* for each selected key is cached, so a row selected while it was rendered
|
|
199
|
+
* still comes back after `data` has moved on - but a key that was selected
|
|
200
|
+
* before the table ever saw its row (seeded via `defaultSelectedRows`, say)
|
|
201
|
+
* has no row to hand back.
|
|
202
|
+
*/
|
|
203
|
+
onSelectionChange?: (selectedKeys: string[], selectedRows: T[]) => void;
|
|
204
|
+
/**
|
|
205
|
+
* What the select-all control acts on - the header checkbox in table mode,
|
|
206
|
+
* or the toolbar checkbox in card view (where there is no header row):
|
|
207
|
+
*
|
|
208
|
+
* - `'all'` - every row in `data`, across pages.
|
|
209
|
+
* - `'page'` - only the rows currently rendered.
|
|
210
|
+
*
|
|
211
|
+
* Either way it only ever adds to or removes from the rows in its own
|
|
212
|
+
* scope, so a selection made on another page survives.
|
|
213
|
+
*
|
|
214
|
+
* `'all'` can only reach the rows the table actually holds: if `data` is one
|
|
215
|
+
* page of a larger set (with `totalItems` describing the whole), it cannot
|
|
216
|
+
* know the keys of rows it has never received, and says so with a dev-only
|
|
217
|
+
* warning. Matches `DataGrid.selectAllScope`.
|
|
218
|
+
*
|
|
219
|
+
* @default 'all'
|
|
220
|
+
*/
|
|
221
|
+
selectAllScope?: 'all' | 'page';
|
|
222
|
+
/**
|
|
223
|
+
* Resolves the keys of **every** row matching the current query, including
|
|
224
|
+
* rows not present in `data`. Supplying it adds a "Select all N" action to
|
|
225
|
+
* the toolbar once everything the table does hold is selected.
|
|
226
|
+
*
|
|
227
|
+
* Only relevant when `data` is a subset of a larger set and `totalItems`
|
|
228
|
+
* describes the whole - a table paginating its own `data` already has every
|
|
229
|
+
* key. Called with no arguments, may be async (the action shows a loading
|
|
230
|
+
* state), and whatever it returns replaces the selection.
|
|
231
|
+
*
|
|
232
|
+
* Matches `DataGrid.onSelectAllMatching`, which is where this mostly earns
|
|
233
|
+
* its keep: `DataGrid` has a real server-side pagination mode.
|
|
234
|
+
*/
|
|
235
|
+
onSelectAllMatching?: () => string[] | Promise<string[]>;
|
|
236
|
+
bulkActions?: BulkAction<T>[];
|
|
237
|
+
density?: 'compact' | 'comfortable' | 'spacious';
|
|
238
|
+
showColumnVisibility?: boolean;
|
|
239
|
+
showExport?: boolean;
|
|
240
|
+
showDensity?: boolean;
|
|
241
|
+
draggableColumns?: boolean;
|
|
242
|
+
onColumnReorder?: (newColumns: TableColumn<T>[]) => void;
|
|
243
|
+
/**
|
|
244
|
+
* On by default: below `cardViewBreakpoint`, or once the table's own width
|
|
245
|
+
* can no longer fit every visible column at a usable width, swap the table
|
|
246
|
+
* for a stacked list of cards - one per row. Only the row rendering
|
|
247
|
+
* changes; the toolbar, pagination, filtering, sorting and selection all
|
|
248
|
+
* keep working. `draggableColumns` has no effect in card view (there are no
|
|
249
|
+
* column headers to drag).
|
|
250
|
+
*
|
|
251
|
+
* Matches `DataGridProps.hasCardView` - both components use the same
|
|
252
|
+
* defaults and the same measured-container logic. Set to `false` to always
|
|
253
|
+
* render a table.
|
|
254
|
+
*
|
|
255
|
+
* @default true
|
|
256
|
+
*/
|
|
257
|
+
hasCardView?: boolean;
|
|
258
|
+
/**
|
|
259
|
+
* Container width (px) at/below which card view kicks in. This is an
|
|
260
|
+
* explicit floor - card view also switches on automatically, regardless
|
|
261
|
+
* of this value, once the container can't fit every visible column at a
|
|
262
|
+
* usable minimum width, so a many-column table never has to overflow
|
|
263
|
+
* horizontally waiting for a hand-tuned breakpoint.
|
|
264
|
+
*
|
|
265
|
+
* @default 640
|
|
266
|
+
*/
|
|
267
|
+
cardViewBreakpoint?: number;
|
|
268
|
+
/**
|
|
269
|
+
* Cards lay out in a responsive grid (CSS `repeat(auto-fill, minmax(...))`)
|
|
270
|
+
* rather than one per row - this sets the minimum width (px) a card can
|
|
271
|
+
* shrink to before the next one wraps to a new row.
|
|
272
|
+
*
|
|
273
|
+
* @default 280
|
|
274
|
+
*/
|
|
275
|
+
cardMinWidth?: number;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
export type { BulkAction as B, FilterValue as F, RowKey as R, TableColumn as T, BulkActionButton as a, BulkActionSplitButton as b, BulkActionSplitOption as c, TableCustomColumn as d, TableFilters as e, TableProps as f, TableValueColumn as g };
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { I as IconType } from './renderIcon-C2lEMMzb.js';
|
|
3
|
+
import { B as ButtonColorProps, b as ButtonVariantProps } from './Button.types-BH0CPyPx.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A field name of a row-data type, as a string-literal union.
|
|
7
|
+
*
|
|
8
|
+
* Shared by every data component that addresses row fields by name
|
|
9
|
+
* (`Table`, `DataGrid`) so the same concept is typed one way everywhere -
|
|
10
|
+
* `TableColumn.key`, `DataGridColumn.key`, `rowKey`, sort keys, and the
|
|
11
|
+
* filter/quick-filter schemas.
|
|
12
|
+
*
|
|
13
|
+
* Degrades to `string` for the untyped default (`Record<string, unknown>`),
|
|
14
|
+
* which is what keeps callers who never specify `T` compiling unchanged.
|
|
15
|
+
*
|
|
16
|
+
* `Extract<keyof T, string>` rather than `keyof T`: keys are compared against
|
|
17
|
+
* and rendered as strings throughout (`data-col-key`, React keys, filter
|
|
18
|
+
* state objects), so numeric and symbol keys are excluded deliberately.
|
|
19
|
+
*
|
|
20
|
+
* ## Why this only works when `T` has no index signature
|
|
21
|
+
*
|
|
22
|
+
* An index signature widens `keyof T` to `string`, at which point this
|
|
23
|
+
* resolves to `string` and every key-narrowing and per-key value type built
|
|
24
|
+
* on it silently degrades to the old, unchecked behaviour. That is exactly
|
|
25
|
+
* what `T extends Record<string, unknown>` used to force on consumers:
|
|
26
|
+
* TypeScript only grants *implicit* index signatures to object type aliases,
|
|
27
|
+
* so anyone modelling rows with an `interface` had to write
|
|
28
|
+
* `interface Row extends Record<string, unknown>` to satisfy it - and thereby
|
|
29
|
+
* opted out of all of this without knowing.
|
|
30
|
+
*
|
|
31
|
+
* Both components now constrain `T extends object` instead, so a plain
|
|
32
|
+
* interface is accepted and keeps its literal keys. Don't tighten that
|
|
33
|
+
* constraint back to `Record<string, unknown>`: it would not fail loudly, it
|
|
34
|
+
* would just quietly stop checking.
|
|
35
|
+
*/
|
|
36
|
+
type RowKey<T> = Extract<keyof T, string>;
|
|
37
|
+
|
|
38
|
+
/** A secondary action inside a `type: 'split-button'` bulk action's dropdown. */
|
|
39
|
+
interface BulkActionSplitOption<T> {
|
|
40
|
+
id: string;
|
|
41
|
+
label: string;
|
|
42
|
+
icon?: IconType;
|
|
43
|
+
disabled?: boolean;
|
|
44
|
+
/** Receives the full array of currently selected row objects. */
|
|
45
|
+
onClick: (selectedRows: T[]) => void;
|
|
46
|
+
}
|
|
47
|
+
interface BulkActionCommon<T> {
|
|
48
|
+
/** Only needs to be unique within this `bulkActions` array. */
|
|
49
|
+
id: string;
|
|
50
|
+
color?: ButtonColorProps;
|
|
51
|
+
disabled?: boolean | ((selectedRows: T[]) => boolean);
|
|
52
|
+
/** Primary action - fired on click for `'button'`, or on the primary (left) segment for `'split-button'`. */
|
|
53
|
+
onClick: (selectedRows: T[]) => void;
|
|
54
|
+
}
|
|
55
|
+
interface BulkActionButton<T> extends BulkActionCommon<T> {
|
|
56
|
+
/** @default 'button' */
|
|
57
|
+
type?: 'button';
|
|
58
|
+
/** Omit to render an icon-only button - `icon` becomes the sole icon in that case. */
|
|
59
|
+
label?: string;
|
|
60
|
+
icon?: IconType;
|
|
61
|
+
posIcon?: IconType;
|
|
62
|
+
variant?: ButtonVariantProps;
|
|
63
|
+
}
|
|
64
|
+
interface BulkActionSplitButton<T> extends BulkActionCommon<T> {
|
|
65
|
+
type: 'split-button';
|
|
66
|
+
/** Required - SplitButton always renders a primary label. */
|
|
67
|
+
label: string;
|
|
68
|
+
icon?: IconType;
|
|
69
|
+
/** SplitButton has no `text` variant. */
|
|
70
|
+
variant?: Exclude<ButtonVariantProps, 'text'>;
|
|
71
|
+
/** Secondary actions shown in the split-button's dropdown. */
|
|
72
|
+
options: BulkActionSplitOption<T>[];
|
|
73
|
+
}
|
|
74
|
+
type BulkAction<T> = BulkActionButton<T> | BulkActionSplitButton<T>;
|
|
75
|
+
/** Members shared by every column variant, field-addressing or not. */
|
|
76
|
+
interface TableColumnCommon {
|
|
77
|
+
label: string;
|
|
78
|
+
sortable?: boolean;
|
|
79
|
+
filterable?: boolean;
|
|
80
|
+
filterType?: 'text' | 'select' | 'date' | 'boolean';
|
|
81
|
+
filterOptions?: {
|
|
82
|
+
id: string;
|
|
83
|
+
value: string;
|
|
84
|
+
label: string;
|
|
85
|
+
}[];
|
|
86
|
+
dateFilterMode?: 'single' | 'multiple' | 'range';
|
|
87
|
+
width?: string;
|
|
88
|
+
/**
|
|
89
|
+
* Cell text alignment. Applies in table mode only: card view renders each
|
|
90
|
+
* field as a label above its value, where aligning the value away from its
|
|
91
|
+
* own label reads as a misalignment rather than a choice.
|
|
92
|
+
*
|
|
93
|
+
* Ignored on `type: 'icon'` and `type: 'action'` columns, which are always
|
|
94
|
+
* centred - they hold a single control in a fixed-width cell, so there is
|
|
95
|
+
* nothing to align it within. `DataGrid`'s actions column behaves the same.
|
|
96
|
+
*/
|
|
97
|
+
align?: 'left' | 'center' | 'right';
|
|
98
|
+
/** Enables position:sticky on this column */
|
|
99
|
+
pin?: 'left' | 'right';
|
|
100
|
+
/**
|
|
101
|
+
* Render this column's value as the card's title instead of a label:value
|
|
102
|
+
* field row. Only the first column with `cardHeader` set is used - if
|
|
103
|
+
* several are marked, the rest render as normal fields.
|
|
104
|
+
*/
|
|
105
|
+
cardHeader?: boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Render this column's value as the card's subtitle, directly under the
|
|
108
|
+
* `cardHeader` value. Only the first column with `cardSubheader` set is
|
|
109
|
+
* used. Has no effect without a `cardHeader` column also being set.
|
|
110
|
+
*/
|
|
111
|
+
cardSubheader?: boolean;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* A column bound to the row field named by `key`, which is what lets `render`
|
|
115
|
+
* receive `T[K]` rather than `unknown`.
|
|
116
|
+
*
|
|
117
|
+
* Not used directly - `TableColumn` distributes this over `keyof T` so each
|
|
118
|
+
* entry correlates its own `key` with its own value type.
|
|
119
|
+
*/
|
|
120
|
+
interface TableValueColumn<T extends object, K extends RowKey<T>> extends TableColumnCommon {
|
|
121
|
+
key: K;
|
|
122
|
+
/** @default 'data' */
|
|
123
|
+
type?: 'data';
|
|
124
|
+
render?: (value: T[K], item: T) => ReactNode;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* A column that renders from the whole row rather than one field - an icon or
|
|
128
|
+
* action cell, or a computed/composite value. `key` is free-form here because
|
|
129
|
+
* nothing reads `row[key]`: it's only an identity for React keys, sorting and
|
|
130
|
+
* `data-col-key`.
|
|
131
|
+
*
|
|
132
|
+
* `'icon'` and `'action'` carry their existing cell styling; `'custom'` styles
|
|
133
|
+
* like a normal data cell but takes a free-form key, which is the home for a
|
|
134
|
+
* derived column (previously expressible only by pointing `key` at a field
|
|
135
|
+
* that didn't exist).
|
|
136
|
+
*/
|
|
137
|
+
interface TableCustomColumn<T extends object> extends TableColumnCommon {
|
|
138
|
+
/** Free-form - must only be unique within `columns`. */
|
|
139
|
+
key: string;
|
|
140
|
+
type: 'icon' | 'action' | 'custom';
|
|
141
|
+
/** `value` is always `undefined`; render from `item`. */
|
|
142
|
+
render?: (value: undefined, item: T) => ReactNode;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* One column definition. A union of two variants, discriminated on `type`:
|
|
146
|
+
*
|
|
147
|
+
* - **value column** (default, `type` omitted or `'data'`) - `key` must be a
|
|
148
|
+
* field of `T`, and `render` receives that field's type instead of `unknown`.
|
|
149
|
+
* - **`type: 'icon' | 'action' | 'custom'`** - renders from the whole row;
|
|
150
|
+
* `key` is free-form.
|
|
151
|
+
*
|
|
152
|
+
* With the untyped default `T`, `RowKey<T>` is `string` and `T[K]` is
|
|
153
|
+
* `unknown`, which is byte-identical to the pre-2.0 behaviour.
|
|
154
|
+
*
|
|
155
|
+
* Replaces `key: keyof T | string`, which looked constrained but wasn't:
|
|
156
|
+
* `keyof T` is assignable to `string`, so that union collapsed to plain
|
|
157
|
+
* `string` and checked nothing.
|
|
158
|
+
*/
|
|
159
|
+
type TableColumn<T extends object = Record<string, unknown>> = {
|
|
160
|
+
[K in RowKey<T>]: TableValueColumn<T, K>;
|
|
161
|
+
}[RowKey<T>] | TableCustomColumn<T>;
|
|
162
|
+
type FilterValue = string | string[] | boolean | {
|
|
163
|
+
start: string | null;
|
|
164
|
+
end: string | null;
|
|
165
|
+
} | undefined;
|
|
166
|
+
interface TableFilters {
|
|
167
|
+
[key: string]: FilterValue;
|
|
168
|
+
}
|
|
169
|
+
interface TableProps<T extends object = Record<string, unknown>> {
|
|
170
|
+
data: T[];
|
|
171
|
+
columns: TableColumn<T>[];
|
|
172
|
+
loading?: boolean;
|
|
173
|
+
emptyMessage?: string;
|
|
174
|
+
onRowClick?: (item: T) => void;
|
|
175
|
+
className?: string;
|
|
176
|
+
showFooter?: boolean;
|
|
177
|
+
totalItems?: number;
|
|
178
|
+
showPagination?: boolean;
|
|
179
|
+
pageSize?: number;
|
|
180
|
+
pageSizeOptions?: number[];
|
|
181
|
+
onSortChange?: (sortBy: RowKey<T>, sortDirection: 'asc' | 'desc') => void;
|
|
182
|
+
currentSort?: {
|
|
183
|
+
key: RowKey<T>;
|
|
184
|
+
direction: 'asc' | 'desc';
|
|
185
|
+
};
|
|
186
|
+
filters?: TableFilters;
|
|
187
|
+
onFiltersChange?: (filters: TableFilters) => void;
|
|
188
|
+
defaultFilters?: TableFilters;
|
|
189
|
+
showFilters?: boolean;
|
|
190
|
+
selectable?: boolean;
|
|
191
|
+
rowKey?: RowKey<T>;
|
|
192
|
+
selectedRows?: string[];
|
|
193
|
+
defaultSelectedRows?: string[];
|
|
194
|
+
/**
|
|
195
|
+
* Fires with every selected key, plus the row object for each of those keys.
|
|
196
|
+
*
|
|
197
|
+
* `selectedKeys` is authoritative; `selectedRows` is best-effort. The row
|
|
198
|
+
* for each selected key is cached, so a row selected while it was rendered
|
|
199
|
+
* still comes back after `data` has moved on - but a key that was selected
|
|
200
|
+
* before the table ever saw its row (seeded via `defaultSelectedRows`, say)
|
|
201
|
+
* has no row to hand back.
|
|
202
|
+
*/
|
|
203
|
+
onSelectionChange?: (selectedKeys: string[], selectedRows: T[]) => void;
|
|
204
|
+
/**
|
|
205
|
+
* What the select-all control acts on - the header checkbox in table mode,
|
|
206
|
+
* or the toolbar checkbox in card view (where there is no header row):
|
|
207
|
+
*
|
|
208
|
+
* - `'all'` - every row in `data`, across pages.
|
|
209
|
+
* - `'page'` - only the rows currently rendered.
|
|
210
|
+
*
|
|
211
|
+
* Either way it only ever adds to or removes from the rows in its own
|
|
212
|
+
* scope, so a selection made on another page survives.
|
|
213
|
+
*
|
|
214
|
+
* `'all'` can only reach the rows the table actually holds: if `data` is one
|
|
215
|
+
* page of a larger set (with `totalItems` describing the whole), it cannot
|
|
216
|
+
* know the keys of rows it has never received, and says so with a dev-only
|
|
217
|
+
* warning. Matches `DataGrid.selectAllScope`.
|
|
218
|
+
*
|
|
219
|
+
* @default 'all'
|
|
220
|
+
*/
|
|
221
|
+
selectAllScope?: 'all' | 'page';
|
|
222
|
+
/**
|
|
223
|
+
* Resolves the keys of **every** row matching the current query, including
|
|
224
|
+
* rows not present in `data`. Supplying it adds a "Select all N" action to
|
|
225
|
+
* the toolbar once everything the table does hold is selected.
|
|
226
|
+
*
|
|
227
|
+
* Only relevant when `data` is a subset of a larger set and `totalItems`
|
|
228
|
+
* describes the whole - a table paginating its own `data` already has every
|
|
229
|
+
* key. Called with no arguments, may be async (the action shows a loading
|
|
230
|
+
* state), and whatever it returns replaces the selection.
|
|
231
|
+
*
|
|
232
|
+
* Matches `DataGrid.onSelectAllMatching`, which is where this mostly earns
|
|
233
|
+
* its keep: `DataGrid` has a real server-side pagination mode.
|
|
234
|
+
*/
|
|
235
|
+
onSelectAllMatching?: () => string[] | Promise<string[]>;
|
|
236
|
+
bulkActions?: BulkAction<T>[];
|
|
237
|
+
density?: 'compact' | 'comfortable' | 'spacious';
|
|
238
|
+
showColumnVisibility?: boolean;
|
|
239
|
+
showExport?: boolean;
|
|
240
|
+
showDensity?: boolean;
|
|
241
|
+
draggableColumns?: boolean;
|
|
242
|
+
onColumnReorder?: (newColumns: TableColumn<T>[]) => void;
|
|
243
|
+
/**
|
|
244
|
+
* On by default: below `cardViewBreakpoint`, or once the table's own width
|
|
245
|
+
* can no longer fit every visible column at a usable width, swap the table
|
|
246
|
+
* for a stacked list of cards - one per row. Only the row rendering
|
|
247
|
+
* changes; the toolbar, pagination, filtering, sorting and selection all
|
|
248
|
+
* keep working. `draggableColumns` has no effect in card view (there are no
|
|
249
|
+
* column headers to drag).
|
|
250
|
+
*
|
|
251
|
+
* Matches `DataGridProps.hasCardView` - both components use the same
|
|
252
|
+
* defaults and the same measured-container logic. Set to `false` to always
|
|
253
|
+
* render a table.
|
|
254
|
+
*
|
|
255
|
+
* @default true
|
|
256
|
+
*/
|
|
257
|
+
hasCardView?: boolean;
|
|
258
|
+
/**
|
|
259
|
+
* Container width (px) at/below which card view kicks in. This is an
|
|
260
|
+
* explicit floor - card view also switches on automatically, regardless
|
|
261
|
+
* of this value, once the container can't fit every visible column at a
|
|
262
|
+
* usable minimum width, so a many-column table never has to overflow
|
|
263
|
+
* horizontally waiting for a hand-tuned breakpoint.
|
|
264
|
+
*
|
|
265
|
+
* @default 640
|
|
266
|
+
*/
|
|
267
|
+
cardViewBreakpoint?: number;
|
|
268
|
+
/**
|
|
269
|
+
* Cards lay out in a responsive grid (CSS `repeat(auto-fill, minmax(...))`)
|
|
270
|
+
* rather than one per row - this sets the minimum width (px) a card can
|
|
271
|
+
* shrink to before the next one wraps to a new row.
|
|
272
|
+
*
|
|
273
|
+
* @default 280
|
|
274
|
+
*/
|
|
275
|
+
cardMinWidth?: number;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
export type { BulkAction as B, FilterValue as F, RowKey as R, TableColumn as T, BulkActionButton as a, BulkActionSplitButton as b, BulkActionSplitOption as c, TableCustomColumn as d, TableFilters as e, TableProps as f, TableValueColumn as g };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { a as BreadcrumbProps } from './Breadcrumb.types-DaykU-C8.cjs';
|
|
2
|
+
import { b as AvatarProps } from './Avatar.types-BY-C09Ke.cjs';
|
|
3
|
+
import { I as IconButtonProps } from './Button.types-DZRCVqyN.cjs';
|
|
4
|
+
import { b as MenuItemType } from './Menu.types-DwcuCZM7.cjs';
|
|
5
|
+
import { C as CommandItem } from './CommandPalette.types-DRMMS_ev.cjs';
|
|
6
|
+
|
|
7
|
+
interface ToolbarProps {
|
|
8
|
+
/** Breadcrumb trail rendered above the page. Omit to leave the leading region empty. */
|
|
9
|
+
breadcrumbs?: Pick<BreadcrumbProps, 'items' | 'separator'>;
|
|
10
|
+
/**
|
|
11
|
+
* The signed-in user, rendered as the `Avatar` at the far right. Omit it
|
|
12
|
+
* (along with `userMenu`) to render no avatar at all.
|
|
13
|
+
*/
|
|
14
|
+
user?: Pick<AvatarProps, 'name' | 'src' | 'color'>;
|
|
15
|
+
/**
|
|
16
|
+
* User menu items, opened from the `user` avatar. Omit (or pass an empty
|
|
17
|
+
* array) to render the avatar as a plain, non-interactive mark.
|
|
18
|
+
*/
|
|
19
|
+
userMenu?: MenuItemType[];
|
|
20
|
+
/** Command palette items, rendered right-aligned. */
|
|
21
|
+
cmdPaletteItems?: CommandItem[];
|
|
22
|
+
/**
|
|
23
|
+
* Free-form content rendered at the start of the trailing region, before
|
|
24
|
+
* the command palette trigger - an environment badge, an org/tenant
|
|
25
|
+
* switcher, a global toggle. Unlike `actions`, which is a restricted
|
|
26
|
+
* button subset, this region takes any node and is laid out as-is.
|
|
27
|
+
*/
|
|
28
|
+
content?: React.ReactNode;
|
|
29
|
+
/** Trailing action buttons, rendered right-aligned. */
|
|
30
|
+
actions?: ToolbarActionProps[];
|
|
31
|
+
className?: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Restricted, discriminated subset of ButtonProps for Toolbar actions.
|
|
35
|
+
*/
|
|
36
|
+
type ToolbarActionProps = Pick<IconButtonProps, 'color' | 'loading' | 'disabled' | 'preIcon' | 'posIcon' | 'icon' | 'children' | 'onClick' | 'tooltip'>;
|
|
37
|
+
|
|
38
|
+
export type { ToolbarActionProps as T, ToolbarProps as a };
|