linkedunion-design-kit 1.9.2 → 1.9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +4 -0
- package/dist/index.js +4 -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 +3 -3
- 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/colors.js +11 -11
- package/dist/src/utils/iconList.d.ts +4 -0
- package/dist/src/utils/iconList.js +4 -0
- package/dist/styles/global.css +209 -67
- 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,344 @@
|
|
|
1
|
+
import { Alert, AlertAction, AlertCancel, AlertHeader, AlertTitle, AlertDescription, AlertFooter, colorOptions, sizeOptions, shadowOptions, variantOptions, getIconForColor, getContentForColor, } from "../AlertDialog/index";
|
|
2
|
+
import LUIcon from "../../Icons/LUIcon";
|
|
3
|
+
import { Button } from "../../Button/Button/Button";
|
|
4
|
+
import { Heading } from "../../Typography/Heading/heading";
|
|
5
|
+
import { Body } from "../../Typography/Body/body";
|
|
6
|
+
export default {
|
|
7
|
+
title: "Components/Alert/Alert",
|
|
8
|
+
component: Alert,
|
|
9
|
+
tags: ["autodocs"],
|
|
10
|
+
parameters: {
|
|
11
|
+
docs: {
|
|
12
|
+
description: {
|
|
13
|
+
component: "A non-modal alert component that uses the same styling as AlertDialog but renders directly in the page flow without requiring a dialog context.",
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
// Template for stories with args
|
|
19
|
+
var Template = function (args) { return (<Alert size={args.size} shadow={args.shadow} color={args.color} variant={args.variant}>
|
|
20
|
+
<AlertHeader>
|
|
21
|
+
{args.Icon && <LUIcon icon={args.Icon} variant="padded"/>}
|
|
22
|
+
<AlertTitle>{args.title}</AlertTitle>
|
|
23
|
+
<AlertDescription>{args.description}</AlertDescription>
|
|
24
|
+
</AlertHeader>
|
|
25
|
+
<AlertFooter>
|
|
26
|
+
{args.showCancel && (<AlertCancel onClick={function () { return alert("Cancel clicked"); }} className="text-blue-600 hover:text-blue-700 hover:underline">
|
|
27
|
+
{args.cancelText}
|
|
28
|
+
</AlertCancel>)}
|
|
29
|
+
{args.showAction && (<AlertAction onClick={function () { return alert("Action clicked"); }} className="text-blue-600 hover:text-blue-700 hover:underline">
|
|
30
|
+
{args.actionText}
|
|
31
|
+
</AlertAction>)}
|
|
32
|
+
</AlertFooter>
|
|
33
|
+
</Alert>); };
|
|
34
|
+
// Default story with all controls
|
|
35
|
+
export var Default = Template.bind({});
|
|
36
|
+
Default.args = {
|
|
37
|
+
size: "md",
|
|
38
|
+
shadow: "none",
|
|
39
|
+
color: "blue",
|
|
40
|
+
variant: "outline",
|
|
41
|
+
Icon: "info",
|
|
42
|
+
title: "Update Available",
|
|
43
|
+
description: "A new version of the application is available. Would you like to update now? The update includes bug fixes and performance improvements.",
|
|
44
|
+
cancelText: "Later",
|
|
45
|
+
actionText: "Update Now",
|
|
46
|
+
showCancel: true,
|
|
47
|
+
showAction: true,
|
|
48
|
+
};
|
|
49
|
+
Default.argTypes = {
|
|
50
|
+
size: {
|
|
51
|
+
control: { type: "select" },
|
|
52
|
+
options: sizeOptions,
|
|
53
|
+
description: "Size variant for Alert",
|
|
54
|
+
table: {
|
|
55
|
+
defaultValue: { summary: "md" },
|
|
56
|
+
type: { summary: "enum" },
|
|
57
|
+
category: "Alert",
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
shadow: {
|
|
61
|
+
control: { type: "select" },
|
|
62
|
+
options: shadowOptions,
|
|
63
|
+
description: "Shadow variant for Alert",
|
|
64
|
+
table: {
|
|
65
|
+
defaultValue: { summary: "none" },
|
|
66
|
+
type: { summary: "enum" },
|
|
67
|
+
category: "Alert",
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
color: {
|
|
71
|
+
control: { type: "select" },
|
|
72
|
+
options: colorOptions,
|
|
73
|
+
description: "Color theme for Alert",
|
|
74
|
+
table: {
|
|
75
|
+
defaultValue: { summary: "blue" },
|
|
76
|
+
type: { summary: "enum" },
|
|
77
|
+
category: "Alert",
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
variant: {
|
|
81
|
+
control: { type: "select" },
|
|
82
|
+
options: variantOptions,
|
|
83
|
+
description: "Variant for Alert (outline | fill)",
|
|
84
|
+
table: {
|
|
85
|
+
defaultValue: { summary: "outline" },
|
|
86
|
+
type: { summary: "enum" },
|
|
87
|
+
category: "Alert",
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
Icon: {
|
|
91
|
+
control: { type: "text" },
|
|
92
|
+
description: "Icon to display in AlertHeader (LUIcon name)",
|
|
93
|
+
table: {
|
|
94
|
+
type: { summary: "string" },
|
|
95
|
+
category: "AlertHeader",
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
title: {
|
|
99
|
+
control: { type: "text" },
|
|
100
|
+
description: "Title text for AlertTitle",
|
|
101
|
+
table: {
|
|
102
|
+
type: { summary: "string" },
|
|
103
|
+
category: "AlertTitle",
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
description: {
|
|
107
|
+
control: { type: "text" },
|
|
108
|
+
description: "Description text for AlertDescription",
|
|
109
|
+
table: {
|
|
110
|
+
type: { summary: "string" },
|
|
111
|
+
category: "AlertDescription",
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
cancelText: {
|
|
115
|
+
control: { type: "text" },
|
|
116
|
+
description: "Text for AlertCancel button",
|
|
117
|
+
table: {
|
|
118
|
+
type: { summary: "string" },
|
|
119
|
+
category: "AlertCancel",
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
actionText: {
|
|
123
|
+
control: { type: "text" },
|
|
124
|
+
description: "Text for AlertAction button",
|
|
125
|
+
table: {
|
|
126
|
+
type: { summary: "string" },
|
|
127
|
+
category: "AlertAction",
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
showCancel: {
|
|
131
|
+
control: { type: "boolean" },
|
|
132
|
+
description: "Whether to show the cancel button",
|
|
133
|
+
table: {
|
|
134
|
+
type: { summary: "boolean" },
|
|
135
|
+
category: "Alert",
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
showAction: {
|
|
139
|
+
control: { type: "boolean" },
|
|
140
|
+
description: "Whether to show the action button",
|
|
141
|
+
table: {
|
|
142
|
+
type: { summary: "boolean" },
|
|
143
|
+
category: "Alert",
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
};
|
|
147
|
+
// Simple Example showing the exact code structure
|
|
148
|
+
export var Example = function () { return (<Alert color="blue" size="md" shadow="none">
|
|
149
|
+
<AlertHeader>
|
|
150
|
+
<LUIcon icon="info" variant="padded"/>
|
|
151
|
+
<AlertTitle>Update Available</AlertTitle>
|
|
152
|
+
<AlertDescription>
|
|
153
|
+
A new version of the application is available. Would you like to update
|
|
154
|
+
now? The update includes bug fixes and performance improvements.
|
|
155
|
+
</AlertDescription>
|
|
156
|
+
</AlertHeader>
|
|
157
|
+
<AlertFooter>
|
|
158
|
+
<AlertCancel className="text-blue-600 hover:text-blue-700 hover:underline" onClick={function () { return console.log("Later clicked"); }}>
|
|
159
|
+
Later
|
|
160
|
+
</AlertCancel>
|
|
161
|
+
<AlertAction className="text-blue-600 hover:text-blue-700 hover:underline" onClick={function () { return console.log("Update Now clicked"); }}>
|
|
162
|
+
Update Now
|
|
163
|
+
</AlertAction>
|
|
164
|
+
</AlertFooter>
|
|
165
|
+
</Alert>); };
|
|
166
|
+
Example.parameters = {
|
|
167
|
+
docs: {
|
|
168
|
+
description: {
|
|
169
|
+
story: "This example shows the exact code structure you should use to implement the Alert component.",
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
};
|
|
173
|
+
// All Colors Example
|
|
174
|
+
export var AllColors = function () { return (<div className="flex flex-col gap-4">
|
|
175
|
+
{colorOptions.map(function (color) {
|
|
176
|
+
var content = getContentForColor(color);
|
|
177
|
+
return (<Alert key={color} color={color}>
|
|
178
|
+
<AlertHeader>
|
|
179
|
+
<LUIcon icon={getIconForColor(color)} variant="padded"/>
|
|
180
|
+
<AlertTitle>{content.title}</AlertTitle>
|
|
181
|
+
<AlertDescription>{content.description}</AlertDescription>
|
|
182
|
+
</AlertHeader>
|
|
183
|
+
<AlertFooter>
|
|
184
|
+
<AlertCancel className={"text-".concat(color, "-600 hover:text-").concat(color, "-700 hover:underline")}>
|
|
185
|
+
Cancel
|
|
186
|
+
</AlertCancel>
|
|
187
|
+
<AlertAction className={"text-".concat(color, "-600 hover:text-").concat(color, "-700 hover:underline")}>
|
|
188
|
+
{content.button}
|
|
189
|
+
</AlertAction>
|
|
190
|
+
</AlertFooter>
|
|
191
|
+
</Alert>);
|
|
192
|
+
})}
|
|
193
|
+
</div>); };
|
|
194
|
+
// All Sizes Example
|
|
195
|
+
export var AllSizes = function () { return (<div className="flex flex-col gap-4">
|
|
196
|
+
{sizeOptions.map(function (size) { return (<Alert key={size} size={size} color="blue">
|
|
197
|
+
<AlertHeader>
|
|
198
|
+
<LUIcon icon="info" color="blue" variant="padded"/>
|
|
199
|
+
<AlertTitle>Size: {size.toUpperCase()}</AlertTitle>
|
|
200
|
+
<AlertDescription>
|
|
201
|
+
This is an example of the Alert component with size {size}.
|
|
202
|
+
</AlertDescription>
|
|
203
|
+
</AlertHeader>
|
|
204
|
+
<AlertFooter>
|
|
205
|
+
<AlertCancel className="text-blue-600 hover:text-blue-700 hover:underline">
|
|
206
|
+
Cancel
|
|
207
|
+
</AlertCancel>
|
|
208
|
+
<AlertAction className="text-blue-600 hover:text-blue-700 hover:underline">
|
|
209
|
+
Action
|
|
210
|
+
</AlertAction>
|
|
211
|
+
</AlertFooter>
|
|
212
|
+
</Alert>); })}
|
|
213
|
+
</div>); };
|
|
214
|
+
// Variants Example
|
|
215
|
+
export var Variants = function () { return (<div className="flex flex-col gap-4">
|
|
216
|
+
<Alert variant="outline" color="blue">
|
|
217
|
+
<AlertHeader>
|
|
218
|
+
<LUIcon icon="info" variant="padded"/>
|
|
219
|
+
<AlertTitle>Outline Variant</AlertTitle>
|
|
220
|
+
<AlertDescription>
|
|
221
|
+
This is an example of the Alert component with the outline variant.
|
|
222
|
+
</AlertDescription>
|
|
223
|
+
</AlertHeader>
|
|
224
|
+
<AlertFooter>
|
|
225
|
+
<AlertCancel className="text-blue-600 hover:text-blue-700 hover:underline">
|
|
226
|
+
Cancel
|
|
227
|
+
</AlertCancel>
|
|
228
|
+
<AlertAction className="text-blue-600 hover:text-blue-700 hover:underline">
|
|
229
|
+
Action
|
|
230
|
+
</AlertAction>
|
|
231
|
+
</AlertFooter>
|
|
232
|
+
</Alert>
|
|
233
|
+
|
|
234
|
+
<Alert variant="fill" color="blue">
|
|
235
|
+
<AlertHeader>
|
|
236
|
+
<LUIcon icon="info" variant="padded"/>
|
|
237
|
+
<AlertTitle>Fill Variant</AlertTitle>
|
|
238
|
+
<AlertDescription>
|
|
239
|
+
This is an example of the Alert component with the fill variant.
|
|
240
|
+
</AlertDescription>
|
|
241
|
+
</AlertHeader>
|
|
242
|
+
<AlertFooter>
|
|
243
|
+
<AlertCancel className="text-blue-600 hover:text-blue-700 hover:underline">
|
|
244
|
+
Cancel
|
|
245
|
+
</AlertCancel>
|
|
246
|
+
<AlertAction className="text-blue-600 hover:text-blue-700 hover:underline">
|
|
247
|
+
Action
|
|
248
|
+
</AlertAction>
|
|
249
|
+
</AlertFooter>
|
|
250
|
+
</Alert>
|
|
251
|
+
</div>); };
|
|
252
|
+
// Comparison with regular AlertDialog
|
|
253
|
+
export var ComparisonWithAlertDialog = function () { return (<div className="flex flex-col gap-8">
|
|
254
|
+
<div>
|
|
255
|
+
<h2 className="text-lg font-semibold mb-2">Alert (Non-Modal)</h2>
|
|
256
|
+
<p className="text-sm text-gray-600 mb-4">
|
|
257
|
+
This version renders directly in the page flow and does not create a
|
|
258
|
+
modal overlay.
|
|
259
|
+
</p>
|
|
260
|
+
<Alert color="green">
|
|
261
|
+
<AlertHeader>
|
|
262
|
+
<LUIcon icon="check" variant="padded"/>
|
|
263
|
+
<AlertTitle>Success!</AlertTitle>
|
|
264
|
+
<AlertDescription>
|
|
265
|
+
Your changes have been saved successfully.
|
|
266
|
+
</AlertDescription>
|
|
267
|
+
</AlertHeader>
|
|
268
|
+
<AlertFooter>
|
|
269
|
+
<AlertAction className="text-green-600 hover:text-green-700 hover:underline">
|
|
270
|
+
Close
|
|
271
|
+
</AlertAction>
|
|
272
|
+
</AlertFooter>
|
|
273
|
+
</Alert>
|
|
274
|
+
</div>
|
|
275
|
+
|
|
276
|
+
<div>
|
|
277
|
+
<h2 className="text-lg font-semibold mb-2">
|
|
278
|
+
AlertDialog Button (Modal - Click to Open)
|
|
279
|
+
</h2>
|
|
280
|
+
<p className="text-sm text-gray-600 mb-4">
|
|
281
|
+
This is the regular AlertDialog component that creates a modal overlay.
|
|
282
|
+
</p>
|
|
283
|
+
<Button color="light-green" onClick={function () { }}>
|
|
284
|
+
Open Modal AlertDialog (See in Stories)
|
|
285
|
+
</Button>
|
|
286
|
+
</div>
|
|
287
|
+
</div>); };
|
|
288
|
+
// No Buttons Example
|
|
289
|
+
export var NoButtons = function () { return (<Alert color="yellow">
|
|
290
|
+
<AlertHeader>
|
|
291
|
+
<LUIcon icon="info" variant="padded"/>
|
|
292
|
+
<AlertTitle>Maintenance Notice</AlertTitle>
|
|
293
|
+
<AlertDescription>
|
|
294
|
+
System maintenance is scheduled for tonight at 10:00 PM. The system will
|
|
295
|
+
be unavailable for approximately 30 minutes.
|
|
296
|
+
</AlertDescription>
|
|
297
|
+
</AlertHeader>
|
|
298
|
+
</Alert>); };
|
|
299
|
+
// With Shadow Example
|
|
300
|
+
export var WithShadow = function () { return (<Alert color="blue" shadow="lg">
|
|
301
|
+
<AlertHeader>
|
|
302
|
+
<LUIcon icon="info" variant="padded"/>
|
|
303
|
+
<AlertTitle>Information</AlertTitle>
|
|
304
|
+
<AlertDescription>
|
|
305
|
+
This alert has a large shadow applied to it.
|
|
306
|
+
</AlertDescription>
|
|
307
|
+
</AlertHeader>
|
|
308
|
+
<AlertFooter>
|
|
309
|
+
<AlertAction className="text-blue-600 hover:text-blue-700 hover:underline">
|
|
310
|
+
Got it
|
|
311
|
+
</AlertAction>
|
|
312
|
+
</AlertFooter>
|
|
313
|
+
</Alert>); };
|
|
314
|
+
// CustomizeAlert Example - showing how to customize with Typography components
|
|
315
|
+
export var CustomizeAlert = function () { return (<Alert color="red" size="md" variant="fill">
|
|
316
|
+
<AlertHeader>
|
|
317
|
+
<LUIcon icon="info" size="9xl" color="light-red" variant="padded"/>
|
|
318
|
+
<AlertTitle>
|
|
319
|
+
<Heading variant="h1-700">Customize Alert Title</Heading>
|
|
320
|
+
</AlertTitle>
|
|
321
|
+
<AlertDescription>
|
|
322
|
+
<Body variant="body-xs">
|
|
323
|
+
This Alert uses a customized icon size, custom typography variants,
|
|
324
|
+
and different button colors to demonstrate full customization
|
|
325
|
+
capabilities.
|
|
326
|
+
</Body>
|
|
327
|
+
</AlertDescription>
|
|
328
|
+
</AlertHeader>
|
|
329
|
+
<AlertFooter>
|
|
330
|
+
<AlertCancel variant="fill" color="indigo">
|
|
331
|
+
Close
|
|
332
|
+
</AlertCancel>
|
|
333
|
+
<AlertAction variant="outline" color="light-green">
|
|
334
|
+
OK
|
|
335
|
+
</AlertAction>
|
|
336
|
+
</AlertFooter>
|
|
337
|
+
</Alert>); };
|
|
338
|
+
CustomizeAlert.parameters = {
|
|
339
|
+
docs: {
|
|
340
|
+
description: {
|
|
341
|
+
story: "This example demonstrates how to customize the Alert component with different typography variants, icon sizes, colors, and button styles. The alert uses a fill variant with red color, custom typography components, a 9xl icon size, and mixed button variants with different colors.",
|
|
342
|
+
},
|
|
343
|
+
},
|
|
344
|
+
};
|
|
@@ -0,0 +1,170 @@
|
|
|
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 * as React from "react";
|
|
13
|
+
import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog";
|
|
14
|
+
import { cva } from "class-variance-authority";
|
|
15
|
+
import { cn } from "../../../lib/utils";
|
|
16
|
+
import { Button } from "../../Button/Button/Button";
|
|
17
|
+
import LUIcon from "../../Icons/LUIcon";
|
|
18
|
+
// Create context for AlertDialog color
|
|
19
|
+
var AlertDialogContext = React.createContext({});
|
|
20
|
+
var useAlertDialogContext = function () { return React.useContext(AlertDialogContext); };
|
|
21
|
+
export var alertDialogVariants = {
|
|
22
|
+
size: {
|
|
23
|
+
lg: "[&_[data-slot='alert-dialog-header']_svg:not(.lu-icon-custom-size)]:size-9 gap-4 [&_h2[data-slot='alert-dialog-title']]:text-2xl [&_h2[data-slot='alert-dialog-title']]:font-medium [&_p[data-slot='alert-dialog-description']]:text-lg [&_p[data-slot='alert-dialog-description']]:font-normal",
|
|
24
|
+
md: "[&_[data-slot='alert-dialog-header']_svg:not(.lu-icon-custom-size)]:size-8 gap-3 [&_h2[data-slot='alert-dialog-title']]:text-xl [&_h2[data-slot='alert-dialog-title']]:font-medium [&_p[data-slot='alert-dialog-description']]:text-base [&_p[data-slot='alert-dialog-description']]:font-normal",
|
|
25
|
+
sm: "[&_[data-slot='alert-dialog-header']_svg:not(.lu-icon-custom-size)]:size-7 gap-2 [&_h2[data-slot='alert-dialog-title']]:text-lg [&_h2[data-slot='alert-dialog-title']]:font-medium [&_p[data-slot='alert-dialog-description']]:text-sm [&_p[data-slot='alert-dialog-description']]:font-normal",
|
|
26
|
+
},
|
|
27
|
+
shadow: {
|
|
28
|
+
none: "",
|
|
29
|
+
lg: "shadow-lg",
|
|
30
|
+
},
|
|
31
|
+
color: {
|
|
32
|
+
blue: "bg-gray-50 text-blue-900 border-blue-600 [&_[data-slot='alert-dialog-header']_svg:not(.lu-icon-custom-color)]:text-blue-600 [&_h2[data-slot='alert-dialog-title']]:text-blue-600",
|
|
33
|
+
red: "bg-gray-50 text-red-900 border-red-600 [&_[data-slot='alert-dialog-header']_svg:not(.lu-icon-custom-color)]:text-red-600 [&_h2[data-slot='alert-dialog-title']]:text-red-600",
|
|
34
|
+
indigo: "bg-gray-50 text-indigo-900 border-indigo-600 [&_[data-slot='alert-dialog-header']_svg:not(.lu-icon-custom-color)]:text-indigo-600 [&_h2[data-slot='alert-dialog-title']]:text-indigo-600",
|
|
35
|
+
yellow: "bg-gray-50 text-yellow-900 border-yellow-600 [&_[data-slot='alert-dialog-header']_svg:not(.lu-icon-custom-color)]:text-yellow-600 [&_h2[data-slot='alert-dialog-title']]:text-yellow-600",
|
|
36
|
+
green: "bg-gray-50 text-green-900 border-green-600 [&_[data-slot='alert-dialog-header']_svg:not(.lu-icon-custom-color)]:text-green-600 [&_h2[data-slot='alert-dialog-title']]:text-green-600",
|
|
37
|
+
gray: "bg-gray-50 text-gray-900 border-gray-600 [&_[data-slot='alert-dialog-header']_svg:not(.lu-icon-custom-color)]:text-gray-600 [&_h2[data-slot='alert-dialog-title']]:text-gray-600",
|
|
38
|
+
},
|
|
39
|
+
variant: {
|
|
40
|
+
outline: "",
|
|
41
|
+
fill: "",
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
var alertDialogContentVariants = cva("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border-l-4 p-4 duration-200 sm:max-w-lg", {
|
|
45
|
+
variants: alertDialogVariants,
|
|
46
|
+
defaultVariants: {
|
|
47
|
+
size: "md",
|
|
48
|
+
shadow: "none",
|
|
49
|
+
color: "blue",
|
|
50
|
+
variant: "outline",
|
|
51
|
+
},
|
|
52
|
+
compoundVariants: [
|
|
53
|
+
{
|
|
54
|
+
color: "blue",
|
|
55
|
+
variant: "fill",
|
|
56
|
+
class: "bg-blue-100 text-blue-900 border-blue-600 [&_[data-slot='alert-dialog-header']_svg:not(.lu-icon-custom-color)]:text-blue-600 [&_h2[data-slot='alert-dialog-title']]:text-blue-600",
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
color: "red",
|
|
60
|
+
variant: "fill",
|
|
61
|
+
class: "bg-red-100 text-red-900 border-red-600 [&_[data-slot='alert-dialog-header']_svg:not(.lu-icon-custom-color)]:text-red-600 [&_h2[data-slot='alert-dialog-title']]:text-red-600",
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
color: "indigo",
|
|
65
|
+
variant: "fill",
|
|
66
|
+
class: "bg-indigo-100 text-indigo-900 border-indigo-600 [&_[data-slot='alert-dialog-header']_svg:not(.lu-icon-custom-color)]:text-indigo-600 [&_h2[data-slot='alert-dialog-title']]:text-indigo-600",
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
color: "yellow",
|
|
70
|
+
variant: "fill",
|
|
71
|
+
class: "bg-yellow-100 text-yellow-900 border-yellow-600 [&_[data-slot='alert-dialog-header']_svg:not(.lu-icon-custom-color)]:text-yellow-600 [&_h2[data-slot='alert-dialog-title']]:text-yellow-600",
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
color: "green",
|
|
75
|
+
variant: "fill",
|
|
76
|
+
class: "bg-green-100 text-green-900 border-green-600 [&_[data-slot='alert-dialog-header']_svg:not(.lu-icon-custom-color)]:text-green-600 [&_h2[data-slot='alert-dialog-title']]:text-green-600",
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
color: "gray",
|
|
80
|
+
variant: "fill",
|
|
81
|
+
class: "bg-gray-100 text-gray-900 border-gray-600 [&_[data-slot='alert-dialog-header']_svg:not(.lu-icon-custom-color)]:text-gray-600 [&_h2[data-slot='alert-dialog-title']]:text-gray-600",
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
});
|
|
85
|
+
function AlertDialog(_a) {
|
|
86
|
+
var props = __rest(_a, []);
|
|
87
|
+
return <AlertDialogPrimitive.Root data-slot="alert-dialog" {...props}/>;
|
|
88
|
+
}
|
|
89
|
+
function AlertDialogTrigger(_a) {
|
|
90
|
+
var props = __rest(_a, []);
|
|
91
|
+
return (<AlertDialogPrimitive.Trigger data-slot="alert-dialog-trigger" {...props}/>);
|
|
92
|
+
}
|
|
93
|
+
function AlertDialogPortal(_a) {
|
|
94
|
+
var props = __rest(_a, []);
|
|
95
|
+
return (<AlertDialogPrimitive.Portal data-slot="alert-dialog-portal" {...props}/>);
|
|
96
|
+
}
|
|
97
|
+
function AlertDialogOverlay(_a) {
|
|
98
|
+
var className = _a.className, props = __rest(_a, ["className"]);
|
|
99
|
+
return (<AlertDialogPrimitive.Overlay data-slot="alert-dialog-overlay" className={cn("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50", className)} {...props}/>);
|
|
100
|
+
}
|
|
101
|
+
function AlertDialogContent(_a) {
|
|
102
|
+
var className = _a.className, size = _a.size, shadow = _a.shadow, color = _a.color, variant = _a.variant, props = __rest(_a, ["className", "size", "shadow", "color", "variant"]);
|
|
103
|
+
return (<AlertDialogContext.Provider value={{ color: color || undefined }}>
|
|
104
|
+
<AlertDialogPortal>
|
|
105
|
+
<AlertDialogOverlay />
|
|
106
|
+
<AlertDialogPrimitive.Content data-slot="alert-dialog-content" className={cn(alertDialogContentVariants({ size: size, shadow: shadow, color: color, variant: variant }), className)} {...props}/>
|
|
107
|
+
</AlertDialogPortal>
|
|
108
|
+
</AlertDialogContext.Provider>);
|
|
109
|
+
}
|
|
110
|
+
function AlertDialogHeader(_a) {
|
|
111
|
+
var className = _a.className, children = _a.children, props = __rest(_a, ["className", "children"]);
|
|
112
|
+
// Check if children contains LUIcon
|
|
113
|
+
var childrenArray = React.Children.toArray(children);
|
|
114
|
+
var hasIcon = childrenArray.some(function (child) { return React.isValidElement(child) && child.type === LUIcon; });
|
|
115
|
+
if (hasIcon) {
|
|
116
|
+
var iconWithClass_1 = null;
|
|
117
|
+
var otherChildren_1 = [];
|
|
118
|
+
childrenArray.forEach(function (child) {
|
|
119
|
+
if (React.isValidElement(child) && child.type === LUIcon) {
|
|
120
|
+
var iconElement = child;
|
|
121
|
+
// If LUIcon has a size prop, add .lu-icon-custom-size to className
|
|
122
|
+
var hasSizeProp = !!iconElement.props.size;
|
|
123
|
+
// If LUIcon has a color prop, add .lu-icon-custom-color to className
|
|
124
|
+
var hasColorProp = !!iconElement.props.color;
|
|
125
|
+
iconWithClass_1 = React.cloneElement(iconElement, {
|
|
126
|
+
className: cn(iconElement.props.className, hasSizeProp && "lu-icon-custom-size", hasColorProp && "lu-icon-custom-color"),
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
otherChildren_1.push(child);
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
return (<div data-slot="alert-dialog-header" className={cn("flex flex-row gap-3 items-start text-left", className)} {...props}>
|
|
134
|
+
{iconWithClass_1}
|
|
135
|
+
<div>{otherChildren_1}</div>
|
|
136
|
+
</div>);
|
|
137
|
+
}
|
|
138
|
+
return (<div data-slot="alert-dialog-header" className={cn("flex flex-col gap-2 text-center sm:text-left", className)} {...props}>
|
|
139
|
+
{children}
|
|
140
|
+
</div>);
|
|
141
|
+
}
|
|
142
|
+
function AlertDialogFooter(_a) {
|
|
143
|
+
var className = _a.className, props = __rest(_a, ["className"]);
|
|
144
|
+
return (<div data-slot="alert-dialog-footer" className={cn("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", className)} {...props}/>);
|
|
145
|
+
}
|
|
146
|
+
function AlertDialogTitle(_a) {
|
|
147
|
+
var className = _a.className, props = __rest(_a, ["className"]);
|
|
148
|
+
return (<AlertDialogPrimitive.Title data-slot="alert-dialog-title" className={cn("text-lg font-semibold", className)} {...props}/>);
|
|
149
|
+
}
|
|
150
|
+
function AlertDialogDescription(_a) {
|
|
151
|
+
var className = _a.className, props = __rest(_a, ["className"]);
|
|
152
|
+
return (<AlertDialogPrimitive.Description data-slot="alert-dialog-description" className={cn("text-black text-sm", className)} {...props}/>);
|
|
153
|
+
}
|
|
154
|
+
function AlertDialogAction(_a) {
|
|
155
|
+
var className = _a.className, colorProp = _a.color, props = __rest(_a, ["className", "color"]);
|
|
156
|
+
var contextColor = useAlertDialogContext().color;
|
|
157
|
+
var color = colorProp || contextColor || undefined;
|
|
158
|
+
return (<AlertDialogPrimitive.Action asChild>
|
|
159
|
+
<Button variant="link" color={color} data-slot="alert-dialog-action" className={cn("h-auto p-0", className)} {...props}/>
|
|
160
|
+
</AlertDialogPrimitive.Action>);
|
|
161
|
+
}
|
|
162
|
+
function AlertDialogCancel(_a) {
|
|
163
|
+
var className = _a.className, colorProp = _a.color, props = __rest(_a, ["className", "color"]);
|
|
164
|
+
var contextColor = useAlertDialogContext().color;
|
|
165
|
+
var color = colorProp || contextColor || undefined;
|
|
166
|
+
return (<AlertDialogPrimitive.Cancel asChild>
|
|
167
|
+
<Button variant="link" color={color} data-slot="alert-dialog-cancel" className={cn("h-auto p-0", className)} {...props}/>
|
|
168
|
+
</AlertDialogPrimitive.Cancel>);
|
|
169
|
+
}
|
|
170
|
+
export { AlertDialog, AlertDialogPortal, AlertDialogOverlay, AlertDialogTrigger, AlertDialogContent, AlertDialogHeader, AlertDialogFooter, AlertDialogTitle, AlertDialogDescription, AlertDialogAction, AlertDialogCancel, };
|