aural-ui 2.0.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/LICENSE +21 -0
- package/README.md +456 -0
- package/dist/components/aspect-ratio/AspectRatio.stories.tsx +1327 -0
- package/dist/components/aspect-ratio/index.tsx +10 -0
- package/dist/components/aspect-ratio/meta.ts +8 -0
- package/dist/components/avatar/Avatar.stories.tsx +645 -0
- package/dist/components/avatar/index.tsx +50 -0
- package/dist/components/avatar/meta.ts +8 -0
- package/dist/components/badge/Badge.stories.tsx +169 -0
- package/dist/components/badge/index.tsx +28 -0
- package/dist/components/badge/meta.ts +6 -0
- package/dist/components/banner/Banner.stories.tsx +475 -0
- package/dist/components/banner/index.tsx +256 -0
- package/dist/components/banner/meta.ts +36 -0
- package/dist/components/button/Button.stories.tsx +74 -0
- package/dist/components/button/index.tsx +158 -0
- package/dist/components/button/meta.ts +33 -0
- package/dist/components/card/Card.stories.tsx +377 -0
- package/dist/components/card/index.tsx +85 -0
- package/dist/components/card/meta.ts +14 -0
- package/dist/components/char-count/CharCount.stories.tsx +334 -0
- package/dist/components/char-count/index.tsx +51 -0
- package/dist/components/char-count/meta.ts +13 -0
- package/dist/components/checkbox/Checkbox.stories.tsx +209 -0
- package/dist/components/checkbox/index.tsx +34 -0
- package/dist/components/checkbox/meta.ts +19 -0
- package/dist/components/chip/Chip.stories.tsx +207 -0
- package/dist/components/chip/index.tsx +92 -0
- package/dist/components/chip/meta.ts +17 -0
- package/dist/components/circular-loader/CircularLoader.stories.tsx +741 -0
- package/dist/components/circular-loader/index.tsx +138 -0
- package/dist/components/circular-loader/meta.ts +11 -0
- package/dist/components/collapsible/Collapsible.stories.tsx +319 -0
- package/dist/components/collapsible/index.tsx +158 -0
- package/dist/components/collapsible/meta.ts +22 -0
- package/dist/components/command/Command.stories.tsx +996 -0
- package/dist/components/command/index.tsx +324 -0
- package/dist/components/command/meta.ts +18 -0
- package/dist/components/dialog/Dialog.stories.tsx +963 -0
- package/dist/components/dialog/index.tsx +250 -0
- package/dist/components/dialog/meta.ts +28 -0
- package/dist/components/divider/Divider.stories.tsx +633 -0
- package/dist/components/divider/index.tsx +181 -0
- package/dist/components/divider/meta.ts +12 -0
- package/dist/components/dot-loader/DotLoader.stories.tsx +352 -0
- package/dist/components/dot-loader/index.tsx +78 -0
- package/dist/components/dot-loader/meta.ts +14 -0
- package/dist/components/dropdown/Dropdown.stories.tsx +1210 -0
- package/dist/components/dropdown/index.tsx +479 -0
- package/dist/components/dropdown/meta.ts +21 -0
- package/dist/components/form/Form.stories.tsx +320 -0
- package/dist/components/form/index.tsx +183 -0
- package/dist/components/form/meta.ts +11 -0
- package/dist/components/helper-text/HelperText.stories.tsx +254 -0
- package/dist/components/helper-text/index.tsx +102 -0
- package/dist/components/helper-text/meta.ts +18 -0
- package/dist/components/hover-card/HoverCard.stories.tsx +1328 -0
- package/dist/components/hover-card/index.tsx +42 -0
- package/dist/components/hover-card/meta.ts +12 -0
- package/dist/components/icon-button/IconButton.stories.tsx +252 -0
- package/dist/components/icon-button/index.tsx +130 -0
- package/dist/components/icon-button/meta.ts +20 -0
- package/dist/components/if-else/if-else.stories.tsx +100 -0
- package/dist/components/if-else/index.tsx +56 -0
- package/dist/components/if-else/meta.ts +6 -0
- package/dist/components/index.ts +70 -0
- package/dist/components/input/Input.stories.tsx +431 -0
- package/dist/components/input/index.tsx +487 -0
- package/dist/components/input/meta.ts +28 -0
- package/dist/components/label/Label.stories.tsx +200 -0
- package/dist/components/label/index.tsx +43 -0
- package/dist/components/label/meta.ts +14 -0
- package/dist/components/list/List.stories.tsx +963 -0
- package/dist/components/list/index.tsx +567 -0
- package/dist/components/list/meta.ts +24 -0
- package/dist/components/marquee/Marquee.stories.tsx +819 -0
- package/dist/components/marquee/index.tsx +107 -0
- package/dist/components/marquee/meta.ts +6 -0
- package/dist/components/overlay/Overlay.stories.tsx +954 -0
- package/dist/components/overlay/index.tsx +58 -0
- package/dist/components/overlay/meta.ts +10 -0
- package/dist/components/pagination/Pagination.stories.tsx +354 -0
- package/dist/components/pagination/index.tsx +455 -0
- package/dist/components/pagination/meta.ts +29 -0
- package/dist/components/popover/Popover.stories.tsx +1037 -0
- package/dist/components/popover/index.tsx +67 -0
- package/dist/components/popover/meta.ts +12 -0
- package/dist/components/radio/Radio.stories.tsx +146 -0
- package/dist/components/radio/index.tsx +41 -0
- package/dist/components/radio/meta.ts +19 -0
- package/dist/components/resizable/Resizable.stories.tsx +866 -0
- package/dist/components/resizable/index.tsx +55 -0
- package/dist/components/resizable/meta.ts +12 -0
- package/dist/components/scroll-area/ScrollArea.stories.tsx +1104 -0
- package/dist/components/scroll-area/index.tsx +55 -0
- package/dist/components/scroll-area/meta.ts +8 -0
- package/dist/components/search/Search.stories.tsx +678 -0
- package/dist/components/search/index.tsx +141 -0
- package/dist/components/search/meta.ts +6 -0
- package/dist/components/select/Select.stories.tsx +962 -0
- package/dist/components/select/index.tsx +512 -0
- package/dist/components/select/meta.ts +40 -0
- package/dist/components/sheet/Sheet.stories.tsx +1060 -0
- package/dist/components/sheet/index.tsx +440 -0
- package/dist/components/sheet/meta.ts +38 -0
- package/dist/components/skelton/Skelton.stories.tsx +859 -0
- package/dist/components/skelton/index.tsx +17 -0
- package/dist/components/skelton/meta.ts +6 -0
- package/dist/components/slider/Slider.stories.tsx +876 -0
- package/dist/components/slider/index.tsx +156 -0
- package/dist/components/slider/meta.ts +29 -0
- package/dist/components/stepper/Stepper.stories.tsx +639 -0
- package/dist/components/stepper/index.tsx +650 -0
- package/dist/components/stepper/meta.ts +19 -0
- package/dist/components/switch/Switch.stories.tsx +85 -0
- package/dist/components/switch/index.tsx +37 -0
- package/dist/components/switch/meta.ts +24 -0
- package/dist/components/switch-case/SwitchCase.stories.tsx +209 -0
- package/dist/components/switch-case/index.tsx +89 -0
- package/dist/components/switch-case/meta.ts +6 -0
- package/dist/components/table/Table.stories.tsx +1095 -0
- package/dist/components/table/index.tsx +113 -0
- package/dist/components/table/meta.ts +20 -0
- package/dist/components/tabs/Tabs.stories.tsx +1379 -0
- package/dist/components/tabs/index.tsx +186 -0
- package/dist/components/tabs/meta.ts +25 -0
- package/dist/components/tag/Tag.stories.tsx +625 -0
- package/dist/components/tag/index.tsx +320 -0
- package/dist/components/tag/meta.ts +52 -0
- package/dist/components/textarea/TextArea.stories.tsx +723 -0
- package/dist/components/textarea/index.tsx +480 -0
- package/dist/components/textarea/meta.ts +23 -0
- package/dist/components/toast/Toast.stories.tsx +1427 -0
- package/dist/components/toast/index.tsx +26 -0
- package/dist/components/toast/meta.ts +19 -0
- package/dist/components/toggle/Toggle.stories.tsx +1093 -0
- package/dist/components/toggle/index.tsx +44 -0
- package/dist/components/toggle/meta.ts +19 -0
- package/dist/components/tooltip/Tooltip.stories.tsx +1548 -0
- package/dist/components/tooltip/index.tsx +304 -0
- package/dist/components/tooltip/meta.ts +21 -0
- package/dist/components/typography/Typography.stories.tsx +197 -0
- package/dist/components/typography/index.tsx +184 -0
- package/dist/components/typography/meta.ts +38 -0
- package/dist/fonts/LabGrotesque-Regular.ttf +0 -0
- package/dist/fonts/LabGrotesqueTRIAL-Bold.otf +0 -0
- package/dist/fonts/LabGrotesqueTRIAL-Light.otf +0 -0
- package/dist/fonts/LabGrotesqueTRIAL-Medium.otf +0 -0
- package/dist/fonts/LabGrotesqueTRIAL-Regular.otf +0 -0
- package/dist/fonts/PPSupplySans-Regular (1).otf +0 -0
- package/dist/fonts/PPSupplySans-Regular.otf +0 -0
- package/dist/fonts/PPSupplySans-Ultralight.otf +0 -0
- package/dist/hooks/index.ts +3 -0
- package/dist/hooks/use-previous/UsePrevious.stories.tsx +997 -0
- package/dist/hooks/use-previous/index.ts +15 -0
- package/dist/hooks/use-previous/meta.ts +6 -0
- package/dist/hooks/use-standalone-pagination/UseStandalonePagination.stories.tsx +983 -0
- package/dist/hooks/use-standalone-pagination/index.ts +146 -0
- package/dist/hooks/use-standalone-pagination/meta.ts +6 -0
- package/dist/icons/Icons.stories.tsx +29 -0
- package/dist/icons/alert-icon/AlertIcon.stories.tsx +991 -0
- package/dist/icons/alert-icon/index.tsx +48 -0
- package/dist/icons/alert-icon/meta.ts +8 -0
- package/dist/icons/all-icons.tsx +738 -0
- package/dist/icons/angle-down-icon/AngleDownIcon.stories.tsx +1031 -0
- package/dist/icons/angle-down-icon/index.tsx +25 -0
- package/dist/icons/angle-down-icon/meta.ts +8 -0
- package/dist/icons/arrow-box-left-icon/ArrowBoxLeftIcon.stories.tsx +1080 -0
- package/dist/icons/arrow-box-left-icon/index.tsx +24 -0
- package/dist/icons/arrow-box-left-icon/meta.ts +8 -0
- package/dist/icons/arrow-right-icon/ArrowRightIcon.stories.tsx +1151 -0
- package/dist/icons/arrow-right-icon/index.tsx +26 -0
- package/dist/icons/arrow-right-icon/meta.ts +8 -0
- package/dist/icons/arrow-right-up-icon/ArrowRightUpIcon.stories.tsx +1273 -0
- package/dist/icons/arrow-right-up-icon/index.tsx +24 -0
- package/dist/icons/arrow-right-up-icon/meta.ts +8 -0
- package/dist/icons/art-board-icon/ArtBoardIcon.stories.tsx +670 -0
- package/dist/icons/art-board-icon/index.tsx +24 -0
- package/dist/icons/art-board-icon/meta.ts +7 -0
- package/dist/icons/audio-bar-icon/AudioBarIcon.stories.tsx +1244 -0
- package/dist/icons/audio-bar-icon/index.tsx +19 -0
- package/dist/icons/audio-bar-icon/meta.ts +8 -0
- package/dist/icons/bubble-check-icon/BubbleCheckIcon.stories.tsx +1239 -0
- package/dist/icons/bubble-check-icon/index.tsx +24 -0
- package/dist/icons/bubble-check-icon/meta.ts +8 -0
- package/dist/icons/bubble-crossed-icon/BubbleCrossedIcon.stories.tsx +1228 -0
- package/dist/icons/bubble-crossed-icon/index.tsx +24 -0
- package/dist/icons/bubble-crossed-icon/meta.ts +8 -0
- package/dist/icons/bubble-sparkle-icon/BubbleSparkleIcon.stories.tsx +912 -0
- package/dist/icons/bubble-sparkle-icon/index.tsx +26 -0
- package/dist/icons/bubble-sparkle-icon/meta.ts +8 -0
- package/dist/icons/chevron-double-left-icon/ChevronDoubleLeftIcon.stories.tsx +1021 -0
- package/dist/icons/chevron-double-left-icon/index.tsx +34 -0
- package/dist/icons/chevron-double-left-icon/meta.ts +8 -0
- package/dist/icons/chevron-double-right-icon/ChevronDoubleRightIcon.stories.tsx +1021 -0
- package/dist/icons/chevron-double-right-icon/index.tsx +34 -0
- package/dist/icons/chevron-double-right-icon/meta.ts +8 -0
- package/dist/icons/chevron-down-icon/ChevronDownIcon.stories.tsx +1001 -0
- package/dist/icons/chevron-down-icon/index.tsx +27 -0
- package/dist/icons/chevron-down-icon/meta.ts +8 -0
- package/dist/icons/chevron-left-icon/ChevronLeftIcon.stories.tsx +1029 -0
- package/dist/icons/chevron-left-icon/index.tsx +27 -0
- package/dist/icons/chevron-left-icon/meta.ts +8 -0
- package/dist/icons/chevron-right-icon/ChevronRightIcon.stories.tsx +1021 -0
- package/dist/icons/chevron-right-icon/index.tsx +27 -0
- package/dist/icons/chevron-right-icon/meta.ts +8 -0
- package/dist/icons/chevron-up-icon/ChevronUpIcon.stories.tsx +1036 -0
- package/dist/icons/chevron-up-icon/index.tsx +27 -0
- package/dist/icons/chevron-up-icon/meta.ts +8 -0
- package/dist/icons/command-icon/CommandIcon.stories.tsx +1098 -0
- package/dist/icons/command-icon/index.tsx +24 -0
- package/dist/icons/command-icon/meta.ts +8 -0
- package/dist/icons/cross-circle-icon/CrossCircleIcon.stories.tsx +1061 -0
- package/dist/icons/cross-circle-icon/index.tsx +23 -0
- package/dist/icons/cross-circle-icon/meta.ts +8 -0
- package/dist/icons/cross-icon/CrossIcon.stories.tsx +1027 -0
- package/dist/icons/cross-icon/index.tsx +24 -0
- package/dist/icons/cross-icon/meta.ts +8 -0
- package/dist/icons/edit-big-icon/EditBigIcon.stories.tsx +1092 -0
- package/dist/icons/edit-big-icon/index.tsx +22 -0
- package/dist/icons/edit-big-icon/meta.ts +8 -0
- package/dist/icons/eye-close-icon/EyeCloseIcon.stories.tsx +1090 -0
- package/dist/icons/eye-close-icon/index.tsx +26 -0
- package/dist/icons/eye-close-icon/meta.ts +8 -0
- package/dist/icons/eye-open-icon/EyeOpenIcon.stories.tsx +1098 -0
- package/dist/icons/eye-open-icon/index.tsx +24 -0
- package/dist/icons/eye-open-icon/meta.ts +8 -0
- package/dist/icons/feature-shine-icon/FeatureShineIcon.stories.tsx +1071 -0
- package/dist/icons/feature-shine-icon/index.tsx +29 -0
- package/dist/icons/feature-shine-icon/meta.ts +8 -0
- package/dist/icons/file-chart-icon/FileChartIcon.stories.tsx +1115 -0
- package/dist/icons/file-chart-icon/index.tsx +24 -0
- package/dist/icons/file-chart-icon/meta.ts +8 -0
- package/dist/icons/file-text-icon/FileTextIcon.stories.tsx +668 -0
- package/dist/icons/file-text-icon/index.tsx +24 -0
- package/dist/icons/file-text-icon/meta.ts +8 -0
- package/dist/icons/grip-vertical-icon/GripVerticalIcon.stories.tsx +1239 -0
- package/dist/icons/grip-vertical-icon/index.tsx +28 -0
- package/dist/icons/grip-vertical-icon/meta.ts +8 -0
- package/dist/icons/image-icon/ImageIcon.stories.tsx +1181 -0
- package/dist/icons/image-icon/index.tsx +24 -0
- package/dist/icons/image-icon/meta.ts +8 -0
- package/dist/icons/import-folder-icon/ImportFolderIcon.stories.tsx +1248 -0
- package/dist/icons/import-folder-icon/index.tsx +22 -0
- package/dist/icons/import-folder-icon/meta.ts +8 -0
- package/dist/icons/index.ts +46 -0
- package/dist/icons/light-bulb-simple-icon/LightBulbSimpleIcon.stories.tsx +1272 -0
- package/dist/icons/light-bulb-simple-icon/index.tsx +24 -0
- package/dist/icons/light-bulb-simple-icon/meta.ts +8 -0
- package/dist/icons/magic-book-icon/MagicBookIcon.stories.tsx +1245 -0
- package/dist/icons/magic-book-icon/index.tsx +32 -0
- package/dist/icons/magic-book-icon/meta.ts +8 -0
- package/dist/icons/maintenance-icon/MaintenanceIcon.stories.tsx +1251 -0
- package/dist/icons/maintenance-icon/index.tsx +23 -0
- package/dist/icons/maintenance-icon/meta.ts +8 -0
- package/dist/icons/message-icon/MessageIcon.stories.tsx +595 -0
- package/dist/icons/message-icon/index.tsx +30 -0
- package/dist/icons/message-icon/meta.ts +8 -0
- package/dist/icons/move-horizontal-icon/MoveHorizontalIcon.stories.tsx +1245 -0
- package/dist/icons/move-horizontal-icon/index.tsx +23 -0
- package/dist/icons/move-horizontal-icon/meta.ts +8 -0
- package/dist/icons/move-vertical-icon/MoveVerticalIcon.stories.tsx +1196 -0
- package/dist/icons/move-vertical-icon/index.tsx +23 -0
- package/dist/icons/move-vertical-icon/meta.ts +8 -0
- package/dist/icons/page-search-icon/PageSearchIcon.stories.tsx +1167 -0
- package/dist/icons/page-search-icon/index.tsx +21 -0
- package/dist/icons/page-search-icon/meta.ts +8 -0
- package/dist/icons/pencil-icon/PencilIcon.stories.tsx +1131 -0
- package/dist/icons/pencil-icon/index.tsx +21 -0
- package/dist/icons/pencil-icon/meta.ts +8 -0
- package/dist/icons/plus-icon/PlusIcon.stories.tsx +1151 -0
- package/dist/icons/plus-icon/index.tsx +24 -0
- package/dist/icons/plus-icon/meta.ts +8 -0
- package/dist/icons/search-icon/SearchIcon.stories.tsx +1181 -0
- package/dist/icons/search-icon/index.tsx +24 -0
- package/dist/icons/search-icon/meta.ts +8 -0
- package/dist/icons/site-logo-icon/SiteLogoIcon.stories.tsx +1167 -0
- package/dist/icons/site-logo-icon/index.tsx +79 -0
- package/dist/icons/site-logo-icon/meta.ts +8 -0
- package/dist/icons/spinner-gradient-icon/SpinnerGradientIcon.stories.tsx +637 -0
- package/dist/icons/spinner-gradient-icon/index.tsx +53 -0
- package/dist/icons/spinner-gradient-icon/meta.ts +8 -0
- package/dist/icons/spinner-solid-icon/SpinnerSolidIcon.stories.tsx +644 -0
- package/dist/icons/spinner-solid-icon/index.tsx +59 -0
- package/dist/icons/spinner-solid-icon/meta.ts +8 -0
- package/dist/icons/spinner-solid-neutral-icon/SpinnerSolidINeutralcon.stories.tsx +736 -0
- package/dist/icons/spinner-solid-neutral-icon/index.tsx +53 -0
- package/dist/icons/spinner-solid-neutral-icon/meta.ts +8 -0
- package/dist/icons/tick-circle-icon/TickCircleIcon.stories.tsx +1204 -0
- package/dist/icons/tick-circle-icon/index.tsx +23 -0
- package/dist/icons/tick-circle-icon/meta.ts +8 -0
- package/dist/icons/tick-icon/TickIcon.stories.tsx +1340 -0
- package/dist/icons/tick-icon/index.tsx +24 -0
- package/dist/icons/tick-icon/meta.ts +8 -0
- package/dist/icons/trash-icon/TrashIcon.stories.tsx +996 -0
- package/dist/icons/trash-icon/index.tsx +24 -0
- package/dist/icons/trash-icon/meta.ts +8 -0
- package/dist/icons/upload-icon/UploadIcon.stories.tsx +947 -0
- package/dist/icons/upload-icon/index.tsx +24 -0
- package/dist/icons/upload-icon/meta.ts +8 -0
- package/dist/icons/vertical-menu-icon/VerticalMenuIcon.stories.tsx +1045 -0
- package/dist/icons/vertical-menu-icon/index.tsx +27 -0
- package/dist/icons/vertical-menu-icon/meta.ts +8 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +206 -0
- package/dist/lib/utils.ts +6 -0
- package/dist/styles/aural-theme.css +1008 -0
- package/package.json +142 -0
|
@@ -0,0 +1,962 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
import {
|
|
3
|
+
Select,
|
|
4
|
+
SelectContent,
|
|
5
|
+
SelectField,
|
|
6
|
+
SelectGroup,
|
|
7
|
+
SelectHelperText,
|
|
8
|
+
SelectItem,
|
|
9
|
+
SelectLabel,
|
|
10
|
+
SelectRoot,
|
|
11
|
+
SelectSeparator,
|
|
12
|
+
SelectTrigger,
|
|
13
|
+
SelectValue,
|
|
14
|
+
SelectWrapper,
|
|
15
|
+
} from "@/ui/components/select"
|
|
16
|
+
import type { Meta, StoryObj } from "@storybook/react"
|
|
17
|
+
|
|
18
|
+
import { Button } from "../button"
|
|
19
|
+
|
|
20
|
+
const meta: Meta<typeof SelectField> = {
|
|
21
|
+
title: "Components/UI/Select",
|
|
22
|
+
component: SelectField,
|
|
23
|
+
parameters: {
|
|
24
|
+
layout: "centered",
|
|
25
|
+
docs: {
|
|
26
|
+
description: {
|
|
27
|
+
component: `
|
|
28
|
+
A customizable select component built on top of Radix UI Select primitives with atomic design principles.
|
|
29
|
+
Provides a dropdown selection interface with support for multiple styling variants, decorations,
|
|
30
|
+
required fields, helper text, grouping, separators, scroll buttons, and comprehensive keyboard navigation.
|
|
31
|
+
|
|
32
|
+
## Features
|
|
33
|
+
- Built on Radix UI for accessibility
|
|
34
|
+
- Multiple styling variants (default, error, warning, success)
|
|
35
|
+
- Multiple decorations (underline, outline, filled)
|
|
36
|
+
- Required field support with visual indicators
|
|
37
|
+
- Helper text support with variant styling
|
|
38
|
+
- Support for grouped options
|
|
39
|
+
- Scroll buttons for long lists
|
|
40
|
+
- Keyboard navigation
|
|
41
|
+
- Disabled states
|
|
42
|
+
- Atomic design composition
|
|
43
|
+
- Unstyled mode for custom styling
|
|
44
|
+
- CVA-based styling system
|
|
45
|
+
- Custom icons (ChevronDown, ChevronUp, Tick)
|
|
46
|
+
- Full accessibility support (ARIA attributes)
|
|
47
|
+
|
|
48
|
+
## Usage
|
|
49
|
+
|
|
50
|
+
### Simple Usage with SelectField
|
|
51
|
+
\`\`\`tsx
|
|
52
|
+
import { SelectField, SelectItem } from '@/ui/components/select'
|
|
53
|
+
|
|
54
|
+
<SelectField
|
|
55
|
+
label="Country"
|
|
56
|
+
placeholder="Select a country..."
|
|
57
|
+
required
|
|
58
|
+
helperText="Please select your country"
|
|
59
|
+
>
|
|
60
|
+
<SelectItem value="us">United States</SelectItem>
|
|
61
|
+
<SelectItem value="ca">Canada</SelectItem>
|
|
62
|
+
</SelectField>
|
|
63
|
+
\`\`\`
|
|
64
|
+
|
|
65
|
+
### Atomic Composition
|
|
66
|
+
\`\`\`tsx
|
|
67
|
+
import {
|
|
68
|
+
Select,
|
|
69
|
+
SelectContent,
|
|
70
|
+
SelectItem,
|
|
71
|
+
SelectRoot,
|
|
72
|
+
SelectTrigger,
|
|
73
|
+
SelectValue,
|
|
74
|
+
SelectWrapper,
|
|
75
|
+
} from '@/ui/components/select'
|
|
76
|
+
|
|
77
|
+
<SelectRoot fullWidth>
|
|
78
|
+
<SelectLabel required>Country</SelectLabel>
|
|
79
|
+
<SelectWrapper>
|
|
80
|
+
<Select>
|
|
81
|
+
<SelectTrigger>
|
|
82
|
+
<SelectValue placeholder="Select..." />
|
|
83
|
+
</SelectTrigger>
|
|
84
|
+
<SelectContent>
|
|
85
|
+
<SelectItem value="us">United States</SelectItem>
|
|
86
|
+
</SelectContent>
|
|
87
|
+
</Select>
|
|
88
|
+
</SelectWrapper>
|
|
89
|
+
<SelectHelperText>Please select your country</SelectHelperText>
|
|
90
|
+
</SelectRoot>
|
|
91
|
+
\`\`\`
|
|
92
|
+
`,
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
tags: ["autodocs"],
|
|
97
|
+
argTypes: {
|
|
98
|
+
label: {
|
|
99
|
+
control: { type: "text" },
|
|
100
|
+
description: "Label text for the select",
|
|
101
|
+
table: {
|
|
102
|
+
type: { summary: "ReactNode" },
|
|
103
|
+
defaultValue: { summary: "undefined" },
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
placeholder: {
|
|
107
|
+
control: { type: "text" },
|
|
108
|
+
description: "Placeholder text shown when no option is selected",
|
|
109
|
+
table: {
|
|
110
|
+
type: { summary: "string" },
|
|
111
|
+
defaultValue: { summary: "undefined" },
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
helperText: {
|
|
115
|
+
control: { type: "text" },
|
|
116
|
+
description: "Helper text displayed below the select",
|
|
117
|
+
table: {
|
|
118
|
+
type: { summary: "ReactNode" },
|
|
119
|
+
defaultValue: { summary: "undefined" },
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
variant: {
|
|
123
|
+
control: { type: "select" },
|
|
124
|
+
options: ["default", "error", "warning", "success"],
|
|
125
|
+
description: "Visual variant affecting border and helper text colors",
|
|
126
|
+
table: {
|
|
127
|
+
type: { summary: '"default" | "error" | "warning" | "success"' },
|
|
128
|
+
defaultValue: { summary: '"default"' },
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
decoration: {
|
|
132
|
+
control: { type: "select" },
|
|
133
|
+
options: ["underline", "outline", "filled"],
|
|
134
|
+
description: "Visual style of the select border and background",
|
|
135
|
+
table: {
|
|
136
|
+
type: { summary: '"underline" | "outline" | "filled"' },
|
|
137
|
+
defaultValue: { summary: '"underline"' },
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
required: {
|
|
141
|
+
control: { type: "boolean" },
|
|
142
|
+
description: "Whether the select is required (adds asterisk to label)",
|
|
143
|
+
table: {
|
|
144
|
+
type: { summary: "boolean" },
|
|
145
|
+
defaultValue: { summary: "false" },
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
disabled: {
|
|
149
|
+
control: { type: "boolean" },
|
|
150
|
+
description: "Whether the select is disabled and non-interactive",
|
|
151
|
+
table: {
|
|
152
|
+
type: { summary: "boolean" },
|
|
153
|
+
defaultValue: { summary: "false" },
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
fullWidth: {
|
|
157
|
+
control: { type: "boolean" },
|
|
158
|
+
description: "Whether the select takes full width of its container",
|
|
159
|
+
table: {
|
|
160
|
+
type: { summary: "boolean" },
|
|
161
|
+
defaultValue: { summary: "false" },
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
value: {
|
|
165
|
+
control: { type: "text" },
|
|
166
|
+
description: "Controlled value of the select",
|
|
167
|
+
table: {
|
|
168
|
+
type: { summary: "string" },
|
|
169
|
+
defaultValue: { summary: "undefined" },
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
onValueChange: {
|
|
173
|
+
action: "valueChanged",
|
|
174
|
+
description: "Callback fired when the value changes",
|
|
175
|
+
table: {
|
|
176
|
+
type: { summary: "(value: string) => void" },
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
classes: {
|
|
180
|
+
control: { type: "object" },
|
|
181
|
+
description: "Override classes for different parts of the component",
|
|
182
|
+
table: {
|
|
183
|
+
type: {
|
|
184
|
+
summary:
|
|
185
|
+
"{ root?: string; label?: string; wrapper?: string; trigger?: string; content?: string; helperText?: string }",
|
|
186
|
+
},
|
|
187
|
+
defaultValue: { summary: "{}" },
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
name: {
|
|
191
|
+
control: "text",
|
|
192
|
+
description: "The name attribute for form submission",
|
|
193
|
+
table: {
|
|
194
|
+
type: { summary: "string" },
|
|
195
|
+
},
|
|
196
|
+
},
|
|
197
|
+
id: {
|
|
198
|
+
control: "text",
|
|
199
|
+
description: "The id attribute for the select",
|
|
200
|
+
table: {
|
|
201
|
+
type: { summary: "string" },
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
},
|
|
205
|
+
args: {
|
|
206
|
+
variant: "default",
|
|
207
|
+
decoration: "underline",
|
|
208
|
+
required: false,
|
|
209
|
+
disabled: false,
|
|
210
|
+
fullWidth: false,
|
|
211
|
+
},
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
export default meta
|
|
215
|
+
type Story = StoryObj<typeof meta>
|
|
216
|
+
|
|
217
|
+
export const Default: Story = {
|
|
218
|
+
args: {
|
|
219
|
+
label: "Fruit Selection",
|
|
220
|
+
placeholder: "Select a fruit",
|
|
221
|
+
decoration: "underline",
|
|
222
|
+
fullWidth: true,
|
|
223
|
+
},
|
|
224
|
+
render: (args) => (
|
|
225
|
+
<SelectField {...args}>
|
|
226
|
+
<SelectItem value="apple">Apple</SelectItem>
|
|
227
|
+
<SelectItem value="banana">Banana</SelectItem>
|
|
228
|
+
<SelectItem value="orange">Orange</SelectItem>
|
|
229
|
+
<SelectItem value="grape">Grape</SelectItem>
|
|
230
|
+
<SelectItem value="strawberry">Strawberry</SelectItem>
|
|
231
|
+
</SelectField>
|
|
232
|
+
),
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
// Decoration variants
|
|
236
|
+
export const DecorationVariants: Story = {
|
|
237
|
+
render: () => (
|
|
238
|
+
<div className="max-w-md space-y-6">
|
|
239
|
+
<div>
|
|
240
|
+
<h3 className="text-fm-primary mb-2 text-sm font-medium">Underline</h3>
|
|
241
|
+
<SelectField
|
|
242
|
+
label="Underline Style"
|
|
243
|
+
placeholder="Minimalist underline style..."
|
|
244
|
+
decoration="underline"
|
|
245
|
+
fullWidth
|
|
246
|
+
>
|
|
247
|
+
<SelectItem value="option1">Option 1</SelectItem>
|
|
248
|
+
<SelectItem value="option2">Option 2</SelectItem>
|
|
249
|
+
<SelectItem value="option3">Option 3</SelectItem>
|
|
250
|
+
</SelectField>
|
|
251
|
+
</div>
|
|
252
|
+
|
|
253
|
+
<div>
|
|
254
|
+
<h3 className="text-fm-primary mb-2 text-sm font-medium">Outline</h3>
|
|
255
|
+
<SelectField
|
|
256
|
+
label="Outline Style"
|
|
257
|
+
placeholder="Traditional outlined style..."
|
|
258
|
+
decoration="outline"
|
|
259
|
+
fullWidth
|
|
260
|
+
>
|
|
261
|
+
<SelectItem value="option1">Option 1</SelectItem>
|
|
262
|
+
<SelectItem value="option2">Option 2</SelectItem>
|
|
263
|
+
<SelectItem value="option3">Option 3</SelectItem>
|
|
264
|
+
</SelectField>
|
|
265
|
+
</div>
|
|
266
|
+
|
|
267
|
+
<div>
|
|
268
|
+
<h3 className="text-fm-primary mb-2 text-sm font-medium">Filled</h3>
|
|
269
|
+
<SelectField
|
|
270
|
+
label="Filled Style"
|
|
271
|
+
placeholder="Modern filled style..."
|
|
272
|
+
decoration="filled"
|
|
273
|
+
fullWidth
|
|
274
|
+
>
|
|
275
|
+
<SelectItem value="option1">Option 1</SelectItem>
|
|
276
|
+
<SelectItem value="option2">Option 2</SelectItem>
|
|
277
|
+
<SelectItem value="option3">Option 3</SelectItem>
|
|
278
|
+
</SelectField>
|
|
279
|
+
</div>
|
|
280
|
+
</div>
|
|
281
|
+
),
|
|
282
|
+
parameters: {
|
|
283
|
+
docs: {
|
|
284
|
+
description: {
|
|
285
|
+
story:
|
|
286
|
+
"Three decoration styles available: underline (minimalist), outline (traditional), and filled (modern with background).",
|
|
287
|
+
},
|
|
288
|
+
},
|
|
289
|
+
},
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
export const WithRequiredField: Story = {
|
|
293
|
+
args: {
|
|
294
|
+
label: "Required Selection",
|
|
295
|
+
placeholder: "Please select an option",
|
|
296
|
+
required: true,
|
|
297
|
+
helperText: "This field is required",
|
|
298
|
+
decoration: "outline",
|
|
299
|
+
fullWidth: true,
|
|
300
|
+
},
|
|
301
|
+
render: (args) => (
|
|
302
|
+
<SelectField {...args}>
|
|
303
|
+
<SelectItem value="option1">Option 1</SelectItem>
|
|
304
|
+
<SelectItem value="option2">Option 2</SelectItem>
|
|
305
|
+
<SelectItem value="option3">Option 3</SelectItem>
|
|
306
|
+
</SelectField>
|
|
307
|
+
),
|
|
308
|
+
parameters: {
|
|
309
|
+
docs: {
|
|
310
|
+
description: {
|
|
311
|
+
story: "Select field with required indicator (asterisk) in the label.",
|
|
312
|
+
},
|
|
313
|
+
},
|
|
314
|
+
},
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
export const Variants: Story = {
|
|
318
|
+
parameters: {
|
|
319
|
+
docs: {
|
|
320
|
+
description: {
|
|
321
|
+
story: `
|
|
322
|
+
Different visual variants of the select component. Each variant uses different colors
|
|
323
|
+
to communicate different states or purposes:
|
|
324
|
+
- **Default**: Standard styling
|
|
325
|
+
- **Error**: Red styling for error states
|
|
326
|
+
- **Warning**: Yellow/orange styling for warnings
|
|
327
|
+
- **Success**: Green styling for success states
|
|
328
|
+
`,
|
|
329
|
+
},
|
|
330
|
+
},
|
|
331
|
+
},
|
|
332
|
+
render: () => (
|
|
333
|
+
<div className="max-w-md space-y-6">
|
|
334
|
+
<SelectField
|
|
335
|
+
label="Default Variant"
|
|
336
|
+
placeholder="Select an option..."
|
|
337
|
+
variant="default"
|
|
338
|
+
decoration="outline"
|
|
339
|
+
helperText="This is the default variant"
|
|
340
|
+
fullWidth
|
|
341
|
+
>
|
|
342
|
+
<SelectItem value="option1">Option 1</SelectItem>
|
|
343
|
+
<SelectItem value="option2">Option 2</SelectItem>
|
|
344
|
+
<SelectItem value="option3">Option 3</SelectItem>
|
|
345
|
+
</SelectField>
|
|
346
|
+
|
|
347
|
+
<SelectField
|
|
348
|
+
label="Error Variant"
|
|
349
|
+
placeholder="Select an option..."
|
|
350
|
+
variant="error"
|
|
351
|
+
decoration="outline"
|
|
352
|
+
helperText="Something went wrong"
|
|
353
|
+
fullWidth
|
|
354
|
+
>
|
|
355
|
+
<SelectItem value="option1">Option 1</SelectItem>
|
|
356
|
+
<SelectItem value="option2">Option 2</SelectItem>
|
|
357
|
+
<SelectItem value="option3">Option 3</SelectItem>
|
|
358
|
+
</SelectField>
|
|
359
|
+
|
|
360
|
+
<SelectField
|
|
361
|
+
label="Warning Variant"
|
|
362
|
+
placeholder="Select an option..."
|
|
363
|
+
variant="warning"
|
|
364
|
+
decoration="outline"
|
|
365
|
+
helperText="Please double-check your selection"
|
|
366
|
+
fullWidth
|
|
367
|
+
>
|
|
368
|
+
<SelectItem value="option1">Option 1</SelectItem>
|
|
369
|
+
<SelectItem value="option2">Option 2</SelectItem>
|
|
370
|
+
<SelectItem value="option3">Option 3</SelectItem>
|
|
371
|
+
</SelectField>
|
|
372
|
+
|
|
373
|
+
<SelectField
|
|
374
|
+
label="Success Variant"
|
|
375
|
+
placeholder="Select an option..."
|
|
376
|
+
variant="success"
|
|
377
|
+
decoration="outline"
|
|
378
|
+
helperText="Great choice!"
|
|
379
|
+
fullWidth
|
|
380
|
+
>
|
|
381
|
+
<SelectItem value="option1">Option 1</SelectItem>
|
|
382
|
+
<SelectItem value="option2">Option 2</SelectItem>
|
|
383
|
+
<SelectItem value="option3">Option 3</SelectItem>
|
|
384
|
+
</SelectField>
|
|
385
|
+
</div>
|
|
386
|
+
),
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
export const WithHelperText: Story = {
|
|
390
|
+
args: {
|
|
391
|
+
label: "Framework Selection",
|
|
392
|
+
placeholder: "Choose your preferred framework",
|
|
393
|
+
helperText: "Select the framework you're most comfortable with",
|
|
394
|
+
decoration: "filled",
|
|
395
|
+
fullWidth: true,
|
|
396
|
+
},
|
|
397
|
+
render: (args) => (
|
|
398
|
+
<SelectField {...args}>
|
|
399
|
+
<SelectItem value="react">React</SelectItem>
|
|
400
|
+
<SelectItem value="vue">Vue.js</SelectItem>
|
|
401
|
+
<SelectItem value="angular">Angular</SelectItem>
|
|
402
|
+
<SelectItem value="svelte">Svelte</SelectItem>
|
|
403
|
+
</SelectField>
|
|
404
|
+
),
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
export const Controlled: Story = {
|
|
408
|
+
parameters: {
|
|
409
|
+
docs: {
|
|
410
|
+
description: {
|
|
411
|
+
story: `
|
|
412
|
+
Example of a controlled select component. The value is managed by the parent component state.
|
|
413
|
+
Use this pattern when you need to control the select value programmatically.
|
|
414
|
+
`,
|
|
415
|
+
},
|
|
416
|
+
},
|
|
417
|
+
},
|
|
418
|
+
render: function ControlledSelect() {
|
|
419
|
+
const [value, setValue] = React.useState<string>("")
|
|
420
|
+
|
|
421
|
+
return (
|
|
422
|
+
<div className="max-w-md space-y-4">
|
|
423
|
+
<div>
|
|
424
|
+
<p className="text-fm-primary mb-2 text-sm">
|
|
425
|
+
Selected value:{" "}
|
|
426
|
+
<code className="rounded bg-gray-100 px-1">{value || "none"}</code>
|
|
427
|
+
</p>
|
|
428
|
+
<SelectField
|
|
429
|
+
label="Controlled Select"
|
|
430
|
+
placeholder="Select a fruit"
|
|
431
|
+
value={value}
|
|
432
|
+
onValueChange={setValue}
|
|
433
|
+
helperText="This select is controlled by React state"
|
|
434
|
+
decoration="outline"
|
|
435
|
+
fullWidth
|
|
436
|
+
>
|
|
437
|
+
<SelectItem value="apple">Apple</SelectItem>
|
|
438
|
+
<SelectItem value="banana">Banana</SelectItem>
|
|
439
|
+
<SelectItem value="orange">Orange</SelectItem>
|
|
440
|
+
<SelectItem value="grape">Grape</SelectItem>
|
|
441
|
+
<SelectItem value="strawberry">Strawberry</SelectItem>
|
|
442
|
+
</SelectField>
|
|
443
|
+
</div>
|
|
444
|
+
<div className="flex gap-2">
|
|
445
|
+
<Button size="sm" onClick={() => setValue("apple")}>
|
|
446
|
+
Set to Apple
|
|
447
|
+
</Button>
|
|
448
|
+
<Button size="sm" variant="outline" onClick={() => setValue("")}>
|
|
449
|
+
Clear
|
|
450
|
+
</Button>
|
|
451
|
+
</div>
|
|
452
|
+
</div>
|
|
453
|
+
)
|
|
454
|
+
},
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
export const DisabledStates: Story = {
|
|
458
|
+
render: () => (
|
|
459
|
+
<div className="max-w-md space-y-6">
|
|
460
|
+
<SelectField
|
|
461
|
+
label="Disabled Select"
|
|
462
|
+
placeholder="This select is disabled"
|
|
463
|
+
disabled
|
|
464
|
+
helperText="This select cannot be interacted with"
|
|
465
|
+
decoration="outline"
|
|
466
|
+
fullWidth
|
|
467
|
+
>
|
|
468
|
+
<SelectItem value="option1">Option 1</SelectItem>
|
|
469
|
+
<SelectItem value="option2">Option 2</SelectItem>
|
|
470
|
+
</SelectField>
|
|
471
|
+
|
|
472
|
+
<SelectField
|
|
473
|
+
label="Select with Disabled Items"
|
|
474
|
+
placeholder="Some items are disabled"
|
|
475
|
+
helperText="Some options may be unavailable"
|
|
476
|
+
decoration="filled"
|
|
477
|
+
fullWidth
|
|
478
|
+
>
|
|
479
|
+
<SelectItem value="available1">Available Option 1</SelectItem>
|
|
480
|
+
<SelectItem value="disabled1" disabled>
|
|
481
|
+
Disabled Option 1
|
|
482
|
+
</SelectItem>
|
|
483
|
+
<SelectItem value="available2">Available Option 2</SelectItem>
|
|
484
|
+
<SelectItem value="disabled2" disabled>
|
|
485
|
+
Disabled Option 2
|
|
486
|
+
</SelectItem>
|
|
487
|
+
</SelectField>
|
|
488
|
+
</div>
|
|
489
|
+
),
|
|
490
|
+
parameters: {
|
|
491
|
+
docs: {
|
|
492
|
+
description: {
|
|
493
|
+
story: "Examples of disabled select and individual disabled options.",
|
|
494
|
+
},
|
|
495
|
+
},
|
|
496
|
+
},
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
export const WithGroups: Story = {
|
|
500
|
+
render: () => (
|
|
501
|
+
<SelectField
|
|
502
|
+
label="Technology Stack"
|
|
503
|
+
placeholder="Select a technology"
|
|
504
|
+
decoration="outline"
|
|
505
|
+
helperText="Choose from frontend or backend technologies"
|
|
506
|
+
fullWidth
|
|
507
|
+
>
|
|
508
|
+
<SelectGroup>
|
|
509
|
+
<SelectLabel className="px-2 pt-2 pb-1">Frontend</SelectLabel>
|
|
510
|
+
<SelectItem value="react">React</SelectItem>
|
|
511
|
+
<SelectSeparator />
|
|
512
|
+
<SelectItem value="vue">Vue</SelectItem>
|
|
513
|
+
<SelectSeparator />
|
|
514
|
+
<SelectItem value="angular">Angular</SelectItem>
|
|
515
|
+
</SelectGroup>
|
|
516
|
+
<SelectSeparator />
|
|
517
|
+
<SelectGroup>
|
|
518
|
+
<SelectLabel className="px-2 pt-2 pb-1">Backend</SelectLabel>
|
|
519
|
+
<SelectItem value="nodejs">Node.js</SelectItem>
|
|
520
|
+
<SelectSeparator />
|
|
521
|
+
<SelectItem value="python">Python</SelectItem>
|
|
522
|
+
<SelectSeparator />
|
|
523
|
+
<SelectItem value="java">Java</SelectItem>
|
|
524
|
+
</SelectGroup>
|
|
525
|
+
</SelectField>
|
|
526
|
+
),
|
|
527
|
+
parameters: {
|
|
528
|
+
docs: {
|
|
529
|
+
description: {
|
|
530
|
+
story: `
|
|
531
|
+
Select with grouped options using \`SelectGroup\`, \`SelectLabel\`, and \`SelectSeparator\` components.
|
|
532
|
+
Useful for organizing related options into categories.
|
|
533
|
+
`,
|
|
534
|
+
},
|
|
535
|
+
},
|
|
536
|
+
},
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
export const FormIntegration: Story = {
|
|
540
|
+
render: () => (
|
|
541
|
+
<form
|
|
542
|
+
className="max-w-md space-y-4 rounded-lg border p-4"
|
|
543
|
+
onSubmit={(e) => {
|
|
544
|
+
e.preventDefault()
|
|
545
|
+
const formData = new FormData(e.currentTarget)
|
|
546
|
+
alert(
|
|
547
|
+
`Selected values:\nFruit: ${formData.get("fruit")}\nColor: ${formData.get("color")}`
|
|
548
|
+
)
|
|
549
|
+
}}
|
|
550
|
+
>
|
|
551
|
+
<SelectField
|
|
552
|
+
label="Favorite Fruit"
|
|
553
|
+
placeholder="Select a fruit"
|
|
554
|
+
name="fruit"
|
|
555
|
+
required
|
|
556
|
+
helperText="Required field"
|
|
557
|
+
decoration="outline"
|
|
558
|
+
fullWidth
|
|
559
|
+
>
|
|
560
|
+
<SelectItem value="apple">Apple</SelectItem>
|
|
561
|
+
<SelectItem value="banana">Banana</SelectItem>
|
|
562
|
+
<SelectItem value="orange">Orange</SelectItem>
|
|
563
|
+
</SelectField>
|
|
564
|
+
|
|
565
|
+
<SelectField
|
|
566
|
+
label="Favorite Color"
|
|
567
|
+
placeholder="Select a color"
|
|
568
|
+
name="color"
|
|
569
|
+
helperText="Optional field"
|
|
570
|
+
decoration="filled"
|
|
571
|
+
fullWidth
|
|
572
|
+
>
|
|
573
|
+
<SelectItem value="red">Red</SelectItem>
|
|
574
|
+
<SelectItem value="blue">Blue</SelectItem>
|
|
575
|
+
<SelectItem value="green">Green</SelectItem>
|
|
576
|
+
</SelectField>
|
|
577
|
+
|
|
578
|
+
<Button type="submit" className="w-full">
|
|
579
|
+
Submit Form
|
|
580
|
+
</Button>
|
|
581
|
+
</form>
|
|
582
|
+
),
|
|
583
|
+
parameters: {
|
|
584
|
+
docs: {
|
|
585
|
+
description: {
|
|
586
|
+
story: `
|
|
587
|
+
Select components integrated with a form. Shows how to use \`name\` and \`required\` props
|
|
588
|
+
for form validation and submission. The select values will be included in form data.
|
|
589
|
+
`,
|
|
590
|
+
},
|
|
591
|
+
},
|
|
592
|
+
},
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
export const AtomicComposition: Story = {
|
|
596
|
+
render: () => {
|
|
597
|
+
const [value, setValue] = React.useState("")
|
|
598
|
+
|
|
599
|
+
return (
|
|
600
|
+
<SelectRoot fullWidth className="max-w-md">
|
|
601
|
+
<SelectLabel required>Custom Composed Select</SelectLabel>
|
|
602
|
+
|
|
603
|
+
<SelectWrapper>
|
|
604
|
+
<Select value={value} onValueChange={setValue}>
|
|
605
|
+
<SelectTrigger
|
|
606
|
+
decoration="outline"
|
|
607
|
+
variant="default"
|
|
608
|
+
aria-describedby="custom-select-helper"
|
|
609
|
+
>
|
|
610
|
+
<SelectValue placeholder="Built with atomic components..." />
|
|
611
|
+
</SelectTrigger>
|
|
612
|
+
|
|
613
|
+
<SelectContent>
|
|
614
|
+
<SelectItem value="atomic">Atomic Design</SelectItem>
|
|
615
|
+
<SelectSeparator />
|
|
616
|
+
<SelectItem value="flexible">Flexible Composition</SelectItem>
|
|
617
|
+
<SelectSeparator />
|
|
618
|
+
<SelectItem value="accessible">Accessible</SelectItem>
|
|
619
|
+
</SelectContent>
|
|
620
|
+
</Select>
|
|
621
|
+
</SelectWrapper>
|
|
622
|
+
|
|
623
|
+
<SelectHelperText id="custom-select-helper" variant="default">
|
|
624
|
+
This is built using atomic components for maximum flexibility
|
|
625
|
+
</SelectHelperText>
|
|
626
|
+
</SelectRoot>
|
|
627
|
+
)
|
|
628
|
+
},
|
|
629
|
+
parameters: {
|
|
630
|
+
docs: {
|
|
631
|
+
description: {
|
|
632
|
+
story:
|
|
633
|
+
"This example shows how to compose the Select using individual atomic components for maximum flexibility. This pattern allows for custom layouts and advanced use cases.",
|
|
634
|
+
},
|
|
635
|
+
},
|
|
636
|
+
},
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
export const AllVariantsAllDecorations: Story = {
|
|
640
|
+
render: () => (
|
|
641
|
+
<div className="grid max-w-6xl grid-cols-1 gap-6 lg:grid-cols-3">
|
|
642
|
+
{/* Underline decoration */}
|
|
643
|
+
<div className="space-y-4">
|
|
644
|
+
<h3 className="text-fm-primary text-lg font-semibold">Underline</h3>
|
|
645
|
+
<SelectField
|
|
646
|
+
label="Default"
|
|
647
|
+
placeholder="Default underline..."
|
|
648
|
+
variant="default"
|
|
649
|
+
decoration="underline"
|
|
650
|
+
helperText="Default variant"
|
|
651
|
+
fullWidth
|
|
652
|
+
>
|
|
653
|
+
<SelectItem value="option1">Option 1</SelectItem>
|
|
654
|
+
<SelectItem value="option2">Option 2</SelectItem>
|
|
655
|
+
</SelectField>
|
|
656
|
+
<SelectField
|
|
657
|
+
label="Error"
|
|
658
|
+
placeholder="Error underline..."
|
|
659
|
+
variant="error"
|
|
660
|
+
decoration="underline"
|
|
661
|
+
helperText="Something went wrong"
|
|
662
|
+
fullWidth
|
|
663
|
+
>
|
|
664
|
+
<SelectItem value="option1">Option 1</SelectItem>
|
|
665
|
+
<SelectItem value="option2">Option 2</SelectItem>
|
|
666
|
+
</SelectField>
|
|
667
|
+
<SelectField
|
|
668
|
+
label="Warning"
|
|
669
|
+
placeholder="Warning underline..."
|
|
670
|
+
variant="warning"
|
|
671
|
+
decoration="underline"
|
|
672
|
+
helperText="Please check selection"
|
|
673
|
+
fullWidth
|
|
674
|
+
>
|
|
675
|
+
<SelectItem value="option1">Option 1</SelectItem>
|
|
676
|
+
<SelectItem value="option2">Option 2</SelectItem>
|
|
677
|
+
</SelectField>
|
|
678
|
+
<SelectField
|
|
679
|
+
label="Success"
|
|
680
|
+
placeholder="Success underline..."
|
|
681
|
+
variant="success"
|
|
682
|
+
decoration="underline"
|
|
683
|
+
helperText="Great choice!"
|
|
684
|
+
fullWidth
|
|
685
|
+
>
|
|
686
|
+
<SelectItem value="option1">Option 1</SelectItem>
|
|
687
|
+
<SelectItem value="option2">Option 2</SelectItem>
|
|
688
|
+
</SelectField>
|
|
689
|
+
</div>
|
|
690
|
+
|
|
691
|
+
{/* Outline decoration */}
|
|
692
|
+
<div className="space-y-4">
|
|
693
|
+
<h3 className="text-fm-primary text-lg font-semibold">Outline</h3>
|
|
694
|
+
<SelectField
|
|
695
|
+
label="Default"
|
|
696
|
+
placeholder="Default outline..."
|
|
697
|
+
variant="default"
|
|
698
|
+
decoration="outline"
|
|
699
|
+
helperText="Default variant"
|
|
700
|
+
fullWidth
|
|
701
|
+
>
|
|
702
|
+
<SelectItem value="option1">Option 1</SelectItem>
|
|
703
|
+
<SelectItem value="option2">Option 2</SelectItem>
|
|
704
|
+
</SelectField>
|
|
705
|
+
<SelectField
|
|
706
|
+
label="Error"
|
|
707
|
+
placeholder="Error outline..."
|
|
708
|
+
variant="error"
|
|
709
|
+
decoration="outline"
|
|
710
|
+
helperText="Something went wrong"
|
|
711
|
+
fullWidth
|
|
712
|
+
>
|
|
713
|
+
<SelectItem value="option1">Option 1</SelectItem>
|
|
714
|
+
<SelectItem value="option2">Option 2</SelectItem>
|
|
715
|
+
</SelectField>
|
|
716
|
+
<SelectField
|
|
717
|
+
label="Warning"
|
|
718
|
+
placeholder="Warning outline..."
|
|
719
|
+
variant="warning"
|
|
720
|
+
decoration="outline"
|
|
721
|
+
helperText="Please check selection"
|
|
722
|
+
fullWidth
|
|
723
|
+
>
|
|
724
|
+
<SelectItem value="option1">Option 1</SelectItem>
|
|
725
|
+
<SelectItem value="option2">Option 2</SelectItem>
|
|
726
|
+
</SelectField>
|
|
727
|
+
<SelectField
|
|
728
|
+
label="Success"
|
|
729
|
+
placeholder="Success outline..."
|
|
730
|
+
variant="success"
|
|
731
|
+
decoration="outline"
|
|
732
|
+
helperText="Great choice!"
|
|
733
|
+
fullWidth
|
|
734
|
+
>
|
|
735
|
+
<SelectItem value="option1">Option 1</SelectItem>
|
|
736
|
+
<SelectItem value="option2">Option 2</SelectItem>
|
|
737
|
+
</SelectField>
|
|
738
|
+
</div>
|
|
739
|
+
|
|
740
|
+
{/* Filled decoration */}
|
|
741
|
+
<div className="space-y-4">
|
|
742
|
+
<h3 className="text-fm-primary text-lg font-semibold">Filled</h3>
|
|
743
|
+
<SelectField
|
|
744
|
+
label="Default"
|
|
745
|
+
placeholder="Default filled..."
|
|
746
|
+
variant="default"
|
|
747
|
+
decoration="filled"
|
|
748
|
+
helperText="Default variant"
|
|
749
|
+
fullWidth
|
|
750
|
+
>
|
|
751
|
+
<SelectItem value="option1">Option 1</SelectItem>
|
|
752
|
+
<SelectItem value="option2">Option 2</SelectItem>
|
|
753
|
+
</SelectField>
|
|
754
|
+
<SelectField
|
|
755
|
+
label="Error"
|
|
756
|
+
placeholder="Error filled..."
|
|
757
|
+
variant="error"
|
|
758
|
+
decoration="filled"
|
|
759
|
+
helperText="Something went wrong"
|
|
760
|
+
fullWidth
|
|
761
|
+
>
|
|
762
|
+
<SelectItem value="option1">Option 1</SelectItem>
|
|
763
|
+
<SelectItem value="option2">Option 2</SelectItem>
|
|
764
|
+
</SelectField>
|
|
765
|
+
<SelectField
|
|
766
|
+
label="Warning"
|
|
767
|
+
placeholder="Warning filled..."
|
|
768
|
+
variant="warning"
|
|
769
|
+
decoration="filled"
|
|
770
|
+
helperText="Please check selection"
|
|
771
|
+
fullWidth
|
|
772
|
+
>
|
|
773
|
+
<SelectItem value="option1">Option 1</SelectItem>
|
|
774
|
+
<SelectItem value="option2">Option 2</SelectItem>
|
|
775
|
+
</SelectField>
|
|
776
|
+
<SelectField
|
|
777
|
+
label="Success"
|
|
778
|
+
placeholder="Success filled..."
|
|
779
|
+
variant="success"
|
|
780
|
+
decoration="filled"
|
|
781
|
+
helperText="Great choice!"
|
|
782
|
+
fullWidth
|
|
783
|
+
>
|
|
784
|
+
<SelectItem value="option1">Option 1</SelectItem>
|
|
785
|
+
<SelectItem value="option2">Option 2</SelectItem>
|
|
786
|
+
</SelectField>
|
|
787
|
+
</div>
|
|
788
|
+
</div>
|
|
789
|
+
),
|
|
790
|
+
parameters: {
|
|
791
|
+
docs: {
|
|
792
|
+
description: {
|
|
793
|
+
story:
|
|
794
|
+
"Complete showcase of all visual variants across all decoration styles.",
|
|
795
|
+
},
|
|
796
|
+
},
|
|
797
|
+
},
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
export const ComplexFormExample: Story = {
|
|
801
|
+
render: () => {
|
|
802
|
+
const [country, setCountry] = React.useState("")
|
|
803
|
+
const [framework, setFramework] = React.useState("")
|
|
804
|
+
|
|
805
|
+
return (
|
|
806
|
+
<div className="max-w-lg space-y-6">
|
|
807
|
+
<SelectField
|
|
808
|
+
label="Country"
|
|
809
|
+
placeholder="Select your country"
|
|
810
|
+
value={country}
|
|
811
|
+
onValueChange={setCountry}
|
|
812
|
+
required
|
|
813
|
+
helperText={
|
|
814
|
+
country
|
|
815
|
+
? "Country selected successfully"
|
|
816
|
+
: "Please select your country"
|
|
817
|
+
}
|
|
818
|
+
variant={country ? "success" : "default"}
|
|
819
|
+
decoration="outline"
|
|
820
|
+
fullWidth
|
|
821
|
+
>
|
|
822
|
+
<SelectItem value="us">United States</SelectItem>
|
|
823
|
+
<SelectItem value="ca">Canada</SelectItem>
|
|
824
|
+
<SelectItem value="uk">United Kingdom</SelectItem>
|
|
825
|
+
<SelectItem value="de">Germany</SelectItem>
|
|
826
|
+
<SelectItem value="fr">France</SelectItem>
|
|
827
|
+
</SelectField>
|
|
828
|
+
|
|
829
|
+
<SelectField
|
|
830
|
+
label="Preferred Framework"
|
|
831
|
+
placeholder="Choose your framework"
|
|
832
|
+
value={framework}
|
|
833
|
+
onValueChange={setFramework}
|
|
834
|
+
helperText="This will help us customize your experience"
|
|
835
|
+
decoration="filled"
|
|
836
|
+
fullWidth
|
|
837
|
+
>
|
|
838
|
+
<SelectGroup>
|
|
839
|
+
<SelectLabel className="px-2 pt-2 pb-1">Popular</SelectLabel>
|
|
840
|
+
<SelectItem value="react">React</SelectItem>
|
|
841
|
+
<SelectSeparator />
|
|
842
|
+
<SelectItem value="vue">Vue.js</SelectItem>
|
|
843
|
+
<SelectSeparator />
|
|
844
|
+
<SelectItem value="angular">Angular</SelectItem>
|
|
845
|
+
</SelectGroup>
|
|
846
|
+
<SelectSeparator />
|
|
847
|
+
<SelectGroup>
|
|
848
|
+
<SelectLabel className="px-2 pt-2 pb-1">Others</SelectLabel>
|
|
849
|
+
<SelectItem value="svelte">Svelte</SelectItem>
|
|
850
|
+
<SelectSeparator />
|
|
851
|
+
<SelectItem value="solid">SolidJS</SelectItem>
|
|
852
|
+
</SelectGroup>
|
|
853
|
+
</SelectField>
|
|
854
|
+
</div>
|
|
855
|
+
)
|
|
856
|
+
},
|
|
857
|
+
parameters: {
|
|
858
|
+
docs: {
|
|
859
|
+
description: {
|
|
860
|
+
story:
|
|
861
|
+
"An example showing multiple SelectField components in a form with different configurations, decorations, and dynamic states based on user input.",
|
|
862
|
+
},
|
|
863
|
+
},
|
|
864
|
+
},
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
// Legacy stories for backward compatibility with the old API
|
|
868
|
+
export const LegacyDefault: Story = {
|
|
869
|
+
parameters: {
|
|
870
|
+
docs: {
|
|
871
|
+
description: {
|
|
872
|
+
story:
|
|
873
|
+
"Legacy API example using the atomic Select components directly (for backward compatibility).",
|
|
874
|
+
},
|
|
875
|
+
},
|
|
876
|
+
},
|
|
877
|
+
render: () => (
|
|
878
|
+
<Select>
|
|
879
|
+
<SelectTrigger
|
|
880
|
+
className="w-[180px]"
|
|
881
|
+
variant="default"
|
|
882
|
+
decoration="underline"
|
|
883
|
+
>
|
|
884
|
+
<SelectValue placeholder="Select a fruit" />
|
|
885
|
+
</SelectTrigger>
|
|
886
|
+
<SelectContent>
|
|
887
|
+
<SelectItem value="apple">Apple</SelectItem>
|
|
888
|
+
<SelectSeparator />
|
|
889
|
+
<SelectItem value="banana">Banana</SelectItem>
|
|
890
|
+
<SelectSeparator />
|
|
891
|
+
<SelectItem value="orange">Orange</SelectItem>
|
|
892
|
+
<SelectSeparator />
|
|
893
|
+
<SelectItem value="grape">Grape</SelectItem>
|
|
894
|
+
<SelectSeparator />
|
|
895
|
+
<SelectItem value="strawberry">Strawberry</SelectItem>
|
|
896
|
+
</SelectContent>
|
|
897
|
+
</Select>
|
|
898
|
+
),
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
export const LongList: Story = {
|
|
902
|
+
render: () => (
|
|
903
|
+
<SelectField
|
|
904
|
+
label="Country Selection"
|
|
905
|
+
placeholder="Select a country"
|
|
906
|
+
helperText="Scroll to see more options"
|
|
907
|
+
decoration="outline"
|
|
908
|
+
fullWidth
|
|
909
|
+
>
|
|
910
|
+
<SelectItem value="us">United States</SelectItem>
|
|
911
|
+
<SelectSeparator />
|
|
912
|
+
<SelectItem value="ca">Canada</SelectItem>
|
|
913
|
+
<SelectSeparator />
|
|
914
|
+
<SelectItem value="uk">United Kingdom</SelectItem>
|
|
915
|
+
<SelectSeparator />
|
|
916
|
+
<SelectItem value="fr">France</SelectItem>
|
|
917
|
+
<SelectSeparator />
|
|
918
|
+
<SelectItem value="de">Germany</SelectItem>
|
|
919
|
+
<SelectSeparator />
|
|
920
|
+
<SelectItem value="it">Italy</SelectItem>
|
|
921
|
+
<SelectSeparator />
|
|
922
|
+
<SelectItem value="es">Spain</SelectItem>
|
|
923
|
+
<SelectSeparator />
|
|
924
|
+
<SelectItem value="au">Australia</SelectItem>
|
|
925
|
+
<SelectSeparator />
|
|
926
|
+
<SelectItem value="jp">Japan</SelectItem>
|
|
927
|
+
<SelectSeparator />
|
|
928
|
+
<SelectItem value="kr">South Korea</SelectItem>
|
|
929
|
+
<SelectSeparator />
|
|
930
|
+
<SelectItem value="in">India</SelectItem>
|
|
931
|
+
<SelectSeparator />
|
|
932
|
+
<SelectItem value="br">Brazil</SelectItem>
|
|
933
|
+
<SelectSeparator />
|
|
934
|
+
<SelectItem value="mx">Mexico</SelectItem>
|
|
935
|
+
<SelectSeparator />
|
|
936
|
+
<SelectItem value="ar">Argentina</SelectItem>
|
|
937
|
+
<SelectSeparator />
|
|
938
|
+
<SelectItem value="cl">Chile</SelectItem>
|
|
939
|
+
<SelectSeparator />
|
|
940
|
+
<SelectItem value="pe">Peru</SelectItem>
|
|
941
|
+
<SelectSeparator />
|
|
942
|
+
<SelectItem value="co">Colombia</SelectItem>
|
|
943
|
+
<SelectSeparator />
|
|
944
|
+
<SelectItem value="ve">Venezuela</SelectItem>
|
|
945
|
+
<SelectSeparator />
|
|
946
|
+
<SelectItem value="ec">Ecuador</SelectItem>
|
|
947
|
+
<SelectSeparator />
|
|
948
|
+
<SelectItem value="uy">Uruguay</SelectItem>
|
|
949
|
+
</SelectField>
|
|
950
|
+
),
|
|
951
|
+
parameters: {
|
|
952
|
+
docs: {
|
|
953
|
+
description: {
|
|
954
|
+
story: `
|
|
955
|
+
Select with many options that demonstrates scrolling behavior.
|
|
956
|
+
The content area becomes scrollable when it exceeds the maximum height,
|
|
957
|
+
and scroll buttons appear automatically at the top and bottom.
|
|
958
|
+
`,
|
|
959
|
+
},
|
|
960
|
+
},
|
|
961
|
+
},
|
|
962
|
+
}
|