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.
Files changed (142) hide show
  1. package/dist/app/layout.jsx +13 -0
  2. package/dist/app/page.jsx +25 -0
  3. package/dist/build/types/app/layout.d.ts +12 -0
  4. package/dist/build/types/app/layout.js +22 -0
  5. package/dist/build/types/app/page.d.ts +12 -0
  6. package/dist/build/types/app/page.js +22 -0
  7. package/dist/index.d.ts +4 -0
  8. package/dist/index.js +4 -0
  9. package/dist/src/components/Accordion/Accordion.stories.jsx +33 -0
  10. package/dist/src/components/Accordion/accordion.jsx +59 -0
  11. package/dist/src/components/Alerts/Alert/alert.jsx +152 -0
  12. package/dist/src/components/Alerts/Alert/alert.stories.jsx +344 -0
  13. package/dist/src/components/Alerts/AlertDialog/alert-dialog.jsx +170 -0
  14. package/dist/src/components/Alerts/AlertDialog/alert-dialog.stories.jsx +552 -0
  15. package/dist/src/components/AppIcons/AndroidIcon.jsx +24 -0
  16. package/dist/src/components/AppIcons/AppIcon.jsx +29 -0
  17. package/dist/src/components/AppIcons/AppIcon.stories.jsx +223 -0
  18. package/dist/src/components/AppIcons/AppleIcon.jsx +31 -0
  19. package/dist/src/components/AppIcons/PlayStoreIcon.jsx +29 -0
  20. package/dist/src/components/Avatar/Avatar/Avatar.jsx +45 -0
  21. package/dist/src/components/Avatar/Avatar/Avatar.stories.jsx +95 -0
  22. package/dist/src/components/Avatar/Avatar/Avatar.test.jsx +9 -0
  23. package/dist/src/components/Avatar/AvatarGroup/AvatarGroup.jsx +17 -0
  24. package/dist/src/components/Avatar/AvatarGroup/AvatarGroup.stories.jsx +32 -0
  25. package/dist/src/components/Avatar/StatusIndicator/StatusIndicator.jsx +20 -0
  26. package/dist/src/components/Avatar/StatusIndicator/StatusIndicator.stories.jsx +50 -0
  27. package/dist/src/components/Badge/Badge.jsx +54 -0
  28. package/dist/src/components/Badge/Badge.stories.jsx +201 -0
  29. package/dist/src/components/Button/Button/Button.d.ts +7 -6
  30. package/dist/src/components/Button/Button/Button.js +32 -9
  31. package/dist/src/components/Button/Button/Button.jsx +101 -0
  32. package/dist/src/components/Button/Button/Button.stories.jsx +283 -0
  33. package/dist/src/components/Button/Button/Button.test.jsx +73 -0
  34. package/dist/src/components/Button/IconButton/IconButton.jsx +63 -0
  35. package/dist/src/components/Button/IconButton/IconButton.stories.jsx +128 -0
  36. package/dist/src/components/Button/IconButton/IconButton.test.jsx +28 -0
  37. package/dist/src/components/Button/index.js +3 -3
  38. package/dist/src/components/Card/MultipleNews/MultiNews.jsx +80 -0
  39. package/dist/src/components/Card/MultipleNews/MultiNews.stories.jsx +104 -0
  40. package/dist/src/components/Card/PostByCategory/PostByCategory.jsx +60 -0
  41. package/dist/src/components/Card/PostByCategory/PostByCategory.stories.jsx +106 -0
  42. package/dist/src/components/Card/SinglePost/SinglePost.jsx +26 -0
  43. package/dist/src/components/Card/SinglePost/SinglePost.stories.jsx +68 -0
  44. package/dist/src/components/Card/card.jsx +36 -0
  45. package/dist/src/components/Card/contactProfile/ContactProfile.jsx +60 -0
  46. package/dist/src/components/Card/contactProfile/ContactProfile.stories.jsx +103 -0
  47. package/dist/src/components/Card/photoAlbum/PhotoAlbum.jsx +41 -0
  48. package/dist/src/components/Card/photoAlbum/PhotoAlbum.stories.jsx +69 -0
  49. package/dist/src/components/Card/photoGallery/PhotoGallery.jsx +17 -0
  50. package/dist/src/components/Card/photoGallery/PhotoGallery.stories.jsx +39 -0
  51. package/dist/src/components/Checkbox/checkbox.jsx +47 -0
  52. package/dist/src/components/Checkbox/checkbox.stories.jsx +113 -0
  53. package/dist/src/components/ColorPicker/ColorPicker.jsx +67 -0
  54. package/dist/src/components/ColorPicker/ColorPicker.stories.jsx +138 -0
  55. package/dist/src/components/Colors/color.jsx +5 -0
  56. package/dist/src/components/Colors/color.stories.jsx +20 -0
  57. package/dist/src/components/Colors/color.test.jsx +23 -0
  58. package/dist/src/components/Dropdown/Combobox/Combobox.jsx +198 -0
  59. package/dist/src/components/Dropdown/Combobox/Combobox.stories.jsx +289 -0
  60. package/dist/src/components/Dropdown/Combobox/utils/renderBadge.jsx +7 -0
  61. package/dist/src/components/Dropdown/DropdownMenu/DropdownMenu.jsx +102 -0
  62. package/dist/src/components/Dropdown/DropdownMenu/DropdownMenu.stories.jsx +464 -0
  63. package/dist/src/components/Dropdown/DropdownMenu/SelectAllSection.jsx +19 -0
  64. package/dist/src/components/Dropdown/Select.stories.jsx +201 -0
  65. package/dist/src/components/Dropdown/select.jsx +93 -0
  66. package/dist/src/components/Icons/LUIcon.jsx +41 -0
  67. package/dist/src/components/Icons/LUIcon.test.jsx +308 -0
  68. package/dist/src/components/Icons/stories/IconDropdown.jsx +67 -0
  69. package/dist/src/components/Icons/stories/IconGallery.jsx +77 -0
  70. package/dist/src/components/Icons/stories/InteractiveIconSelector.jsx +86 -0
  71. package/dist/src/components/Icons/stories/LUIcon.stories.jsx +108 -0
  72. package/dist/src/components/ImageUploader/ImageUploader.stories.jsx +50 -0
  73. package/dist/src/components/ImageUploader/imageUploader.jsx +94 -0
  74. package/dist/src/components/Images/LuImage.jsx +19 -0
  75. package/dist/src/components/Images/LuImage.stories.jsx +154 -0
  76. package/dist/src/components/Images/LuImage.test.jsx +44 -0
  77. package/dist/src/components/Input/Input.stories.jsx +250 -0
  78. package/dist/src/components/Input/input.jsx +110 -0
  79. package/dist/src/components/Label/Label.jsx +32 -0
  80. package/dist/src/components/Label/Label.stories.jsx +30 -0
  81. package/dist/src/components/Pagination/pagination.d.ts +33 -0
  82. package/dist/src/components/Pagination/pagination.js +68 -0
  83. package/dist/src/components/Pagination/pagination.jsx +68 -0
  84. package/dist/src/components/Pagination/pagination.stories.d.ts +74 -0
  85. package/dist/src/components/Pagination/pagination.stories.js +168 -0
  86. package/dist/src/components/Pagination/pagination.stories.jsx +114 -0
  87. package/dist/src/components/RadioGroup/RadioGroup.stories.jsx +146 -0
  88. package/dist/src/components/RadioGroup/radio-group.jsx +49 -0
  89. package/dist/src/components/Skeleton/skeleton.d.ts +117 -0
  90. package/dist/src/components/Skeleton/skeleton.js +140 -0
  91. package/dist/src/components/Skeleton/skeleton.stories.d.ts +153 -0
  92. package/dist/src/components/Skeleton/skeleton.stories.js +404 -0
  93. package/dist/src/components/Slider/Slider.stories.jsx +159 -0
  94. package/dist/src/components/Slider/slider.jsx +31 -0
  95. package/dist/src/components/SweetAlert/SweetAlert.jsx +147 -0
  96. package/dist/src/components/SweetAlert/SweetAlert.stories.jsx +505 -0
  97. package/dist/src/components/Switch/Switch.stories.jsx +66 -0
  98. package/dist/src/components/Switch/switch.jsx +61 -0
  99. package/dist/src/components/Table/Table.d.ts +26 -0
  100. package/dist/src/components/Table/Table.js +186 -0
  101. package/dist/src/components/Table/Table.jsx +221 -0
  102. package/dist/src/components/Table/Table.stories.d.ts +51 -0
  103. package/dist/src/components/Table/Table.stories.js +408 -0
  104. package/dist/src/components/Table/Table.stories.jsx +652 -0
  105. package/dist/src/components/Table/index.d.ts +20 -0
  106. package/dist/src/components/Table/index.js +20 -0
  107. package/dist/src/components/Tabs/Tabs.stories.jsx +29 -0
  108. package/dist/src/components/Tabs/tabs.jsx +32 -0
  109. package/dist/src/components/Title/Title.jsx +8 -0
  110. package/dist/src/components/Title/Title.stories.jsx +37 -0
  111. package/dist/src/components/Title/Title.test.jsx +24 -0
  112. package/dist/src/components/ToolTip/Tooltip.jsx +18 -0
  113. package/dist/src/components/ToolTip/Tooltip.stories.jsx +25 -0
  114. package/dist/src/components/Typography/Body/Body.stories.jsx +34 -0
  115. package/dist/src/components/Typography/Body/body.jsx +52 -0
  116. package/dist/src/components/Typography/Caption/Caption.stories.jsx +24 -0
  117. package/dist/src/components/Typography/Caption/caption.jsx +25 -0
  118. package/dist/src/components/Typography/Display/Display.stories.jsx +24 -0
  119. package/dist/src/components/Typography/Display/display.jsx +39 -0
  120. package/dist/src/components/Typography/Heading/Heading.stories.jsx +37 -0
  121. package/dist/src/components/Typography/Heading/heading.jsx +53 -0
  122. package/dist/src/components/ui/avatar.d.ts +3 -10
  123. package/dist/src/components/ui/avatar.js +12 -27
  124. package/dist/src/components/ui/avatar.jsx +27 -0
  125. package/dist/src/components/ui/button.d.ts +10 -0
  126. package/dist/src/components/ui/button.js +56 -0
  127. package/dist/src/components/ui/button.jsx +45 -0
  128. package/dist/src/components/ui/collapsible.d.ts +5 -0
  129. package/dist/src/components/ui/collapsible.js +5 -0
  130. package/dist/src/components/ui/collapsible.jsx +5 -0
  131. package/dist/src/components/ui/command.jsx +67 -0
  132. package/dist/src/components/ui/dialog.jsx +66 -0
  133. package/dist/src/components/ui/popover.jsx +33 -0
  134. package/dist/src/components/ui/tooltip.jsx +38 -0
  135. package/dist/src/components/ui/typography.jsx +56 -0
  136. package/dist/src/utils/colors.js +11 -11
  137. package/dist/src/utils/iconList.d.ts +4 -0
  138. package/dist/src/utils/iconList.js +4 -0
  139. package/dist/styles/global.css +209 -67
  140. package/package.json +1 -1
  141. package/dist/src/components/Avatar/Avatar/Avatar1.stories.d.ts +0 -17
  142. package/dist/src/components/Avatar/Avatar/Avatar1.stories.js +0 -68
