aural-ui 4.0.1 → 4.2.0
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/README.md +8 -1
- package/dist/components/aspect-ratio/AspectRatio.stories.tsx +290 -1228
- package/dist/components/avatar/Avatar.stories.tsx +219 -235
- package/dist/components/badge/Badge.stories.tsx +379 -116
- package/dist/components/banner/Banner.stories.tsx +445 -391
- package/dist/components/breadcrumb/Breadcrumb.stories.tsx +453 -199
- package/dist/components/button/Button.stories.tsx +585 -230
- package/dist/components/card/Card.stories.tsx +619 -301
- package/dist/components/char-count/CharCount.stories.tsx +350 -248
- package/dist/components/checkbox/Checkbox.stories.tsx +309 -167
- package/dist/components/chip/Chip.stories.tsx +362 -168
- package/dist/components/circular-loader/CircularLoader.stories.tsx +221 -636
- package/dist/components/clamp-lines/ClampLines.stories.tsx +246 -117
- package/dist/components/collapsible/Collapsible.stories.tsx +391 -252
- package/dist/components/command/Command.stories.tsx +530 -867
- package/dist/components/dialog/Dialog.stories.tsx +501 -950
- package/dist/components/divider/Divider.stories.tsx +264 -527
- package/dist/components/dot-loader/DotLoader.stories.tsx +256 -257
- package/dist/components/drawer/Drawer.stories.tsx +659 -1023
- package/dist/components/dropdown/Dropdown.stories.tsx +643 -1028
- package/dist/components/form/Form.stories.tsx +560 -274
- package/dist/components/helper-text/HelperText.stories.tsx +199 -200
- package/dist/components/hover-card/HoverCard.stories.tsx +318 -1254
- package/dist/components/icon-button/IconButton.stories.tsx +837 -194
- package/dist/components/if-else/if-else.stories.tsx +370 -83
- package/dist/components/input/Input.stories.tsx +436 -368
- package/dist/components/label/Label.stories.tsx +156 -154
- package/dist/components/list/List.stories.tsx +484 -835
- package/dist/components/marquee/Marquee.stories.tsx +356 -712
- package/dist/components/otp-inputs/OtpInputs.stories.tsx +352 -422
- package/dist/components/overlay/Overlay.stories.tsx +452 -824
- package/dist/components/pagination/Pagination.stories.tsx +721 -210
- package/dist/components/popover/Popover.stories.tsx +481 -896
- package/dist/components/radio/Radio.stories.tsx +432 -124
- package/dist/components/resizable/Resizable.stories.tsx +495 -799
- package/dist/components/scroll-area/ScrollArea.stories.tsx +383 -1059
- package/dist/components/search/Search.stories.tsx +312 -595
- package/dist/components/select/Select.stories.tsx +684 -789
- package/dist/components/sheet/Sheet.stories.tsx +671 -950
- package/dist/components/skelton/Skelton.stories.tsx +230 -764
- package/dist/components/slider/Slider.stories.tsx +383 -760
- package/dist/components/stepper/Stepper.stories.tsx +371 -514
- package/dist/components/switch/Switch.stories.tsx +461 -208
- package/dist/components/switch-case/SwitchCase.stories.tsx +367 -188
- package/dist/components/table/Table.stories.tsx +770 -916
- package/dist/components/tabs/Tabs.stories.tsx +458 -1455
- package/dist/components/tag/Tag.stories.tsx +714 -542
- package/dist/components/textarea/TextArea.stories.tsx +621 -562
- package/dist/components/thumbnail-tags/ThumbnailTags.stories.tsx +228 -154
- package/dist/components/toast/Toast.stories.tsx +452 -1339
- package/dist/components/toggle/Toggle.stories.tsx +488 -931
- package/dist/components/tooltip/Tooltip.stories.tsx +344 -1388
- package/dist/components/typography/Typography.stories.tsx +406 -89
- package/dist/hooks/use-change-state/UseChangeState.stories.tsx +309 -606
- package/dist/hooks/use-previous/UsePrevious.stories.tsx +367 -917
- package/dist/hooks/use-standalone-pagination/UseStandalonePagination.stories.tsx +639 -867
- package/dist/icons/Icons.stories.tsx +0 -12
- package/dist/icons/ai-avatar-icon/AiAvatarIcon.stories.tsx +223 -1060
- package/dist/icons/alert-icon/AlertIcon.stories.tsx +106 -968
- package/dist/icons/all-icons.tsx +37 -16
- package/dist/icons/angle-down-icon/AngleDownIcon.stories.tsx +137 -1010
- package/dist/icons/apple-logo-icon/AppleLogoIcon.stories.tsx +145 -935
- package/dist/icons/arrow-box-left-icon/ArrowBoxLeftIcon.stories.tsx +132 -1046
- package/dist/icons/arrow-corner-up-left-icon/ArrowCornerUpLeftIcon.stories.tsx +134 -986
- package/dist/icons/arrow-corner-up-right-icon/ArrowCornerUpRightIcon.stories.tsx +135 -1028
- package/dist/icons/arrow-left-icon/ArrowLeftIcon.stories.tsx +133 -971
- package/dist/icons/arrow-right-icon/ArrowRightIcon.stories.tsx +145 -1123
- package/dist/icons/arrow-right-up-icon/ArrowRightUpIcon.stories.tsx +143 -1252
- package/dist/icons/art-board-icon/ArtBoardIcon.stories.tsx +123 -632
- package/dist/icons/audio-bar-icon/AudioBarIcon.stories.tsx +141 -1223
- package/dist/icons/backward-ten-seconds-icon/BackwardTenSecondsIcon.stories.tsx +164 -1018
- package/dist/icons/bubble-check-icon/BubbleCheckIcon.stories.tsx +121 -1236
- package/dist/icons/bubble-crossed-icon/BubbleCrossedIcon.stories.tsx +121 -1213
- package/dist/icons/bubble-sparkle-icon/BubbleSparkleIcon.stories.tsx +116 -893
- package/dist/icons/camera-icon/CameraIcon.stories.tsx +109 -1254
- package/dist/icons/capital-a-letter-icon/CapitalALetterIcon.stories.tsx +114 -975
- package/dist/icons/chevron-double-left-icon/ChevronDoubleLeftIcon.stories.tsx +157 -994
- package/dist/icons/chevron-double-right-icon/ChevronDoubleRightIcon.stories.tsx +160 -992
- package/dist/icons/chevron-down-icon/ChevronDownIcon.stories.tsx +140 -970
- package/dist/icons/chevron-left-icon/ChevronLeftIcon.stories.tsx +126 -993
- package/dist/icons/chevron-right-icon/ChevronRightIcon.stories.tsx +144 -987
- package/dist/icons/chevron-up-icon/ChevronUpIcon.stories.tsx +141 -1007
- package/dist/icons/circle-tick-icon/CircleTickIcon.stories.tsx +147 -1187
- package/dist/icons/circular-play-icon/CircularPlayIcon.stories.tsx +110 -476
- package/dist/icons/coin-icon/CoinIcon.stories.tsx +120 -1364
- package/dist/icons/coin-toons-icon/CoinToonsIcon.stories.tsx +113 -1360
- package/dist/icons/column-wide-add-icon/ColumnWideAddIcon.stories.tsx +111 -942
- package/dist/icons/command-icon/CommandIcon.stories.tsx +124 -1087
- package/dist/icons/copy-icon/CopyIcon.stories.tsx +119 -996
- package/dist/icons/cross-circle-icon/CrossCircleIcon.stories.tsx +144 -1046
- package/dist/icons/cross-icon/CrossIcon.stories.tsx +136 -999
- package/dist/icons/download-icon/DownloadIcon.stories.tsx +123 -857
- package/dist/icons/edit-big-icon/EditBigIcon.stories.tsx +121 -1080
- package/dist/icons/email-icon/EmailIcon.stories.tsx +112 -979
- package/dist/icons/expand-icon/ExpandIcon.stories.tsx +109 -1146
- package/dist/icons/eye-close-icon/EyeCloseIcon.stories.tsx +141 -1068
- package/dist/icons/eye-open-icon/EyeOpenIcon.stories.tsx +140 -1081
- package/dist/icons/feature-shine-icon/FeatureShineIcon.stories.tsx +124 -1050
- package/dist/icons/file-chart-icon/FileChartIcon.stories.tsx +123 -1091
- package/dist/icons/file-text-icon/FileTextIcon.stories.tsx +122 -633
- package/dist/icons/filter-bar-row-icon/FilterBarRowIcon.stories.tsx +116 -1087
- package/dist/icons/forward-ten-seconds-icon/ForwardTenSecondsIcon.stories.tsx +166 -1020
- package/dist/icons/git-branch-icon/GitBranchIcon.stories.tsx +112 -1182
- package/dist/icons/git-fork-icon/GitForkIcon.stories.tsx +112 -1155
- package/dist/icons/globe-icon/GlobeIcon.stories.tsx +127 -325
- package/dist/icons/google-logo-icon/GoogleLogoIcon.stories.tsx +142 -985
- package/dist/icons/grip-vertical-icon/GripVerticalIcon.stories.tsx +116 -1217
- package/dist/icons/head-icon/HeadIcon.stories.tsx +108 -953
- package/dist/icons/heart-icon/HeartIcon.stories.tsx +117 -1060
- package/dist/icons/image-avatar-sparkle-icon/ImageAvatarSparkleIcon.stories.tsx +116 -716
- package/dist/icons/image-icon/ImageIcon.stories.tsx +102 -1164
- package/dist/icons/import-folder-icon/ImportFolderIcon.stories.tsx +108 -1233
- package/dist/icons/import-left-arrow-folder-icon/ImportLeftArrowFolderIcon.stories.tsx +133 -1289
- package/dist/icons/indian-flag-icon/IndianFlagIcon.stories.tsx +155 -1012
- package/dist/icons/instagram-icon/InstagramIcon.stories.tsx +158 -1438
- package/dist/icons/layout-column-icon/LayoutColumnIcon.stories.tsx +121 -1011
- package/dist/icons/layout-left-icon/LayoutLeftIcon.stories.tsx +116 -981
- package/dist/icons/layout-right-icon/LayoutRightIcon.stories.tsx +116 -979
- package/dist/icons/light-bulb-simple-icon/LightBulbSimpleIcon.stories.tsx +105 -1252
- package/dist/icons/linked-in-icon/LinkedInIcon.stories.tsx +151 -1554
- package/dist/icons/magic-book-icon/MagicBookIcon.stories.tsx +107 -1227
- package/dist/icons/magic-edit-icon/MagicEditIcon.stories.tsx +116 -707
- package/dist/icons/maintenance-icon/MaintenanceIcon.stories.tsx +119 -1226
- package/dist/icons/message-icon/MessageIcon.stories.tsx +111 -557
- package/dist/icons/minimize-icon/MinimizeIcon.stories.tsx +112 -1198
- package/dist/icons/moon-icon/MoonIcon.stories.tsx +117 -557
- package/dist/icons/move-horizontal-icon/MoveHorizontalIcon.stories.tsx +106 -1235
- package/dist/icons/move-vertical-icon/MoveVerticalIcon.stories.tsx +112 -1185
- package/dist/icons/musical-note-icon/MusicalNoteIcon.stories.tsx +116 -1012
- package/dist/icons/notepad-icon/NotepadIcon.stories.tsx +108 -1137
- package/dist/icons/notes-icon/NotesIcon.stories.tsx +116 -1138
- package/dist/icons/page-search-icon/PageSearchIcon.stories.tsx +106 -1146
- package/dist/icons/page-text-icon/PageTextIcon.stories.tsx +119 -719
- package/dist/icons/paint-roll-icon/PaintRollIcon.stories.tsx +110 -999
- package/dist/icons/paper-plane-icon/PaperPlaneIcon.stories.tsx +109 -912
- package/dist/icons/pause-icon/PauseIcon.stories.tsx +110 -1041
- package/dist/icons/pencil-icon/PencilIcon.stories.tsx +112 -1109
- package/dist/icons/phone-icon/PhoneIcon.stories.tsx +112 -1023
- package/dist/icons/plus-icon/PlusIcon.stories.tsx +103 -1132
- package/dist/icons/pocket-studio-icon/PocketStudioIcon.stories.tsx +104 -870
- package/dist/icons/scroll-down-icon/ScrollDownIcon.stories.tsx +99 -476
- package/dist/icons/search-icon/SearchIcon.stories.tsx +108 -1161
- package/dist/icons/setting-icon/SettingIcon.stories.tsx +104 -1009
- package/dist/icons/share-icon/ShareIcon.stories.tsx +117 -1064
- package/dist/icons/shield-icon/ShieldIcon.stories.tsx +114 -974
- package/dist/icons/site-logo-icon/SiteLogoIcon.stories.tsx +134 -1160
- package/dist/icons/skip-backward-icon/SkipBackwardIcon.stories.tsx +169 -1017
- package/dist/icons/skip-forward-icon/SkipForwardIcon.stories.tsx +161 -1016
- package/dist/icons/sparkles-soft-icon/SparklesSoftIcon.stories.tsx +102 -1001
- package/dist/icons/spinner-gradient-icon/SpinnerGradientIcon.stories.tsx +155 -593
- package/dist/icons/spinner-solid-icon/SpinnerSolidIcon.stories.tsx +155 -608
- package/dist/icons/spinner-solid-neutral-icon/SpinnerSolidINeutralcon.stories.tsx +142 -712
- package/dist/icons/star-icon/StarIcon.stories.tsx +120 -946
- package/dist/icons/store-coin-icon/StoreCoinIcon.stories.tsx +109 -1013
- package/dist/icons/suggestion-icon/SuggestionIcon.stories.tsx +113 -891
- package/dist/icons/sun-icon/SunIcon.stories.tsx +117 -864
- package/dist/icons/text-color-icon/TextColorIcon.stories.tsx +113 -989
- package/dist/icons/text-indicator-icon/TextIndicatorIcon.stories.tsx +120 -1027
- package/dist/icons/threads-icon/ThreadsIcon.stories.tsx +153 -1476
- package/dist/icons/tick-circle-icon/TickCircleIcon.stories.tsx +143 -1187
- package/dist/icons/tick-icon/TickIcon.stories.tsx +142 -1322
- package/dist/icons/trash-icon/TrashIcon.stories.tsx +105 -970
- package/dist/icons/twitter-x-icon/TwitterXIcon.stories.tsx +154 -1457
- package/dist/icons/upload-icon/UploadIcon.stories.tsx +112 -930
- package/dist/icons/vertical-menu-icon/VerticalMenuIcon.stories.tsx +115 -1019
- package/dist/icons/video-play-list-icon/VideoPlaylistIcon.stories.tsx +122 -1092
- package/dist/icons/voice-playing-icon/VoicePlayingIcon.stories.tsx +120 -1401
- package/dist/icons/volume-full-icon/VolumeFullIcon.stories.tsx +107 -1212
- package/dist/icons/volume-half-icon/VolumeHalfIcon.stories.tsx +109 -1122
- package/dist/icons/volume-off-icon/VolumeOffIcon.stories.tsx +112 -1124
- package/dist/icons/warning-icon/WarningIcon.stories.tsx +119 -1083
- package/dist/icons/youtube-icon/YoutubeIcon.stories.tsx +158 -983
- package/dist/index.cjs +90 -90
- package/dist/index.js +90 -90
- package/package.json +8 -3
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React from "react"
|
|
2
2
|
import type { Meta, StoryObj } from "@storybook/react-vite"
|
|
3
3
|
|
|
4
|
+
import { AuralComponentDocsPage } from "src/ui/story-spec/components/component-story-docs-page"
|
|
5
|
+
|
|
4
6
|
import { Slider } from "."
|
|
5
7
|
|
|
6
8
|
const meta: Meta<typeof Slider> = {
|
|
@@ -8,126 +10,29 @@ const meta: Meta<typeof Slider> = {
|
|
|
8
10
|
component: Slider,
|
|
9
11
|
parameters: {
|
|
10
12
|
layout: "centered",
|
|
11
|
-
backgrounds: {
|
|
12
|
-
default: "dark",
|
|
13
|
-
values: [
|
|
14
|
-
{ name: "dark", value: "#0a0a0a" },
|
|
15
|
-
{ name: "light", value: "#ffffff" },
|
|
16
|
-
],
|
|
17
|
-
},
|
|
18
13
|
docs: {
|
|
19
14
|
description: {
|
|
20
|
-
component:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
A customizable range slider component built with Radix UI primitives and design system integration.
|
|
24
|
-
|
|
25
|
-
## Features
|
|
26
|
-
|
|
27
|
-
- **Multiple Variants**: Default, primary, secondary, positive, warning, and info variants
|
|
28
|
-
- **Size Options**: Small (sm), medium (md), and large (lg) sizes
|
|
29
|
-
- **Orientation Support**: Horizontal and vertical orientations
|
|
30
|
-
- **Range & Single Value**: Support for both single value and range selection
|
|
31
|
-
- **Label Display**: Configurable thumb labels with custom text or values
|
|
32
|
-
- **Align Thumb**: Optional thumb alignment
|
|
33
|
-
- **Accessibility**: Built with Radix UI for keyboard navigation and screen reader support
|
|
34
|
-
- **Custom Styling**: Flexible class override system for complete customization
|
|
35
|
-
- **Touch Support**: Touch-friendly interaction on mobile devices
|
|
36
|
-
- **Design System**: Integrated with FM design tokens
|
|
37
|
-
|
|
38
|
-
## Anatomy
|
|
39
|
-
|
|
40
|
-
### Core Components
|
|
41
|
-
- **SliderRoot**: Main container with orientation and interaction handling
|
|
42
|
-
- **SliderTrack**: Background track element
|
|
43
|
-
- **SliderRange**: Active range/progress indicator
|
|
44
|
-
- **SliderThumb**: Interactive handle(s) for value selection with optional labels
|
|
45
|
-
|
|
46
|
-
## Props Interface
|
|
47
|
-
|
|
48
|
-
\`\`\`tsx
|
|
49
|
-
interface SliderProps extends React.ComponentProps<typeof SliderPrimitive.Root> {
|
|
50
|
-
variant?: "default" | "primary" | "secondary" | "positive" | "warning" | "info"
|
|
51
|
-
size?: "sm" | "md" | "lg"
|
|
52
|
-
showLabel?: boolean // Show/hide thumb labels
|
|
53
|
-
label?: string // Custom label text (overrides value display)
|
|
54
|
-
alignThumb?: "bottom" | "top" | "center" // align thumb alignment
|
|
55
|
-
classes?: {
|
|
56
|
-
root?: string // Override root container styles
|
|
57
|
-
track?: string // Override track background styles
|
|
58
|
-
range?: string // Override active range styles
|
|
59
|
-
thumb?: string // Override thumb handle styles
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
\`\`\`
|
|
63
|
-
|
|
64
|
-
## New Features
|
|
65
|
-
|
|
66
|
-
### Label Display
|
|
67
|
-
- **showLabel**: Toggle thumb label visibility (default: true)
|
|
68
|
-
- **label**: Custom text to display instead of values
|
|
69
|
-
- **Value Display**: Automatic value display when no custom label provided
|
|
70
|
-
|
|
71
|
-
### Align Thumb
|
|
72
|
-
- **alignThumb**: Optional centered positioning for thumbs
|
|
73
|
-
- **Track Alignment**: Conditional styling for track-thumb alignment
|
|
74
|
-
|
|
75
|
-
### Enhanced Styling
|
|
76
|
-
- **classes**: Granular style overrides for all sub-components
|
|
77
|
-
- **Variant Support**: Consistent variant styling across track, range, and thumbs
|
|
78
|
-
- **Size Variants**: Responsive sizing for different use cases
|
|
79
|
-
|
|
80
|
-
## Usage Examples
|
|
81
|
-
|
|
82
|
-
### Basic with Labels
|
|
83
|
-
\`\`\`tsx
|
|
84
|
-
<Slider
|
|
85
|
-
defaultValue={[50]}
|
|
86
|
-
showLabel={true}
|
|
87
|
-
max={100}
|
|
88
|
-
min={0}
|
|
89
|
-
/>
|
|
90
|
-
\`\`\`
|
|
91
|
-
|
|
92
|
-
### Custom Label Text
|
|
93
|
-
\`\`\`tsx
|
|
94
|
-
<Slider
|
|
95
|
-
defaultValue={[75]}
|
|
96
|
-
label="Volume"
|
|
97
|
-
showLabel={true}
|
|
98
|
-
/>
|
|
99
|
-
\`\`\`
|
|
100
|
-
|
|
101
|
-
### Without Labels
|
|
102
|
-
\`\`\`tsx
|
|
103
|
-
<Slider
|
|
104
|
-
defaultValue={[30]}
|
|
105
|
-
showLabel={false}
|
|
106
|
-
/>
|
|
107
|
-
\`\`\`
|
|
108
|
-
|
|
109
|
-
### Align Thumb
|
|
110
|
-
\`\`\`tsx
|
|
111
|
-
<Slider
|
|
112
|
-
defaultValue={[60]}
|
|
113
|
-
alignThumb={"top"}
|
|
114
|
-
/>
|
|
115
|
-
\`\`\`
|
|
116
|
-
|
|
117
|
-
### Custom Styling Classes
|
|
118
|
-
\`\`\`tsx
|
|
119
|
-
<Slider
|
|
120
|
-
defaultValue={[45]}
|
|
121
|
-
classes={{
|
|
122
|
-
root: "custom-root-class",
|
|
123
|
-
track: "bg-red-100",
|
|
124
|
-
range: "bg-red-500",
|
|
125
|
-
thumb: "bg-red-600 ring-red-200"
|
|
126
|
-
}}
|
|
127
|
-
/>
|
|
128
|
-
\`\`\`
|
|
129
|
-
`,
|
|
15
|
+
component:
|
|
16
|
+
"A customizable range slider built on Radix UI primitives. Supports six color variants, three sizes, horizontal/vertical orientations, single and dual-thumb range mode, optional thumb labels, and configurable thumb alignment.",
|
|
130
17
|
},
|
|
18
|
+
page: () => (
|
|
19
|
+
<AuralComponentDocsPage
|
|
20
|
+
features={[
|
|
21
|
+
{
|
|
22
|
+
title: "6 Color Variants",
|
|
23
|
+
description: "Default to info",
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
title: "Range Mode",
|
|
27
|
+
description: "Single or dual thumb",
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
title: "Thumb Labels",
|
|
31
|
+
description: "Optional value display",
|
|
32
|
+
},
|
|
33
|
+
]}
|
|
34
|
+
/>
|
|
35
|
+
),
|
|
131
36
|
},
|
|
132
37
|
},
|
|
133
38
|
tags: ["autodocs"],
|
|
@@ -142,34 +47,34 @@ interface SliderProps extends React.ComponentProps<typeof SliderPrimitive.Root>
|
|
|
142
47
|
"warning",
|
|
143
48
|
"info",
|
|
144
49
|
],
|
|
145
|
-
description: "
|
|
50
|
+
description: "Color variant applied to the track range and thumb",
|
|
146
51
|
},
|
|
147
52
|
size: {
|
|
148
53
|
control: "select",
|
|
149
54
|
options: ["sm", "md", "lg"],
|
|
150
|
-
description: "
|
|
55
|
+
description: "Track thickness and thumb size",
|
|
151
56
|
},
|
|
152
57
|
showLabel: {
|
|
153
58
|
control: "boolean",
|
|
154
|
-
description: "Show or hide thumb
|
|
59
|
+
description: "Show or hide the value label on the thumb",
|
|
155
60
|
},
|
|
156
61
|
label: {
|
|
157
62
|
control: "text",
|
|
158
|
-
description: "Custom label text
|
|
63
|
+
description: "Custom label text — overrides numeric value display",
|
|
159
64
|
},
|
|
160
65
|
alignThumb: {
|
|
161
66
|
control: "select",
|
|
162
|
-
options: ["bottom", "
|
|
163
|
-
description: "Thumb alignment",
|
|
67
|
+
options: ["bottom", "center", "top"],
|
|
68
|
+
description: "Thumb vertical alignment relative to the track",
|
|
164
69
|
},
|
|
165
70
|
orientation: {
|
|
166
71
|
control: "select",
|
|
167
72
|
options: ["horizontal", "vertical"],
|
|
168
|
-
description: "
|
|
73
|
+
description: "Track orientation",
|
|
169
74
|
},
|
|
170
75
|
disabled: {
|
|
171
76
|
control: "boolean",
|
|
172
|
-
description: "
|
|
77
|
+
description: "Disables interaction",
|
|
173
78
|
},
|
|
174
79
|
min: {
|
|
175
80
|
control: "number",
|
|
@@ -181,7 +86,7 @@ interface SliderProps extends React.ComponentProps<typeof SliderPrimitive.Root>
|
|
|
181
86
|
},
|
|
182
87
|
step: {
|
|
183
88
|
control: "number",
|
|
184
|
-
description: "Step increment",
|
|
89
|
+
description: "Step increment between values",
|
|
185
90
|
},
|
|
186
91
|
},
|
|
187
92
|
}
|
|
@@ -189,713 +94,431 @@ interface SliderProps extends React.ComponentProps<typeof SliderPrimitive.Root>
|
|
|
189
94
|
export default meta
|
|
190
95
|
type Story = StoryObj<typeof Slider>
|
|
191
96
|
|
|
192
|
-
// 1.
|
|
193
|
-
|
|
97
|
+
// ─── 1. Playground ────────────────────────────────────────────────────────────
|
|
98
|
+
|
|
99
|
+
export const Playground: Story = {
|
|
194
100
|
args: {
|
|
195
101
|
defaultValue: [50],
|
|
102
|
+
variant: "primary",
|
|
103
|
+
size: "md",
|
|
104
|
+
showLabel: true,
|
|
105
|
+
alignThumb: "bottom",
|
|
196
106
|
min: 0,
|
|
197
107
|
max: 100,
|
|
198
|
-
showLabel: true,
|
|
199
108
|
},
|
|
200
109
|
render: (args) => (
|
|
201
|
-
<div className="w-
|
|
202
|
-
<div className="mb-4">
|
|
203
|
-
<h3 className="text-fm-primary mb-2 text-lg font-medium">
|
|
204
|
-
Default Slider
|
|
205
|
-
</h3>
|
|
206
|
-
<p className="text-fm-secondary text-sm">
|
|
207
|
-
Basic slider with default styling and value labels
|
|
208
|
-
</p>
|
|
209
|
-
</div>
|
|
110
|
+
<div className="w-full max-w-sm space-y-4">
|
|
210
111
|
<Slider {...args} />
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
<div className="w-80 space-y-6 p-8">
|
|
219
|
-
<div className="mb-6">
|
|
220
|
-
<h3 className="text-fm-primary mb-2 text-lg font-medium">
|
|
221
|
-
Label Options
|
|
222
|
-
</h3>
|
|
223
|
-
<p className="text-fm-secondary text-sm">
|
|
224
|
-
Different ways to display thumb labels
|
|
225
|
-
</p>
|
|
226
|
-
</div>
|
|
227
|
-
|
|
228
|
-
<div className="space-y-6">
|
|
229
|
-
<div>
|
|
230
|
-
<label className="text-fm-primary mb-2 block text-sm font-medium">
|
|
231
|
-
With Value Labels (Default)
|
|
232
|
-
</label>
|
|
233
|
-
<Slider defaultValue={[60]} variant="primary" showLabel={true} />
|
|
234
|
-
</div>
|
|
235
|
-
|
|
236
|
-
<div>
|
|
237
|
-
<label className="text-fm-primary mb-2 block text-sm font-medium">
|
|
238
|
-
Custom Label Text
|
|
239
|
-
</label>
|
|
240
|
-
<Slider
|
|
241
|
-
defaultValue={[75]}
|
|
242
|
-
variant="positive"
|
|
243
|
-
showLabel={true}
|
|
244
|
-
label="High"
|
|
245
|
-
/>
|
|
246
|
-
</div>
|
|
247
|
-
|
|
248
|
-
<div>
|
|
249
|
-
<label className="text-fm-primary mb-2 block text-sm font-medium">
|
|
250
|
-
Without Labels
|
|
251
|
-
</label>
|
|
252
|
-
<Slider defaultValue={[40]} variant="warning" showLabel={false} />
|
|
253
|
-
</div>
|
|
254
|
-
|
|
255
|
-
<div>
|
|
256
|
-
<label className="text-fm-primary mb-2 block text-sm font-medium">
|
|
257
|
-
Range with Custom Labels
|
|
258
|
-
</label>
|
|
259
|
-
<Slider
|
|
260
|
-
defaultValue={[25, 75]}
|
|
261
|
-
variant="info"
|
|
262
|
-
showLabel={true}
|
|
263
|
-
label="Range"
|
|
264
|
-
/>
|
|
265
|
-
</div>
|
|
112
|
+
<div className="border-fm-divider-secondary bg-fm-surface-secondary rounded-lg border px-4 py-3">
|
|
113
|
+
<code
|
|
114
|
+
className="text-fm-secondary text-fm-md leading-fm-md"
|
|
115
|
+
style={{ fontFamily: "var(--font-fm-mono)" }}
|
|
116
|
+
>
|
|
117
|
+
{`<Slider variant="${args.variant}" size="${args.size}" showLabel={${args.showLabel}} alignThumb="${args.alignThumb}" />`}
|
|
118
|
+
</code>
|
|
266
119
|
</div>
|
|
267
120
|
</div>
|
|
268
121
|
),
|
|
122
|
+
parameters: {
|
|
123
|
+
docs: {
|
|
124
|
+
description: {
|
|
125
|
+
story:
|
|
126
|
+
"Use the controls panel in the sidebar to explore variant, size, label, and alignment options.",
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
},
|
|
269
130
|
}
|
|
270
131
|
|
|
271
|
-
//
|
|
272
|
-
export const Variants: Story = {
|
|
273
|
-
render: () => (
|
|
274
|
-
<div className="w-80 space-y-6 p-8">
|
|
275
|
-
<div className="mb-6">
|
|
276
|
-
<h3 className="text-fm-primary mb-2 text-lg font-medium">
|
|
277
|
-
Slider Variants
|
|
278
|
-
</h3>
|
|
279
|
-
<p className="text-fm-secondary text-sm">
|
|
280
|
-
Different color variants with value labels
|
|
281
|
-
</p>
|
|
282
|
-
</div>
|
|
132
|
+
// ─── 2. All Variants ──────────────────────────────────────────────────────────
|
|
283
133
|
|
|
134
|
+
export const AllVariants: Story = {
|
|
135
|
+
render: () => (
|
|
136
|
+
<div className="space-y-8">
|
|
284
137
|
<div className="space-y-4">
|
|
285
|
-
<
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
138
|
+
<h4 className="text-fm-secondary font-fm-text text-fm-md leading-fm-md font-medium">
|
|
139
|
+
Variant × Size
|
|
140
|
+
</h4>
|
|
141
|
+
{(
|
|
142
|
+
[
|
|
143
|
+
{ variant: "default", label: "Default", value: 40 },
|
|
144
|
+
{ variant: "primary", label: "Primary", value: 60 },
|
|
145
|
+
{ variant: "secondary", label: "Secondary", value: 35 },
|
|
146
|
+
{ variant: "positive", label: "Positive", value: 80 },
|
|
147
|
+
{ variant: "warning", label: "Warning", value: 25 },
|
|
148
|
+
{ variant: "info", label: "Info", value: 70 },
|
|
149
|
+
] as const
|
|
150
|
+
).map(({ variant, label, value }) => (
|
|
151
|
+
<div key={variant} className="space-y-6">
|
|
152
|
+
<h4 className="text-fm-secondary font-fm-text text-fm-md leading-fm-md font-medium">
|
|
153
|
+
{label}
|
|
154
|
+
</h4>
|
|
155
|
+
<div className="flex flex-wrap items-end gap-8">
|
|
156
|
+
<div className="min-w-40 space-y-2 text-center">
|
|
157
|
+
<Slider
|
|
158
|
+
defaultValue={[value]}
|
|
159
|
+
variant={variant}
|
|
160
|
+
size="sm"
|
|
161
|
+
showLabel
|
|
162
|
+
/>
|
|
163
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
164
|
+
sm
|
|
165
|
+
</p>
|
|
166
|
+
</div>
|
|
167
|
+
<div className="min-w-40 space-y-2 text-center">
|
|
168
|
+
<Slider
|
|
169
|
+
defaultValue={[value]}
|
|
170
|
+
variant={variant}
|
|
171
|
+
size="md"
|
|
172
|
+
showLabel
|
|
173
|
+
/>
|
|
174
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
175
|
+
md
|
|
176
|
+
</p>
|
|
177
|
+
</div>
|
|
178
|
+
<div className="min-w-40 space-y-2 text-center">
|
|
179
|
+
<Slider
|
|
180
|
+
defaultValue={[value]}
|
|
181
|
+
variant={variant}
|
|
182
|
+
size="lg"
|
|
183
|
+
showLabel
|
|
184
|
+
/>
|
|
185
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
186
|
+
lg
|
|
187
|
+
</p>
|
|
188
|
+
</div>
|
|
189
|
+
</div>
|
|
190
|
+
</div>
|
|
191
|
+
))}
|
|
326
192
|
</div>
|
|
327
193
|
</div>
|
|
328
194
|
),
|
|
195
|
+
parameters: {
|
|
196
|
+
layout: "padded",
|
|
197
|
+
docs: {
|
|
198
|
+
description: {
|
|
199
|
+
story:
|
|
200
|
+
"All six color variants (default, primary, secondary, positive, warning, info) shown at each size (sm, md, lg).",
|
|
201
|
+
},
|
|
202
|
+
},
|
|
203
|
+
},
|
|
329
204
|
}
|
|
330
205
|
|
|
331
|
-
//
|
|
332
|
-
export const Sizes: Story = {
|
|
333
|
-
render: () => (
|
|
334
|
-
<div className="w-80 space-y-6 p-8">
|
|
335
|
-
<div className="mb-6">
|
|
336
|
-
<h3 className="text-fm-primary mb-2 text-lg font-medium">
|
|
337
|
-
Slider Sizes
|
|
338
|
-
</h3>
|
|
339
|
-
<p className="text-fm-secondary text-sm">
|
|
340
|
-
Small, medium, and large size options with labels
|
|
341
|
-
</p>
|
|
342
|
-
</div>
|
|
343
|
-
|
|
344
|
-
<div className="space-y-6">
|
|
345
|
-
<div>
|
|
346
|
-
<label className="text-fm-primary mb-2 block text-sm font-medium">
|
|
347
|
-
Small (sm)
|
|
348
|
-
</label>
|
|
349
|
-
<Slider
|
|
350
|
-
defaultValue={[30]}
|
|
351
|
-
size="sm"
|
|
352
|
-
variant="primary"
|
|
353
|
-
showLabel={true}
|
|
354
|
-
/>
|
|
355
|
-
</div>
|
|
356
|
-
|
|
357
|
-
<div>
|
|
358
|
-
<label className="text-fm-primary mb-2 block text-sm font-medium">
|
|
359
|
-
Medium (md) - Default
|
|
360
|
-
</label>
|
|
361
|
-
<Slider
|
|
362
|
-
defaultValue={[50]}
|
|
363
|
-
size="md"
|
|
364
|
-
variant="primary"
|
|
365
|
-
showLabel={true}
|
|
366
|
-
/>
|
|
367
|
-
</div>
|
|
206
|
+
// ─── 3. Configurations ────────────────────────────────────────────────────────
|
|
368
207
|
|
|
369
|
-
|
|
370
|
-
<label className="text-fm-primary mb-2 block text-sm font-medium">
|
|
371
|
-
Large (lg)
|
|
372
|
-
</label>
|
|
373
|
-
<Slider
|
|
374
|
-
defaultValue={[70]}
|
|
375
|
-
size="lg"
|
|
376
|
-
variant="primary"
|
|
377
|
-
showLabel={true}
|
|
378
|
-
/>
|
|
379
|
-
</div>
|
|
380
|
-
</div>
|
|
381
|
-
</div>
|
|
382
|
-
),
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
// 5. Align Thumb
|
|
386
|
-
export const AlignThumb: Story = {
|
|
208
|
+
export const Configurations: Story = {
|
|
387
209
|
render: () => (
|
|
388
|
-
<div className="
|
|
389
|
-
<div className="
|
|
390
|
-
<
|
|
391
|
-
|
|
392
|
-
</
|
|
393
|
-
<
|
|
394
|
-
|
|
395
|
-
</p>
|
|
396
|
-
</div>
|
|
397
|
-
|
|
398
|
-
<div className="space-y-6">
|
|
399
|
-
<div>
|
|
400
|
-
<label className="text-fm-primary mb-2 block text-sm font-medium">
|
|
401
|
-
Default alignment
|
|
402
|
-
</label>
|
|
403
|
-
<Slider
|
|
404
|
-
defaultValue={[50]}
|
|
405
|
-
variant="primary"
|
|
406
|
-
alignThumb={"bottom"}
|
|
407
|
-
showLabel={true}
|
|
408
|
-
/>
|
|
409
|
-
</div>
|
|
410
|
-
|
|
411
|
-
<div>
|
|
412
|
-
<label className="text-fm-primary mb-2 block text-sm font-medium">
|
|
413
|
-
Centered Thumb
|
|
414
|
-
</label>
|
|
415
|
-
<Slider
|
|
416
|
-
defaultValue={[50]}
|
|
417
|
-
variant="primary"
|
|
418
|
-
alignThumb={"center"}
|
|
419
|
-
showLabel={true}
|
|
420
|
-
/>
|
|
421
|
-
</div>
|
|
422
|
-
|
|
423
|
-
<div>
|
|
424
|
-
<label className="text-fm-primary mb-5 block text-sm font-medium">
|
|
425
|
-
Top Thumbs
|
|
426
|
-
</label>
|
|
427
|
-
<Slider
|
|
428
|
-
defaultValue={[50]}
|
|
429
|
-
variant="positive"
|
|
430
|
-
alignThumb={"top"}
|
|
431
|
-
showLabel={true}
|
|
432
|
-
/>
|
|
433
|
-
</div>
|
|
434
|
-
</div>
|
|
435
|
-
</div>
|
|
436
|
-
),
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
// 6. Custom Labels
|
|
440
|
-
export const CustomLabels: Story = {
|
|
441
|
-
render: () => {
|
|
442
|
-
const [volume, setVolume] = React.useState([75])
|
|
443
|
-
const [quality, setQuality] = React.useState([3])
|
|
444
|
-
const [temperature, setTemperature] = React.useState([22])
|
|
445
|
-
const [mode, setMode] = React.useState([2])
|
|
446
|
-
|
|
447
|
-
const getQualityLabel = (value: number) => {
|
|
448
|
-
const labels = ["Low", "Medium", "High", "Ultra", "Max"]
|
|
449
|
-
return labels[value - 1] || "Unknown"
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
const getModeLabel = (value: number) => {
|
|
453
|
-
const modes = ["Eco", "Normal", "Performance", "Turbo"]
|
|
454
|
-
return modes[value - 1] || "Unknown"
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
return (
|
|
458
|
-
<div className="w-80 space-y-6 p-8">
|
|
459
|
-
<div className="mb-6">
|
|
460
|
-
<h3 className="text-fm-primary mb-2 text-lg font-medium">
|
|
461
|
-
Custom Labels
|
|
462
|
-
</h3>
|
|
463
|
-
<p className="text-fm-secondary text-sm">
|
|
464
|
-
Sliders with custom label text instead of values
|
|
465
|
-
</p>
|
|
466
|
-
</div>
|
|
467
|
-
|
|
468
|
-
<div className="space-y-6">
|
|
469
|
-
<div>
|
|
470
|
-
<label className="text-fm-primary mb-2 block text-sm font-medium">
|
|
471
|
-
Volume Control
|
|
472
|
-
</label>
|
|
210
|
+
<div className="space-y-8">
|
|
211
|
+
<div className="space-y-4">
|
|
212
|
+
<h4 className="text-fm-secondary font-fm-text text-fm-md leading-fm-md font-medium">
|
|
213
|
+
Thumb Alignment
|
|
214
|
+
</h4>
|
|
215
|
+
<div className="flex flex-wrap gap-8">
|
|
216
|
+
<div className="min-w-48 space-y-2 text-center">
|
|
473
217
|
<Slider
|
|
474
|
-
|
|
475
|
-
onValueChange={setVolume}
|
|
218
|
+
defaultValue={[50]}
|
|
476
219
|
variant="primary"
|
|
477
|
-
|
|
478
|
-
showLabel
|
|
220
|
+
alignThumb="bottom"
|
|
221
|
+
showLabel
|
|
479
222
|
/>
|
|
480
|
-
<
|
|
481
|
-
|
|
482
|
-
</
|
|
223
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
224
|
+
bottom (default)
|
|
225
|
+
</p>
|
|
483
226
|
</div>
|
|
484
|
-
|
|
485
|
-
<div>
|
|
486
|
-
<label className="text-fm-primary mb-2 block text-sm font-medium">
|
|
487
|
-
Quality Setting
|
|
488
|
-
</label>
|
|
227
|
+
<div className="min-w-48 space-y-2 text-center">
|
|
489
228
|
<Slider
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
max={5}
|
|
495
|
-
step={1}
|
|
496
|
-
label={getQualityLabel(quality[0])}
|
|
497
|
-
showLabel={true}
|
|
229
|
+
defaultValue={[50]}
|
|
230
|
+
variant="primary"
|
|
231
|
+
alignThumb="center"
|
|
232
|
+
showLabel
|
|
498
233
|
/>
|
|
499
|
-
<
|
|
500
|
-
|
|
501
|
-
</
|
|
234
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
235
|
+
center
|
|
236
|
+
</p>
|
|
502
237
|
</div>
|
|
503
|
-
|
|
504
|
-
<div>
|
|
505
|
-
<label className="text-fm-primary mb-2 block text-sm font-medium">
|
|
506
|
-
Temperature
|
|
507
|
-
</label>
|
|
238
|
+
<div className="min-w-48 space-y-2 pt-5 text-center">
|
|
508
239
|
<Slider
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
max={30}
|
|
514
|
-
label={`${temperature[0]}°C`}
|
|
515
|
-
showLabel={true}
|
|
240
|
+
defaultValue={[50]}
|
|
241
|
+
variant="primary"
|
|
242
|
+
alignThumb="top"
|
|
243
|
+
showLabel
|
|
516
244
|
/>
|
|
245
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
246
|
+
top
|
|
247
|
+
</p>
|
|
517
248
|
</div>
|
|
249
|
+
</div>
|
|
250
|
+
</div>
|
|
518
251
|
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
252
|
+
<div className="space-y-4">
|
|
253
|
+
<h4 className="text-fm-secondary font-fm-text text-fm-md leading-fm-md font-medium">
|
|
254
|
+
Range Slider (Dual Thumbs)
|
|
255
|
+
</h4>
|
|
256
|
+
<div className="flex flex-wrap gap-8">
|
|
257
|
+
<div className="min-w-48 space-y-2 text-center">
|
|
258
|
+
<Slider defaultValue={[20, 80]} variant="primary" showLabel />
|
|
259
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
260
|
+
primary range
|
|
261
|
+
</p>
|
|
262
|
+
</div>
|
|
263
|
+
<div className="min-w-48 space-y-2 text-center">
|
|
264
|
+
<Slider defaultValue={[30, 70]} variant="positive" showLabel />
|
|
265
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
266
|
+
positive range
|
|
267
|
+
</p>
|
|
268
|
+
</div>
|
|
269
|
+
<div className="min-w-48 space-y-2 text-center">
|
|
523
270
|
<Slider
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
max={4}
|
|
529
|
-
step={1}
|
|
530
|
-
label={getModeLabel(mode[0])}
|
|
531
|
-
showLabel={true}
|
|
271
|
+
defaultValue={[10, 90]}
|
|
272
|
+
variant="info"
|
|
273
|
+
showLabel
|
|
274
|
+
label="Range"
|
|
532
275
|
/>
|
|
276
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
277
|
+
custom label range
|
|
278
|
+
</p>
|
|
533
279
|
</div>
|
|
534
280
|
</div>
|
|
535
281
|
</div>
|
|
536
|
-
)
|
|
537
|
-
},
|
|
538
|
-
}
|
|
539
|
-
|
|
540
|
-
// 7. Range Slider with Custom Styling
|
|
541
|
-
export const RangeSlider: Story = {
|
|
542
|
-
render: () => {
|
|
543
|
-
const [values, setValues] = React.useState([25, 75])
|
|
544
282
|
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
showLabel={true}
|
|
564
|
-
classes={{
|
|
565
|
-
thumb: "rounded-lg",
|
|
566
|
-
}}
|
|
567
|
-
/>
|
|
568
|
-
|
|
569
|
-
<div className="text-fm-secondary flex justify-between text-sm">
|
|
570
|
-
<span>Min: {values[0]}</span>
|
|
571
|
-
<span>Max: {values[1]}</span>
|
|
283
|
+
<div className="space-y-4">
|
|
284
|
+
<h4 className="text-fm-secondary font-fm-text text-fm-md leading-fm-md font-medium">
|
|
285
|
+
Vertical Orientation
|
|
286
|
+
</h4>
|
|
287
|
+
<div className="flex flex-wrap items-end gap-12">
|
|
288
|
+
<div className="space-y-2 text-center">
|
|
289
|
+
<div className="flex justify-center">
|
|
290
|
+
<Slider
|
|
291
|
+
orientation="vertical"
|
|
292
|
+
defaultValue={[60]}
|
|
293
|
+
variant="primary"
|
|
294
|
+
className="h-48"
|
|
295
|
+
showLabel
|
|
296
|
+
/>
|
|
297
|
+
</div>
|
|
298
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
299
|
+
primary · vertical
|
|
300
|
+
</p>
|
|
572
301
|
</div>
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
302
|
+
<div className="space-y-2 text-center">
|
|
303
|
+
<div className="flex justify-center">
|
|
304
|
+
<Slider
|
|
305
|
+
orientation="vertical"
|
|
306
|
+
defaultValue={[80]}
|
|
307
|
+
variant="positive"
|
|
308
|
+
className="h-48"
|
|
309
|
+
showLabel={false}
|
|
310
|
+
/>
|
|
311
|
+
</div>
|
|
312
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
313
|
+
positive · no label
|
|
314
|
+
</p>
|
|
315
|
+
</div>
|
|
316
|
+
<div className="space-y-2 text-center">
|
|
317
|
+
<div className="flex justify-center">
|
|
318
|
+
<Slider
|
|
319
|
+
orientation="vertical"
|
|
320
|
+
defaultValue={[30, 80]}
|
|
321
|
+
variant="info"
|
|
322
|
+
className="h-48"
|
|
323
|
+
showLabel
|
|
324
|
+
/>
|
|
325
|
+
</div>
|
|
326
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
327
|
+
info · range
|
|
328
|
+
</p>
|
|
329
|
+
</div>
|
|
330
|
+
<div className="space-y-2 text-center">
|
|
331
|
+
<div className="flex justify-center">
|
|
332
|
+
<Slider
|
|
333
|
+
orientation="vertical"
|
|
334
|
+
defaultValue={[40]}
|
|
335
|
+
variant="warning"
|
|
336
|
+
className="h-48"
|
|
337
|
+
showLabel
|
|
338
|
+
label="Temp"
|
|
339
|
+
/>
|
|
340
|
+
</div>
|
|
341
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
342
|
+
warning · custom label
|
|
578
343
|
</p>
|
|
579
344
|
</div>
|
|
580
345
|
</div>
|
|
581
346
|
</div>
|
|
582
|
-
)
|
|
583
|
-
},
|
|
584
|
-
}
|
|
585
|
-
|
|
586
|
-
// 8. Vertical Orientation with Labels
|
|
587
|
-
export const VerticalSlider: Story = {
|
|
588
|
-
render: () => (
|
|
589
|
-
<div className="flex items-center justify-center gap-12 p-8">
|
|
590
|
-
<div className="text-center">
|
|
591
|
-
<h4 className="text-fm-primary mb-4 text-sm font-medium">
|
|
592
|
-
With Labels
|
|
593
|
-
</h4>
|
|
594
|
-
<Slider
|
|
595
|
-
orientation="vertical"
|
|
596
|
-
defaultValue={[60]}
|
|
597
|
-
variant="primary"
|
|
598
|
-
className="h-64"
|
|
599
|
-
showLabel={true}
|
|
600
|
-
/>
|
|
601
|
-
</div>
|
|
602
347
|
|
|
603
|
-
<div className="
|
|
604
|
-
<h4 className="text-fm-
|
|
605
|
-
|
|
606
|
-
</h4>
|
|
607
|
-
<Slider
|
|
608
|
-
orientation="vertical"
|
|
609
|
-
defaultValue={[80]}
|
|
610
|
-
variant="positive"
|
|
611
|
-
className="h-64"
|
|
612
|
-
showLabel={false}
|
|
613
|
-
/>
|
|
614
|
-
</div>
|
|
615
|
-
|
|
616
|
-
<div className="text-center">
|
|
617
|
-
<h4 className="text-fm-primary mb-4 text-sm font-medium">
|
|
618
|
-
Custom Label
|
|
348
|
+
<div className="space-y-4">
|
|
349
|
+
<h4 className="text-fm-secondary font-fm-text text-fm-md leading-fm-md font-medium">
|
|
350
|
+
Label Display
|
|
619
351
|
</h4>
|
|
620
|
-
<
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
352
|
+
<div className="flex flex-wrap gap-8">
|
|
353
|
+
<div className="min-w-48 space-y-2 text-center">
|
|
354
|
+
<Slider defaultValue={[60]} variant="primary" showLabel />
|
|
355
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
356
|
+
numeric value
|
|
357
|
+
</p>
|
|
358
|
+
</div>
|
|
359
|
+
<div className="min-w-48 space-y-2 text-center">
|
|
360
|
+
<Slider
|
|
361
|
+
defaultValue={[75]}
|
|
362
|
+
variant="positive"
|
|
363
|
+
showLabel
|
|
364
|
+
label="High"
|
|
365
|
+
/>
|
|
366
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
367
|
+
custom text
|
|
368
|
+
</p>
|
|
369
|
+
</div>
|
|
370
|
+
<div className="min-w-48 space-y-2 text-center">
|
|
371
|
+
<Slider defaultValue={[40]} variant="warning" showLabel={false} />
|
|
372
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
373
|
+
no label
|
|
374
|
+
</p>
|
|
375
|
+
</div>
|
|
376
|
+
</div>
|
|
639
377
|
</div>
|
|
640
378
|
</div>
|
|
641
379
|
),
|
|
642
380
|
parameters: {
|
|
643
|
-
layout: "
|
|
381
|
+
layout: "padded",
|
|
382
|
+
docs: {
|
|
383
|
+
description: {
|
|
384
|
+
story:
|
|
385
|
+
"Configuration axes: thumb alignment (bottom/center/top), range mode with dual thumbs, vertical orientation, and label display options.",
|
|
386
|
+
},
|
|
387
|
+
},
|
|
644
388
|
},
|
|
645
389
|
}
|
|
646
390
|
|
|
647
|
-
//
|
|
648
|
-
export const CustomStyling: Story = {
|
|
649
|
-
render: () => (
|
|
650
|
-
<div className="w-80 space-y-6 p-8">
|
|
651
|
-
<div className="mb-6">
|
|
652
|
-
<h3 className="text-fm-primary mb-2 text-lg font-medium">
|
|
653
|
-
Custom Styling
|
|
654
|
-
</h3>
|
|
655
|
-
<p className="text-fm-secondary text-sm">
|
|
656
|
-
Override default styles with custom classes
|
|
657
|
-
</p>
|
|
658
|
-
</div>
|
|
659
|
-
|
|
660
|
-
<div className="space-y-6">
|
|
661
|
-
<div>
|
|
662
|
-
<label className="text-fm-primary mb-2 block text-sm font-medium">
|
|
663
|
-
Custom Track & Range
|
|
664
|
-
</label>
|
|
665
|
-
<Slider
|
|
666
|
-
defaultValue={[40]}
|
|
667
|
-
showLabel={true}
|
|
668
|
-
classes={{
|
|
669
|
-
track: "bg-purple-900/40 rounded-full",
|
|
670
|
-
range:
|
|
671
|
-
"bg-gradient-to-r from-purple-400 to-pink-400 rounded-full",
|
|
672
|
-
}}
|
|
673
|
-
/>
|
|
674
|
-
</div>
|
|
675
|
-
|
|
676
|
-
<div>
|
|
677
|
-
<label className="text-fm-primary mb-2 block text-sm font-medium">
|
|
678
|
-
Custom Thumb Styling
|
|
679
|
-
</label>
|
|
680
|
-
<Slider
|
|
681
|
-
defaultValue={[70]}
|
|
682
|
-
variant="primary"
|
|
683
|
-
showLabel={true}
|
|
684
|
-
classes={{
|
|
685
|
-
thumb:
|
|
686
|
-
"bg-white text-gray-900 border-2 border-fm-primary-500 ring-fm-primary-200 rounded-full shadow-lg",
|
|
687
|
-
}}
|
|
688
|
-
/>
|
|
689
|
-
</div>
|
|
391
|
+
// ─── 4. Interactive ───────────────────────────────────────────────────────────
|
|
690
392
|
|
|
691
|
-
|
|
692
|
-
<label className="text-fm-primary mb-2 block text-sm font-medium">
|
|
693
|
-
Gradient with Custom Root
|
|
694
|
-
</label>
|
|
695
|
-
<Slider
|
|
696
|
-
defaultValue={[55]}
|
|
697
|
-
showLabel={true}
|
|
698
|
-
label="Style"
|
|
699
|
-
classes={{
|
|
700
|
-
root: "p-2 bg-gray-900/20 rounded-lg",
|
|
701
|
-
range: "bg-gradient-to-r from-cyan-400 to-blue-500 rounded-full",
|
|
702
|
-
thumb:
|
|
703
|
-
"bg-gradient-to-r from-cyan-400 to-blue-500 border-0 shadow-xl",
|
|
704
|
-
}}
|
|
705
|
-
/>
|
|
706
|
-
</div>
|
|
707
|
-
</div>
|
|
708
|
-
</div>
|
|
709
|
-
),
|
|
710
|
-
}
|
|
711
|
-
|
|
712
|
-
// 10. Complete Interactive Showcase
|
|
713
|
-
export const CompleteShowcase: Story = {
|
|
393
|
+
export const Interactive: Story = {
|
|
714
394
|
render: () => {
|
|
715
|
-
const [
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
const updateSetting = (key: string, value: number[]) => {
|
|
725
|
-
setSettings((prev) => ({ ...prev, [key]: value }))
|
|
726
|
-
}
|
|
727
|
-
|
|
728
|
-
const getQualityLabel = (value: number) => {
|
|
729
|
-
const labels = ["Low", "Medium", "High", "Ultra", "Max"]
|
|
730
|
-
return labels[value - 1] || "Unknown"
|
|
395
|
+
const [volume, setVolume] = React.useState([72])
|
|
396
|
+
const [brightness, setBrightness] = React.useState([55])
|
|
397
|
+
|
|
398
|
+
const getVolumeIcon = (v: number) => {
|
|
399
|
+
if (v === 0) return "Muted"
|
|
400
|
+
if (v < 33) return "Low"
|
|
401
|
+
if (v < 66) return "Mid"
|
|
402
|
+
return "High"
|
|
731
403
|
}
|
|
732
404
|
|
|
733
|
-
const
|
|
734
|
-
|
|
735
|
-
|
|
405
|
+
const getBrightnessLabel = (v: number) => {
|
|
406
|
+
if (v < 25) return "Dim"
|
|
407
|
+
if (v < 50) return "Low"
|
|
408
|
+
if (v < 75) return "Mid"
|
|
409
|
+
return "Bright"
|
|
736
410
|
}
|
|
737
411
|
|
|
738
412
|
return (
|
|
739
|
-
<div className="w-
|
|
740
|
-
<div className="
|
|
741
|
-
<
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
label="Vol"
|
|
766
|
-
/>
|
|
767
|
-
</div>
|
|
768
|
-
</div>
|
|
769
|
-
|
|
770
|
-
{/* Display Settings */}
|
|
771
|
-
<div className="space-y-4">
|
|
772
|
-
<h4 className="text-fm-primary font-medium">Display</h4>
|
|
773
|
-
<div className="space-y-4">
|
|
774
|
-
<div className="space-y-2">
|
|
775
|
-
<div className="flex items-center justify-between">
|
|
776
|
-
<label className="text-fm-secondary text-sm">Brightness</label>
|
|
777
|
-
<span className="text-fm-primary text-sm font-medium">
|
|
778
|
-
{settings.brightness[0]}%
|
|
779
|
-
</span>
|
|
413
|
+
<div className="w-full p-8">
|
|
414
|
+
<div className="mx-auto max-w-3xl space-y-6">
|
|
415
|
+
<div className="grid grid-cols-1 gap-6 lg:grid-cols-3">
|
|
416
|
+
{/* Controls Panel */}
|
|
417
|
+
<div className="border-fm-divider-secondary bg-fm-surface-secondary space-y-5 rounded-xl border p-5">
|
|
418
|
+
<p className="text-fm-primary font-fm-brand text-fm-sm leading-fm-sm font-semibold tracking-widest uppercase">
|
|
419
|
+
Presets
|
|
420
|
+
</p>
|
|
421
|
+
<div className="space-y-2">
|
|
422
|
+
{[
|
|
423
|
+
{ label: "Silent", vol: 0, bright: 20 },
|
|
424
|
+
{ label: "Quiet", vol: 25, bright: 40 },
|
|
425
|
+
{ label: "Default", vol: 72, bright: 55 },
|
|
426
|
+
{ label: "Party", vol: 100, bright: 90 },
|
|
427
|
+
].map(({ label, vol, bright }) => (
|
|
428
|
+
<button
|
|
429
|
+
key={label}
|
|
430
|
+
onClick={() => {
|
|
431
|
+
setVolume([vol])
|
|
432
|
+
setBrightness([bright])
|
|
433
|
+
}}
|
|
434
|
+
className="border-fm-divider-secondary text-fm-secondary hover:bg-fm-surface-secondary hover:text-fm-primary font-fm-text text-fm-sm leading-fm-sm w-full rounded-lg border px-3 py-2 text-left transition-colors"
|
|
435
|
+
>
|
|
436
|
+
{label}
|
|
437
|
+
</button>
|
|
438
|
+
))}
|
|
780
439
|
</div>
|
|
781
|
-
<
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
<span className="text-fm-primary text-sm font-medium">
|
|
794
|
-
{settings.contrast[0]}%
|
|
795
|
-
</span>
|
|
440
|
+
<div className="border-fm-divider-secondary border-t pt-4" />
|
|
441
|
+
<div className="space-y-1">
|
|
442
|
+
<p className="text-fm-primary font-fm-brand text-fm-sm leading-fm-sm font-semibold tracking-widest uppercase">
|
|
443
|
+
Live Values
|
|
444
|
+
</p>
|
|
445
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
446
|
+
Volume: {volume[0]}% · {getVolumeIcon(volume[0])}
|
|
447
|
+
</p>
|
|
448
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
449
|
+
Brightness: {brightness[0]}% ·{" "}
|
|
450
|
+
{getBrightnessLabel(brightness[0])}
|
|
451
|
+
</p>
|
|
796
452
|
</div>
|
|
797
|
-
<Slider
|
|
798
|
-
value={settings.contrast}
|
|
799
|
-
onValueChange={(value) => updateSetting("contrast", value)}
|
|
800
|
-
variant="info"
|
|
801
|
-
size="sm"
|
|
802
|
-
showLabel={true}
|
|
803
|
-
/>
|
|
804
453
|
</div>
|
|
805
|
-
</div>
|
|
806
|
-
</div>
|
|
807
454
|
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
455
|
+
{/* Preview Stage */}
|
|
456
|
+
<div className="flex flex-col gap-3 lg:col-span-2">
|
|
457
|
+
<div className="border-fm-divider-secondary bg-fm-surface-secondary space-y-8 rounded-xl border p-6">
|
|
458
|
+
<div className="space-y-3">
|
|
459
|
+
<div className="flex items-center justify-between">
|
|
460
|
+
<span className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
461
|
+
Volume
|
|
462
|
+
</span>
|
|
463
|
+
<span className="text-fm-primary font-fm-text text-fm-sm leading-fm-sm font-medium">
|
|
464
|
+
{volume[0]}%
|
|
465
|
+
</span>
|
|
466
|
+
</div>
|
|
467
|
+
<Slider
|
|
468
|
+
value={volume}
|
|
469
|
+
onValueChange={setVolume}
|
|
470
|
+
variant="primary"
|
|
471
|
+
size="md"
|
|
472
|
+
showLabel
|
|
473
|
+
label="Vol"
|
|
474
|
+
min={0}
|
|
475
|
+
max={100}
|
|
476
|
+
/>
|
|
477
|
+
</div>
|
|
478
|
+
|
|
479
|
+
<div className="space-y-3">
|
|
480
|
+
<div className="flex items-center justify-between">
|
|
481
|
+
<span className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
482
|
+
Brightness
|
|
483
|
+
</span>
|
|
484
|
+
<span className="text-fm-primary font-fm-text text-fm-sm leading-fm-sm font-medium">
|
|
485
|
+
{brightness[0]}%
|
|
486
|
+
</span>
|
|
487
|
+
</div>
|
|
488
|
+
<Slider
|
|
489
|
+
value={brightness}
|
|
490
|
+
onValueChange={setBrightness}
|
|
491
|
+
variant="warning"
|
|
492
|
+
size="md"
|
|
493
|
+
showLabel
|
|
494
|
+
label="Lux"
|
|
495
|
+
min={0}
|
|
496
|
+
max={100}
|
|
497
|
+
/>
|
|
498
|
+
</div>
|
|
843
499
|
</div>
|
|
844
|
-
<Slider
|
|
845
|
-
value={settings.quality}
|
|
846
|
-
onValueChange={(value) => updateSetting("quality", value)}
|
|
847
|
-
variant="secondary"
|
|
848
|
-
min={1}
|
|
849
|
-
max={5}
|
|
850
|
-
step={1}
|
|
851
|
-
showLabel={true}
|
|
852
|
-
label={getQualityLabel(settings.quality[0])}
|
|
853
|
-
/>
|
|
854
|
-
</div>
|
|
855
500
|
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
501
|
+
<div className="border-fm-divider-secondary bg-fm-surface-secondary rounded-lg border px-4 py-3">
|
|
502
|
+
<code
|
|
503
|
+
className="text-fm-secondary text-fm-md leading-fm-md"
|
|
504
|
+
style={{ fontFamily: "var(--font-fm-mono)" }}
|
|
505
|
+
>
|
|
506
|
+
{`<Slider value={[${volume[0]}]} variant="primary" showLabel label="Vol" />`}
|
|
507
|
+
</code>
|
|
862
508
|
</div>
|
|
863
|
-
<Slider
|
|
864
|
-
value={settings.mode}
|
|
865
|
-
onValueChange={(value) => updateSetting("mode", value)}
|
|
866
|
-
variant="positive"
|
|
867
|
-
min={1}
|
|
868
|
-
max={3}
|
|
869
|
-
step={1}
|
|
870
|
-
showLabel={true}
|
|
871
|
-
label={getModeLabel(settings.mode[0])}
|
|
872
|
-
classes={{
|
|
873
|
-
thumb: "rounded-full shadow-lg",
|
|
874
|
-
}}
|
|
875
|
-
/>
|
|
876
509
|
</div>
|
|
877
510
|
</div>
|
|
878
511
|
</div>
|
|
879
|
-
|
|
880
|
-
{/* Settings Summary */}
|
|
881
|
-
<div className="bg-fm-surface-secondary/20 mt-8 rounded-lg p-4">
|
|
882
|
-
<h5 className="text-fm-primary mb-2 font-medium">Current Settings</h5>
|
|
883
|
-
<div className="text-fm-secondary space-y-1 text-sm">
|
|
884
|
-
<div>Volume: {settings.volume[0]}%</div>
|
|
885
|
-
<div>Brightness: {settings.brightness[0]}%</div>
|
|
886
|
-
<div>Contrast: {settings.contrast[0]}%</div>
|
|
887
|
-
<div>
|
|
888
|
-
Temperature: {settings.temperature[0]}° -{" "}
|
|
889
|
-
{settings.temperature[1]}°C
|
|
890
|
-
</div>
|
|
891
|
-
<div>Quality: {getQualityLabel(settings.quality[0])}</div>
|
|
892
|
-
<div>Mode: {getModeLabel(settings.mode[0])}</div>
|
|
893
|
-
</div>
|
|
894
|
-
</div>
|
|
895
512
|
</div>
|
|
896
513
|
)
|
|
897
514
|
},
|
|
898
515
|
parameters: {
|
|
899
516
|
layout: "fullscreen",
|
|
517
|
+
docs: {
|
|
518
|
+
description: {
|
|
519
|
+
story:
|
|
520
|
+
"Live volume and brightness sliders with preset buttons and real-time value display. Demonstrates controlled state and label customization.",
|
|
521
|
+
},
|
|
522
|
+
},
|
|
900
523
|
},
|
|
901
524
|
}
|