@rovula/ui 0.0.11 → 0.0.13
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 +55 -5
- package/dist/cjs/bundle.js +23 -1
- package/dist/cjs/bundle.js.map +1 -1
- package/dist/cjs/types/components/DataTable/DataTable.d.ts +6 -11
- package/dist/cjs/types/components/DataTable/DataTable.stories.d.ts +3 -0
- package/dist/cjs/types/components/Table/Table.d.ts +3 -1
- package/dist/cjs/types/components/Table/Table.stories.d.ts +4 -1
- package/dist/cjs/types/index.d.ts +2 -1
- package/dist/components/DataTable/DataTable.js +62 -23
- package/dist/components/DataTable/DataTable.stories.js +16 -25
- package/dist/components/Dropdown/Dropdown.js +39 -2
- package/dist/components/Dropdown/Dropdown.stories.js +29 -4
- package/dist/components/Table/Table.js +6 -6
- package/dist/esm/bundle.css +55 -5
- package/dist/esm/bundle.js +23 -1
- package/dist/esm/bundle.js.map +1 -1
- package/dist/esm/types/components/DataTable/DataTable.d.ts +6 -11
- package/dist/esm/types/components/DataTable/DataTable.stories.d.ts +3 -0
- package/dist/esm/types/components/Table/Table.d.ts +3 -1
- package/dist/esm/types/components/Table/Table.stories.d.ts +4 -1
- package/dist/esm/types/index.d.ts +2 -1
- package/dist/index.d.ts +14 -2
- package/dist/index.js +1 -0
- package/dist/src/theme/global.css +71 -6
- package/package.json +2 -1
- package/src/components/DataTable/DataTable.stories.tsx +26 -30
- package/src/components/DataTable/DataTable.tsx +111 -45
- package/src/components/Dropdown/Dropdown.stories.tsx +25 -3
- package/src/components/Dropdown/Dropdown.tsx +61 -2
- package/src/components/Table/Table.tsx +17 -8
- package/src/index.ts +2 -1
- package/dist/cjs/types/components/ui/table.d.ts +0 -10
- package/dist/components/ui/table.js +0 -66
- package/dist/esm/types/components/ui/table.d.ts +0 -10
- package/src/components/ui/table.tsx +0 -117
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useRef } from "react";
|
|
1
|
+
import React, { useRef, useState } from "react";
|
|
2
2
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
3
|
import Dropdown, { Options } from "./Dropdown";
|
|
4
4
|
import Button from "../Button/Button";
|
|
@@ -53,15 +53,37 @@ export const Default = {
|
|
|
53
53
|
const DropdownWithRef = (props: any) => {
|
|
54
54
|
const inputRef = useRef<HTMLInputElement | null>(null);
|
|
55
55
|
|
|
56
|
+
const [options, setOptions] = useState(customOptions);
|
|
57
|
+
const [value, setValue] = useState<Options>({
|
|
58
|
+
label: "",
|
|
59
|
+
value: "",
|
|
60
|
+
});
|
|
61
|
+
const [text, setText] = useState("");
|
|
62
|
+
|
|
56
63
|
return (
|
|
57
64
|
<Dropdown
|
|
58
65
|
id="1"
|
|
59
66
|
size="lg"
|
|
60
67
|
{...props}
|
|
68
|
+
value={value}
|
|
69
|
+
options={options}
|
|
61
70
|
ref={inputRef}
|
|
62
71
|
labelClassName="peer-focus:bg-red-500"
|
|
72
|
+
onSelect={setValue}
|
|
73
|
+
onChangeText={(e) => setText(e.target.value)}
|
|
63
74
|
onKeyDown={(e) => {
|
|
64
75
|
if (e.code === "Enter") {
|
|
76
|
+
setOptions((options) => [
|
|
77
|
+
...options,
|
|
78
|
+
{
|
|
79
|
+
label: text,
|
|
80
|
+
value: text,
|
|
81
|
+
},
|
|
82
|
+
]);
|
|
83
|
+
setValue({
|
|
84
|
+
label: text,
|
|
85
|
+
value: text,
|
|
86
|
+
});
|
|
65
87
|
inputRef.current?.blur?.();
|
|
66
88
|
}
|
|
67
89
|
}}
|
|
@@ -83,7 +105,7 @@ export const WithRef = {
|
|
|
83
105
|
};
|
|
84
106
|
return (
|
|
85
107
|
<div className="flex flex-row gap-4 w-full">
|
|
86
|
-
<DropdownWithRef id="1" size="lg" options={options} {...args}
|
|
108
|
+
<DropdownWithRef id="1" size="lg" options={options} {...args} />
|
|
87
109
|
</div>
|
|
88
110
|
);
|
|
89
111
|
},
|
|
@@ -126,7 +148,7 @@ export const CustomOption = {
|
|
|
126
148
|
};
|
|
127
149
|
return (
|
|
128
150
|
<div className="flex flex-row gap-4 w-full">
|
|
129
|
-
<DropdownWithRef id="1" size="lg" options={options} {...args}
|
|
151
|
+
<DropdownWithRef id="1" size="lg" options={options} {...args} />
|
|
130
152
|
</div>
|
|
131
153
|
);
|
|
132
154
|
},
|
|
@@ -5,6 +5,7 @@ import React, {
|
|
|
5
5
|
useCallback,
|
|
6
6
|
useEffect,
|
|
7
7
|
useMemo,
|
|
8
|
+
useRef,
|
|
8
9
|
useState,
|
|
9
10
|
} from "react";
|
|
10
11
|
|
|
@@ -80,6 +81,7 @@ const Dropdown = forwardRef<HTMLInputElement, DropdownProps>(
|
|
|
80
81
|
Options | null | undefined
|
|
81
82
|
>(null);
|
|
82
83
|
const [textValue, setTextValue] = useState("");
|
|
84
|
+
const keyCode = useRef("");
|
|
83
85
|
|
|
84
86
|
useEffect(() => {
|
|
85
87
|
if (value && !selectedOption) {
|
|
@@ -147,6 +149,62 @@ const Dropdown = forwardRef<HTMLInputElement, DropdownProps>(
|
|
|
147
149
|
</ul>
|
|
148
150
|
);
|
|
149
151
|
|
|
152
|
+
const handleOnFocus = useCallback(
|
|
153
|
+
(e: React.FocusEvent<HTMLInputElement, Element>) => {
|
|
154
|
+
setIsFocused(true);
|
|
155
|
+
props?.onFocus?.(e);
|
|
156
|
+
},
|
|
157
|
+
[props?.onFocus]
|
|
158
|
+
);
|
|
159
|
+
|
|
160
|
+
const clearMismatchValue = useCallback(
|
|
161
|
+
(e: React.FocusEvent<HTMLInputElement, Element>) => {
|
|
162
|
+
const matchSelectedValue = optionsFiltered.find(
|
|
163
|
+
(opt) =>
|
|
164
|
+
opt.value === e.target?.value || opt.label === e.target?.value
|
|
165
|
+
);
|
|
166
|
+
const isMatchSelectedValue = !!matchSelectedValue;
|
|
167
|
+
|
|
168
|
+
let option = matchSelectedValue || {
|
|
169
|
+
value: "",
|
|
170
|
+
label: "",
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
if (!isMatchSelectedValue && textValue) {
|
|
174
|
+
option = {
|
|
175
|
+
value: "",
|
|
176
|
+
label: "",
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
if (keyCode.current === "Enter") {
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
setSelectedOption(option);
|
|
185
|
+
setTextValue(option.label);
|
|
186
|
+
onSelect?.(option);
|
|
187
|
+
},
|
|
188
|
+
[optionsFiltered, textValue]
|
|
189
|
+
);
|
|
190
|
+
|
|
191
|
+
const handleOnBlur = useCallback(
|
|
192
|
+
(e: React.FocusEvent<HTMLInputElement, Element>) => {
|
|
193
|
+
setIsFocused(false);
|
|
194
|
+
clearMismatchValue(e);
|
|
195
|
+
props?.onBlur?.(e);
|
|
196
|
+
},
|
|
197
|
+
[props?.onBlur]
|
|
198
|
+
);
|
|
199
|
+
|
|
200
|
+
const handleOnKeyDown = useCallback(
|
|
201
|
+
(e: React.KeyboardEvent<HTMLInputElement>) => {
|
|
202
|
+
keyCode.current = e.code;
|
|
203
|
+
props?.onKeyDown?.(e);
|
|
204
|
+
},
|
|
205
|
+
[props?.onKeyDown]
|
|
206
|
+
);
|
|
207
|
+
|
|
150
208
|
return (
|
|
151
209
|
<div className={`relative ${fullwidth ? "w-full" : ""}`}>
|
|
152
210
|
<TextInput
|
|
@@ -170,8 +228,9 @@ const Dropdown = forwardRef<HTMLInputElement, DropdownProps>(
|
|
|
170
228
|
hasClearIcon={false}
|
|
171
229
|
size={size}
|
|
172
230
|
className={customInputVariant({ size })}
|
|
173
|
-
onFocus={
|
|
174
|
-
onBlur={
|
|
231
|
+
onFocus={handleOnFocus}
|
|
232
|
+
onBlur={handleOnBlur}
|
|
233
|
+
onKeyDown={handleOnKeyDown}
|
|
175
234
|
endIcon={
|
|
176
235
|
<div className={iconWrapperVariant({ size })}>
|
|
177
236
|
<ChevronDownIcon
|
|
@@ -4,12 +4,14 @@ import { cn } from "@/utils/cn";
|
|
|
4
4
|
|
|
5
5
|
const Table = React.forwardRef<
|
|
6
6
|
HTMLTableElement,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
{
|
|
8
|
+
rootRef?: React.LegacyRef<HTMLDivElement>;
|
|
9
|
+
} & React.HTMLAttributes<HTMLTableElement>
|
|
10
|
+
>(({ className, rootRef, ...props }, ref) => (
|
|
11
|
+
<div className="relative h-full w-full overflow-auto" ref={rootRef}>
|
|
10
12
|
<table
|
|
11
13
|
ref={ref}
|
|
12
|
-
className={cn("w-full caption-bottom text-sm", className)}
|
|
14
|
+
className={cn("w-full caption-bottom text-sm border-collapse", className)}
|
|
13
15
|
{...props}
|
|
14
16
|
/>
|
|
15
17
|
</div>
|
|
@@ -20,7 +22,11 @@ const TableHeader = React.forwardRef<
|
|
|
20
22
|
HTMLTableSectionElement,
|
|
21
23
|
React.HTMLAttributes<HTMLTableSectionElement>
|
|
22
24
|
>(({ className, ...props }, ref) => (
|
|
23
|
-
<thead
|
|
25
|
+
<thead
|
|
26
|
+
ref={ref}
|
|
27
|
+
className={cn("[&_tr]:border-b bg-secondary-80", className)}
|
|
28
|
+
{...props}
|
|
29
|
+
/>
|
|
24
30
|
));
|
|
25
31
|
TableHeader.displayName = "TableHeader";
|
|
26
32
|
|
|
@@ -58,7 +64,7 @@ const TableRow = React.forwardRef<
|
|
|
58
64
|
<tr
|
|
59
65
|
ref={ref}
|
|
60
66
|
className={cn(
|
|
61
|
-
"border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-
|
|
67
|
+
"border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-grey-20",
|
|
62
68
|
className
|
|
63
69
|
)}
|
|
64
70
|
{...props}
|
|
@@ -73,7 +79,7 @@ const TableHead = React.forwardRef<
|
|
|
73
79
|
<th
|
|
74
80
|
ref={ref}
|
|
75
81
|
className={cn(
|
|
76
|
-
"h-12 px-
|
|
82
|
+
" h-12 py-3 px-6 text-left align-middle typography-body2 text-textcolor-grey-dark [&:has([role=checkbox])]:pr-4 [&:has([role=checkbox])]:w-4",
|
|
77
83
|
className
|
|
78
84
|
)}
|
|
79
85
|
{...props}
|
|
@@ -87,7 +93,10 @@ const TableCell = React.forwardRef<
|
|
|
87
93
|
>(({ className, ...props }, ref) => (
|
|
88
94
|
<td
|
|
89
95
|
ref={ref}
|
|
90
|
-
className={cn(
|
|
96
|
+
className={cn(
|
|
97
|
+
" py-3 px-6 text-left align-middle typography-body3 text-textcolor-grey-dark [&:has([role=checkbox])]:pr-4 [&:has([role=checkbox])]:w-4",
|
|
98
|
+
className
|
|
99
|
+
)}
|
|
91
100
|
{...props}
|
|
92
101
|
/>
|
|
93
102
|
));
|
package/src/index.ts
CHANGED
|
@@ -10,13 +10,14 @@ export { Checkbox } from "./components/Checkbox/Checkbox";
|
|
|
10
10
|
export { Label } from "./components/Label/Label";
|
|
11
11
|
export { Input } from "./components/Input/Input";
|
|
12
12
|
export * from "./components/Table/Table";
|
|
13
|
+
export * from "./components/DataTable/DataTable";
|
|
13
14
|
export * from "./components/Dialog/Dialog";
|
|
14
15
|
export * from "./components/AlertDialog/AlertDialog";
|
|
15
16
|
|
|
16
17
|
// Export component types
|
|
17
18
|
export type { ButtonProps } from "./components/Button/Button";
|
|
18
19
|
export type { InputProps } from "./components/TextInput/TextInput";
|
|
19
|
-
export type { DropdownProps } from "./components/Dropdown/Dropdown";
|
|
20
|
+
export type { DropdownProps, Options } from "./components/Dropdown/Dropdown";
|
|
20
21
|
|
|
21
22
|
// UTILS
|
|
22
23
|
export {
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
declare const Table: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableElement> & React.RefAttributes<HTMLTableElement>>;
|
|
3
|
-
declare const TableHeader: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableSectionElement> & React.RefAttributes<HTMLTableSectionElement>>;
|
|
4
|
-
declare const TableBody: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableSectionElement> & React.RefAttributes<HTMLTableSectionElement>>;
|
|
5
|
-
declare const TableFooter: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableSectionElement> & React.RefAttributes<HTMLTableSectionElement>>;
|
|
6
|
-
declare const TableRow: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableRowElement> & React.RefAttributes<HTMLTableRowElement>>;
|
|
7
|
-
declare const TableHead: React.ForwardRefExoticComponent<React.ThHTMLAttributes<HTMLTableCellElement> & React.RefAttributes<HTMLTableCellElement>>;
|
|
8
|
-
declare const TableCell: React.ForwardRefExoticComponent<React.TdHTMLAttributes<HTMLTableCellElement> & React.RefAttributes<HTMLTableCellElement>>;
|
|
9
|
-
declare const TableCaption: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableCaptionElement> & React.RefAttributes<HTMLTableCaptionElement>>;
|
|
10
|
-
export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption, };
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
-
var t = {};
|
|
14
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
-
t[p] = s[p];
|
|
16
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
-
t[p[i]] = s[p[i]];
|
|
20
|
-
}
|
|
21
|
-
return t;
|
|
22
|
-
};
|
|
23
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
-
import * as React from "react";
|
|
25
|
-
import { cn } from "@/utils/cn";
|
|
26
|
-
var Table = React.forwardRef(function (_a, ref) {
|
|
27
|
-
var className = _a.className, props = __rest(_a, ["className"]);
|
|
28
|
-
return (_jsx("div", { className: "relative w-full overflow-auto", children: _jsx("table", __assign({ ref: ref, className: cn("w-full caption-bottom text-sm", className) }, props)) }));
|
|
29
|
-
});
|
|
30
|
-
Table.displayName = "Table";
|
|
31
|
-
var TableHeader = React.forwardRef(function (_a, ref) {
|
|
32
|
-
var className = _a.className, props = __rest(_a, ["className"]);
|
|
33
|
-
return (_jsx("thead", __assign({ ref: ref, className: cn("[&_tr]:border-b", className) }, props)));
|
|
34
|
-
});
|
|
35
|
-
TableHeader.displayName = "TableHeader";
|
|
36
|
-
var TableBody = React.forwardRef(function (_a, ref) {
|
|
37
|
-
var className = _a.className, props = __rest(_a, ["className"]);
|
|
38
|
-
return (_jsx("tbody", __assign({ ref: ref, className: cn("[&_tr:last-child]:border-0", className) }, props)));
|
|
39
|
-
});
|
|
40
|
-
TableBody.displayName = "TableBody";
|
|
41
|
-
var TableFooter = React.forwardRef(function (_a, ref) {
|
|
42
|
-
var className = _a.className, props = __rest(_a, ["className"]);
|
|
43
|
-
return (_jsx("tfoot", __assign({ ref: ref, className: cn("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0", className) }, props)));
|
|
44
|
-
});
|
|
45
|
-
TableFooter.displayName = "TableFooter";
|
|
46
|
-
var TableRow = React.forwardRef(function (_a, ref) {
|
|
47
|
-
var className = _a.className, props = __rest(_a, ["className"]);
|
|
48
|
-
return (_jsx("tr", __assign({ ref: ref, className: cn("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted", className) }, props)));
|
|
49
|
-
});
|
|
50
|
-
TableRow.displayName = "TableRow";
|
|
51
|
-
var TableHead = React.forwardRef(function (_a, ref) {
|
|
52
|
-
var className = _a.className, props = __rest(_a, ["className"]);
|
|
53
|
-
return (_jsx("th", __assign({ ref: ref, className: cn("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0", className) }, props)));
|
|
54
|
-
});
|
|
55
|
-
TableHead.displayName = "TableHead";
|
|
56
|
-
var TableCell = React.forwardRef(function (_a, ref) {
|
|
57
|
-
var className = _a.className, props = __rest(_a, ["className"]);
|
|
58
|
-
return (_jsx("td", __assign({ ref: ref, className: cn("p-4 align-middle [&:has([role=checkbox])]:pr-0", className) }, props)));
|
|
59
|
-
});
|
|
60
|
-
TableCell.displayName = "TableCell";
|
|
61
|
-
var TableCaption = React.forwardRef(function (_a, ref) {
|
|
62
|
-
var className = _a.className, props = __rest(_a, ["className"]);
|
|
63
|
-
return (_jsx("caption", __assign({ ref: ref, className: cn("mt-4 text-sm text-muted-foreground", className) }, props)));
|
|
64
|
-
});
|
|
65
|
-
TableCaption.displayName = "TableCaption";
|
|
66
|
-
export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption, };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
declare const Table: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableElement> & React.RefAttributes<HTMLTableElement>>;
|
|
3
|
-
declare const TableHeader: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableSectionElement> & React.RefAttributes<HTMLTableSectionElement>>;
|
|
4
|
-
declare const TableBody: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableSectionElement> & React.RefAttributes<HTMLTableSectionElement>>;
|
|
5
|
-
declare const TableFooter: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableSectionElement> & React.RefAttributes<HTMLTableSectionElement>>;
|
|
6
|
-
declare const TableRow: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableRowElement> & React.RefAttributes<HTMLTableRowElement>>;
|
|
7
|
-
declare const TableHead: React.ForwardRefExoticComponent<React.ThHTMLAttributes<HTMLTableCellElement> & React.RefAttributes<HTMLTableCellElement>>;
|
|
8
|
-
declare const TableCell: React.ForwardRefExoticComponent<React.TdHTMLAttributes<HTMLTableCellElement> & React.RefAttributes<HTMLTableCellElement>>;
|
|
9
|
-
declare const TableCaption: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableCaptionElement> & React.RefAttributes<HTMLTableCaptionElement>>;
|
|
10
|
-
export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption, };
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import * as React from "react"
|
|
2
|
-
|
|
3
|
-
import { cn } from "@/utils/cn"
|
|
4
|
-
|
|
5
|
-
const Table = React.forwardRef<
|
|
6
|
-
HTMLTableElement,
|
|
7
|
-
React.HTMLAttributes<HTMLTableElement>
|
|
8
|
-
>(({ className, ...props }, ref) => (
|
|
9
|
-
<div className="relative w-full overflow-auto">
|
|
10
|
-
<table
|
|
11
|
-
ref={ref}
|
|
12
|
-
className={cn("w-full caption-bottom text-sm", className)}
|
|
13
|
-
{...props}
|
|
14
|
-
/>
|
|
15
|
-
</div>
|
|
16
|
-
))
|
|
17
|
-
Table.displayName = "Table"
|
|
18
|
-
|
|
19
|
-
const TableHeader = React.forwardRef<
|
|
20
|
-
HTMLTableSectionElement,
|
|
21
|
-
React.HTMLAttributes<HTMLTableSectionElement>
|
|
22
|
-
>(({ className, ...props }, ref) => (
|
|
23
|
-
<thead ref={ref} className={cn("[&_tr]:border-b", className)} {...props} />
|
|
24
|
-
))
|
|
25
|
-
TableHeader.displayName = "TableHeader"
|
|
26
|
-
|
|
27
|
-
const TableBody = React.forwardRef<
|
|
28
|
-
HTMLTableSectionElement,
|
|
29
|
-
React.HTMLAttributes<HTMLTableSectionElement>
|
|
30
|
-
>(({ className, ...props }, ref) => (
|
|
31
|
-
<tbody
|
|
32
|
-
ref={ref}
|
|
33
|
-
className={cn("[&_tr:last-child]:border-0", className)}
|
|
34
|
-
{...props}
|
|
35
|
-
/>
|
|
36
|
-
))
|
|
37
|
-
TableBody.displayName = "TableBody"
|
|
38
|
-
|
|
39
|
-
const TableFooter = React.forwardRef<
|
|
40
|
-
HTMLTableSectionElement,
|
|
41
|
-
React.HTMLAttributes<HTMLTableSectionElement>
|
|
42
|
-
>(({ className, ...props }, ref) => (
|
|
43
|
-
<tfoot
|
|
44
|
-
ref={ref}
|
|
45
|
-
className={cn(
|
|
46
|
-
"border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",
|
|
47
|
-
className
|
|
48
|
-
)}
|
|
49
|
-
{...props}
|
|
50
|
-
/>
|
|
51
|
-
))
|
|
52
|
-
TableFooter.displayName = "TableFooter"
|
|
53
|
-
|
|
54
|
-
const TableRow = React.forwardRef<
|
|
55
|
-
HTMLTableRowElement,
|
|
56
|
-
React.HTMLAttributes<HTMLTableRowElement>
|
|
57
|
-
>(({ className, ...props }, ref) => (
|
|
58
|
-
<tr
|
|
59
|
-
ref={ref}
|
|
60
|
-
className={cn(
|
|
61
|
-
"border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",
|
|
62
|
-
className
|
|
63
|
-
)}
|
|
64
|
-
{...props}
|
|
65
|
-
/>
|
|
66
|
-
))
|
|
67
|
-
TableRow.displayName = "TableRow"
|
|
68
|
-
|
|
69
|
-
const TableHead = React.forwardRef<
|
|
70
|
-
HTMLTableCellElement,
|
|
71
|
-
React.ThHTMLAttributes<HTMLTableCellElement>
|
|
72
|
-
>(({ className, ...props }, ref) => (
|
|
73
|
-
<th
|
|
74
|
-
ref={ref}
|
|
75
|
-
className={cn(
|
|
76
|
-
"h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",
|
|
77
|
-
className
|
|
78
|
-
)}
|
|
79
|
-
{...props}
|
|
80
|
-
/>
|
|
81
|
-
))
|
|
82
|
-
TableHead.displayName = "TableHead"
|
|
83
|
-
|
|
84
|
-
const TableCell = React.forwardRef<
|
|
85
|
-
HTMLTableCellElement,
|
|
86
|
-
React.TdHTMLAttributes<HTMLTableCellElement>
|
|
87
|
-
>(({ className, ...props }, ref) => (
|
|
88
|
-
<td
|
|
89
|
-
ref={ref}
|
|
90
|
-
className={cn("p-4 align-middle [&:has([role=checkbox])]:pr-0", className)}
|
|
91
|
-
{...props}
|
|
92
|
-
/>
|
|
93
|
-
))
|
|
94
|
-
TableCell.displayName = "TableCell"
|
|
95
|
-
|
|
96
|
-
const TableCaption = React.forwardRef<
|
|
97
|
-
HTMLTableCaptionElement,
|
|
98
|
-
React.HTMLAttributes<HTMLTableCaptionElement>
|
|
99
|
-
>(({ className, ...props }, ref) => (
|
|
100
|
-
<caption
|
|
101
|
-
ref={ref}
|
|
102
|
-
className={cn("mt-4 text-sm text-muted-foreground", className)}
|
|
103
|
-
{...props}
|
|
104
|
-
/>
|
|
105
|
-
))
|
|
106
|
-
TableCaption.displayName = "TableCaption"
|
|
107
|
-
|
|
108
|
-
export {
|
|
109
|
-
Table,
|
|
110
|
-
TableHeader,
|
|
111
|
-
TableBody,
|
|
112
|
-
TableFooter,
|
|
113
|
-
TableHead,
|
|
114
|
-
TableRow,
|
|
115
|
-
TableCell,
|
|
116
|
-
TableCaption,
|
|
117
|
-
}
|