linkedunion-design-kit 1.9.1 → 1.9.2
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/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/src/components/Accordion/accordion.js +1 -1
- package/dist/src/components/Alerts/Alert/alert.d.ts +19 -0
- package/dist/src/components/Alerts/Alert/alert.js +156 -0
- package/dist/src/components/Alerts/Alert/alert.stories.d.ts +30 -0
- package/dist/src/components/Alerts/Alert/alert.stories.js +166 -0
- package/dist/src/components/Alerts/AlertDialog/alert-dialog.d.ts +45 -0
- package/dist/src/components/Alerts/AlertDialog/alert-dialog.js +168 -0
- package/dist/src/components/Alerts/AlertDialog/alert-dialog.stories.d.ts +69 -0
- package/dist/src/components/Alerts/AlertDialog/alert-dialog.stories.js +213 -0
- package/dist/src/components/Alerts/AlertDialog/index.d.ts +44 -0
- package/dist/src/components/Alerts/AlertDialog/index.js +189 -0
- package/dist/src/components/Avatar/Avatar/Avatar.d.ts +12 -3
- package/dist/src/components/Avatar/Avatar/Avatar.js +49 -11
- package/dist/src/components/Avatar/Avatar/Avatar.stories.d.ts +16 -2
- package/dist/src/components/Avatar/Avatar/Avatar.stories.js +51 -25
- package/dist/src/components/Avatar/Avatar/Avatar.test.js +6 -46
- package/dist/src/components/Avatar/Avatar/Avatar1.stories.d.ts +17 -0
- package/dist/src/components/Avatar/Avatar/Avatar1.stories.js +68 -0
- package/dist/src/components/Avatar/Avatar/index.d.ts +51 -28
- package/dist/src/components/Avatar/Avatar/index.js +76 -28
- package/dist/src/components/Avatar/AvatarGroup/AvatarGroup.js +1 -1
- package/dist/src/components/Avatar/AvatarGroup/AvatarGroup.stories.js +1 -1
- package/dist/src/components/Avatar/StatusIndicator/StatusIndicator.d.ts +3 -0
- package/dist/src/components/Avatar/StatusIndicator/StatusIndicator.js +18 -0
- package/dist/src/components/Avatar/StatusIndicator/StatusIndicator.stories.d.ts +44 -0
- package/dist/src/components/Avatar/StatusIndicator/StatusIndicator.stories.js +41 -0
- package/dist/src/components/Avatar/StatusIndicator/index.d.ts +27 -0
- package/dist/src/components/Avatar/StatusIndicator/index.js +29 -0
- package/dist/src/components/Avatar/StatusIndicator/type.d.ts +6 -0
- package/dist/src/components/Badge/Badge.d.ts +21 -0
- package/dist/src/components/Badge/Badge.js +59 -0
- package/dist/src/components/Badge/Badge.stories.d.ts +719 -0
- package/dist/src/components/Badge/Badge.stories.js +145 -0
- package/dist/src/components/Badge/index.d.ts +47 -0
- package/dist/src/components/Badge/index.js +49 -0
- package/dist/src/components/Button/Button/Button.d.ts +2 -2
- package/dist/src/components/Button/Button/Button.stories.d.ts +4 -4
- package/dist/src/components/Button/IconButton/IconButton.d.ts +2 -2
- package/dist/src/components/Button/IconButton/IconButton.stories.d.ts +4 -4
- package/dist/src/components/Dropdown/Combobox/Combobox.d.ts +3 -0
- package/dist/src/components/Dropdown/Combobox/Combobox.js +160 -0
- package/dist/src/components/Dropdown/Combobox/Combobox.stories.d.ts +13 -0
- package/dist/src/components/Dropdown/Combobox/Combobox.stories.js +225 -0
- package/dist/src/components/Dropdown/Combobox/index.d.ts +35 -0
- package/dist/src/components/Dropdown/Combobox/index.js +36 -0
- package/dist/src/components/Dropdown/Combobox/type.d.ts +25 -0
- package/dist/src/components/Dropdown/Combobox/utils/getLabelVariant.d.ts +3 -0
- package/dist/src/components/Dropdown/Combobox/utils/getLabelVariant.js +7 -0
- package/dist/src/components/Dropdown/Combobox/utils/renderBadge.d.ts +6 -0
- package/dist/src/components/Dropdown/Combobox/utils/renderBadge.js +5 -0
- package/dist/src/components/Dropdown/Combobox/utils/useResponsiveBadge.d.ts +1 -0
- package/dist/src/components/Dropdown/Combobox/utils/useResponsiveBadge.js +14 -0
- package/dist/src/components/Dropdown/DropdownMenu/DropdownMenu.d.ts +37 -0
- package/dist/src/components/Dropdown/DropdownMenu/DropdownMenu.js +96 -0
- package/dist/src/components/Dropdown/DropdownMenu/DropdownMenu.stories.d.ts +25 -0
- package/dist/src/components/Dropdown/DropdownMenu/DropdownMenu.stories.js +253 -0
- package/dist/src/components/Dropdown/DropdownMenu/SelectAllSection.d.ts +3 -0
- package/dist/src/components/Dropdown/DropdownMenu/SelectAllSection.js +9 -0
- package/dist/src/components/Dropdown/DropdownMenu/index.d.ts +20 -0
- package/dist/src/components/Dropdown/DropdownMenu/index.js +21 -0
- package/dist/src/components/Dropdown/DropdownMenu/type.d.ts +7 -0
- package/dist/src/components/Dropdown/select.js +3 -3
- package/dist/src/components/Icons/LUIcon.d.ts +1 -1
- package/dist/src/components/Icons/LUIcon.js +15 -8
- package/dist/src/components/Icons/LUIcon.test.d.ts +0 -1
- package/dist/src/components/Icons/LUIcon.test.js +306 -253
- package/dist/src/components/Icons/index.d.ts +23 -8
- package/dist/src/components/Icons/index.js +43 -28
- package/dist/src/components/Icons/stories/InteractiveIconSelector.js +3 -3
- package/dist/src/components/Icons/stories/LUIcon.stories.d.ts +9 -5
- package/dist/src/components/Icons/stories/LUIcon.stories.js +28 -43
- package/dist/src/components/Icons/type.d.ts +0 -1
- package/dist/src/components/SweetAlert/SweetAlert.d.ts +40 -0
- package/dist/src/components/SweetAlert/SweetAlert.js +150 -0
- package/dist/src/components/SweetAlert/SweetAlert.stories.d.ts +86 -0
- package/dist/src/components/SweetAlert/SweetAlert.stories.js +305 -0
- package/dist/src/components/SweetAlert/index.d.ts +24 -0
- package/dist/src/components/SweetAlert/index.js +137 -0
- package/dist/src/components/ui/avatar.d.ts +10 -3
- package/dist/src/components/ui/avatar.js +27 -12
- package/dist/src/components/ui/command.d.ts +22 -0
- package/dist/src/components/ui/command.js +65 -0
- package/dist/src/components/ui/dialog.d.ts +15 -0
- package/dist/src/components/ui/dialog.js +68 -0
- package/dist/src/components/ui/popover.d.ts +7 -0
- package/dist/src/components/ui/popover.js +42 -0
- package/dist/src/utils/constants.d.ts +1 -0
- package/dist/src/utils/constants.js +1 -0
- package/dist/styles/global.css +727 -53
- package/dist/tailwind.config.js +6 -0
- package/package.json +6 -1
- package/dist/app/layout.jsx +0 -13
- package/dist/app/page.jsx +0 -5
- package/dist/next.config.d.ts +0 -8
- package/dist/next.config.js +0 -10
- package/dist/src/components/Accordion/Accordion.stories.jsx +0 -33
- package/dist/src/components/Accordion/accordion.jsx +0 -59
- package/dist/src/components/AppIcons/AndroidIcon.jsx +0 -24
- package/dist/src/components/AppIcons/AppIcon.jsx +0 -29
- package/dist/src/components/AppIcons/AppIcon.stories.jsx +0 -223
- package/dist/src/components/AppIcons/AppleIcon.jsx +0 -31
- package/dist/src/components/AppIcons/PlayStoreIcon.jsx +0 -29
- package/dist/src/components/Avatar/Avatar/Avatar.jsx +0 -17
- package/dist/src/components/Avatar/Avatar/Avatar.stories.jsx +0 -31
- package/dist/src/components/Avatar/Avatar/Avatar.test.jsx +0 -51
- package/dist/src/components/Avatar/AvatarGroup/AvatarGroup.jsx +0 -17
- package/dist/src/components/Avatar/AvatarGroup/AvatarGroup.stories.jsx +0 -32
- package/dist/src/components/Button/Button/Button.jsx +0 -73
- package/dist/src/components/Button/Button/Button.stories.jsx +0 -283
- package/dist/src/components/Button/Button/Button.test.jsx +0 -73
- package/dist/src/components/Button/Button/index.d.ts +0 -63
- package/dist/src/components/Button/Button/index.js +0 -64
- package/dist/src/components/Button/Button.d.ts +0 -20
- package/dist/src/components/Button/Button.js +0 -83
- package/dist/src/components/Button/Button.stories.d.ts +0 -725
- package/dist/src/components/Button/Button.stories.js +0 -288
- package/dist/src/components/Button/Button.test.js +0 -10
- package/dist/src/components/Button/IconButton/IconButton.jsx +0 -63
- package/dist/src/components/Button/IconButton/IconButton.stories.jsx +0 -128
- package/dist/src/components/Button/IconButton/IconButton.test.jsx +0 -28
- package/dist/src/components/Button/IconButton/index.d.ts +0 -0
- package/dist/src/components/Button/IconButton/index.js +0 -1
- package/dist/src/components/Button/IconButton.d.ts +0 -33
- package/dist/src/components/Button/IconButton.js +0 -79
- package/dist/src/components/Button/IconButton.stories.d.ts +0 -4
- package/dist/src/components/Button/IconButton.stories.js +0 -65
- package/dist/src/components/Button/IconButton.test.js +0 -28
- package/dist/src/components/Card/MultipleNews/MultiNews.jsx +0 -80
- package/dist/src/components/Card/MultipleNews/MultiNews.stories.jsx +0 -104
- package/dist/src/components/Card/PostByCategory/PostByCategory.jsx +0 -60
- package/dist/src/components/Card/PostByCategory/PostByCategory.stories.jsx +0 -106
- package/dist/src/components/Card/SinglePost/SinglePost.jsx +0 -26
- package/dist/src/components/Card/SinglePost/SinglePost.stories.jsx +0 -68
- package/dist/src/components/Card/card.jsx +0 -36
- package/dist/src/components/Card/contactProfile/ContactProfile.jsx +0 -60
- package/dist/src/components/Card/contactProfile/ContactProfile.stories.jsx +0 -103
- package/dist/src/components/Card/photoAlbum/PhotoAlbum.jsx +0 -41
- package/dist/src/components/Card/photoAlbum/PhotoAlbum.stories.jsx +0 -69
- package/dist/src/components/Card/photoGallery/PhotoGallery.jsx +0 -17
- package/dist/src/components/Card/photoGallery/PhotoGallery.stories.jsx +0 -39
- package/dist/src/components/Checkbox/checkbox.jsx +0 -47
- package/dist/src/components/Checkbox/checkbox.stories.jsx +0 -113
- package/dist/src/components/ColorPicker/ColorPicker.jsx +0 -67
- package/dist/src/components/ColorPicker/ColorPicker.stories.jsx +0 -138
- package/dist/src/components/Colors/color.jsx +0 -5
- package/dist/src/components/Colors/color.stories.jsx +0 -20
- package/dist/src/components/Colors/color.test.jsx +0 -23
- package/dist/src/components/Dropdown/Select.stories.jsx +0 -201
- package/dist/src/components/Dropdown/select.jsx +0 -94
- package/dist/src/components/Icons/IconList.test.d.ts +0 -1
- package/dist/src/components/Icons/IconList.test.js +0 -58
- package/dist/src/components/Icons/IconView.d.ts +0 -1
- package/dist/src/components/Icons/IconView.js +0 -8
- package/dist/src/components/Icons/IconView.stories.d.ts +0 -4
- package/dist/src/components/Icons/IconView.stories.js +0 -20
- package/dist/src/components/Icons/LUIcon.jsx +0 -36
- package/dist/src/components/Icons/LUIcon.stories.d.ts +0 -6
- package/dist/src/components/Icons/LUIcon.stories.js +0 -75
- package/dist/src/components/Icons/LUIcon.test.jsx +0 -243
- package/dist/src/components/Icons/SingleIcon.test.d.ts +0 -1
- package/dist/src/components/Icons/SingleIcon.test.js +0 -68
- package/dist/src/components/Icons/stories/IconDropdown.jsx +0 -67
- package/dist/src/components/Icons/stories/IconGallery.jsx +0 -77
- package/dist/src/components/Icons/stories/InteractiveIconSelector.jsx +0 -86
- package/dist/src/components/Icons/stories/LUIcon.stories.jsx +0 -96
- package/dist/src/components/ImageUploader/ImageUploader.stories.jsx +0 -50
- package/dist/src/components/ImageUploader/imageUploader.jsx +0 -94
- package/dist/src/components/Images/LuImage.jsx +0 -19
- package/dist/src/components/Images/LuImage.stories.jsx +0 -154
- package/dist/src/components/Images/LuImage.test.jsx +0 -44
- package/dist/src/components/Input/Input.stories.jsx +0 -250
- package/dist/src/components/Input/input.jsx +0 -110
- package/dist/src/components/Label/Label.jsx +0 -32
- package/dist/src/components/Label/Label.stories.jsx +0 -30
- package/dist/src/components/MediaCard/Card.d.ts +0 -3
- package/dist/src/components/MediaCard/Card.js +0 -45
- package/dist/src/components/MediaCard/Card.stories.d.ts +0 -4
- package/dist/src/components/MediaCard/Card.stories.js +0 -57
- package/dist/src/components/MediaCard/Card.test.d.ts +0 -1
- package/dist/src/components/MediaCard/Card.test.js +0 -28
- package/dist/src/components/MediaCard/ContactProfile/ContactProfile.d.ts +0 -2
- package/dist/src/components/MediaCard/ContactProfile/ContactProfile.js +0 -27
- package/dist/src/components/MediaCard/ContactProfile/ContactProfile.test.d.ts +0 -1
- package/dist/src/components/MediaCard/ContactProfile/ContactProfile.test.js +0 -61
- package/dist/src/components/MediaCard/ContactProfile/ContactProfileTheme1.d.ts +0 -2
- package/dist/src/components/MediaCard/ContactProfile/ContactProfileTheme1.js +0 -7
- package/dist/src/components/MediaCard/ContactProfile/ContactProfileTheme1.test.d.ts +0 -1
- package/dist/src/components/MediaCard/ContactProfile/ContactProfileTheme1.test.js +0 -99
- package/dist/src/components/MediaCard/ContactProfile/ContactProfileTheme2.d.ts +0 -2
- package/dist/src/components/MediaCard/ContactProfile/ContactProfileTheme2.js +0 -7
- package/dist/src/components/MediaCard/ContactProfile/ContactProfileTheme2.test.d.ts +0 -1
- package/dist/src/components/MediaCard/ContactProfile/ContactProfileTheme2.test.js +0 -99
- package/dist/src/components/MediaCard/PostByCategory/PostByCategory.d.ts +0 -2
- package/dist/src/components/MediaCard/PostByCategory/PostByCategory.js +0 -31
- package/dist/src/components/MediaCard/PostByCategory/PostByCategory.test.d.ts +0 -1
- package/dist/src/components/MediaCard/PostByCategory/PostByCategory.test.js +0 -62
- package/dist/src/components/MediaCard/PostByCategory/PostByCategoryTheme1.d.ts +0 -2
- package/dist/src/components/MediaCard/PostByCategory/PostByCategoryTheme1.js +0 -7
- package/dist/src/components/MediaCard/PostByCategory/PostByCategoryTheme1.test.d.ts +0 -1
- package/dist/src/components/MediaCard/PostByCategory/PostByCategoryTheme1.test.js +0 -99
- package/dist/src/components/MediaCard/PostByCategory/PostByCategoryTheme2.d.ts +0 -2
- package/dist/src/components/MediaCard/PostByCategory/PostByCategoryTheme2.js +0 -7
- package/dist/src/components/MediaCard/PostByCategory/PostByCategoryTheme2.test.d.ts +0 -1
- package/dist/src/components/MediaCard/PostByCategory/PostByCategoryTheme2.test.js +0 -99
- package/dist/src/components/MediaCard/VerticalCard/VerticalCard.d.ts +0 -3
- package/dist/src/components/MediaCard/VerticalCard/VerticalCard.js +0 -13
- package/dist/src/components/MediaCard/VerticalCard/VerticalCard.stories.d.ts +0 -5
- package/dist/src/components/MediaCard/VerticalCard/VerticalCard.stories.js +0 -40
- package/dist/src/components/MediaCard/index.d.ts +0 -9
- package/dist/src/components/MediaCard/index.js +0 -13
- package/dist/src/components/MediaCard/type.d.ts +0 -47
- package/dist/src/components/RadioButton/RadioButton.stories.d.ts +0 -10
- package/dist/src/components/RadioButton/RadioButton.stories.js +0 -82
- package/dist/src/components/RadioButton/RadioGroup.stories.d.ts +0 -10
- package/dist/src/components/RadioButton/RadioGroup.stories.js +0 -131
- package/dist/src/components/RadioButton/radio-button.d.ts +0 -14
- package/dist/src/components/RadioButton/radio-button.js +0 -57
- package/dist/src/components/RadioButton/radio-group.d.ts +0 -21
- package/dist/src/components/RadioButton/radio-group.js +0 -59
- package/dist/src/components/RadioGroup/RadioGroup.stories.jsx +0 -146
- package/dist/src/components/RadioGroup/radio-group.jsx +0 -49
- package/dist/src/components/Slider/Slider.stories.jsx +0 -159
- package/dist/src/components/Slider/slider.jsx +0 -31
- package/dist/src/components/Switch/Switch.stories.jsx +0 -66
- package/dist/src/components/Switch/switch.jsx +0 -61
- package/dist/src/components/Tabs/Tabs.stories.jsx +0 -29
- package/dist/src/components/Tabs/tabs.jsx +0 -32
- package/dist/src/components/Title/Title.jsx +0 -8
- package/dist/src/components/Title/Title.stories.jsx +0 -37
- package/dist/src/components/Title/Title.test.jsx +0 -24
- package/dist/src/components/ToolTip/Tooltip.jsx +0 -18
- package/dist/src/components/ToolTip/Tooltip.stories.jsx +0 -25
- package/dist/src/components/Typography/Body/Body.stories.jsx +0 -34
- package/dist/src/components/Typography/Body/body.jsx +0 -52
- package/dist/src/components/Typography/Caption/Caption.stories.jsx +0 -24
- package/dist/src/components/Typography/Caption/caption.jsx +0 -25
- package/dist/src/components/Typography/Display/Display.stories.jsx +0 -24
- package/dist/src/components/Typography/Display/display.jsx +0 -39
- package/dist/src/components/Typography/Heading/Heading.stories.jsx +0 -37
- package/dist/src/components/Typography/Heading/heading.jsx +0 -53
- package/dist/src/components/ui/accordion.d.ts +0 -7
- package/dist/src/components/ui/accordion.js +0 -64
- package/dist/src/components/ui/avatar.jsx +0 -27
- package/dist/src/components/ui/caption.d.ts +0 -8
- package/dist/src/components/ui/caption.js +0 -34
- package/dist/src/components/ui/checkbox.d.ts +0 -4
- package/dist/src/components/ui/checkbox.js +0 -31
- package/dist/src/components/ui/input.d.ts +0 -3
- package/dist/src/components/ui/input.js +0 -29
- package/dist/src/components/ui/switch.d.ts +0 -22
- package/dist/src/components/ui/switch.js +0 -70
- package/dist/src/components/ui/tooltip.jsx +0 -38
- package/dist/src/components/ui/typography.jsx +0 -56
- package/dist/src/context/LocalizationContext.d.ts +0 -23
- package/dist/src/context/LocalizationContext.js +0 -17
- package/dist/src/utils/index.d.ts +0 -17
- package/dist/src/utils/index.js +0 -20
- /package/dist/src/components/{MediaCard → Avatar/StatusIndicator}/type.js +0 -0
- /package/dist/src/components/{Button/Button.test.d.ts → Dropdown/Combobox/type.js} +0 -0
- /package/dist/src/components/{Button/IconButton.test.d.ts → Dropdown/DropdownMenu/type.js} +0 -0
|
@@ -0,0 +1,145 @@
|
|
|
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
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { Badge } from "./Badge";
|
|
14
|
+
import { badgeStyles } from ".";
|
|
15
|
+
import { iconList } from "../../utils/iconList";
|
|
16
|
+
var meta = {
|
|
17
|
+
title: "Components/Badge",
|
|
18
|
+
component: Badge,
|
|
19
|
+
tags: ["autodocs"],
|
|
20
|
+
argTypes: {
|
|
21
|
+
type: {
|
|
22
|
+
control: {
|
|
23
|
+
type: "select",
|
|
24
|
+
options: Object.keys(badgeStyles.type),
|
|
25
|
+
},
|
|
26
|
+
description: "The type of the badge.",
|
|
27
|
+
table: {
|
|
28
|
+
type: { summary: "string" },
|
|
29
|
+
defaultValue: { summary: "fill" },
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
color: {
|
|
33
|
+
control: {
|
|
34
|
+
type: "select",
|
|
35
|
+
},
|
|
36
|
+
options: Object.keys(badgeStyles.fillColor),
|
|
37
|
+
description: "The color of the badge.",
|
|
38
|
+
table: {
|
|
39
|
+
type: { summary: "string" },
|
|
40
|
+
defaultValue: { summary: "blue" },
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
size: {
|
|
44
|
+
control: {
|
|
45
|
+
type: "select",
|
|
46
|
+
options: Object.keys(badgeStyles.size),
|
|
47
|
+
},
|
|
48
|
+
description: "The size of the badge.",
|
|
49
|
+
table: {
|
|
50
|
+
type: { summary: "string" },
|
|
51
|
+
defaultValue: { summary: "md" },
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
shape: {
|
|
55
|
+
control: {
|
|
56
|
+
type: "select",
|
|
57
|
+
options: Object.keys(badgeStyles.shape),
|
|
58
|
+
},
|
|
59
|
+
description: "The shape of the badge.",
|
|
60
|
+
table: {
|
|
61
|
+
type: { summary: "string" },
|
|
62
|
+
defaultValue: { summary: "rounded" },
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
startIcon: {
|
|
66
|
+
control: {
|
|
67
|
+
type: "select",
|
|
68
|
+
options: Object.keys(iconList),
|
|
69
|
+
},
|
|
70
|
+
description: "The icon to display at the start of the badge.",
|
|
71
|
+
table: {
|
|
72
|
+
type: { summary: "string" },
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
endIcon: {
|
|
76
|
+
control: {
|
|
77
|
+
type: "select",
|
|
78
|
+
options: Object.keys(iconList),
|
|
79
|
+
},
|
|
80
|
+
description: "The icon to display at the end of the badge.",
|
|
81
|
+
table: {
|
|
82
|
+
type: { summary: "string" },
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
disabled: {
|
|
86
|
+
control: {
|
|
87
|
+
type: "boolean",
|
|
88
|
+
},
|
|
89
|
+
description: "Whether the badge is disabled.",
|
|
90
|
+
table: {
|
|
91
|
+
type: { summary: "boolean" },
|
|
92
|
+
defaultValue: { summary: "false" },
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
onRemove: {
|
|
96
|
+
description: "When provided, displays a close icon that calls this function when clicked. The close icon is only shown when this prop is present.",
|
|
97
|
+
table: {
|
|
98
|
+
type: { summary: "() => void" },
|
|
99
|
+
defaultValue: { summary: "undefined" },
|
|
100
|
+
},
|
|
101
|
+
control: false,
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
decorators: [
|
|
105
|
+
function (Story, context) {
|
|
106
|
+
// Use type, not color, to determine color options
|
|
107
|
+
var currentType = context.args.type;
|
|
108
|
+
if (context.argTypes && context.argTypes.color) {
|
|
109
|
+
context.argTypes.color.options =
|
|
110
|
+
currentType === "fill"
|
|
111
|
+
? Object.keys(badgeStyles.fillColor)
|
|
112
|
+
: Object.keys(badgeStyles.outlineColor);
|
|
113
|
+
}
|
|
114
|
+
return _jsx(Story, __assign({}, context));
|
|
115
|
+
},
|
|
116
|
+
],
|
|
117
|
+
};
|
|
118
|
+
export default meta;
|
|
119
|
+
export var Default = {
|
|
120
|
+
args: {
|
|
121
|
+
children: "Default Badge",
|
|
122
|
+
onRemove: undefined,
|
|
123
|
+
},
|
|
124
|
+
parameters: {
|
|
125
|
+
docs: {
|
|
126
|
+
description: {
|
|
127
|
+
story: "Default badge without a close icon. The close icon is only shown when the onRemove prop is provided.",
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
};
|
|
132
|
+
export var BadgeSize = function () { return (_jsxs("div", { className: "flex flex-col space-y-2", children: [_jsx(Badge, { size: "sm", children: "Small Badge" }), _jsx(Badge, { size: "md", children: "Medium Badge" }), _jsx(Badge, { size: "lg", children: "Large Badge" })] })); };
|
|
133
|
+
export var WithIcons = function () { return (_jsxs("div", { className: "flex flex-col space-y-2", children: [_jsx(Badge, { startIcon: "check", children: "Left Icon Only" }), _jsx(Badge, { endIcon: "check", children: "Right Icon Only" }), _jsx(Badge, { startIcon: "check", endIcon: "star", children: "Both Icons" }), _jsx("p", { className: "text-sm mt-2 text-gray-500", children: "Note: None of these have an onRemove handler, so no close icon is shown" })] })); };
|
|
134
|
+
export var BadgeType = function () { return (_jsxs("div", { className: "flex flex-col space-y-2", children: [_jsx(Badge, { type: "fill", children: "Fill Badge" }), _jsx(Badge, { type: "outline", children: "Outline Badge" })] })); };
|
|
135
|
+
export var BadgeShape = function () { return (_jsxs("div", { className: "flex flex-col space-y-2", children: [_jsx(Badge, { shape: "rounded", children: "Rounded Badge" }), _jsx(Badge, { shape: "square", children: "Square Badge" })] })); };
|
|
136
|
+
export var BadgeFillColors = function () { return (_jsxs("div", { className: "flex flex-row space-x-2", children: [_jsx(Badge, { color: "blue", children: "Blue" }), _jsx(Badge, { color: "light-blue", children: "Light Blue" }), _jsx(Badge, { color: "red", children: "Red" }), _jsx(Badge, { color: "light-red", children: "Light Red" }), _jsx(Badge, { color: "indigo", children: "Indigo" }), _jsx(Badge, { color: "light-indigo", children: "Light Indigo" }), _jsx(Badge, { color: "green", children: "Green" }), _jsx(Badge, { color: "light-green", children: "Light Green" }), _jsx(Badge, { color: "yellow", children: "Yellow" }), _jsx(Badge, { color: "light-yellow", children: "Light Yellow" }), _jsx(Badge, { color: "gray", children: "Gray" }), _jsx(Badge, { color: "light-gray", children: "Light Gray" })] })); };
|
|
137
|
+
export var BadgeOutlineColors = function () { return (_jsxs("div", { className: "flex flex-row space-x-2", children: [_jsx(Badge, { color: "blue", type: "outline", children: "Blue" }), _jsx(Badge, { color: "red", type: "outline", children: "Red" }), _jsx(Badge, { color: "indigo", type: "outline", children: "Indigo" }), _jsx(Badge, { color: "green", type: "outline", children: "Green" }), _jsx(Badge, { color: "yellow", type: "outline", children: "Yellow" }), _jsx(Badge, { color: "gray", type: "outline", children: "Gray" })] })); };
|
|
138
|
+
export var DisabledBadge = function () { return (_jsx("div", { className: "flex flex-col space-y-2", children: _jsx(Badge, { disabled: true, children: "Disabled Badge" }) })); };
|
|
139
|
+
export var BadgeWithCounter = function () { return (_jsxs("div", { className: "flex flex-col space-y-2", children: [_jsx(Badge, { children: "3" }), _jsx(Badge, { color: "red", children: "+3" })] })); };
|
|
140
|
+
export var BadgeWithRemoveHandler = function () {
|
|
141
|
+
var handleRemove = function () {
|
|
142
|
+
alert("Badge removed!");
|
|
143
|
+
};
|
|
144
|
+
return (_jsxs("div", { className: "flex flex-col space-y-2", children: [_jsx(Badge, { startIcon: "plus", onRemove: handleRemove, color: "green", children: "Badge with Close Icon" }), _jsx(Badge, { onRemove: handleRemove, children: "Removable Badge" }), _jsx(Badge, { startIcon: "check", onRemove: handleRemove, children: "Check with Remove" }), _jsx(Badge, { type: "outline", onRemove: handleRemove, children: "Outline Removable" })] }));
|
|
145
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export declare const badgeStyles: {
|
|
2
|
+
size: {
|
|
3
|
+
sm: string;
|
|
4
|
+
md: string;
|
|
5
|
+
lg: string;
|
|
6
|
+
};
|
|
7
|
+
type: {
|
|
8
|
+
fill: string;
|
|
9
|
+
outline: string;
|
|
10
|
+
};
|
|
11
|
+
shape: {
|
|
12
|
+
rounded: string;
|
|
13
|
+
square: string;
|
|
14
|
+
};
|
|
15
|
+
fillColor: {
|
|
16
|
+
blue: string;
|
|
17
|
+
"light-blue": string;
|
|
18
|
+
red: string;
|
|
19
|
+
"light-red": string;
|
|
20
|
+
indigo: string;
|
|
21
|
+
"light-indigo": string;
|
|
22
|
+
green: string;
|
|
23
|
+
"light-green": string;
|
|
24
|
+
yellow: string;
|
|
25
|
+
"light-yellow": string;
|
|
26
|
+
gray: string;
|
|
27
|
+
"light-gray": string;
|
|
28
|
+
};
|
|
29
|
+
outlineColor: {
|
|
30
|
+
blue: string;
|
|
31
|
+
red: string;
|
|
32
|
+
indigo: string;
|
|
33
|
+
green: string;
|
|
34
|
+
yellow: string;
|
|
35
|
+
gray: string;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
export declare const badgeLeftIconSize: {
|
|
39
|
+
readonly sm: "2xs";
|
|
40
|
+
readonly md: "xs";
|
|
41
|
+
readonly lg: "sm";
|
|
42
|
+
};
|
|
43
|
+
export declare const badgeRightIconSize: {
|
|
44
|
+
readonly sm: "2xs";
|
|
45
|
+
readonly md: "2xs";
|
|
46
|
+
readonly lg: "2xs";
|
|
47
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export var badgeStyles = {
|
|
2
|
+
size: {
|
|
3
|
+
sm: "px-2 py-0.5 text-[0.625rem] leading-4", //TODO: Add text-tiny font-size
|
|
4
|
+
md: "px-2.5 py-1 text-xs leading-4",
|
|
5
|
+
lg: "px-2.5 py-1 text-sm leading-5",
|
|
6
|
+
},
|
|
7
|
+
type: {
|
|
8
|
+
fill: "",
|
|
9
|
+
outline: "border bg-transparent",
|
|
10
|
+
},
|
|
11
|
+
shape: {
|
|
12
|
+
rounded: "rounded-full",
|
|
13
|
+
square: "rounded-sm",
|
|
14
|
+
},
|
|
15
|
+
fillColor: {
|
|
16
|
+
blue: "bg-blue-600 text-blue-50",
|
|
17
|
+
"light-blue": "bg-blue-100 text-blue-600",
|
|
18
|
+
red: "bg-red-600 text-red-50",
|
|
19
|
+
"light-red": "bg-red-100 text-red-600",
|
|
20
|
+
indigo: "bg-indigo-600 text-indigo-50",
|
|
21
|
+
"light-indigo": "bg-indigo-100 text-indigo-600",
|
|
22
|
+
green: "bg-green-600 text-green-50",
|
|
23
|
+
"light-green": "bg-green-100 text-green-600",
|
|
24
|
+
yellow: "bg-yellow-500 text-yellow-950",
|
|
25
|
+
"light-yellow": "bg-yellow-100 text-yellow-950",
|
|
26
|
+
gray: "bg-gray-300 text-gray-950",
|
|
27
|
+
"light-gray": "bg-gray-100 text-gray-950",
|
|
28
|
+
},
|
|
29
|
+
outlineColor: {
|
|
30
|
+
blue: "border-blue-600 text-blue-600",
|
|
31
|
+
red: "border-red-600 text-red-600",
|
|
32
|
+
indigo: "border-indigo-600 text-indigo-600",
|
|
33
|
+
green: "border-green-600 text-green-600",
|
|
34
|
+
yellow: "border-yellow-500 text-yellow-500",
|
|
35
|
+
gray: "border-gray-200 text-gray-950",
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
// Map badge left size to icon size
|
|
39
|
+
export var badgeLeftIconSize = {
|
|
40
|
+
sm: "2xs",
|
|
41
|
+
md: "xs",
|
|
42
|
+
lg: "sm",
|
|
43
|
+
};
|
|
44
|
+
// Map badge right size to icon size
|
|
45
|
+
export var badgeRightIconSize = {
|
|
46
|
+
sm: "2xs",
|
|
47
|
+
md: "2xs",
|
|
48
|
+
lg: "2xs",
|
|
49
|
+
};
|
|
@@ -8,9 +8,9 @@ export declare const variant: {
|
|
|
8
8
|
ghost: string;
|
|
9
9
|
};
|
|
10
10
|
declare const buttonVariants: (props?: ({
|
|
11
|
-
color?: "blue" | "light-blue" | "green" | "light-green" | "yellow" | "light-yellow" | "red" | "light-red" | "indigo" | "light-indigo" | "gray" | "
|
|
11
|
+
color?: "blue" | "light-blue" | "green" | "light-green" | "yellow" | "light-yellow" | "red" | "light-red" | "indigo" | "light-indigo" | "gray" | "light-gray" | "disabled" | null | undefined;
|
|
12
12
|
size?: "sm" | "md" | "lg" | "xl" | null | undefined;
|
|
13
|
-
shape?: "rounded-
|
|
13
|
+
shape?: "rounded-sm" | "rounded-full" | null | undefined;
|
|
14
14
|
variant?: "link" | "fill" | "outline" | "ghost" | null | undefined;
|
|
15
15
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
16
16
|
declare function Button({ className, color, size, shape, variant, asChild, startIcon, endIcon, ...props }: React.ComponentProps<"button"> & VariantProps<typeof buttonVariants> & {
|
|
@@ -148,7 +148,7 @@ declare const meta: {
|
|
|
148
148
|
vocab?: string | undefined | undefined;
|
|
149
149
|
autoCorrect?: string | undefined | undefined;
|
|
150
150
|
autoSave?: string | undefined | undefined;
|
|
151
|
-
color?: "blue" | "light-blue" | "green" | "light-green" | "yellow" | "light-yellow" | "red" | "light-red" | "indigo" | "light-indigo" | "gray" | "
|
|
151
|
+
color?: "blue" | "light-blue" | "green" | "light-green" | "yellow" | "light-yellow" | "red" | "light-red" | "indigo" | "light-indigo" | "gray" | "light-gray" | "disabled" | undefined;
|
|
152
152
|
itemProp?: string | undefined | undefined;
|
|
153
153
|
itemScope?: boolean | undefined | undefined;
|
|
154
154
|
itemType?: string | undefined | undefined;
|
|
@@ -393,7 +393,7 @@ declare const meta: {
|
|
|
393
393
|
onTransitionStartCapture?: import("react").TransitionEventHandler<HTMLButtonElement> | undefined;
|
|
394
394
|
size?: "sm" | "md" | "lg" | "xl" | null | undefined;
|
|
395
395
|
variant?: "fill" | "link" | "outline" | "ghost" | undefined;
|
|
396
|
-
shape?: "rounded-
|
|
396
|
+
shape?: "rounded-sm" | "rounded-full" | null | undefined;
|
|
397
397
|
asChild?: boolean | undefined;
|
|
398
398
|
startIcon?: keyof typeof import("../../../utils/iconList").iconList | undefined;
|
|
399
399
|
endIcon?: keyof typeof import("../../../utils/iconList").iconList | undefined;
|
|
@@ -448,7 +448,7 @@ declare const meta: {
|
|
|
448
448
|
vocab?: string | undefined | undefined;
|
|
449
449
|
autoCorrect?: string | undefined | undefined;
|
|
450
450
|
autoSave?: string | undefined | undefined;
|
|
451
|
-
color?: "blue" | "light-blue" | "green" | "light-green" | "yellow" | "light-yellow" | "red" | "light-red" | "indigo" | "light-indigo" | "gray" | "
|
|
451
|
+
color?: "blue" | "light-blue" | "green" | "light-green" | "yellow" | "light-yellow" | "red" | "light-red" | "indigo" | "light-indigo" | "gray" | "light-gray" | "disabled" | undefined;
|
|
452
452
|
itemProp?: string | undefined | undefined;
|
|
453
453
|
itemScope?: boolean | undefined | undefined;
|
|
454
454
|
itemType?: string | undefined | undefined;
|
|
@@ -693,7 +693,7 @@ declare const meta: {
|
|
|
693
693
|
onTransitionStartCapture?: import("react").TransitionEventHandler<HTMLButtonElement> | undefined;
|
|
694
694
|
size?: "sm" | "md" | "lg" | "xl" | null | undefined;
|
|
695
695
|
variant?: "fill" | "link" | "outline" | "ghost" | undefined;
|
|
696
|
-
shape?: "rounded-
|
|
696
|
+
shape?: "rounded-sm" | "rounded-full" | null | undefined;
|
|
697
697
|
asChild?: boolean | undefined;
|
|
698
698
|
startIcon?: keyof typeof import("../../../utils/iconList").iconList | undefined;
|
|
699
699
|
endIcon?: keyof typeof import("../../../utils/iconList").iconList | undefined;
|
|
@@ -7,9 +7,9 @@ export declare const variant: {
|
|
|
7
7
|
ghost: string;
|
|
8
8
|
};
|
|
9
9
|
declare const buttonVariants: (props?: ({
|
|
10
|
-
color?: "blue" | "light-blue" | "green" | "light-green" | "yellow" | "light-yellow" | "red" | "light-red" | "indigo" | "light-indigo" | "gray" | "
|
|
10
|
+
color?: "blue" | "light-blue" | "green" | "light-green" | "yellow" | "light-yellow" | "red" | "light-red" | "indigo" | "light-indigo" | "gray" | "light-gray" | "disabled" | null | undefined;
|
|
11
11
|
size?: "sm" | "md" | "lg" | "xl" | null | undefined;
|
|
12
|
-
shape?: "rounded-
|
|
12
|
+
shape?: "rounded-sm" | "rounded-full" | null | undefined;
|
|
13
13
|
variant?: "fill" | "outline" | "ghost" | null | undefined;
|
|
14
14
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
15
15
|
declare function IconButton({ className, color, size, shape, variant, asChild, icon, ...props }: React.ComponentProps<"button"> & VariantProps<typeof buttonVariants> & {
|
|
@@ -159,7 +159,7 @@ declare const meta: {
|
|
|
159
159
|
vocab?: string | undefined | undefined;
|
|
160
160
|
autoCorrect?: string | undefined | undefined;
|
|
161
161
|
autoSave?: string | undefined | undefined;
|
|
162
|
-
color?: "blue" | "light-blue" | "green" | "light-green" | "yellow" | "light-yellow" | "red" | "light-red" | "indigo" | "light-indigo" | "gray" | "
|
|
162
|
+
color?: "blue" | "light-blue" | "green" | "light-green" | "yellow" | "light-yellow" | "red" | "light-red" | "indigo" | "light-indigo" | "gray" | "light-gray" | "disabled" | undefined;
|
|
163
163
|
itemProp?: string | undefined | undefined;
|
|
164
164
|
itemScope?: boolean | undefined | undefined;
|
|
165
165
|
itemType?: string | undefined | undefined;
|
|
@@ -404,7 +404,7 @@ declare const meta: {
|
|
|
404
404
|
onTransitionStartCapture?: import("react").TransitionEventHandler<HTMLButtonElement> | undefined;
|
|
405
405
|
size?: "sm" | "md" | "lg" | "xl" | null | undefined;
|
|
406
406
|
variant?: "fill" | "outline" | "ghost" | undefined;
|
|
407
|
-
shape?: "rounded-
|
|
407
|
+
shape?: "rounded-sm" | "rounded-full" | null | undefined;
|
|
408
408
|
asChild?: boolean | undefined;
|
|
409
409
|
icon?: keyof typeof iconList | undefined;
|
|
410
410
|
}>, context: import("@storybook/core/csf").StoryContext<import("@storybook/react").ReactRenderer, {
|
|
@@ -458,7 +458,7 @@ declare const meta: {
|
|
|
458
458
|
vocab?: string | undefined | undefined;
|
|
459
459
|
autoCorrect?: string | undefined | undefined;
|
|
460
460
|
autoSave?: string | undefined | undefined;
|
|
461
|
-
color?: "blue" | "light-blue" | "green" | "light-green" | "yellow" | "light-yellow" | "red" | "light-red" | "indigo" | "light-indigo" | "gray" | "
|
|
461
|
+
color?: "blue" | "light-blue" | "green" | "light-green" | "yellow" | "light-yellow" | "red" | "light-red" | "indigo" | "light-indigo" | "gray" | "light-gray" | "disabled" | undefined;
|
|
462
462
|
itemProp?: string | undefined | undefined;
|
|
463
463
|
itemScope?: boolean | undefined | undefined;
|
|
464
464
|
itemType?: string | undefined | undefined;
|
|
@@ -703,7 +703,7 @@ declare const meta: {
|
|
|
703
703
|
onTransitionStartCapture?: import("react").TransitionEventHandler<HTMLButtonElement> | undefined;
|
|
704
704
|
size?: "sm" | "md" | "lg" | "xl" | null | undefined;
|
|
705
705
|
variant?: "fill" | "outline" | "ghost" | undefined;
|
|
706
|
-
shape?: "rounded-
|
|
706
|
+
shape?: "rounded-sm" | "rounded-full" | null | undefined;
|
|
707
707
|
asChild?: boolean | undefined;
|
|
708
708
|
icon?: keyof typeof iconList | undefined;
|
|
709
709
|
}>) => import("react/jsx-runtime").JSX.Element)[];
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
3
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
4
|
+
if (ar || !(i in from)) {
|
|
5
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
6
|
+
ar[i] = from[i];
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
10
|
+
};
|
|
11
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
+
import { useRef, useState, useEffect, useMemo } from "react";
|
|
13
|
+
import { cn } from "../../../lib/utils";
|
|
14
|
+
import { Badge } from "../../../components/Badge/Badge";
|
|
15
|
+
import { renderBadge } from "./utils/renderBadge";
|
|
16
|
+
import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, } from "../../../components/ui/command";
|
|
17
|
+
import { Popover, PopoverContent, PopoverTrigger, } from "../../../components/ui/popover";
|
|
18
|
+
import { Button } from "../../../components/Button/Button/Button";
|
|
19
|
+
import LUIcon from "../../../components/Icons/LUIcon";
|
|
20
|
+
import { Checkbox } from "../../../components/Checkbox/checkbox";
|
|
21
|
+
import { comboboxColor, comboboxSelectType, comboboxShapes, comboboxSizes, iconSizeMap, } from ".";
|
|
22
|
+
import { Label } from "../../../components/Label/Label";
|
|
23
|
+
import { Caption } from "../../../components/Typography/Caption/caption";
|
|
24
|
+
import { empty_message } from "../../../utils/constants";
|
|
25
|
+
import Tooltip from "../../../components/ToolTip/Tooltip";
|
|
26
|
+
import { useResponsiveBadges } from "./utils/useResponsiveBadge";
|
|
27
|
+
import { getLabelVariant } from "./utils/getLabelVariant";
|
|
28
|
+
var Combobox = function (props) {
|
|
29
|
+
var _a = props.size, size = _a === void 0 ? "md" : _a, _b = props.placeholder, placeholder = _b === void 0 ? "Select Options" : _b, _c = props.shape, shape = _c === void 0 ? "rectangular" : _c, _d = props.variant, variant = _d === void 0 ? "fill" : _d, _e = props.color, color = _e === void 0 ? "default" : _e, options = props.options, _f = props.isSearch, isSearch = _f === void 0 ? false : _f, _g = props.isMulti, isMulti = _g === void 0 ? false : _g, onSelect = props.onSelect, renderOption = props.renderOption, _h = props.disabled, disabled = _h === void 0 ? false : _h, defaultValue = props.defaultValue;
|
|
30
|
+
var _j = useState(false), open = _j[0], setOpen = _j[1];
|
|
31
|
+
var _k = useState(""), singleValue = _k[0], setSingleValue = _k[1];
|
|
32
|
+
var _l = useState([]), multiValue = _l[0], setMultiValue = _l[1];
|
|
33
|
+
var buttonRef = useRef(null);
|
|
34
|
+
var _m = useState(), popoverWidth = _m[0], setPopoverWidth = _m[1];
|
|
35
|
+
var maxVisibleBadges = useResponsiveBadges();
|
|
36
|
+
useEffect(function () {
|
|
37
|
+
if (isMulti && Array.isArray(defaultValue)) {
|
|
38
|
+
setMultiValue(defaultValue);
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
setSingleValue(defaultValue);
|
|
42
|
+
}
|
|
43
|
+
}, [defaultValue, isMulti]);
|
|
44
|
+
useEffect(function () {
|
|
45
|
+
if (open && buttonRef.current) {
|
|
46
|
+
setPopoverWidth("".concat(buttonRef.current.offsetWidth, "px"));
|
|
47
|
+
}
|
|
48
|
+
}, [open]);
|
|
49
|
+
var handleSelect = function (currentValue) {
|
|
50
|
+
if (isMulti) {
|
|
51
|
+
setMultiValue(function (prev) {
|
|
52
|
+
var newValue = prev.includes(currentValue)
|
|
53
|
+
? prev.filter(function (v) { return v !== currentValue; })
|
|
54
|
+
: __spreadArray(__spreadArray([], prev, true), [currentValue], false);
|
|
55
|
+
onSelect === null || onSelect === void 0 ? void 0 : onSelect(newValue);
|
|
56
|
+
return newValue;
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
var newValue = currentValue === singleValue ? "" : currentValue;
|
|
61
|
+
setSingleValue(newValue);
|
|
62
|
+
onSelect === null || onSelect === void 0 ? void 0 : onSelect(newValue);
|
|
63
|
+
setOpen(false);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
var handleSelectAll = function () {
|
|
67
|
+
if (!options)
|
|
68
|
+
return;
|
|
69
|
+
var allValues = options.map(function (option) {
|
|
70
|
+
return typeof option === "string" ? option : option.value;
|
|
71
|
+
});
|
|
72
|
+
var newValues = multiValue.length === allValues.length ? [] : allValues;
|
|
73
|
+
setMultiValue(newValues);
|
|
74
|
+
onSelect === null || onSelect === void 0 ? void 0 : onSelect(newValues);
|
|
75
|
+
};
|
|
76
|
+
var getDisplay = useMemo(function () {
|
|
77
|
+
var handleRemove = function (value) {
|
|
78
|
+
if (isMulti) {
|
|
79
|
+
var newValues = multiValue.filter(function (val) { return val !== value; });
|
|
80
|
+
setMultiValue(newValues);
|
|
81
|
+
onSelect === null || onSelect === void 0 ? void 0 : onSelect(newValues);
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
setSingleValue("");
|
|
85
|
+
onSelect === null || onSelect === void 0 ? void 0 : onSelect("");
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
if (!options)
|
|
89
|
+
return placeholder;
|
|
90
|
+
if (isMulti) {
|
|
91
|
+
if (!multiValue.length)
|
|
92
|
+
return placeholder;
|
|
93
|
+
var selectedOptions = options.filter(function (option) {
|
|
94
|
+
return typeof option === "string"
|
|
95
|
+
? multiValue.includes(option)
|
|
96
|
+
: multiValue.includes(option.value);
|
|
97
|
+
});
|
|
98
|
+
if (selectedOptions.length <= maxVisibleBadges) {
|
|
99
|
+
return (_jsx("div", { className: "flex flex-wrap gap-1", children: selectedOptions.map(function (option) {
|
|
100
|
+
return renderBadge(typeof option === "string"
|
|
101
|
+
? { key: option, value: option }
|
|
102
|
+
: option, handleRemove);
|
|
103
|
+
}) }));
|
|
104
|
+
}
|
|
105
|
+
var remainingCount = selectedOptions.length - maxVisibleBadges;
|
|
106
|
+
var remainingOptions = selectedOptions.slice(maxVisibleBadges);
|
|
107
|
+
return (_jsxs("div", { className: "flex flex-wrap gap-1", children: [selectedOptions
|
|
108
|
+
.slice(0, maxVisibleBadges)
|
|
109
|
+
.map(function (option) {
|
|
110
|
+
return renderBadge(typeof option === "string"
|
|
111
|
+
? { key: option, value: option }
|
|
112
|
+
: option, handleRemove);
|
|
113
|
+
}), _jsx(Tooltip, { title: remainingOptions
|
|
114
|
+
.map(function (option) {
|
|
115
|
+
return typeof option === "string" ? option : option.key;
|
|
116
|
+
})
|
|
117
|
+
.join(", "), children: _jsxs(Badge, { color: "light-blue", className: "cursor-help", children: ["+", remainingCount] }) })] }));
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
if (!singleValue)
|
|
121
|
+
return placeholder;
|
|
122
|
+
var isMatch = function (option) {
|
|
123
|
+
return typeof option === "string"
|
|
124
|
+
? option === singleValue
|
|
125
|
+
: option.value === singleValue;
|
|
126
|
+
};
|
|
127
|
+
var found = options.find(isMatch);
|
|
128
|
+
return found
|
|
129
|
+
? renderBadge(typeof found === "string" ? { key: found, value: found } : found, handleRemove)
|
|
130
|
+
: placeholder;
|
|
131
|
+
}
|
|
132
|
+
}, [
|
|
133
|
+
options,
|
|
134
|
+
placeholder,
|
|
135
|
+
isMulti,
|
|
136
|
+
multiValue,
|
|
137
|
+
singleValue,
|
|
138
|
+
maxVisibleBadges,
|
|
139
|
+
onSelect,
|
|
140
|
+
setMultiValue,
|
|
141
|
+
setSingleValue,
|
|
142
|
+
]);
|
|
143
|
+
var normalizedOptions = useMemo(function () { return (Array.isArray(options) ? options : []); }, [options]);
|
|
144
|
+
return (_jsxs(Popover, { open: open, onOpenChange: setOpen, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs(Button, { ref: buttonRef, variant: "outline", role: "combobox", color: "light-gray", "aria-expanded": open, className: cn("w-full justify-between !py-3 !px-4 font-normal !leading-normal hover:!bg-transparent active:!bg-transparent", comboboxSizes[size], comboboxSelectType[variant], comboboxColor[variant][color], open && comboboxColor[variant]["blue"], disabled && [
|
|
145
|
+
variant === "fill" && "bg-gray-100",
|
|
146
|
+
"border border-gray-300 cursor-not-allowed pointer-events-none",
|
|
147
|
+
], "min-h-[42px]"), shape: comboboxShapes[shape], disabled: disabled, tabIndex: disabled ? -1 : 0, children: [_jsx("div", { className: "flex-grow flex items-center", children: getDisplay }), _jsx(LUIcon, { icon: "angle-down", size: iconSizeMap[size], color: "light-gray" })] }) }), _jsx(PopoverContent, { className: "p-0", style: popoverWidth ? { width: popoverWidth } : {}, children: _jsxs(Command, { children: [isSearch && (_jsx(CommandInput, { placeholder: "Search", className: comboboxSizes[size] })), isMulti && normalizedOptions.length > 0 && (_jsxs("div", { className: "flex flex-col gap-1 !px-4 !py-3 rounded-sm bg-gray-50 text-gray-800", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Checkbox, { id: "select-all", checked: multiValue.length === normalizedOptions.length, onCheckedChange: handleSelectAll, size: size }), _jsx(Label, { variant: getLabelVariant(size), children: "Select All" })] }), _jsxs(Caption, { variant: "sm", className: "text-gray-500", children: ["Selected (", multiValue.length, ")"] })] })), _jsxs(CommandList, { children: [_jsx(CommandEmpty, { children: empty_message }), _jsx(CommandGroup, { children: normalizedOptions.map(function (option) {
|
|
148
|
+
var normalizedOption = typeof option === "string"
|
|
149
|
+
? { key: option, value: option }
|
|
150
|
+
: option;
|
|
151
|
+
var selected = isMulti
|
|
152
|
+
? multiValue.includes(normalizedOption.value)
|
|
153
|
+
: singleValue === normalizedOption.value;
|
|
154
|
+
return (_jsx(CommandItem, { value: normalizedOption.value, onSelect: function () { return handleSelect(normalizedOption.value); }, size: size, className: cn(selected &&
|
|
155
|
+
"bg-blue-50 text-blue-600 hover:text-blue-600"), children: renderOption
|
|
156
|
+
? renderOption(normalizedOption)
|
|
157
|
+
: normalizedOption.key }, normalizedOption.value));
|
|
158
|
+
}) })] })] }) })] }));
|
|
159
|
+
};
|
|
160
|
+
export default Combobox;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ComboboxProps } from "./type";
|
|
2
|
+
import { Meta } from "@storybook/react";
|
|
3
|
+
declare const _default: Meta<ComboboxProps>;
|
|
4
|
+
export default _default;
|
|
5
|
+
export declare const Default: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, ComboboxProps>;
|
|
6
|
+
export declare const Basic: () => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare const ComboboxSize: () => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare const ComboboxType: () => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare const ComboboxWithCheckbox: () => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare const ComboboxWithUserIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare const ComboboxWithDefaultValue: () => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare const ListOfArray: () => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare const ComboboxValidation: () => import("react/jsx-runtime").JSX.Element;
|