@fanvue/ui 3.28.0 → 3.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +62 -0
- package/THIRD-PARTY-NOTICES.md +97 -0
- package/dist/animated-icons.d.ts +1542 -0
- package/dist/animated-icons.mjs +142 -0
- package/dist/animated-icons.mjs.map +1 -0
- package/dist/cjs/animated-icons.cjs +142 -0
- package/dist/cjs/animated-icons.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/AIIcon.cjs +105 -0
- package/dist/cjs/components/AnimatedIcons/AIIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/AddIcon.cjs +69 -0
- package/dist/cjs/components/AnimatedIcons/AddIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/AffiliatesIcon.cjs +80 -0
- package/dist/cjs/components/AnimatedIcons/AffiliatesIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/ArrowDownIcon.cjs +78 -0
- package/dist/cjs/components/AnimatedIcons/ArrowDownIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/ArrowLeftIcon.cjs +78 -0
- package/dist/cjs/components/AnimatedIcons/ArrowLeftIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/ArrowRightIcon.cjs +78 -0
- package/dist/cjs/components/AnimatedIcons/ArrowRightIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/ArrowUpIcon.cjs +78 -0
- package/dist/cjs/components/AnimatedIcons/ArrowUpIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/ArrowUpRightIcon.cjs +77 -0
- package/dist/cjs/components/AnimatedIcons/ArrowUpRightIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/AtSignIcon.cjs +106 -0
- package/dist/cjs/components/AnimatedIcons/AtSignIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/BellIcon.cjs +69 -0
- package/dist/cjs/components/AnimatedIcons/BellIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/BoltIcon.cjs +86 -0
- package/dist/cjs/components/AnimatedIcons/BoltIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/CalendarIcon.cjs +100 -0
- package/dist/cjs/components/AnimatedIcons/CalendarIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/CardIcon.cjs +77 -0
- package/dist/cjs/components/AnimatedIcons/CardIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/CheckIcon.cjs +83 -0
- package/dist/cjs/components/AnimatedIcons/CheckIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/CheckOutlineIcon.cjs +84 -0
- package/dist/cjs/components/AnimatedIcons/CheckOutlineIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/ChevronDownIcon.cjs +76 -0
- package/dist/cjs/components/AnimatedIcons/ChevronDownIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/ChevronLeftIcon.cjs +76 -0
- package/dist/cjs/components/AnimatedIcons/ChevronLeftIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/ChevronRightIcon.cjs +76 -0
- package/dist/cjs/components/AnimatedIcons/ChevronRightIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/ChevronUpIcon.cjs +76 -0
- package/dist/cjs/components/AnimatedIcons/ChevronUpIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/ClockIcon.cjs +116 -0
- package/dist/cjs/components/AnimatedIcons/ClockIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/CloseIcon.cjs +82 -0
- package/dist/cjs/components/AnimatedIcons/CloseIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/CogIcon.cjs +81 -0
- package/dist/cjs/components/AnimatedIcons/CogIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/CoinIcon.cjs +116 -0
- package/dist/cjs/components/AnimatedIcons/CoinIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/CopyIcon.cjs +92 -0
- package/dist/cjs/components/AnimatedIcons/CopyIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/CrossIcon.cjs +76 -0
- package/dist/cjs/components/AnimatedIcons/CrossIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/DiscordIcon.cjs +130 -0
- package/dist/cjs/components/AnimatedIcons/DiscordIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/DoubleTickIcon.cjs +103 -0
- package/dist/cjs/components/AnimatedIcons/DoubleTickIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/DownloadIcon.cjs +74 -0
- package/dist/cjs/components/AnimatedIcons/DownloadIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/EmojiIcon.cjs +151 -0
- package/dist/cjs/components/AnimatedIcons/EmojiIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/ExpandIcon.cjs +86 -0
- package/dist/cjs/components/AnimatedIcons/ExpandIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/EyeIcon.cjs +84 -0
- package/dist/cjs/components/AnimatedIcons/EyeIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/EyeOffIcon.cjs +70 -0
- package/dist/cjs/components/AnimatedIcons/EyeOffIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/FlameIcon.cjs +81 -0
- package/dist/cjs/components/AnimatedIcons/FlameIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/HeartIcon.cjs +67 -0
- package/dist/cjs/components/AnimatedIcons/HeartIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/HelpIcon.cjs +77 -0
- package/dist/cjs/components/AnimatedIcons/HelpIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/HomeIcon.cjs +81 -0
- package/dist/cjs/components/AnimatedIcons/HomeIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/HourglassIcon.cjs +84 -0
- package/dist/cjs/components/AnimatedIcons/HourglassIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/LanguageIcon.cjs +103 -0
- package/dist/cjs/components/AnimatedIcons/LanguageIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/LinkIcon.cjs +90 -0
- package/dist/cjs/components/AnimatedIcons/LinkIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/LocationIcon.cjs +99 -0
- package/dist/cjs/components/AnimatedIcons/LocationIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/LockerIcon.cjs +95 -0
- package/dist/cjs/components/AnimatedIcons/LockerIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/MenuCloseIcon.cjs +76 -0
- package/dist/cjs/components/AnimatedIcons/MenuCloseIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/MenuIcon.cjs +113 -0
- package/dist/cjs/components/AnimatedIcons/MenuIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/MenuOpenIcon.cjs +76 -0
- package/dist/cjs/components/AnimatedIcons/MenuOpenIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/MicrophoneIcon.cjs +82 -0
- package/dist/cjs/components/AnimatedIcons/MicrophoneIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/NewMessageIcon.cjs +102 -0
- package/dist/cjs/components/AnimatedIcons/NewMessageIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/OpenIcon.cjs +79 -0
- package/dist/cjs/components/AnimatedIcons/OpenIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/PeopleIcon.cjs +79 -0
- package/dist/cjs/components/AnimatedIcons/PeopleIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/PhoneIcon.cjs +73 -0
- package/dist/cjs/components/AnimatedIcons/PhoneIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/PlusIcon.cjs +68 -0
- package/dist/cjs/components/AnimatedIcons/PlusIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/ReverseIcon.cjs +132 -0
- package/dist/cjs/components/AnimatedIcons/ReverseIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/SearchIcon.cjs +71 -0
- package/dist/cjs/components/AnimatedIcons/SearchIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/SendIcon.cjs +104 -0
- package/dist/cjs/components/AnimatedIcons/SendIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/SettingsIcon.cjs +241 -0
- package/dist/cjs/components/AnimatedIcons/SettingsIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/SoundIcon.cjs +127 -0
- package/dist/cjs/components/AnimatedIcons/SoundIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/SunIcon.cjs +84 -0
- package/dist/cjs/components/AnimatedIcons/SunIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/ThumbDownIcon.cjs +73 -0
- package/dist/cjs/components/AnimatedIcons/ThumbDownIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/ThumbUpIcon.cjs +73 -0
- package/dist/cjs/components/AnimatedIcons/ThumbUpIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/TickCircleIcon.cjs +85 -0
- package/dist/cjs/components/AnimatedIcons/TickCircleIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/TickIcon.cjs +89 -0
- package/dist/cjs/components/AnimatedIcons/TickIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/TrashBinIcon.cjs +111 -0
- package/dist/cjs/components/AnimatedIcons/TrashBinIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/TrashIcon.cjs +112 -0
- package/dist/cjs/components/AnimatedIcons/TrashIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/UploadCloudIcon.cjs +78 -0
- package/dist/cjs/components/AnimatedIcons/UploadCloudIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/UploadIcon.cjs +74 -0
- package/dist/cjs/components/AnimatedIcons/UploadIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/UploadToCloudIcon.cjs +84 -0
- package/dist/cjs/components/AnimatedIcons/UploadToCloudIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/UsersIcon.cjs +80 -0
- package/dist/cjs/components/AnimatedIcons/UsersIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/WalletIcon.cjs +91 -0
- package/dist/cjs/components/AnimatedIcons/WalletIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/WifiIcon.cjs +87 -0
- package/dist/cjs/components/AnimatedIcons/WifiIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/WrenchIcon.cjs +73 -0
- package/dist/cjs/components/AnimatedIcons/WrenchIcon.cjs.map +1 -0
- package/dist/cjs/components/AnimatedIcons/useIconAnimation.cjs +87 -0
- package/dist/cjs/components/AnimatedIcons/useIconAnimation.cjs.map +1 -0
- package/dist/cjs/components/Button/Button.cjs +1 -1
- package/dist/cjs/components/Button/Button.cjs.map +1 -1
- package/dist/cjs/components/ChatMessage/ChatMessage.cjs +1 -1
- package/dist/cjs/components/ChatMessage/ChatMessage.cjs.map +1 -1
- package/dist/cjs/components/DatePicker/DatePicker.cjs +1 -1
- package/dist/cjs/components/DatePicker/DatePicker.cjs.map +1 -1
- package/dist/cjs/components/Icons/BaseIcon.cjs +2 -6
- package/dist/cjs/components/Icons/BaseIcon.cjs.map +1 -1
- package/dist/cjs/components/Icons/iconSizeClass.cjs +10 -0
- package/dist/cjs/components/Icons/iconSizeClass.cjs.map +1 -0
- package/dist/cjs/components/SegmentedControl/SegmentedControl.cjs +21 -6
- package/dist/cjs/components/SegmentedControl/SegmentedControl.cjs.map +1 -1
- package/dist/components/AnimatedIcons/AIIcon.mjs +88 -0
- package/dist/components/AnimatedIcons/AIIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/AddIcon.mjs +52 -0
- package/dist/components/AnimatedIcons/AddIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/AffiliatesIcon.mjs +63 -0
- package/dist/components/AnimatedIcons/AffiliatesIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/ArrowDownIcon.mjs +61 -0
- package/dist/components/AnimatedIcons/ArrowDownIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/ArrowLeftIcon.mjs +61 -0
- package/dist/components/AnimatedIcons/ArrowLeftIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/ArrowRightIcon.mjs +61 -0
- package/dist/components/AnimatedIcons/ArrowRightIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/ArrowUpIcon.mjs +61 -0
- package/dist/components/AnimatedIcons/ArrowUpIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/ArrowUpRightIcon.mjs +60 -0
- package/dist/components/AnimatedIcons/ArrowUpRightIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/AtSignIcon.mjs +89 -0
- package/dist/components/AnimatedIcons/AtSignIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/BellIcon.mjs +52 -0
- package/dist/components/AnimatedIcons/BellIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/BoltIcon.mjs +69 -0
- package/dist/components/AnimatedIcons/BoltIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/CalendarIcon.mjs +83 -0
- package/dist/components/AnimatedIcons/CalendarIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/CardIcon.mjs +60 -0
- package/dist/components/AnimatedIcons/CardIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/CheckIcon.mjs +66 -0
- package/dist/components/AnimatedIcons/CheckIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/CheckOutlineIcon.mjs +67 -0
- package/dist/components/AnimatedIcons/CheckOutlineIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/ChevronDownIcon.mjs +59 -0
- package/dist/components/AnimatedIcons/ChevronDownIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/ChevronLeftIcon.mjs +59 -0
- package/dist/components/AnimatedIcons/ChevronLeftIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/ChevronRightIcon.mjs +59 -0
- package/dist/components/AnimatedIcons/ChevronRightIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/ChevronUpIcon.mjs +59 -0
- package/dist/components/AnimatedIcons/ChevronUpIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/ClockIcon.mjs +99 -0
- package/dist/components/AnimatedIcons/ClockIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/CloseIcon.mjs +65 -0
- package/dist/components/AnimatedIcons/CloseIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/CogIcon.mjs +64 -0
- package/dist/components/AnimatedIcons/CogIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/CoinIcon.mjs +99 -0
- package/dist/components/AnimatedIcons/CoinIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/CopyIcon.mjs +75 -0
- package/dist/components/AnimatedIcons/CopyIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/CrossIcon.mjs +59 -0
- package/dist/components/AnimatedIcons/CrossIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/DiscordIcon.mjs +113 -0
- package/dist/components/AnimatedIcons/DiscordIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/DoubleTickIcon.mjs +86 -0
- package/dist/components/AnimatedIcons/DoubleTickIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/DownloadIcon.mjs +57 -0
- package/dist/components/AnimatedIcons/DownloadIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/EmojiIcon.mjs +134 -0
- package/dist/components/AnimatedIcons/EmojiIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/ExpandIcon.mjs +69 -0
- package/dist/components/AnimatedIcons/ExpandIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/EyeIcon.mjs +67 -0
- package/dist/components/AnimatedIcons/EyeIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/EyeOffIcon.mjs +53 -0
- package/dist/components/AnimatedIcons/EyeOffIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/FlameIcon.mjs +64 -0
- package/dist/components/AnimatedIcons/FlameIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/HeartIcon.mjs +50 -0
- package/dist/components/AnimatedIcons/HeartIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/HelpIcon.mjs +60 -0
- package/dist/components/AnimatedIcons/HelpIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/HomeIcon.mjs +64 -0
- package/dist/components/AnimatedIcons/HomeIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/HourglassIcon.mjs +67 -0
- package/dist/components/AnimatedIcons/HourglassIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/LanguageIcon.mjs +86 -0
- package/dist/components/AnimatedIcons/LanguageIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/LinkIcon.mjs +73 -0
- package/dist/components/AnimatedIcons/LinkIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/LocationIcon.mjs +82 -0
- package/dist/components/AnimatedIcons/LocationIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/LockerIcon.mjs +78 -0
- package/dist/components/AnimatedIcons/LockerIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/MenuCloseIcon.mjs +59 -0
- package/dist/components/AnimatedIcons/MenuCloseIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/MenuIcon.mjs +96 -0
- package/dist/components/AnimatedIcons/MenuIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/MenuOpenIcon.mjs +59 -0
- package/dist/components/AnimatedIcons/MenuOpenIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/MicrophoneIcon.mjs +65 -0
- package/dist/components/AnimatedIcons/MicrophoneIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/NewMessageIcon.mjs +85 -0
- package/dist/components/AnimatedIcons/NewMessageIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/OpenIcon.mjs +62 -0
- package/dist/components/AnimatedIcons/OpenIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/PeopleIcon.mjs +62 -0
- package/dist/components/AnimatedIcons/PeopleIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/PhoneIcon.mjs +56 -0
- package/dist/components/AnimatedIcons/PhoneIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/PlusIcon.mjs +51 -0
- package/dist/components/AnimatedIcons/PlusIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/ReverseIcon.mjs +115 -0
- package/dist/components/AnimatedIcons/ReverseIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/SearchIcon.mjs +54 -0
- package/dist/components/AnimatedIcons/SearchIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/SendIcon.mjs +87 -0
- package/dist/components/AnimatedIcons/SendIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/SettingsIcon.mjs +224 -0
- package/dist/components/AnimatedIcons/SettingsIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/SoundIcon.mjs +110 -0
- package/dist/components/AnimatedIcons/SoundIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/SunIcon.mjs +67 -0
- package/dist/components/AnimatedIcons/SunIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/ThumbDownIcon.mjs +56 -0
- package/dist/components/AnimatedIcons/ThumbDownIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/ThumbUpIcon.mjs +56 -0
- package/dist/components/AnimatedIcons/ThumbUpIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/TickCircleIcon.mjs +68 -0
- package/dist/components/AnimatedIcons/TickCircleIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/TickIcon.mjs +72 -0
- package/dist/components/AnimatedIcons/TickIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/TrashBinIcon.mjs +94 -0
- package/dist/components/AnimatedIcons/TrashBinIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/TrashIcon.mjs +95 -0
- package/dist/components/AnimatedIcons/TrashIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/UploadCloudIcon.mjs +61 -0
- package/dist/components/AnimatedIcons/UploadCloudIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/UploadIcon.mjs +57 -0
- package/dist/components/AnimatedIcons/UploadIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/UploadToCloudIcon.mjs +67 -0
- package/dist/components/AnimatedIcons/UploadToCloudIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/UsersIcon.mjs +63 -0
- package/dist/components/AnimatedIcons/UsersIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/WalletIcon.mjs +74 -0
- package/dist/components/AnimatedIcons/WalletIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/WifiIcon.mjs +70 -0
- package/dist/components/AnimatedIcons/WifiIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/WrenchIcon.mjs +56 -0
- package/dist/components/AnimatedIcons/WrenchIcon.mjs.map +1 -0
- package/dist/components/AnimatedIcons/useIconAnimation.mjs +70 -0
- package/dist/components/AnimatedIcons/useIconAnimation.mjs.map +1 -0
- package/dist/components/Button/Button.mjs +1 -1
- package/dist/components/Button/Button.mjs.map +1 -1
- package/dist/components/ChatMessage/ChatMessage.mjs +1 -1
- package/dist/components/ChatMessage/ChatMessage.mjs.map +1 -1
- package/dist/components/DatePicker/DatePicker.mjs +1 -1
- package/dist/components/DatePicker/DatePicker.mjs.map +1 -1
- package/dist/components/Icons/BaseIcon.mjs +2 -6
- package/dist/components/Icons/BaseIcon.mjs.map +1 -1
- package/dist/components/Icons/iconSizeClass.mjs +10 -0
- package/dist/components/Icons/iconSizeClass.mjs.map +1 -0
- package/dist/components/SegmentedControl/SegmentedControl.mjs +21 -6
- package/dist/components/SegmentedControl/SegmentedControl.mjs.map +1 -1
- package/dist/index.d.ts +19 -6
- package/dist/styles/base.css +42 -0
- package/dist/styles/theme.css +283 -64
- package/package.json +32 -3
|
@@ -2,11 +2,7 @@
|
|
|
2
2
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { cn } from "../../utils/cn.mjs";
|
|
5
|
-
|
|
6
|
-
16: "size-4",
|
|
7
|
-
24: "size-6",
|
|
8
|
-
32: "size-8"
|
|
9
|
-
};
|
|
5
|
+
import { ICON_SIZE_CLASS } from "./iconSizeClass.mjs";
|
|
10
6
|
const LAYER_TRANSITION = "motion-safe:transition-opacity motion-safe:duration-150 motion-safe:ease-in-out";
|
|
11
7
|
const renderPath = (p) => p.sw !== void 0 ? /* @__PURE__ */ jsx(
|
|
12
8
|
"path",
|
|
@@ -46,7 +42,7 @@ const BaseIcon = React.forwardRef(
|
|
|
46
42
|
viewBox: `0 0 ${size} ${size}`,
|
|
47
43
|
fill: "none",
|
|
48
44
|
"aria-hidden": "true",
|
|
49
|
-
className: cn(
|
|
45
|
+
className: cn(ICON_SIZE_CLASS[size], className),
|
|
50
46
|
...props,
|
|
51
47
|
children: [
|
|
52
48
|
/* @__PURE__ */ jsx("g", { className: cn(LAYER_TRANSITION, showFilled ? "opacity-0" : "opacity-100"), children: outlined.map(renderPath) }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseIcon.mjs","sources":["../../../src/components/Icons/BaseIcon.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"@/utils/cn\";\nimport
|
|
1
|
+
{"version":3,"file":"BaseIcon.mjs","sources":["../../../src/components/Icons/BaseIcon.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"@/utils/cn\";\nimport { ICON_SIZE_CLASS } from \"./iconSizeClass\";\nimport type { BaseIconProps, IconPath, IconVariants } from \"./types\";\n\nconst LAYER_TRANSITION =\n \"motion-safe:transition-opacity motion-safe:duration-150 motion-safe:ease-in-out\";\n\ninterface InternalBaseIconProps extends BaseIconProps {\n variants: IconVariants;\n}\n\nconst renderPath = (p: IconPath) =>\n p.sw !== undefined ? (\n <path\n key={p.d}\n d={p.d}\n stroke=\"currentColor\"\n strokeWidth={p.sw}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n ) : (\n <path\n key={p.d}\n d={p.d}\n fill=\"currentColor\"\n fillRule={p.eo ? \"evenodd\" : undefined}\n clipRule={p.eo ? \"evenodd\" : undefined}\n />\n );\n\n/**\n * Internal renderer for prop-based icons. Each public icon (e.g. `HeartIcon`)\n * is a thin wrapper that supplies its own `variants` table and re-exports\n * {@link BaseIconProps} as `*IconProps`. Not exported from the package.\n *\n * When a `filled` variant exists, both layers are rendered simultaneously and\n * the `filled` prop crossfades between them. The same `<svg>` and `<g>` nodes\n * persist across toggles so the transition is visible rather than an instant\n * remount.\n */\nexport const BaseIcon = React.forwardRef<SVGSVGElement, InternalBaseIconProps>(\n ({ variants, size = 24, filled, className, ...props }, ref) => {\n const v = variants[size];\n const outlined = v?.outlined ?? [];\n const filledPaths = v?.filled;\n const showFilled = !!(filled && filledPaths);\n\n if (filled && !filledPaths && v && process.env.NODE_ENV !== \"production\") {\n console.warn(\n `[fanvue/ui] Icon at size=${size} has no 'filled' variant; falling back to outlined.`,\n );\n }\n\n return (\n <svg\n ref={ref}\n viewBox={`0 0 ${size} ${size}`}\n fill=\"none\"\n aria-hidden=\"true\"\n className={cn(ICON_SIZE_CLASS[size], className)}\n {...props}\n >\n <g className={cn(LAYER_TRANSITION, showFilled ? \"opacity-0\" : \"opacity-100\")}>\n {outlined.map(renderPath)}\n </g>\n {filledPaths && (\n <g className={cn(LAYER_TRANSITION, showFilled ? \"opacity-100\" : \"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AAE,WAAW,GAAG,kBAAkB,aAAa,gBAAgB,WAAW,GACxE,UAAA,YAAY,IAAI,UAAU,EAAA,CAC7B;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;AAEA,SAAS,cAAc;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"iconSizeClass.mjs","sources":["../../../src/components/Icons/iconSizeClass.ts"],"sourcesContent":["import type { IconSize } from \"./types\";\n\n/**\n * Tailwind box class for each authored icon size. Shared by {@link BaseIcon} and\n * the animated icons in `src/components/AnimatedIcons` so an animated icon always\n * occupies exactly the same box as its static twin.\n *\n * Internal — not exported from the package.\n */\nexport const ICON_SIZE_CLASS: Record<IconSize, string> = {\n 16: \"size-4\",\n 24: \"size-6\",\n 32: \"size-8\",\n};\n"],"names":[],"mappings":";AASO,MAAM,kBAA4C;AAAA,EACvD,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;"}
|
|
@@ -45,6 +45,7 @@ function getSegmentClassName({
|
|
|
45
45
|
size,
|
|
46
46
|
variant,
|
|
47
47
|
isSelected,
|
|
48
|
+
isAiSegment,
|
|
48
49
|
disabled
|
|
49
50
|
}) {
|
|
50
51
|
return cn(
|
|
@@ -61,11 +62,17 @@ function getSegmentClassName({
|
|
|
61
62
|
sizeClasses[size],
|
|
62
63
|
// brand renders icon + label together, so space them.
|
|
63
64
|
appearance === "brand" && "gap-1.5",
|
|
64
|
-
isSelected ? appearance === "brand" ? (
|
|
65
|
-
//
|
|
66
|
-
//
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
isSelected ? appearance === "brand" && isAiSegment ? (
|
|
66
|
+
// The AI segment: translucent AI fill plus the AI gradient stroke. Scoped to the
|
|
67
|
+
// segment marked `ai` rather than to whatever is selected, so a brand stroke never
|
|
68
|
+
// lands on a segment that should read as plain.
|
|
69
|
+
"fv-ai-stroke bg-buttons-ai-default text-content-primary"
|
|
70
|
+
) : (
|
|
71
|
+
// Every other selected segment, `brand` included, takes the neutral pill. Its
|
|
72
|
+
// tokens invert with the theme, so this is a white pill on dark and a black one on
|
|
73
|
+
// light.
|
|
74
|
+
"bg-buttons-primary-default text-content-primary-inverted shadow-sm"
|
|
75
|
+
) : "text-content-primary hover:bg-buttons-switch-hover"
|
|
69
76
|
),
|
|
70
77
|
disabled && "pointer-events-none"
|
|
71
78
|
);
|
|
@@ -191,7 +198,14 @@ const SegmentedControl = React.forwardRef(
|
|
|
191
198
|
"aria-label": showLabelText ? void 0 : option.label,
|
|
192
199
|
onClick: () => handleSelect(option.value),
|
|
193
200
|
onKeyDown: (e) => handleKeyDown(e, index),
|
|
194
|
-
className: getSegmentClassName({
|
|
201
|
+
className: getSegmentClassName({
|
|
202
|
+
appearance,
|
|
203
|
+
size,
|
|
204
|
+
variant,
|
|
205
|
+
isSelected,
|
|
206
|
+
isAiSegment: option.ai === true,
|
|
207
|
+
disabled
|
|
208
|
+
}),
|
|
195
209
|
children: [
|
|
196
210
|
option.icon && /* @__PURE__ */ jsx("span", { className: "flex shrink-0 items-center justify-center", "aria-hidden": "true", children: option.icon }),
|
|
197
211
|
showLabelText && /* @__PURE__ */ jsx("span", { className: "min-w-0 truncate", children: option.label })
|
|
@@ -215,6 +229,7 @@ const SegmentedControl = React.forwardRef(
|
|
|
215
229
|
size,
|
|
216
230
|
variant: "hug",
|
|
217
231
|
isSelected: currentValue === option.value,
|
|
232
|
+
isAiSegment: option.ai === true,
|
|
218
233
|
disabled
|
|
219
234
|
}),
|
|
220
235
|
children: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SegmentedControl.mjs","sources":["../../../src/components/SegmentedControl/SegmentedControl.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\n\n/** Height of the segmented control in pixels. */\nexport type SegmentedControlSize = \"32\" | \"40\" | \"48\";\n\n/**\n * Segment layout.\n * - `\"hug\"`: each segment is sized to its content.\n * - `\"fill\"`: the control spans the full width of its container and each segment grows equally.\n */\nexport type SegmentedControlVariant = \"hug\" | \"fill\";\n\n/**\n * Visual style of the control.\n * - `\"pill\"`: the container has a muted background and the selected segment shows a filled pill (default).\n * - `\"plain\"`: no container or selected-pill background; segments are bare content and selection is\n * communicated by color alone. Designed for icon-only toggles (e.g. a list/grid view switch).\n * - `\"brand\"`: like `\"pill\"`, but segments render their `icon` alongside the visible `label` and the\n * selected segment uses the brand-green pill. Designed for prominent toggles such as the\n * Home/Agent navigation switch.\n */\nexport type SegmentedControlAppearance = \"pill\" | \"plain\" | \"brand\";\n\n/** Describes one selectable segment. */\nexport interface SegmentedControlOption {\n /**\n * Display label for the segment. In `pill`/`plain` appearances, when `icon` is provided the\n * segment renders icon-only and this value becomes its accessible name (applied as `aria-label`)\n * instead of visible text. In the `brand` appearance the label is always rendered as visible text\n * (alongside the icon when present).\n */\n label: string;\n /** Value identifier returned via `onChange`. */\n value: string;\n /**\n * Icon to render for the segment. In `pill`/`plain` appearances the segment renders icon-only and\n * `label` becomes required as its accessible name (applied as `aria-label`, no visible text). In\n * the `brand` appearance the icon renders alongside the visible `label`. Required for every option\n * when `collapsible` is set unless a `collapsedIcon` is given, since the collapsed control\n * otherwise shows the selected option's icon alone.\n */\n icon?: React.ReactNode;\n}\n\nexport interface SegmentedControlProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, \"onChange\"> {\n /** Height of the control in pixels. @default \"32\" */\n size?: SegmentedControlSize;\n /** Segment layout. @default \"hug\" */\n variant?: SegmentedControlVariant;\n /** Visual style of the control. @default \"pill\" */\n appearance?: SegmentedControlAppearance;\n /** The selectable segments. Designed for two or three mutually exclusive options. */\n options: SegmentedControlOption[];\n /** Currently selected value (controlled). */\n value?: string;\n /** Initially selected value (uncontrolled). Defaults to the first option. */\n defaultValue?: string;\n /** Callback fired when the selected value changes. */\n onChange?: (value: string) => void;\n /** Whether the control is disabled. @default false */\n disabled?: boolean;\n /**\n * When `true`, the control automatically collapses to a single icon-only toggle whenever its\n * container is too narrow to show every segment side by side, and expands again when the space\n * returns. Collapsed, it shows `collapsedIcon` when given and otherwise the currently-selected\n * option's `icon`; clicking it (or pressing Enter/Space) advances to the next option, wrapping\n * around from the last back to the first.\n *\n * Only supported for the icon-bearing `\"plain\"` and `\"brand\"` appearances, and every option must\n * define an `icon` unless `collapsedIcon` is given (there is nothing to show otherwise). Ignored,\n * with a dev-time warning, when those conditions are not met. @default false\n */\n collapsible?: boolean;\n /**\n * Single glyph for the collapsed toggle, replacing the selected option's icon. Use it when the\n * collapsed control should read as one switch affordance rather than as a preview of the current\n * selection — the collapsed navigation rail shows a repeat glyph this way. The button still\n * announces the selected option as its accessible name, so the current state stays available to\n * assistive tech. Only meaningful alongside `collapsible`.\n */\n collapsedIcon?: React.ReactNode;\n}\n\n/** Padding and typography per size. Combined with the container's `p-1` these hit the 32/40/48px heights. */\nconst sizeClasses: Record<SegmentedControlSize, string> = {\n \"32\": \"px-2 py-1 typography-description-12px-semibold\",\n \"40\": \"px-3 py-1.75 typography-body-small-14px-semibold\",\n \"48\": \"px-4 py-2 typography-body-default-16px-semibold\",\n};\n\nfunction warnMissingAccessibleName(ariaLabel?: string, ariaLabelledBy?: string) {\n if (process.env.NODE_ENV !== \"production\") {\n if (!ariaLabel && !ariaLabelledBy) {\n console.warn(\n \"SegmentedControl: no accessible name provided. Pass an `aria-label` or `aria-labelledby` prop.\",\n );\n }\n }\n}\n\nfunction warnMissingOptionAccessibleName(options: SegmentedControlOption[]) {\n if (process.env.NODE_ENV !== \"production\") {\n for (const option of options) {\n if (option.icon && !option.label?.trim()) {\n console.warn(\n `SegmentedControl: icon-only segment \"${option.value}\" is missing a non-empty \\`label\\` to use as its accessible name.`,\n );\n }\n }\n }\n}\n\nfunction warnUnsupportedCollapsible(\n appearance: SegmentedControlAppearance,\n options: SegmentedControlOption[],\n hasCollapsedIcon: boolean,\n) {\n if (process.env.NODE_ENV !== \"production\") {\n if (appearance === \"pill\") {\n console.warn(\n 'SegmentedControl: `collapsible` is only supported for the \"plain\" and \"brand\" appearances; ignoring it.',\n );\n } else if (!hasCollapsedIcon && !options.every((option) => option.icon)) {\n console.warn(\n \"SegmentedControl: `collapsible` requires every option to define an `icon`, or a `collapsedIcon` to show instead; ignoring it.\",\n );\n }\n }\n}\n\nfunction getSegmentClassName({\n appearance,\n size,\n variant,\n isSelected,\n disabled,\n}: {\n appearance: SegmentedControlAppearance;\n size: SegmentedControlSize;\n variant: SegmentedControlVariant;\n isSelected: boolean;\n disabled: boolean;\n}) {\n return cn(\n \"relative inline-flex min-w-0 cursor-pointer items-center justify-center rounded-full\",\n \"motion-safe:transition-colors motion-safe:duration-150 motion-safe:ease-in-out\",\n \"focus-visible:shadow-focus-ring focus-visible:outline-none\",\n variant === \"fill\" ? \"flex-1\" : \"shrink-0\",\n appearance === \"plain\"\n ? cn(\n // Padding + negative margin enlarge the hit target without changing the\n // visual footprint, which must stay glyph-only to match the design.\n \"-m-1 p-1\",\n isSelected ? \"text-icons-primary\" : \"text-icons-tertiary hover:text-icons-primary\",\n )\n : cn(\n sizeClasses[size],\n // brand renders icon + label together, so space them.\n appearance === \"brand\" && \"gap-1.5\",\n isSelected\n ? appearance === \"brand\"\n ? // Approximate brand-green pill using existing tokens; exact colours pending\n // dedicated navigation tokens (see ENG follow-up).\n \"bg-brand-primary-muted text-content-always-black shadow-sm ring-1 ring-brand-primary-default\"\n : \"bg-buttons-primary-default text-content-primary-inverted shadow-sm\"\n : \"text-content-primary hover:bg-buttons-switch-hover\",\n ),\n disabled && \"pointer-events-none\",\n );\n}\n\n/**\n * Footprint of the collapsed toggle per size. A fixed square keeps the collapsed control the same\n * height as the expanded one, whose height comes from the segment padding plus the container's\n * `p-1` — padding the collapsed button alone would fall short of it by that container padding.\n */\nconst collapsedSizeClasses: Record<SegmentedControlSize, string> = {\n \"32\": \"size-8\",\n \"40\": \"size-10\",\n \"48\": \"size-12\",\n};\n\n/**\n * Classes for the single button shown while the control is collapsed. Unlike an expanded segment\n * (which carries asymmetric `px`/`py` padding and so reads slightly wider than tall), the collapsed\n * toggle is forced to a square via a fixed footprint and `aspect-square`, so with `rounded-full` the\n * icon-only control reads as a round button.\n */\nfunction getCollapsedButtonClassName({\n appearance,\n size,\n disabled,\n}: {\n appearance: SegmentedControlAppearance;\n size: SegmentedControlSize;\n disabled: boolean;\n}) {\n return cn(\n \"relative inline-flex aspect-square shrink-0 cursor-pointer items-center justify-center rounded-full\",\n \"motion-safe:transition-colors motion-safe:duration-150 motion-safe:ease-in-out\",\n \"focus-visible:shadow-focus-ring focus-visible:outline-none\",\n appearance === \"plain\"\n ? // Glyph-only: no pill, just the selected icon colour. The negative margin keeps the visual\n // footprint icon-sized while the padding enlarges the hit target.\n \"-m-1 p-1 text-icons-primary\"\n : cn(\n collapsedSizeClasses[size],\n // Neutral circle rather than the brand pill: collapsed, the control is a switch\n // affordance, not a preview of the selected segment.\n \"bg-surface-secondary text-icons-primary hover:bg-buttons-switch-hover\",\n ),\n disabled && \"pointer-events-none\",\n );\n}\n\n/**\n * Watches `rootRef`'s available width against the natural width of the fully expanded control\n * (measured from `measureRef`, an off-screen replica) and returns whether the control should\n * collapse. Comparing available space to a stable off-screen measurement — rather than to the\n * live control, which shrinks when it collapses — avoids the expand/collapse oscillation that a\n * self-referential measurement would cause. Returns `false` until both widths are measurable\n * (SSR, jsdom, or a zero-width layout), so the control renders expanded by default.\n */\nfunction useAutoCollapse(\n rootRef: React.RefObject<HTMLDivElement | null>,\n measureRef: React.RefObject<HTMLDivElement | null>,\n enabled: boolean,\n): boolean {\n const [collapsed, setCollapsed] = React.useState(false);\n\n React.useEffect(() => {\n if (!enabled) {\n setCollapsed(false);\n return;\n }\n const root = rootRef.current;\n const measure = measureRef.current;\n const parent = root?.parentElement;\n if (!root || !measure || !parent) return;\n\n const evaluate = () => {\n const available = parent.getBoundingClientRect().width;\n const required = measure.getBoundingClientRect().width;\n // Both unmeasured (SSR/jsdom/zero-width): leave the current state untouched.\n if (available <= 0 || required <= 0) return;\n setCollapsed(required > available);\n };\n\n evaluate();\n\n const observer = new ResizeObserver(evaluate);\n observer.observe(parent);\n observer.observe(measure);\n return () => observer.disconnect();\n }, [enabled, rootRef, measureRef]);\n\n return enabled && collapsed;\n}\n\n/**\n * A compact selector for choosing between two or three mutually exclusive\n * options where the choice affects the content immediately below it. Use\n * instead of tabs when the options are more like settings or filters than\n * navigation, such as toggling a list/grid view or a monthly/annual price.\n *\n * Rendered as a `radiogroup` with roving-tabindex keyboard navigation. Supports\n * both controlled and uncontrolled usage. With `collapsible`, the icon-bearing\n * `plain`/`brand` appearances shrink to a single cycling icon toggle when space\n * is tight (rendered as a `group` containing one button).\n *\n * @example\n * ```tsx\n * <SegmentedControl\n * options={[\n * { label: \"Net\", value: \"net\" },\n * { label: \"Gross\", value: \"gross\" },\n * ]}\n * value={amount}\n * onChange={setAmount}\n * aria-label=\"Amount type\"\n * />\n * ```\n *\n * @example Icon-only segments (e.g. a list/grid view toggle)\n * ```tsx\n * <SegmentedControl\n * appearance=\"plain\"\n * options={[\n * { label: \"List view\", value: \"list\", icon: <ListViewIcon size={16} /> },\n * { label: \"Grid view\", value: \"grid\", icon: <GridViewIcon size={16} /> },\n * ]}\n * value={view}\n * onChange={setView}\n * aria-label=\"View\"\n * />\n * ```\n *\n * @example Icon + label with the brand-green pill (e.g. the Home/Agent nav switch)\n * ```tsx\n * <SegmentedControl\n * appearance=\"brand\"\n * options={[\n * { label: \"Home\", value: \"home\", icon: <HomeIcon size={16} /> },\n * { label: \"Agent\", value: \"agent\", icon: <AIIcon size={16} /> },\n * ]}\n * value={mode}\n * onChange={setMode}\n * aria-label=\"Navigation mode\"\n * />\n * ```\n *\n * @example Collapses to a cycling icon toggle when the container is too narrow\n * ```tsx\n * <SegmentedControl\n * appearance=\"plain\"\n * collapsible\n * options={[\n * { label: \"List view\", value: \"list\", icon: <ListViewIcon size={16} /> },\n * { label: \"Grid view\", value: \"grid\", icon: <GridViewIcon size={16} /> },\n * ]}\n * value={view}\n * onChange={setView}\n * aria-label=\"View\"\n * />\n * ```\n *\n * @example A collapsed toggle that shows one switch glyph instead of the selected icon\n * ```tsx\n * <SegmentedControl\n * appearance=\"brand\"\n * collapsible\n * collapsedIcon={<RepeatIcon size={16} />}\n * options={[\n * { label: \"Home\", value: \"home\", icon: <HomeIcon size={16} /> },\n * { label: \"Agent\", value: \"agent\", icon: <AIIcon size={16} filled /> },\n * ]}\n * value={mode}\n * onChange={setMode}\n * aria-label=\"Navigation mode\"\n * />\n * ```\n */\nexport const SegmentedControl = React.forwardRef<HTMLDivElement, SegmentedControlProps>(\n (\n {\n className,\n size = \"32\",\n variant = \"hug\",\n appearance = \"pill\",\n options,\n value: controlledValue,\n defaultValue,\n onChange,\n disabled = false,\n collapsible = false,\n collapsedIcon,\n ...props\n },\n ref,\n ) => {\n warnMissingAccessibleName(props[\"aria-label\"], props[\"aria-labelledby\"]);\n warnMissingOptionAccessibleName(options);\n if (collapsible) warnUnsupportedCollapsible(appearance, options, collapsedIcon !== undefined);\n\n // Tracks selection for uncontrolled usage; ignored when `value` prop is provided\n const [internalValue, setInternalValue] = React.useState(defaultValue ?? options[0]?.value);\n const isControlled = controlledValue !== undefined;\n const currentValue = isControlled ? controlledValue : internalValue;\n const anySelected = options.some((o) => o.value === currentValue);\n const buttonRefs = React.useRef<(HTMLButtonElement | null)[]>([]);\n\n // Collapsing only makes sense for icon-bearing appearances where there is a glyph to show:\n // either a `collapsedIcon` for every state, or an icon on every option. Anything else falls\n // back to the normal expanded control (a dev warning fires above).\n const canCollapse =\n collapsible &&\n (appearance === \"plain\" || appearance === \"brand\") &&\n (collapsedIcon !== undefined || options.every((option) => option.icon));\n\n const rootRef = React.useRef<HTMLDivElement | null>(null);\n const measureRef = React.useRef<HTMLDivElement | null>(null);\n const setRootRef = React.useCallback(\n (node: HTMLDivElement | null) => {\n rootRef.current = node;\n if (typeof ref === \"function\") ref(node);\n else if (ref) ref.current = node;\n },\n [ref],\n );\n const isCollapsed = useAutoCollapse(rootRef, measureRef, canCollapse);\n\n const handleSelect = (optionValue: string) => {\n if (disabled || optionValue === currentValue) return;\n if (!isControlled) {\n setInternalValue(optionValue);\n }\n onChange?.(optionValue);\n };\n\n const handleKeyDown = (e: React.KeyboardEvent, index: number) => {\n const nextIndex =\n e.key === \"ArrowRight\" || e.key === \"ArrowDown\"\n ? (index + 1) % options.length\n : e.key === \"ArrowLeft\" || e.key === \"ArrowUp\"\n ? (index - 1 + options.length) % options.length\n : null;\n if (nextIndex === null) return;\n e.preventDefault();\n const nextOption = options[nextIndex] as SegmentedControlOption;\n handleSelect(nextOption.value);\n buttonRefs.current[nextIndex]?.focus();\n };\n\n const renderSegment = (option: SegmentedControlOption, index: number) => {\n const isSelected = currentValue === option.value;\n // `brand` shows the label as visible text (with the icon); `pill`/`plain` render\n // icon-only when an icon is given, falling back to the label otherwise.\n const showLabelText = appearance === \"brand\" || !option.icon;\n return (\n // biome-ignore lint/a11y/useSemanticElements: native radio inputs only allow Tab-focus on the checked item; buttons with roving tabindex give full keyboard navigation\n <button\n key={option.value}\n ref={(el) => {\n buttonRefs.current[index] = el;\n }}\n type=\"button\"\n role=\"radio\"\n aria-checked={isSelected}\n tabIndex={isSelected || (!anySelected && index === 0) ? 0 : -1}\n disabled={disabled}\n aria-label={showLabelText ? undefined : option.label}\n onClick={() => handleSelect(option.value)}\n onKeyDown={(e) => handleKeyDown(e, index)}\n className={getSegmentClassName({ appearance, size, variant, isSelected, disabled })}\n >\n {option.icon && (\n <span className=\"flex shrink-0 items-center justify-center\" aria-hidden=\"true\">\n {option.icon}\n </span>\n )}\n {showLabelText && <span className=\"min-w-0 truncate\">{option.label}</span>}\n </button>\n );\n };\n\n // Off-screen replica of one segment used only to size the expanded control. Rendered as an\n // inert (disabled + `aria-hidden`) button with no `radio` semantics so it stays out of the\n // accessibility tree and tab order, and always with hug sizing so the replica reflects the\n // natural (uncompressed) width even under a `fill` layout.\n const renderMeasureSegment = (option: SegmentedControlOption) => {\n const showLabelText = appearance === \"brand\" || !option.icon;\n return (\n <button\n key={option.value}\n type=\"button\"\n disabled\n aria-hidden=\"true\"\n tabIndex={-1}\n className={getSegmentClassName({\n appearance,\n size,\n variant: \"hug\",\n isSelected: currentValue === option.value,\n disabled,\n })}\n >\n {option.icon && (\n <span className=\"flex shrink-0 items-center justify-center\" aria-hidden=\"true\">\n {option.icon}\n </span>\n )}\n {showLabelText && <span className=\"min-w-0 truncate\">{option.label}</span>}\n </button>\n );\n };\n\n // Collapsed: a single button showing the selected option's icon that cycles to the next\n // option on activation, wrapping from the last option back to the first.\n const selectedIndex = options.findIndex((option) => option.value === currentValue);\n const selectedOption = options[selectedIndex] ?? options[0];\n const handleCycle = () => {\n if (disabled || options.length === 0) return;\n const from = selectedIndex < 0 ? 0 : selectedIndex;\n const nextOption = options[(from + 1) % options.length] as SegmentedControlOption;\n handleSelect(nextOption.value);\n };\n\n return (\n <div\n ref={setRootRef}\n role={isCollapsed ? \"group\" : \"radiogroup\"}\n className={cn(\n \"relative items-center rounded-full\",\n variant === \"fill\" ? \"flex w-full\" : \"inline-flex\",\n isCollapsed\n ? // Collapsed, the toggle itself carries the surface, so the container drops its own\n // chrome and centres the button instead of pinning it to the start of a full-width\n // row — in a narrow rail that offset is the whole width of the column.\n \"justify-center\"\n : appearance === \"plain\"\n ? \"gap-2\"\n : \"bg-surface-tertiary p-1\",\n disabled && \"cursor-not-allowed opacity-50\",\n className,\n )}\n {...props}\n >\n {isCollapsed && selectedOption ? (\n <button\n type=\"button\"\n disabled={disabled}\n aria-label={selectedOption.label}\n onClick={handleCycle}\n className={getCollapsedButtonClassName({ appearance, size, disabled })}\n >\n {(collapsedIcon ?? selectedOption.icon) && (\n <span className=\"flex shrink-0 items-center justify-center\" aria-hidden=\"true\">\n {collapsedIcon ?? selectedOption.icon}\n </span>\n )}\n </button>\n ) : (\n options.map((option, index) => renderSegment(option, index))\n )}\n\n {canCollapse && (\n // Off-screen replica of the fully expanded control. Kept in the DOM (out of flow, hidden\n // from AT and tab order) so its natural width is always measurable, whether the visible\n // control is currently expanded or collapsed.\n <div\n ref={measureRef}\n aria-hidden=\"true\"\n className={cn(\n \"pointer-events-none invisible absolute top-0 left-0 -z-10 flex items-center whitespace-nowrap rounded-full\",\n appearance === \"plain\" ? \"gap-2\" : \"bg-surface-tertiary p-1\",\n )}\n >\n {options.map((option) => renderMeasureSegment(option))}\n </div>\n )}\n </div>\n );\n },\n);\n\nSegmentedControl.displayName = \"SegmentedControl\";\n"],"names":[],"mappings":";;;;AAsFA,MAAM,cAAoD;AAAA,EACxD,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AACR;AAEA,SAAS,0BAA0B,WAAoB,gBAAyB;AAC9E,MAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,QAAI,CAAC,aAAa,CAAC,gBAAgB;AACjC,cAAQ;AAAA,QACN;AAAA,MAAA;AAAA,IAEJ;AAAA,EACF;AACF;AAEA,SAAS,gCAAgC,SAAmC;AAC1E,MAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,eAAW,UAAU,SAAS;AAC5B,UAAI,OAAO,QAAQ,CAAC,OAAO,OAAO,QAAQ;AACxC,gBAAQ;AAAA,UACN,wCAAwC,OAAO,KAAK;AAAA,QAAA;AAAA,MAExD;AAAA,IACF;AAAA,EACF;AACF;AAEA,SAAS,2BACP,YACA,SACA,kBACA;AACA,MAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,QAAI,eAAe,QAAQ;AACzB,cAAQ;AAAA,QACN;AAAA,MAAA;AAAA,IAEJ,WAAW,CAAC,oBAAoB,CAAC,QAAQ,MAAM,CAAC,WAAW,OAAO,IAAI,GAAG;AACvE,cAAQ;AAAA,QACN;AAAA,MAAA;AAAA,IAEJ;AAAA,EACF;AACF;AAEA,SAAS,oBAAoB;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAMG;AACD,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA,YAAY,SAAS,WAAW;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,WAAA,iBAAiB,eAAe,SAChC,oBAAC,QAAA,EAAK,WAAU,6CAA4C,eAAY,QACrE,UAAA,iBAAiB,eAAe,KAAA,CACnC;AAAA,YAAA;AAAA,UAAA,IAIJ,QAAQ,IAAI,CAAC,QAAQ,UAAU,cAAc,QAAQ,KAAK,CAAC;AAAA,UAG5D;AAAA;AAAA;AAAA,UAIC;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,KAAK;AAAA,cACL,eAAY;AAAA,cACZ,WAAW;AAAA,gBACT;AAAA,gBACA,eAAe,UAAU,UAAU;AAAA,cAAA;AAAA,cAGpC,kBAAQ,IAAI,CAAC,WAAW,qBAAqB,MAAM,CAAC;AAAA,YAAA;AAAA,UAAA;AAAA,QACvD;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;AAEA,iBAAiB,cAAc;"}
|
|
1
|
+
{"version":3,"file":"SegmentedControl.mjs","sources":["../../../src/components/SegmentedControl/SegmentedControl.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\n\n/** Height of the segmented control in pixels. */\nexport type SegmentedControlSize = \"32\" | \"40\" | \"48\";\n\n/**\n * Segment layout.\n * - `\"hug\"`: each segment is sized to its content.\n * - `\"fill\"`: the control spans the full width of its container and each segment grows equally.\n */\nexport type SegmentedControlVariant = \"hug\" | \"fill\";\n\n/**\n * Visual style of the control.\n * - `\"pill\"`: the container has a muted background and the selected segment shows a filled pill (default).\n * - `\"plain\"`: no container or selected-pill background; segments are bare content and selection is\n * communicated by color alone. Designed for icon-only toggles (e.g. a list/grid view switch).\n * - `\"brand\"`: like `\"pill\"`, but segments render their `icon` alongside the visible `label`.\n * A selected segment takes the neutral selected pill, except the one marked `ai`, which takes the\n * AI fill and gradient stroke. Designed for prominent toggles such as the Home/Agent navigation\n * switch.\n */\nexport type SegmentedControlAppearance = \"pill\" | \"plain\" | \"brand\";\n\n/** Describes one selectable segment. */\nexport interface SegmentedControlOption {\n /**\n * Display label for the segment. In `pill`/`plain` appearances, when `icon` is provided the\n * segment renders icon-only and this value becomes its accessible name (applied as `aria-label`)\n * instead of visible text. In the `brand` appearance the label is always rendered as visible text\n * (alongside the icon when present).\n */\n label: string;\n /** Value identifier returned via `onChange`. */\n value: string;\n /**\n * Icon to render for the segment. In `pill`/`plain` appearances the segment renders icon-only and\n * `label` becomes required as its accessible name (applied as `aria-label`, no visible text). In\n * the `brand` appearance the icon renders alongside the visible `label`. Required for every option\n * when `collapsible` is set unless a `collapsedIcon` is given, since the collapsed control\n * otherwise shows the selected option's icon alone.\n */\n icon?: React.ReactNode;\n /**\n * Marks this segment as the AI one, so that when it is selected it takes the AI treatment — the\n * translucent `Buttons/AI/Default` fill and the `Buttons/AI` gradient stroke — instead of the\n * neutral selected pill every other segment gets.\n *\n * Set it on the Agent side of a Manage/Agent switch. Without it the AI treatment would follow\n * whichever segment happened to be selected, putting a brand stroke on segments that should not\n * carry one. Only meaningful in the `brand` appearance, and only while the control is expanded —\n * collapsed, the toggle stays the neutral switch affordance whichever option is selected.\n * @default false\n */\n ai?: boolean;\n}\n\nexport interface SegmentedControlProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, \"onChange\"> {\n /** Height of the control in pixels. @default \"32\" */\n size?: SegmentedControlSize;\n /** Segment layout. @default \"hug\" */\n variant?: SegmentedControlVariant;\n /** Visual style of the control. @default \"pill\" */\n appearance?: SegmentedControlAppearance;\n /** The selectable segments. Designed for two or three mutually exclusive options. */\n options: SegmentedControlOption[];\n /** Currently selected value (controlled). */\n value?: string;\n /** Initially selected value (uncontrolled). Defaults to the first option. */\n defaultValue?: string;\n /** Callback fired when the selected value changes. */\n onChange?: (value: string) => void;\n /** Whether the control is disabled. @default false */\n disabled?: boolean;\n /**\n * When `true`, the control automatically collapses to a single icon-only toggle whenever its\n * container is too narrow to show every segment side by side, and expands again when the space\n * returns. Collapsed, it shows `collapsedIcon` when given and otherwise the currently-selected\n * option's `icon`; clicking it (or pressing Enter/Space) advances to the next option, wrapping\n * around from the last back to the first.\n *\n * Only supported for the icon-bearing `\"plain\"` and `\"brand\"` appearances, and every option must\n * define an `icon` unless `collapsedIcon` is given (there is nothing to show otherwise). Ignored,\n * with a dev-time warning, when those conditions are not met. @default false\n */\n collapsible?: boolean;\n /**\n * Single glyph for the collapsed toggle, replacing the selected option's icon. Use it when the\n * collapsed control should read as one switch affordance rather than as a preview of the current\n * selection — the collapsed navigation rail shows a repeat glyph this way. The button still\n * announces the selected option as its accessible name, so the current state stays available to\n * assistive tech. Only meaningful alongside `collapsible`.\n */\n collapsedIcon?: React.ReactNode;\n}\n\n/** Padding and typography per size. Combined with the container's `p-1` these hit the 32/40/48px heights. */\nconst sizeClasses: Record<SegmentedControlSize, string> = {\n \"32\": \"px-2 py-1 typography-description-12px-semibold\",\n \"40\": \"px-3 py-1.75 typography-body-small-14px-semibold\",\n \"48\": \"px-4 py-2 typography-body-default-16px-semibold\",\n};\n\nfunction warnMissingAccessibleName(ariaLabel?: string, ariaLabelledBy?: string) {\n if (process.env.NODE_ENV !== \"production\") {\n if (!ariaLabel && !ariaLabelledBy) {\n console.warn(\n \"SegmentedControl: no accessible name provided. Pass an `aria-label` or `aria-labelledby` prop.\",\n );\n }\n }\n}\n\nfunction warnMissingOptionAccessibleName(options: SegmentedControlOption[]) {\n if (process.env.NODE_ENV !== \"production\") {\n for (const option of options) {\n if (option.icon && !option.label?.trim()) {\n console.warn(\n `SegmentedControl: icon-only segment \"${option.value}\" is missing a non-empty \\`label\\` to use as its accessible name.`,\n );\n }\n }\n }\n}\n\nfunction warnUnsupportedCollapsible(\n appearance: SegmentedControlAppearance,\n options: SegmentedControlOption[],\n hasCollapsedIcon: boolean,\n) {\n if (process.env.NODE_ENV !== \"production\") {\n if (appearance === \"pill\") {\n console.warn(\n 'SegmentedControl: `collapsible` is only supported for the \"plain\" and \"brand\" appearances; ignoring it.',\n );\n } else if (!hasCollapsedIcon && !options.every((option) => option.icon)) {\n console.warn(\n \"SegmentedControl: `collapsible` requires every option to define an `icon`, or a `collapsedIcon` to show instead; ignoring it.\",\n );\n }\n }\n}\n\nfunction getSegmentClassName({\n appearance,\n size,\n variant,\n isSelected,\n isAiSegment,\n disabled,\n}: {\n appearance: SegmentedControlAppearance;\n size: SegmentedControlSize;\n variant: SegmentedControlVariant;\n isSelected: boolean;\n isAiSegment: boolean;\n disabled: boolean;\n}) {\n return cn(\n \"relative inline-flex min-w-0 cursor-pointer items-center justify-center rounded-full\",\n \"motion-safe:transition-colors motion-safe:duration-150 motion-safe:ease-in-out\",\n \"focus-visible:shadow-focus-ring focus-visible:outline-none\",\n variant === \"fill\" ? \"flex-1\" : \"shrink-0\",\n appearance === \"plain\"\n ? cn(\n // Padding + negative margin enlarge the hit target without changing the\n // visual footprint, which must stay glyph-only to match the design.\n \"-m-1 p-1\",\n isSelected ? \"text-icons-primary\" : \"text-icons-tertiary hover:text-icons-primary\",\n )\n : cn(\n sizeClasses[size],\n // brand renders icon + label together, so space them.\n appearance === \"brand\" && \"gap-1.5\",\n isSelected\n ? appearance === \"brand\" && isAiSegment\n ? // The AI segment: translucent AI fill plus the AI gradient stroke. Scoped to the\n // segment marked `ai` rather than to whatever is selected, so a brand stroke never\n // lands on a segment that should read as plain.\n \"fv-ai-stroke bg-buttons-ai-default text-content-primary\"\n : // Every other selected segment, `brand` included, takes the neutral pill. Its\n // tokens invert with the theme, so this is a white pill on dark and a black one on\n // light.\n \"bg-buttons-primary-default text-content-primary-inverted shadow-sm\"\n : \"text-content-primary hover:bg-buttons-switch-hover\",\n ),\n disabled && \"pointer-events-none\",\n );\n}\n\n/**\n * Footprint of the collapsed toggle per size. A fixed square keeps the collapsed control the same\n * height as the expanded one, whose height comes from the segment padding plus the container's\n * `p-1` — padding the collapsed button alone would fall short of it by that container padding.\n */\nconst collapsedSizeClasses: Record<SegmentedControlSize, string> = {\n \"32\": \"size-8\",\n \"40\": \"size-10\",\n \"48\": \"size-12\",\n};\n\n/**\n * Classes for the single button shown while the control is collapsed. Unlike an expanded segment\n * (which carries asymmetric `px`/`py` padding and so reads slightly wider than tall), the collapsed\n * toggle is forced to a square via a fixed footprint and `aspect-square`, so with `rounded-full` the\n * icon-only control reads as a round button.\n */\nfunction getCollapsedButtonClassName({\n appearance,\n size,\n disabled,\n}: {\n appearance: SegmentedControlAppearance;\n size: SegmentedControlSize;\n disabled: boolean;\n}) {\n return cn(\n \"relative inline-flex aspect-square shrink-0 cursor-pointer items-center justify-center rounded-full\",\n \"motion-safe:transition-colors motion-safe:duration-150 motion-safe:ease-in-out\",\n \"focus-visible:shadow-focus-ring focus-visible:outline-none\",\n appearance === \"plain\"\n ? // Glyph-only: no pill, just the selected icon colour. The negative margin keeps the visual\n // footprint icon-sized while the padding enlarges the hit target.\n \"-m-1 p-1 text-icons-primary\"\n : cn(\n collapsedSizeClasses[size],\n // Neutral circle rather than the brand pill: collapsed, the control is a switch\n // affordance, not a preview of the selected segment.\n \"bg-surface-secondary text-icons-primary hover:bg-buttons-switch-hover\",\n ),\n disabled && \"pointer-events-none\",\n );\n}\n\n/**\n * Watches `rootRef`'s available width against the natural width of the fully expanded control\n * (measured from `measureRef`, an off-screen replica) and returns whether the control should\n * collapse. Comparing available space to a stable off-screen measurement — rather than to the\n * live control, which shrinks when it collapses — avoids the expand/collapse oscillation that a\n * self-referential measurement would cause. Returns `false` until both widths are measurable\n * (SSR, jsdom, or a zero-width layout), so the control renders expanded by default.\n */\nfunction useAutoCollapse(\n rootRef: React.RefObject<HTMLDivElement | null>,\n measureRef: React.RefObject<HTMLDivElement | null>,\n enabled: boolean,\n): boolean {\n const [collapsed, setCollapsed] = React.useState(false);\n\n React.useEffect(() => {\n if (!enabled) {\n setCollapsed(false);\n return;\n }\n const root = rootRef.current;\n const measure = measureRef.current;\n const parent = root?.parentElement;\n if (!root || !measure || !parent) return;\n\n const evaluate = () => {\n const available = parent.getBoundingClientRect().width;\n const required = measure.getBoundingClientRect().width;\n // Both unmeasured (SSR/jsdom/zero-width): leave the current state untouched.\n if (available <= 0 || required <= 0) return;\n setCollapsed(required > available);\n };\n\n evaluate();\n\n const observer = new ResizeObserver(evaluate);\n observer.observe(parent);\n observer.observe(measure);\n return () => observer.disconnect();\n }, [enabled, rootRef, measureRef]);\n\n return enabled && collapsed;\n}\n\n/**\n * A compact selector for choosing between two or three mutually exclusive\n * options where the choice affects the content immediately below it. Use\n * instead of tabs when the options are more like settings or filters than\n * navigation, such as toggling a list/grid view or a monthly/annual price.\n *\n * Rendered as a `radiogroup` with roving-tabindex keyboard navigation. Supports\n * both controlled and uncontrolled usage. With `collapsible`, the icon-bearing\n * `plain`/`brand` appearances shrink to a single cycling icon toggle when space\n * is tight (rendered as a `group` containing one button).\n *\n * @example\n * ```tsx\n * <SegmentedControl\n * options={[\n * { label: \"Net\", value: \"net\" },\n * { label: \"Gross\", value: \"gross\" },\n * ]}\n * value={amount}\n * onChange={setAmount}\n * aria-label=\"Amount type\"\n * />\n * ```\n *\n * @example Icon-only segments (e.g. a list/grid view toggle)\n * ```tsx\n * <SegmentedControl\n * appearance=\"plain\"\n * options={[\n * { label: \"List view\", value: \"list\", icon: <ListViewIcon size={16} /> },\n * { label: \"Grid view\", value: \"grid\", icon: <GridViewIcon size={16} /> },\n * ]}\n * value={view}\n * onChange={setView}\n * aria-label=\"View\"\n * />\n * ```\n *\n * @example Icon + label, with the AI treatment on the Agent segment (the Home/Agent nav switch)\n * ```tsx\n * <SegmentedControl\n * appearance=\"brand\"\n * options={[\n * { label: \"Home\", value: \"home\", icon: <HomeIcon size={16} /> },\n * { label: \"Agent\", value: \"agent\", icon: <AIIcon size={16} />, ai: true },\n * ]}\n * value={mode}\n * onChange={setMode}\n * aria-label=\"Navigation mode\"\n * />\n * ```\n *\n * @example Collapses to a cycling icon toggle when the container is too narrow\n * ```tsx\n * <SegmentedControl\n * appearance=\"plain\"\n * collapsible\n * options={[\n * { label: \"List view\", value: \"list\", icon: <ListViewIcon size={16} /> },\n * { label: \"Grid view\", value: \"grid\", icon: <GridViewIcon size={16} /> },\n * ]}\n * value={view}\n * onChange={setView}\n * aria-label=\"View\"\n * />\n * ```\n *\n * @example A collapsed toggle that shows one switch glyph instead of the selected icon\n * ```tsx\n * <SegmentedControl\n * appearance=\"brand\"\n * collapsible\n * collapsedIcon={<RepeatIcon size={16} />}\n * options={[\n * { label: \"Home\", value: \"home\", icon: <HomeIcon size={16} /> },\n * { label: \"Agent\", value: \"agent\", icon: <AIIcon size={16} filled />, ai: true },\n * ]}\n * value={mode}\n * onChange={setMode}\n * aria-label=\"Navigation mode\"\n * />\n * ```\n */\nexport const SegmentedControl = React.forwardRef<HTMLDivElement, SegmentedControlProps>(\n (\n {\n className,\n size = \"32\",\n variant = \"hug\",\n appearance = \"pill\",\n options,\n value: controlledValue,\n defaultValue,\n onChange,\n disabled = false,\n collapsible = false,\n collapsedIcon,\n ...props\n },\n ref,\n ) => {\n warnMissingAccessibleName(props[\"aria-label\"], props[\"aria-labelledby\"]);\n warnMissingOptionAccessibleName(options);\n if (collapsible) warnUnsupportedCollapsible(appearance, options, collapsedIcon !== undefined);\n\n // Tracks selection for uncontrolled usage; ignored when `value` prop is provided\n const [internalValue, setInternalValue] = React.useState(defaultValue ?? options[0]?.value);\n const isControlled = controlledValue !== undefined;\n const currentValue = isControlled ? controlledValue : internalValue;\n const anySelected = options.some((o) => o.value === currentValue);\n const buttonRefs = React.useRef<(HTMLButtonElement | null)[]>([]);\n\n // Collapsing only makes sense for icon-bearing appearances where there is a glyph to show:\n // either a `collapsedIcon` for every state, or an icon on every option. Anything else falls\n // back to the normal expanded control (a dev warning fires above).\n const canCollapse =\n collapsible &&\n (appearance === \"plain\" || appearance === \"brand\") &&\n (collapsedIcon !== undefined || options.every((option) => option.icon));\n\n const rootRef = React.useRef<HTMLDivElement | null>(null);\n const measureRef = React.useRef<HTMLDivElement | null>(null);\n const setRootRef = React.useCallback(\n (node: HTMLDivElement | null) => {\n rootRef.current = node;\n if (typeof ref === \"function\") ref(node);\n else if (ref) ref.current = node;\n },\n [ref],\n );\n const isCollapsed = useAutoCollapse(rootRef, measureRef, canCollapse);\n\n const handleSelect = (optionValue: string) => {\n if (disabled || optionValue === currentValue) return;\n if (!isControlled) {\n setInternalValue(optionValue);\n }\n onChange?.(optionValue);\n };\n\n const handleKeyDown = (e: React.KeyboardEvent, index: number) => {\n const nextIndex =\n e.key === \"ArrowRight\" || e.key === \"ArrowDown\"\n ? (index + 1) % options.length\n : e.key === \"ArrowLeft\" || e.key === \"ArrowUp\"\n ? (index - 1 + options.length) % options.length\n : null;\n if (nextIndex === null) return;\n e.preventDefault();\n const nextOption = options[nextIndex] as SegmentedControlOption;\n handleSelect(nextOption.value);\n buttonRefs.current[nextIndex]?.focus();\n };\n\n const renderSegment = (option: SegmentedControlOption, index: number) => {\n const isSelected = currentValue === option.value;\n // `brand` shows the label as visible text (with the icon); `pill`/`plain` render\n // icon-only when an icon is given, falling back to the label otherwise.\n const showLabelText = appearance === \"brand\" || !option.icon;\n return (\n // biome-ignore lint/a11y/useSemanticElements: native radio inputs only allow Tab-focus on the checked item; buttons with roving tabindex give full keyboard navigation\n <button\n key={option.value}\n ref={(el) => {\n buttonRefs.current[index] = el;\n }}\n type=\"button\"\n role=\"radio\"\n aria-checked={isSelected}\n tabIndex={isSelected || (!anySelected && index === 0) ? 0 : -1}\n disabled={disabled}\n aria-label={showLabelText ? undefined : option.label}\n onClick={() => handleSelect(option.value)}\n onKeyDown={(e) => handleKeyDown(e, index)}\n className={getSegmentClassName({\n appearance,\n size,\n variant,\n isSelected,\n isAiSegment: option.ai === true,\n disabled,\n })}\n >\n {option.icon && (\n <span className=\"flex shrink-0 items-center justify-center\" aria-hidden=\"true\">\n {option.icon}\n </span>\n )}\n {showLabelText && <span className=\"min-w-0 truncate\">{option.label}</span>}\n </button>\n );\n };\n\n // Off-screen replica of one segment used only to size the expanded control. Rendered as an\n // inert (disabled + `aria-hidden`) button with no `radio` semantics so it stays out of the\n // accessibility tree and tab order, and always with hug sizing so the replica reflects the\n // natural (uncompressed) width even under a `fill` layout.\n const renderMeasureSegment = (option: SegmentedControlOption) => {\n const showLabelText = appearance === \"brand\" || !option.icon;\n return (\n <button\n key={option.value}\n type=\"button\"\n disabled\n aria-hidden=\"true\"\n tabIndex={-1}\n className={getSegmentClassName({\n appearance,\n size,\n variant: \"hug\",\n isSelected: currentValue === option.value,\n isAiSegment: option.ai === true,\n disabled,\n })}\n >\n {option.icon && (\n <span className=\"flex shrink-0 items-center justify-center\" aria-hidden=\"true\">\n {option.icon}\n </span>\n )}\n {showLabelText && <span className=\"min-w-0 truncate\">{option.label}</span>}\n </button>\n );\n };\n\n // Collapsed: a single button showing the selected option's icon that cycles to the next\n // option on activation, wrapping from the last option back to the first.\n const selectedIndex = options.findIndex((option) => option.value === currentValue);\n const selectedOption = options[selectedIndex] ?? options[0];\n const handleCycle = () => {\n if (disabled || options.length === 0) return;\n const from = selectedIndex < 0 ? 0 : selectedIndex;\n const nextOption = options[(from + 1) % options.length] as SegmentedControlOption;\n handleSelect(nextOption.value);\n };\n\n return (\n <div\n ref={setRootRef}\n role={isCollapsed ? \"group\" : \"radiogroup\"}\n className={cn(\n \"relative items-center rounded-full\",\n variant === \"fill\" ? \"flex w-full\" : \"inline-flex\",\n isCollapsed\n ? // Collapsed, the toggle itself carries the surface, so the container drops its own\n // chrome and centres the button instead of pinning it to the start of a full-width\n // row — in a narrow rail that offset is the whole width of the column.\n \"justify-center\"\n : appearance === \"plain\"\n ? \"gap-2\"\n : \"bg-surface-tertiary p-1\",\n disabled && \"cursor-not-allowed opacity-50\",\n className,\n )}\n {...props}\n >\n {isCollapsed && selectedOption ? (\n <button\n type=\"button\"\n disabled={disabled}\n aria-label={selectedOption.label}\n onClick={handleCycle}\n className={getCollapsedButtonClassName({ appearance, size, disabled })}\n >\n {(collapsedIcon ?? selectedOption.icon) && (\n <span className=\"flex shrink-0 items-center justify-center\" aria-hidden=\"true\">\n {collapsedIcon ?? selectedOption.icon}\n </span>\n )}\n </button>\n ) : (\n options.map((option, index) => renderSegment(option, index))\n )}\n\n {canCollapse && (\n // Off-screen replica of the fully expanded control. Kept in the DOM (out of flow, hidden\n // from AT and tab order) so its natural width is always measurable, whether the visible\n // control is currently expanded or collapsed.\n <div\n ref={measureRef}\n aria-hidden=\"true\"\n className={cn(\n \"pointer-events-none invisible absolute top-0 left-0 -z-10 flex items-center whitespace-nowrap rounded-full\",\n appearance === \"plain\" ? \"gap-2\" : \"bg-surface-tertiary p-1\",\n )}\n >\n {options.map((option) => renderMeasureSegment(option))}\n </div>\n )}\n </div>\n );\n },\n);\n\nSegmentedControl.displayName = \"SegmentedControl\";\n"],"names":[],"mappings":";;;;AAmGA,MAAM,cAAoD;AAAA,EACxD,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AACR;AAEA,SAAS,0BAA0B,WAAoB,gBAAyB;AAC9E,MAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,QAAI,CAAC,aAAa,CAAC,gBAAgB;AACjC,cAAQ;AAAA,QACN;AAAA,MAAA;AAAA,IAEJ;AAAA,EACF;AACF;AAEA,SAAS,gCAAgC,SAAmC;AAC1E,MAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,eAAW,UAAU,SAAS;AAC5B,UAAI,OAAO,QAAQ,CAAC,OAAO,OAAO,QAAQ;AACxC,gBAAQ;AAAA,UACN,wCAAwC,OAAO,KAAK;AAAA,QAAA;AAAA,MAExD;AAAA,IACF;AAAA,EACF;AACF;AAEA,SAAS,2BACP,YACA,SACA,kBACA;AACA,MAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,QAAI,eAAe,QAAQ;AACzB,cAAQ;AAAA,QACN;AAAA,MAAA;AAAA,IAEJ,WAAW,CAAC,oBAAoB,CAAC,QAAQ,MAAM,CAAC,WAAW,OAAO,IAAI,GAAG;AACvE,cAAQ;AAAA,QACN;AAAA,MAAA;AAAA,IAEJ;AAAA,EACF;AACF;AAEA,SAAS,oBAAoB;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;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AA,UACZ;AAAA,QAAA;AAAA,QAED,GAAG;AAAA,QAEH,UAAA;AAAA,UAAA,eAAe,iBACd;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,MAAK;AAAA,cACL;AAAA,cACA,cAAY,eAAe;AAAA,cAC3B,SAAS;AAAA,cACT,WAAW,4BAA4B,EAAE,YAAY,MAAM,UAAU;AAAA,cAEnE,WAAA,iBAAiB,eAAe,SAChC,oBAAC,QAAA,EAAK,WAAU,6CAA4C,eAAY,QACrE,UAAA,iBAAiB,eAAe,KAAA,CACnC;AAAA,YAAA;AAAA,UAAA,IAIJ,QAAQ,IAAI,CAAC,QAAQ,UAAU,cAAc,QAAQ,KAAK,CAAC;AAAA,UAG5D;AAAA;AAAA;AAAA,UAIC;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,KAAK;AAAA,cACL,eAAY;AAAA,cACZ,WAAW;AAAA,gBACT;AAAA,gBACA,eAAe,UAAU,UAAU;AAAA,cAAA;AAAA,cAGpC,kBAAQ,IAAI,CAAC,WAAW,qBAAqB,MAAM,CAAC;AAAA,YAAA;AAAA,UAAA;AAAA,QACvD;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;AAEA,iBAAiB,cAAc;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -4945,13 +4945,13 @@ export declare type SearchIconProps = BaseIconProps;
|
|
|
4945
4945
|
* />
|
|
4946
4946
|
* ```
|
|
4947
4947
|
*
|
|
4948
|
-
* @example Icon + label with the
|
|
4948
|
+
* @example Icon + label, with the AI treatment on the Agent segment (the Home/Agent nav switch)
|
|
4949
4949
|
* ```tsx
|
|
4950
4950
|
* <SegmentedControl
|
|
4951
4951
|
* appearance="brand"
|
|
4952
4952
|
* options={[
|
|
4953
4953
|
* { label: "Home", value: "home", icon: <HomeIcon size={16} /> },
|
|
4954
|
-
* { label: "Agent", value: "agent", icon: <AIIcon size={16}
|
|
4954
|
+
* { label: "Agent", value: "agent", icon: <AIIcon size={16} />, ai: true },
|
|
4955
4955
|
* ]}
|
|
4956
4956
|
* value={mode}
|
|
4957
4957
|
* onChange={setMode}
|
|
@@ -4982,7 +4982,7 @@ export declare type SearchIconProps = BaseIconProps;
|
|
|
4982
4982
|
* collapsedIcon={<RepeatIcon size={16} />}
|
|
4983
4983
|
* options={[
|
|
4984
4984
|
* { label: "Home", value: "home", icon: <HomeIcon size={16} /> },
|
|
4985
|
-
* { label: "Agent", value: "agent", icon: <AIIcon size={16} filled
|
|
4985
|
+
* { label: "Agent", value: "agent", icon: <AIIcon size={16} filled />, ai: true },
|
|
4986
4986
|
* ]}
|
|
4987
4987
|
* value={mode}
|
|
4988
4988
|
* onChange={setMode}
|
|
@@ -4997,9 +4997,10 @@ export declare const SegmentedControl: React_2.ForwardRefExoticComponent<Segment
|
|
|
4997
4997
|
* - `"pill"`: the container has a muted background and the selected segment shows a filled pill (default).
|
|
4998
4998
|
* - `"plain"`: no container or selected-pill background; segments are bare content and selection is
|
|
4999
4999
|
* communicated by color alone. Designed for icon-only toggles (e.g. a list/grid view switch).
|
|
5000
|
-
* - `"brand"`: like `"pill"`, but segments render their `icon` alongside the visible `label
|
|
5001
|
-
* selected segment
|
|
5002
|
-
* Home/Agent navigation
|
|
5000
|
+
* - `"brand"`: like `"pill"`, but segments render their `icon` alongside the visible `label`.
|
|
5001
|
+
* A selected segment takes the neutral selected pill, except the one marked `ai`, which takes the
|
|
5002
|
+
* AI fill and gradient stroke. Designed for prominent toggles such as the Home/Agent navigation
|
|
5003
|
+
* switch.
|
|
5003
5004
|
*/
|
|
5004
5005
|
export declare type SegmentedControlAppearance = "pill" | "plain" | "brand";
|
|
5005
5006
|
|
|
@@ -5022,6 +5023,18 @@ export declare interface SegmentedControlOption {
|
|
|
5022
5023
|
* otherwise shows the selected option's icon alone.
|
|
5023
5024
|
*/
|
|
5024
5025
|
icon?: React_2.ReactNode;
|
|
5026
|
+
/**
|
|
5027
|
+
* Marks this segment as the AI one, so that when it is selected it takes the AI treatment — the
|
|
5028
|
+
* translucent `Buttons/AI/Default` fill and the `Buttons/AI` gradient stroke — instead of the
|
|
5029
|
+
* neutral selected pill every other segment gets.
|
|
5030
|
+
*
|
|
5031
|
+
* Set it on the Agent side of a Manage/Agent switch. Without it the AI treatment would follow
|
|
5032
|
+
* whichever segment happened to be selected, putting a brand stroke on segments that should not
|
|
5033
|
+
* carry one. Only meaningful in the `brand` appearance, and only while the control is expanded —
|
|
5034
|
+
* collapsed, the toggle stays the neutral switch affordance whichever option is selected.
|
|
5035
|
+
* @default false
|
|
5036
|
+
*/
|
|
5037
|
+
ai?: boolean;
|
|
5025
5038
|
}
|
|
5026
5039
|
|
|
5027
5040
|
export declare interface SegmentedControlProps extends Omit<React_2.HTMLAttributes<HTMLDivElement>, "onChange"> {
|
package/dist/styles/base.css
CHANGED
|
@@ -155,6 +155,48 @@
|
|
|
155
155
|
initial-value: 50%;
|
|
156
156
|
}
|
|
157
157
|
|
|
158
|
+
/*
|
|
159
|
+
* AI treatment for a single segment of a `brand` SegmentedControl — the Agent
|
|
160
|
+
* side of the Manage/Agent navigation switch.
|
|
161
|
+
*
|
|
162
|
+
* Draws the `Buttons/AI/Stroke-Start` -> `Stroke-End` gradient stroke as a masked
|
|
163
|
+
* 1px ring on `::before`. A real `border` would reflow the segment, and Tailwind's
|
|
164
|
+
* `ring-*` utilities cannot hold a gradient. `z-index: -1` against
|
|
165
|
+
* `isolation: isolate` keeps the ring above the segment's own fill and below its
|
|
166
|
+
* icon and label. Both stops are tokens, so light and dark follow the theme
|
|
167
|
+
* without a second rule.
|
|
168
|
+
*
|
|
169
|
+
* The fill is left to a `bg-*` utility on the element so it stays visible to
|
|
170
|
+
* tailwind-merge and can be overridden per consumer.
|
|
171
|
+
*/
|
|
172
|
+
@utility fv-ai-stroke {
|
|
173
|
+
position: relative;
|
|
174
|
+
isolation: isolate;
|
|
175
|
+
|
|
176
|
+
&::before {
|
|
177
|
+
content: "";
|
|
178
|
+
position: absolute;
|
|
179
|
+
inset: 0;
|
|
180
|
+
z-index: -1;
|
|
181
|
+
border-radius: inherit;
|
|
182
|
+
padding: 1px;
|
|
183
|
+
pointer-events: none;
|
|
184
|
+
background: linear-gradient(
|
|
185
|
+
250.3deg,
|
|
186
|
+
var(--color-buttons-ai-stroke-start) -9%,
|
|
187
|
+
var(--color-buttons-ai-stroke-end) 110%
|
|
188
|
+
);
|
|
189
|
+
-webkit-mask:
|
|
190
|
+
linear-gradient(#000 0 0) content-box,
|
|
191
|
+
linear-gradient(#000 0 0);
|
|
192
|
+
-webkit-mask-composite: xor;
|
|
193
|
+
mask:
|
|
194
|
+
linear-gradient(#000 0 0) content-box,
|
|
195
|
+
linear-gradient(#000 0 0);
|
|
196
|
+
mask-composite: exclude;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
158
200
|
/*
|
|
159
201
|
* AiButton surface. The lit rim and the sheen are pseudo-elements rather than
|
|
160
202
|
* box-shadows on the button so they can be masked and brightened independently
|