linkedunion-design-kit 1.9.0 → 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 +3 -1
- package/dist/index.js +3 -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.stories.d.ts +162 -0
- package/dist/src/components/Dropdown/Select.stories.js +138 -0
- package/dist/src/components/Dropdown/index.d.ts +37 -0
- package/dist/src/components/Dropdown/index.js +32 -0
- package/dist/src/components/Dropdown/select.d.ts +38 -0
- package/dist/src/components/Dropdown/select.js +87 -0
- 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 +935 -51
- package/dist/tailwind.config.js +6 -0
- package/package.json +7 -1
- package/dist/next.config.d.ts +0 -8
- package/dist/next.config.js +0 -10
- 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/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/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.stories.d.ts +0 -6
- package/dist/src/components/Icons/LUIcon.stories.js +0 -75
- 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/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/ui/accordion.d.ts +0 -7
- package/dist/src/components/ui/accordion.js +0 -64
- 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/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
|
@@ -1,32 +1,80 @@
|
|
|
1
1
|
export var avatarSize = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
sm: "!p-2",
|
|
17
|
-
md: "!p-2",
|
|
18
|
-
lg: "!p-3",
|
|
19
|
-
xl: "!p-4",
|
|
20
|
-
"2xl": "!p-5",
|
|
21
|
-
"3xl": "p-6",
|
|
22
|
-
"4xl": "p-8",
|
|
23
|
-
"5xl": "p-10",
|
|
24
|
-
"6xl": "p-10",
|
|
25
|
-
"7xl": "p-10",
|
|
26
|
-
huge: "p-10",
|
|
27
|
-
massive: "p-10",
|
|
2
|
+
massive: "h-40 w-40 text-5xl",
|
|
3
|
+
huge: "h-36 w-36 text-5xl",
|
|
4
|
+
"5xl": "h-20 w-20 text-4xl",
|
|
5
|
+
"4xl": "h-16 w-16 text-4xl",
|
|
6
|
+
"3xl": "h-14 w-14 text-3xl",
|
|
7
|
+
"2xl": "h-12 w-12 text-2xl",
|
|
8
|
+
xl: "h-11 w-11 text-2xl",
|
|
9
|
+
lg: "h-10 w-10 text-2xl",
|
|
10
|
+
md: "h-9 w-9 text-xl",
|
|
11
|
+
sm: "h-8 w-8 text-sm",
|
|
12
|
+
xs: "h-6 w-6 text-sm",
|
|
13
|
+
"2xs": "h-5 w-5 text-xs",
|
|
14
|
+
"3xs": "h-4.5 w-4.5 text-tiny",
|
|
15
|
+
"4xs": "h-4 w-4 text-tiny",
|
|
28
16
|
};
|
|
29
17
|
export var avatarShape = {
|
|
30
|
-
square:
|
|
31
|
-
|
|
18
|
+
square: {
|
|
19
|
+
massive: "rounded-2xl",
|
|
20
|
+
huge: "rounded-2xl",
|
|
21
|
+
"5xl": "rounded-xl",
|
|
22
|
+
"4xl": "rounded-xl",
|
|
23
|
+
"3xl": "rounded-lg",
|
|
24
|
+
"2xl": "rounded-md",
|
|
25
|
+
xl: "rounded-sm",
|
|
26
|
+
lg: "rounded-sm",
|
|
27
|
+
md: "rounded-sm",
|
|
28
|
+
sm: "rounded-sm",
|
|
29
|
+
xs: "rounded-xs",
|
|
30
|
+
"2xs": "rounded-xs",
|
|
31
|
+
"3xs": "rounded-xs",
|
|
32
|
+
"4xs": "rounded-xs",
|
|
33
|
+
},
|
|
34
|
+
rounded: "rounded-full",
|
|
35
|
+
};
|
|
36
|
+
export var statusIndicatorSize = {
|
|
37
|
+
massive: "xl",
|
|
38
|
+
huge: "xl",
|
|
39
|
+
"5xl": "lg",
|
|
40
|
+
"4xl": "md",
|
|
41
|
+
"3xl": "md",
|
|
42
|
+
"2xl": "sm",
|
|
43
|
+
xl: "sm",
|
|
44
|
+
lg: "sm",
|
|
45
|
+
md: "sm",
|
|
46
|
+
sm: "sm",
|
|
47
|
+
xs: "xs",
|
|
48
|
+
"2xs": "xs",
|
|
49
|
+
"3xs": "xs",
|
|
50
|
+
"4xs": "xs",
|
|
32
51
|
};
|
|
52
|
+
function buildOffsetMap(groups) {
|
|
53
|
+
var map = Object.create(null);
|
|
54
|
+
for (var _i = 0, groups_1 = groups; _i < groups_1.length; _i++) {
|
|
55
|
+
var _a = groups_1[_i], sizes = _a[0], offset = _a[1];
|
|
56
|
+
for (var _b = 0, sizes_1 = sizes; _b < sizes_1.length; _b++) {
|
|
57
|
+
var size = sizes_1[_b];
|
|
58
|
+
map[size] = offset;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return Object.freeze(map);
|
|
62
|
+
}
|
|
63
|
+
// Status Indicator for rectangular avatars
|
|
64
|
+
var groups = [
|
|
65
|
+
[["massive", "huge", "5xl", "4xl", "3xl", "2xl"], "top-2 right-2"],
|
|
66
|
+
[["xl", "lg"], "top-1.5 right-1.5"],
|
|
67
|
+
[["md", "sm", "xs"], "top-1 right-1"],
|
|
68
|
+
[["2xs", "3xs", "4xs"], "top-0.5 right-0.5"],
|
|
69
|
+
];
|
|
70
|
+
export var statusIndicatorOffset = buildOffsetMap(groups);
|
|
71
|
+
// Status Indicator for rounded avatars
|
|
72
|
+
var roundedGroups = [
|
|
73
|
+
[["massive"], "top-4 right-2"],
|
|
74
|
+
[["huge"], "top-3 right-2"],
|
|
75
|
+
[["5xl", "4xl", "3xl", "2xl"], "top-0 right-2"],
|
|
76
|
+
[["xl", "lg"], "top-0 right-1.5"],
|
|
77
|
+
[["md", "sm", "xs"], "top-0 right-1"],
|
|
78
|
+
[["2xs", "3xs", "4xs"], "top-0 right-0.5"],
|
|
79
|
+
];
|
|
80
|
+
export var roundedStatusIndicatorOffset = buildOffsetMap(roundedGroups);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Avatar,
|
|
2
|
+
import { Avatar, AvatarFallback, AvatarImage } from "../Avatar/Avatar";
|
|
3
3
|
export var AvatarGroup = function (_a) {
|
|
4
4
|
var images = _a.images;
|
|
5
5
|
var visibleImages = images.slice(0, 2);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Avatar, AvatarImage, AvatarFallback } from "../../../components/ui/avatar";
|
|
3
2
|
import { avatars } from ".";
|
|
3
|
+
import { Avatar, AvatarFallback, AvatarImage } from "../Avatar/Avatar";
|
|
4
4
|
export default {
|
|
5
5
|
title: "Components/Avatar/AvatarGroup",
|
|
6
6
|
component: Avatar,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../../../lib/utils";
|
|
3
|
+
import { statusIndicatorOuterSize, awayIndicatorInnerSize, statusIndicatorBorder, } from ".";
|
|
4
|
+
export var StatusIndicator = function (_a) {
|
|
5
|
+
var status = _a.status, _b = _a.size, size = _b === void 0 ? "md" : _b, className = _a.className;
|
|
6
|
+
var baseClasses = cn("relative inline-flex items-center justify-center rounded-full", statusIndicatorOuterSize[size], className);
|
|
7
|
+
if (status === "online") {
|
|
8
|
+
return (_jsx("span", { className: cn(baseClasses, "border-green-100 bg-green-600", statusIndicatorBorder[size]) }));
|
|
9
|
+
}
|
|
10
|
+
if (status === "offline") {
|
|
11
|
+
return (_jsx("span", { className: cn(baseClasses, "bg-gray-100 border-gray-300", statusIndicatorBorder[size]) }));
|
|
12
|
+
}
|
|
13
|
+
if (status === "busy") {
|
|
14
|
+
return (_jsx("span", { className: cn(baseClasses, "bg-red-100 border-red-600", statusIndicatorBorder[size]) }));
|
|
15
|
+
}
|
|
16
|
+
// away
|
|
17
|
+
return (_jsx("span", { className: cn(baseClasses, "bg-yellow-500"), children: _jsx("span", { className: cn(awayIndicatorInnerSize[size], "rounded-full bg-yellow-100 block", "absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2") }) }));
|
|
18
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { StoryObj } from "@storybook/react";
|
|
2
|
+
import { StatusIndicator } from "./StatusIndicator";
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: import("react").FC<import("./type").StatusIndicatorProps>;
|
|
6
|
+
tags: string[];
|
|
7
|
+
argTypes: {
|
|
8
|
+
status: {
|
|
9
|
+
control: {
|
|
10
|
+
type: "select";
|
|
11
|
+
options: string[];
|
|
12
|
+
};
|
|
13
|
+
description: string;
|
|
14
|
+
table: {
|
|
15
|
+
type: {
|
|
16
|
+
summary: string;
|
|
17
|
+
};
|
|
18
|
+
defaultValue: {
|
|
19
|
+
summary: string;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
size: {
|
|
24
|
+
control: {
|
|
25
|
+
type: "select";
|
|
26
|
+
options: string[];
|
|
27
|
+
};
|
|
28
|
+
description: string;
|
|
29
|
+
table: {
|
|
30
|
+
type: {
|
|
31
|
+
summary: string;
|
|
32
|
+
};
|
|
33
|
+
defaultValue: {
|
|
34
|
+
summary: string;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
export default meta;
|
|
41
|
+
type Story = StoryObj<typeof StatusIndicator>;
|
|
42
|
+
export declare const Default: Story;
|
|
43
|
+
export declare const AllStatuses: () => import("react/jsx-runtime").JSX.Element;
|
|
44
|
+
export declare const StatusIndicatorSizes: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { StatusIndicator } from "./StatusIndicator";
|
|
3
|
+
import { statusIndicatorOuterSize } from ".";
|
|
4
|
+
var meta = {
|
|
5
|
+
title: "Components/StatusIndicator",
|
|
6
|
+
component: StatusIndicator,
|
|
7
|
+
tags: ["autodocs"],
|
|
8
|
+
argTypes: {
|
|
9
|
+
status: {
|
|
10
|
+
control: {
|
|
11
|
+
type: "select",
|
|
12
|
+
options: ["online", "offline", "busy", "away"],
|
|
13
|
+
},
|
|
14
|
+
description: "The status to display.",
|
|
15
|
+
table: {
|
|
16
|
+
type: { summary: "string" },
|
|
17
|
+
defaultValue: { summary: "online" },
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
size: {
|
|
21
|
+
control: {
|
|
22
|
+
type: "select",
|
|
23
|
+
options: Object.keys(statusIndicatorOuterSize),
|
|
24
|
+
},
|
|
25
|
+
description: "The size of the status indicator.",
|
|
26
|
+
table: {
|
|
27
|
+
type: { summary: "string" },
|
|
28
|
+
defaultValue: { summary: "md" },
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
export default meta;
|
|
34
|
+
export var Default = {
|
|
35
|
+
args: {
|
|
36
|
+
status: "online",
|
|
37
|
+
size: "md",
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
export var AllStatuses = function () { return (_jsxs("div", { className: "flex flex-row space-x-2", children: [_jsx(StatusIndicator, { status: "online", size: "lg" }), _jsx(StatusIndicator, { status: "offline", size: "lg" }), _jsx(StatusIndicator, { status: "busy", size: "lg" }), _jsx(StatusIndicator, { status: "away", size: "lg" })] })); };
|
|
41
|
+
export var StatusIndicatorSizes = function () { return (_jsx("div", { className: "flex flex-row space-x-2 items-center", children: Object.keys(statusIndicatorOuterSize).map(function (size) { return (_jsxs("div", { className: "flex flex-col items-center space-y-1", children: [_jsx(StatusIndicator, { status: "online", size: size }), _jsx("span", { className: "text-xs", children: size })] }, size)); }) })); };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare const statusIndicatorOuterSize: {
|
|
2
|
+
readonly xs: "w-1 h-1";
|
|
3
|
+
readonly sm: "w-1.5 h-1.5";
|
|
4
|
+
readonly md: "w-2.5 h-2.5";
|
|
5
|
+
readonly lg: "w-3.5 h-3.5";
|
|
6
|
+
readonly xl: "w-4.5 h-4.5";
|
|
7
|
+
};
|
|
8
|
+
export declare const statusIndicatorBorder: {
|
|
9
|
+
readonly xs: "border-1";
|
|
10
|
+
readonly sm: "border-1";
|
|
11
|
+
readonly md: "border-2";
|
|
12
|
+
readonly lg: "border-2";
|
|
13
|
+
readonly xl: "border-2";
|
|
14
|
+
};
|
|
15
|
+
export declare const awayIndicatorInnerSize: {
|
|
16
|
+
readonly xl: "w-3 h-0.5";
|
|
17
|
+
readonly lg: "w-2 h-0.5";
|
|
18
|
+
readonly md: "w-1.5 h-0.5";
|
|
19
|
+
readonly sm: "w-1 h-px";
|
|
20
|
+
readonly xs: "w-0.5 h-px";
|
|
21
|
+
};
|
|
22
|
+
export declare const statusIndicator: {
|
|
23
|
+
online: string;
|
|
24
|
+
offline: string;
|
|
25
|
+
busy: string;
|
|
26
|
+
away: string;
|
|
27
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Outer circle/shape sizes
|
|
2
|
+
export var statusIndicatorOuterSize = {
|
|
3
|
+
xs: "w-1 h-1",
|
|
4
|
+
sm: "w-1.5 h-1.5",
|
|
5
|
+
md: "w-2.5 h-2.5",
|
|
6
|
+
lg: "w-3.5 h-3.5",
|
|
7
|
+
xl: "w-4.5 h-4.5",
|
|
8
|
+
};
|
|
9
|
+
export var statusIndicatorBorder = {
|
|
10
|
+
xs: "border-1",
|
|
11
|
+
sm: "border-1",
|
|
12
|
+
md: "border-2",
|
|
13
|
+
lg: "border-2",
|
|
14
|
+
xl: "border-2",
|
|
15
|
+
};
|
|
16
|
+
// Inner glyph sizes (used for away indicator horizontal bar)
|
|
17
|
+
export var awayIndicatorInnerSize = {
|
|
18
|
+
xl: "w-3 h-0.5",
|
|
19
|
+
lg: "w-2 h-0.5",
|
|
20
|
+
md: "w-1.5 h-0.5",
|
|
21
|
+
sm: "w-1 h-px",
|
|
22
|
+
xs: "w-0.5 h-px",
|
|
23
|
+
};
|
|
24
|
+
export var statusIndicator = {
|
|
25
|
+
online: "online",
|
|
26
|
+
offline: "offline",
|
|
27
|
+
busy: "busy",
|
|
28
|
+
away: "away",
|
|
29
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { type VariantProps } from "class-variance-authority";
|
|
3
|
+
import { badgeStyles } from ".";
|
|
4
|
+
import { iconList } from "../../utils/iconList";
|
|
5
|
+
declare const badgeVariants: (props?: ({
|
|
6
|
+
color?: "blue" | "light-blue" | "green" | "light-green" | "yellow" | "light-yellow" | "red" | "light-red" | "indigo" | "light-indigo" | "gray" | "light-gray" | null | undefined;
|
|
7
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
8
|
+
type?: "fill" | "outline" | null | undefined;
|
|
9
|
+
shape?: "square" | "rounded" | null | undefined;
|
|
10
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
11
|
+
declare function Badge({ className, color, size, type, asChild, disabled, shape, onRemove, ...props }: React.ComponentProps<"span"> & VariantProps<typeof badgeVariants> & {
|
|
12
|
+
asChild?: boolean;
|
|
13
|
+
size?: "sm" | "md" | "lg";
|
|
14
|
+
type?: "fill" | "outline";
|
|
15
|
+
startIcon?: keyof typeof iconList;
|
|
16
|
+
endIcon?: keyof typeof iconList;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
shape?: keyof typeof badgeStyles.shape;
|
|
19
|
+
onRemove?: () => void;
|
|
20
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export { Badge, badgeVariants };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
|
+
import LUIcon from "../Icons/LUIcon";
|
|
25
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
26
|
+
import { cva } from "class-variance-authority";
|
|
27
|
+
import { cn } from "../../lib/utils";
|
|
28
|
+
import { badgeStyles, badgeLeftIconSize, badgeRightIconSize } from ".";
|
|
29
|
+
var badgeVariants = cva("inline-flex items-center justify-center font-normal w-fit whitespace-nowrap shrink-0 gap-2 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden", {
|
|
30
|
+
variants: {
|
|
31
|
+
color: badgeStyles.fillColor,
|
|
32
|
+
size: badgeStyles.size,
|
|
33
|
+
type: badgeStyles.type,
|
|
34
|
+
shape: badgeStyles.shape,
|
|
35
|
+
},
|
|
36
|
+
defaultVariants: {
|
|
37
|
+
color: "blue",
|
|
38
|
+
size: "md",
|
|
39
|
+
type: "fill",
|
|
40
|
+
shape: "rounded",
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
function Badge(_a) {
|
|
44
|
+
var className = _a.className, _b = _a.color, color = _b === void 0 ? "blue" : _b, _c = _a.size, size = _c === void 0 ? "md" : _c, _d = _a.type, type = _d === void 0 ? "fill" : _d, _e = _a.asChild, asChild = _e === void 0 ? false : _e, _f = _a.disabled, disabled = _f === void 0 ? false : _f, _g = _a.shape, shape = _g === void 0 ? "rounded" : _g, onRemove = _a.onRemove, props = __rest(_a, ["className", "color", "size", "type", "asChild", "disabled", "shape", "onRemove"]);
|
|
45
|
+
var colorClass = type === "fill"
|
|
46
|
+
? badgeStyles.fillColor[color]
|
|
47
|
+
: badgeStyles.outlineColor.hasOwnProperty(color)
|
|
48
|
+
? badgeStyles.outlineColor[color]
|
|
49
|
+
: badgeStyles.outlineColor["blue"];
|
|
50
|
+
var Comp = asChild ? Slot : "span";
|
|
51
|
+
var handleRemove = function (e) {
|
|
52
|
+
if (onRemove && !disabled) {
|
|
53
|
+
e.stopPropagation();
|
|
54
|
+
onRemove();
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
return (_jsxs(Comp, __assign({ "data-slot": "badge", className: cn(badgeVariants({ color: color, size: size, type: type, shape: shape }), colorClass, className, disabled && "opacity-50 pointer-events-none cursor-not-allowed"), "aria-disabled": disabled, tabIndex: disabled ? -1 : undefined }, props, { children: [props.startIcon && (_jsx(LUIcon, { icon: props.startIcon, size: badgeLeftIconSize[size] })), props.children, onRemove ? (_jsx("div", { onClick: handleRemove, className: "cursor-pointer ml-1 pointer-events-auto", children: _jsx(LUIcon, { icon: "xMark", size: badgeRightIconSize[size] }) })) : (props.endIcon && (_jsx(LUIcon, { icon: props.endIcon, size: badgeRightIconSize[size] })))] })));
|
|
58
|
+
}
|
|
59
|
+
export { Badge, badgeVariants };
|