linkedunion-design-kit 1.9.6-beta.0 → 1.9.6-beta.1
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/build/types/validator.js +12 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/src/components/Badge/Badge.stories.d.ts +1 -1
- package/dist/src/components/Badge/Badge.stories.js +1 -1
- package/dist/src/components/Button/Button/Button.module.css +1 -1
- package/dist/src/components/Card/MultipleNews/MultiNews.js +2 -2
- package/dist/src/components/Pagination/pagination.js +7 -7
- package/dist/src/components/Skeleton/skeleton.stories.d.ts +3 -1
- package/dist/src/components/Skeleton/skeleton.stories.js +48 -38
- package/dist/src/components/Title/Title.module.css +1 -1
- package/dist/src/components/Typography/Heading/heading.module.css +1 -1
- package/dist/src/components/VerticalTabs/VerticalTabs.d.ts +18 -0
- package/dist/src/components/VerticalTabs/VerticalTabs.js +60 -0
- package/dist/src/components/VerticalTabs/VerticalTabs.stories.d.ts +11 -0
- package/dist/src/components/VerticalTabs/VerticalTabs.stories.js +100 -0
- package/dist/src/components/VerticalTabs/VerticalTabs.test.d.ts +1 -0
- package/dist/src/components/VerticalTabs/VerticalTabs.test.js +48 -0
- package/dist/styles/global.css +118 -6
- package/package.json +2 -2
- package/dist/app/layout.jsx +0 -13
- package/dist/app/page.jsx +0 -5
- package/dist/src/components/Accordion/Accordion.stories.jsx +0 -33
- package/dist/src/components/Accordion/accordion.jsx +0 -59
- package/dist/src/components/Alerts/Alert/alert.jsx +0 -152
- package/dist/src/components/Alerts/Alert/alert.stories.jsx +0 -344
- package/dist/src/components/Alerts/AlertDialog/alert-dialog.jsx +0 -170
- package/dist/src/components/Alerts/AlertDialog/alert-dialog.stories.jsx +0 -552
- 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 -45
- package/dist/src/components/Avatar/Avatar/Avatar.stories.jsx +0 -95
- package/dist/src/components/Avatar/Avatar/Avatar.test.jsx +0 -9
- package/dist/src/components/Avatar/Avatar/type.d.ts +0 -12
- 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/Avatar/StatusIndicator/StatusIndicator.jsx +0 -20
- package/dist/src/components/Avatar/StatusIndicator/StatusIndicator.stories.jsx +0 -50
- package/dist/src/components/Badge/Badge.jsx +0 -54
- package/dist/src/components/Badge/Badge.stories.jsx +0 -201
- package/dist/src/components/Button/Button/Button.jsx +0 -96
- 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/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/Card/MultipleNews/MultiNews.jsx +0 -70
- package/dist/src/components/Card/MultipleNews/MultiNews.stories.jsx +0 -101
- package/dist/src/components/Card/PostByCategory/PostByCategory.jsx +0 -60
- package/dist/src/components/Card/PostByCategory/PostByCategory.stories.jsx +0 -102
- package/dist/src/components/Card/SinglePost/SinglePost.jsx +0 -26
- package/dist/src/components/Card/SinglePost/SinglePost.stories.jsx +0 -63
- package/dist/src/components/Card/card.jsx +0 -20
- package/dist/src/components/Card/contactProfile/ContactProfile.jsx +0 -60
- package/dist/src/components/Card/contactProfile/ContactProfile.stories.jsx +0 -99
- package/dist/src/components/Card/photoAlbum/PhotoAlbum.jsx +0 -41
- package/dist/src/components/Card/photoAlbum/PhotoAlbum.stories.jsx +0 -51
- package/dist/src/components/Card/photoGallery/PhotoGallery.jsx +0 -17
- package/dist/src/components/Card/photoGallery/PhotoGallery.stories.jsx +0 -34
- 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/Combobox/Combobox.jsx +0 -198
- package/dist/src/components/Dropdown/Combobox/Combobox.stories.jsx +0 -289
- package/dist/src/components/Dropdown/Combobox/utils/renderBadge.jsx +0 -7
- package/dist/src/components/Dropdown/DropdownMenu/DropdownMenu.jsx +0 -102
- package/dist/src/components/Dropdown/DropdownMenu/DropdownMenu.stories.jsx +0 -464
- package/dist/src/components/Dropdown/DropdownMenu/SelectAllSection.jsx +0 -19
- package/dist/src/components/Dropdown/Select.stories.jsx +0 -201
- package/dist/src/components/Dropdown/select.jsx +0 -93
- package/dist/src/components/Icons/LUIcon.jsx +0 -41
- package/dist/src/components/Icons/LUIcon.test.jsx +0 -308
- 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 -108
- 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/Pagination/pagination.jsx +0 -65
- package/dist/src/components/Pagination/pagination.stories.jsx +0 -301
- 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/SweetAlert/SweetAlert.jsx +0 -147
- package/dist/src/components/SweetAlert/SweetAlert.stories.jsx +0 -505
- package/dist/src/components/Switch/Switch.stories.jsx +0 -66
- package/dist/src/components/Switch/switch.jsx +0 -61
- package/dist/src/components/Table/Table.jsx +0 -221
- package/dist/src/components/Table/Table.stories.jsx +0 -652
- 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/avatar.d.ts +0 -6
- package/dist/src/components/ui/avatar.js +0 -38
- package/dist/src/components/ui/avatar.jsx +0 -27
- package/dist/src/components/ui/button.d.ts +0 -10
- package/dist/src/components/ui/button.js +0 -56
- package/dist/src/components/ui/button.jsx +0 -45
- package/dist/src/components/ui/collapsible.jsx +0 -5
- package/dist/src/components/ui/command.jsx +0 -67
- package/dist/src/components/ui/dialog.jsx +0 -66
- package/dist/src/components/ui/popover.jsx +0 -33
- package/dist/src/components/ui/tooltip.jsx +0 -38
- package/dist/src/components/ui/typography.jsx +0 -56
- /package/dist/{src/components/Avatar/Avatar/type.js → build/types/validator.d.ts} +0 -0
|
@@ -1,54 +0,0 @@
|
|
|
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 };
|
|
@@ -1,201 +0,0 @@
|
|
|
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,96 +0,0 @@
|
|
|
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 { cn } from "../../../lib/utils";
|
|
25
|
-
import LUIcon from "../../Icons/LUIcon";
|
|
26
|
-
import { buttonStyles } from "..";
|
|
27
|
-
export var variant = {
|
|
28
|
-
fill: "",
|
|
29
|
-
link: "bg-transparent hover:bg-transparent focus:bg-transparent active:bg-transparent !p-0 underline-offset-4 hover:underline border-none",
|
|
30
|
-
outline: "border bg-transparent",
|
|
31
|
-
ghost: "bg-transparent border-none",
|
|
32
|
-
};
|
|
33
|
-
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", {
|
|
34
|
-
variants: {
|
|
35
|
-
color: buttonStyles.fillColor,
|
|
36
|
-
size: buttonStyles.size,
|
|
37
|
-
shape: buttonStyles.shape,
|
|
38
|
-
variant: variant,
|
|
39
|
-
},
|
|
40
|
-
defaultVariants: {
|
|
41
|
-
color: "blue",
|
|
42
|
-
size: "md",
|
|
43
|
-
shape: "rounded-sm",
|
|
44
|
-
variant: "fill",
|
|
45
|
-
},
|
|
46
|
-
compoundVariants: __spreadArray(__spreadArray(__spreadArray([], Object.entries(buttonStyles.linkColor).map(function (_a) {
|
|
47
|
-
var color = _a[0], className = _a[1];
|
|
48
|
-
return ({
|
|
49
|
-
color: color,
|
|
50
|
-
variant: "link",
|
|
51
|
-
class: className,
|
|
52
|
-
});
|
|
53
|
-
}), true), Object.entries(buttonStyles.outlineColor).map(function (_a) {
|
|
54
|
-
var color = _a[0], className = _a[1];
|
|
55
|
-
return ({
|
|
56
|
-
color: color,
|
|
57
|
-
variant: "outline",
|
|
58
|
-
class: className,
|
|
59
|
-
});
|
|
60
|
-
}), true), Object.entries(buttonStyles.ghostColor).map(function (_a) {
|
|
61
|
-
var color = _a[0], className = _a[1];
|
|
62
|
-
return ({
|
|
63
|
-
color: color,
|
|
64
|
-
variant: "ghost",
|
|
65
|
-
class: className,
|
|
66
|
-
});
|
|
67
|
-
}), true),
|
|
68
|
-
});
|
|
69
|
-
function Button(_a) {
|
|
70
|
-
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"]);
|
|
71
|
-
var Comp = asChild ? Slot : "button";
|
|
72
|
-
// Map button size to appropriate icon sizes for start and end icons
|
|
73
|
-
var getIconSizes = function () {
|
|
74
|
-
if (size === "xl" || size === "lg" || size === "md") {
|
|
75
|
-
return {
|
|
76
|
-
startIcon: "md", // 16px (size-6) - matches iconSize.xl
|
|
77
|
-
endIcon: "xs", // 12px (size-3.5)
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
return {
|
|
81
|
-
startIcon: "sm", // 14px (size-4)
|
|
82
|
-
endIcon: "xs", // 12px (size-3.5)
|
|
83
|
-
};
|
|
84
|
-
};
|
|
85
|
-
// Get icon sizes based on button size
|
|
86
|
-
var iconSizes = getIconSizes();
|
|
87
|
-
// Use the calculated sizes based on button size
|
|
88
|
-
var startIconSizeValue = iconSizes.startIcon;
|
|
89
|
-
var endIconSizeValue = iconSizes.endIcon;
|
|
90
|
-
return (<Comp 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}>
|
|
91
|
-
{startIcon && (<LUIcon size={startIconSizeValue} data-testid="start-icon" icon={startIcon}/>)}
|
|
92
|
-
{props.children}
|
|
93
|
-
{endIcon && (<LUIcon size={endIconSizeValue} data-testid="end-icon" icon={endIcon}/>)}
|
|
94
|
-
</Comp>);
|
|
95
|
-
}
|
|
96
|
-
export { Button, buttonVariants };
|
|
@@ -1,283 +0,0 @@
|
|
|
1
|
-
import { Button, variant } from "./Button";
|
|
2
|
-
import { buttonStyles } from "..";
|
|
3
|
-
var meta = {
|
|
4
|
-
title: "Components/Button",
|
|
5
|
-
component: Button,
|
|
6
|
-
tags: ["autodocs"],
|
|
7
|
-
parameters: {
|
|
8
|
-
docs: {
|
|
9
|
-
description: {
|
|
10
|
-
component: "Button component with default variants: color: blue, size: md, shape: rounded-sm, variant: default",
|
|
11
|
-
},
|
|
12
|
-
},
|
|
13
|
-
controls: {
|
|
14
|
-
expanded: true,
|
|
15
|
-
sort: "requiredFirst",
|
|
16
|
-
hideNoControlsWarning: true,
|
|
17
|
-
exclude: [],
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
args: {
|
|
21
|
-
// Default values for all stories
|
|
22
|
-
color: "blue",
|
|
23
|
-
size: "md",
|
|
24
|
-
shape: "rounded-sm",
|
|
25
|
-
variant: "fill",
|
|
26
|
-
},
|
|
27
|
-
argTypes: {
|
|
28
|
-
color: {
|
|
29
|
-
control: {
|
|
30
|
-
type: "select",
|
|
31
|
-
},
|
|
32
|
-
options: Object.keys(buttonStyles.fillColor),
|
|
33
|
-
description: "The color and visual style of the button",
|
|
34
|
-
defaultValue: "blue",
|
|
35
|
-
table: {
|
|
36
|
-
defaultValue: { summary: "blue" },
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
size: {
|
|
40
|
-
control: {
|
|
41
|
-
type: "select",
|
|
42
|
-
},
|
|
43
|
-
options: Object.keys(buttonStyles.size),
|
|
44
|
-
description: "The size of the button",
|
|
45
|
-
defaultValue: "md",
|
|
46
|
-
table: {
|
|
47
|
-
defaultValue: { summary: "md" },
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
shape: {
|
|
51
|
-
control: {
|
|
52
|
-
type: "select",
|
|
53
|
-
},
|
|
54
|
-
options: Object.keys(buttonStyles.shape),
|
|
55
|
-
description: "The shape of the button",
|
|
56
|
-
defaultValue: "rounded-sm",
|
|
57
|
-
table: {
|
|
58
|
-
defaultValue: { summary: "rounded-sm" },
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
variant: {
|
|
62
|
-
control: {
|
|
63
|
-
type: "select",
|
|
64
|
-
},
|
|
65
|
-
options: Object.keys(variant),
|
|
66
|
-
description: "The variant of the button (default or link)",
|
|
67
|
-
defaultValue: "fill",
|
|
68
|
-
table: {
|
|
69
|
-
defaultValue: { summary: "fill" },
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
startIcon: {
|
|
73
|
-
control: "text",
|
|
74
|
-
description: "Icon to display at the start of the button",
|
|
75
|
-
},
|
|
76
|
-
endIcon: {
|
|
77
|
-
control: "text",
|
|
78
|
-
description: "Icon to display at the end of the button",
|
|
79
|
-
},
|
|
80
|
-
disabled: {
|
|
81
|
-
control: "boolean",
|
|
82
|
-
description: "Whether the button is disabled",
|
|
83
|
-
},
|
|
84
|
-
asChild: {
|
|
85
|
-
control: "boolean",
|
|
86
|
-
description: "Whether to render as a child component",
|
|
87
|
-
},
|
|
88
|
-
onClick: {
|
|
89
|
-
action: "clicked",
|
|
90
|
-
description: "Function called when button is clicked",
|
|
91
|
-
},
|
|
92
|
-
},
|
|
93
|
-
decorators: [
|
|
94
|
-
function (Story, context) {
|
|
95
|
-
var currentVariant = context.args.variant;
|
|
96
|
-
var isLink = currentVariant === "link";
|
|
97
|
-
var isOutline = currentVariant === "outline";
|
|
98
|
-
var isGhost = currentVariant === "ghost";
|
|
99
|
-
var isFill = currentVariant === "fill";
|
|
100
|
-
if (context.argTypes) {
|
|
101
|
-
// ✅ Update Link color and size options
|
|
102
|
-
if (context.argTypes.color) {
|
|
103
|
-
context.argTypes.color.options = isLink
|
|
104
|
-
? Object.keys(buttonStyles.linkColor)
|
|
105
|
-
: isOutline
|
|
106
|
-
? Object.keys(buttonStyles.outlineColor)
|
|
107
|
-
: isGhost
|
|
108
|
-
? Object.keys(buttonStyles.ghostColor)
|
|
109
|
-
: isFill
|
|
110
|
-
? Object.keys(buttonStyles.fillColor)
|
|
111
|
-
: undefined;
|
|
112
|
-
}
|
|
113
|
-
if (context.argTypes.size) {
|
|
114
|
-
context.argTypes.size.options = isLink
|
|
115
|
-
? Object.keys(buttonStyles.linkSize)
|
|
116
|
-
: Object.keys(buttonStyles.size);
|
|
117
|
-
}
|
|
118
|
-
// ✅ Hide shape control if variant is link
|
|
119
|
-
if (context.argTypes.shape) {
|
|
120
|
-
context.argTypes.shape.table = context.argTypes.shape.table || {};
|
|
121
|
-
context.argTypes.shape.table.disable = isLink;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
return <Story {...context}/>;
|
|
125
|
-
},
|
|
126
|
-
],
|
|
127
|
-
};
|
|
128
|
-
export default meta;
|
|
129
|
-
// Display Default button with explicit default values
|
|
130
|
-
export var Default = {
|
|
131
|
-
args: {
|
|
132
|
-
children: "Button Text",
|
|
133
|
-
color: "blue",
|
|
134
|
-
size: "md",
|
|
135
|
-
shape: "rounded-sm",
|
|
136
|
-
variant: "fill",
|
|
137
|
-
onClick: function () {
|
|
138
|
-
alert("Button clicked!");
|
|
139
|
-
},
|
|
140
|
-
},
|
|
141
|
-
};
|
|
142
|
-
export var Blue = {
|
|
143
|
-
args: {
|
|
144
|
-
children: "Blue Button",
|
|
145
|
-
color: "blue",
|
|
146
|
-
size: "md",
|
|
147
|
-
},
|
|
148
|
-
};
|
|
149
|
-
export var Red = {
|
|
150
|
-
args: {
|
|
151
|
-
children: "Red Button",
|
|
152
|
-
color: "red",
|
|
153
|
-
size: "md",
|
|
154
|
-
},
|
|
155
|
-
};
|
|
156
|
-
export var Green = {
|
|
157
|
-
args: {
|
|
158
|
-
children: "Green Button",
|
|
159
|
-
color: "green",
|
|
160
|
-
size: "md",
|
|
161
|
-
},
|
|
162
|
-
};
|
|
163
|
-
export var Yellow = {
|
|
164
|
-
args: {
|
|
165
|
-
children: "Yellow Button",
|
|
166
|
-
color: "yellow",
|
|
167
|
-
size: "md",
|
|
168
|
-
},
|
|
169
|
-
};
|
|
170
|
-
export var Indigo = {
|
|
171
|
-
args: {
|
|
172
|
-
children: "Indigo Button",
|
|
173
|
-
color: "indigo",
|
|
174
|
-
size: "md",
|
|
175
|
-
},
|
|
176
|
-
};
|
|
177
|
-
export var Gray = {
|
|
178
|
-
args: {
|
|
179
|
-
children: "Gray Button",
|
|
180
|
-
color: "gray",
|
|
181
|
-
size: "md",
|
|
182
|
-
},
|
|
183
|
-
};
|
|
184
|
-
export var WithStartIcon = {
|
|
185
|
-
args: {
|
|
186
|
-
children: "Button with Start Icon",
|
|
187
|
-
startIcon: "arrow-right",
|
|
188
|
-
size: "md",
|
|
189
|
-
},
|
|
190
|
-
};
|
|
191
|
-
export var WithEndIcon = {
|
|
192
|
-
args: {
|
|
193
|
-
children: "Button with End Icon",
|
|
194
|
-
endIcon: "arrow-right",
|
|
195
|
-
size: "md",
|
|
196
|
-
},
|
|
197
|
-
};
|
|
198
|
-
export var WithBothIcons = {
|
|
199
|
-
args: {
|
|
200
|
-
children: "Button with Icons",
|
|
201
|
-
startIcon: "plus",
|
|
202
|
-
endIcon: "arrow-right",
|
|
203
|
-
size: "md",
|
|
204
|
-
},
|
|
205
|
-
};
|
|
206
|
-
export var Small = {
|
|
207
|
-
args: {
|
|
208
|
-
children: "Small Button",
|
|
209
|
-
size: "sm",
|
|
210
|
-
},
|
|
211
|
-
};
|
|
212
|
-
export var Medium = {
|
|
213
|
-
args: {
|
|
214
|
-
children: "Medium Button",
|
|
215
|
-
size: "md",
|
|
216
|
-
},
|
|
217
|
-
};
|
|
218
|
-
export var Large = {
|
|
219
|
-
args: {
|
|
220
|
-
children: "Large Button",
|
|
221
|
-
size: "lg",
|
|
222
|
-
},
|
|
223
|
-
};
|
|
224
|
-
export var ExtraLarge = {
|
|
225
|
-
args: {
|
|
226
|
-
children: "Extra Large Button",
|
|
227
|
-
size: "xl",
|
|
228
|
-
},
|
|
229
|
-
};
|
|
230
|
-
export var DefaultVariant = {
|
|
231
|
-
args: {
|
|
232
|
-
children: "Default Variant Button",
|
|
233
|
-
variant: "fill",
|
|
234
|
-
},
|
|
235
|
-
};
|
|
236
|
-
export var LinkVariant = {
|
|
237
|
-
args: {
|
|
238
|
-
children: "Link Style Button",
|
|
239
|
-
variant: "link",
|
|
240
|
-
color: "blue",
|
|
241
|
-
},
|
|
242
|
-
};
|
|
243
|
-
export var LinkVariantRed = {
|
|
244
|
-
args: {
|
|
245
|
-
children: "Red Link Button",
|
|
246
|
-
variant: "link",
|
|
247
|
-
color: "red",
|
|
248
|
-
},
|
|
249
|
-
};
|
|
250
|
-
export var LinkVariantGreen = {
|
|
251
|
-
args: {
|
|
252
|
-
children: "Green Link Button",
|
|
253
|
-
variant: "link",
|
|
254
|
-
color: "green",
|
|
255
|
-
},
|
|
256
|
-
};
|
|
257
|
-
export var RoundedSmall = {
|
|
258
|
-
args: {
|
|
259
|
-
children: "Rounded Small",
|
|
260
|
-
shape: "rounded-sm",
|
|
261
|
-
},
|
|
262
|
-
};
|
|
263
|
-
export var RoundedFull = {
|
|
264
|
-
args: {
|
|
265
|
-
children: "Rounded Full",
|
|
266
|
-
shape: "rounded-full",
|
|
267
|
-
},
|
|
268
|
-
};
|
|
269
|
-
export var Disabled = {
|
|
270
|
-
args: {
|
|
271
|
-
children: "Disabled Button",
|
|
272
|
-
disabled: true,
|
|
273
|
-
},
|
|
274
|
-
};
|
|
275
|
-
// Color variants
|
|
276
|
-
// Example of color with different button states
|
|
277
|
-
export var DisabledButton = {
|
|
278
|
-
args: {
|
|
279
|
-
children: "Disabled Button",
|
|
280
|
-
color: "blue",
|
|
281
|
-
disabled: true,
|
|
282
|
-
},
|
|
283
|
-
};
|