@@ -0,0 +1,464 @@
1
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
2
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
3
+ if (ar || !(i in from)) {
4
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
5
+ ar[i] = from[i];
6
+ }
7
+ }
8
+ return to.concat(ar || Array.prototype.slice.call(from));
9
+ };
10
+ import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuCheckboxItem, DropdownMenuLabel, DropdownMenuSubTrigger, DropdownMenuSub, DropdownMenuSubContent, } from "./DropdownMenu";
11
+ import { Button } from "../../../components/Button/Button/Button";
12
+ import LUIcon from "../../../components/Icons/LUIcon";
13
+ import { useState } from "react";
14
+ import { dropdownMenuSize } from ".";
15
+ import { IconButton } from "../../../components/Button/IconButton/IconButton";
16
+ import { Checkbox } from "../../../components/Checkbox/checkbox";
17
+ import { Label } from "../../../components/Label/Label";
18
+ import { Caption } from "../../../components/Typography/Caption/caption";
19
+ import { Input } from "../../../components/Input";
20
+ import { SelectAllSection } from "./SelectAllSection";
21
+ import { Avatar, AvatarFallback, AvatarImage, } from "../../../components/Avatar/Avatar/Avatar";
22
+ export default {
23
+ title: "Components/Dropdown/DropdownMenu",
24
+ component: DropdownMenu,
25
+ tags: ["autodocs"],
26
+ argTypes: {
27
+ size: {
28
+ control: { type: "select" },
29
+ options: Object.keys(dropdownMenuSize),
30
+ description: "Dropdown menu size",
31
+ table: {
32
+ type: { summary: "string" },
33
+ defaultValue: { summary: "md" },
34
+ },
35
+ },
36
+ disabled: {
37
+ control: { type: "boolean" },
38
+ description: "Disable the dropdown menu item",
39
+ table: {
40
+ type: { summary: "boolean" },
41
+ defaultValue: { summary: false },
42
+ },
43
+ },
44
+ align: {
45
+ control: { type: "select" },
46
+ options: ["start", "center", "end"],
47
+ description: "Alignment of the dropdown menu",
48
+ table: {
49
+ type: { summary: "string" },
50
+ defaultValue: { summary: "start" },
51
+ },
52
+ },
53
+ },
54
+ };
55
+ var Template = function (args) {
56
+ var menuItems = [
57
+ { label: "Option 1" },
58
+ { label: "Option 2" },
59
+ { label: "Option 3" },
60
+ ];
61
+ return (<DropdownMenu {...args}>
62
+ <DropdownMenuTrigger>
63
+ <Button>Open Menu</Button>
64
+ </DropdownMenuTrigger>
65
+ <DropdownMenuContent>
66
+ {menuItems.map(function (item, index) { return (<DropdownMenuItem key={index} onSelect={function () { return alert("".concat(item.label, " selected")); }}>
67
+ {item.label}
68
+ </DropdownMenuItem>); })}
69
+ </DropdownMenuContent>
70
+ </DropdownMenu>);
71
+ };
72
+ export var Default = Template.bind({});
73
+ export var Sizes = function () {
74
+ var menuItems = [
75
+ {
76
+ label: "Home",
77
+ icon: "chart-simple",
78
+ },
79
+ {
80
+ label: "Profile",
81
+ icon: "chart-pie",
82
+ },
83
+ {
84
+ label: "Settings",
85
+ icon: "square-poll-horizontal",
86
+ },
87
+ {
88
+ label: "Logout",
89
+ icon: "square-poll-vertical",
90
+ },
91
+ ];
92
+ return (<div className="flex flex-row space-x-2">
93
+ <DropdownMenu>
94
+ <DropdownMenuTrigger>
95
+ <Button>Small Menu</Button>
96
+ </DropdownMenuTrigger>
97
+ <DropdownMenuContent size="sm">
98
+ {menuItems.map(function (item, index) { return (<DropdownMenuItem key={index} onSelect={function () { return alert("".concat(item.label, " selected")); }}>
99
+ <LUIcon icon={item.icon} size="sm"/> {item.label}
100
+ </DropdownMenuItem>); })}
101
+ </DropdownMenuContent>
102
+ </DropdownMenu>
103
+
104
+ <DropdownMenu>
105
+ <DropdownMenuTrigger>
106
+ <Button>Medium Menu</Button>
107
+ </DropdownMenuTrigger>
108
+ <DropdownMenuContent size="md">
109
+ {menuItems.map(function (item, index) { return (<DropdownMenuItem key={index} onSelect={function () { return alert("".concat(item.label, " selected")); }}>
110
+ <LUIcon icon={item.icon} size="md"/> {item.label}
111
+ </DropdownMenuItem>); })}
112
+ </DropdownMenuContent>
113
+ </DropdownMenu>
114
+
115
+ <DropdownMenu>
116
+ <DropdownMenuTrigger>
117
+ <Button>Large Menu</Button>
118
+ </DropdownMenuTrigger>
119
+ <DropdownMenuContent size="lg">
120
+ {menuItems.map(function (item, index) { return (<DropdownMenuItem key={index} onSelect={function () { return alert("".concat(item.label, " selected")); }}>
121
+ <LUIcon icon={item.icon} size="lg"/> {item.label}
122
+ </DropdownMenuItem>); })}
123
+ </DropdownMenuContent>
124
+ </DropdownMenu>
125
+ </div>);
126
+ };
127
+ export var WithIcons = function () {
128
+ var menuItems = [
129
+ {
130
+ label: "Home",
131
+ icon: "chart-simple",
132
+ },
133
+ {
134
+ label: "Profile",
135
+ icon: "chart-pie",
136
+ },
137
+ {
138
+ label: "Settings",
139
+ icon: "square-poll-horizontal",
140
+ },
141
+ {
142
+ label: "Logout",
143
+ icon: "square-poll-vertical",
144
+ },
145
+ ];
146
+ return (<DropdownMenu>
147
+ <DropdownMenuTrigger>
148
+ <Button>Menu with Icons</Button>
149
+ </DropdownMenuTrigger>
150
+ <DropdownMenuContent>
151
+ {menuItems.map(function (item, index) { return (<DropdownMenuItem key={index} onSelect={function () { return alert("".concat(item.label, " selected")); }}>
152
+ <LUIcon icon={item.icon} size="sm"/> {item.label}
153
+ </DropdownMenuItem>); })}
154
+ </DropdownMenuContent>
155
+ </DropdownMenu>);
156
+ };
157
+ export var DisabledItems = function () { return (<DropdownMenu>
158
+ <DropdownMenuTrigger>
159
+ <Button>Menu with Disabled Items</Button>
160
+ </DropdownMenuTrigger>
161
+ <DropdownMenuContent>
162
+ <DropdownMenuItem onSelect={function () { return alert("Enabled selected"); }}>
163
+ Enabled
164
+ </DropdownMenuItem>
165
+ <DropdownMenuItem disabled>Disabled</DropdownMenuItem>
166
+ <DropdownMenuSeparator />
167
+ <DropdownMenuItem onSelect={function () { return alert("Another enabled selected"); }}>
168
+ Another Enabled
169
+ </DropdownMenuItem>
170
+ </DropdownMenuContent>
171
+ </DropdownMenu>); };
172
+ export var NestedMenu = function () {
173
+ var menuItems = [
174
+ { label: "Open conversation details", icon: "eye", items: [] },
175
+ { label: "View full profile", icon: "user", items: [] },
176
+ { label: "Start conversation", icon: "address-book", items: [] },
177
+ {
178
+ label: "Copy",
179
+ icon: "copy",
180
+ items: [
181
+ { label: "Copy name", icon: "copy" },
182
+ { label: "Copy email", icon: "copy" },
183
+ { label: "Copy link", icon: "copy" },
184
+ ],
185
+ },
186
+ { label: "Search in conversation", icon: "magnifying-glass" },
187
+ { label: "Open in new window", icon: "arrow-right-to-bracket" },
188
+ ];
189
+ return (<DropdownMenu>
190
+ <DropdownMenuTrigger asChild>
191
+ <IconButton variant="outline" icon="plus"/>
192
+ </DropdownMenuTrigger>
193
+ <DropdownMenuContent className="mt-2">
194
+ {menuItems.map(function (item, index) {
195
+ if (item.items && item.items.length > 0) {
196
+ return (<DropdownMenuSub key={index}>
197
+ <DropdownMenuSubTrigger>
198
+ <LUIcon icon={item.icon}/> {item.label}
199
+ </DropdownMenuSubTrigger>
200
+ <DropdownMenuSubContent>
201
+ {item.items.map(function (subItem, subIndex) { return (<DropdownMenuItem key={subIndex}>
202
+ <LUIcon icon={subItem.icon}/> {subItem.label}
203
+ </DropdownMenuItem>); })}
204
+ </DropdownMenuSubContent>
205
+ </DropdownMenuSub>);
206
+ }
207
+ return (<DropdownMenuItem key={index}>
208
+ <LUIcon icon={item.icon}/> {item.label}
209
+ </DropdownMenuItem>);
210
+ })}
211
+ </DropdownMenuContent>
212
+ </DropdownMenu>);
213
+ };
214
+ export var DropdownMenuWithSelectAll = function () {
215
+ var tags = ["Sport", "Music", "Food", "Travel", "Tech", "Science", "Art"];
216
+ var _a = useState([]), selectedTags = _a[0], setSelectedTags = _a[1];
217
+ var handleTagChange = function (tag, checked) {
218
+ if (checked) {
219
+ setSelectedTags(__spreadArray(__spreadArray([], selectedTags, true), [tag], false));
220
+ }
221
+ else {
222
+ setSelectedTags(selectedTags.filter(function (t) { return t !== tag; }));
223
+ }
224
+ };
225
+ var handleSelectAll = function () {
226
+ var allSelected = selectedTags.length === tags.length;
227
+ var next = allSelected ? [] : __spreadArray([], tags, true);
228
+ setSelectedTags(next);
229
+ };
230
+ return (<DropdownMenu>
231
+ <DropdownMenuTrigger asChild>
232
+ <Button variant="outline">Select Tags</Button>
233
+ </DropdownMenuTrigger>
234
+ <DropdownMenuContent className="w-50" size="lg">
235
+ <DropdownMenuLabel>Select Tags</DropdownMenuLabel>
236
+ <div className="flex flex-col gap-1 rounded-sm bg-gray-50 text-gray-800 py-3 px-4">
237
+ <div className="flex items-center gap-2">
238
+ <Checkbox id="dm-select-all" checked={selectedTags.length === tags.length} onCheckedChange={function () { return handleSelectAll(); }} onClick={function (e) { return e.stopPropagation(); }} size="md"/>
239
+ <Label htmlFor="dm-select-all">Select All</Label>
240
+ </div>
241
+ <Caption className="text-gray-500">
242
+ Selected ({selectedTags.length})
243
+ </Caption>
244
+ </div>
245
+ <DropdownMenuSeparator />
246
+ {tags.map(function (tag) { return (<DropdownMenuCheckboxItem checked={selectedTags.includes(tag)} key={tag} onCheckedChange={function (checked) { return handleTagChange(tag, checked); }}
247
+ // Prevent the dropdown menu from closing when the checkbox is clicked
248
+ onSelect={function (e) { return e.preventDefault(); }}>
249
+ {tag}
250
+ </DropdownMenuCheckboxItem>); })}
251
+ </DropdownMenuContent>
252
+ </DropdownMenu>);
253
+ };
254
+ export var MultipleSelections = function () {
255
+ var tags = ["Sport", "Music", "Food", "Travel", "Tech", "Science", "Art"];
256
+ var _a = useState([
257
+ tags[0],
258
+ tags[4],
259
+ ]), selectedTags = _a[0], setSelectedTags = _a[1];
260
+ var handleTagChange = function (tag, checked) {
261
+ if (checked) {
262
+ setSelectedTags(__spreadArray(__spreadArray([], selectedTags, true), [tag], false));
263
+ }
264
+ else {
265
+ setSelectedTags(selectedTags.filter(function (t) { return t !== tag; }));
266
+ }
267
+ };
268
+ return (<DropdownMenu>
269
+ <DropdownMenuTrigger asChild>
270
+ <Button variant="outline">Select Tags</Button>
271
+ </DropdownMenuTrigger>
272
+ <DropdownMenuContent className="w-44" size="lg">
273
+ <DropdownMenuLabel>Select Tags</DropdownMenuLabel>
274
+ <DropdownMenuSeparator />
275
+ {tags.map(function (tag) { return (<DropdownMenuCheckboxItem checked={selectedTags.includes(tag)} key={tag} onCheckedChange={function (checked) { return handleTagChange(tag, checked); }}
276
+ // Prevent the dropdown menu from closing when the checkbox is clicked
277
+ onSelect={function (e) { return e.preventDefault(); }}>
278
+ {tag}
279
+ </DropdownMenuCheckboxItem>); })}
280
+ </DropdownMenuContent>
281
+ </DropdownMenu>);
282
+ };
283
+ export var DropdownMenuWithSearch = function () {
284
+ var menuItems = [
285
+ { label: "Open conversation details", icon: "eye" },
286
+ { label: "View full profile", icon: "user" },
287
+ { label: "Start conversation", icon: "address-book" },
288
+ ];
289
+ var _a = useState(false), open = _a[0], setOpen = _a[1];
290
+ var _b = useState(""), query = _b[0], setQuery = _b[1];
291
+ var filteredItems = menuItems.filter(function (item) {
292
+ return item.label.toLowerCase().includes(query.toLowerCase());
293
+ });
294
+ return (<DropdownMenu open={open} onOpenChange={setOpen}>
295
+ <DropdownMenuTrigger asChild>
296
+ <Button variant="outline">Select an Option</Button>
297
+ </DropdownMenuTrigger>
298
+ <DropdownMenuContent className="p-0" size="lg">
299
+ <div className="p-2">
300
+ <Input placeholder="Search..." value={query} onChange={function (e) { return setQuery(e.target.value); }} onKeyDownCapture={function (e) { return e.stopPropagation(); }} startIcon="magnifying-glass"/>
301
+ </div>
302
+ {filteredItems.length === 0 ? (<div className="py-6 text-center text-sm text-muted-foreground">
303
+ No results found.
304
+ </div>) : (filteredItems.map(function (option) { return (<DropdownMenuItem key={option.label} onSelect={function () { return setOpen(false); }}>
305
+ <LUIcon icon={option.icon}/> {option.label}
306
+ </DropdownMenuItem>); }))}
307
+ </DropdownMenuContent>
308
+ </DropdownMenu>);
309
+ };
310
+ DropdownMenuWithSearch.parameters = {
311
+ docs: {
312
+ description: {
313
+ story: "DropdownMenuWithSearch provides a dropdown menu that includes a search box. Users can type into the box to filter the menu items. For larger dropdowns, a large search input should be used; for medium dropdowns, a medium input; and for small dropdowns, a small input.",
314
+ },
315
+ },
316
+ };
317
+ export var DropdownMenuWithSelectAllAndSearch = function () {
318
+ var tags = ["Sport", "Music", "Food", "Travel", "Tech", "Science", "Art"];
319
+ var _a = useState([]), selectedTags = _a[0], setSelectedTags = _a[1];
320
+ var _b = useState(""), query = _b[0], setQuery = _b[1];
321
+ var toggleTag = function (tag) {
322
+ setSelectedTags(function (prev) {
323
+ return prev.includes(tag) ? prev.filter(function (t) { return t !== tag; }) : __spreadArray(__spreadArray([], prev, true), [tag], false);
324
+ });
325
+ };
326
+ var handleSelectAll = function () {
327
+ var allSelected = selectedTags.length === tags.length;
328
+ setSelectedTags(allSelected ? [] : __spreadArray([], tags, true));
329
+ };
330
+ var filtered = tags.filter(function (t) {
331
+ return t.toLowerCase().includes(query.toLowerCase());
332
+ });
333
+ return (<DropdownMenu>
334
+ <DropdownMenuTrigger asChild>
335
+ <Button variant="outline">Select Tags</Button>
336
+ </DropdownMenuTrigger>
337
+ <DropdownMenuContent size="lg">
338
+ <div className="mb-2">
339
+ <Input placeholder="Search..." value={query} onChange={function (e) { return setQuery(e.target.value); }} onKeyDownCapture={function (e) { return e.stopPropagation(); }} size="lg" startIcon="magnifying-glass"/>
340
+ </div>
341
+
342
+ <SelectAllSection checked={selectedTags.length === tags.length && tags.length > 0} onToggleAll={handleSelectAll} selectedCount={selectedTags.length} size="lg"/>
343
+ <DropdownMenuSeparator />
344
+ {filtered.length === 0 ? (<div className="py-6 text-center text-sm text-muted-foreground">
345
+ No results found.
346
+ </div>) : (filtered.map(function (tag) {
347
+ var isSelected = selectedTags.includes(tag);
348
+ return (<DropdownMenuCheckboxItem key={tag} checked={isSelected}
349
+ // Prevent DropdownMenu from closing in multi-select scenario
350
+ onSelect={function (e) { return e.preventDefault(); }} onCheckedChange={function () { return toggleTag(tag); }} className={isSelected ? "bg-blue-50 text-blue-600" : ""}>
351
+ {tag}
352
+ </DropdownMenuCheckboxItem>);
353
+ }))}
354
+ </DropdownMenuContent>
355
+ </DropdownMenu>);
356
+ };
357
+ export var WorkSpaceSwitcher = function () {
358
+ var workspaces = [
359
+ {
360
+ id: 1,
361
+ name: "Workspace 1",
362
+ createdBy: "abc@example.com",
363
+ },
364
+ {
365
+ id: 2,
366
+ name: "Workspace 2",
367
+ createdBy: "def@example.com",
368
+ },
369
+ {
370
+ id: 3,
371
+ name: "Workspace 3",
372
+ createdBy: "ghi@example.com",
373
+ },
374
+ ];
375
+ var _a = useState(workspaces[0]), selectedWorkspace = _a[0], setSelectedWorkspace = _a[1];
376
+ return (<DropdownMenu>
377
+ <DropdownMenuTrigger className="flex items-center gap-2 bg-accent py-2.5 px-3 rounded-lg">
378
+ <Avatar>
379
+ <AvatarImage alt="Avatar" src="/images/avatar.png"/>
380
+ <AvatarFallback>AB</AvatarFallback>
381
+ </Avatar>
382
+ <div className="text-start flex flex-col gap-1 leading-none">
383
+ <span className="text-sm leading-none font-semibold truncate max-w-[17ch]">
384
+ {selectedWorkspace.name}
385
+ </span>
386
+ <span className="text-xs text-muted-foreground truncate max-w-[20ch]">
387
+ {selectedWorkspace.createdBy}
388
+ </span>
389
+ </div>
390
+ <LUIcon icon="angle-down"/>
391
+ </DropdownMenuTrigger>
392
+ <DropdownMenuContent>
393
+ <DropdownMenuLabel>Workspaces</DropdownMenuLabel>
394
+ {workspaces.map(function (workspace) { return (<DropdownMenuItem key={workspace.id} onClick={function () { return setSelectedWorkspace(workspace); }}>
395
+ <div className="flex items-center gap-2">
396
+ <Avatar>
397
+ <AvatarImage alt="Avatar" src="/images/avatar.png"/>
398
+ <AvatarFallback>AB</AvatarFallback>
399
+ </Avatar>
400
+ <div className="flex flex-col">
401
+ <span>{workspace.name}</span>
402
+ <span className="text-xs text-muted-foreground">
403
+ {workspace.createdBy}
404
+ </span>
405
+ </div>
406
+ </div>
407
+ {selectedWorkspace.id === workspace.id && (<LUIcon icon="check" className="ml-auto"/>)}
408
+ </DropdownMenuItem>); })}
409
+ </DropdownMenuContent>
410
+ </DropdownMenu>);
411
+ };
412
+ export var LanguageDropdownMenu = function () {
413
+ var languages = ["English", "Spanish", "French", "German", "Chinese"];
414
+ var _a = useState(languages[0]), selectedLanguage = _a[0], setSelectedLanguage = _a[1];
415
+ var _b = useState(false), isOpen = _b[0], setIsOpen = _b[1];
416
+ return (<DropdownMenu open={isOpen} onOpenChange={setIsOpen}>
417
+ <DropdownMenuTrigger asChild>
418
+ <Button shape="rounded-full" startIcon="language" endIcon={isOpen ? "angle-up" : "angle-down"}>
419
+ {selectedLanguage}
420
+ </Button>
421
+ </DropdownMenuTrigger>
422
+ <DropdownMenuContent className="w-50">
423
+ {languages.map(function (language) { return (<DropdownMenuItem key={language} onSelect={function () { return setSelectedLanguage(language); }}>
424
+ {language}
425
+ </DropdownMenuItem>); })}
426
+ </DropdownMenuContent>
427
+ </DropdownMenu>);
428
+ };
429
+ export var Alignments = function () {
430
+ return (<div className="flex flex-row space-x-4">
431
+ <DropdownMenu>
432
+ <DropdownMenuTrigger>
433
+ <Button>Align Start</Button>
434
+ </DropdownMenuTrigger>
435
+ <DropdownMenuContent align="start">
436
+ <DropdownMenuItem>Option 1</DropdownMenuItem>
437
+ <DropdownMenuItem>Option 2</DropdownMenuItem>
438
+ <DropdownMenuItem>Option 3</DropdownMenuItem>
439
+ </DropdownMenuContent>
440
+ </DropdownMenu>
441
+
442
+ <DropdownMenu>
443
+ <DropdownMenuTrigger>
444
+ <Button>Align Center</Button>
445
+ </DropdownMenuTrigger>
446
+ <DropdownMenuContent align="center">
447
+ <DropdownMenuItem>Option 1</DropdownMenuItem>
448
+ <DropdownMenuItem>Option 2</DropdownMenuItem>
449
+ <DropdownMenuItem>Option 3</DropdownMenuItem>
450
+ </DropdownMenuContent>
451
+ </DropdownMenu>
452
+
453
+ <DropdownMenu>
454
+ <DropdownMenuTrigger>
455
+ <Button>Align End</Button>
456
+ </DropdownMenuTrigger>
457
+ <DropdownMenuContent align="end">
458
+ <DropdownMenuItem>Option 1</DropdownMenuItem>
459
+ <DropdownMenuItem>Option 2</DropdownMenuItem>
460
+ <DropdownMenuItem>Option 3</DropdownMenuItem>
461
+ </DropdownMenuContent>
462
+ </DropdownMenu>
463
+ </div>);
464
+ };
@@ -0,0 +1,19 @@
1
+ import * as React from "react";
2
+ import { Checkbox } from "../../../components/Checkbox/checkbox";
3
+ import { Label } from "../../../components/Label/Label";
4
+ import { Caption } from "../../../components/Typography/Caption/caption";
5
+ export var SelectAllSection = function (_a) {
6
+ var _b = _a.id, id = _b === void 0 ? "dm-select-all" : _b, checked = _a.checked, onToggleAll = _a.onToggleAll, selectedCount = _a.selectedCount, _c = _a.size, size = _c === void 0 ? "md" : _c;
7
+ var labelVariant = size === "lg" ? "label-lg" : size === "md" ? "label-md" : "label-sm";
8
+ return (<div className="flex flex-col gap-1 rounded-sm bg-gray-50 text-gray-800 py-3 px-4">
9
+ <div className="flex items-center gap-2">
10
+ <Checkbox id={id} checked={checked} onCheckedChange={onToggleAll} onClick={function (e) { return e.stopPropagation(); }} size={size}/>
11
+ <Label htmlFor={id} variant={labelVariant}>
12
+ Select All
13
+ </Label>
14
+ </div>
15
+ <Caption className="text-gray-500" variant="sm">
16
+ Selected ({selectedCount})
17
+ </Caption>
18
+ </div>);
19
+ };
@@ -0,0 +1,201 @@
1
+ import { Select, SelectTrigger, SelectContent, SelectItem, SelectGroup, SelectLabel, SelectSeparator, SelectValue, } from "./select";
2
+ import { selectColor, selectShape, selectSize, selectType, } from ".";
3
+ import LUIcon from "../Icons/LUIcon";
4
+ import React from "react";
5
+ var meta = {
6
+ title: "Components/Select",
7
+ component: Select,
8
+ tags: ["autodocs"],
9
+ argTypes: {
10
+ onValueChange: {
11
+ control: false,
12
+ description: "Callback fired when the value changes",
13
+ table: {
14
+ type: { summary: "(value: string) => void" },
15
+ defaultValue: { summary: undefined },
16
+ },
17
+ },
18
+ size: {
19
+ control: { type: "select" },
20
+ options: Object.keys(selectSize),
21
+ description: "Size of the select trigger",
22
+ table: {
23
+ type: { summary: "SelectSize" },
24
+ defaultValue: { summary: "md" },
25
+ },
26
+ },
27
+ variant: {
28
+ control: { type: "select" },
29
+ options: Object.keys(selectType),
30
+ description: "Type of the select trigger",
31
+ table: {
32
+ type: { summary: "SelectType" },
33
+ defaultValue: { summary: "fill" },
34
+ },
35
+ },
36
+ color: {
37
+ control: { type: "select" },
38
+ options: Object.keys(selectColor.fill),
39
+ description: "Color of the select trigger",
40
+ table: {
41
+ type: { summary: "SelectColor" },
42
+ defaultValue: { summary: "default" },
43
+ },
44
+ },
45
+ placeholder: {
46
+ control: { type: "text" },
47
+ description: "Placeholder text for the select",
48
+ table: {
49
+ type: { summary: "string" },
50
+ defaultValue: { summary: "Select an option" },
51
+ },
52
+ },
53
+ shape: {
54
+ control: { type: "select" },
55
+ options: Object.keys(selectShape),
56
+ description: "Shape of the select trigger",
57
+ table: {
58
+ type: { summary: "SelectShape" },
59
+ defaultValue: { summary: "rectangular" },
60
+ },
61
+ },
62
+ disabled: {
63
+ control: { type: "boolean" },
64
+ description: "Disable the select",
65
+ table: {
66
+ type: { summary: "boolean" },
67
+ defaultValue: { summary: false },
68
+ },
69
+ },
70
+ defaultValue: {
71
+ control: { type: "text" },
72
+ description: "Default value for the select",
73
+ table: {
74
+ type: { summary: "string" },
75
+ },
76
+ },
77
+ },
78
+ args: {
79
+ size: "md",
80
+ shape: "rectangular",
81
+ variant: "fill",
82
+ color: "default",
83
+ placeholder: "Select an option",
84
+ disabled: false,
85
+ onValueChange: function (value) {
86
+ console.log("Select value changed:", value);
87
+ },
88
+ },
89
+ };
90
+ export default meta;
91
+ export var Default = function (args) { return (<Select disabled={args.disabled} onValueChange={args.onValueChange}>
92
+ <SelectTrigger size={args.size} shape={args.shape} variant={args.variant} color={args.color} disabled={args.disabled}>
93
+ <SelectValue placeholder={args.placeholder}/>
94
+ </SelectTrigger>
95
+ <SelectContent>
96
+ <SelectItem value="one">One</SelectItem>
97
+ </SelectContent>
98
+ </Select>); };
99
+ export var Group = function () {
100
+ var groupedOptions = [
101
+ {
102
+ label: "Fruits",
103
+ items: [
104
+ { value: "apple", label: "Apple", icon: "plus" },
105
+ { value: "banana", label: "Banana" },
106
+ { value: "orange", label: "Orange" },
107
+ ],
108
+ },
109
+ {
110
+ label: "Vegetables",
111
+ items: [
112
+ { value: "carrot", label: "Carrot" },
113
+ { value: "lettuce", label: "Lettuce" },
114
+ ],
115
+ },
116
+ ];
117
+ return (<Select onValueChange={function (value) {
118
+ console.log("Select value changed:", value);
119
+ }} defaultValue={"apple"}>
120
+ <SelectTrigger color="default" size="md" shape="rectangular" variant="fill" disabled={false}>
121
+ <SelectValue placeholder="Select Option"/>
122
+ </SelectTrigger>
123
+ <SelectContent>
124
+ <SelectGroup>
125
+ {groupedOptions.map(function (group, idx) { return (<React.Fragment key={group.label}>
126
+ <SelectLabel>{group.label}</SelectLabel>
127
+ {group.items.map(function (item) { return (<SelectItem value={item.value} key={item.value}>
128
+ {item.icon && (<LUIcon icon={item.icon} size="sm"/>)}
129
+ {item.label}
130
+ </SelectItem>); })}
131
+ {idx < groupedOptions.length - 1 && <SelectSeparator />}
132
+ </React.Fragment>); })}
133
+ </SelectGroup>
134
+ </SelectContent>
135
+ </Select>);
136
+ };
137
+ export var KeyValue = function () {
138
+ var backendOptions = [
139
+ { key: "us", label: "United States", icon: "info" },
140
+ { key: "ca", label: "Canada", icon: "plus" },
141
+ { key: "mx", label: "Mexico", icon: "minus" },
142
+ { key: "uk", label: "United Kingdom", icon: "check" },
143
+ { key: "fr", label: "France", icon: "star" },
144
+ ];
145
+ return (<Select disabled={false}>
146
+ <SelectTrigger size="md" shape="rectangular" variant="fill" color="default" disabled={false}>
147
+ <SelectValue placeholder={"Select a country"}/>
148
+ </SelectTrigger>
149
+ <SelectContent>
150
+ {backendOptions.map(function (option) { return (<SelectItem key={option.key} value={option.key}>
151
+ {option.icon && (<LUIcon icon={option.icon} size="sm" className="mr-2"/>)}
152
+ {option.label}
153
+ </SelectItem>); })}
154
+ </SelectContent>
155
+ </Select>);
156
+ };
157
+ KeyValue.story = {
158
+ parameters: {
159
+ docs: {
160
+ description: {
161
+ story: "This story demonstrates how to render Select options from a backend-like key-value array. The dropdown values (keys) are mapped from a simulated backend, and the display text is the label. This is useful for cases where you need to show a label but store a key in your form state.",
162
+ },
163
+ },
164
+ },
165
+ };
166
+ export var Disabled = function (args) { return (<Select disabled={args.disabled} onValueChange={args.onValueChange}>
167
+ <SelectTrigger disabled={args.disabled || true} shape={args.shape} variant={args.variant} color={args.color}>
168
+ <SelectValue placeholder={args.placeholder || "Disabled select"}/>
169
+ </SelectTrigger>
170
+ <SelectContent>
171
+ <SelectItem value="a">A</SelectItem>
172
+ <SelectItem value="b">B</SelectItem>
173
+ </SelectContent>
174
+ </Select>); };
175
+ // Story: Large Dropdown with many items
176
+ export var LargeDropdown = function () { return (<Select disabled={false}>
177
+ <SelectTrigger size="lg" disabled={false}>
178
+ <SelectValue placeholder="Select a country"/>
179
+ </SelectTrigger>
180
+ <SelectContent>
181
+ <SelectGroup>
182
+ <SelectLabel>Options</SelectLabel>
183
+ {Array.from({ length: 10 }, function (_, i) { return (<SelectItem key={i} value={"option-".concat(i + 1)}>
184
+ Option {i + 1}
185
+ </SelectItem>); })}
186
+ </SelectGroup>
187
+ </SelectContent>
188
+ </Select>); };
189
+ // Story: Select with a disabled item
190
+ export var WithDisabledItem = function () { return (<Select>
191
+ <SelectTrigger size="md">
192
+ <SelectValue placeholder="Select an option"/>
193
+ </SelectTrigger>
194
+ <SelectContent>
195
+ <SelectItem value="enabled-1">Enabled Option 1</SelectItem>
196
+ <SelectItem value="disabled-2" disabled>
197
+ Disabled Option
198
+ </SelectItem>
199
+ <SelectItem value="enabled-3">Enabled Option 2</SelectItem>
200
+ </SelectContent>
201
+ </Select>); };