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,404 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { BadgeSkeletonSize, HeadingSkeletonSize, InputSkeletonSize, Skeleton, TextSkeletonSize, } from "./skeleton";
|
|
14
|
+
import { avatarSize } from "../Avatar/Avatar";
|
|
15
|
+
import { buttonStyles } from "../Button";
|
|
16
|
+
import { tableBodySize } from "../Table";
|
|
17
|
+
import { comboboxSizes } from "../Dropdown/Combobox";
|
|
18
|
+
import { iconSize as LUIconSizes } from "../Icons";
|
|
19
|
+
import { checkboxSize } from "../Checkbox/checkbox";
|
|
20
|
+
import { size as SwitchSizes } from "../Switch/switch";
|
|
21
|
+
var meta = {
|
|
22
|
+
title: "Components/Skeleton",
|
|
23
|
+
component: Skeleton,
|
|
24
|
+
tags: ["autodocs"],
|
|
25
|
+
parameters: {
|
|
26
|
+
docs: {
|
|
27
|
+
description: {
|
|
28
|
+
component: "A component for displaying loading skeleton placeholders. ",
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
controls: {
|
|
32
|
+
expanded: true,
|
|
33
|
+
sort: "requiredFirst",
|
|
34
|
+
hideNoControlsWarning: true,
|
|
35
|
+
exclude: [],
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
args: {
|
|
39
|
+
className: "",
|
|
40
|
+
variant: "default",
|
|
41
|
+
size: "md",
|
|
42
|
+
isIcon: true,
|
|
43
|
+
},
|
|
44
|
+
argTypes: {
|
|
45
|
+
variant: {
|
|
46
|
+
control: { type: "select" },
|
|
47
|
+
options: [
|
|
48
|
+
"default",
|
|
49
|
+
"button",
|
|
50
|
+
"input",
|
|
51
|
+
"avatar",
|
|
52
|
+
"badge",
|
|
53
|
+
"card",
|
|
54
|
+
"tableRow",
|
|
55
|
+
"checkbox",
|
|
56
|
+
"switch",
|
|
57
|
+
"select",
|
|
58
|
+
"icon",
|
|
59
|
+
"text",
|
|
60
|
+
"heading",
|
|
61
|
+
"image",
|
|
62
|
+
],
|
|
63
|
+
description: "Select the skeleton component variant",
|
|
64
|
+
table: {
|
|
65
|
+
defaultValue: { summary: "default" },
|
|
66
|
+
type: { summary: "enum" },
|
|
67
|
+
category: "Component",
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
size: {
|
|
71
|
+
control: { type: "select" },
|
|
72
|
+
options: Object.keys(avatarSize), // Will be dynamically updated by decorator
|
|
73
|
+
description: "Size for Avatar, Button, Badge, Input, TableRow, Select, Icon, Text, and Heading skeletons (when applicable)",
|
|
74
|
+
table: {
|
|
75
|
+
defaultValue: { summary: "md" },
|
|
76
|
+
type: { summary: "enum" },
|
|
77
|
+
category: "Size",
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
columns: {
|
|
81
|
+
control: { type: "number", min: 1, max: 10 },
|
|
82
|
+
description: "Number of columns for TableRow skeleton",
|
|
83
|
+
table: {
|
|
84
|
+
type: { summary: "number" },
|
|
85
|
+
category: "TableRow",
|
|
86
|
+
},
|
|
87
|
+
if: { arg: "variant", eq: "tableRow" },
|
|
88
|
+
},
|
|
89
|
+
lines: {
|
|
90
|
+
control: { type: "number", min: 1, max: 10 },
|
|
91
|
+
description: "Number of lines for Text skeleton",
|
|
92
|
+
table: {
|
|
93
|
+
type: { summary: "number" },
|
|
94
|
+
category: "Text",
|
|
95
|
+
},
|
|
96
|
+
if: { arg: "variant", eq: "text" },
|
|
97
|
+
},
|
|
98
|
+
aspectRatio: {
|
|
99
|
+
control: { type: "select" },
|
|
100
|
+
options: ["square", "video", "portrait"],
|
|
101
|
+
description: "Aspect ratio for Image skeleton",
|
|
102
|
+
table: {
|
|
103
|
+
type: { summary: '"square" | "video" | "portrait"' },
|
|
104
|
+
category: "Image",
|
|
105
|
+
},
|
|
106
|
+
if: { arg: "variant", eq: "image" },
|
|
107
|
+
},
|
|
108
|
+
isIcon: {
|
|
109
|
+
control: { type: "boolean" },
|
|
110
|
+
description: "Toggle placeholder icon inside Image skeleton",
|
|
111
|
+
table: {
|
|
112
|
+
type: { summary: "boolean" },
|
|
113
|
+
defaultValue: { summary: "true" },
|
|
114
|
+
category: "Image",
|
|
115
|
+
},
|
|
116
|
+
if: { arg: "variant", eq: "image" },
|
|
117
|
+
},
|
|
118
|
+
className: {
|
|
119
|
+
control: "text",
|
|
120
|
+
description: "Custom className to override default sizing",
|
|
121
|
+
table: {
|
|
122
|
+
type: { summary: "string" },
|
|
123
|
+
category: "Styling",
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
decorators: [
|
|
128
|
+
function (Story, context) {
|
|
129
|
+
var currentVariant = context.args.variant;
|
|
130
|
+
var variantsWithSize = [
|
|
131
|
+
"button",
|
|
132
|
+
"avatar",
|
|
133
|
+
"badge",
|
|
134
|
+
"input",
|
|
135
|
+
"tableRow",
|
|
136
|
+
"select",
|
|
137
|
+
"icon",
|
|
138
|
+
"text",
|
|
139
|
+
"heading",
|
|
140
|
+
];
|
|
141
|
+
if (context.argTypes && context.argTypes.size) {
|
|
142
|
+
// Hide size control for variants that don't support it
|
|
143
|
+
if (!variantsWithSize.includes(currentVariant !== null && currentVariant !== void 0 ? currentVariant : "")) {
|
|
144
|
+
context.argTypes.size.table = { disable: true };
|
|
145
|
+
delete context.argTypes.size.control;
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
// Show size control and update options based on variant
|
|
149
|
+
context.argTypes.size.control = { type: "select" };
|
|
150
|
+
context.argTypes.size.table = {
|
|
151
|
+
defaultValue: { summary: "md" },
|
|
152
|
+
type: { summary: "enum" },
|
|
153
|
+
category: "Size",
|
|
154
|
+
};
|
|
155
|
+
// Set default size and options based on variant
|
|
156
|
+
if (currentVariant === "button") {
|
|
157
|
+
context.argTypes.size.options = Object.keys(buttonStyles.size);
|
|
158
|
+
// Set default size if not already set
|
|
159
|
+
if (!context.args.size || context.args.size === "md") {
|
|
160
|
+
context.args.size = "md";
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
else if (currentVariant === "avatar") {
|
|
164
|
+
context.argTypes.size.options = Object.keys(avatarSize);
|
|
165
|
+
if (!context.args.size || context.args.size === "md") {
|
|
166
|
+
context.args.size = "md";
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
else if (currentVariant === "badge") {
|
|
170
|
+
context.argTypes.size.options = Object.keys(BadgeSkeletonSize);
|
|
171
|
+
if (!context.args.size || context.args.size === "md") {
|
|
172
|
+
context.args.size = "md";
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
else if (currentVariant === "switch") {
|
|
176
|
+
context.argTypes.size.options = Object.keys(SwitchSizes);
|
|
177
|
+
if (!context.args.size || context.args.size === "md") {
|
|
178
|
+
context.args.size = "md";
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
else if (currentVariant === "input") {
|
|
182
|
+
context.argTypes.size.options = Object.keys(InputSkeletonSize);
|
|
183
|
+
if (!context.args.size || context.args.size === "md") {
|
|
184
|
+
context.args.size = "lg"; // Input default is lg
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
else if (currentVariant === "tableRow") {
|
|
188
|
+
context.argTypes.size.options = Object.keys(tableBodySize);
|
|
189
|
+
if (!context.args.size || context.args.size === "md") {
|
|
190
|
+
context.args.size = "md";
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
else if (currentVariant === "select") {
|
|
194
|
+
context.argTypes.size.options = Object.keys(comboboxSizes);
|
|
195
|
+
if (!context.args.size || context.args.size === "md") {
|
|
196
|
+
context.args.size = "md";
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
else if (currentVariant === "icon") {
|
|
200
|
+
context.argTypes.size.options = Object.keys(LUIconSizes);
|
|
201
|
+
if (!context.args.size || context.args.size === "md") {
|
|
202
|
+
context.args.size = "md";
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
else if (currentVariant === "text") {
|
|
206
|
+
context.argTypes.size.options = Object.keys(TextSkeletonSize);
|
|
207
|
+
if (!context.args.size || context.args.size === "md") {
|
|
208
|
+
context.args.size = "md";
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
else if (currentVariant === "checkbox") {
|
|
212
|
+
context.argTypes.size.options = Object.keys(checkboxSize);
|
|
213
|
+
if (!context.args.size || context.args.size === "md") {
|
|
214
|
+
context.args.size = "md";
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
else if (currentVariant === "heading") {
|
|
218
|
+
context.argTypes.size.options = Object.keys(HeadingSkeletonSize);
|
|
219
|
+
// Heading has a special default
|
|
220
|
+
if (!context.args.size || context.args.size === "md") {
|
|
221
|
+
context.args.size = "h2";
|
|
222
|
+
}
|
|
223
|
+
context.argTypes.size.table.defaultValue = { summary: "h2" };
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
return _jsx(Story, __assign({}, context));
|
|
228
|
+
},
|
|
229
|
+
],
|
|
230
|
+
};
|
|
231
|
+
export default meta;
|
|
232
|
+
// Default Skeleton
|
|
233
|
+
var Template = function (args) {
|
|
234
|
+
var _a = args.variant, variant = _a === void 0 ? "default" : _a, className = args.className, columns = args.columns, lines = args.lines, aspectRatio = args.aspectRatio, isIcon = args.isIcon;
|
|
235
|
+
// Set appropriate default size based on variant
|
|
236
|
+
// Narrow size type for each variant
|
|
237
|
+
var size = args.size;
|
|
238
|
+
if (!size) {
|
|
239
|
+
if (variant === "heading") {
|
|
240
|
+
size = "h2";
|
|
241
|
+
}
|
|
242
|
+
else {
|
|
243
|
+
size = "md";
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
switch (variant) {
|
|
247
|
+
case "button":
|
|
248
|
+
return (_jsx(Skeleton.Button, { size: size, className: className }));
|
|
249
|
+
case "input":
|
|
250
|
+
return (_jsx(Skeleton.Input, { size: size, className: className }));
|
|
251
|
+
case "avatar":
|
|
252
|
+
return (_jsx(Skeleton.Avatar, { size: size, className: className }));
|
|
253
|
+
case "badge":
|
|
254
|
+
return (_jsx(Skeleton.Badge, { size: size, className: className }));
|
|
255
|
+
case "card":
|
|
256
|
+
return _jsx(Skeleton.Card, { className: className });
|
|
257
|
+
case "tableRow":
|
|
258
|
+
return (_jsx(Skeleton.TableRow, { columns: columns, size: size, className: className }));
|
|
259
|
+
case "checkbox":
|
|
260
|
+
return _jsx(Skeleton.Checkbox, { className: className });
|
|
261
|
+
case "switch":
|
|
262
|
+
return _jsx(Skeleton.Switch, { className: className });
|
|
263
|
+
case "select":
|
|
264
|
+
return (_jsx(Skeleton.Select, { size: size, className: className }));
|
|
265
|
+
case "icon":
|
|
266
|
+
return (_jsx(Skeleton.Icon, { size: size, className: className }));
|
|
267
|
+
case "text":
|
|
268
|
+
return (_jsx(Skeleton.Text, { lines: lines, size: size, className: className }));
|
|
269
|
+
case "heading":
|
|
270
|
+
return (_jsx(Skeleton.Heading, { size: size, className: className }));
|
|
271
|
+
case "image":
|
|
272
|
+
return (_jsx(Skeleton.Image, { aspectRatio: aspectRatio, isIcon: isIcon, className: className }));
|
|
273
|
+
case "default":
|
|
274
|
+
default:
|
|
275
|
+
return _jsx(Skeleton, { className: "w-48 h-48 ".concat(className) });
|
|
276
|
+
}
|
|
277
|
+
};
|
|
278
|
+
export var Default = Template.bind({});
|
|
279
|
+
// Button Skeletons - All Sizes
|
|
280
|
+
export var ButtonSkeletons = function () { return (_jsxs("div", { className: "space-y-6", children: [_jsxs("div", { children: [_jsx("h3", { className: "mb-4 text-lg font-semibold", children: "Button Skeleton Sizes" }), _jsx("div", { className: "flex flex-col gap-4", children: Object.keys(buttonStyles.size).map(function (size) { return (_jsxs("div", { children: [_jsx("p", { className: "mb-2 text-sm font-medium", children: size.toUpperCase() }), _jsx(Skeleton.Button, { size: size })] }, size)); }) })] }), _jsxs("div", { children: [_jsx("h3", { className: "mb-4 text-lg font-semibold", children: "Custom Width" }), _jsx(Skeleton.Button, { className: "w-64" })] })] })); };
|
|
281
|
+
ButtonSkeletons.parameters = {
|
|
282
|
+
docs: {
|
|
283
|
+
description: {
|
|
284
|
+
story: "Button skeleton placeholders in all available sizes (sm, md, lg, xl).",
|
|
285
|
+
},
|
|
286
|
+
},
|
|
287
|
+
};
|
|
288
|
+
// Input Skeletons - All Sizes
|
|
289
|
+
export var InputSkeletons = function () { return (_jsxs("div", { className: "space-y-4", children: [_jsxs("div", { children: [_jsx("p", { className: "mb-2 text-sm font-medium", children: "Small Input" }), _jsx(Skeleton.Input, { size: "sm" })] }), _jsxs("div", { children: [_jsx("p", { className: "mb-2 text-sm font-medium", children: "Medium Input" }), _jsx(Skeleton.Input, { size: "md" })] }), _jsxs("div", { children: [_jsx("p", { className: "mb-2 text-sm font-medium", children: "Large Input (Default)" }), _jsx(Skeleton.Input, { size: "lg" })] }), _jsxs("div", { children: [_jsx("p", { className: "mb-2 text-sm font-medium", children: "Custom Width" }), _jsx(Skeleton.Input, { className: "w-1/2" })] })] })); };
|
|
290
|
+
InputSkeletons.parameters = {
|
|
291
|
+
docs: {
|
|
292
|
+
description: {
|
|
293
|
+
story: "Input skeleton placeholders with size options (sm, md, lg).",
|
|
294
|
+
},
|
|
295
|
+
},
|
|
296
|
+
};
|
|
297
|
+
// Avatar Skeletons - All Sizes
|
|
298
|
+
export var AvatarSkeletons = function () { return (_jsxs("div", { className: "space-y-4", children: [_jsx("div", { className: "flex items-center gap-4 flex-wrap", children: ["4xs", "3xs", "2xs", "xs", "sm", "md", "lg", "xl"].map(function (size) { return (_jsxs("div", { className: "flex flex-col items-center gap-2", children: [_jsx(Skeleton.Avatar, { size: size }), _jsx("span", { className: "text-xs text-gray-500", children: size })] }, size)); }) }), _jsx("div", { className: "flex items-center gap-4 flex-wrap", children: ["2xl", "3xl", "4xl", "5xl", "huge", "massive"].map(function (size) { return (_jsxs("div", { className: "flex flex-col items-center gap-2", children: [_jsx(Skeleton.Avatar, { size: size }), _jsx("span", { className: "text-xs text-gray-500", children: size })] }, size)); }) })] })); };
|
|
299
|
+
AvatarSkeletons.parameters = {
|
|
300
|
+
docs: {
|
|
301
|
+
description: {
|
|
302
|
+
story: "Avatar skeleton placeholders in all available sizes.",
|
|
303
|
+
},
|
|
304
|
+
},
|
|
305
|
+
};
|
|
306
|
+
// Badge Skeletons - All Sizes
|
|
307
|
+
export var BadgeSkeletons = function () { return (_jsxs("div", { className: "space-y-4", children: [_jsxs("div", { children: [_jsx("p", { className: "mb-2 text-sm font-medium", children: "Small Badge" }), _jsx(Skeleton.Badge, { size: "sm" })] }), _jsxs("div", { children: [_jsx("p", { className: "mb-2 text-sm font-medium", children: "Medium Badge (Default)" }), _jsx(Skeleton.Badge, { size: "md" })] }), _jsxs("div", { children: [_jsx("p", { className: "mb-2 text-sm font-medium", children: "Large Badge" }), _jsx(Skeleton.Badge, { size: "lg" })] })] })); };
|
|
308
|
+
BadgeSkeletons.parameters = {
|
|
309
|
+
docs: {
|
|
310
|
+
description: {
|
|
311
|
+
story: "Badge skeleton placeholders with size options (sm, md, lg).",
|
|
312
|
+
},
|
|
313
|
+
},
|
|
314
|
+
};
|
|
315
|
+
// Card Skeleton
|
|
316
|
+
export var CardSkeleton = function () { return (_jsxs("div", { className: "space-y-4", children: [_jsxs("div", { children: [_jsx("p", { className: "mb-2 text-sm font-medium", children: "Default Card Skeleton" }), _jsx(Skeleton.Card, {})] }), _jsxs("div", { children: [_jsx("p", { className: "mb-2 text-sm font-medium", children: "Custom Height" }), _jsx(Skeleton.Card, { className: "h-64" })] })] })); };
|
|
317
|
+
CardSkeleton.parameters = {
|
|
318
|
+
docs: {
|
|
319
|
+
description: {
|
|
320
|
+
story: "Card skeleton placeholder for card components.",
|
|
321
|
+
},
|
|
322
|
+
},
|
|
323
|
+
};
|
|
324
|
+
// Table Row Skeletons
|
|
325
|
+
export var TableRowSkeletons = function () { return (_jsxs("div", { className: "space-y-6", children: [_jsxs("div", { children: [_jsx("p", { className: "mb-2 text-sm font-medium", children: "3 Columns - Small" }), _jsx(Skeleton.TableRow, { columns: 3, size: "sm" })] }), _jsxs("div", { children: [_jsx("p", { className: "mb-2 text-sm font-medium", children: "4 Columns - Medium" }), _jsx(Skeleton.TableRow, { columns: 4, size: "md" })] }), _jsxs("div", { children: [_jsx("p", { className: "mb-2 text-sm font-medium", children: "5 Columns - Large" }), _jsx(Skeleton.TableRow, { columns: 5, size: "lg" })] }), _jsxs("div", { children: [_jsx("p", { className: "mb-2 text-sm font-medium", children: "Full Table Example" }), _jsxs("div", { className: "space-y-2", children: [_jsx(Skeleton.TableRow, { columns: 4, size: "md" }), _jsx(Skeleton.TableRow, { columns: 4, size: "md" }), _jsx(Skeleton.TableRow, { columns: 4, size: "md" })] })] })] })); };
|
|
326
|
+
TableRowSkeletons.parameters = {
|
|
327
|
+
docs: {
|
|
328
|
+
description: {
|
|
329
|
+
story: "Table row skeleton with customizable columns and sizes. Perfect for table loading states.",
|
|
330
|
+
},
|
|
331
|
+
},
|
|
332
|
+
};
|
|
333
|
+
// Form Elements Skeletons
|
|
334
|
+
export var FormElementsSkeletons = function () { return (_jsxs("div", { className: "space-y-6", children: [_jsxs("div", { children: [_jsx("h3", { className: "mb-4 text-lg font-semibold", children: "Checkbox" }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Skeleton.Checkbox, {}), _jsx(Skeleton, { className: "h-4 w-24" })] })] }), _jsxs("div", { children: [_jsx("h3", { className: "mb-4 text-lg font-semibold", children: "Switch" }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Skeleton.Switch, {}), _jsx(Skeleton, { className: "h-4 w-32" })] })] }), _jsxs("div", { children: [_jsx("h3", { className: "mb-4 text-lg font-semibold", children: "Select/Dropdown" }), _jsxs("div", { className: "space-y-2", children: [_jsx(Skeleton.Select, { size: "sm" }), _jsx(Skeleton.Select, { size: "md" }), _jsx(Skeleton.Select, { size: "lg" })] })] })] })); };
|
|
335
|
+
FormElementsSkeletons.parameters = {
|
|
336
|
+
docs: {
|
|
337
|
+
description: {
|
|
338
|
+
story: "Skeleton loaders for form elements like checkbox, switch, and select.",
|
|
339
|
+
},
|
|
340
|
+
},
|
|
341
|
+
};
|
|
342
|
+
// Icon Skeletons
|
|
343
|
+
export var IconSkeletons = function () { return (_jsx("div", { className: "space-y-4", children: _jsxs("div", { className: "flex items-center gap-4", children: [_jsxs("div", { className: "flex flex-col items-center gap-2", children: [_jsx(Skeleton.Icon, { size: "sm" }), _jsx("span", { className: "text-xs text-gray-500", children: "Small" })] }), _jsxs("div", { className: "flex flex-col items-center gap-2", children: [_jsx(Skeleton.Icon, { size: "md" }), _jsx("span", { className: "text-xs text-gray-500", children: "Medium" })] }), _jsxs("div", { className: "flex flex-col items-center gap-2", children: [_jsx(Skeleton.Icon, { size: "lg" }), _jsx("span", { className: "text-xs text-gray-500", children: "Large" })] }), _jsxs("div", { className: "flex flex-col items-center gap-2", children: [_jsx(Skeleton.Icon, { size: "xl" }), _jsx("span", { className: "text-xs text-gray-500", children: "XLarge" })] })] }) })); };
|
|
344
|
+
IconSkeletons.parameters = {
|
|
345
|
+
docs: {
|
|
346
|
+
description: {
|
|
347
|
+
story: "Icon skeleton placeholders in different sizes (sm, md, lg, xl).",
|
|
348
|
+
},
|
|
349
|
+
},
|
|
350
|
+
};
|
|
351
|
+
// Text Skeletons
|
|
352
|
+
export var TextSkeletons = function () { return (_jsxs("div", { className: "space-y-6", children: [_jsxs("div", { children: [_jsx("h3", { className: "mb-4 text-lg font-semibold", children: "Text Sizes" }), _jsxs("div", { className: "space-y-4", children: [_jsxs("div", { children: [_jsx("p", { className: "mb-2 text-sm font-medium", children: "Extra Small (xs)" }), _jsx(Skeleton.Text, { lines: 1, size: "xs" })] }), _jsxs("div", { children: [_jsx("p", { className: "mb-2 text-sm font-medium", children: "Small (sm)" }), _jsx(Skeleton.Text, { lines: 1, size: "sm" })] }), _jsxs("div", { children: [_jsx("p", { className: "mb-2 text-sm font-medium", children: "Medium (md) - Default" }), _jsx(Skeleton.Text, { lines: 1, size: "md" })] }), _jsxs("div", { children: [_jsx("p", { className: "mb-2 text-sm font-medium", children: "Large (lg)" }), _jsx(Skeleton.Text, { lines: 1, size: "lg" })] }), _jsxs("div", { children: [_jsx("p", { className: "mb-2 text-sm font-medium", children: "Extra Large (xl)" }), _jsx(Skeleton.Text, { lines: 1, size: "xl" })] })] })] }), _jsxs("div", { children: [_jsx("h3", { className: "mb-4 text-lg font-semibold", children: "Multi-line Text" }), _jsxs("div", { className: "space-y-4", children: [_jsxs("div", { children: [_jsx("p", { className: "mb-2 text-sm font-medium", children: "Two Lines" }), _jsx(Skeleton.Text, { lines: 2 })] }), _jsxs("div", { children: [_jsx("p", { className: "mb-2 text-sm font-medium", children: "Three Lines" }), _jsx(Skeleton.Text, { lines: 3 })] }), _jsxs("div", { children: [_jsx("p", { className: "mb-2 text-sm font-medium", children: "Five Lines" }), _jsx(Skeleton.Text, { lines: 5 })] })] })] })] })); };
|
|
353
|
+
TextSkeletons.parameters = {
|
|
354
|
+
docs: {
|
|
355
|
+
description: {
|
|
356
|
+
story: "Text skeleton placeholders with multiple size options (xs, sm, md, lg, xl) and multi-line support. The last line is automatically 75% width for multi-line text.",
|
|
357
|
+
},
|
|
358
|
+
},
|
|
359
|
+
};
|
|
360
|
+
// Heading Skeletons
|
|
361
|
+
export var HeadingSkeletons = function () { return (_jsx("div", { className: "space-y-6", children: _jsxs("div", { children: [_jsx("h3", { className: "mb-4 text-lg font-semibold", children: "Heading Sizes" }), _jsxs("div", { className: "space-y-4", children: [_jsxs("div", { children: [_jsx("p", { className: "mb-2 text-sm font-medium", children: "H1 - Largest" }), _jsx(Skeleton.Heading, { size: "h1" })] }), _jsxs("div", { children: [_jsx("p", { className: "mb-2 text-sm font-medium", children: "H2 - Default" }), _jsx(Skeleton.Heading, { size: "h2" })] }), _jsxs("div", { children: [_jsx("p", { className: "mb-2 text-sm font-medium", children: "H3" }), _jsx(Skeleton.Heading, { size: "h3" })] }), _jsxs("div", { children: [_jsx("p", { className: "mb-2 text-sm font-medium", children: "H4" }), _jsx(Skeleton.Heading, { size: "h4" })] }), _jsxs("div", { children: [_jsx("p", { className: "mb-2 text-sm font-medium", children: "H5" }), _jsx(Skeleton.Heading, { size: "h5" })] }), _jsxs("div", { children: [_jsx("p", { className: "mb-2 text-sm font-medium", children: "H6 - Smallest" }), _jsx(Skeleton.Heading, { size: "h6" })] })] })] }) })); };
|
|
362
|
+
HeadingSkeletons.parameters = {
|
|
363
|
+
docs: {
|
|
364
|
+
description: {
|
|
365
|
+
story: "Heading skeleton placeholders with all heading sizes (h1 through h6). Default width is 75% but can be customized with className.",
|
|
366
|
+
},
|
|
367
|
+
},
|
|
368
|
+
};
|
|
369
|
+
// Image Skeletons
|
|
370
|
+
export var ImageSkeletons = function () { return (_jsxs("div", { className: "space-y-6", children: [_jsxs("div", { children: [_jsx("p", { className: "mb-2 text-sm font-medium", children: "Square Aspect Ratio" }), _jsx("div", { className: "w-64", children: _jsx(Skeleton.Image, { aspectRatio: "square" }) })] }), _jsxs("div", { children: [_jsx("p", { className: "mb-2 text-sm font-medium", children: "Video Aspect Ratio (16:9)" }), _jsx("div", { className: "w-64", children: _jsx(Skeleton.Image, { aspectRatio: "video" }) })] }), _jsxs("div", { children: [_jsx("p", { className: "mb-2 text-sm font-medium", children: "Portrait Aspect Ratio (3:4)" }), _jsx("div", { className: "w-48", children: _jsx(Skeleton.Image, { aspectRatio: "portrait" }) })] }), _jsxs("div", { children: [_jsx("p", { className: "mb-2 text-sm font-medium", children: "Icon Scale Variations" }), _jsxs("div", { className: "flex gap-6 flex-wrap", children: [_jsxs("div", { className: "w-40", children: [_jsx("p", { className: "text-xs mb-1", children: "Scale: sm" }), _jsx(Skeleton.Image, { aspectRatio: "square" })] }), _jsxs("div", { className: "w-40", children: [_jsx("p", { className: "text-xs mb-1", children: "Scale: md" }), _jsx(Skeleton.Image, { aspectRatio: "square" })] }), _jsxs("div", { className: "w-40", children: [_jsx("p", { className: "text-xs mb-1", children: "Scale: lg" }), _jsx(Skeleton.Image, { aspectRatio: "square" })] }), _jsxs("div", { className: "w-40", children: [_jsx("p", { className: "text-xs mb-1", children: "Scale: auto (responsive)" }), _jsx(Skeleton.Image, { aspectRatio: "square" })] })] })] })] })); };
|
|
371
|
+
ImageSkeletons.parameters = {
|
|
372
|
+
docs: {
|
|
373
|
+
description: {
|
|
374
|
+
story: "Image skeleton placeholders with different aspect ratio options (square, video, portrait).",
|
|
375
|
+
},
|
|
376
|
+
},
|
|
377
|
+
};
|
|
378
|
+
// Complete Card Example
|
|
379
|
+
export var CompleteCardExample = function () { return (_jsxs("div", { className: "w-80 rounded-lg border p-6", children: [_jsxs("div", { className: "flex items-center gap-4 mb-4", children: [_jsx(Skeleton.Avatar, { size: "lg" }), _jsxs("div", { className: "flex-1 space-y-2", children: [_jsx(Skeleton, { className: "h-4 w-3/4" }), _jsx(Skeleton, { className: "h-3 w-1/2" })] })] }), _jsx("div", { className: "space-y-2 mb-4", children: _jsx(Skeleton.Text, { lines: 3 }) }), _jsxs("div", { className: "flex gap-2", children: [_jsx(Skeleton.Button, { size: "md", className: "flex-1" }), _jsx(Skeleton.Button, { size: "md", className: "flex-1" })] })] })); };
|
|
380
|
+
CompleteCardExample.parameters = {
|
|
381
|
+
docs: {
|
|
382
|
+
description: {
|
|
383
|
+
story: "A complete card loading state example using multiple skeleton components.",
|
|
384
|
+
},
|
|
385
|
+
},
|
|
386
|
+
};
|
|
387
|
+
// Complete Form Example
|
|
388
|
+
export var CompleteFormExample = function () { return (_jsxs("div", { className: "w-96 space-y-4", children: [_jsxs("div", { children: [_jsx(Skeleton, { className: "h-4 w-20 mb-2" }), _jsx(Skeleton.Input, { size: "lg" })] }), _jsxs("div", { children: [_jsx(Skeleton, { className: "h-4 w-24 mb-2" }), _jsx(Skeleton.Input, { size: "lg" })] }), _jsxs("div", { children: [_jsx(Skeleton, { className: "h-4 w-32 mb-2" }), _jsx(Skeleton.Select, { size: "md" })] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Skeleton.Checkbox, {}), _jsx(Skeleton, { className: "h-4 w-40" })] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Skeleton.Switch, {}), _jsx(Skeleton, { className: "h-4 w-36" })] }), _jsx(Skeleton.Button, { size: "lg", className: "w-full" })] })); };
|
|
389
|
+
CompleteFormExample.parameters = {
|
|
390
|
+
docs: {
|
|
391
|
+
description: {
|
|
392
|
+
story: "A complete form loading state example with various input types.",
|
|
393
|
+
},
|
|
394
|
+
},
|
|
395
|
+
};
|
|
396
|
+
// All Variants Together
|
|
397
|
+
export var AllVariants = function () { return (_jsxs("div", { className: "space-y-8", children: [_jsxs("div", { children: [_jsx("h3", { className: "mb-4 text-lg font-semibold", children: "Buttons" }), _jsxs("div", { className: "flex gap-4", children: [_jsx(Skeleton.Button, { size: "sm" }), _jsx(Skeleton.Button, { size: "md" }), _jsx(Skeleton.Button, { size: "lg" })] })] }), _jsxs("div", { children: [_jsx("h3", { className: "mb-4 text-lg font-semibold", children: "Inputs & Selects" }), _jsxs("div", { className: "space-y-2 max-w-md", children: [_jsx(Skeleton.Input, { size: "sm" }), _jsx(Skeleton.Input, { size: "md" }), _jsx(Skeleton.Select, { size: "lg" })] })] }), _jsxs("div", { children: [_jsx("h3", { className: "mb-4 text-lg font-semibold", children: "Avatars" }), _jsxs("div", { className: "flex gap-4 items-center", children: [_jsx(Skeleton.Avatar, { size: "sm" }), _jsx(Skeleton.Avatar, { size: "md" }), _jsx(Skeleton.Avatar, { size: "lg" }), _jsx(Skeleton.Avatar, { size: "xl" })] })] }), _jsxs("div", { children: [_jsx("h3", { className: "mb-4 text-lg font-semibold", children: "Badges" }), _jsxs("div", { className: "flex gap-4 items-center", children: [_jsx(Skeleton.Badge, { size: "sm" }), _jsx(Skeleton.Badge, { size: "md" }), _jsx(Skeleton.Badge, { size: "lg" })] })] }), _jsxs("div", { children: [_jsx("h3", { className: "mb-4 text-lg font-semibold", children: "Form Controls" }), _jsxs("div", { className: "flex gap-4 items-center", children: [_jsx(Skeleton.Checkbox, {}), _jsx(Skeleton.Switch, {}), _jsx(Skeleton.Icon, { size: "md" })] })] }), _jsxs("div", { children: [_jsx("h3", { className: "mb-4 text-lg font-semibold", children: "Text" }), _jsx("div", { className: "max-w-md", children: _jsx(Skeleton.Text, { lines: 3 }) })] }), _jsxs("div", { children: [_jsx("h3", { className: "mb-4 text-lg font-semibold", children: "Images" }), _jsxs("div", { className: "flex gap-4", children: [_jsx("div", { className: "w-32", children: _jsx(Skeleton.Image, { aspectRatio: "square" }) }), _jsx("div", { className: "w-48", children: _jsx(Skeleton.Image, { aspectRatio: "video" }) })] })] })] })); };
|
|
398
|
+
AllVariants.parameters = {
|
|
399
|
+
docs: {
|
|
400
|
+
description: {
|
|
401
|
+
story: "Overview of all skeleton variants and their common use cases.",
|
|
402
|
+
},
|
|
403
|
+
},
|
|
404
|
+
};
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { Slider } from "./slider";
|
|
2
|
+
var meta = {
|
|
3
|
+
title: "Components/Slider",
|
|
4
|
+
component: Slider,
|
|
5
|
+
tags: ["autodocs"],
|
|
6
|
+
parameters: {
|
|
7
|
+
docs: {
|
|
8
|
+
description: {
|
|
9
|
+
component: "Slider component that allows users to select a value or range by dragging a handle along a track.",
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
controls: {
|
|
13
|
+
expanded: true,
|
|
14
|
+
sort: "requiredFirst",
|
|
15
|
+
hideNoControlsWarning: true,
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
args: {
|
|
19
|
+
// Default values for the slider
|
|
20
|
+
min: 0,
|
|
21
|
+
max: 100,
|
|
22
|
+
step: 1,
|
|
23
|
+
orientation: "horizontal",
|
|
24
|
+
},
|
|
25
|
+
argTypes: {
|
|
26
|
+
min: {
|
|
27
|
+
control: { type: "number" },
|
|
28
|
+
description: "The minimum value of the slider",
|
|
29
|
+
defaultValue: 0,
|
|
30
|
+
table: {
|
|
31
|
+
defaultValue: { summary: "0" },
|
|
32
|
+
type: { summary: "number" },
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
max: {
|
|
36
|
+
control: { type: "number" },
|
|
37
|
+
description: "The maximum value of the slider",
|
|
38
|
+
defaultValue: 100,
|
|
39
|
+
table: {
|
|
40
|
+
defaultValue: { summary: "100" },
|
|
41
|
+
type: { summary: "number" },
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
step: {
|
|
45
|
+
control: { type: "number" },
|
|
46
|
+
description: "The step increment value for the slider",
|
|
47
|
+
defaultValue: 1,
|
|
48
|
+
table: {
|
|
49
|
+
defaultValue: { summary: "1" },
|
|
50
|
+
type: { summary: "number" },
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
value: {
|
|
54
|
+
control: { type: "object" },
|
|
55
|
+
description: "The controlled value of the slider (for controlled components)",
|
|
56
|
+
table: {
|
|
57
|
+
defaultValue: { summary: "undefined" },
|
|
58
|
+
type: { summary: "number[]" },
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
defaultValue: {
|
|
62
|
+
control: { type: "object" },
|
|
63
|
+
description: "The default value of the slider (for uncontrolled components)",
|
|
64
|
+
table: {
|
|
65
|
+
defaultValue: { summary: "[min, max]" },
|
|
66
|
+
type: { summary: "number[]" },
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
orientation: {
|
|
70
|
+
control: { type: "radio" },
|
|
71
|
+
options: ["horizontal", "vertical"],
|
|
72
|
+
description: "The orientation of the slider",
|
|
73
|
+
defaultValue: "horizontal",
|
|
74
|
+
table: {
|
|
75
|
+
defaultValue: { summary: "horizontal" },
|
|
76
|
+
type: { summary: "string" },
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
disabled: {
|
|
80
|
+
control: { type: "boolean" },
|
|
81
|
+
description: "Whether the slider is disabled",
|
|
82
|
+
defaultValue: false,
|
|
83
|
+
table: {
|
|
84
|
+
defaultValue: { summary: "false" },
|
|
85
|
+
type: { summary: "boolean" },
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
onValueChange: {
|
|
89
|
+
action: "valueChanged",
|
|
90
|
+
description: "Callback function called when the value changes",
|
|
91
|
+
table: {
|
|
92
|
+
category: "Events",
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
};
|
|
97
|
+
export default meta;
|
|
98
|
+
// Basic single value slider
|
|
99
|
+
export var Default = {
|
|
100
|
+
args: {
|
|
101
|
+
defaultValue: [50],
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
// Slider with predefined value
|
|
105
|
+
export var PresetValue = {
|
|
106
|
+
args: {
|
|
107
|
+
value: [40],
|
|
108
|
+
},
|
|
109
|
+
};
|
|
110
|
+
// Range slider with two thumbs
|
|
111
|
+
export var Range = {
|
|
112
|
+
args: {
|
|
113
|
+
defaultValue: [25, 75],
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
// Slider with custom step
|
|
117
|
+
export var CustomStep = {
|
|
118
|
+
args: {
|
|
119
|
+
defaultValue: [50],
|
|
120
|
+
step: 10,
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
|
+
// Disabled slider
|
|
124
|
+
export var Disabled = {
|
|
125
|
+
args: {
|
|
126
|
+
defaultValue: [50],
|
|
127
|
+
disabled: true,
|
|
128
|
+
},
|
|
129
|
+
};
|
|
130
|
+
// Vertical orientation
|
|
131
|
+
export var VerticalSlider = {
|
|
132
|
+
args: {
|
|
133
|
+
defaultValue: [50],
|
|
134
|
+
orientation: "vertical",
|
|
135
|
+
},
|
|
136
|
+
parameters: {
|
|
137
|
+
docs: {
|
|
138
|
+
description: {
|
|
139
|
+
story: "A slider with vertical orientation. Note that you may need to set a height on the container.",
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
// Vertical range slider
|
|
145
|
+
export var VerticalRange = {
|
|
146
|
+
args: {
|
|
147
|
+
defaultValue: [25, 75],
|
|
148
|
+
orientation: "vertical",
|
|
149
|
+
},
|
|
150
|
+
};
|
|
151
|
+
// Custom range slider
|
|
152
|
+
export var CustomRange = {
|
|
153
|
+
args: {
|
|
154
|
+
min: 100,
|
|
155
|
+
max: 1000,
|
|
156
|
+
defaultValue: [400, 700],
|
|
157
|
+
step: 100,
|
|
158
|
+
},
|
|
159
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
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 SliderPrimitive from "@radix-ui/react-slider";
|
|
14
|
+
import { cn } from "../../lib/utils";
|
|
15
|
+
function Slider(_a) {
|
|
16
|
+
var className = _a.className, defaultValue = _a.defaultValue, value = _a.value, _b = _a.min, min = _b === void 0 ? 0 : _b, _c = _a.max, max = _c === void 0 ? 100 : _c, props = __rest(_a, ["className", "defaultValue", "value", "min", "max"]);
|
|
17
|
+
var _values = React.useMemo(function () {
|
|
18
|
+
return Array.isArray(value)
|
|
19
|
+
? value
|
|
20
|
+
: Array.isArray(defaultValue)
|
|
21
|
+
? defaultValue
|
|
22
|
+
: [min, max];
|
|
23
|
+
}, [value, defaultValue, min, max]);
|
|
24
|
+
return (<SliderPrimitive.Root data-slot="slider" defaultValue={defaultValue} value={value} min={min} max={max} className={cn("relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col", className)} {...props}>
|
|
25
|
+
<SliderPrimitive.Track data-slot="slider-track" className={cn("bg-muted relative grow overflow-hidden rounded-full data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5")}>
|
|
26
|
+
<SliderPrimitive.Range data-slot="slider-range" className={cn("bg-blue-600 absolute data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full")}/>
|
|
27
|
+
</SliderPrimitive.Track>
|
|
28
|
+
{Array.from({ length: _values.length }, function (_, index) { return (<SliderPrimitive.Thumb data-slot="slider-thumb" key={index} className="border-blue-600 bg-background ring-ring/50 block size-4 shrink-0 rounded-full border shadow-sm transition-[color,box-shadow] hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50"/>); })}
|
|
29
|
+
</SliderPrimitive.Root>);
|
|
30
|
+
}
|
|
31
|
+
export { Slider };
|