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,512 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { Divider } from "@components/divider"
|
|
3
|
+
import HelperText from "@components/helper-text"
|
|
4
|
+
import Label from "@components/label"
|
|
5
|
+
import { ChevronDownIcon } from "@icons/chevron-down-icon"
|
|
6
|
+
import { ChevronUpIcon } from "@icons/chevron-up-icon"
|
|
7
|
+
import { TickIcon } from "@icons/tick-icon"
|
|
8
|
+
import { cn } from "@lib/utils"
|
|
9
|
+
import * as SelectPrimitive from "@radix-ui/react-select"
|
|
10
|
+
import { cva } from "class-variance-authority"
|
|
11
|
+
|
|
12
|
+
// CVA for select variants matching input component
|
|
13
|
+
export const selectVariants = cva(
|
|
14
|
+
// Base styles
|
|
15
|
+
"flex w-full items-center justify-between focus:outline-none transition-all duration-200 border-solid tracking-wide font-fm-text text-fm-primary [&>span]:line-clamp-1 data-[placeholder]:text-fm-placeholder",
|
|
16
|
+
{
|
|
17
|
+
variants: {
|
|
18
|
+
variant: {
|
|
19
|
+
default:
|
|
20
|
+
"border-fm-divider-primary focus:border-fm-divider-contrast data-[state=open]:border-fm-divider-contrast",
|
|
21
|
+
error:
|
|
22
|
+
"border-fm-divider-negative focus:border-fm-divider-negative data-[state=open]:border-fm-divider-negative",
|
|
23
|
+
warning:
|
|
24
|
+
"border-fm-divider-warning focus:border-fm-divider-warning data-[state=open]:border-fm-divider-warning",
|
|
25
|
+
success:
|
|
26
|
+
"border-fm-divider-positive focus:border-fm-divider-positive data-[state=open]:border-fm-divider-positive",
|
|
27
|
+
},
|
|
28
|
+
decoration: {
|
|
29
|
+
underline:
|
|
30
|
+
"border-b h-11 leading-fm-xl [font-size:var(--text-fm-xl)] px-0",
|
|
31
|
+
outline:
|
|
32
|
+
"border rounded-fm-s h-12 leading-fm-md [font-size:var(--text-fm-md)] px-4 py-2",
|
|
33
|
+
filled:
|
|
34
|
+
"h-10 rounded-fm-s bg-fm-surface-frosted/20 border leading-fm-md [font-size:var(--text-fm-md)] px-4 py-2",
|
|
35
|
+
},
|
|
36
|
+
state: {
|
|
37
|
+
default: "",
|
|
38
|
+
open: "",
|
|
39
|
+
disabled:
|
|
40
|
+
"border-fm-divider-tertiary !text-fm-inactive cursor-not-allowed",
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
defaultVariants: {
|
|
44
|
+
variant: "default",
|
|
45
|
+
state: "default",
|
|
46
|
+
decoration: "underline",
|
|
47
|
+
},
|
|
48
|
+
}
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
const Select = SelectPrimitive.Root
|
|
52
|
+
|
|
53
|
+
const SelectGroup = SelectPrimitive.Group
|
|
54
|
+
|
|
55
|
+
const SelectValue = SelectPrimitive.Value
|
|
56
|
+
|
|
57
|
+
const SelectTrigger = React.forwardRef<
|
|
58
|
+
React.ElementRef<typeof SelectPrimitive.Trigger>,
|
|
59
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger> & {
|
|
60
|
+
variant?: "default" | "error" | "warning" | "success"
|
|
61
|
+
decoration?: "underline" | "outline" | "filled"
|
|
62
|
+
unstyled?: boolean
|
|
63
|
+
classes?: {
|
|
64
|
+
icon?: string
|
|
65
|
+
root?: string
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
>(
|
|
69
|
+
(
|
|
70
|
+
{
|
|
71
|
+
className,
|
|
72
|
+
children,
|
|
73
|
+
variant = "default",
|
|
74
|
+
decoration = "underline",
|
|
75
|
+
unstyled = false,
|
|
76
|
+
classes = {},
|
|
77
|
+
...props
|
|
78
|
+
},
|
|
79
|
+
ref
|
|
80
|
+
) => (
|
|
81
|
+
<SelectPrimitive.Trigger
|
|
82
|
+
ref={ref}
|
|
83
|
+
className={cn(
|
|
84
|
+
!unstyled &&
|
|
85
|
+
selectVariants({
|
|
86
|
+
variant,
|
|
87
|
+
decoration,
|
|
88
|
+
state: props.disabled ? "disabled" : "default",
|
|
89
|
+
}),
|
|
90
|
+
// Add group class to enable group-based selectors
|
|
91
|
+
"group",
|
|
92
|
+
className,
|
|
93
|
+
classes?.root
|
|
94
|
+
)}
|
|
95
|
+
{...props}
|
|
96
|
+
>
|
|
97
|
+
{children}
|
|
98
|
+
<SelectPrimitive.Icon asChild>
|
|
99
|
+
<ChevronDownIcon
|
|
100
|
+
className={cn(
|
|
101
|
+
"h-6 w-6 transition-transform duration-200 group-data-[state=open]:-rotate-180",
|
|
102
|
+
{
|
|
103
|
+
"text-fm-icon-inactive": props.disabled,
|
|
104
|
+
"text-fm-icon-active": !props.disabled,
|
|
105
|
+
},
|
|
106
|
+
classes?.icon
|
|
107
|
+
)}
|
|
108
|
+
/>
|
|
109
|
+
</SelectPrimitive.Icon>
|
|
110
|
+
</SelectPrimitive.Trigger>
|
|
111
|
+
)
|
|
112
|
+
)
|
|
113
|
+
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName
|
|
114
|
+
|
|
115
|
+
type SelectScrollButtonProps = React.ComponentPropsWithoutRef<
|
|
116
|
+
typeof SelectPrimitive.ScrollDownButton
|
|
117
|
+
> & {
|
|
118
|
+
classes?: {
|
|
119
|
+
root?: string
|
|
120
|
+
icon?: string
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const SelectScrollUpButton = React.forwardRef<
|
|
125
|
+
React.ElementRef<typeof SelectPrimitive.ScrollUpButton>,
|
|
126
|
+
SelectScrollButtonProps
|
|
127
|
+
>(({ className, classes = {}, ...props }, ref) => (
|
|
128
|
+
<SelectPrimitive.ScrollUpButton
|
|
129
|
+
ref={ref}
|
|
130
|
+
className={cn(
|
|
131
|
+
"text-fm-primary hover:bg-fm-surface-frosted/10 flex cursor-default items-center justify-center py-1",
|
|
132
|
+
className,
|
|
133
|
+
classes?.root
|
|
134
|
+
)}
|
|
135
|
+
{...props}
|
|
136
|
+
>
|
|
137
|
+
<ChevronUpIcon className={cn("h-6 w-6", classes?.icon)} />
|
|
138
|
+
</SelectPrimitive.ScrollUpButton>
|
|
139
|
+
))
|
|
140
|
+
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName
|
|
141
|
+
|
|
142
|
+
const SelectScrollDownButton = React.forwardRef<
|
|
143
|
+
React.ElementRef<typeof SelectPrimitive.ScrollDownButton>,
|
|
144
|
+
SelectScrollButtonProps
|
|
145
|
+
>(({ className, classes = {}, ...props }, ref) => (
|
|
146
|
+
<SelectPrimitive.ScrollDownButton
|
|
147
|
+
ref={ref}
|
|
148
|
+
className={cn(
|
|
149
|
+
"text-fm-primary hover:bg-fm-surface-frosted/10 flex cursor-default items-center justify-center py-1",
|
|
150
|
+
className,
|
|
151
|
+
classes?.root
|
|
152
|
+
)}
|
|
153
|
+
{...props}
|
|
154
|
+
>
|
|
155
|
+
<ChevronDownIcon className={cn("h-6 w-6", classes?.icon)} />
|
|
156
|
+
</SelectPrimitive.ScrollDownButton>
|
|
157
|
+
))
|
|
158
|
+
SelectScrollDownButton.displayName =
|
|
159
|
+
SelectPrimitive.ScrollDownButton.displayName
|
|
160
|
+
|
|
161
|
+
const borderVariants = cva("absolute w-full left-0 right-0 top-0 h-0.5 block", {
|
|
162
|
+
variants: {
|
|
163
|
+
variant: {
|
|
164
|
+
default: "bg-(image:--gradient-fm-stroke-neutral)",
|
|
165
|
+
error: "bg-(image:--gradient-fm-stroke-negative)",
|
|
166
|
+
warning: "bg-(image:--gradient-fm-stroke-warning)",
|
|
167
|
+
success: "bg-(image:--gradient-fm-stroke-positive)",
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
defaultVariants: {
|
|
171
|
+
variant: "default",
|
|
172
|
+
},
|
|
173
|
+
})
|
|
174
|
+
|
|
175
|
+
type SelectContentProps = React.ComponentPropsWithoutRef<
|
|
176
|
+
typeof SelectPrimitive.Content
|
|
177
|
+
> & {
|
|
178
|
+
variant?: "default" | "error" | "warning" | "success"
|
|
179
|
+
classes?: {
|
|
180
|
+
portal?: string
|
|
181
|
+
root?: string
|
|
182
|
+
border?: string
|
|
183
|
+
scrollButton?: {
|
|
184
|
+
root?: string
|
|
185
|
+
icon?: string
|
|
186
|
+
}
|
|
187
|
+
viewport?: string
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
const SelectContent = React.forwardRef<
|
|
192
|
+
React.ElementRef<typeof SelectPrimitive.Content>,
|
|
193
|
+
SelectContentProps
|
|
194
|
+
>(
|
|
195
|
+
(
|
|
196
|
+
{
|
|
197
|
+
className,
|
|
198
|
+
children,
|
|
199
|
+
position = "popper",
|
|
200
|
+
variant = "default",
|
|
201
|
+
classes = {},
|
|
202
|
+
...props
|
|
203
|
+
},
|
|
204
|
+
ref
|
|
205
|
+
) => (
|
|
206
|
+
//@ts-expect-error className valid
|
|
207
|
+
<SelectPrimitive.Portal className={cn("z-50", classes?.portal)}>
|
|
208
|
+
<SelectPrimitive.Content
|
|
209
|
+
ref={ref}
|
|
210
|
+
className={cn(
|
|
211
|
+
"bg-fm-surface-frosted/20 relative max-h-96 shadow-lg backdrop-blur-lg",
|
|
212
|
+
position === "popper" &&
|
|
213
|
+
"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
|
|
214
|
+
className,
|
|
215
|
+
classes?.root
|
|
216
|
+
)}
|
|
217
|
+
position={position}
|
|
218
|
+
{...props}
|
|
219
|
+
>
|
|
220
|
+
<div className={cn(borderVariants({ variant }), classes?.border)} />
|
|
221
|
+
<SelectScrollUpButton classes={classes?.scrollButton} />
|
|
222
|
+
<SelectPrimitive.Viewport
|
|
223
|
+
className={cn(
|
|
224
|
+
position === "popper" &&
|
|
225
|
+
"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]",
|
|
226
|
+
classes?.viewport
|
|
227
|
+
)}
|
|
228
|
+
>
|
|
229
|
+
{children}
|
|
230
|
+
</SelectPrimitive.Viewport>
|
|
231
|
+
<SelectScrollDownButton classes={classes?.scrollButton} />
|
|
232
|
+
</SelectPrimitive.Content>
|
|
233
|
+
</SelectPrimitive.Portal>
|
|
234
|
+
)
|
|
235
|
+
)
|
|
236
|
+
SelectContent.displayName = SelectPrimitive.Content.displayName
|
|
237
|
+
|
|
238
|
+
const SelectLabel = React.forwardRef<
|
|
239
|
+
React.ElementRef<typeof SelectPrimitive.Label>,
|
|
240
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label> & {
|
|
241
|
+
required?: boolean
|
|
242
|
+
disabled?: boolean
|
|
243
|
+
}
|
|
244
|
+
>(({ className, required = false, disabled = false, ...props }, ref) => (
|
|
245
|
+
<SelectPrimitive.Label ref={ref} asChild className={className} {...props}>
|
|
246
|
+
<Label required={required} disabled={disabled}>
|
|
247
|
+
{props.children}
|
|
248
|
+
</Label>
|
|
249
|
+
</SelectPrimitive.Label>
|
|
250
|
+
))
|
|
251
|
+
SelectLabel.displayName = SelectPrimitive.Label.displayName
|
|
252
|
+
|
|
253
|
+
type SelectItemProps = React.ComponentPropsWithoutRef<
|
|
254
|
+
typeof SelectPrimitive.Item
|
|
255
|
+
> & {
|
|
256
|
+
classes?: {
|
|
257
|
+
root?: string
|
|
258
|
+
icon?: string
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
const SelectItem = React.forwardRef<
|
|
263
|
+
React.ElementRef<typeof SelectPrimitive.Item>,
|
|
264
|
+
SelectItemProps
|
|
265
|
+
>(({ className, children, classes = {}, ...props }, ref) => (
|
|
266
|
+
<SelectPrimitive.Item
|
|
267
|
+
ref={ref}
|
|
268
|
+
className={cn(
|
|
269
|
+
"leading-fm-lg font-fm-text data-[disabled]:bg-fm-surface-frosted/20 hover:bg-fm-surface-frosted/15 text-fm-primary data-[state=checked]:not-data-[disabled]:bg-fm-surface-frosted/10 focus-visible:bg-fm-surface-frosted/15 group data-[disabled]:text-fm-inactive relative flex h-12 items-center justify-between gap-2 px-4 [font-size:var(--text-fm-lg)] tracking-wide outline-none data-[disabled]:pointer-events-none",
|
|
270
|
+
className,
|
|
271
|
+
classes?.root
|
|
272
|
+
)}
|
|
273
|
+
{...props}
|
|
274
|
+
>
|
|
275
|
+
<span className="absolute right-4 flex h-3.5 w-3.5 items-center justify-center">
|
|
276
|
+
<SelectPrimitive.ItemIndicator>
|
|
277
|
+
<TickIcon
|
|
278
|
+
className={cn(
|
|
279
|
+
"text-fm-icon-active group-data-[disabled]:text-fm-icon-inactive h-6 w-6",
|
|
280
|
+
classes?.icon
|
|
281
|
+
)}
|
|
282
|
+
/>
|
|
283
|
+
</SelectPrimitive.ItemIndicator>
|
|
284
|
+
</span>
|
|
285
|
+
|
|
286
|
+
<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
|
|
287
|
+
</SelectPrimitive.Item>
|
|
288
|
+
))
|
|
289
|
+
SelectItem.displayName = SelectPrimitive.Item.displayName
|
|
290
|
+
|
|
291
|
+
const SelectSeparator = React.forwardRef<
|
|
292
|
+
React.ElementRef<typeof SelectPrimitive.Separator>,
|
|
293
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator> &
|
|
294
|
+
React.ComponentPropsWithoutRef<typeof Divider>
|
|
295
|
+
>(({ className, ...props }, ref) => (
|
|
296
|
+
<SelectPrimitive.Separator ref={ref} className={className} {...props} asChild>
|
|
297
|
+
<Divider variant="dashed" size="full_default" />
|
|
298
|
+
</SelectPrimitive.Separator>
|
|
299
|
+
))
|
|
300
|
+
SelectSeparator.displayName = SelectPrimitive.Separator.displayName
|
|
301
|
+
|
|
302
|
+
const SelectHelperText = React.forwardRef<
|
|
303
|
+
HTMLSpanElement,
|
|
304
|
+
React.ComponentProps<typeof HelperText> & {
|
|
305
|
+
variant?: "default" | "error" | "warning" | "success"
|
|
306
|
+
}
|
|
307
|
+
>((props, ref) => {
|
|
308
|
+
const { variant = "default", children, ...rest } = props
|
|
309
|
+
return (
|
|
310
|
+
<HelperText variant={variant} ref={ref} {...rest}>
|
|
311
|
+
{children}
|
|
312
|
+
</HelperText>
|
|
313
|
+
)
|
|
314
|
+
})
|
|
315
|
+
SelectHelperText.displayName = HelperText.displayName
|
|
316
|
+
|
|
317
|
+
// Compound Select component with label and helper text
|
|
318
|
+
export interface SelectFieldProps {
|
|
319
|
+
label?: React.ReactNode
|
|
320
|
+
helperText?: React.ReactNode
|
|
321
|
+
variant?: "default" | "error" | "warning" | "success"
|
|
322
|
+
decoration?: "underline" | "outline" | "filled"
|
|
323
|
+
required?: boolean
|
|
324
|
+
disabled?: boolean
|
|
325
|
+
fullWidth?: boolean
|
|
326
|
+
className?: string
|
|
327
|
+
children?: React.ReactNode
|
|
328
|
+
value?: string
|
|
329
|
+
onValueChange?: (value: string) => void
|
|
330
|
+
placeholder?: string
|
|
331
|
+
id?: string
|
|
332
|
+
name?: string
|
|
333
|
+
classes?: {
|
|
334
|
+
root?: string
|
|
335
|
+
label?: string
|
|
336
|
+
wrapper?: string
|
|
337
|
+
trigger?: {
|
|
338
|
+
root?: string
|
|
339
|
+
icon?: string
|
|
340
|
+
}
|
|
341
|
+
content?: {
|
|
342
|
+
portal?: string
|
|
343
|
+
root?: string
|
|
344
|
+
border?: string
|
|
345
|
+
scrollButton?: {
|
|
346
|
+
root?: string
|
|
347
|
+
icon?: string
|
|
348
|
+
}
|
|
349
|
+
viewport?: string
|
|
350
|
+
}
|
|
351
|
+
helperText?: string
|
|
352
|
+
}
|
|
353
|
+
"aria-label"?: string
|
|
354
|
+
"aria-describedby"?: string
|
|
355
|
+
"aria-labelledby"?: string
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
const SelectRoot = React.forwardRef<
|
|
359
|
+
HTMLDivElement,
|
|
360
|
+
React.PropsWithChildren<{ className?: string; fullWidth?: boolean }>
|
|
361
|
+
>(({ children, className = "", fullWidth = false }, ref) => (
|
|
362
|
+
<SelectGroup
|
|
363
|
+
ref={ref}
|
|
364
|
+
className={cn(
|
|
365
|
+
"space-y-1",
|
|
366
|
+
{
|
|
367
|
+
"w-full": fullWidth,
|
|
368
|
+
},
|
|
369
|
+
className
|
|
370
|
+
)}
|
|
371
|
+
>
|
|
372
|
+
{children}
|
|
373
|
+
</SelectGroup>
|
|
374
|
+
))
|
|
375
|
+
SelectRoot.displayName = "SelectRoot"
|
|
376
|
+
|
|
377
|
+
const SelectWrapper = React.forwardRef<
|
|
378
|
+
HTMLDivElement,
|
|
379
|
+
React.PropsWithChildren<{ className?: string }>
|
|
380
|
+
>(({ children, className = "" }, ref) => (
|
|
381
|
+
<div ref={ref} className={cn("relative", className)}>
|
|
382
|
+
{children}
|
|
383
|
+
</div>
|
|
384
|
+
))
|
|
385
|
+
SelectWrapper.displayName = "SelectWrapper"
|
|
386
|
+
|
|
387
|
+
const SelectField = React.forwardRef<
|
|
388
|
+
React.ElementRef<typeof SelectTrigger>,
|
|
389
|
+
SelectFieldProps
|
|
390
|
+
>(
|
|
391
|
+
(
|
|
392
|
+
{
|
|
393
|
+
label,
|
|
394
|
+
helperText,
|
|
395
|
+
variant = "default",
|
|
396
|
+
decoration = "underline",
|
|
397
|
+
required = false,
|
|
398
|
+
disabled = false,
|
|
399
|
+
fullWidth = false,
|
|
400
|
+
className = "",
|
|
401
|
+
children,
|
|
402
|
+
value,
|
|
403
|
+
onValueChange,
|
|
404
|
+
placeholder,
|
|
405
|
+
id,
|
|
406
|
+
name,
|
|
407
|
+
classes,
|
|
408
|
+
"aria-label": ariaLabel,
|
|
409
|
+
"aria-describedby": ariaDescribedBy,
|
|
410
|
+
"aria-labelledby": ariaLabelledBy,
|
|
411
|
+
...props
|
|
412
|
+
},
|
|
413
|
+
ref
|
|
414
|
+
) => {
|
|
415
|
+
// Generate unique IDs for accessibility
|
|
416
|
+
const selectId = id || `select-${Math.random().toString(36).substr(2, 9)}`
|
|
417
|
+
const helperTextId = helperText ? `${selectId}-helper` : undefined
|
|
418
|
+
const labelId = label ? `${selectId}-label` : undefined
|
|
419
|
+
|
|
420
|
+
// Build aria-describedby
|
|
421
|
+
const describedByIds = [ariaDescribedBy, helperTextId]
|
|
422
|
+
.filter(Boolean)
|
|
423
|
+
.join(" ")
|
|
424
|
+
|
|
425
|
+
// Build aria-labelledby
|
|
426
|
+
const labelledByIds = [ariaLabelledBy, labelId].filter(Boolean).join(" ")
|
|
427
|
+
|
|
428
|
+
return (
|
|
429
|
+
<SelectRoot
|
|
430
|
+
fullWidth={fullWidth}
|
|
431
|
+
className={cn(className, classes?.root)}
|
|
432
|
+
>
|
|
433
|
+
{/* Label */}
|
|
434
|
+
{label && (
|
|
435
|
+
<SelectLabel
|
|
436
|
+
id={labelId}
|
|
437
|
+
required={required}
|
|
438
|
+
disabled={disabled}
|
|
439
|
+
className={classes?.label}
|
|
440
|
+
>
|
|
441
|
+
{label}
|
|
442
|
+
</SelectLabel>
|
|
443
|
+
)}
|
|
444
|
+
|
|
445
|
+
{/* Select wrapper */}
|
|
446
|
+
<SelectWrapper className={classes?.wrapper}>
|
|
447
|
+
<Select
|
|
448
|
+
value={value}
|
|
449
|
+
onValueChange={onValueChange}
|
|
450
|
+
disabled={disabled}
|
|
451
|
+
required={required}
|
|
452
|
+
name={name}
|
|
453
|
+
{...props}
|
|
454
|
+
>
|
|
455
|
+
<SelectTrigger
|
|
456
|
+
ref={ref}
|
|
457
|
+
id={selectId}
|
|
458
|
+
variant={variant}
|
|
459
|
+
decoration={decoration}
|
|
460
|
+
disabled={disabled}
|
|
461
|
+
className={className}
|
|
462
|
+
aria-label={ariaLabel}
|
|
463
|
+
aria-describedby={describedByIds || undefined}
|
|
464
|
+
aria-labelledby={labelledByIds || undefined}
|
|
465
|
+
aria-required={required}
|
|
466
|
+
aria-invalid={variant === "error"}
|
|
467
|
+
classes={classes?.trigger}
|
|
468
|
+
>
|
|
469
|
+
<SelectValue placeholder={placeholder} />
|
|
470
|
+
</SelectTrigger>
|
|
471
|
+
|
|
472
|
+
<SelectContent variant={variant} classes={classes?.content}>
|
|
473
|
+
{children}
|
|
474
|
+
</SelectContent>
|
|
475
|
+
</Select>
|
|
476
|
+
</SelectWrapper>
|
|
477
|
+
|
|
478
|
+
{/* Helper text */}
|
|
479
|
+
{helperText && (
|
|
480
|
+
<SelectHelperText
|
|
481
|
+
variant={variant}
|
|
482
|
+
id={helperTextId}
|
|
483
|
+
disabled={disabled}
|
|
484
|
+
className={classes?.helperText}
|
|
485
|
+
>
|
|
486
|
+
{helperText}
|
|
487
|
+
</SelectHelperText>
|
|
488
|
+
)}
|
|
489
|
+
</SelectRoot>
|
|
490
|
+
)
|
|
491
|
+
}
|
|
492
|
+
)
|
|
493
|
+
SelectField.displayName = "SelectField"
|
|
494
|
+
|
|
495
|
+
export {
|
|
496
|
+
Select,
|
|
497
|
+
SelectGroup,
|
|
498
|
+
SelectValue,
|
|
499
|
+
SelectTrigger,
|
|
500
|
+
SelectContent,
|
|
501
|
+
SelectLabel,
|
|
502
|
+
SelectItem,
|
|
503
|
+
SelectSeparator,
|
|
504
|
+
SelectScrollUpButton,
|
|
505
|
+
SelectScrollDownButton,
|
|
506
|
+
SelectHelperText,
|
|
507
|
+
SelectField,
|
|
508
|
+
SelectRoot,
|
|
509
|
+
SelectWrapper,
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
export type { SelectTrigger as SelectTriggerType }
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export const meta = {
|
|
2
|
+
dependencies: {
|
|
3
|
+
"@radix-ui/react-select": "^2.2.5",
|
|
4
|
+
},
|
|
5
|
+
devDependencies: {},
|
|
6
|
+
internalDependencies: [
|
|
7
|
+
"chevron-down-icon",
|
|
8
|
+
"chevron-up-icon",
|
|
9
|
+
"divider",
|
|
10
|
+
"helper-text",
|
|
11
|
+
"label",
|
|
12
|
+
"tick-icon",
|
|
13
|
+
],
|
|
14
|
+
tokens: [
|
|
15
|
+
"--color-fm-divider-contrast",
|
|
16
|
+
"--color-fm-divider-negative",
|
|
17
|
+
"--color-fm-divider-positive",
|
|
18
|
+
"--color-fm-divider-primary",
|
|
19
|
+
"--color-fm-divider-tertiary",
|
|
20
|
+
"--color-fm-divider-warning",
|
|
21
|
+
"--color-fm-icon-active",
|
|
22
|
+
"--color-fm-icon-inactive",
|
|
23
|
+
"--color-fm-inactive",
|
|
24
|
+
"--color-fm-placeholder",
|
|
25
|
+
"--color-fm-primary",
|
|
26
|
+
"--color-fm-surface-frosted",
|
|
27
|
+
"--font-fm-text",
|
|
28
|
+
"--gradient-fm-stroke-negative",
|
|
29
|
+
"--gradient-fm-stroke-neutral",
|
|
30
|
+
"--gradient-fm-stroke-positive",
|
|
31
|
+
"--gradient-fm-stroke-warning",
|
|
32
|
+
"--leading-fm-lg",
|
|
33
|
+
"--leading-fm-md",
|
|
34
|
+
"--leading-fm-xl",
|
|
35
|
+
"--radius-fm-s",
|
|
36
|
+
"--text-fm-lg",
|
|
37
|
+
"--text-fm-md",
|
|
38
|
+
"--text-fm-xl",
|
|
39
|
+
],
|
|
40
|
+
}
|