linkedunion-design-kit 1.9.2 → 1.9.4
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/app/layout.jsx +13 -0
- package/dist/app/page.jsx +25 -0
- package/dist/build/types/app/layout.d.ts +12 -0
- package/dist/build/types/app/layout.js +22 -0
- package/dist/build/types/app/page.d.ts +12 -0
- package/dist/build/types/app/page.js +22 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/src/components/Accordion/Accordion.stories.jsx +33 -0
- package/dist/src/components/Accordion/accordion.jsx +59 -0
- package/dist/src/components/Alerts/Alert/alert.jsx +152 -0
- package/dist/src/components/Alerts/Alert/alert.stories.jsx +344 -0
- package/dist/src/components/Alerts/AlertDialog/alert-dialog.jsx +170 -0
- package/dist/src/components/Alerts/AlertDialog/alert-dialog.stories.jsx +552 -0
- package/dist/src/components/AppIcons/AndroidIcon.jsx +24 -0
- package/dist/src/components/AppIcons/AppIcon.jsx +29 -0
- package/dist/src/components/AppIcons/AppIcon.stories.jsx +223 -0
- package/dist/src/components/AppIcons/AppleIcon.jsx +31 -0
- package/dist/src/components/AppIcons/PlayStoreIcon.jsx +29 -0
- package/dist/src/components/Avatar/Avatar/Avatar.jsx +45 -0
- package/dist/src/components/Avatar/Avatar/Avatar.stories.jsx +95 -0
- package/dist/src/components/Avatar/Avatar/Avatar.test.jsx +9 -0
- package/dist/src/components/Avatar/AvatarGroup/AvatarGroup.jsx +17 -0
- package/dist/src/components/Avatar/AvatarGroup/AvatarGroup.stories.jsx +32 -0
- package/dist/src/components/Avatar/StatusIndicator/StatusIndicator.jsx +20 -0
- package/dist/src/components/Avatar/StatusIndicator/StatusIndicator.stories.jsx +50 -0
- package/dist/src/components/Badge/Badge.jsx +54 -0
- package/dist/src/components/Badge/Badge.stories.jsx +201 -0
- package/dist/src/components/Button/Button/Button.d.ts +7 -6
- package/dist/src/components/Button/Button/Button.js +32 -9
- package/dist/src/components/Button/Button/Button.jsx +101 -0
- package/dist/src/components/Button/Button/Button.stories.jsx +283 -0
- package/dist/src/components/Button/Button/Button.test.jsx +73 -0
- package/dist/src/components/Button/IconButton/IconButton.jsx +63 -0
- package/dist/src/components/Button/IconButton/IconButton.stories.jsx +128 -0
- package/dist/src/components/Button/IconButton/IconButton.test.jsx +28 -0
- package/dist/src/components/Button/index.js +3 -3
- package/dist/src/components/Card/MultipleNews/MultiNews.jsx +80 -0
- package/dist/src/components/Card/MultipleNews/MultiNews.stories.jsx +104 -0
- package/dist/src/components/Card/PostByCategory/PostByCategory.jsx +60 -0
- package/dist/src/components/Card/PostByCategory/PostByCategory.stories.jsx +106 -0
- package/dist/src/components/Card/SinglePost/SinglePost.jsx +26 -0
- package/dist/src/components/Card/SinglePost/SinglePost.stories.jsx +68 -0
- package/dist/src/components/Card/card.jsx +36 -0
- package/dist/src/components/Card/contactProfile/ContactProfile.jsx +60 -0
- package/dist/src/components/Card/contactProfile/ContactProfile.stories.jsx +103 -0
- package/dist/src/components/Card/photoAlbum/PhotoAlbum.jsx +41 -0
- package/dist/src/components/Card/photoAlbum/PhotoAlbum.stories.jsx +69 -0
- package/dist/src/components/Card/photoGallery/PhotoGallery.jsx +17 -0
- package/dist/src/components/Card/photoGallery/PhotoGallery.stories.jsx +39 -0
- package/dist/src/components/Checkbox/checkbox.jsx +47 -0
- package/dist/src/components/Checkbox/checkbox.stories.jsx +113 -0
- package/dist/src/components/ColorPicker/ColorPicker.jsx +67 -0
- package/dist/src/components/ColorPicker/ColorPicker.stories.jsx +138 -0
- package/dist/src/components/Colors/color.jsx +5 -0
- package/dist/src/components/Colors/color.stories.jsx +20 -0
- package/dist/src/components/Colors/color.test.jsx +23 -0
- package/dist/src/components/Dropdown/Combobox/Combobox.jsx +198 -0
- package/dist/src/components/Dropdown/Combobox/Combobox.stories.jsx +289 -0
- package/dist/src/components/Dropdown/Combobox/utils/renderBadge.jsx +7 -0
- package/dist/src/components/Dropdown/DropdownMenu/DropdownMenu.jsx +102 -0
- package/dist/src/components/Dropdown/DropdownMenu/DropdownMenu.stories.jsx +464 -0
- package/dist/src/components/Dropdown/DropdownMenu/SelectAllSection.jsx +19 -0
- package/dist/src/components/Dropdown/Select.stories.jsx +201 -0
- package/dist/src/components/Dropdown/select.jsx +93 -0
- package/dist/src/components/Icons/LUIcon.jsx +41 -0
- package/dist/src/components/Icons/LUIcon.test.jsx +308 -0
- package/dist/src/components/Icons/stories/IconDropdown.jsx +67 -0
- package/dist/src/components/Icons/stories/IconGallery.jsx +77 -0
- package/dist/src/components/Icons/stories/InteractiveIconSelector.jsx +86 -0
- package/dist/src/components/Icons/stories/LUIcon.stories.jsx +108 -0
- package/dist/src/components/ImageUploader/ImageUploader.stories.jsx +50 -0
- package/dist/src/components/ImageUploader/imageUploader.jsx +94 -0
- package/dist/src/components/Images/LuImage.jsx +19 -0
- package/dist/src/components/Images/LuImage.stories.jsx +154 -0
- package/dist/src/components/Images/LuImage.test.jsx +44 -0
- package/dist/src/components/Input/Input.stories.jsx +250 -0
- package/dist/src/components/Input/input.jsx +110 -0
- package/dist/src/components/Label/Label.jsx +32 -0
- package/dist/src/components/Label/Label.stories.jsx +30 -0
- package/dist/src/components/Pagination/pagination.d.ts +33 -0
- package/dist/src/components/Pagination/pagination.js +68 -0
- package/dist/src/components/Pagination/pagination.jsx +68 -0
- package/dist/src/components/Pagination/pagination.stories.d.ts +74 -0
- package/dist/src/components/Pagination/pagination.stories.js +168 -0
- package/dist/src/components/Pagination/pagination.stories.jsx +114 -0
- package/dist/src/components/RadioGroup/RadioGroup.stories.jsx +146 -0
- package/dist/src/components/RadioGroup/radio-group.jsx +49 -0
- package/dist/src/components/Skeleton/skeleton.d.ts +117 -0
- package/dist/src/components/Skeleton/skeleton.js +140 -0
- package/dist/src/components/Skeleton/skeleton.stories.d.ts +153 -0
- package/dist/src/components/Skeleton/skeleton.stories.js +404 -0
- package/dist/src/components/Slider/Slider.stories.jsx +159 -0
- package/dist/src/components/Slider/slider.jsx +31 -0
- package/dist/src/components/SweetAlert/SweetAlert.jsx +147 -0
- package/dist/src/components/SweetAlert/SweetAlert.stories.jsx +505 -0
- package/dist/src/components/Switch/Switch.stories.jsx +66 -0
- package/dist/src/components/Switch/switch.jsx +61 -0
- package/dist/src/components/Table/Table.d.ts +26 -0
- package/dist/src/components/Table/Table.js +186 -0
- package/dist/src/components/Table/Table.jsx +221 -0
- package/dist/src/components/Table/Table.stories.d.ts +51 -0
- package/dist/src/components/Table/Table.stories.js +408 -0
- package/dist/src/components/Table/Table.stories.jsx +652 -0
- package/dist/src/components/Table/index.d.ts +20 -0
- package/dist/src/components/Table/index.js +20 -0
- package/dist/src/components/Tabs/Tabs.stories.jsx +29 -0
- package/dist/src/components/Tabs/tabs.jsx +32 -0
- package/dist/src/components/Title/Title.jsx +8 -0
- package/dist/src/components/Title/Title.stories.jsx +37 -0
- package/dist/src/components/Title/Title.test.jsx +24 -0
- package/dist/src/components/ToolTip/Tooltip.jsx +18 -0
- package/dist/src/components/ToolTip/Tooltip.stories.jsx +25 -0
- package/dist/src/components/Typography/Body/Body.stories.jsx +34 -0
- package/dist/src/components/Typography/Body/body.jsx +52 -0
- package/dist/src/components/Typography/Caption/Caption.stories.jsx +24 -0
- package/dist/src/components/Typography/Caption/caption.jsx +25 -0
- package/dist/src/components/Typography/Display/Display.stories.jsx +24 -0
- package/dist/src/components/Typography/Display/display.jsx +39 -0
- package/dist/src/components/Typography/Heading/Heading.stories.jsx +37 -0
- package/dist/src/components/Typography/Heading/heading.jsx +53 -0
- package/dist/src/components/ui/avatar.d.ts +3 -10
- package/dist/src/components/ui/avatar.js +12 -27
- package/dist/src/components/ui/avatar.jsx +27 -0
- package/dist/src/components/ui/button.d.ts +10 -0
- package/dist/src/components/ui/button.js +56 -0
- package/dist/src/components/ui/button.jsx +45 -0
- package/dist/src/components/ui/collapsible.d.ts +5 -0
- package/dist/src/components/ui/collapsible.js +5 -0
- package/dist/src/components/ui/collapsible.jsx +5 -0
- package/dist/src/components/ui/command.jsx +67 -0
- package/dist/src/components/ui/dialog.jsx +66 -0
- package/dist/src/components/ui/popover.jsx +33 -0
- package/dist/src/components/ui/tooltip.jsx +38 -0
- package/dist/src/components/ui/typography.jsx +56 -0
- package/dist/src/utils/colors.js +11 -11
- package/dist/src/utils/iconList.d.ts +4 -0
- package/dist/src/utils/iconList.js +4 -0
- package/dist/styles/global.css +209 -67
- package/package.json +1 -1
- package/dist/src/components/Avatar/Avatar/Avatar1.stories.d.ts +0 -17
- package/dist/src/components/Avatar/Avatar/Avatar1.stories.js +0 -68
|
@@ -0,0 +1,652 @@
|
|
|
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 __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
13
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
14
|
+
if (ar || !(i in from)) {
|
|
15
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
16
|
+
ar[i] = from[i];
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
20
|
+
};
|
|
21
|
+
import React, { useState, useMemo } from "react";
|
|
22
|
+
import { Table, TableHeader, TableBody, TableRow, TableHead, TableCell, TableCaption, } from "./Table";
|
|
23
|
+
import { tableSize } from ".";
|
|
24
|
+
import { Checkbox } from "../Checkbox/checkbox";
|
|
25
|
+
import { Badge } from "../Badge/Badge";
|
|
26
|
+
import Combobox from "../Dropdown/Combobox/Combobox";
|
|
27
|
+
import { IconButton } from "../Button/IconButton/IconButton";
|
|
28
|
+
import { Avatar, AvatarFallback, AvatarImage } from "../Avatar/Avatar/Avatar";
|
|
29
|
+
export default {
|
|
30
|
+
title: "Components/Table",
|
|
31
|
+
component: Table,
|
|
32
|
+
argTypes: {
|
|
33
|
+
size: {
|
|
34
|
+
control: {
|
|
35
|
+
type: "select",
|
|
36
|
+
},
|
|
37
|
+
options: Object.keys(tableSize),
|
|
38
|
+
description: "The size of the table. This controls the height and text size of the cells.",
|
|
39
|
+
table: {
|
|
40
|
+
type: { summary: "string" },
|
|
41
|
+
defaultValue: { summary: "sm" },
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
var Template = function (args) {
|
|
47
|
+
return (<Table {...args}>
|
|
48
|
+
<TableCaption>Example users table</TableCaption>
|
|
49
|
+
<TableHeader>
|
|
50
|
+
<TableRow>
|
|
51
|
+
<TableHead>Name</TableHead>
|
|
52
|
+
<TableHead>Email</TableHead>
|
|
53
|
+
<TableHead>Role</TableHead>
|
|
54
|
+
</TableRow>
|
|
55
|
+
</TableHeader>
|
|
56
|
+
<TableBody>
|
|
57
|
+
<TableRow>
|
|
58
|
+
<TableCell>Jane Cooper</TableCell>
|
|
59
|
+
<TableCell>jane.cooper@example.com</TableCell>
|
|
60
|
+
<TableCell>Admin</TableCell>
|
|
61
|
+
</TableRow>
|
|
62
|
+
<TableRow>
|
|
63
|
+
<TableCell>John Doe</TableCell>
|
|
64
|
+
<TableCell>john.doe@example.com</TableCell>
|
|
65
|
+
<TableCell>Member</TableCell>
|
|
66
|
+
</TableRow>
|
|
67
|
+
</TableBody>
|
|
68
|
+
</Table>);
|
|
69
|
+
};
|
|
70
|
+
export var Default = Template.bind({});
|
|
71
|
+
export var TableSizes = function () { return (<div className="flex flex-col space-y-2">
|
|
72
|
+
{Object.keys(tableSize).map(function (size) { return (<Table key={size} size={size}>
|
|
73
|
+
<TableCaption>{"Table Size: ".concat(size)}</TableCaption>
|
|
74
|
+
<TableHeader>
|
|
75
|
+
<TableRow>
|
|
76
|
+
<TableHead>Name</TableHead>
|
|
77
|
+
<TableHead>Email</TableHead>
|
|
78
|
+
<TableHead>Role</TableHead>
|
|
79
|
+
</TableRow>
|
|
80
|
+
</TableHeader>
|
|
81
|
+
<TableBody>
|
|
82
|
+
<TableRow>
|
|
83
|
+
<TableCell>Jane Cooper</TableCell>
|
|
84
|
+
<TableCell>jane.cooper@example.com</TableCell>
|
|
85
|
+
<TableCell>Admin</TableCell>
|
|
86
|
+
</TableRow>
|
|
87
|
+
<TableRow>
|
|
88
|
+
<TableCell>John Doe</TableCell>
|
|
89
|
+
<TableCell>john.doe@example.com</TableCell>
|
|
90
|
+
<TableCell>Member</TableCell>
|
|
91
|
+
</TableRow>
|
|
92
|
+
</TableBody>
|
|
93
|
+
</Table>); })}
|
|
94
|
+
</div>); };
|
|
95
|
+
export var CheckBoxInSmallTable = function () {
|
|
96
|
+
var users = [
|
|
97
|
+
{
|
|
98
|
+
id: 1,
|
|
99
|
+
name: "Jane Cooper",
|
|
100
|
+
email: "jane.cooper@example.com",
|
|
101
|
+
role: "Admin",
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
id: 2,
|
|
105
|
+
name: "John Doe",
|
|
106
|
+
email: "john.doe@example.com",
|
|
107
|
+
role: "Member",
|
|
108
|
+
},
|
|
109
|
+
];
|
|
110
|
+
var _a = useState(new Set()), selected = _a[0], setSelected = _a[1];
|
|
111
|
+
var allChecked = selected.size === users.length && users.length > 0;
|
|
112
|
+
var toggleAll = function (checked) {
|
|
113
|
+
if (checked) {
|
|
114
|
+
setSelected(new Set(users.map(function (u) { return u.id; })));
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
setSelected(new Set());
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
var toggleOne = function (id, checked) {
|
|
121
|
+
setSelected(function (prev) {
|
|
122
|
+
var next = new Set(prev);
|
|
123
|
+
if (checked) {
|
|
124
|
+
next.add(id);
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
next.delete(id);
|
|
128
|
+
}
|
|
129
|
+
return next;
|
|
130
|
+
});
|
|
131
|
+
};
|
|
132
|
+
return (<Table>
|
|
133
|
+
<TableHeader>
|
|
134
|
+
<TableRow>
|
|
135
|
+
<TableHead>
|
|
136
|
+
<div className="flex items-center gap-2">
|
|
137
|
+
<Checkbox checked={allChecked} onCheckedChange={toggleAll} aria-checked={allChecked} size="sm"/>
|
|
138
|
+
Name
|
|
139
|
+
</div>
|
|
140
|
+
</TableHead>
|
|
141
|
+
<TableHead>Email</TableHead>
|
|
142
|
+
<TableHead>Role</TableHead>
|
|
143
|
+
</TableRow>
|
|
144
|
+
</TableHeader>
|
|
145
|
+
<TableBody>
|
|
146
|
+
{users.map(function (user) {
|
|
147
|
+
var isChecked = selected.has(user.id);
|
|
148
|
+
return (<TableRow key={user.id}>
|
|
149
|
+
<TableCell>
|
|
150
|
+
<div className="flex items-center gap-2">
|
|
151
|
+
<Checkbox checked={isChecked} onCheckedChange={function (c) { return toggleOne(user.id, c); }} size="sm"/>
|
|
152
|
+
{user.name}
|
|
153
|
+
</div>
|
|
154
|
+
</TableCell>
|
|
155
|
+
<TableCell>{user.email}</TableCell>
|
|
156
|
+
<TableCell>{user.role}</TableCell>
|
|
157
|
+
</TableRow>);
|
|
158
|
+
})}
|
|
159
|
+
</TableBody>
|
|
160
|
+
</Table>);
|
|
161
|
+
};
|
|
162
|
+
export var CheckBoxInMediumTable = function () {
|
|
163
|
+
var users = [
|
|
164
|
+
{
|
|
165
|
+
id: 1,
|
|
166
|
+
name: "Jane Cooper",
|
|
167
|
+
email: "jane.cooper@example.com",
|
|
168
|
+
role: "Admin",
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
id: 2,
|
|
172
|
+
name: "John Doe",
|
|
173
|
+
email: "john.doe@example.com",
|
|
174
|
+
role: "Member",
|
|
175
|
+
},
|
|
176
|
+
];
|
|
177
|
+
var _a = useState(new Set()), selected = _a[0], setSelected = _a[1];
|
|
178
|
+
var allChecked = selected.size === users.length && users.length > 0;
|
|
179
|
+
var toggleAll = function (checked) {
|
|
180
|
+
if (checked) {
|
|
181
|
+
setSelected(new Set(users.map(function (u) { return u.id; })));
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
setSelected(new Set());
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
var toggleOne = function (id, checked) {
|
|
188
|
+
setSelected(function (prev) {
|
|
189
|
+
var next = new Set(prev);
|
|
190
|
+
if (checked) {
|
|
191
|
+
next.add(id);
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
next.delete(id);
|
|
195
|
+
}
|
|
196
|
+
return next;
|
|
197
|
+
});
|
|
198
|
+
};
|
|
199
|
+
return (<Table size="md">
|
|
200
|
+
<TableHeader>
|
|
201
|
+
<TableRow>
|
|
202
|
+
<TableHead>
|
|
203
|
+
<div className="flex items-center gap-2">
|
|
204
|
+
<Checkbox checked={allChecked} onCheckedChange={toggleAll} aria-checked={allChecked} size="md"/>
|
|
205
|
+
Name
|
|
206
|
+
</div>
|
|
207
|
+
</TableHead>
|
|
208
|
+
<TableHead>Email</TableHead>
|
|
209
|
+
<TableHead>Role</TableHead>
|
|
210
|
+
</TableRow>
|
|
211
|
+
</TableHeader>
|
|
212
|
+
<TableBody>
|
|
213
|
+
{users.map(function (user) {
|
|
214
|
+
var isChecked = selected.has(user.id);
|
|
215
|
+
return (<TableRow key={user.id}>
|
|
216
|
+
<TableCell>
|
|
217
|
+
<div className="flex items-center gap-2">
|
|
218
|
+
<Checkbox checked={isChecked} onCheckedChange={function (c) { return toggleOne(user.id, c); }} size="md"/>
|
|
219
|
+
{user.name}
|
|
220
|
+
</div>
|
|
221
|
+
</TableCell>
|
|
222
|
+
<TableCell>{user.email}</TableCell>
|
|
223
|
+
<TableCell>{user.role}</TableCell>
|
|
224
|
+
</TableRow>);
|
|
225
|
+
})}
|
|
226
|
+
</TableBody>
|
|
227
|
+
</Table>);
|
|
228
|
+
};
|
|
229
|
+
export var CheckBoxInLargeTable = function () {
|
|
230
|
+
var users = [
|
|
231
|
+
{
|
|
232
|
+
id: 1,
|
|
233
|
+
name: "Jane Cooper",
|
|
234
|
+
email: "jane.cooper@example.com",
|
|
235
|
+
role: "Admin",
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
id: 2,
|
|
239
|
+
name: "John Doe",
|
|
240
|
+
email: "john.doe@example.com",
|
|
241
|
+
role: "Member",
|
|
242
|
+
},
|
|
243
|
+
];
|
|
244
|
+
var _a = useState(new Set()), selected = _a[0], setSelected = _a[1];
|
|
245
|
+
var allChecked = selected.size === users.length && users.length > 0;
|
|
246
|
+
var toggleAll = function (checked) {
|
|
247
|
+
if (checked) {
|
|
248
|
+
setSelected(new Set(users.map(function (u) { return u.id; })));
|
|
249
|
+
}
|
|
250
|
+
else {
|
|
251
|
+
setSelected(new Set());
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
var toggleOne = function (id, checked) {
|
|
255
|
+
setSelected(function (prev) {
|
|
256
|
+
var next = new Set(prev);
|
|
257
|
+
if (checked) {
|
|
258
|
+
next.add(id);
|
|
259
|
+
}
|
|
260
|
+
else {
|
|
261
|
+
next.delete(id);
|
|
262
|
+
}
|
|
263
|
+
return next;
|
|
264
|
+
});
|
|
265
|
+
};
|
|
266
|
+
return (<Table size="lg">
|
|
267
|
+
<TableHeader>
|
|
268
|
+
<TableRow>
|
|
269
|
+
<TableHead>
|
|
270
|
+
<div className="flex items-center gap-2">
|
|
271
|
+
<Checkbox checked={allChecked} onCheckedChange={toggleAll} aria-checked={allChecked} size="lg"/>
|
|
272
|
+
Name
|
|
273
|
+
</div>
|
|
274
|
+
</TableHead>
|
|
275
|
+
<TableHead>Email</TableHead>
|
|
276
|
+
<TableHead>Role</TableHead>
|
|
277
|
+
</TableRow>
|
|
278
|
+
</TableHeader>
|
|
279
|
+
<TableBody>
|
|
280
|
+
{users.map(function (user) {
|
|
281
|
+
var isChecked = selected.has(user.id);
|
|
282
|
+
return (<TableRow key={user.id}>
|
|
283
|
+
<TableCell>
|
|
284
|
+
<div className="flex items-center gap-2">
|
|
285
|
+
<Checkbox checked={isChecked} onCheckedChange={function (c) { return toggleOne(user.id, c); }} size="lg"/>
|
|
286
|
+
{user.name}
|
|
287
|
+
</div>
|
|
288
|
+
</TableCell>
|
|
289
|
+
<TableCell>{user.email}</TableCell>
|
|
290
|
+
<TableCell>{user.role}</TableCell>
|
|
291
|
+
</TableRow>);
|
|
292
|
+
})}
|
|
293
|
+
</TableBody>
|
|
294
|
+
</Table>);
|
|
295
|
+
};
|
|
296
|
+
export var SortingTable = function () {
|
|
297
|
+
var users = useMemo(function () { return [
|
|
298
|
+
{
|
|
299
|
+
id: 1,
|
|
300
|
+
name: "Jane Cooper",
|
|
301
|
+
email: "jane.cooper@example.com",
|
|
302
|
+
role: "Admin",
|
|
303
|
+
joinDate: "2023-01-15",
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
id: 2,
|
|
307
|
+
name: "John Doe",
|
|
308
|
+
email: "john.doe@example.com",
|
|
309
|
+
role: "Member",
|
|
310
|
+
joinDate: "2023-03-22",
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
id: 3,
|
|
314
|
+
name: "Alice Smith",
|
|
315
|
+
email: "alice.smith@example.com",
|
|
316
|
+
role: "Admin",
|
|
317
|
+
joinDate: "2023-02-10",
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
id: 4,
|
|
321
|
+
name: "Bob Johnson",
|
|
322
|
+
email: "bob.johnson@example.com",
|
|
323
|
+
role: "User",
|
|
324
|
+
joinDate: "2023-04-05",
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
id: 5,
|
|
328
|
+
name: "Charlie Brown",
|
|
329
|
+
email: "charlie.brown@example.com",
|
|
330
|
+
role: "Member",
|
|
331
|
+
joinDate: "2023-01-30",
|
|
332
|
+
},
|
|
333
|
+
]; }, []);
|
|
334
|
+
var _a = React.useState(undefined), sortKey = _a[0], setSortKey = _a[1];
|
|
335
|
+
var _b = React.useState(undefined), direction = _b[0], setDirection = _b[1];
|
|
336
|
+
var handleSort = function (key) {
|
|
337
|
+
if (sortKey === key) {
|
|
338
|
+
// Toggle direction if same column is clicked again
|
|
339
|
+
setDirection(direction === "asc" ? "desc" : "asc");
|
|
340
|
+
}
|
|
341
|
+
else {
|
|
342
|
+
// Set a new column and default to ascending
|
|
343
|
+
setSortKey(key);
|
|
344
|
+
setDirection("asc");
|
|
345
|
+
}
|
|
346
|
+
};
|
|
347
|
+
var sorted = useMemo(function () {
|
|
348
|
+
if (!sortKey || !direction)
|
|
349
|
+
return users;
|
|
350
|
+
return __spreadArray([], users, true).sort(function (a, b) {
|
|
351
|
+
var aVal = a[sortKey];
|
|
352
|
+
var bVal = b[sortKey];
|
|
353
|
+
if (aVal < bVal)
|
|
354
|
+
return direction === "asc" ? -1 : 1;
|
|
355
|
+
if (aVal > bVal)
|
|
356
|
+
return direction === "asc" ? 1 : -1;
|
|
357
|
+
return 0;
|
|
358
|
+
});
|
|
359
|
+
}, [sortKey, direction, users]);
|
|
360
|
+
return (<Table size="sm">
|
|
361
|
+
<TableCaption>Sortable table - Click on Name or Role</TableCaption>
|
|
362
|
+
<TableHeader>
|
|
363
|
+
<TableRow>
|
|
364
|
+
<TableHead>
|
|
365
|
+
<div className="flex items-center gap-2">
|
|
366
|
+
Name
|
|
367
|
+
<IconButton aria-label="Toggle sort by Name" onClick={function () { return handleSort("name"); }} size="sm" variant="ghost" icon="sort" color="gray"/>
|
|
368
|
+
</div>
|
|
369
|
+
</TableHead>
|
|
370
|
+
<TableHead>Email</TableHead>
|
|
371
|
+
<TableHead>
|
|
372
|
+
<div className="flex items-center gap-2">
|
|
373
|
+
Role
|
|
374
|
+
<IconButton aria-label="Toggle sort by Role" onClick={function () { return handleSort("role"); }} size="sm" variant="ghost" icon="sort" color="gray"/>
|
|
375
|
+
</div>
|
|
376
|
+
</TableHead>
|
|
377
|
+
<TableHead>Join Date</TableHead>
|
|
378
|
+
</TableRow>
|
|
379
|
+
</TableHeader>
|
|
380
|
+
<TableBody>
|
|
381
|
+
{sorted.map(function (user) { return (<TableRow key={user.id}>
|
|
382
|
+
<TableCell>{user.name}</TableCell>
|
|
383
|
+
<TableCell>{user.email}</TableCell>
|
|
384
|
+
<TableCell>{user.role}</TableCell>
|
|
385
|
+
<TableCell>{user.joinDate}</TableCell>
|
|
386
|
+
</TableRow>); })}
|
|
387
|
+
</TableBody>
|
|
388
|
+
</Table>);
|
|
389
|
+
};
|
|
390
|
+
export var BadgesInTable = function () {
|
|
391
|
+
var users = [
|
|
392
|
+
{
|
|
393
|
+
id: 1,
|
|
394
|
+
task: "Design new homepage",
|
|
395
|
+
status: "In Progress",
|
|
396
|
+
role: "Admin",
|
|
397
|
+
},
|
|
398
|
+
{
|
|
399
|
+
id: 2,
|
|
400
|
+
task: "Implement user authentication",
|
|
401
|
+
status: "Completed",
|
|
402
|
+
role: "Member",
|
|
403
|
+
},
|
|
404
|
+
];
|
|
405
|
+
return (<Table size="sm">
|
|
406
|
+
<TableCaption>Tasks with Status Badges</TableCaption>
|
|
407
|
+
<TableHeader>
|
|
408
|
+
<TableRow>
|
|
409
|
+
<TableHead>Task</TableHead>
|
|
410
|
+
<TableHead>Status</TableHead>
|
|
411
|
+
<TableHead>Role</TableHead>
|
|
412
|
+
</TableRow>
|
|
413
|
+
</TableHeader>
|
|
414
|
+
<TableBody>
|
|
415
|
+
{users.map(function (user) { return (<TableRow key={user.id}>
|
|
416
|
+
<TableCell>{user.task}</TableCell>
|
|
417
|
+
<TableCell>
|
|
418
|
+
<Badge color={user.status === "Completed" ? "light-green" : "light-blue"} size="sm" endIcon="check">
|
|
419
|
+
{user.status}
|
|
420
|
+
</Badge>
|
|
421
|
+
</TableCell>
|
|
422
|
+
<TableCell>{user.role}</TableCell>
|
|
423
|
+
</TableRow>); })}
|
|
424
|
+
</TableBody>
|
|
425
|
+
</Table>);
|
|
426
|
+
};
|
|
427
|
+
BadgesInTable.parameters = {
|
|
428
|
+
docs: {
|
|
429
|
+
description: {
|
|
430
|
+
story: "Badges in table displays a table of tasks with their current status represented by badges. The badges are color-coded to indicate the status of each task. For large table, use large badge. For medium table, use medium badge. For small table, use small badge.",
|
|
431
|
+
},
|
|
432
|
+
},
|
|
433
|
+
};
|
|
434
|
+
export var DropdownInTable = function () {
|
|
435
|
+
var users = [
|
|
436
|
+
{
|
|
437
|
+
id: 1,
|
|
438
|
+
name: "Jane Cooper",
|
|
439
|
+
email: "jane.cooper@example.com",
|
|
440
|
+
role: "Admin",
|
|
441
|
+
joinDate: "2023-01-15",
|
|
442
|
+
},
|
|
443
|
+
{
|
|
444
|
+
id: 2,
|
|
445
|
+
name: "John Doe",
|
|
446
|
+
email: "john.doe@example.com",
|
|
447
|
+
role: "Member",
|
|
448
|
+
joinDate: "2023-03-22",
|
|
449
|
+
},
|
|
450
|
+
{
|
|
451
|
+
id: 3,
|
|
452
|
+
name: "Alice Smith",
|
|
453
|
+
email: "alice.smith@example.com",
|
|
454
|
+
role: "Admin",
|
|
455
|
+
joinDate: "2023-02-10",
|
|
456
|
+
},
|
|
457
|
+
];
|
|
458
|
+
return (<Table size="sm">
|
|
459
|
+
<TableCaption>Table with Dropdown Actions</TableCaption>
|
|
460
|
+
<TableHeader>
|
|
461
|
+
<TableRow>
|
|
462
|
+
<TableHead>Name</TableHead>
|
|
463
|
+
<TableHead>Email</TableHead>
|
|
464
|
+
<TableHead>Role</TableHead>
|
|
465
|
+
<TableHead>Actions</TableHead>
|
|
466
|
+
</TableRow>
|
|
467
|
+
</TableHeader>
|
|
468
|
+
<TableBody>
|
|
469
|
+
{users.map(function (user) { return (<TableRow key={user.id}>
|
|
470
|
+
<TableCell>{user.name}</TableCell>
|
|
471
|
+
<TableCell>{user.email}</TableCell>
|
|
472
|
+
<TableCell>{user.role}</TableCell>
|
|
473
|
+
<TableCell>
|
|
474
|
+
<div className="w-48">
|
|
475
|
+
<Combobox size="sm" placeholder="Actions" options={["Edit", "Share", "Delete"]} isSearch={false} isMulti={false} onSelect={function (v) { return console.log("selected", v); }}/>
|
|
476
|
+
</div>
|
|
477
|
+
</TableCell>
|
|
478
|
+
</TableRow>); })}
|
|
479
|
+
</TableBody>
|
|
480
|
+
</Table>);
|
|
481
|
+
};
|
|
482
|
+
DropdownInTable.parameters = {
|
|
483
|
+
docs: {
|
|
484
|
+
description: {
|
|
485
|
+
story: "Dropdown in table displays a table of users with a dropdown menu for actions. The dropdown menu allows users to select an action to perform on each user. For large table, use large dropdown. For medium table, use medium dropdown. For small table, use small dropdown.",
|
|
486
|
+
},
|
|
487
|
+
},
|
|
488
|
+
};
|
|
489
|
+
export var ActionButtonInTable = function () {
|
|
490
|
+
var columnMinWidth = 150;
|
|
491
|
+
// Only include data columns in responsive calculation, NOT actions
|
|
492
|
+
var columns = [
|
|
493
|
+
{ key: "name", header: "Name" },
|
|
494
|
+
{ key: "email", header: "Email" },
|
|
495
|
+
{ key: "role", header: "Role" },
|
|
496
|
+
{ key: "joinDate", header: "Join Date" },
|
|
497
|
+
];
|
|
498
|
+
// Create header columns that include actions for proper slicing
|
|
499
|
+
var headerColumns = __spreadArray(__spreadArray([], columns, true), [{ key: "actions", header: "Actions" }], false);
|
|
500
|
+
var users = [
|
|
501
|
+
{
|
|
502
|
+
id: 1,
|
|
503
|
+
name: "Jane Cooper",
|
|
504
|
+
email: "jane.cooper@example.com",
|
|
505
|
+
role: "Admin",
|
|
506
|
+
joinDate: "2023-01-15",
|
|
507
|
+
},
|
|
508
|
+
{
|
|
509
|
+
id: 2,
|
|
510
|
+
name: "John Doe",
|
|
511
|
+
email: "john.doe@example.com",
|
|
512
|
+
role: "Member",
|
|
513
|
+
joinDate: "2023-03-22",
|
|
514
|
+
},
|
|
515
|
+
];
|
|
516
|
+
return (<div className="w-full">
|
|
517
|
+
<Table className="w-full" columnMinWidth={columnMinWidth} columns={headerColumns} hasActionColumn={true}>
|
|
518
|
+
<TableCaption>Table with Action Buttons</TableCaption>
|
|
519
|
+
<TableHeader>
|
|
520
|
+
<TableRow data={{}}>
|
|
521
|
+
{headerColumns.map(function (col) { return (<TableHead key={col.key}>{col.header}</TableHead>); })}
|
|
522
|
+
</TableRow>
|
|
523
|
+
</TableHeader>
|
|
524
|
+
<TableBody>
|
|
525
|
+
{users.map(function (user) {
|
|
526
|
+
var userWithActions = __assign(__assign({}, user), { actions: (<div className="flex space-x-2">
|
|
527
|
+
<IconButton onClick={function () { return alert("Editing ".concat(user.name)); }} color="light-green" icon="pen" size="sm"/>
|
|
528
|
+
<IconButton onClick={function () { return alert("Deleting ".concat(user.name)); }} color="light-red" icon="trash" size="sm"/>
|
|
529
|
+
<IconButton onClick={function () { return alert("Downloading ".concat(user.name)); }} color="light-blue" icon="download" size="sm"/>
|
|
530
|
+
</div>) });
|
|
531
|
+
return (<TableRow key={user.id} data={userWithActions}>
|
|
532
|
+
{headerColumns.map(function (col) { return (<TableCell key={col.key}>
|
|
533
|
+
{col.key === "actions"
|
|
534
|
+
? userWithActions.actions
|
|
535
|
+
: userWithActions[col.key]}
|
|
536
|
+
</TableCell>); })}
|
|
537
|
+
</TableRow>);
|
|
538
|
+
})}
|
|
539
|
+
</TableBody>
|
|
540
|
+
</Table>
|
|
541
|
+
</div>);
|
|
542
|
+
};
|
|
543
|
+
ActionButtonInTable.parameters = {
|
|
544
|
+
docs: {
|
|
545
|
+
description: {
|
|
546
|
+
story: "Action buttons in table display a table of users with action buttons for each user. The action buttons allow users to perform actions such as editing, deleting, and downloading user information. For large table, use large icon buttons. For medium table, use medium icon buttons. For small table, use small icon buttons.",
|
|
547
|
+
},
|
|
548
|
+
},
|
|
549
|
+
};
|
|
550
|
+
export var AvatarInTable = function () {
|
|
551
|
+
var users = [
|
|
552
|
+
{
|
|
553
|
+
id: 1,
|
|
554
|
+
name: "Jane Cooper",
|
|
555
|
+
email: "jane.cooper@example.com",
|
|
556
|
+
role: "Admin",
|
|
557
|
+
joinDate: "2023-01-15",
|
|
558
|
+
image: "/images/avatar.png",
|
|
559
|
+
},
|
|
560
|
+
{
|
|
561
|
+
id: 2,
|
|
562
|
+
name: "John Doe",
|
|
563
|
+
email: "john.doe@example.com",
|
|
564
|
+
role: "Member",
|
|
565
|
+
image: "/images/avatar.png",
|
|
566
|
+
joinDate: "2023-03-22",
|
|
567
|
+
},
|
|
568
|
+
];
|
|
569
|
+
return (<Table>
|
|
570
|
+
<TableCaption>Table with Avatars</TableCaption>
|
|
571
|
+
<TableHeader>
|
|
572
|
+
<TableRow>
|
|
573
|
+
<TableHead></TableHead>
|
|
574
|
+
<TableHead>Name</TableHead>
|
|
575
|
+
<TableHead>Email</TableHead>
|
|
576
|
+
<TableHead>Role</TableHead>
|
|
577
|
+
</TableRow>
|
|
578
|
+
</TableHeader>
|
|
579
|
+
<TableBody>
|
|
580
|
+
{users.map(function (user) { return (<TableRow key={user.id}>
|
|
581
|
+
<TableCell>
|
|
582
|
+
<Avatar size="sm">
|
|
583
|
+
<AvatarImage alt="Avatar" src={user.image}/>
|
|
584
|
+
<AvatarFallback>AB</AvatarFallback>
|
|
585
|
+
</Avatar>
|
|
586
|
+
</TableCell>
|
|
587
|
+
<TableCell>{user.name}</TableCell>
|
|
588
|
+
<TableCell>{user.email}</TableCell>
|
|
589
|
+
<TableCell>{user.role}</TableCell>
|
|
590
|
+
</TableRow>); })}
|
|
591
|
+
</TableBody>
|
|
592
|
+
</Table>);
|
|
593
|
+
};
|
|
594
|
+
export var ResponsiveTable = function () {
|
|
595
|
+
var columnMinWidth = 120;
|
|
596
|
+
var columns = [
|
|
597
|
+
{ key: "id", header: "ID" },
|
|
598
|
+
{ key: "name", header: "Name" },
|
|
599
|
+
{ key: "email", header: "Email" },
|
|
600
|
+
{ key: "role", header: "Role" },
|
|
601
|
+
{ key: "status", header: "Status" },
|
|
602
|
+
{ key: "created", header: "Created At" },
|
|
603
|
+
{ key: "updated", header: "Updated At" },
|
|
604
|
+
{ key: "data", header: "Data" },
|
|
605
|
+
];
|
|
606
|
+
var data = [
|
|
607
|
+
{
|
|
608
|
+
id: 1,
|
|
609
|
+
name: "Jane Cooper",
|
|
610
|
+
email: "jane.cooper@example.com",
|
|
611
|
+
role: "Admin",
|
|
612
|
+
status: "Active",
|
|
613
|
+
created: "2023-09-20",
|
|
614
|
+
updated: "2023-09-22",
|
|
615
|
+
data: "Some data",
|
|
616
|
+
},
|
|
617
|
+
{
|
|
618
|
+
id: 2,
|
|
619
|
+
name: "John Doe",
|
|
620
|
+
email: "john.doe@example.com",
|
|
621
|
+
role: "User",
|
|
622
|
+
status: "Pending",
|
|
623
|
+
created: "2023-08-15",
|
|
624
|
+
updated: "2023-08-20",
|
|
625
|
+
data: "Some data",
|
|
626
|
+
},
|
|
627
|
+
{
|
|
628
|
+
id: 3,
|
|
629
|
+
name: "Alice Smith",
|
|
630
|
+
email: "alice.smith@example.com",
|
|
631
|
+
role: "Manager",
|
|
632
|
+
status: "Inactive",
|
|
633
|
+
created: "2023-07-10",
|
|
634
|
+
updated: "2023-07-18",
|
|
635
|
+
data: "Some data",
|
|
636
|
+
},
|
|
637
|
+
];
|
|
638
|
+
return (<Table className="w-full" columnMinWidth={columnMinWidth} columns={columns}>
|
|
639
|
+
<TableHeader>
|
|
640
|
+
<TableRow>
|
|
641
|
+
{columns.map(function (col) { return (<TableHead key={col.key}>{col.header}</TableHead>); })}
|
|
642
|
+
</TableRow>
|
|
643
|
+
</TableHeader>
|
|
644
|
+
<TableBody>
|
|
645
|
+
{data.map(function (row, rowIndex) { return (<TableRow key={rowIndex} data={row}>
|
|
646
|
+
{columns.map(function (col) { return (<TableCell key={col.key}>
|
|
647
|
+
{row[col.key]}
|
|
648
|
+
</TableCell>); })}
|
|
649
|
+
</TableRow>); })}
|
|
650
|
+
</TableBody>
|
|
651
|
+
</Table>);
|
|
652
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const tableSize: {
|
|
2
|
+
readonly lg: "h-20 text-lg";
|
|
3
|
+
readonly md: "h-16 text-base";
|
|
4
|
+
readonly sm: "h-14 text-sm";
|
|
5
|
+
};
|
|
6
|
+
export declare const tableBodySize: {
|
|
7
|
+
readonly lg: "h-20 text-lg font-normal px-4 py-3";
|
|
8
|
+
readonly md: "h-16 text-base font-normal px-4 py-3";
|
|
9
|
+
readonly sm: "h-14 py-2 px-3 text-sm font-normal";
|
|
10
|
+
};
|
|
11
|
+
export declare const tableFooterSize: {
|
|
12
|
+
readonly lg: "h-20 text-lg font-semibold px-4 py-0";
|
|
13
|
+
readonly md: "h-16 text-base font-normal px-4 py-0";
|
|
14
|
+
readonly sm: "h-14 py-2 px-3 text-sm font-normal px-3 py-0";
|
|
15
|
+
};
|
|
16
|
+
export declare const collapsibleIconSize: {
|
|
17
|
+
readonly lg: "lg";
|
|
18
|
+
readonly md: "md";
|
|
19
|
+
readonly sm: "sm";
|
|
20
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export var tableSize = {
|
|
2
|
+
lg: "h-20 text-lg",
|
|
3
|
+
md: "h-16 text-base",
|
|
4
|
+
sm: "h-14 text-sm",
|
|
5
|
+
};
|
|
6
|
+
export var tableBodySize = {
|
|
7
|
+
lg: "h-20 text-lg font-normal px-4 py-3",
|
|
8
|
+
md: "h-16 text-base font-normal px-4 py-3",
|
|
9
|
+
sm: "h-14 py-2 px-3 text-sm font-normal",
|
|
10
|
+
};
|
|
11
|
+
export var tableFooterSize = {
|
|
12
|
+
lg: "h-20 text-lg font-semibold px-4 py-0",
|
|
13
|
+
md: "h-16 text-base font-normal px-4 py-0",
|
|
14
|
+
sm: "h-14 py-2 px-3 text-sm font-normal px-3 py-0",
|
|
15
|
+
};
|
|
16
|
+
export var collapsibleIconSize = {
|
|
17
|
+
lg: "lg",
|
|
18
|
+
md: "md",
|
|
19
|
+
sm: "sm",
|
|
20
|
+
};
|