@usefragments/ui 1.3.2 → 1.4.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/README.md +3 -1
- package/dist/assets/ui.css +1261 -849
- package/dist/chart.cjs +60 -24
- package/dist/chart.js +38 -24
- package/dist/codeblock.cjs +14 -6
- package/dist/codeblock.js +14 -6
- package/dist/colorpicker.cjs +56 -9
- package/dist/colorpicker.js +34 -9
- package/dist/components/Badge/Badge.module.scss.cjs +23 -16
- package/dist/components/Badge/Badge.module.scss.js +23 -16
- package/dist/components/Badge/index.cjs +8 -1
- package/dist/components/Badge/index.d.ts +3 -0
- package/dist/components/Badge/index.d.ts.map +1 -1
- package/dist/components/Badge/index.js +8 -1
- package/dist/components/Button/Button.module.scss.cjs +16 -13
- package/dist/components/Button/Button.module.scss.js +16 -13
- package/dist/components/Button/index.d.ts +2 -1
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/Chart/index.d.ts +3 -0
- package/dist/components/Chart/index.d.ts.map +1 -1
- package/dist/components/CodeBlock/CodeBlock.module.scss.cjs +21 -21
- package/dist/components/CodeBlock/CodeBlock.module.scss.js +21 -21
- package/dist/components/CodeBlock/index.d.ts.map +1 -1
- package/dist/components/ColorPicker/index.d.ts +4 -0
- package/dist/components/ColorPicker/index.d.ts.map +1 -1
- package/dist/components/Combobox/Combobox.module.scss.cjs +23 -23
- package/dist/components/Combobox/Combobox.module.scss.js +23 -23
- package/dist/components/Command/Command.module.scss.cjs +11 -11
- package/dist/components/Command/Command.module.scss.js +11 -11
- package/dist/components/ConversationList/ConversationList.module.scss.cjs +13 -10
- package/dist/components/ConversationList/ConversationList.module.scss.js +14 -11
- package/dist/components/ConversationList/index.cjs +26 -22
- package/dist/components/ConversationList/index.d.ts +5 -1
- package/dist/components/ConversationList/index.d.ts.map +1 -1
- package/dist/components/ConversationList/index.js +27 -23
- package/dist/components/DataTable/DataTable.module.scss.cjs +35 -35
- package/dist/components/DataTable/DataTable.module.scss.js +35 -35
- package/dist/components/DataTable/index.d.ts +4 -1
- package/dist/components/DataTable/index.d.ts.map +1 -1
- package/dist/components/DatePicker/index.d.ts +3 -0
- package/dist/components/DatePicker/index.d.ts.map +1 -1
- package/dist/components/Editor/index.d.ts +4 -1
- package/dist/components/Editor/index.d.ts.map +1 -1
- package/dist/components/Listbox/Listbox.module.scss.cjs +8 -8
- package/dist/components/Listbox/Listbox.module.scss.js +8 -8
- package/dist/components/Markdown/Markdown.module.scss.cjs +1 -1
- package/dist/components/Markdown/Markdown.module.scss.js +1 -1
- package/dist/components/Markdown/index.d.ts +16 -0
- package/dist/components/Markdown/index.d.ts.map +1 -1
- package/dist/components/Menu/Menu.module.scss.cjs +14 -14
- package/dist/components/Menu/Menu.module.scss.js +14 -14
- package/dist/components/Message/Message.module.scss.cjs +23 -20
- package/dist/components/Message/Message.module.scss.js +24 -21
- package/dist/components/Message/index.cjs +5 -1
- package/dist/components/Message/index.d.ts.map +1 -1
- package/dist/components/Message/index.js +5 -1
- package/dist/components/NavigationMenu/NavigationMenu.module.scss.cjs +28 -28
- package/dist/components/NavigationMenu/NavigationMenu.module.scss.js +28 -28
- package/dist/components/Pagination/Pagination.module.scss.cjs +7 -7
- package/dist/components/Pagination/Pagination.module.scss.js +7 -7
- package/dist/components/Prompt/Prompt.module.scss.cjs +52 -22
- package/dist/components/Prompt/Prompt.module.scss.js +52 -22
- package/dist/components/Prompt/index.cjs +197 -2
- package/dist/components/Prompt/index.d.ts +98 -3
- package/dist/components/Prompt/index.d.ts.map +1 -1
- package/dist/components/Prompt/index.js +198 -3
- package/dist/components/Select/Select.module.scss.cjs +29 -17
- package/dist/components/Select/Select.module.scss.js +30 -18
- package/dist/components/Select/index.cjs +45 -8
- package/dist/components/Select/index.d.ts +17 -2
- package/dist/components/Select/index.d.ts.map +1 -1
- package/dist/components/Select/index.js +45 -8
- package/dist/components/Sidebar/Sidebar.module.scss.cjs +45 -42
- package/dist/components/Sidebar/Sidebar.module.scss.js +45 -42
- package/dist/components/Sidebar/index.cjs +2 -0
- package/dist/components/Sidebar/index.d.ts +6 -1
- package/dist/components/Sidebar/index.d.ts.map +1 -1
- package/dist/components/Sidebar/index.js +2 -0
- package/dist/components/Text/Text.module.scss.cjs +63 -51
- package/dist/components/Text/Text.module.scss.js +63 -51
- package/dist/components/Text/index.d.ts +4 -2
- package/dist/components/Text/index.d.ts.map +1 -1
- package/dist/data-table.cjs +210 -28
- package/dist/data-table.js +189 -29
- package/dist/datepicker.cjs +63 -14
- package/dist/datepicker.js +41 -14
- package/dist/editor.cjs +67 -16
- package/dist/editor.js +45 -16
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/markdown.cjs +63 -19
- package/dist/markdown.js +41 -19
- package/fragments.json +1 -1
- package/package.json +2 -2
- package/src/components/Badge/Badge.contract.json +28 -5
- package/src/components/Badge/Badge.module.scss +21 -0
- package/src/components/Badge/index.tsx +10 -1
- package/src/components/Button/Button.contract.json +9 -3
- package/src/components/Button/Button.module.scss +34 -0
- package/src/components/Button/index.tsx +11 -1
- package/src/components/Chart/Chart.contract.json +7 -0
- package/src/components/Chart/index.tsx +44 -27
- package/src/components/CodeBlock/CodeBlock.contract.json +7 -0
- package/src/components/CodeBlock/CodeBlock.module.scss +7 -2
- package/src/components/CodeBlock/index.tsx +38 -6
- package/src/components/ColorPicker/ColorPicker.contract.json +9 -1
- package/src/components/ColorPicker/index.tsx +42 -12
- package/src/components/Combobox/Combobox.module.scss +4 -13
- package/src/components/ConversationList/ConversationList.contract.json +16 -1
- package/src/components/ConversationList/ConversationList.module.scss +12 -0
- package/src/components/ConversationList/index.tsx +40 -26
- package/src/components/DataTable/DataTable.contract.json +8 -1
- package/src/components/DataTable/DataTable.module.scss +5 -0
- package/src/components/DataTable/index.tsx +282 -51
- package/src/components/DatePicker/DatePicker.contract.json +8 -1
- package/src/components/DatePicker/index.tsx +51 -22
- package/src/components/Editor/Editor.contract.json +19 -1
- package/src/components/Editor/index.tsx +67 -23
- package/src/components/Listbox/Listbox.module.scss +3 -11
- package/src/components/Markdown/Markdown.contract.json +15 -1
- package/src/components/Markdown/Markdown.module.scss +18 -1
- package/src/components/Markdown/index.tsx +58 -24
- package/src/components/Menu/Menu.module.scss +12 -2
- package/src/components/Message/Message.contract.json +3 -0
- package/src/components/Message/Message.module.scss +33 -4
- package/src/components/Message/index.tsx +7 -1
- package/src/components/Pagination/Pagination.contract.json +1 -0
- package/src/components/Pagination/Pagination.module.scss +5 -4
- package/src/components/Prompt/Prompt.contract.json +40 -1
- package/src/components/Prompt/Prompt.module.scss +351 -4
- package/src/components/Prompt/index.tsx +324 -0
- package/src/components/Select/Select.contract.json +11 -1
- package/src/components/Select/Select.module.scss +80 -13
- package/src/components/Select/index.tsx +73 -7
- package/src/components/Sidebar/Sidebar.contract.json +1 -0
- package/src/components/Sidebar/Sidebar.module.scss +10 -0
- package/src/components/Sidebar/index.tsx +7 -0
- package/src/components/Text/Text.contract.json +7 -4
- package/src/components/Text/Text.module.scss +18 -0
- package/src/components/Text/index.tsx +4 -2
- package/src/index.ts +1 -0
- package/src/tokens/_mixins.scss +39 -4
- package/src/tokens/_variables.scss +30 -0
|
@@ -1,89 +1,101 @@
|
|
|
1
|
-
const text = "
|
|
2
|
-
const variantSectionLabel = "_variant-section-
|
|
3
|
-
const size2Xs = "_size-
|
|
4
|
-
const sizeXs = "_size-
|
|
5
|
-
const sizeSm = "_size-
|
|
6
|
-
const sizeBase = "_size-
|
|
7
|
-
const sizeMd = "_size-
|
|
8
|
-
const sizeLg = "_size-
|
|
9
|
-
const sizeXl = "_size-
|
|
10
|
-
const size2Xl = "_size-
|
|
11
|
-
const size3Xl = "_size-
|
|
12
|
-
const size4Xl = "_size-
|
|
13
|
-
const weightNormal = "_weight-
|
|
14
|
-
const weightMedium = "_weight-
|
|
15
|
-
const weightSemibold = "_weight-
|
|
16
|
-
const weightBold = "_weight-
|
|
17
|
-
const colorPrimary = "_color-
|
|
18
|
-
const colorSecondary = "_color-
|
|
19
|
-
const colorTertiary = "_color-
|
|
20
|
-
const colorMuted = "_color-
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
const
|
|
1
|
+
const text = "_text_1159j_1";
|
|
2
|
+
const variantSectionLabel = "_variant-section-label_1159j_7";
|
|
3
|
+
const size2Xs = "_size-2xs_1159j_17";
|
|
4
|
+
const sizeXs = "_size-xs_1159j_21";
|
|
5
|
+
const sizeSm = "_size-sm_1159j_25";
|
|
6
|
+
const sizeBase = "_size-base_1159j_29";
|
|
7
|
+
const sizeMd = "_size-md_1159j_33";
|
|
8
|
+
const sizeLg = "_size-lg_1159j_37";
|
|
9
|
+
const sizeXl = "_size-xl_1159j_41";
|
|
10
|
+
const size2Xl = "_size-2xl_1159j_45";
|
|
11
|
+
const size3Xl = "_size-3xl_1159j_49";
|
|
12
|
+
const size4Xl = "_size-4xl_1159j_55";
|
|
13
|
+
const weightNormal = "_weight-normal_1159j_61";
|
|
14
|
+
const weightMedium = "_weight-medium_1159j_65";
|
|
15
|
+
const weightSemibold = "_weight-semibold_1159j_69";
|
|
16
|
+
const weightBold = "_weight-bold_1159j_73";
|
|
17
|
+
const colorPrimary = "_color-primary_1159j_77";
|
|
18
|
+
const colorSecondary = "_color-secondary_1159j_81";
|
|
19
|
+
const colorTertiary = "_color-tertiary_1159j_85";
|
|
20
|
+
const colorMuted = "_color-muted_1159j_86";
|
|
21
|
+
const colorSuccess = "_color-success_1159j_90";
|
|
22
|
+
const colorWarning = "_color-warning_1159j_94";
|
|
23
|
+
const colorDanger = "_color-danger_1159j_98";
|
|
24
|
+
const mono = "_mono_1159j_102";
|
|
25
|
+
const truncate = "_truncate_1159j_106";
|
|
26
|
+
const lineClamp = "_lineClamp_1159j_112";
|
|
27
|
+
const trackingNormal = "_tracking-normal_1159j_120";
|
|
28
|
+
const trackingTight = "_tracking-tight_1159j_124";
|
|
29
|
+
const trackingTighter = "_tracking-tighter_1159j_128";
|
|
30
|
+
const trackingTightest = "_tracking-tightest_1159j_132";
|
|
31
|
+
const tabularNums = "_tabularNums_1159j_136";
|
|
29
32
|
const styles = {
|
|
30
33
|
text,
|
|
31
|
-
"variant-section-label": "_variant-section-
|
|
34
|
+
"variant-section-label": "_variant-section-label_1159j_7",
|
|
32
35
|
variantSectionLabel,
|
|
33
|
-
"size-2xs": "_size-
|
|
36
|
+
"size-2xs": "_size-2xs_1159j_17",
|
|
34
37
|
size2Xs,
|
|
35
|
-
"size-xs": "_size-
|
|
38
|
+
"size-xs": "_size-xs_1159j_21",
|
|
36
39
|
sizeXs,
|
|
37
|
-
"size-sm": "_size-
|
|
40
|
+
"size-sm": "_size-sm_1159j_25",
|
|
38
41
|
sizeSm,
|
|
39
|
-
"size-base": "_size-
|
|
42
|
+
"size-base": "_size-base_1159j_29",
|
|
40
43
|
sizeBase,
|
|
41
|
-
"size-md": "_size-
|
|
44
|
+
"size-md": "_size-md_1159j_33",
|
|
42
45
|
sizeMd,
|
|
43
|
-
"size-lg": "_size-
|
|
46
|
+
"size-lg": "_size-lg_1159j_37",
|
|
44
47
|
sizeLg,
|
|
45
|
-
"size-xl": "_size-
|
|
48
|
+
"size-xl": "_size-xl_1159j_41",
|
|
46
49
|
sizeXl,
|
|
47
|
-
"size-2xl": "_size-
|
|
50
|
+
"size-2xl": "_size-2xl_1159j_45",
|
|
48
51
|
size2Xl,
|
|
49
|
-
"size-3xl": "_size-
|
|
52
|
+
"size-3xl": "_size-3xl_1159j_49",
|
|
50
53
|
size3Xl,
|
|
51
|
-
"size-4xl": "_size-
|
|
54
|
+
"size-4xl": "_size-4xl_1159j_55",
|
|
52
55
|
size4Xl,
|
|
53
|
-
"weight-normal": "_weight-
|
|
56
|
+
"weight-normal": "_weight-normal_1159j_61",
|
|
54
57
|
weightNormal,
|
|
55
|
-
"weight-medium": "_weight-
|
|
58
|
+
"weight-medium": "_weight-medium_1159j_65",
|
|
56
59
|
weightMedium,
|
|
57
|
-
"weight-semibold": "_weight-
|
|
60
|
+
"weight-semibold": "_weight-semibold_1159j_69",
|
|
58
61
|
weightSemibold,
|
|
59
|
-
"weight-bold": "_weight-
|
|
62
|
+
"weight-bold": "_weight-bold_1159j_73",
|
|
60
63
|
weightBold,
|
|
61
|
-
"color-primary": "_color-
|
|
64
|
+
"color-primary": "_color-primary_1159j_77",
|
|
62
65
|
colorPrimary,
|
|
63
|
-
"color-secondary": "_color-
|
|
66
|
+
"color-secondary": "_color-secondary_1159j_81",
|
|
64
67
|
colorSecondary,
|
|
65
|
-
"color-tertiary": "_color-
|
|
68
|
+
"color-tertiary": "_color-tertiary_1159j_85",
|
|
66
69
|
colorTertiary,
|
|
67
|
-
"color-muted": "_color-
|
|
70
|
+
"color-muted": "_color-muted_1159j_86",
|
|
68
71
|
colorMuted,
|
|
72
|
+
"color-success": "_color-success_1159j_90",
|
|
73
|
+
colorSuccess,
|
|
74
|
+
"color-warning": "_color-warning_1159j_94",
|
|
75
|
+
colorWarning,
|
|
76
|
+
"color-danger": "_color-danger_1159j_98",
|
|
77
|
+
colorDanger,
|
|
69
78
|
mono,
|
|
70
79
|
truncate,
|
|
71
80
|
lineClamp,
|
|
72
|
-
"tracking-normal": "_tracking-
|
|
81
|
+
"tracking-normal": "_tracking-normal_1159j_120",
|
|
73
82
|
trackingNormal,
|
|
74
|
-
"tracking-tight": "_tracking-
|
|
83
|
+
"tracking-tight": "_tracking-tight_1159j_124",
|
|
75
84
|
trackingTight,
|
|
76
|
-
"tracking-tighter": "_tracking-
|
|
85
|
+
"tracking-tighter": "_tracking-tighter_1159j_128",
|
|
77
86
|
trackingTighter,
|
|
78
|
-
"tracking-tightest": "_tracking-
|
|
87
|
+
"tracking-tightest": "_tracking-tightest_1159j_132",
|
|
79
88
|
trackingTightest,
|
|
80
89
|
tabularNums
|
|
81
90
|
};
|
|
82
91
|
export {
|
|
92
|
+
colorDanger,
|
|
83
93
|
colorMuted,
|
|
84
94
|
colorPrimary,
|
|
85
95
|
colorSecondary,
|
|
96
|
+
colorSuccess,
|
|
86
97
|
colorTertiary,
|
|
98
|
+
colorWarning,
|
|
87
99
|
styles as default,
|
|
88
100
|
lineClamp,
|
|
89
101
|
mono,
|
|
@@ -17,9 +17,11 @@ export interface TextProps extends Omit<React.HTMLAttributes<HTMLElement>, 'colo
|
|
|
17
17
|
/** Font weight.
|
|
18
18
|
* @default "normal" */
|
|
19
19
|
weight?: 'normal' | 'medium' | 'semibold' | 'bold';
|
|
20
|
-
/** Text color. `"muted"` is an alias for `"tertiary"`.
|
|
20
|
+
/** Text color. `"muted"` is an alias for `"tertiary"`. `"success" | "warning" | "danger"`
|
|
21
|
+
* are for a run of text that carries a state on its own; prefer Badge or Alert when the
|
|
22
|
+
* state deserves a container.
|
|
21
23
|
* @default "primary" */
|
|
22
|
-
color?: 'primary' | 'secondary' | 'tertiary' | 'muted';
|
|
24
|
+
color?: 'primary' | 'secondary' | 'tertiary' | 'muted' | 'success' | 'warning' | 'danger';
|
|
23
25
|
/** Font family.
|
|
24
26
|
* @default "sans" */
|
|
25
27
|
font?: 'sans' | 'mono';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Text/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B;;;GAGG;AACH,MAAM,WAAW,SAAU,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;IACjF,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;yBACqB;IACrB,EAAE,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,GAAG,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,QAAQ,GAAG,IAAI,GAAG,OAAO,GAAG,MAAM,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,SAAS,GAAG,YAAY,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;IAClN,0BAA0B;IAC1B,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B;;6DAEyD;IACzD,IAAI,CAAC,EAAE,KAAK,GAAG,IAAI,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;IACjF;2BACuB;IACvB,MAAM,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,UAAU,GAAG,MAAM,CAAC;IACnD;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Text/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B;;;GAGG;AACH,MAAM,WAAW,SAAU,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;IACjF,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;yBACqB;IACrB,EAAE,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,GAAG,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,QAAQ,GAAG,IAAI,GAAG,OAAO,GAAG,MAAM,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,SAAS,GAAG,YAAY,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;IAClN,0BAA0B;IAC1B,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B;;6DAEyD;IACzD,IAAI,CAAC,EAAE,KAAK,GAAG,IAAI,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;IACjF;2BACuB;IACvB,MAAM,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,UAAU,GAAG,MAAM,CAAC;IACnD;;;4BAGwB;IACxB,KAAK,CAAC,EAAE,SAAS,GAAG,WAAW,GAAG,UAAU,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;IAC1F;yBACqB;IACrB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,oDAAoD;IACpD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iEAAiE;IACjE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;4EAEwE;IACxE,aAAa,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,UAAU,CAAC;IAC5D;mEAC+D;IAC/D,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAkDD,eAAO,MAAM,IAAI;;CAEf,CAAC"}
|
package/dist/data-table.cjs
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use strict";
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
18
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
19
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
20
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
21
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
22
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
23
|
+
mod
|
|
24
|
+
));
|
|
3
25
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
26
|
const jsxRuntime = require("react/jsx-runtime");
|
|
5
27
|
const React = require("react");
|
|
@@ -25,16 +47,38 @@ function _interopNamespaceDefault(e) {
|
|
|
25
47
|
}
|
|
26
48
|
const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
|
|
27
49
|
let _reactTable = null;
|
|
28
|
-
let
|
|
50
|
+
let _reactTableLoadPromise = null;
|
|
29
51
|
let _reactTableFailed = false;
|
|
30
52
|
function loadReactTable() {
|
|
31
|
-
if (
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
53
|
+
if (!_reactTableLoadPromise) {
|
|
54
|
+
_reactTableLoadPromise = (async () => {
|
|
55
|
+
try {
|
|
56
|
+
_reactTable = await import("@tanstack/react-table");
|
|
57
|
+
} catch {
|
|
58
|
+
_reactTableFailed = true;
|
|
59
|
+
if (process.env.NODE_ENV === "development") {
|
|
60
|
+
console.warn(
|
|
61
|
+
"[@usefragments/ui] DataTable: @tanstack/react-table is not installed. Rendering a static table without sorting, selection, or expansion. Install it with: npm install @tanstack/react-table"
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
})();
|
|
37
66
|
}
|
|
67
|
+
return _reactTableLoadPromise;
|
|
68
|
+
}
|
|
69
|
+
function useReactTableDeps() {
|
|
70
|
+
const [, rerender] = React__namespace.useReducer((n) => n + 1, 0);
|
|
71
|
+
React__namespace.useEffect(() => {
|
|
72
|
+
if (_reactTable || _reactTableFailed) return;
|
|
73
|
+
let active = true;
|
|
74
|
+
void loadReactTable().then(() => {
|
|
75
|
+
if (active) rerender();
|
|
76
|
+
});
|
|
77
|
+
return () => {
|
|
78
|
+
active = false;
|
|
79
|
+
};
|
|
80
|
+
}, []);
|
|
81
|
+
return _reactTable ? "ready" : _reactTableFailed ? "failed" : "pending";
|
|
38
82
|
}
|
|
39
83
|
function getColumnSizeStyle(column) {
|
|
40
84
|
const { size, minSize, maxSize } = column.columnDef;
|
|
@@ -49,6 +93,24 @@ function getColumnSizeStyle(column) {
|
|
|
49
93
|
maxWidth: maxSize ?? resolvedSize
|
|
50
94
|
};
|
|
51
95
|
}
|
|
96
|
+
function computeTableClasses(opts) {
|
|
97
|
+
const densityClass = opts.density === "condensed" ? DataTable_module.default.densityCondensed : opts.density === "regular" ? DataTable_module.default.densityRegular : opts.density === "relaxed" ? DataTable_module.default.densityRelaxed : void 0;
|
|
98
|
+
const rootClasses = [
|
|
99
|
+
DataTable_module.default.table,
|
|
100
|
+
opts.hasExplicitColumnSizing && DataTable_module.default.fixedLayout,
|
|
101
|
+
DataTable_module.default[opts.size],
|
|
102
|
+
densityClass,
|
|
103
|
+
opts.striped && DataTable_module.default.striped,
|
|
104
|
+
opts.className
|
|
105
|
+
].filter(Boolean).join(" ");
|
|
106
|
+
const wrapperClasses = [
|
|
107
|
+
DataTable_module.default.wrapper,
|
|
108
|
+
opts.bordered && DataTable_module.default.bordered,
|
|
109
|
+
opts.wrapperClassName,
|
|
110
|
+
opts.wrapperPropsClassName
|
|
111
|
+
].filter(Boolean).join(" ");
|
|
112
|
+
return { rootClasses, wrapperClasses };
|
|
113
|
+
}
|
|
52
114
|
function isInteractiveTarget(target, currentTarget) {
|
|
53
115
|
if (!(target instanceof Element)) return false;
|
|
54
116
|
const interactiveElement = target.closest(
|
|
@@ -58,7 +120,7 @@ function isInteractiveTarget(target, currentTarget) {
|
|
|
58
120
|
interactiveElement && interactiveElement !== currentTarget && currentTarget.contains(interactiveElement)
|
|
59
121
|
);
|
|
60
122
|
}
|
|
61
|
-
function
|
|
123
|
+
function DataTableLive({
|
|
62
124
|
columns: userColumns,
|
|
63
125
|
data,
|
|
64
126
|
getRowId,
|
|
@@ -92,12 +154,6 @@ function DataTableRoot({
|
|
|
92
154
|
"aria-describedby": ariaDescribedBy,
|
|
93
155
|
...htmlProps
|
|
94
156
|
}) {
|
|
95
|
-
loadReactTable();
|
|
96
|
-
if (_reactTableFailed || !_reactTable) {
|
|
97
|
-
throw new Error(
|
|
98
|
-
"[@usefragments/ui] DataTable: @tanstack/react-table is not installed. Install it with: npm install @tanstack/react-table"
|
|
99
|
-
);
|
|
100
|
-
}
|
|
101
157
|
const { flexRender, getCoreRowModel, getExpandedRowModel, getSortedRowModel, useReactTable } = _reactTable;
|
|
102
158
|
const tableRef = React__namespace.useRef(null);
|
|
103
159
|
DataTable_support.useArrowKeyRowNav(tableRef, !!onRowClick);
|
|
@@ -169,22 +225,17 @@ function DataTableRoot({
|
|
|
169
225
|
enableExpanding: hasSubRows
|
|
170
226
|
});
|
|
171
227
|
const isEmpty = !loading && data.length === 0;
|
|
172
|
-
const densityClass = density === "condensed" ? DataTable_module.default.densityCondensed : density === "regular" ? DataTable_module.default.densityRegular : density === "relaxed" ? DataTable_module.default.densityRelaxed : void 0;
|
|
173
|
-
const rootClasses = [
|
|
174
|
-
DataTable_module.default.table,
|
|
175
|
-
hasExplicitColumnSizing && DataTable_module.default.fixedLayout,
|
|
176
|
-
DataTable_module.default[size],
|
|
177
|
-
densityClass,
|
|
178
|
-
striped && DataTable_module.default.striped,
|
|
179
|
-
className
|
|
180
|
-
].filter(Boolean).join(" ");
|
|
181
228
|
const { className: wrapperPropsClassName, ...restWrapperProps } = wrapperProps ?? {};
|
|
182
|
-
const wrapperClasses =
|
|
183
|
-
|
|
184
|
-
|
|
229
|
+
const { rootClasses, wrapperClasses } = computeTableClasses({
|
|
230
|
+
size,
|
|
231
|
+
density,
|
|
232
|
+
striped,
|
|
233
|
+
bordered,
|
|
234
|
+
hasExplicitColumnSizing,
|
|
235
|
+
className,
|
|
185
236
|
wrapperClassName,
|
|
186
237
|
wrapperPropsClassName
|
|
187
|
-
|
|
238
|
+
});
|
|
188
239
|
if (isEmpty) {
|
|
189
240
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { ...restWrapperProps, className: wrapperClasses, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
190
241
|
"table",
|
|
@@ -327,6 +378,135 @@ function DataTableRoot({
|
|
|
327
378
|
}
|
|
328
379
|
) });
|
|
329
380
|
}
|
|
381
|
+
function staticColumnSizeStyle(col) {
|
|
382
|
+
const { size, minSize, maxSize } = col;
|
|
383
|
+
if (size === void 0 && minSize === void 0 && maxSize === void 0) return void 0;
|
|
384
|
+
const resolved = size ?? minSize ?? maxSize;
|
|
385
|
+
return { width: resolved, minWidth: minSize ?? resolved, maxWidth: maxSize ?? resolved };
|
|
386
|
+
}
|
|
387
|
+
function staticCellContent(col, row, index2) {
|
|
388
|
+
const raw = col.accessorFn ? col.accessorFn(row) : col.accessorKey ? row[col.accessorKey] : void 0;
|
|
389
|
+
if (typeof col.cell === "function") {
|
|
390
|
+
try {
|
|
391
|
+
return col.cell({
|
|
392
|
+
row: { original: row, id: String(index2), index: index2, depth: 0 },
|
|
393
|
+
getValue: () => raw,
|
|
394
|
+
column: { id: col.id ?? col.accessorKey ?? "" }
|
|
395
|
+
});
|
|
396
|
+
} catch {
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
return typeof raw === "string" || typeof raw === "number" ? raw : null;
|
|
400
|
+
}
|
|
401
|
+
function DataTableStatic({
|
|
402
|
+
pending,
|
|
403
|
+
columns,
|
|
404
|
+
data,
|
|
405
|
+
getRowId,
|
|
406
|
+
emptyMessage = "No data available",
|
|
407
|
+
emptyState,
|
|
408
|
+
loading = false,
|
|
409
|
+
skeletonRows = 6,
|
|
410
|
+
density,
|
|
411
|
+
hideHeader = false,
|
|
412
|
+
size = "md",
|
|
413
|
+
className,
|
|
414
|
+
caption,
|
|
415
|
+
captionHidden = false,
|
|
416
|
+
striped = false,
|
|
417
|
+
bordered = false,
|
|
418
|
+
wrapperClassName,
|
|
419
|
+
wrapperProps,
|
|
420
|
+
"aria-label": ariaLabel,
|
|
421
|
+
"aria-describedby": ariaDescribedBy,
|
|
422
|
+
// Interactive props are inert without the peer — accepted but unused.
|
|
423
|
+
sortable: _sortable,
|
|
424
|
+
sorting: _sorting,
|
|
425
|
+
onSortingChange: _onSortingChange,
|
|
426
|
+
selectable: _selectable,
|
|
427
|
+
showCheckbox: _showCheckbox,
|
|
428
|
+
rowSelection: _rowSelection,
|
|
429
|
+
onRowSelectionChange: _onRowSelectionChange,
|
|
430
|
+
onRowClick: _onRowClick,
|
|
431
|
+
getRowProps: _getRowProps,
|
|
432
|
+
getSubRows: _getSubRows,
|
|
433
|
+
expanded: _expanded,
|
|
434
|
+
onExpandedChange: _onExpandedChange,
|
|
435
|
+
...htmlProps
|
|
436
|
+
}) {
|
|
437
|
+
const hasExplicitColumnSizing = columns.some(
|
|
438
|
+
(column) => column.size !== void 0 || column.minSize !== void 0 || column.maxSize !== void 0
|
|
439
|
+
);
|
|
440
|
+
const { className: wrapperPropsClassName, ...restWrapperProps } = wrapperProps ?? {};
|
|
441
|
+
const { rootClasses, wrapperClasses } = computeTableClasses({
|
|
442
|
+
size,
|
|
443
|
+
density,
|
|
444
|
+
striped,
|
|
445
|
+
bordered,
|
|
446
|
+
hasExplicitColumnSizing,
|
|
447
|
+
className,
|
|
448
|
+
wrapperClassName,
|
|
449
|
+
wrapperPropsClassName
|
|
450
|
+
});
|
|
451
|
+
const showSkeleton = pending || loading;
|
|
452
|
+
const isEmpty = !showSkeleton && data.length === 0;
|
|
453
|
+
const columnCount = Math.max(columns.length, 1);
|
|
454
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { ...restWrapperProps, className: wrapperClasses, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
455
|
+
"table",
|
|
456
|
+
{
|
|
457
|
+
...htmlProps,
|
|
458
|
+
className: rootClasses,
|
|
459
|
+
"aria-label": ariaLabel,
|
|
460
|
+
"aria-describedby": ariaDescribedBy,
|
|
461
|
+
"aria-busy": showSkeleton || void 0,
|
|
462
|
+
children: [
|
|
463
|
+
caption && /* @__PURE__ */ jsxRuntime.jsx("caption", { className: captionHidden ? DataTable_module.default.captionHidden : DataTable_module.default.caption, children: caption }),
|
|
464
|
+
!hideHeader && !isEmpty && /* @__PURE__ */ jsxRuntime.jsx("thead", { className: DataTable_module.default.thead, children: /* @__PURE__ */ jsxRuntime.jsx("tr", { className: DataTable_module.default.headerRow, children: columns.map((col, colIndex) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
465
|
+
"th",
|
|
466
|
+
{
|
|
467
|
+
className: DataTable_module.default.th,
|
|
468
|
+
style: staticColumnSizeStyle(col),
|
|
469
|
+
scope: "col",
|
|
470
|
+
"data-align": col.align,
|
|
471
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: DataTable_module.default.headerContent, children: typeof col.header === "string" ? col.header : col.id ?? col.accessorKey ?? "" })
|
|
472
|
+
},
|
|
473
|
+
col.id ?? col.accessorKey ?? colIndex
|
|
474
|
+
)) }) }),
|
|
475
|
+
/* @__PURE__ */ jsxRuntime.jsx("tbody", { className: DataTable_module.default.tbody, children: showSkeleton ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
476
|
+
DataTable_support.DataTableSkeletonRows,
|
|
477
|
+
{
|
|
478
|
+
rowCount: skeletonRows,
|
|
479
|
+
columnCount,
|
|
480
|
+
rowClassName: DataTable_module.default.row,
|
|
481
|
+
cellClassName: DataTable_module.default.td,
|
|
482
|
+
barClassName: DataTable_module.default.skeletonBar
|
|
483
|
+
}
|
|
484
|
+
) : isEmpty ? /* @__PURE__ */ jsxRuntime.jsx("tr", { className: DataTable_module.default.row, children: /* @__PURE__ */ jsxRuntime.jsx("td", { className: DataTable_module.default.td, colSpan: columnCount, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: DataTable_module.default.emptyState, children: emptyState ?? /* @__PURE__ */ jsxRuntime.jsx("span", { className: DataTable_module.default.emptyMessage, children: emptyMessage }) }) }) }) : data.map((row, rowIndex) => {
|
|
485
|
+
const rowKey = (getRowId == null ? void 0 : getRowId(row)) ?? rowIndex;
|
|
486
|
+
return /* @__PURE__ */ jsxRuntime.jsx("tr", { className: DataTable_module.default.row, children: columns.map((col, colIndex) => {
|
|
487
|
+
const content = staticCellContent(col, row, rowIndex);
|
|
488
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
489
|
+
"td",
|
|
490
|
+
{
|
|
491
|
+
className: [DataTable_module.default.td, col.truncate && DataTable_module.default.truncate].filter(Boolean).join(" "),
|
|
492
|
+
"data-align": col.align,
|
|
493
|
+
title: typeof content === "string" ? content : void 0,
|
|
494
|
+
style: staticColumnSizeStyle(col),
|
|
495
|
+
children: content
|
|
496
|
+
},
|
|
497
|
+
col.id ?? col.accessorKey ?? colIndex
|
|
498
|
+
);
|
|
499
|
+
}) }, rowKey);
|
|
500
|
+
}) })
|
|
501
|
+
]
|
|
502
|
+
}
|
|
503
|
+
) });
|
|
504
|
+
}
|
|
505
|
+
function DataTableRoot(props) {
|
|
506
|
+
const deps = useReactTableDeps();
|
|
507
|
+
if (deps === "ready") return /* @__PURE__ */ jsxRuntime.jsx(DataTableLive, { ...props });
|
|
508
|
+
return /* @__PURE__ */ jsxRuntime.jsx(DataTableStatic, { ...props, pending: deps === "pending" });
|
|
509
|
+
}
|
|
330
510
|
function createColumns(columns) {
|
|
331
511
|
return columns.map((col) => ({
|
|
332
512
|
id: col.key,
|
|
@@ -340,7 +520,9 @@ function createColumns(columns) {
|
|
|
340
520
|
}
|
|
341
521
|
const DataTable = Object.assign(DataTableRoot, {
|
|
342
522
|
Root: DataTableRoot,
|
|
343
|
-
Columns: createColumns
|
|
523
|
+
Columns: createColumns,
|
|
524
|
+
/** Start resolving @tanstack/react-table before first render (optional). */
|
|
525
|
+
preload: loadReactTable
|
|
344
526
|
});
|
|
345
527
|
exports.DataTable = DataTable;
|
|
346
528
|
exports.createColumns = createColumns;
|