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.
Files changed (175) hide show
  1. package/README.md +8 -1
  2. package/dist/components/aspect-ratio/AspectRatio.stories.tsx +290 -1228
  3. package/dist/components/avatar/Avatar.stories.tsx +219 -235
  4. package/dist/components/badge/Badge.stories.tsx +379 -116
  5. package/dist/components/banner/Banner.stories.tsx +445 -391
  6. package/dist/components/breadcrumb/Breadcrumb.stories.tsx +453 -199
  7. package/dist/components/button/Button.stories.tsx +585 -230
  8. package/dist/components/card/Card.stories.tsx +619 -301
  9. package/dist/components/char-count/CharCount.stories.tsx +350 -248
  10. package/dist/components/checkbox/Checkbox.stories.tsx +309 -167
  11. package/dist/components/chip/Chip.stories.tsx +362 -168
  12. package/dist/components/circular-loader/CircularLoader.stories.tsx +221 -636
  13. package/dist/components/clamp-lines/ClampLines.stories.tsx +246 -117
  14. package/dist/components/collapsible/Collapsible.stories.tsx +391 -252
  15. package/dist/components/command/Command.stories.tsx +530 -867
  16. package/dist/components/dialog/Dialog.stories.tsx +501 -950
  17. package/dist/components/divider/Divider.stories.tsx +264 -527
  18. package/dist/components/dot-loader/DotLoader.stories.tsx +256 -257
  19. package/dist/components/drawer/Drawer.stories.tsx +659 -1023
  20. package/dist/components/dropdown/Dropdown.stories.tsx +643 -1028
  21. package/dist/components/form/Form.stories.tsx +560 -274
  22. package/dist/components/helper-text/HelperText.stories.tsx +199 -200
  23. package/dist/components/hover-card/HoverCard.stories.tsx +318 -1254
  24. package/dist/components/icon-button/IconButton.stories.tsx +837 -194
  25. package/dist/components/if-else/if-else.stories.tsx +370 -83
  26. package/dist/components/input/Input.stories.tsx +436 -368
  27. package/dist/components/label/Label.stories.tsx +156 -154
  28. package/dist/components/list/List.stories.tsx +484 -835
  29. package/dist/components/marquee/Marquee.stories.tsx +356 -712
  30. package/dist/components/otp-inputs/OtpInputs.stories.tsx +352 -422
  31. package/dist/components/overlay/Overlay.stories.tsx +452 -824
  32. package/dist/components/pagination/Pagination.stories.tsx +721 -210
  33. package/dist/components/popover/Popover.stories.tsx +481 -896
  34. package/dist/components/radio/Radio.stories.tsx +432 -124
  35. package/dist/components/resizable/Resizable.stories.tsx +495 -799
  36. package/dist/components/scroll-area/ScrollArea.stories.tsx +383 -1059
  37. package/dist/components/search/Search.stories.tsx +312 -595
  38. package/dist/components/select/Select.stories.tsx +684 -789
  39. package/dist/components/sheet/Sheet.stories.tsx +671 -950
  40. package/dist/components/skelton/Skelton.stories.tsx +230 -764
  41. package/dist/components/slider/Slider.stories.tsx +383 -760
  42. package/dist/components/stepper/Stepper.stories.tsx +371 -514
  43. package/dist/components/switch/Switch.stories.tsx +461 -208
  44. package/dist/components/switch-case/SwitchCase.stories.tsx +367 -188
  45. package/dist/components/table/Table.stories.tsx +770 -916
  46. package/dist/components/tabs/Tabs.stories.tsx +458 -1455
  47. package/dist/components/tag/Tag.stories.tsx +714 -542
  48. package/dist/components/textarea/TextArea.stories.tsx +621 -562
  49. package/dist/components/thumbnail-tags/ThumbnailTags.stories.tsx +228 -154
  50. package/dist/components/toast/Toast.stories.tsx +452 -1339
  51. package/dist/components/toggle/Toggle.stories.tsx +488 -931
  52. package/dist/components/tooltip/Tooltip.stories.tsx +344 -1388
  53. package/dist/components/typography/Typography.stories.tsx +406 -89
  54. package/dist/hooks/use-change-state/UseChangeState.stories.tsx +309 -606
  55. package/dist/hooks/use-previous/UsePrevious.stories.tsx +367 -917
  56. package/dist/hooks/use-standalone-pagination/UseStandalonePagination.stories.tsx +639 -867
  57. package/dist/icons/Icons.stories.tsx +0 -12
  58. package/dist/icons/ai-avatar-icon/AiAvatarIcon.stories.tsx +223 -1060
  59. package/dist/icons/alert-icon/AlertIcon.stories.tsx +106 -968
  60. package/dist/icons/all-icons.tsx +37 -16
  61. package/dist/icons/angle-down-icon/AngleDownIcon.stories.tsx +137 -1010
  62. package/dist/icons/apple-logo-icon/AppleLogoIcon.stories.tsx +145 -935
  63. package/dist/icons/arrow-box-left-icon/ArrowBoxLeftIcon.stories.tsx +132 -1046
  64. package/dist/icons/arrow-corner-up-left-icon/ArrowCornerUpLeftIcon.stories.tsx +134 -986
  65. package/dist/icons/arrow-corner-up-right-icon/ArrowCornerUpRightIcon.stories.tsx +135 -1028
  66. package/dist/icons/arrow-left-icon/ArrowLeftIcon.stories.tsx +133 -971
  67. package/dist/icons/arrow-right-icon/ArrowRightIcon.stories.tsx +145 -1123
  68. package/dist/icons/arrow-right-up-icon/ArrowRightUpIcon.stories.tsx +143 -1252
  69. package/dist/icons/art-board-icon/ArtBoardIcon.stories.tsx +123 -632
  70. package/dist/icons/audio-bar-icon/AudioBarIcon.stories.tsx +141 -1223
  71. package/dist/icons/backward-ten-seconds-icon/BackwardTenSecondsIcon.stories.tsx +164 -1018
  72. package/dist/icons/bubble-check-icon/BubbleCheckIcon.stories.tsx +121 -1236
  73. package/dist/icons/bubble-crossed-icon/BubbleCrossedIcon.stories.tsx +121 -1213
  74. package/dist/icons/bubble-sparkle-icon/BubbleSparkleIcon.stories.tsx +116 -893
  75. package/dist/icons/camera-icon/CameraIcon.stories.tsx +109 -1254
  76. package/dist/icons/capital-a-letter-icon/CapitalALetterIcon.stories.tsx +114 -975
  77. package/dist/icons/chevron-double-left-icon/ChevronDoubleLeftIcon.stories.tsx +157 -994
  78. package/dist/icons/chevron-double-right-icon/ChevronDoubleRightIcon.stories.tsx +160 -992
  79. package/dist/icons/chevron-down-icon/ChevronDownIcon.stories.tsx +140 -970
  80. package/dist/icons/chevron-left-icon/ChevronLeftIcon.stories.tsx +126 -993
  81. package/dist/icons/chevron-right-icon/ChevronRightIcon.stories.tsx +144 -987
  82. package/dist/icons/chevron-up-icon/ChevronUpIcon.stories.tsx +141 -1007
  83. package/dist/icons/circle-tick-icon/CircleTickIcon.stories.tsx +147 -1187
  84. package/dist/icons/circular-play-icon/CircularPlayIcon.stories.tsx +110 -476
  85. package/dist/icons/coin-icon/CoinIcon.stories.tsx +120 -1364
  86. package/dist/icons/coin-toons-icon/CoinToonsIcon.stories.tsx +113 -1360
  87. package/dist/icons/column-wide-add-icon/ColumnWideAddIcon.stories.tsx +111 -942
  88. package/dist/icons/command-icon/CommandIcon.stories.tsx +124 -1087
  89. package/dist/icons/copy-icon/CopyIcon.stories.tsx +119 -996
  90. package/dist/icons/cross-circle-icon/CrossCircleIcon.stories.tsx +144 -1046
  91. package/dist/icons/cross-icon/CrossIcon.stories.tsx +136 -999
  92. package/dist/icons/download-icon/DownloadIcon.stories.tsx +123 -857
  93. package/dist/icons/edit-big-icon/EditBigIcon.stories.tsx +121 -1080
  94. package/dist/icons/email-icon/EmailIcon.stories.tsx +112 -979
  95. package/dist/icons/expand-icon/ExpandIcon.stories.tsx +109 -1146
  96. package/dist/icons/eye-close-icon/EyeCloseIcon.stories.tsx +141 -1068
  97. package/dist/icons/eye-open-icon/EyeOpenIcon.stories.tsx +140 -1081
  98. package/dist/icons/feature-shine-icon/FeatureShineIcon.stories.tsx +124 -1050
  99. package/dist/icons/file-chart-icon/FileChartIcon.stories.tsx +123 -1091
  100. package/dist/icons/file-text-icon/FileTextIcon.stories.tsx +122 -633
  101. package/dist/icons/filter-bar-row-icon/FilterBarRowIcon.stories.tsx +116 -1087
  102. package/dist/icons/forward-ten-seconds-icon/ForwardTenSecondsIcon.stories.tsx +166 -1020
  103. package/dist/icons/git-branch-icon/GitBranchIcon.stories.tsx +112 -1182
  104. package/dist/icons/git-fork-icon/GitForkIcon.stories.tsx +112 -1155
  105. package/dist/icons/globe-icon/GlobeIcon.stories.tsx +127 -325
  106. package/dist/icons/google-logo-icon/GoogleLogoIcon.stories.tsx +142 -985
  107. package/dist/icons/grip-vertical-icon/GripVerticalIcon.stories.tsx +116 -1217
  108. package/dist/icons/head-icon/HeadIcon.stories.tsx +108 -953
  109. package/dist/icons/heart-icon/HeartIcon.stories.tsx +117 -1060
  110. package/dist/icons/image-avatar-sparkle-icon/ImageAvatarSparkleIcon.stories.tsx +116 -716
  111. package/dist/icons/image-icon/ImageIcon.stories.tsx +102 -1164
  112. package/dist/icons/import-folder-icon/ImportFolderIcon.stories.tsx +108 -1233
  113. package/dist/icons/import-left-arrow-folder-icon/ImportLeftArrowFolderIcon.stories.tsx +133 -1289
  114. package/dist/icons/indian-flag-icon/IndianFlagIcon.stories.tsx +155 -1012
  115. package/dist/icons/instagram-icon/InstagramIcon.stories.tsx +158 -1438
  116. package/dist/icons/layout-column-icon/LayoutColumnIcon.stories.tsx +121 -1011
  117. package/dist/icons/layout-left-icon/LayoutLeftIcon.stories.tsx +116 -981
  118. package/dist/icons/layout-right-icon/LayoutRightIcon.stories.tsx +116 -979
  119. package/dist/icons/light-bulb-simple-icon/LightBulbSimpleIcon.stories.tsx +105 -1252
  120. package/dist/icons/linked-in-icon/LinkedInIcon.stories.tsx +151 -1554
  121. package/dist/icons/magic-book-icon/MagicBookIcon.stories.tsx +107 -1227
  122. package/dist/icons/magic-edit-icon/MagicEditIcon.stories.tsx +116 -707
  123. package/dist/icons/maintenance-icon/MaintenanceIcon.stories.tsx +119 -1226
  124. package/dist/icons/message-icon/MessageIcon.stories.tsx +111 -557
  125. package/dist/icons/minimize-icon/MinimizeIcon.stories.tsx +112 -1198
  126. package/dist/icons/moon-icon/MoonIcon.stories.tsx +117 -557
  127. package/dist/icons/move-horizontal-icon/MoveHorizontalIcon.stories.tsx +106 -1235
  128. package/dist/icons/move-vertical-icon/MoveVerticalIcon.stories.tsx +112 -1185
  129. package/dist/icons/musical-note-icon/MusicalNoteIcon.stories.tsx +116 -1012
  130. package/dist/icons/notepad-icon/NotepadIcon.stories.tsx +108 -1137
  131. package/dist/icons/notes-icon/NotesIcon.stories.tsx +116 -1138
  132. package/dist/icons/page-search-icon/PageSearchIcon.stories.tsx +106 -1146
  133. package/dist/icons/page-text-icon/PageTextIcon.stories.tsx +119 -719
  134. package/dist/icons/paint-roll-icon/PaintRollIcon.stories.tsx +110 -999
  135. package/dist/icons/paper-plane-icon/PaperPlaneIcon.stories.tsx +109 -912
  136. package/dist/icons/pause-icon/PauseIcon.stories.tsx +110 -1041
  137. package/dist/icons/pencil-icon/PencilIcon.stories.tsx +112 -1109
  138. package/dist/icons/phone-icon/PhoneIcon.stories.tsx +112 -1023
  139. package/dist/icons/plus-icon/PlusIcon.stories.tsx +103 -1132
  140. package/dist/icons/pocket-studio-icon/PocketStudioIcon.stories.tsx +104 -870
  141. package/dist/icons/scroll-down-icon/ScrollDownIcon.stories.tsx +99 -476
  142. package/dist/icons/search-icon/SearchIcon.stories.tsx +108 -1161
  143. package/dist/icons/setting-icon/SettingIcon.stories.tsx +104 -1009
  144. package/dist/icons/share-icon/ShareIcon.stories.tsx +117 -1064
  145. package/dist/icons/shield-icon/ShieldIcon.stories.tsx +114 -974
  146. package/dist/icons/site-logo-icon/SiteLogoIcon.stories.tsx +134 -1160
  147. package/dist/icons/skip-backward-icon/SkipBackwardIcon.stories.tsx +169 -1017
  148. package/dist/icons/skip-forward-icon/SkipForwardIcon.stories.tsx +161 -1016
  149. package/dist/icons/sparkles-soft-icon/SparklesSoftIcon.stories.tsx +102 -1001
  150. package/dist/icons/spinner-gradient-icon/SpinnerGradientIcon.stories.tsx +155 -593
  151. package/dist/icons/spinner-solid-icon/SpinnerSolidIcon.stories.tsx +155 -608
  152. package/dist/icons/spinner-solid-neutral-icon/SpinnerSolidINeutralcon.stories.tsx +142 -712
  153. package/dist/icons/star-icon/StarIcon.stories.tsx +120 -946
  154. package/dist/icons/store-coin-icon/StoreCoinIcon.stories.tsx +109 -1013
  155. package/dist/icons/suggestion-icon/SuggestionIcon.stories.tsx +113 -891
  156. package/dist/icons/sun-icon/SunIcon.stories.tsx +117 -864
  157. package/dist/icons/text-color-icon/TextColorIcon.stories.tsx +113 -989
  158. package/dist/icons/text-indicator-icon/TextIndicatorIcon.stories.tsx +120 -1027
  159. package/dist/icons/threads-icon/ThreadsIcon.stories.tsx +153 -1476
  160. package/dist/icons/tick-circle-icon/TickCircleIcon.stories.tsx +143 -1187
  161. package/dist/icons/tick-icon/TickIcon.stories.tsx +142 -1322
  162. package/dist/icons/trash-icon/TrashIcon.stories.tsx +105 -970
  163. package/dist/icons/twitter-x-icon/TwitterXIcon.stories.tsx +154 -1457
  164. package/dist/icons/upload-icon/UploadIcon.stories.tsx +112 -930
  165. package/dist/icons/vertical-menu-icon/VerticalMenuIcon.stories.tsx +115 -1019
  166. package/dist/icons/video-play-list-icon/VideoPlaylistIcon.stories.tsx +122 -1092
  167. package/dist/icons/voice-playing-icon/VoicePlayingIcon.stories.tsx +120 -1401
  168. package/dist/icons/volume-full-icon/VolumeFullIcon.stories.tsx +107 -1212
  169. package/dist/icons/volume-half-icon/VolumeHalfIcon.stories.tsx +109 -1122
  170. package/dist/icons/volume-off-icon/VolumeOffIcon.stories.tsx +112 -1124
  171. package/dist/icons/warning-icon/WarningIcon.stories.tsx +119 -1083
  172. package/dist/icons/youtube-icon/YoutubeIcon.stories.tsx +158 -983
  173. package/dist/index.cjs +90 -90
  174. package/dist/index.js +90 -90
  175. package/package.json +8 -3
