linkedunion-design-kit 1.9.2 → 1.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app/layout.jsx +13 -0
- package/dist/app/page.jsx +25 -0
- package/dist/build/types/app/layout.d.ts +12 -0
- package/dist/build/types/app/layout.js +22 -0
- package/dist/build/types/app/page.d.ts +12 -0
- package/dist/build/types/app/page.js +22 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/src/components/Accordion/Accordion.stories.jsx +33 -0
- package/dist/src/components/Accordion/accordion.jsx +59 -0
- package/dist/src/components/Alerts/Alert/alert.jsx +152 -0
- package/dist/src/components/Alerts/Alert/alert.stories.jsx +344 -0
- package/dist/src/components/Alerts/AlertDialog/alert-dialog.jsx +170 -0
- package/dist/src/components/Alerts/AlertDialog/alert-dialog.stories.jsx +552 -0
- package/dist/src/components/AppIcons/AndroidIcon.jsx +24 -0
- package/dist/src/components/AppIcons/AppIcon.jsx +29 -0
- package/dist/src/components/AppIcons/AppIcon.stories.jsx +223 -0
- package/dist/src/components/AppIcons/AppleIcon.jsx +31 -0
- package/dist/src/components/AppIcons/PlayStoreIcon.jsx +29 -0
- package/dist/src/components/Avatar/Avatar/Avatar.jsx +45 -0
- package/dist/src/components/Avatar/Avatar/Avatar.stories.jsx +95 -0
- package/dist/src/components/Avatar/Avatar/Avatar.test.jsx +9 -0
- package/dist/src/components/Avatar/AvatarGroup/AvatarGroup.jsx +17 -0
- package/dist/src/components/Avatar/AvatarGroup/AvatarGroup.stories.jsx +32 -0
- package/dist/src/components/Avatar/StatusIndicator/StatusIndicator.jsx +20 -0
- package/dist/src/components/Avatar/StatusIndicator/StatusIndicator.stories.jsx +50 -0
- package/dist/src/components/Badge/Badge.jsx +54 -0
- package/dist/src/components/Badge/Badge.stories.jsx +201 -0
- package/dist/src/components/Button/Button/Button.d.ts +7 -6
- package/dist/src/components/Button/Button/Button.js +32 -9
- package/dist/src/components/Button/Button/Button.jsx +101 -0
- package/dist/src/components/Button/Button/Button.stories.jsx +283 -0
- package/dist/src/components/Button/Button/Button.test.jsx +73 -0
- package/dist/src/components/Button/IconButton/IconButton.jsx +63 -0
- package/dist/src/components/Button/IconButton/IconButton.stories.jsx +128 -0
- package/dist/src/components/Button/IconButton/IconButton.test.jsx +28 -0
- package/dist/src/components/Button/index.js +1 -1
- package/dist/src/components/Card/MultipleNews/MultiNews.jsx +80 -0
- package/dist/src/components/Card/MultipleNews/MultiNews.stories.jsx +104 -0
- package/dist/src/components/Card/PostByCategory/PostByCategory.jsx +60 -0
- package/dist/src/components/Card/PostByCategory/PostByCategory.stories.jsx +106 -0
- package/dist/src/components/Card/SinglePost/SinglePost.jsx +26 -0
- package/dist/src/components/Card/SinglePost/SinglePost.stories.jsx +68 -0
- package/dist/src/components/Card/card.jsx +36 -0
- package/dist/src/components/Card/contactProfile/ContactProfile.jsx +60 -0
- package/dist/src/components/Card/contactProfile/ContactProfile.stories.jsx +103 -0
- package/dist/src/components/Card/photoAlbum/PhotoAlbum.jsx +41 -0
- package/dist/src/components/Card/photoAlbum/PhotoAlbum.stories.jsx +69 -0
- package/dist/src/components/Card/photoGallery/PhotoGallery.jsx +17 -0
- package/dist/src/components/Card/photoGallery/PhotoGallery.stories.jsx +39 -0
- package/dist/src/components/Checkbox/checkbox.jsx +47 -0
- package/dist/src/components/Checkbox/checkbox.stories.jsx +113 -0
- package/dist/src/components/ColorPicker/ColorPicker.jsx +67 -0
- package/dist/src/components/ColorPicker/ColorPicker.stories.jsx +138 -0
- package/dist/src/components/Colors/color.jsx +5 -0
- package/dist/src/components/Colors/color.stories.jsx +20 -0
- package/dist/src/components/Colors/color.test.jsx +23 -0
- package/dist/src/components/Dropdown/Combobox/Combobox.jsx +198 -0
- package/dist/src/components/Dropdown/Combobox/Combobox.stories.jsx +289 -0
- package/dist/src/components/Dropdown/Combobox/utils/renderBadge.jsx +7 -0
- package/dist/src/components/Dropdown/DropdownMenu/DropdownMenu.jsx +102 -0
- package/dist/src/components/Dropdown/DropdownMenu/DropdownMenu.stories.jsx +464 -0
- package/dist/src/components/Dropdown/DropdownMenu/SelectAllSection.jsx +19 -0
- package/dist/src/components/Dropdown/Select.stories.jsx +201 -0
- package/dist/src/components/Dropdown/select.jsx +93 -0
- package/dist/src/components/Icons/LUIcon.jsx +41 -0
- package/dist/src/components/Icons/LUIcon.test.jsx +308 -0
- package/dist/src/components/Icons/stories/IconDropdown.jsx +67 -0
- package/dist/src/components/Icons/stories/IconGallery.jsx +77 -0
- package/dist/src/components/Icons/stories/InteractiveIconSelector.jsx +86 -0
- package/dist/src/components/Icons/stories/LUIcon.stories.jsx +108 -0
- package/dist/src/components/ImageUploader/ImageUploader.stories.jsx +50 -0
- package/dist/src/components/ImageUploader/imageUploader.jsx +94 -0
- package/dist/src/components/Images/LuImage.jsx +19 -0
- package/dist/src/components/Images/LuImage.stories.jsx +154 -0
- package/dist/src/components/Images/LuImage.test.jsx +44 -0
- package/dist/src/components/Input/Input.stories.jsx +250 -0
- package/dist/src/components/Input/input.jsx +110 -0
- package/dist/src/components/Label/Label.jsx +32 -0
- package/dist/src/components/Label/Label.stories.jsx +30 -0
- package/dist/src/components/Pagination/pagination.d.ts +33 -0
- package/dist/src/components/Pagination/pagination.js +68 -0
- package/dist/src/components/Pagination/pagination.jsx +68 -0
- package/dist/src/components/Pagination/pagination.stories.d.ts +74 -0
- package/dist/src/components/Pagination/pagination.stories.js +168 -0
- package/dist/src/components/Pagination/pagination.stories.jsx +114 -0
- package/dist/src/components/RadioGroup/RadioGroup.stories.jsx +146 -0
- package/dist/src/components/RadioGroup/radio-group.jsx +49 -0
- package/dist/src/components/Skeleton/skeleton.d.ts +117 -0
- package/dist/src/components/Skeleton/skeleton.js +140 -0
- package/dist/src/components/Skeleton/skeleton.stories.d.ts +153 -0
- package/dist/src/components/Skeleton/skeleton.stories.js +404 -0
- package/dist/src/components/Slider/Slider.stories.jsx +159 -0
- package/dist/src/components/Slider/slider.jsx +31 -0
- package/dist/src/components/SweetAlert/SweetAlert.jsx +147 -0
- package/dist/src/components/SweetAlert/SweetAlert.stories.jsx +505 -0
- package/dist/src/components/Switch/Switch.stories.jsx +66 -0
- package/dist/src/components/Switch/switch.jsx +61 -0
- package/dist/src/components/Table/Table.d.ts +26 -0
- package/dist/src/components/Table/Table.js +186 -0
- package/dist/src/components/Table/Table.jsx +221 -0
- package/dist/src/components/Table/Table.stories.d.ts +51 -0
- package/dist/src/components/Table/Table.stories.js +408 -0
- package/dist/src/components/Table/Table.stories.jsx +652 -0
- package/dist/src/components/Table/index.d.ts +20 -0
- package/dist/src/components/Table/index.js +20 -0
- package/dist/src/components/Tabs/Tabs.stories.jsx +29 -0
- package/dist/src/components/Tabs/tabs.jsx +32 -0
- package/dist/src/components/Title/Title.jsx +8 -0
- package/dist/src/components/Title/Title.stories.jsx +37 -0
- package/dist/src/components/Title/Title.test.jsx +24 -0
- package/dist/src/components/ToolTip/Tooltip.jsx +18 -0
- package/dist/src/components/ToolTip/Tooltip.stories.jsx +25 -0
- package/dist/src/components/Typography/Body/Body.stories.jsx +34 -0
- package/dist/src/components/Typography/Body/body.jsx +52 -0
- package/dist/src/components/Typography/Caption/Caption.stories.jsx +24 -0
- package/dist/src/components/Typography/Caption/caption.jsx +25 -0
- package/dist/src/components/Typography/Display/Display.stories.jsx +24 -0
- package/dist/src/components/Typography/Display/display.jsx +39 -0
- package/dist/src/components/Typography/Heading/Heading.stories.jsx +37 -0
- package/dist/src/components/Typography/Heading/heading.jsx +53 -0
- package/dist/src/components/ui/avatar.d.ts +3 -10
- package/dist/src/components/ui/avatar.js +12 -27
- package/dist/src/components/ui/avatar.jsx +27 -0
- package/dist/src/components/ui/button.d.ts +10 -0
- package/dist/src/components/ui/button.js +56 -0
- package/dist/src/components/ui/button.jsx +45 -0
- package/dist/src/components/ui/collapsible.d.ts +5 -0
- package/dist/src/components/ui/collapsible.js +5 -0
- package/dist/src/components/ui/collapsible.jsx +5 -0
- package/dist/src/components/ui/command.jsx +67 -0
- package/dist/src/components/ui/dialog.jsx +66 -0
- package/dist/src/components/ui/popover.jsx +33 -0
- package/dist/src/components/ui/tooltip.jsx +38 -0
- package/dist/src/components/ui/typography.jsx +56 -0
- package/dist/src/utils/iconList.d.ts +4 -0
- package/dist/src/utils/iconList.js +4 -0
- package/dist/styles/global.css +139 -0
- package/package.json +1 -1
- package/dist/src/components/Avatar/Avatar/Avatar1.stories.d.ts +0 -17
- package/dist/src/components/Avatar/Avatar/Avatar1.stories.js +0 -68
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import React from "react";
|
|
13
|
+
import LUIcon from "../Icons/LUIcon";
|
|
14
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
15
|
+
import { cva } from "class-variance-authority";
|
|
16
|
+
import { cn } from "../../lib/utils";
|
|
17
|
+
import { badgeStyles, badgeLeftIconSize, badgeRightIconSize } from ".";
|
|
18
|
+
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", {
|
|
19
|
+
variants: {
|
|
20
|
+
color: badgeStyles.fillColor,
|
|
21
|
+
size: badgeStyles.size,
|
|
22
|
+
type: badgeStyles.type,
|
|
23
|
+
shape: badgeStyles.shape,
|
|
24
|
+
},
|
|
25
|
+
defaultVariants: {
|
|
26
|
+
color: "blue",
|
|
27
|
+
size: "md",
|
|
28
|
+
type: "fill",
|
|
29
|
+
shape: "rounded",
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
function Badge(_a) {
|
|
33
|
+
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"]);
|
|
34
|
+
var colorClass = type === "fill"
|
|
35
|
+
? badgeStyles.fillColor[color]
|
|
36
|
+
: badgeStyles.outlineColor.hasOwnProperty(color)
|
|
37
|
+
? badgeStyles.outlineColor[color]
|
|
38
|
+
: badgeStyles.outlineColor["blue"];
|
|
39
|
+
var Comp = asChild ? Slot : "span";
|
|
40
|
+
var handleRemove = function (e) {
|
|
41
|
+
if (onRemove && !disabled) {
|
|
42
|
+
e.stopPropagation();
|
|
43
|
+
onRemove();
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
return (<Comp 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}>
|
|
47
|
+
{props.startIcon && (<LUIcon icon={props.startIcon} size={badgeLeftIconSize[size]}/>)}
|
|
48
|
+
{props.children}
|
|
49
|
+
{onRemove ? (<div onClick={handleRemove} className="cursor-pointer ml-1 pointer-events-auto">
|
|
50
|
+
<LUIcon icon="xMark" size={badgeRightIconSize[size]}/>
|
|
51
|
+
</div>) : (props.endIcon && (<LUIcon icon={props.endIcon} size={badgeRightIconSize[size]}/>))}
|
|
52
|
+
</Comp>);
|
|
53
|
+
}
|
|
54
|
+
export { Badge, badgeVariants };
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Badge } from "./Badge";
|
|
3
|
+
import { badgeStyles } from ".";
|
|
4
|
+
import { iconList } from "../../utils/iconList";
|
|
5
|
+
var meta = {
|
|
6
|
+
title: "Components/Badge",
|
|
7
|
+
component: Badge,
|
|
8
|
+
tags: ["autodocs"],
|
|
9
|
+
argTypes: {
|
|
10
|
+
type: {
|
|
11
|
+
control: {
|
|
12
|
+
type: "select",
|
|
13
|
+
options: Object.keys(badgeStyles.type),
|
|
14
|
+
},
|
|
15
|
+
description: "The type of the badge.",
|
|
16
|
+
table: {
|
|
17
|
+
type: { summary: "string" },
|
|
18
|
+
defaultValue: { summary: "fill" },
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
color: {
|
|
22
|
+
control: {
|
|
23
|
+
type: "select",
|
|
24
|
+
},
|
|
25
|
+
options: Object.keys(badgeStyles.fillColor),
|
|
26
|
+
description: "The color of the badge.",
|
|
27
|
+
table: {
|
|
28
|
+
type: { summary: "string" },
|
|
29
|
+
defaultValue: { summary: "blue" },
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
size: {
|
|
33
|
+
control: {
|
|
34
|
+
type: "select",
|
|
35
|
+
options: Object.keys(badgeStyles.size),
|
|
36
|
+
},
|
|
37
|
+
description: "The size of the badge.",
|
|
38
|
+
table: {
|
|
39
|
+
type: { summary: "string" },
|
|
40
|
+
defaultValue: { summary: "md" },
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
shape: {
|
|
44
|
+
control: {
|
|
45
|
+
type: "select",
|
|
46
|
+
options: Object.keys(badgeStyles.shape),
|
|
47
|
+
},
|
|
48
|
+
description: "The shape of the badge.",
|
|
49
|
+
table: {
|
|
50
|
+
type: { summary: "string" },
|
|
51
|
+
defaultValue: { summary: "rounded" },
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
startIcon: {
|
|
55
|
+
control: {
|
|
56
|
+
type: "select",
|
|
57
|
+
options: Object.keys(iconList),
|
|
58
|
+
},
|
|
59
|
+
description: "The icon to display at the start of the badge.",
|
|
60
|
+
table: {
|
|
61
|
+
type: { summary: "string" },
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
endIcon: {
|
|
65
|
+
control: {
|
|
66
|
+
type: "select",
|
|
67
|
+
options: Object.keys(iconList),
|
|
68
|
+
},
|
|
69
|
+
description: "The icon to display at the end of the badge.",
|
|
70
|
+
table: {
|
|
71
|
+
type: { summary: "string" },
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
disabled: {
|
|
75
|
+
control: {
|
|
76
|
+
type: "boolean",
|
|
77
|
+
},
|
|
78
|
+
description: "Whether the badge is disabled.",
|
|
79
|
+
table: {
|
|
80
|
+
type: { summary: "boolean" },
|
|
81
|
+
defaultValue: { summary: "false" },
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
onRemove: {
|
|
85
|
+
description: "When provided, displays a close icon that calls this function when clicked. The close icon is only shown when this prop is present.",
|
|
86
|
+
table: {
|
|
87
|
+
type: { summary: "() => void" },
|
|
88
|
+
defaultValue: { summary: "undefined" },
|
|
89
|
+
},
|
|
90
|
+
control: false,
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
decorators: [
|
|
94
|
+
function (Story, context) {
|
|
95
|
+
// Use type, not color, to determine color options
|
|
96
|
+
var currentType = context.args.type;
|
|
97
|
+
if (context.argTypes && context.argTypes.color) {
|
|
98
|
+
context.argTypes.color.options =
|
|
99
|
+
currentType === "fill"
|
|
100
|
+
? Object.keys(badgeStyles.fillColor)
|
|
101
|
+
: Object.keys(badgeStyles.outlineColor);
|
|
102
|
+
}
|
|
103
|
+
return <Story {...context}/>;
|
|
104
|
+
},
|
|
105
|
+
],
|
|
106
|
+
};
|
|
107
|
+
export default meta;
|
|
108
|
+
export var Default = {
|
|
109
|
+
args: {
|
|
110
|
+
children: "Default Badge",
|
|
111
|
+
onRemove: undefined,
|
|
112
|
+
},
|
|
113
|
+
parameters: {
|
|
114
|
+
docs: {
|
|
115
|
+
description: {
|
|
116
|
+
story: "Default badge without a close icon. The close icon is only shown when the onRemove prop is provided.",
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
};
|
|
121
|
+
export var BadgeSize = function () { return (<div className="flex flex-col space-y-2">
|
|
122
|
+
<Badge size="sm">Small Badge</Badge>
|
|
123
|
+
<Badge size="md">Medium Badge</Badge>
|
|
124
|
+
<Badge size="lg">Large Badge</Badge>
|
|
125
|
+
</div>); };
|
|
126
|
+
export var WithIcons = function () { return (<div className="flex flex-col space-y-2">
|
|
127
|
+
<Badge startIcon="check">Left Icon Only</Badge>
|
|
128
|
+
<Badge endIcon="check">Right Icon Only</Badge>
|
|
129
|
+
<Badge startIcon="check" endIcon="star">
|
|
130
|
+
Both Icons
|
|
131
|
+
</Badge>
|
|
132
|
+
<p className="text-sm mt-2 text-gray-500">
|
|
133
|
+
Note: None of these have an onRemove handler, so no close icon is shown
|
|
134
|
+
</p>
|
|
135
|
+
</div>); };
|
|
136
|
+
export var BadgeType = function () { return (<div className="flex flex-col space-y-2">
|
|
137
|
+
<Badge type="fill">Fill Badge</Badge>
|
|
138
|
+
<Badge type="outline">Outline Badge</Badge>
|
|
139
|
+
</div>); };
|
|
140
|
+
export var BadgeShape = function () { return (<div className="flex flex-col space-y-2">
|
|
141
|
+
<Badge shape="rounded">Rounded Badge</Badge>
|
|
142
|
+
<Badge shape="square">Square Badge</Badge>
|
|
143
|
+
</div>); };
|
|
144
|
+
export var BadgeFillColors = function () { return (<div className="flex flex-row space-x-2">
|
|
145
|
+
<Badge color="blue">Blue</Badge>
|
|
146
|
+
<Badge color="light-blue">Light Blue</Badge>
|
|
147
|
+
<Badge color="red">Red</Badge>
|
|
148
|
+
<Badge color="light-red">Light Red</Badge>
|
|
149
|
+
<Badge color="indigo">Indigo</Badge>
|
|
150
|
+
<Badge color="light-indigo">Light Indigo</Badge>
|
|
151
|
+
<Badge color="green">Green</Badge>
|
|
152
|
+
<Badge color="light-green">Light Green</Badge>
|
|
153
|
+
<Badge color="yellow">Yellow</Badge>
|
|
154
|
+
<Badge color="light-yellow">Light Yellow</Badge>
|
|
155
|
+
<Badge color="gray">Gray</Badge>
|
|
156
|
+
<Badge color="light-gray">Light Gray</Badge>
|
|
157
|
+
</div>); };
|
|
158
|
+
export var BadgeOutlineColors = function () { return (<div className="flex flex-row space-x-2">
|
|
159
|
+
<Badge color="blue" type="outline">
|
|
160
|
+
Blue
|
|
161
|
+
</Badge>
|
|
162
|
+
<Badge color="red" type="outline">
|
|
163
|
+
Red
|
|
164
|
+
</Badge>
|
|
165
|
+
<Badge color="indigo" type="outline">
|
|
166
|
+
Indigo
|
|
167
|
+
</Badge>
|
|
168
|
+
<Badge color="green" type="outline">
|
|
169
|
+
Green
|
|
170
|
+
</Badge>
|
|
171
|
+
<Badge color="yellow" type="outline">
|
|
172
|
+
Yellow
|
|
173
|
+
</Badge>
|
|
174
|
+
<Badge color="gray" type="outline">
|
|
175
|
+
Gray
|
|
176
|
+
</Badge>
|
|
177
|
+
</div>); };
|
|
178
|
+
export var DisabledBadge = function () { return (<div className="flex flex-col space-y-2">
|
|
179
|
+
<Badge disabled>Disabled Badge</Badge>
|
|
180
|
+
</div>); };
|
|
181
|
+
export var BadgeWithCounter = function () { return (<div className="flex flex-col space-y-2">
|
|
182
|
+
<Badge>3</Badge>
|
|
183
|
+
<Badge color="red">+3</Badge>
|
|
184
|
+
</div>); };
|
|
185
|
+
export var BadgeWithRemoveHandler = function () {
|
|
186
|
+
var handleRemove = function () {
|
|
187
|
+
alert("Badge removed!");
|
|
188
|
+
};
|
|
189
|
+
return (<div className="flex flex-col space-y-2">
|
|
190
|
+
<Badge startIcon="plus" onRemove={handleRemove} color="green">
|
|
191
|
+
Badge with Close Icon
|
|
192
|
+
</Badge>
|
|
193
|
+
<Badge onRemove={handleRemove}>Removable Badge</Badge>
|
|
194
|
+
<Badge startIcon="check" onRemove={handleRemove}>
|
|
195
|
+
Check with Remove
|
|
196
|
+
</Badge>
|
|
197
|
+
<Badge type="outline" onRemove={handleRemove}>
|
|
198
|
+
Outline Removable
|
|
199
|
+
</Badge>
|
|
200
|
+
</div>);
|
|
201
|
+
};
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { type VariantProps } from "class-variance-authority";
|
|
3
3
|
import { iconList } from "../../../utils/iconList";
|
|
4
|
+
export type ButtonProps = React.ComponentProps<"button"> & VariantProps<typeof buttonVariants> & {
|
|
5
|
+
asChild?: boolean;
|
|
6
|
+
startIcon?: keyof typeof iconList;
|
|
7
|
+
endIcon?: keyof typeof iconList;
|
|
8
|
+
variant?: "fill" | "link" | "outline" | "ghost";
|
|
9
|
+
};
|
|
4
10
|
export declare const variant: {
|
|
5
11
|
fill: string;
|
|
6
12
|
link: string;
|
|
@@ -13,10 +19,5 @@ declare const buttonVariants: (props?: ({
|
|
|
13
19
|
shape?: "rounded-sm" | "rounded-full" | null | undefined;
|
|
14
20
|
variant?: "link" | "fill" | "outline" | "ghost" | null | undefined;
|
|
15
21
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
16
|
-
declare function Button({ className, color, size, shape, variant, asChild, startIcon, endIcon, ...props }:
|
|
17
|
-
asChild?: boolean;
|
|
18
|
-
startIcon?: keyof typeof iconList;
|
|
19
|
-
endIcon?: keyof typeof iconList;
|
|
20
|
-
variant?: "fill" | "link" | "outline" | "ghost";
|
|
21
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
declare function Button({ className, color, size, shape, variant, asChild, startIcon, endIcon, ...props }: ButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
22
23
|
export { Button, buttonVariants };
|
|
@@ -20,6 +20,15 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
20
20
|
}
|
|
21
21
|
return t;
|
|
22
22
|
};
|
|
23
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
24
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
25
|
+
if (ar || !(i in from)) {
|
|
26
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
27
|
+
ar[i] = from[i];
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
31
|
+
};
|
|
23
32
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
33
|
import { Slot } from "@radix-ui/react-slot";
|
|
25
34
|
import { cva } from "class-variance-authority";
|
|
@@ -45,6 +54,28 @@ var buttonVariants = cva("inline-flex items-center justify-center gap-2 whitespa
|
|
|
45
54
|
shape: "rounded-sm",
|
|
46
55
|
variant: "fill",
|
|
47
56
|
},
|
|
57
|
+
compoundVariants: __spreadArray(__spreadArray(__spreadArray([], Object.entries(buttonStyles.linkColor).map(function (_a) {
|
|
58
|
+
var color = _a[0], className = _a[1];
|
|
59
|
+
return ({
|
|
60
|
+
color: color,
|
|
61
|
+
variant: "link",
|
|
62
|
+
class: className,
|
|
63
|
+
});
|
|
64
|
+
}), true), Object.entries(buttonStyles.outlineColor).map(function (_a) {
|
|
65
|
+
var color = _a[0], className = _a[1];
|
|
66
|
+
return ({
|
|
67
|
+
color: color,
|
|
68
|
+
variant: "outline",
|
|
69
|
+
class: className,
|
|
70
|
+
});
|
|
71
|
+
}), true), Object.entries(buttonStyles.ghostColor).map(function (_a) {
|
|
72
|
+
var color = _a[0], className = _a[1];
|
|
73
|
+
return ({
|
|
74
|
+
color: color,
|
|
75
|
+
variant: "ghost",
|
|
76
|
+
class: className,
|
|
77
|
+
});
|
|
78
|
+
}), true),
|
|
48
79
|
});
|
|
49
80
|
function Button(_a) {
|
|
50
81
|
var className = _a.className, _b = _a.color, color = _b === void 0 ? "blue" : _b, size = _a.size, shape = _a.shape, _c = _a.variant, variant = _c === void 0 ? "fill" : _c, _d = _a.asChild, asChild = _d === void 0 ? false : _d, startIcon = _a.startIcon, endIcon = _a.endIcon, props = __rest(_a, ["className", "color", "size", "shape", "variant", "asChild", "startIcon", "endIcon"]);
|
|
@@ -67,14 +98,6 @@ function Button(_a) {
|
|
|
67
98
|
// Use the calculated sizes based on button size
|
|
68
99
|
var startIconSizeValue = iconSizes.startIcon;
|
|
69
100
|
var endIconSizeValue = iconSizes.endIcon;
|
|
70
|
-
|
|
71
|
-
var extraClasses = variant === "link" && color
|
|
72
|
-
? buttonStyles.linkColor[color]
|
|
73
|
-
: variant === "outline" && color
|
|
74
|
-
? buttonStyles.outlineColor[color]
|
|
75
|
-
: variant === "ghost" && color
|
|
76
|
-
? buttonStyles.ghostColor[color]
|
|
77
|
-
: "";
|
|
78
|
-
return (_jsxs(Comp, __assign({ "data-slot": "button", className: cn(buttonVariants({ variant: variant, color: color, size: size, shape: shape, className: className }), extraClasses) }, props, { children: [startIcon && (_jsx(LUIcon, { size: startIconSizeValue, "data-testid": "start-icon", icon: startIcon })), props.children, endIcon && (_jsx(LUIcon, { size: endIconSizeValue, "data-testid": "end-icon", icon: endIcon }))] })));
|
|
101
|
+
return (_jsxs(Comp, __assign({ "data-slot": "button", "data-size": size, "data-variant": variant, "data-color": color, className: cn(buttonVariants({ variant: variant, color: color, size: size, shape: shape, className: className })) }, props, { children: [startIcon && (_jsx(LUIcon, { size: startIconSizeValue, "data-testid": "start-icon", icon: startIcon })), props.children, endIcon && (_jsx(LUIcon, { size: endIconSizeValue, "data-testid": "end-icon", icon: endIcon }))] })));
|
|
79
102
|
}
|
|
80
103
|
export { Button, buttonVariants };
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
13
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
14
|
+
if (ar || !(i in from)) {
|
|
15
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
16
|
+
ar[i] = from[i];
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
20
|
+
};
|
|
21
|
+
import * as React from "react";
|
|
22
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
23
|
+
import { cva } from "class-variance-authority";
|
|
24
|
+
import LUIcon from "../../Icons/LUIcon";
|
|
25
|
+
import { buttonStyles } from "..";
|
|
26
|
+
export var variant = {
|
|
27
|
+
fill: "",
|
|
28
|
+
link: "bg-transparent hover:bg-transparent focus:bg-transparent active:bg-transparent !p-0 underline-offset-4 hover:underline border-none",
|
|
29
|
+
outline: "border bg-transparent",
|
|
30
|
+
ghost: "bg-transparent border-none",
|
|
31
|
+
};
|
|
32
|
+
var buttonVariants = cva("inline-flex items-center justify-center gap-2 whitespace-nowrap text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-blue-200 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive cursor-pointer", {
|
|
33
|
+
variants: {
|
|
34
|
+
color: buttonStyles.fillColor,
|
|
35
|
+
size: buttonStyles.size,
|
|
36
|
+
shape: buttonStyles.shape,
|
|
37
|
+
variant: variant,
|
|
38
|
+
},
|
|
39
|
+
defaultVariants: {
|
|
40
|
+
color: "blue",
|
|
41
|
+
size: "md",
|
|
42
|
+
shape: "rounded-sm",
|
|
43
|
+
variant: "fill",
|
|
44
|
+
},
|
|
45
|
+
compoundVariants: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], Object.entries(buttonStyles.linkSize).map(function (_a) {
|
|
46
|
+
var size = _a[0], cls = _a[1];
|
|
47
|
+
return ({
|
|
48
|
+
variant: "link",
|
|
49
|
+
size: size,
|
|
50
|
+
class: cls,
|
|
51
|
+
});
|
|
52
|
+
}), true), Object.entries(buttonStyles.linkColor).map(function (_a) {
|
|
53
|
+
var color = _a[0], cls = _a[1];
|
|
54
|
+
return ({
|
|
55
|
+
variant: "link",
|
|
56
|
+
color: color,
|
|
57
|
+
class: cls,
|
|
58
|
+
});
|
|
59
|
+
}), true), Object.entries(buttonStyles.outlineColor).map(function (_a) {
|
|
60
|
+
var color = _a[0], cls = _a[1];
|
|
61
|
+
return ({
|
|
62
|
+
variant: "outline",
|
|
63
|
+
color: color,
|
|
64
|
+
class: cls,
|
|
65
|
+
});
|
|
66
|
+
}), true), Object.entries(buttonStyles.ghostColor).map(function (_a) {
|
|
67
|
+
var color = _a[0], cls = _a[1];
|
|
68
|
+
return ({
|
|
69
|
+
variant: "ghost",
|
|
70
|
+
color: color,
|
|
71
|
+
class: cls,
|
|
72
|
+
});
|
|
73
|
+
}), true),
|
|
74
|
+
});
|
|
75
|
+
function Button(_a) {
|
|
76
|
+
var className = _a.className, _b = _a.color, color = _b === void 0 ? "blue" : _b, size = _a.size, shape = _a.shape, _c = _a.variant, variant = _c === void 0 ? "fill" : _c, _d = _a.asChild, asChild = _d === void 0 ? false : _d, startIcon = _a.startIcon, endIcon = _a.endIcon, props = __rest(_a, ["className", "color", "size", "shape", "variant", "asChild", "startIcon", "endIcon"]);
|
|
77
|
+
var Comp = asChild ? Slot : "button";
|
|
78
|
+
// Map button size to appropriate icon sizes for start and end icons
|
|
79
|
+
var getIconSizes = function () {
|
|
80
|
+
if (size === "xl" || size === "lg" || size === "md") {
|
|
81
|
+
return {
|
|
82
|
+
startIcon: "md", // 16px (size-6) - matches iconSize.xl
|
|
83
|
+
endIcon: "xs", // 12px (size-3.5)
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
return {
|
|
87
|
+
startIcon: "sm", // 14px (size-4)
|
|
88
|
+
endIcon: "xs", // 12px (size-3.5)
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
// Get icon sizes based on button size
|
|
92
|
+
var iconSizes = getIconSizes();
|
|
93
|
+
var startIconSizeValue = iconSizes.startIcon;
|
|
94
|
+
var endIconSizeValue = iconSizes.endIcon;
|
|
95
|
+
return (<Comp data-slot="button" className={buttonVariants({ variant: variant, color: color, size: size, shape: shape, className: className })} {...props}>
|
|
96
|
+
{startIcon && (<LUIcon size={startIconSizeValue} data-testid="start-icon" icon={startIcon}/>)}
|
|
97
|
+
{props.children}
|
|
98
|
+
{endIcon && (<LUIcon size={endIconSizeValue} data-testid="end-icon" icon={endIcon}/>)}
|
|
99
|
+
</Comp>);
|
|
100
|
+
}
|
|
101
|
+
export { Button, buttonVariants };
|