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,147 @@
|
|
|
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 SweetAlert color and variant
|
|
19
|
+
var SweetAlertContext = React.createContext({});
|
|
20
|
+
// Hook to access SweetAlert context values
|
|
21
|
+
var useAlertContext = function () { return React.useContext(SweetAlertContext); };
|
|
22
|
+
export var sweetAlertVariants = {
|
|
23
|
+
shadow: {
|
|
24
|
+
none: "shadow-2xl",
|
|
25
|
+
lg: "shadow-lg",
|
|
26
|
+
},
|
|
27
|
+
variant: {
|
|
28
|
+
outline: "",
|
|
29
|
+
fill: "",
|
|
30
|
+
light: "",
|
|
31
|
+
},
|
|
32
|
+
color: {
|
|
33
|
+
blue: "",
|
|
34
|
+
red: "",
|
|
35
|
+
green: "",
|
|
36
|
+
yellow: "",
|
|
37
|
+
indigo: "",
|
|
38
|
+
gray: "",
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
var sweetAlertContentVariants = 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 w-full max-w-md translate-x-[-50%] translate-y-[-50%] duration-200 rounded-lg border-0 p-8 text-center", {
|
|
42
|
+
variants: sweetAlertVariants,
|
|
43
|
+
defaultVariants: {
|
|
44
|
+
shadow: "none",
|
|
45
|
+
variant: "outline",
|
|
46
|
+
color: "blue",
|
|
47
|
+
},
|
|
48
|
+
compoundVariants: [
|
|
49
|
+
// Outline variants (white background)
|
|
50
|
+
{ variant: "outline", class: "bg-white text-gray-950" },
|
|
51
|
+
// Fill variants (colored background with light text)
|
|
52
|
+
{ color: "blue", variant: "fill", class: "bg-blue-600 text-blue-50" },
|
|
53
|
+
{ color: "red", variant: "fill", class: "bg-red-600 text-red-50" },
|
|
54
|
+
{ color: "green", variant: "fill", class: "bg-green-600 text-green-50" },
|
|
55
|
+
{
|
|
56
|
+
color: "yellow",
|
|
57
|
+
variant: "fill",
|
|
58
|
+
class: "bg-yellow-500 text-yellow-50",
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
color: "indigo",
|
|
62
|
+
variant: "fill",
|
|
63
|
+
class: "bg-indigo-600 text-indigo-50",
|
|
64
|
+
},
|
|
65
|
+
{ color: "gray", variant: "fill", class: "bg-gray-600 text-gray-50" },
|
|
66
|
+
// Light variants (light colored background with dark text)
|
|
67
|
+
{ color: "blue", variant: "light", class: "bg-blue-100 text-gray-950" },
|
|
68
|
+
{ color: "red", variant: "light", class: "bg-red-100 text-gray-950" },
|
|
69
|
+
{ color: "green", variant: "light", class: "bg-green-100 text-gray-950" },
|
|
70
|
+
{
|
|
71
|
+
color: "yellow",
|
|
72
|
+
variant: "light",
|
|
73
|
+
class: "bg-yellow-100 text-gray-950",
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
color: "indigo",
|
|
77
|
+
variant: "light",
|
|
78
|
+
class: "bg-indigo-100 text-gray-950",
|
|
79
|
+
},
|
|
80
|
+
{ color: "gray", variant: "light", class: "bg-gray-100 text-gray-950" },
|
|
81
|
+
],
|
|
82
|
+
});
|
|
83
|
+
function SweetAlertRoot(_a) {
|
|
84
|
+
var props = __rest(_a, []);
|
|
85
|
+
return <AlertDialogPrimitive.Root data-slot="sweet-alert" {...props}/>;
|
|
86
|
+
}
|
|
87
|
+
function SweetAlertTrigger(_a) {
|
|
88
|
+
var props = __rest(_a, []);
|
|
89
|
+
return (<AlertDialogPrimitive.Trigger data-slot="sweet-alert-trigger" {...props}/>);
|
|
90
|
+
}
|
|
91
|
+
function SweetAlertContent(_a) {
|
|
92
|
+
var className = _a.className, shadow = _a.shadow, color = _a.color, variant = _a.variant, props = __rest(_a, ["className", "shadow", "color", "variant"]);
|
|
93
|
+
// Provide color and variant to child components through context
|
|
94
|
+
var contextValue = React.useMemo(function () { return ({
|
|
95
|
+
color: color || undefined,
|
|
96
|
+
variant: variant || undefined,
|
|
97
|
+
}); }, [color, variant]);
|
|
98
|
+
return (<SweetAlertContext.Provider value={contextValue}>
|
|
99
|
+
<AlertDialogPrimitive.Portal>
|
|
100
|
+
<AlertDialogPrimitive.Overlay className="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"/>
|
|
101
|
+
<AlertDialogPrimitive.Content data-slot="sweet-alert-content" className={cn(sweetAlertContentVariants({ shadow: shadow, color: color, variant: variant }), "flex flex-col items-center gap-4 text-center", className)} {...props}/>
|
|
102
|
+
</AlertDialogPrimitive.Portal>
|
|
103
|
+
</SweetAlertContext.Provider>);
|
|
104
|
+
}
|
|
105
|
+
function SweetAlertFooter(_a) {
|
|
106
|
+
var className = _a.className, props = __rest(_a, ["className"]);
|
|
107
|
+
return (<div data-slot="sweet-alert-footer" className={cn("flex flex-row justify-center text-lg gap-3 mt-6", className)} {...props}/>);
|
|
108
|
+
}
|
|
109
|
+
function SweetAlertTitle(_a) {
|
|
110
|
+
var className = _a.className, props = __rest(_a, ["className"]);
|
|
111
|
+
return (<AlertDialogPrimitive.Title data-slot="sweet-alert-title" className={cn("font-semibold text-2xl", className)} {...props}/>);
|
|
112
|
+
}
|
|
113
|
+
function SweetAlertDescription(_a) {
|
|
114
|
+
var className = _a.className, props = __rest(_a, ["className"]);
|
|
115
|
+
return (<AlertDialogPrimitive.Description data-slot="sweet-alert-description" className={cn("text-lg", className)} {...props}/>);
|
|
116
|
+
}
|
|
117
|
+
// Helper function to get color based on context and variant
|
|
118
|
+
function getColorWithVariant(colorProp, contextColor, contextVariant) {
|
|
119
|
+
var color = colorProp || contextColor;
|
|
120
|
+
if (!color)
|
|
121
|
+
return undefined;
|
|
122
|
+
return contextVariant === "fill" ? "light-".concat(color) : color;
|
|
123
|
+
}
|
|
124
|
+
function SweetAlertAction(_a) {
|
|
125
|
+
var className = _a.className, colorProp = _a.color, props = __rest(_a, ["className", "color"]);
|
|
126
|
+
var _b = useAlertContext(), contextColor = _b.color, contextVariant = _b.variant;
|
|
127
|
+
var color = getColorWithVariant(colorProp, contextColor, contextVariant);
|
|
128
|
+
return (<AlertDialogPrimitive.Action asChild>
|
|
129
|
+
<Button variant="fill" color={color} data-slot="sweet-alert-action" className={cn(className)} {...props}/>
|
|
130
|
+
</AlertDialogPrimitive.Action>);
|
|
131
|
+
}
|
|
132
|
+
function SweetAlertCancel(_a) {
|
|
133
|
+
var className = _a.className, colorProp = _a.color, props = __rest(_a, ["className", "color"]);
|
|
134
|
+
var _b = useAlertContext(), contextColor = _b.color, contextVariant = _b.variant;
|
|
135
|
+
var color = getColorWithVariant(colorProp, contextColor, contextVariant);
|
|
136
|
+
return (<AlertDialogPrimitive.Cancel asChild>
|
|
137
|
+
<Button variant="outline" color={color} data-slot="sweet-alert-cancel" className={cn(className)} {...props}/>
|
|
138
|
+
</AlertDialogPrimitive.Cancel>);
|
|
139
|
+
}
|
|
140
|
+
function SweetAlertIcon(_a) {
|
|
141
|
+
var _b = _a.size, size = _b === void 0 ? "12xl" : _b, _c = _a.variant, variant = _c === void 0 ? "padded" : _c, colorProp = _a.color, _d = _a.shape, shape = _d === void 0 ? "rounded" : _d, props = __rest(_a, ["size", "variant", "color", "shape"]);
|
|
142
|
+
var _e = useAlertContext(), contextColor = _e.color, contextVariant = _e.variant;
|
|
143
|
+
var color = getColorWithVariant(colorProp, contextColor, contextVariant);
|
|
144
|
+
return (<LUIcon size={size} variant={variant} color={color} shape={shape} {...props}/>);
|
|
145
|
+
}
|
|
146
|
+
export { SweetAlertRoot as SweetAlert, SweetAlertTrigger, SweetAlertContent, SweetAlertFooter, SweetAlertTitle, SweetAlertDescription, SweetAlertAction, SweetAlertCancel, SweetAlertIcon, };
|
|
147
|
+
export default SweetAlertRoot;
|
|
@@ -0,0 +1,505 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import { SweetAlert, SweetAlertAction, SweetAlertCancel, SweetAlertContent, SweetAlertDescription, SweetAlertTitle, SweetAlertTrigger, SweetAlertFooter, SweetAlertIcon, sweetAlertVariants, } from "./SweetAlert";
|
|
3
|
+
import { Button } from "../Button/Button/Button";
|
|
4
|
+
import { Heading } from "../Typography/Heading/heading";
|
|
5
|
+
import { Body } from "../Typography/Body/body";
|
|
6
|
+
import LUIcon from "../Icons/LUIcon";
|
|
7
|
+
// Constants for stories
|
|
8
|
+
var colorOptions = Object.keys(sweetAlertVariants.color);
|
|
9
|
+
var variantOptions = Object.keys(sweetAlertVariants.variant);
|
|
10
|
+
var shadowOptions = Object.keys(sweetAlertVariants.shadow);
|
|
11
|
+
// Helper functions for stories
|
|
12
|
+
var getIconForColor = function (color) {
|
|
13
|
+
switch (color) {
|
|
14
|
+
case "blue":
|
|
15
|
+
return "info";
|
|
16
|
+
case "red":
|
|
17
|
+
return "star";
|
|
18
|
+
case "green":
|
|
19
|
+
return "check";
|
|
20
|
+
case "yellow":
|
|
21
|
+
return "star";
|
|
22
|
+
case "indigo":
|
|
23
|
+
return "bell";
|
|
24
|
+
case "gray":
|
|
25
|
+
return "info";
|
|
26
|
+
default:
|
|
27
|
+
return "info";
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
var getContentForColor = function (color) {
|
|
31
|
+
switch (color) {
|
|
32
|
+
case "blue":
|
|
33
|
+
return {
|
|
34
|
+
title: "Information",
|
|
35
|
+
description: "This is an informational message about your account status.",
|
|
36
|
+
button: "Got it",
|
|
37
|
+
};
|
|
38
|
+
case "red":
|
|
39
|
+
return {
|
|
40
|
+
title: "Warning",
|
|
41
|
+
description: "This action cannot be undone. Please proceed with caution.",
|
|
42
|
+
button: "Delete",
|
|
43
|
+
};
|
|
44
|
+
case "green":
|
|
45
|
+
return {
|
|
46
|
+
title: "Success",
|
|
47
|
+
description: "Your changes have been successfully saved.",
|
|
48
|
+
button: "Continue",
|
|
49
|
+
};
|
|
50
|
+
case "yellow":
|
|
51
|
+
return {
|
|
52
|
+
title: "Alert",
|
|
53
|
+
description: "Please review your information before submitting.",
|
|
54
|
+
button: "Review",
|
|
55
|
+
};
|
|
56
|
+
case "indigo":
|
|
57
|
+
return {
|
|
58
|
+
title: "Notification",
|
|
59
|
+
description: "You have new messages waiting in your inbox.",
|
|
60
|
+
button: "View",
|
|
61
|
+
};
|
|
62
|
+
case "gray":
|
|
63
|
+
return {
|
|
64
|
+
title: "Notice",
|
|
65
|
+
description: "System maintenance is scheduled for tomorrow.",
|
|
66
|
+
button: "Acknowledge",
|
|
67
|
+
};
|
|
68
|
+
default:
|
|
69
|
+
return {
|
|
70
|
+
title: "Information",
|
|
71
|
+
description: "This is an informational alert.",
|
|
72
|
+
button: "OK",
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
// Example configurations for stories
|
|
77
|
+
var realWorldExamples = [
|
|
78
|
+
{
|
|
79
|
+
triggerText: "Delete Account",
|
|
80
|
+
triggerColor: "red",
|
|
81
|
+
shadow: "lg",
|
|
82
|
+
color: "red",
|
|
83
|
+
variant: "fill",
|
|
84
|
+
icon: "star",
|
|
85
|
+
title: "Delete Account?",
|
|
86
|
+
description: "This will permanently delete your account and all associated data. This action cannot be undone.",
|
|
87
|
+
cancelText: "Keep Account",
|
|
88
|
+
actionText: "Delete Forever",
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
triggerText: "Update Available",
|
|
92
|
+
triggerColor: "blue",
|
|
93
|
+
shadow: "none",
|
|
94
|
+
color: "blue",
|
|
95
|
+
variant: "outline",
|
|
96
|
+
icon: "info",
|
|
97
|
+
title: "Update Available",
|
|
98
|
+
description: "A new version is available. Would you like to update now?",
|
|
99
|
+
cancelText: "Later",
|
|
100
|
+
actionText: "Update Now",
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
triggerText: "Payment Success",
|
|
104
|
+
triggerColor: "green",
|
|
105
|
+
shadow: "none",
|
|
106
|
+
color: "green",
|
|
107
|
+
variant: "light",
|
|
108
|
+
icon: "check",
|
|
109
|
+
title: "Payment Successful",
|
|
110
|
+
description: "Your payment has been processed successfully. Thank you for your purchase!",
|
|
111
|
+
cancelText: "Close",
|
|
112
|
+
actionText: "View Receipt",
|
|
113
|
+
},
|
|
114
|
+
];
|
|
115
|
+
export default {
|
|
116
|
+
title: "Components/Alert/SweetAlert",
|
|
117
|
+
component: SweetAlert,
|
|
118
|
+
tags: ["autodocs"],
|
|
119
|
+
parameters: {
|
|
120
|
+
docs: {
|
|
121
|
+
description: {
|
|
122
|
+
component: "SweetAlert is a beautiful replacement for JavaScript's alert. It provides a modal dialog with customizable colors, icons, and action buttons. Now supports both wrapper component pattern and individual composable components like AlertDialog. This component is built using Radix UI's Alert Dialog primitives - for more details on the underlying API, please refer to the [Radix UI Alert Dialog documentation](https://www.radix-ui.com/primitives/docs/components/alert-dialog).",
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
};
|
|
127
|
+
// Reusable SweetAlert component
|
|
128
|
+
var SweetAlertExample = function (_a) {
|
|
129
|
+
var triggerText = _a.triggerText, triggerColor = _a.triggerColor, _b = _a.shadow, shadow = _b === void 0 ? "none" : _b, color = _a.color, _c = _a.variant, variant = _c === void 0 ? "outline" : _c, icon = _a.icon, title = _a.title, description = _a.description, cancelText = _a.cancelText, actionText = _a.actionText, _d = _a.showCancel, showCancel = _d === void 0 ? true : _d, _e = _a.showAction, showAction = _e === void 0 ? true : _e, _f = _a.className, className = _f === void 0 ? "" : _f;
|
|
130
|
+
return (<SweetAlert>
|
|
131
|
+
<SweetAlertTrigger asChild>
|
|
132
|
+
<Button variant="outline" color={triggerColor} className={className}>
|
|
133
|
+
{triggerText}
|
|
134
|
+
</Button>
|
|
135
|
+
</SweetAlertTrigger>
|
|
136
|
+
<SweetAlertContent shadow={shadow} color={color} variant={variant}>
|
|
137
|
+
{icon && <SweetAlertIcon icon={icon}/>}
|
|
138
|
+
<SweetAlertTitle>{title}</SweetAlertTitle>
|
|
139
|
+
<SweetAlertDescription>{description}</SweetAlertDescription>
|
|
140
|
+
<SweetAlertFooter>
|
|
141
|
+
{showCancel && (<SweetAlertCancel>{cancelText || "Cancel"}</SweetAlertCancel>)}
|
|
142
|
+
{showAction && (<SweetAlertAction>{actionText || "OK"}</SweetAlertAction>)}
|
|
143
|
+
</SweetAlertFooter>
|
|
144
|
+
</SweetAlertContent>
|
|
145
|
+
</SweetAlert>);
|
|
146
|
+
};
|
|
147
|
+
// Component with eye icon to show code
|
|
148
|
+
var ColorVariantWithEyeIcon = function (_a) {
|
|
149
|
+
var color = _a.color, _b = _a.variant, variant = _b === void 0 ? "outline" : _b, content = _a.content;
|
|
150
|
+
var _c = useState(false), showCode = _c[0], setShowCode = _c[1];
|
|
151
|
+
var triggerText = color.charAt(0).toUpperCase() + color.slice(1).replace("-", " ");
|
|
152
|
+
var sweetAlertCode = "<SweetAlert>\n <SweetAlertTrigger asChild>\n <Button variant=\"outline\" color=\"".concat(color, "\">\n ").concat(triggerText, "\n </Button>\n </SweetAlertTrigger>\n <SweetAlertContent color=\"").concat(color, "\" variant=\"").concat(variant, "\">\n <SweetAlertIcon icon=\"").concat(getIconForColor(color), "\" />\n <SweetAlertTitle>").concat(content.title, "</SweetAlertTitle>\n <SweetAlertDescription>\n ").concat(content.description, "\n </SweetAlertDescription>\n <SweetAlertFooter>\n <SweetAlertCancel>Cancel</SweetAlertCancel>\n <SweetAlertAction>").concat(content.button, "</SweetAlertAction>\n </SweetAlertFooter>\n </SweetAlertContent>\n</SweetAlert>");
|
|
153
|
+
return (<div className="space-y-2">
|
|
154
|
+
<div className="flex items-center gap-2">
|
|
155
|
+
<div className="flex-1">
|
|
156
|
+
<SweetAlertExample triggerText={triggerText} triggerColor={color} color={color} variant={variant} icon={getIconForColor(color)} title={content.title} description={content.description} cancelText="Cancel" actionText={content.button} className="w-full"/>
|
|
157
|
+
</div>
|
|
158
|
+
<Button onClick={function () { return setShowCode(!showCode); }} variant="ghost" size="sm" title={showCode ? "Hide Code" : "Show Code"} className="text-gray-600 hover:text-gray-800 hover:bg-gray-100">
|
|
159
|
+
<LUIcon icon={showCode ? "eye-slash" : "eye"}/>
|
|
160
|
+
</Button>
|
|
161
|
+
</div>
|
|
162
|
+
|
|
163
|
+
{showCode && (<div className="p-3 bg-gray-50 border rounded-lg">
|
|
164
|
+
<div className="flex items-center justify-between mb-2">
|
|
165
|
+
<Body variant="body-sm" className="font-semibold text-gray-700">
|
|
166
|
+
{triggerText} - SweetAlert Code
|
|
167
|
+
</Body>
|
|
168
|
+
<Button onClick={function () { return navigator.clipboard.writeText(sweetAlertCode); }} variant="ghost" size="sm" title="Copy code to clipboard" className="text-xs text-blue-700 hover:bg-blue-200 bg-blue-100">
|
|
169
|
+
Copy Code
|
|
170
|
+
</Button>
|
|
171
|
+
</div>
|
|
172
|
+
<pre className="text-xs bg-white p-3 rounded border overflow-x-auto">
|
|
173
|
+
<code className="text-gray-800">{sweetAlertCode}</code>
|
|
174
|
+
</pre>
|
|
175
|
+
</div>)}
|
|
176
|
+
</div>);
|
|
177
|
+
};
|
|
178
|
+
// Component with eye icon to show code for all variants of a color
|
|
179
|
+
var ColorVariantsWithEyeIcon = function (_a) {
|
|
180
|
+
var color = _a.color;
|
|
181
|
+
var _b = useState(false), showCode = _b[0], setShowCode = _b[1];
|
|
182
|
+
var colorName = color.charAt(0).toUpperCase() + color.slice(1);
|
|
183
|
+
var variants = [
|
|
184
|
+
"outline",
|
|
185
|
+
"fill",
|
|
186
|
+
"light",
|
|
187
|
+
];
|
|
188
|
+
var generateVariantCode = function (variant) { return "<SweetAlert>\n <SweetAlertTrigger asChild>\n <Button variant=\"outline\" color=\"".concat(color, "\">\n ").concat(color, " - ").concat(variant.charAt(0).toUpperCase() + variant.slice(1), "\n </Button>\n </SweetAlertTrigger>\n <SweetAlertContent color=\"").concat(color, "\" variant=\"").concat(variant, "\">\n <SweetAlertIcon icon=\"").concat(getIconForColor(color), "\" />\n <SweetAlertTitle>").concat(colorName, " Alert</SweetAlertTitle>\n <SweetAlertDescription>\n This is a ").concat(color, " ").concat(variant, " variant alert.\n </SweetAlertDescription>\n <SweetAlertFooter>\n <SweetAlertCancel>Cancel</SweetAlertCancel>\n <SweetAlertAction>OK</SweetAlertAction>\n </SweetAlertFooter>\n </SweetAlertContent>\n</SweetAlert>"); };
|
|
189
|
+
var allVariantsCode = variants
|
|
190
|
+
.map(function (variant) { return generateVariantCode(variant); })
|
|
191
|
+
.join("\n\n");
|
|
192
|
+
return (<div className="space-y-4">
|
|
193
|
+
<div className="flex items-center justify-between">
|
|
194
|
+
<Heading variant="h4" className="font-medium text-gray-700">
|
|
195
|
+
{colorName}
|
|
196
|
+
</Heading>
|
|
197
|
+
<Button onClick={function () { return setShowCode(!showCode); }} variant="ghost" size="sm" title={showCode ? "Hide Code" : "Show Code"} className="text-gray-600 hover:text-gray-800 hover:bg-gray-100">
|
|
198
|
+
<LUIcon icon={showCode ? "eye-slash" : "eye"}/>
|
|
199
|
+
</Button>
|
|
200
|
+
</div>
|
|
201
|
+
|
|
202
|
+
<div className="flex flex-col gap-2">
|
|
203
|
+
{variants.map(function (variant) { return (<SweetAlertExample key={variant} triggerText={"".concat(color, " - ").concat(variant.charAt(0).toUpperCase() + variant.slice(1))} triggerColor={color} color={color} variant={variant} icon={getIconForColor(color)} title={"".concat(colorName, " Alert")} description={"This is a ".concat(color, " ").concat(variant, " variant alert.")} showCancel={true} showAction={true} cancelText="Cancel" actionText="OK"/>); })}
|
|
204
|
+
</div>
|
|
205
|
+
|
|
206
|
+
{showCode && (<div className="p-3 bg-gray-50 border rounded-lg">
|
|
207
|
+
<div className="flex items-center justify-between mb-2">
|
|
208
|
+
<Body variant="body-sm" className="font-semibold text-gray-700">
|
|
209
|
+
{colorName} - All Variants Code
|
|
210
|
+
</Body>
|
|
211
|
+
<Button onClick={function () { return navigator.clipboard.writeText(allVariantsCode); }} variant="ghost" size="sm" title="Copy code to clipboard" className="text-xs text-blue-700 hover:bg-blue-200 bg-blue-100">
|
|
212
|
+
Copy Code
|
|
213
|
+
</Button>
|
|
214
|
+
</div>
|
|
215
|
+
<pre className="text-xs bg-white p-3 rounded border overflow-x-auto">
|
|
216
|
+
<code className="text-gray-800">{allVariantsCode}</code>
|
|
217
|
+
</pre>
|
|
218
|
+
</div>)}
|
|
219
|
+
</div>);
|
|
220
|
+
};
|
|
221
|
+
// Template for stories with args
|
|
222
|
+
var Template = function (args) { return (<SweetAlert>
|
|
223
|
+
<SweetAlertTrigger asChild>
|
|
224
|
+
<Button variant="outline" color="blue">
|
|
225
|
+
Show Sweet Alert
|
|
226
|
+
</Button>
|
|
227
|
+
</SweetAlertTrigger>
|
|
228
|
+
<SweetAlertContent shadow={args.shadow} color={args.color} variant={args.variant}>
|
|
229
|
+
{args.icon && <SweetAlertIcon icon={args.icon}/>}
|
|
230
|
+
<SweetAlertTitle>{args.title}</SweetAlertTitle>
|
|
231
|
+
<SweetAlertDescription>{args.description}</SweetAlertDescription>
|
|
232
|
+
<SweetAlertFooter>
|
|
233
|
+
<SweetAlertCancel>{args.cancelText}</SweetAlertCancel>
|
|
234
|
+
<SweetAlertAction>{args.actionText}</SweetAlertAction>
|
|
235
|
+
</SweetAlertFooter>
|
|
236
|
+
</SweetAlertContent>
|
|
237
|
+
</SweetAlert>); };
|
|
238
|
+
// Default story with all controls
|
|
239
|
+
export var Default = Template.bind({});
|
|
240
|
+
Default.args = {
|
|
241
|
+
shadow: "none",
|
|
242
|
+
color: "blue",
|
|
243
|
+
variant: "outline",
|
|
244
|
+
icon: "info",
|
|
245
|
+
title: "Update Available",
|
|
246
|
+
description: "A new version of the application is available. Would you like to update now? The update includes bug fixes and performance improvements.",
|
|
247
|
+
cancelText: "Later",
|
|
248
|
+
actionText: "Update Now",
|
|
249
|
+
};
|
|
250
|
+
Default.argTypes = {
|
|
251
|
+
shadow: {
|
|
252
|
+
control: { type: "select" },
|
|
253
|
+
options: shadowOptions,
|
|
254
|
+
description: "Shadow variant for SweetAlertContent",
|
|
255
|
+
table: {
|
|
256
|
+
defaultValue: { summary: "none" },
|
|
257
|
+
type: { summary: "enum" },
|
|
258
|
+
category: "SweetAlertContent",
|
|
259
|
+
},
|
|
260
|
+
},
|
|
261
|
+
color: {
|
|
262
|
+
control: { type: "select" },
|
|
263
|
+
options: colorOptions,
|
|
264
|
+
description: "Color theme for SweetAlertContent",
|
|
265
|
+
table: {
|
|
266
|
+
defaultValue: { summary: "blue" },
|
|
267
|
+
type: { summary: "enum" },
|
|
268
|
+
category: "SweetAlertContent",
|
|
269
|
+
},
|
|
270
|
+
},
|
|
271
|
+
variant: {
|
|
272
|
+
control: { type: "select" },
|
|
273
|
+
options: variantOptions,
|
|
274
|
+
description: "Variant for SweetAlertContent (outline | fill | light)",
|
|
275
|
+
table: {
|
|
276
|
+
defaultValue: { summary: "outline" },
|
|
277
|
+
type: { summary: "enum" },
|
|
278
|
+
category: "SweetAlertContent",
|
|
279
|
+
},
|
|
280
|
+
},
|
|
281
|
+
icon: {
|
|
282
|
+
control: { type: "text" },
|
|
283
|
+
description: "Icon to display (LUIcon name)",
|
|
284
|
+
table: {
|
|
285
|
+
type: { summary: "string" },
|
|
286
|
+
category: "SweetAlertIcon",
|
|
287
|
+
},
|
|
288
|
+
},
|
|
289
|
+
title: {
|
|
290
|
+
control: { type: "text" },
|
|
291
|
+
description: "Title text for SweetAlertTitle",
|
|
292
|
+
table: {
|
|
293
|
+
type: { summary: "string" },
|
|
294
|
+
category: "SweetAlertTitle",
|
|
295
|
+
},
|
|
296
|
+
},
|
|
297
|
+
description: {
|
|
298
|
+
control: { type: "text" },
|
|
299
|
+
description: "Description text for SweetAlertDescription",
|
|
300
|
+
table: {
|
|
301
|
+
type: { summary: "string" },
|
|
302
|
+
category: "SweetAlertDescription",
|
|
303
|
+
},
|
|
304
|
+
},
|
|
305
|
+
cancelText: {
|
|
306
|
+
control: { type: "text" },
|
|
307
|
+
description: "Text for SweetAlertCancel button",
|
|
308
|
+
table: {
|
|
309
|
+
type: { summary: "string" },
|
|
310
|
+
category: "SweetAlertCancel",
|
|
311
|
+
},
|
|
312
|
+
},
|
|
313
|
+
actionText: {
|
|
314
|
+
control: { type: "text" },
|
|
315
|
+
description: "Text for SweetAlertAction button",
|
|
316
|
+
table: {
|
|
317
|
+
type: { summary: "string" },
|
|
318
|
+
category: "SweetAlertAction",
|
|
319
|
+
},
|
|
320
|
+
},
|
|
321
|
+
};
|
|
322
|
+
// Simple Example showing the exact code structure
|
|
323
|
+
export var Example = function () { return (<SweetAlert>
|
|
324
|
+
<SweetAlertTrigger asChild>
|
|
325
|
+
<Button variant="outline" color="blue">
|
|
326
|
+
Show Sweet Alert
|
|
327
|
+
</Button>
|
|
328
|
+
</SweetAlertTrigger>
|
|
329
|
+
<SweetAlertContent color="blue" shadow="none">
|
|
330
|
+
<SweetAlertIcon icon="info"/>
|
|
331
|
+
<SweetAlertTitle>Update Available</SweetAlertTitle>
|
|
332
|
+
<SweetAlertDescription>
|
|
333
|
+
A new version of the application is available. Would you like to update
|
|
334
|
+
now? The update includes bug fixes and performance improvements.
|
|
335
|
+
</SweetAlertDescription>
|
|
336
|
+
<SweetAlertFooter>
|
|
337
|
+
<SweetAlertCancel>Later</SweetAlertCancel>
|
|
338
|
+
<SweetAlertAction>Update Now</SweetAlertAction>
|
|
339
|
+
</SweetAlertFooter>
|
|
340
|
+
</SweetAlertContent>
|
|
341
|
+
</SweetAlert>); };
|
|
342
|
+
Example.parameters = {
|
|
343
|
+
docs: {
|
|
344
|
+
description: {
|
|
345
|
+
story: "This example shows the exact code structure you should use to implement the SweetAlert component. SweetAlert is built on top of Radix UI Alert Dialog primitives, offering the same accessibility features and API while adding our custom styling and behavior.",
|
|
346
|
+
},
|
|
347
|
+
},
|
|
348
|
+
};
|
|
349
|
+
// Basic Example - Shows the actual component code
|
|
350
|
+
export var BasicExample = function () { return (<SweetAlert>
|
|
351
|
+
<SweetAlertTrigger asChild>
|
|
352
|
+
<Button variant="outline" color="blue">
|
|
353
|
+
Show Basic Alert
|
|
354
|
+
</Button>
|
|
355
|
+
</SweetAlertTrigger>
|
|
356
|
+
<SweetAlertContent color="blue" shadow="none">
|
|
357
|
+
<SweetAlertIcon icon="info"/>
|
|
358
|
+
<SweetAlertTitle>Update Available</SweetAlertTitle>
|
|
359
|
+
<SweetAlertDescription>
|
|
360
|
+
A new version of the application is available. Would you like to update
|
|
361
|
+
now? The update includes bug fixes and performance improvements.
|
|
362
|
+
</SweetAlertDescription>
|
|
363
|
+
<SweetAlertFooter>
|
|
364
|
+
<SweetAlertCancel>Later</SweetAlertCancel>
|
|
365
|
+
<SweetAlertAction>Update Now</SweetAlertAction>
|
|
366
|
+
</SweetAlertFooter>
|
|
367
|
+
</SweetAlertContent>
|
|
368
|
+
</SweetAlert>); };
|
|
369
|
+
BasicExample.parameters = {
|
|
370
|
+
docs: {
|
|
371
|
+
description: {
|
|
372
|
+
story: "Basic SweetAlert example showing the actual component structure.",
|
|
373
|
+
},
|
|
374
|
+
},
|
|
375
|
+
};
|
|
376
|
+
export var AllColors = function () { return (<div className="flex flex-col gap-8">
|
|
377
|
+
<Heading variant="h3" className="text-lg font-semibold">
|
|
378
|
+
All Color Variants
|
|
379
|
+
</Heading>
|
|
380
|
+
<Body variant="body-sm" className="text-gray-600">
|
|
381
|
+
Click the eye icon (👁️) to view the code for each color variant
|
|
382
|
+
</Body>
|
|
383
|
+
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
|
|
384
|
+
{colorOptions.map(function (color) {
|
|
385
|
+
var content = getContentForColor(color);
|
|
386
|
+
return (<ColorVariantWithEyeIcon key={color} color={color} content={content}/>);
|
|
387
|
+
})}
|
|
388
|
+
</div>
|
|
389
|
+
</div>); };
|
|
390
|
+
AllColors.parameters = {
|
|
391
|
+
docs: {
|
|
392
|
+
source: {
|
|
393
|
+
code: null, // This hides the source code
|
|
394
|
+
},
|
|
395
|
+
},
|
|
396
|
+
};
|
|
397
|
+
export var ColorVariants = function () { return (<div className="flex flex-col gap-8">
|
|
398
|
+
<Heading variant="h3" className="text-lg font-semibold">
|
|
399
|
+
Color Variant Examples
|
|
400
|
+
</Heading>
|
|
401
|
+
<Body variant="body-sm" className="text-gray-600">
|
|
402
|
+
Click the eye icon (👁️) to view the code for each color variant
|
|
403
|
+
</Body>
|
|
404
|
+
<div className="grid grid-cols-1 md:grid-cols-3 gap-4">
|
|
405
|
+
{colorOptions.map(function (color) { return (<ColorVariantsWithEyeIcon key={color} color={color}/>); })}
|
|
406
|
+
</div>
|
|
407
|
+
</div>); };
|
|
408
|
+
ColorVariants.parameters = {
|
|
409
|
+
docs: {
|
|
410
|
+
source: {
|
|
411
|
+
code: null, // This hides the source code
|
|
412
|
+
},
|
|
413
|
+
},
|
|
414
|
+
};
|
|
415
|
+
export var RealWorldExamples = function () { return (<div className="flex flex-col gap-8">
|
|
416
|
+
<Heading variant="h3" className="text-lg font-semibold">
|
|
417
|
+
Real-world Use Cases
|
|
418
|
+
</Heading>
|
|
419
|
+
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
|
|
420
|
+
{realWorldExamples.map(function (example, index) { return (<SweetAlertExample key={index} triggerText={example.triggerText} triggerColor={example.triggerColor} shadow={example.shadow} color={example.color} variant={example.variant} icon={example.icon} title={example.title} description={example.description} cancelText={example.cancelText} actionText={example.actionText} className="w-full"/>); })}
|
|
421
|
+
</div>
|
|
422
|
+
</div>); };
|
|
423
|
+
RealWorldExamples.parameters = {
|
|
424
|
+
docs: {
|
|
425
|
+
source: {
|
|
426
|
+
code: null, // This hides the source code
|
|
427
|
+
},
|
|
428
|
+
},
|
|
429
|
+
};
|
|
430
|
+
// Button Configuration Variants - Comprehensive Examples
|
|
431
|
+
export var ButtonVariants = function () { return (<div className="flex flex-col gap-8">
|
|
432
|
+
<Heading variant="h3" className="text-lg font-semibold">
|
|
433
|
+
Button Configuration Variants
|
|
434
|
+
</Heading>
|
|
435
|
+
|
|
436
|
+
{/* Single Button Examples */}
|
|
437
|
+
<div className="space-y-4">
|
|
438
|
+
<Heading variant="h4" className="font-medium text-gray-700">
|
|
439
|
+
Single Button (Action Only)
|
|
440
|
+
</Heading>
|
|
441
|
+
<div className="flex flex-wrap gap-4">
|
|
442
|
+
<SweetAlertExample triggerText="Success Message" triggerColor="light-green" color="green" icon="check" title="Message Sent" description="Your message has been delivered successfully to all recipients." showCancel={false} actionText="Close"/>
|
|
443
|
+
|
|
444
|
+
<SweetAlertExample triggerText="Error Alert" triggerColor="light-red" shadow="lg" color="red" icon="star" title="Connection Failed" description="Unable to connect to the server. Please check your internet connection and try again." showCancel={false} actionText="Retry"/>
|
|
445
|
+
|
|
446
|
+
<SweetAlertExample triggerText="Installation Complete" triggerColor="blue" color="green" icon="check" title="Installation Complete" description="The application has been successfully installed on your device. You can now start using all the features." showCancel={false} actionText="Start Using App"/>
|
|
447
|
+
</div>
|
|
448
|
+
</div>
|
|
449
|
+
|
|
450
|
+
{/* Both Buttons Examples */}
|
|
451
|
+
<div className="space-y-4">
|
|
452
|
+
<Heading variant="h4" className="font-medium text-gray-700">
|
|
453
|
+
Both Buttons (Cancel + Action)
|
|
454
|
+
</Heading>
|
|
455
|
+
<div className="flex flex-wrap gap-4">
|
|
456
|
+
<SweetAlertExample triggerText="Confirm Action" triggerColor="blue" color="blue" icon="info" title="Confirm Your Action" description="Do you want to proceed with this action? This will update your settings and preferences." cancelText="No, Cancel" actionText="Yes, Proceed"/>
|
|
457
|
+
|
|
458
|
+
<SweetAlertExample triggerText="Delete Confirmation" triggerColor="light-red" color="red" icon="star" title="Confirm Deletion" description="Are you sure you want to delete this item? This action cannot be undone." cancelText="Cancel" actionText="Delete"/>
|
|
459
|
+
|
|
460
|
+
<SweetAlertExample triggerText="Save Changes" triggerColor="blue" color="blue" title="Save Draft" description="You have unsaved changes in your document. Would you like to save them as a draft before leaving?" cancelText="Discard Changes" actionText="Save Draft"/>
|
|
461
|
+
</div>
|
|
462
|
+
</div>
|
|
463
|
+
</div>); };
|
|
464
|
+
ButtonVariants.parameters = {
|
|
465
|
+
docs: {
|
|
466
|
+
source: {
|
|
467
|
+
code: null, // This hides the source code
|
|
468
|
+
},
|
|
469
|
+
},
|
|
470
|
+
};
|
|
471
|
+
// Story showing how to customize the SweetAlert
|
|
472
|
+
export var CustomizeAlert = function () { return (<SweetAlert>
|
|
473
|
+
<SweetAlertTrigger asChild>
|
|
474
|
+
<Button variant="outline" color="blue">
|
|
475
|
+
Customize Alert
|
|
476
|
+
</Button>
|
|
477
|
+
</SweetAlertTrigger>
|
|
478
|
+
<SweetAlertContent color="red" shadow="lg" variant="fill">
|
|
479
|
+
<SweetAlertIcon icon="info"/>
|
|
480
|
+
<SweetAlertTitle>
|
|
481
|
+
<Heading variant="h1-700">Customize Alert Title</Heading>
|
|
482
|
+
</SweetAlertTitle>
|
|
483
|
+
<SweetAlertDescription>
|
|
484
|
+
<Body variant="body-xs">
|
|
485
|
+
This SweetAlert uses customized styling with a red background, large
|
|
486
|
+
icon, and custom typography.
|
|
487
|
+
</Body>
|
|
488
|
+
</SweetAlertDescription>
|
|
489
|
+
<SweetAlertFooter>
|
|
490
|
+
<SweetAlertCancel variant="fill" color="light-indigo">
|
|
491
|
+
Close
|
|
492
|
+
</SweetAlertCancel>
|
|
493
|
+
<SweetAlertAction variant="outline" color="light-green">
|
|
494
|
+
OK
|
|
495
|
+
</SweetAlertAction>
|
|
496
|
+
</SweetAlertFooter>
|
|
497
|
+
</SweetAlertContent>
|
|
498
|
+
</SweetAlert>); };
|
|
499
|
+
CustomizeAlert.parameters = {
|
|
500
|
+
docs: {
|
|
501
|
+
description: {
|
|
502
|
+
story: "This example shows how to customize the SweetAlert with custom typography and styling.",
|
|
503
|
+
},
|
|
504
|
+
},
|
|
505
|
+
};
|