@@ -1,9 +1,9 @@
1
- import React from "react"
2
- import { Button } from "@components/button"
1
+ import React, { useState } from "react"
3
2
  import Label from "@components/label"
4
3
  import type { Meta, StoryObj } from "@storybook/react-vite"
5
4
 
6
5
  import { CrossIcon, TickIcon } from "src/ui/icons"
6
+ import { AuralComponentDocsPage } from "src/ui/story-spec/components/component-story-docs-page"
7
7
 
8
8
  import { Switch } from "."
9
9
 
@@ -12,12 +12,29 @@ const meta: Meta<typeof Switch> = {
12
12
  component: Switch,
13
13
  parameters: {
14
14
  layout: "centered",
15
- backgrounds: {
16
- default: "dark",
17
- values: [
18
- { name: "dark", value: "#0a0a0a" },
19
- { name: "light", value: "#ffffff" },
20
- ],
15
+ docs: {
16
+ description: {
17
+ component:
18
+ "A Radix-based toggle switch with three sizes (sm, md, lg), optional icon or text labels inside the track, and support for disabled state. Designed for on/off settings in settings panels, preferences forms, and audio control UIs.",
19
+ },
20
+ page: () => (
21
+ <AuralComponentDocsPage
22
+ features={[
23
+ {
24
+ title: "3 Sizes",
25
+ description: "sm, md, lg scale",
26
+ },
27
+ {
28
+ title: "Track Labels",
29
+ description: "Icon or text in track",
30
+ },
31
+ {
32
+ title: "Disabled State",
33
+ description: "Muted inactive style",
34
+ },
35
+ ]}
36
+ />
37
+ ),
21
38
  },
22
39
  },
23
40
  tags: ["autodocs"],
@@ -36,14 +53,6 @@ const meta: Meta<typeof Switch> = {
36
53
  description: "Size variant of the switch",
37
54
  defaultValue: "md",
38
55
  },
39
- onIcon: {
40
- control: { type: "text" },
41
- description: "Custom icon to display when switch is ON",
42
- },
43
- offIcon: {
44
- control: { type: "text" },
45
- description: "Custom icon to display when switch is OFF",
46
- },
47
56
  switchOnText: {
48
57
  control: { type: "text" },
49
58
  description: "Custom text to display when switch is ON",
@@ -62,237 +71,481 @@ const meta: Meta<typeof Switch> = {
62
71
  export default meta
63
72
  type Story = StoryObj<typeof Switch>
64
73
 
65
- export const Default: Story = {
66
- args: {
67
- checked: false,
68
- },
69
- }
74
+ // ─── 1. Playground ────────────────────────────────────────────────────────────
70
75
 
71
- export const Checked: Story = {
76
+ export const Playground: Story = {
72
77
  args: {
73
- checked: true,
74
- },
75
- }
76
-
77
- export const Disabled: Story = {
78
- args: {
79
- disabled: true,
80
- },
81
- }
82
-
83
- export const DisabledAndChecked: Story = {
84
- args: {
85
- disabled: true,
86
- checked: true,
78
+ checked: false,
79
+ size: "md",
87
80
  },
88
- }
89
-
90
- export const SizeVariants: Story = {
91
- render: () => (
92
- <div className="flex flex-col items-center space-y-4">
93
- <div className="flex items-center space-x-4">
94
- <Switch size="sm" checked={true} />
95
- <span className="text-fm-secondary text-sm">Small (sm)</span>
96
- </div>
97
- <div className="flex items-center space-x-4">
98
- <Switch size="md" checked={true} />
99
- <span className="text-fm-secondary text-sm">Medium (md)</span>
81
+ render: (args) => (
82
+ <div className="w-full max-w-sm space-y-4">
83
+ <div className="flex justify-center">
84
+ <Switch {...args} />
100
85
  </div>
101
- <div className="flex items-center space-x-4">
102
- <Switch size="lg" checked={true} />
103
- <span className="text-fm-secondary text-sm">Large (lg)</span>
86
+ <div className="border-fm-divider-secondary bg-fm-surface-secondary rounded-lg border px-4 py-3">
87
+ <code className="text-fm-secondary text-fm-md leading-fm-md font-(--font-fm-mono)">{`<Switch size="${args.size}" checked={${args.checked}} disabled={${args.disabled ?? false}} />`}</code>
104
88
  </div>
105
89
  </div>
106
90
  ),
107
- }
108
-
109
- export const WithCustomClassNames: Story = {
110
- args: {
111
- checked: true,
112
- classNames: {
113
- root: "border-2 border-blue-500",
114
- onIcon: "text-green-600 font-bold",
115
- offIcon: "text-fm-secondary",
116
- thumb: "bg-blue-500 shadow-xl",
91
+ parameters: {
92
+ docs: {
93
+ description: {
94
+ story:
95
+ "Adjust size, checked, and disabled state using the controls panel in the sidebar.",
96
+ },
117
97
  },
118
98
  },
119
99
  }
120
100
 
121
- export const WithLabel: Story = {
122
- render: () => (
123
- <div className="flex items-center space-x-2">
124
- <Switch id="switch-with-label" value="Toggle me" />
125
- <Label htmlFor="switch-with-label">Toggle me</Label>
126
- </div>
127
- ),
128
- }
101
+ // ─── 2. All Variants ──────────────────────────────────────────────────────────
129
102
 
130
- export const WithForm: Story = {
103
+ export const AllVariants: Story = {
131
104
  render: () => (
132
- <form
133
- onSubmit={(e) => {
134
- e.preventDefault()
135
- // Handle form submission
136
- }}
137
- >
138
- <div className="grid gap-4">
139
- <div className="flex items-center space-x-2">
140
- <Switch id="notifications" />
141
- <Label htmlFor="notifications">Enable notifications</Label>
142
- </div>
143
- <div className="flex items-center space-x-2">
144
- <Switch id="newsletter" defaultChecked />
145
- <Label htmlFor="newsletter">Subscribe to newsletter</Label>
105
+ <div className="space-y-8">
106
+ {/* Size variants */}
107
+ <div className="space-y-4">
108
+ <h4 className="text-fm-secondary font-fm-text text-fm-md leading-fm-md font-medium">
109
+ Size Variants
110
+ </h4>
111
+ <div className="flex flex-wrap items-end gap-8">
112
+ <div className="space-y-2 text-center">
113
+ <div className="flex justify-center">
114
+ <Switch size="sm" checked />
115
+ </div>
116
+ <p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
117
+ Small (sm)
118
+ </p>
119
+ </div>
120
+ <div className="space-y-2 text-center">
121
+ <div className="flex justify-center">
122
+ <Switch size="md" checked />
123
+ </div>
124
+ <p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
125
+ Medium (md)
126
+ </p>
127
+ </div>
128
+ <div className="space-y-2 text-center">
129
+ <div className="flex justify-center">
130
+ <Switch size="lg" checked />
131
+ </div>
132
+ <p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
133
+ Large (lg)
134
+ </p>
135
+ </div>
146
136
  </div>
147
- <Button>Submit</Button>
148
137
  </div>
149
- </form>
150
- ),
151
- }
152
-
153
- export const WithIcons: Story = {
154
- args: {
155
- checked: false,
156
- onIcon: <TickIcon />,
157
- offIcon: <CrossIcon />,
158
- },
159
- }
160
138
 
161
- export const CheckedWithIcons: Story = {
162
- args: {
163
- checked: true,
164
- onIcon: <TickIcon />,
165
- offIcon: <CrossIcon />,
166
- },
167
- }
168
-
169
- export const WithCustomText: Story = {
170
- args: {
171
- checked: false,
172
- switchOnText: "YES",
173
- switchOffText: "NO",
174
- },
175
- }
176
-
177
- export const CheckedWithCustomText: Story = {
178
- args: {
179
- checked: true,
180
- switchOnText: "YES",
181
- switchOffText: "NO",
182
- },
183
- }
184
-
185
- export const WithCustomTextVariants: Story = {
186
- render: () => (
187
- <div className="flex flex-col items-center space-y-4">
188
- <div className="flex items-center space-x-4">
189
- <Switch checked={false} switchOnText="ON" switchOffText="OFF" />
190
- <span className="text-fm-secondary text-sm">Default (ON/OFF)</span>
191
- </div>
192
- <div className="flex items-center space-x-4">
193
- <Switch checked={false} switchOnText="YES" switchOffText="NO" />
194
- <span className="text-fm-secondary text-sm">Yes/No</span>
195
- </div>
196
- <div className="flex items-center space-x-4">
197
- <Switch checked={false} switchOnText="1" switchOffText="0" />
198
- <span className="text-fm-secondary text-sm">Binary (1/0)</span>
199
- </div>
200
- <div className="flex items-center space-x-4">
201
- <Switch checked={false} switchOnText="✓" switchOffText="✗" />
202
- <span className="text-fm-secondary text-sm">Symbols (✓/✗)</span>
203
- </div>
204
- <div className="flex items-center space-x-4">
205
- <Switch checked={false} switchOnText="EN" switchOffText="DIS" />
206
- <span className="text-fm-secondary text-sm">Enable/Disable</span>
139
+ {/* Icon modes */}
140
+ <div className="space-y-4">
141
+ <h4 className="text-fm-secondary font-fm-text text-fm-md leading-fm-md font-medium">
142
+ Icon Modes
143
+ </h4>
144
+ <div className="flex flex-wrap items-end gap-8">
145
+ <div className="space-y-2 text-center">
146
+ <div className="flex justify-center">
147
+ <Switch
148
+ size="md"
149
+ checked={false}
150
+ onIcon={<TickIcon />}
151
+ offIcon={<CrossIcon />}
152
+ />
153
+ </div>
154
+ <p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
155
+ Icons Off
156
+ </p>
157
+ </div>
158
+ <div className="space-y-2 text-center">
159
+ <div className="flex justify-center">
160
+ <Switch
161
+ size="md"
162
+ checked
163
+ onIcon={<TickIcon />}
164
+ offIcon={<CrossIcon />}
165
+ />
166
+ </div>
167
+ <p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
168
+ Icons On
169
+ </p>
170
+ </div>
171
+ <div className="space-y-2 text-center">
172
+ <div className="flex justify-center">
173
+ <Switch
174
+ size="lg"
175
+ checked
176
+ onIcon={<TickIcon />}
177
+ offIcon={<CrossIcon />}
178
+ />
179
+ </div>
180
+ <p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
181
+ Icons — Large On
182
+ </p>
183
+ </div>
184
+ </div>
207
185
  </div>
208
- </div>
209
- ),
210
- }
211
186
 
212
- export const CustomTextWithSizes: Story = {
213
- render: () => (
214
- <div className="flex flex-col items-center space-y-4">
215
- <div className="flex items-center space-x-4">
216
- <Switch
217
- size="sm"
218
- checked={true}
219
- switchOnText="ON"
220
- switchOffText="OFF"
221
- />
222
- <span className="text-fm-secondary text-sm">Small</span>
223
- </div>
224
- <div className="flex items-center space-x-4">
225
- <Switch
226
- size="md"
227
- checked={true}
228
- switchOnText="ON"
229
- switchOffText="OFF"
230
- />
231
- <span className="text-fm-secondary text-sm">Medium</span>
187
+ {/* Text modes */}
188
+ <div className="space-y-4">
189
+ <h4 className="text-fm-secondary font-fm-text text-fm-md leading-fm-md font-medium">
190
+ Text Modes
191
+ </h4>
192
+ <div className="flex flex-wrap items-end gap-8">
193
+ <div className="space-y-2 text-center">
194
+ <div className="flex justify-center">
195
+ <Switch
196
+ size="md"
197
+ checked={false}
198
+ switchOnText="ON"
199
+ switchOffText="OFF"
200
+ />
201
+ </div>
202
+ <p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
203
+ ON / OFF — Off
204
+ </p>
205
+ </div>
206
+ <div className="space-y-2 text-center">
207
+ <div className="flex justify-center">
208
+ <Switch size="md" checked switchOnText="ON" switchOffText="OFF" />
209
+ </div>
210
+ <p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
211
+ ON / OFF — On
212
+ </p>
213
+ </div>
214
+ <div className="space-y-2 text-center">
215
+ <div className="flex justify-center">
216
+ <Switch
217
+ size="md"
218
+ checked={false}
219
+ switchOnText="YES"
220
+ switchOffText="NO"
221
+ />
222
+ </div>
223
+ <p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
224
+ YES / NO — Off
225
+ </p>
226
+ </div>
227
+ <div className="space-y-2 text-center">
228
+ <div className="flex justify-center">
229
+ <Switch size="md" checked switchOnText="YES" switchOffText="NO" />
230
+ </div>
231
+ <p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
232
+ YES / NO — On
233
+ </p>
234
+ </div>
235
+ <div className="space-y-2 text-center">
236
+ <div className="flex justify-center">
237
+ <Switch size="md" checked switchOnText="EN" switchOffText="DIS" />
238
+ </div>
239
+ <p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
240
+ EN / DIS
241
+ </p>
242
+ </div>
243
+ </div>
232
244
  </div>
233
- <div className="flex items-center space-x-4">
234
- <Switch
235
- size="lg"
236
- checked={true}
237
- switchOnText="ON"
238
- switchOffText="OFF"
239
- />
240
- <span className="text-fm-secondary text-sm">Large</span>
245
+
246
+ {/* Custom token styling */}
247
+ <div className="space-y-4">
248
+ <h4 className="text-fm-secondary font-fm-text text-fm-md leading-fm-md font-medium">
249
+ Custom Styling via Design Tokens
250
+ </h4>
251
+ <div className="flex flex-wrap items-end gap-8">
252
+ <div className="space-y-2 text-center">
253
+ <div className="flex justify-center">
254
+ <Switch
255
+ size="md"
256
+ checked
257
+ classNames={{
258
+ root: "border-fm-secondary-500",
259
+ thumb: "bg-fm-secondary-500",
260
+ }}
261
+ />
262
+ </div>
263
+ <p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
264
+ Secondary accent
265
+ </p>
266
+ </div>
267
+ <div className="space-y-2 text-center">
268
+ <div className="flex justify-center">
269
+ <Switch
270
+ size="md"
271
+ checked
272
+ onIcon={<TickIcon />}
273
+ offIcon={<CrossIcon />}
274
+ classNames={{
275
+ root: "border-fm-secondary-500",
276
+ thumb: "bg-fm-secondary-500",
277
+ }}
278
+ />
279
+ </div>
280
+ <p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
281
+ Secondary + Icons
282
+ </p>
283
+ </div>
284
+ </div>
241
285
  </div>
242
286
  </div>
243
287
  ),
288
+ parameters: {
289
+ docs: {
290
+ description: {
291
+ story:
292
+ "Full visual matrix: all three size variants, icon modes (off/on), text label modes, and custom token-based styling — all shown side by side.",
293
+ },
294
+ },
295
+ },
244
296
  }
245
297
 
246
- export const AllVariants: Story = {
298
+ // ─── 3. States ────────────────────────────────────────────────────────────────
299
+
300
+ export const States: Story = {
247
301
  render: () => (
248
- <div className="grid grid-cols-2 gap-6">
302
+ <div className="space-y-8">
249
303
  <div className="space-y-4">
250
- <h3 className="text-lg font-semibold">Size Variants</h3>
251
- <div className="space-y-3">
252
- <div className="flex items-center justify-between">
253
- <span>Small</span>
254
- <Switch size="sm" checked={true} />
304
+ <h4 className="text-fm-secondary font-fm-text text-fm-md leading-fm-md font-medium">
305
+ On / Off
306
+ </h4>
307
+ <div className="flex flex-wrap gap-8">
308
+ <div className="space-y-2 text-center">
309
+ <div className="flex justify-center">
310
+ <Switch size="md" checked={false} />
311
+ </div>
312
+ <p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
313
+ Off
314
+ </p>
255
315
  </div>
256
- <div className="flex items-center justify-between">
257
- <span>Medium</span>
258
- <Switch size="md" checked={true} />
316
+ <div className="space-y-2 text-center">
317
+ <div className="flex justify-center">
318
+ <Switch size="md" checked />
319
+ </div>
320
+ <p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
321
+ On
322
+ </p>
259
323
  </div>
260
- <div className="flex items-center justify-between">
261
- <span>Large</span>
262
- <Switch size="lg" checked={true} />
324
+ </div>
325
+ </div>
326
+
327
+ <div className="space-y-4">
328
+ <h4 className="text-fm-secondary font-fm-text text-fm-md leading-fm-md font-medium">
329
+ Disabled
330
+ </h4>
331
+ <div className="flex flex-wrap gap-8">
332
+ <div className="space-y-2 text-center">
333
+ <div className="flex justify-center">
334
+ <Switch size="md" checked={false} disabled />
335
+ </div>
336
+ <p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
337
+ Disabled — Off
338
+ </p>
339
+ </div>
340
+ <div className="space-y-2 text-center">
341
+ <div className="flex justify-center">
342
+ <Switch size="md" checked disabled />
343
+ </div>
344
+ <p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
345
+ Disabled — On
346
+ </p>
263
347
  </div>
264
348
  </div>
265
349
  </div>
266
350
 
267
351
  <div className="space-y-4">
268
- <h3 className="text-lg font-semibold">With Custom Styling</h3>
352
+ <h4 className="text-fm-secondary font-fm-text text-fm-md leading-fm-md font-medium">
353
+ All States — With Labels
354
+ </h4>
269
355
  <div className="space-y-3">
270
- <div className="flex items-center justify-between">
271
- <span>Custom Colors</span>
272
- <Switch
273
- size="md"
274
- checked={true}
275
- classNames={{
276
- root: "border-2 border-purple-500",
277
- thumb: "bg-purple-500",
278
- }}
279
- />
356
+ <div className="flex items-center gap-3">
357
+ <Switch id="st-off" size="md" checked={false} />
358
+ <Label htmlFor="st-off">Off</Label>
359
+ </div>
360
+ <div className="flex items-center gap-3">
361
+ <Switch id="st-on" size="md" checked />
362
+ <Label htmlFor="st-on">On</Label>
280
363
  </div>
281
- <div className="flex items-center justify-between">
282
- <span>With Icons</span>
283
- <Switch
284
- size="md"
285
- checked={true}
286
- onIcon={<TickIcon />}
287
- offIcon={<CrossIcon />}
288
- />
364
+ <div className="flex items-center gap-3">
365
+ <Switch id="st-dis-off" size="md" checked={false} disabled />
366
+ <Label htmlFor="st-dis-off" disabled>
367
+ Disabled — Off
368
+ </Label>
289
369
  </div>
290
- <div className="flex items-center justify-between">
291
- <span>Disabled</span>
292
- <Switch size="md" checked={true} disabled />
370
+ <div className="flex items-center gap-3">
371
+ <Switch id="st-dis-on" size="md" checked disabled />
372
+ <Label htmlFor="st-dis-on" disabled>
373
+ Disabled — On
374
+ </Label>
293
375
  </div>
294
376
  </div>
295
377
  </div>
296
378
  </div>
297
379
  ),
380
+ parameters: {
381
+ docs: {
382
+ description: {
383
+ story:
384
+ "All four switch states — off, on, disabled-off, and disabled-on — shown as item cards and with label pairings.",
385
+ },
386
+ },
387
+ },
388
+ }
389
+
390
+ // ─── 4. Use Cases ─────────────────────────────────────────────────────────────
391
+
392
+ export const UseCases: Story = {
393
+ render: () => {
394
+ const [autoplay, setAutoplay] = useState(true)
395
+ const [shuffle, setShuffle] = useState(false)
396
+ const [crossfade, setCrossfade] = useState(false)
397
+ const [notifications, setNotifications] = useState(true)
398
+ const [offlineMode, setOfflineMode] = useState(false)
399
+ const [dataReducer, setDataReducer] = useState(false)
400
+
401
+ return (
402
+ <div className="mx-auto max-w-3xl space-y-8 p-8">
403
+ {/* Playback Settings */}
404
+ <div className="space-y-4">
405
+ <h4 className="text-fm-secondary font-fm-text text-fm-md leading-fm-md font-medium">
406
+ Playback Settings
407
+ </h4>
408
+ <div className="border-fm-divider-secondary bg-fm-surface-secondary mx-auto max-w-md space-y-1 rounded-xl border p-5">
409
+ <div className="flex items-center justify-between gap-4 py-1">
410
+ <div>
411
+ <Label htmlFor="uc-autoplay">Autoplay</Label>
412
+ <p className="text-fm-tertiary font-fm-text text-fm-sm leading-fm-sm mt-0.5">
413
+ Continue playing similar tracks when queue ends
414
+ </p>
415
+ </div>
416
+ <Switch
417
+ id="uc-autoplay"
418
+ size="md"
419
+ checked={autoplay}
420
+ onCheckedChange={setAutoplay}
421
+ onIcon={<TickIcon />}
422
+ offIcon={<CrossIcon />}
423
+ />
424
+ </div>
425
+ <div className="border-fm-divider-secondary border-t" />
426
+ <div className="flex items-center justify-between gap-4 py-1">
427
+ <div>
428
+ <Label htmlFor="uc-shuffle">Shuffle</Label>
429
+ <p className="text-fm-tertiary font-fm-text text-fm-sm leading-fm-sm mt-0.5">
430
+ Play tracks in a random order
431
+ </p>
432
+ </div>
433
+ <Switch
434
+ id="uc-shuffle"
435
+ size="md"
436
+ checked={shuffle}
437
+ onCheckedChange={setShuffle}
438
+ onIcon={<TickIcon />}
439
+ offIcon={<CrossIcon />}
440
+ />
441
+ </div>
442
+ <div className="border-fm-divider-secondary border-t" />
443
+ <div className="flex items-center justify-between gap-4 py-1">
444
+ <div>
445
+ <Label htmlFor="uc-crossfade">Crossfade</Label>
446
+ <p className="text-fm-tertiary font-fm-text text-fm-sm leading-fm-sm mt-0.5">
447
+ Smooth transitions between tracks
448
+ </p>
449
+ </div>
450
+ <Switch
451
+ id="uc-crossfade"
452
+ size="md"
453
+ checked={crossfade}
454
+ onCheckedChange={setCrossfade}
455
+ onIcon={<TickIcon />}
456
+ offIcon={<CrossIcon />}
457
+ />
458
+ </div>
459
+ </div>
460
+ </div>
461
+
462
+ {/* App Preferences */}
463
+ <div className="space-y-4">
464
+ <h4 className="text-fm-secondary font-fm-text text-fm-md leading-fm-md font-medium">
465
+ App Preferences
466
+ </h4>
467
+ <div className="border-fm-divider-secondary bg-fm-surface-secondary mx-auto max-w-md space-y-1 rounded-xl border p-5">
468
+ <div className="flex items-center justify-between gap-4 py-1">
469
+ <div>
470
+ <Label htmlFor="uc-notifications">Push Notifications</Label>
471
+ <p className="text-fm-tertiary font-fm-text text-fm-sm leading-fm-sm mt-0.5">
472
+ New releases, live events, and activity
473
+ </p>
474
+ </div>
475
+ <Switch
476
+ id="uc-notifications"
477
+ size="sm"
478
+ checked={notifications}
479
+ onCheckedChange={setNotifications}
480
+ switchOnText="ON"
481
+ switchOffText="OFF"
482
+ />
483
+ </div>
484
+ <div className="border-fm-divider-secondary border-t" />
485
+ <div className="flex items-center justify-between gap-4 py-1">
486
+ <div>
487
+ <Label htmlFor="uc-offline">Offline Mode</Label>
488
+ <p className="text-fm-tertiary font-fm-text text-fm-sm leading-fm-sm mt-0.5">
489
+ Only play downloaded tracks
490
+ </p>
491
+ </div>
492
+ <Switch
493
+ id="uc-offline"
494
+ size="sm"
495
+ checked={offlineMode}
496
+ onCheckedChange={setOfflineMode}
497
+ switchOnText="ON"
498
+ switchOffText="OFF"
499
+ />
500
+ </div>
501
+ <div className="border-fm-divider-secondary border-t" />
502
+ <div className="flex items-center justify-between gap-4 py-1">
503
+ <div>
504
+ <Label htmlFor="uc-data-reducer">Data Saver</Label>
505
+ <p className="text-fm-tertiary font-fm-text text-fm-sm leading-fm-sm mt-0.5">
506
+ Stream at lower quality to reduce data usage
507
+ </p>
508
+ </div>
509
+ <Switch
510
+ id="uc-data-reducer"
511
+ size="sm"
512
+ checked={dataReducer}
513
+ onCheckedChange={setDataReducer}
514
+ switchOnText="ON"
515
+ switchOffText="OFF"
516
+ />
517
+ </div>
518
+ <div className="border-fm-divider-secondary border-t" />
519
+ <div className="flex items-center justify-between gap-4 py-1">
520
+ <div>
521
+ <Label htmlFor="uc-explicit" disabled>
522
+ Explicit Content
523
+ </Label>
524
+ <p className="text-fm-tertiary font-fm-text text-fm-sm leading-fm-sm mt-0.5">
525
+ Requires a premium account
526
+ </p>
527
+ </div>
528
+ <Switch
529
+ id="uc-explicit"
530
+ size="sm"
531
+ checked={false}
532
+ disabled
533
+ switchOnText="ON"
534
+ switchOffText="OFF"
535
+ />
536
+ </div>
537
+ </div>
538
+ </div>
539
+ </div>
540
+ )
541
+ },
542
+ parameters: {
543
+ layout: "fullscreen",
544
+ docs: {
545
+ description: {
546
+ story:
547
+ "Real-world audio app scenarios: a playback settings panel using icon-mode switches, and an app preferences panel using text-mode switches including a disabled locked setting.",
548
+ },
549
+ },
550
+ },
298
551
  }