@rovula/ui 0.1.29 → 0.1.31
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/cjs/bundle.css +21 -0
- package/dist/cjs/bundle.js +14 -9235
- package/dist/cjs/bundle.js.map +1 -1
- package/dist/cjs/types/components/DataTable/DataTable.d.ts +3 -3
- package/dist/cjs/types/components/DataTable/DataTable.stories.d.ts +29 -3
- package/dist/cjs/types/components/Icon/Icon.stories.d.ts +4 -0
- package/dist/components/DataTable/DataTable.js +16 -6
- package/dist/components/DataTable/DataTable.stories.js +60 -0
- package/dist/components/Icon/Icon.stories.js +21 -2
- package/dist/components/Table/Table.js +5 -5
- package/dist/esm/bundle.css +21 -0
- package/dist/esm/bundle.js +14 -9235
- package/dist/esm/bundle.js.map +1 -1
- package/dist/esm/types/components/DataTable/DataTable.d.ts +3 -3
- package/dist/esm/types/components/DataTable/DataTable.stories.d.ts +29 -3
- package/dist/esm/types/components/Icon/Icon.stories.d.ts +4 -0
- package/dist/index.d.ts +3 -3
- package/dist/src/theme/global.css +28 -0
- package/package.json +3 -3
- package/src/components/DataTable/DataTable.stories.tsx +141 -0
- package/src/components/DataTable/DataTable.tsx +35 -20
- package/src/components/Icon/Icon.stories.tsx +77 -5
- package/src/components/Table/Table.tsx +54 -42
|
@@ -37,51 +37,61 @@ const Table = React.forwardRef<
|
|
|
37
37
|
*/
|
|
38
38
|
scrollableWrapper?: boolean;
|
|
39
39
|
} & React.HTMLAttributes<HTMLTableElement>
|
|
40
|
-
>(
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
40
|
+
>(
|
|
41
|
+
(
|
|
42
|
+
{
|
|
43
|
+
rootClassName,
|
|
44
|
+
className,
|
|
45
|
+
rootRef,
|
|
46
|
+
bordered = false,
|
|
47
|
+
scrollableWrapper = true,
|
|
48
|
+
...props
|
|
49
|
+
},
|
|
50
|
+
ref,
|
|
51
|
+
) => {
|
|
52
|
+
const scrollClassName = cn(
|
|
53
|
+
"relative h-full w-full min-h-0 overflow-auto",
|
|
54
|
+
"ui-scrollbar ui-scrollbar-x-m ui-scrollbar-y-s",
|
|
55
|
+
);
|
|
45
56
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
57
|
+
const tableClassName = cn(
|
|
58
|
+
"min-w-full caption-bottom border-separate border-spacing-0",
|
|
59
|
+
className,
|
|
60
|
+
);
|
|
50
61
|
|
|
51
|
-
|
|
52
|
-
<table ref={ref} className={tableClassName} {...props} />
|
|
53
|
-
);
|
|
62
|
+
const tableEl = <table ref={ref} className={tableClassName} {...props} />;
|
|
54
63
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
+
if (!bordered && scrollableWrapper === false) {
|
|
65
|
+
return (
|
|
66
|
+
<table
|
|
67
|
+
ref={ref}
|
|
68
|
+
className={cn(tableClassName, rootClassName)}
|
|
69
|
+
{...props}
|
|
70
|
+
/>
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (bordered) {
|
|
75
|
+
return (
|
|
76
|
+
<div
|
|
77
|
+
className={cn(
|
|
78
|
+
"relative flex h-full w-full min-h-0 flex-col overflow-hidden rounded-md border border-table-c-border",
|
|
79
|
+
rootClassName,
|
|
80
|
+
)}
|
|
81
|
+
ref={rootRef}
|
|
82
|
+
>
|
|
83
|
+
<div className={scrollClassName}>{tableEl}</div>
|
|
84
|
+
</div>
|
|
85
|
+
);
|
|
86
|
+
}
|
|
64
87
|
|
|
65
|
-
if (bordered) {
|
|
66
88
|
return (
|
|
67
|
-
<div
|
|
68
|
-
|
|
69
|
-
"relative flex h-full w-full min-h-0 flex-col overflow-hidden rounded-md border border-table-c-border",
|
|
70
|
-
rootClassName,
|
|
71
|
-
)}
|
|
72
|
-
ref={rootRef}
|
|
73
|
-
>
|
|
74
|
-
<div className={scrollClassName}>{tableEl}</div>
|
|
89
|
+
<div className={cn(scrollClassName, rootClassName)} ref={rootRef}>
|
|
90
|
+
{tableEl}
|
|
75
91
|
</div>
|
|
76
92
|
);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
return (
|
|
80
|
-
<div className={cn(scrollClassName, rootClassName)} ref={rootRef}>
|
|
81
|
-
{tableEl}
|
|
82
|
-
</div>
|
|
83
|
-
);
|
|
84
|
-
});
|
|
93
|
+
},
|
|
94
|
+
);
|
|
85
95
|
Table.displayName = "Table";
|
|
86
96
|
|
|
87
97
|
// ---------------------------------------------------------------------------
|
|
@@ -99,7 +109,7 @@ const TableHeader = React.forwardRef<
|
|
|
99
109
|
<thead
|
|
100
110
|
ref={ref}
|
|
101
111
|
className={cn(
|
|
102
|
-
"[&_tr>th]:border-b [&_tr>th]:border-b-table-c-header-line",
|
|
112
|
+
"[&_tr>th]:box-border [&_tr>th]:border-b [&_tr>th]:border-b-table-c-header-line",
|
|
103
113
|
className,
|
|
104
114
|
)}
|
|
105
115
|
{...props}
|
|
@@ -179,7 +189,7 @@ const TableRow = React.forwardRef<
|
|
|
179
189
|
<tr
|
|
180
190
|
ref={ref}
|
|
181
191
|
className={cn(
|
|
182
|
-
"transition-colors",
|
|
192
|
+
"transition-colors box-border",
|
|
183
193
|
// Row separator — applied on cells because border-separate ignores tr borders
|
|
184
194
|
divided && [
|
|
185
195
|
"[&>td]:border-b [&>td]:border-b-table-c-row-line",
|
|
@@ -207,9 +217,10 @@ const TableHead = React.forwardRef<
|
|
|
207
217
|
<th
|
|
208
218
|
ref={ref}
|
|
209
219
|
className={cn(
|
|
210
|
-
"
|
|
220
|
+
"box-border py-3 px-3 text-left align-middle",
|
|
211
221
|
"typography-body2 text-text-contrast-max",
|
|
212
222
|
"bg-table-c-header-bg",
|
|
223
|
+
"leading-[20px]",
|
|
213
224
|
// Prefer min-width only so callers (e.g. DataTable exactWidth) can set
|
|
214
225
|
// a different width via inline style without fighting a fixed `w-10`.
|
|
215
226
|
"[&:has([role=checkbox])]:px-3 [&:has([role=checkbox])]:min-w-10",
|
|
@@ -230,8 +241,9 @@ const TableCell = React.forwardRef<
|
|
|
230
241
|
<td
|
|
231
242
|
ref={ref}
|
|
232
243
|
className={cn(
|
|
233
|
-
"
|
|
244
|
+
"box-border py-3 px-3 text-left align-middle",
|
|
234
245
|
"typography-body3 text-text-contrast-max",
|
|
246
|
+
"leading-[18px]", // content สูง 18
|
|
235
247
|
// Inherit row background from <tr> so every cell paints the same fill
|
|
236
248
|
// (some table layouts / browsers leave the last column visually “empty”).
|
|
237
249
|
"bg-inherit",
|