aural-ui 3.0.7 → 4.1.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/dist/components/aspect-ratio/AspectRatio.stories.tsx +290 -1199
- package/dist/components/avatar/Avatar.stories.tsx +235 -237
- package/dist/components/badge/Badge.stories.tsx +379 -116
- package/dist/components/banner/Banner.stories.tsx +445 -391
- package/dist/components/breadcrumb/Breadcrumb.stories.tsx +453 -199
- package/dist/components/button/Button.stories.tsx +585 -230
- package/dist/components/button/index.tsx +7 -7
- package/dist/components/card/Card.stories.tsx +619 -301
- package/dist/components/char-count/CharCount.stories.tsx +350 -248
- package/dist/components/checkbox/Checkbox.stories.tsx +309 -167
- package/dist/components/chip/Chip.stories.tsx +362 -168
- package/dist/components/circular-loader/CircularLoader.stories.tsx +221 -620
- package/dist/components/clamp-lines/ClampLines.stories.tsx +246 -117
- package/dist/components/collapsible/Collapsible.stories.tsx +391 -252
- package/dist/components/command/Command.stories.tsx +533 -856
- package/dist/components/dialog/Dialog.stories.tsx +505 -949
- package/dist/components/divider/Divider.stories.tsx +265 -502
- package/dist/components/dot-loader/DotLoader.stories.tsx +256 -257
- package/dist/components/drawer/Drawer.stories.tsx +659 -993
- package/dist/components/drawer/index.tsx +3 -3
- package/dist/components/dropdown/Dropdown.stories.tsx +643 -1018
- package/dist/components/form/Form.stories.tsx +560 -274
- package/dist/components/helper-text/HelperText.stories.tsx +199 -200
- package/dist/components/hover-card/HoverCard.stories.tsx +318 -1221
- package/dist/components/icon-button/IconButton.stories.tsx +837 -194
- package/dist/components/if-else/if-else.stories.tsx +370 -83
- package/dist/components/input/Input.stories.tsx +436 -368
- package/dist/components/label/Label.stories.tsx +156 -154
- package/dist/components/list/List.stories.tsx +485 -822
- package/dist/components/marquee/Marquee.stories.tsx +356 -694
- package/dist/components/otp-inputs/OtpInputs.stories.tsx +352 -410
- package/dist/components/overlay/Overlay.stories.tsx +452 -818
- package/dist/components/overlay/index.tsx +4 -4
- package/dist/components/pagination/Pagination.stories.tsx +721 -210
- package/dist/components/popover/Popover.stories.tsx +484 -873
- package/dist/components/radio/Radio.stories.tsx +432 -124
- package/dist/components/resizable/Resizable.stories.tsx +496 -752
- package/dist/components/scroll-area/ScrollArea.stories.tsx +384 -1006
- package/dist/components/search/Search.stories.tsx +314 -575
- package/dist/components/select/Select.stories.tsx +684 -787
- package/dist/components/sheet/Sheet.stories.tsx +671 -936
- package/dist/components/skelton/Skelton.stories.tsx +230 -764
- package/dist/components/slider/Slider.stories.tsx +384 -737
- package/dist/components/stepper/Stepper.stories.tsx +371 -514
- package/dist/components/switch/Switch.stories.tsx +461 -208
- package/dist/components/switch-case/SwitchCase.stories.tsx +367 -188
- package/dist/components/table/Table.stories.tsx +770 -914
- package/dist/components/tabs/Tabs.stories.tsx +459 -1400
- package/dist/components/tag/Tag.stories.tsx +714 -542
- package/dist/components/textarea/TextArea.stories.tsx +621 -562
- package/dist/components/thumbnail-tags/ThumbnailTags.stories.tsx +228 -148
- package/dist/components/toast/Toast.stories.tsx +452 -1333
- package/dist/components/toggle/Toggle.stories.tsx +488 -909
- package/dist/components/tooltip/Tooltip.stories.tsx +344 -1372
- package/dist/components/typography/Typography.stories.tsx +406 -89
- package/dist/hooks/use-change-state/UseChangeState.stories.tsx +309 -606
- package/dist/hooks/use-previous/UsePrevious.stories.tsx +367 -917
- package/dist/hooks/use-standalone-pagination/UseStandalonePagination.stories.tsx +639 -867
- package/dist/icons/Icons.stories.tsx +0 -12
- package/dist/icons/ai-avatar-icon/AiAvatarIcon.stories.tsx +226 -1013
- package/dist/icons/alert-icon/AlertIcon.stories.tsx +109 -929
- package/dist/icons/all-icons.tsx +124 -87
- package/dist/icons/angle-down-icon/AngleDownIcon.stories.tsx +140 -971
- package/dist/icons/apple-logo-icon/AppleLogoIcon.stories.tsx +148 -888
- package/dist/icons/arrow-box-left-icon/ArrowBoxLeftIcon.stories.tsx +135 -1019
- package/dist/icons/arrow-corner-up-left-icon/ArrowCornerUpLeftIcon.stories.tsx +137 -953
- package/dist/icons/arrow-corner-up-right-icon/ArrowCornerUpRightIcon.stories.tsx +138 -997
- package/dist/icons/arrow-left-icon/ArrowLeftIcon.stories.tsx +136 -942
- package/dist/icons/arrow-right-icon/ArrowRightIcon.stories.tsx +148 -1092
- package/dist/icons/arrow-right-up-icon/ArrowRightUpIcon.stories.tsx +146 -1211
- package/dist/icons/art-board-icon/ArtBoardIcon.stories.tsx +126 -615
- package/dist/icons/audio-bar-icon/AudioBarIcon.stories.tsx +144 -1164
- package/dist/icons/backward-ten-seconds-icon/BackwardTenSecondsIcon.stories.tsx +167 -985
- package/dist/icons/bubble-check-icon/BubbleCheckIcon.stories.tsx +122 -1179
- package/dist/icons/bubble-crossed-icon/BubbleCrossedIcon.stories.tsx +124 -1168
- package/dist/icons/bubble-sparkle-icon/BubbleSparkleIcon.stories.tsx +119 -850
- package/dist/icons/camera-icon/CameraIcon.stories.tsx +112 -1213
- package/dist/icons/capital-a-letter-icon/CapitalALetterIcon.stories.tsx +117 -934
- package/dist/icons/chevron-double-left-icon/ChevronDoubleLeftIcon.stories.tsx +160 -961
- package/dist/icons/chevron-double-right-icon/ChevronDoubleRightIcon.stories.tsx +163 -961
- package/dist/icons/chevron-down-icon/ChevronDownIcon.stories.tsx +144 -942
- package/dist/icons/chevron-left-icon/ChevronLeftIcon.stories.tsx +129 -966
- package/dist/icons/chevron-right-icon/ChevronRightIcon.stories.tsx +147 -964
- package/dist/icons/chevron-up-icon/ChevronUpIcon.stories.tsx +145 -975
- package/dist/icons/circle-tick-icon/CircleTickIcon.stories.tsx +150 -1142
- package/dist/icons/circular-play-icon/CircularPlayIcon.stories.tsx +114 -461
- package/dist/icons/coin-icon/CoinIcon.stories.tsx +124 -1322
- package/dist/icons/coin-toons-icon/CoinToonsIcon.stories.tsx +117 -1318
- package/dist/icons/column-wide-add-icon/ColumnWideAddIcon.stories.tsx +114 -903
- package/dist/icons/command-icon/CommandIcon.stories.tsx +127 -1042
- package/dist/icons/copy-icon/CopyIcon.stories.tsx +123 -962
- package/dist/icons/cross-circle-icon/CrossCircleIcon.stories.tsx +147 -999
- package/dist/icons/cross-icon/CrossIcon.stories.tsx +139 -960
- package/dist/icons/download-icon/DownloadIcon.stories.tsx +126 -820
- package/dist/icons/edit-big-icon/EditBigIcon.stories.tsx +124 -1031
- package/dist/icons/email-icon/EmailIcon.stories.tsx +115 -936
- package/dist/icons/expand-icon/ExpandIcon.stories.tsx +112 -1111
- package/dist/icons/eye-close-icon/EyeCloseIcon.stories.tsx +144 -1025
- package/dist/icons/eye-open-icon/EyeOpenIcon.stories.tsx +143 -1036
- package/dist/icons/feature-shine-icon/FeatureShineIcon.stories.tsx +127 -1011
- package/dist/icons/file-chart-icon/FileChartIcon.stories.tsx +126 -1056
- package/dist/icons/file-text-icon/FileTextIcon.stories.tsx +125 -614
- package/dist/icons/filter-bar-row-icon/FilterBarRowIcon.stories.tsx +119 -1050
- package/dist/icons/forward-ten-seconds-icon/ForwardTenSecondsIcon.stories.tsx +169 -989
- package/dist/icons/git-branch-icon/GitBranchIcon.stories.tsx +115 -1145
- package/dist/icons/git-fork-icon/GitForkIcon.stories.tsx +115 -1122
- package/dist/icons/globe-icon/GlobeIcon.stories.tsx +130 -313
- package/dist/icons/google-logo-icon/GoogleLogoIcon.stories.tsx +145 -940
- package/dist/icons/grip-vertical-icon/GripVerticalIcon.stories.tsx +119 -1174
- package/dist/icons/head-icon/HeadIcon.stories.tsx +111 -916
- package/dist/icons/heart-icon/HeartIcon.stories.tsx +120 -1019
- package/dist/icons/image-avatar-sparkle-icon/ImageAvatarSparkleIcon.stories.tsx +119 -683
- package/dist/icons/image-icon/ImageIcon.stories.tsx +105 -1121
- package/dist/icons/import-folder-icon/ImportFolderIcon.stories.tsx +111 -1192
- package/dist/icons/import-left-arrow-folder-icon/ImportLeftArrowFolderIcon.stories.tsx +136 -1256
- package/dist/icons/indian-flag-icon/IndianFlagIcon.stories.tsx +159 -962
- package/dist/icons/instagram-icon/InstagramIcon.stories.tsx +161 -1385
- package/dist/icons/layout-column-icon/LayoutColumnIcon.stories.tsx +124 -972
- package/dist/icons/layout-left-icon/LayoutLeftIcon.stories.tsx +119 -948
- package/dist/icons/layout-right-icon/LayoutRightIcon.stories.tsx +119 -942
- package/dist/icons/light-bulb-simple-icon/LightBulbSimpleIcon.stories.tsx +108 -1215
- package/dist/icons/linked-in-icon/LinkedInIcon.stories.tsx +154 -1517
- package/dist/icons/magic-book-icon/MagicBookIcon.stories.tsx +110 -1188
- package/dist/icons/magic-edit-icon/MagicEditIcon.stories.tsx +119 -678
- package/dist/icons/maintenance-icon/MaintenanceIcon.stories.tsx +123 -1184
- package/dist/icons/message-icon/MessageIcon.stories.tsx +114 -538
- package/dist/icons/minimize-icon/MinimizeIcon.stories.tsx +116 -1158
- package/dist/icons/moon-icon/MoonIcon.stories.tsx +120 -536
- package/dist/icons/move-horizontal-icon/MoveHorizontalIcon.stories.tsx +109 -1184
- package/dist/icons/move-vertical-icon/MoveVerticalIcon.stories.tsx +115 -1134
- package/dist/icons/musical-note-icon/MusicalNoteIcon.stories.tsx +119 -971
- package/dist/icons/notepad-icon/NotepadIcon.stories.tsx +111 -1100
- package/dist/icons/notes-icon/NotesIcon.stories.tsx +119 -1101
- package/dist/icons/page-search-icon/PageSearchIcon.stories.tsx +109 -1111
- package/dist/icons/page-text-icon/PageTextIcon.stories.tsx +122 -684
- package/dist/icons/paint-roll-icon/PaintRollIcon.stories.tsx +113 -954
- package/dist/icons/paper-plane-icon/PaperPlaneIcon.stories.tsx +112 -877
- package/dist/icons/pause-icon/PauseIcon.stories.tsx +113 -1000
- package/dist/icons/pencil-icon/PencilIcon.stories.tsx +115 -1070
- package/dist/icons/phone-icon/PhoneIcon.stories.tsx +115 -978
- package/dist/icons/plus-icon/PlusIcon.stories.tsx +106 -1093
- package/dist/icons/pocket-studio-icon/PocketStudioIcon.stories.tsx +107 -829
- package/dist/icons/scroll-down-icon/ScrollDownIcon.stories.tsx +102 -469
- package/dist/icons/search-icon/SearchIcon.stories.tsx +111 -1124
- package/dist/icons/setting-icon/SettingIcon.stories.tsx +107 -970
- package/dist/icons/share-icon/ShareIcon.stories.tsx +120 -1025
- package/dist/icons/shield-icon/ShieldIcon.stories.tsx +117 -931
- package/dist/icons/site-logo-icon/SiteLogoIcon.stories.tsx +137 -1104
- package/dist/icons/skip-backward-icon/SkipBackwardIcon.stories.tsx +172 -982
- package/dist/icons/skip-forward-icon/SkipForwardIcon.stories.tsx +164 -983
- package/dist/icons/sparkles-soft-icon/SparklesSoftIcon.stories.tsx +105 -958
- package/dist/icons/spinner-gradient-icon/SpinnerGradientIcon.stories.tsx +158 -580
- package/dist/icons/spinner-gradient-icon/index.tsx +6 -1
- package/dist/icons/spinner-solid-icon/SpinnerSolidIcon.stories.tsx +158 -587
- package/dist/icons/spinner-solid-icon/index.tsx +6 -1
- package/dist/icons/spinner-solid-neutral-icon/SpinnerSolidINeutralcon.stories.tsx +146 -682
- package/dist/icons/spinner-solid-neutral-icon/index.tsx +1 -1
- package/dist/icons/star-icon/StarIcon.stories.tsx +124 -904
- package/dist/icons/store-coin-icon/StoreCoinIcon.stories.tsx +112 -964
- package/dist/icons/suggestion-icon/SuggestionIcon.stories.tsx +116 -852
- package/dist/icons/sun-icon/SunIcon.stories.tsx +120 -831
- package/dist/icons/text-color-icon/TextColorIcon.stories.tsx +116 -950
- package/dist/icons/text-indicator-icon/TextIndicatorIcon.stories.tsx +123 -980
- package/dist/icons/threads-icon/ThreadsIcon.stories.tsx +156 -1427
- package/dist/icons/tick-circle-icon/TickCircleIcon.stories.tsx +146 -1142
- package/dist/icons/tick-icon/TickIcon.stories.tsx +145 -1276
- package/dist/icons/trash-icon/TrashIcon.stories.tsx +108 -933
- package/dist/icons/twitter-x-icon/TwitterXIcon.stories.tsx +157 -1402
- package/dist/icons/upload-icon/UploadIcon.stories.tsx +115 -889
- package/dist/icons/vertical-menu-icon/VerticalMenuIcon.stories.tsx +118 -984
- package/dist/icons/video-play-list-icon/VideoPlaylistIcon.stories.tsx +125 -1049
- package/dist/icons/voice-playing-icon/VoicePlayingIcon.stories.tsx +123 -1356
- package/dist/icons/volume-full-icon/VolumeFullIcon.stories.tsx +110 -1171
- package/dist/icons/volume-half-icon/VolumeHalfIcon.stories.tsx +112 -1093
- package/dist/icons/volume-off-icon/VolumeOffIcon.stories.tsx +115 -1087
- package/dist/icons/warning-icon/WarningIcon.stories.tsx +122 -1046
- package/dist/icons/youtube-icon/YoutubeIcon.stories.tsx +161 -936
- package/dist/index.cjs +84 -84
- package/dist/index.js +84 -84
- package/dist/styles/aural-all-theme.css +1222 -0
- package/dist/styles/{aural-theme.css → aural-dark-theme.css} +15 -3
- package/dist/styles/aural-light-theme.css +1047 -0
- package/package.json +1 -1
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React from "react"
|
|
2
2
|
import type { Meta, StoryObj } from "@storybook/react-vite"
|
|
3
3
|
|
|
4
|
+
import { AuralComponentDocsPage } from "src/ui/story-spec/components/component-story-docs-page"
|
|
5
|
+
|
|
4
6
|
import { Avatar, AvatarFallback, AvatarImage } from "."
|
|
5
7
|
|
|
6
8
|
const meta: Meta<typeof Avatar> = {
|
|
@@ -8,61 +10,29 @@ const meta: Meta<typeof Avatar> = {
|
|
|
8
10
|
component: Avatar,
|
|
9
11
|
parameters: {
|
|
10
12
|
layout: "centered",
|
|
11
|
-
backgrounds: {
|
|
12
|
-
default: "dark",
|
|
13
|
-
values: [
|
|
14
|
-
{ name: "dark", value: "#0a0a0a" },
|
|
15
|
-
{ name: "light", value: "#ffffff" },
|
|
16
|
-
],
|
|
17
|
-
},
|
|
18
13
|
docs: {
|
|
19
14
|
description: {
|
|
20
|
-
component:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
A versatile avatar component built on Radix UI primitives for displaying user profile images with automatic fallback handling.
|
|
24
|
-
|
|
25
|
-
## Features
|
|
26
|
-
|
|
27
|
-
- **Automatic Fallback**: Graceful fallback to initials or placeholder when image fails to load
|
|
28
|
-
- **Responsive Design**: Flexible sizing with consistent aspect ratio
|
|
29
|
-
- **Accessibility**: Built-in accessibility features from Radix UI
|
|
30
|
-
- **Custom Styling**: Easy customization via className prop
|
|
31
|
-
- **Image Optimization**: Proper image handling with loading states
|
|
32
|
-
- **Circular Design**: Rounded avatar design optimized for profile pictures
|
|
33
|
-
|
|
34
|
-
## Component Structure
|
|
35
|
-
|
|
36
|
-
- **Avatar**: Root container that manages the avatar display
|
|
37
|
-
- **AvatarImage**: The actual image element with proper sizing and aspect ratio
|
|
38
|
-
- **AvatarFallback**: Fallback content displayed when image fails to load or is loading
|
|
39
|
-
|
|
40
|
-
## Usage Examples
|
|
41
|
-
|
|
42
|
-
### Basic Avatar
|
|
43
|
-
\`\`\`tsx
|
|
44
|
-
<Avatar>
|
|
45
|
-
<AvatarImage src="/user-avatar.jpg" alt="User Name" />
|
|
46
|
-
<AvatarFallback>UN</AvatarFallback>
|
|
47
|
-
</Avatar>
|
|
48
|
-
\`\`\`
|
|
49
|
-
|
|
50
|
-
### Custom Sizing
|
|
51
|
-
\`\`\`tsx
|
|
52
|
-
<Avatar className="size-16">
|
|
53
|
-
<AvatarImage src="/user-avatar.jpg" alt="User Name" />
|
|
54
|
-
<AvatarFallback>UN</AvatarFallback>
|
|
55
|
-
</Avatar>
|
|
56
|
-
\`\`\`
|
|
57
|
-
|
|
58
|
-
### Fallback Only
|
|
59
|
-
\`\`\`tsx
|
|
60
|
-
<Avatar>
|
|
61
|
-
<AvatarFallback>AB</AvatarFallback>
|
|
62
|
-
</Avatar>
|
|
63
|
-
\`\`\`
|
|
64
|
-
`,
|
|
15
|
+
component:
|
|
16
|
+
"A versatile avatar component built on Radix UI primitives for displaying user profile images with automatic fallback handling.",
|
|
65
17
|
},
|
|
18
|
+
page: () => (
|
|
19
|
+
<AuralComponentDocsPage
|
|
20
|
+
features={[
|
|
21
|
+
{
|
|
22
|
+
title: "Image & Fallback",
|
|
23
|
+
description: "Auto-handles load errors",
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
title: "Flexible Sizing",
|
|
27
|
+
description: "Any size via className",
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
title: "Composable Parts",
|
|
31
|
+
description: "Image, Fallback sub-parts",
|
|
32
|
+
},
|
|
33
|
+
]}
|
|
34
|
+
/>
|
|
35
|
+
),
|
|
66
36
|
},
|
|
67
37
|
},
|
|
68
38
|
tags: ["autodocs"],
|
|
@@ -71,19 +41,15 @@ A versatile avatar component built on Radix UI primitives for displaying user pr
|
|
|
71
41
|
export default meta
|
|
72
42
|
type Story = StoryObj<typeof Avatar>
|
|
73
43
|
|
|
74
|
-
// 1.
|
|
75
|
-
|
|
44
|
+
// ─── 1. All Variants ─────────────────────────────────────────────────────────
|
|
45
|
+
|
|
46
|
+
export const AllVariants: Story = {
|
|
76
47
|
render: () => (
|
|
77
48
|
<div className="space-y-8">
|
|
78
|
-
<
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
Standard avatar components with images and fallbacks
|
|
82
|
-
</p>
|
|
83
|
-
</div>
|
|
84
|
-
|
|
49
|
+
<h4 className="text-fm-secondary font-fm-text text-fm-md leading-fm-md font-medium">
|
|
50
|
+
Image & Fallback
|
|
51
|
+
</h4>
|
|
85
52
|
<div className="flex flex-wrap items-center justify-center gap-4">
|
|
86
|
-
{/* Avatar with Image */}
|
|
87
53
|
<div className="space-y-2 text-center">
|
|
88
54
|
<Avatar>
|
|
89
55
|
<AvatarImage
|
|
@@ -92,32 +58,37 @@ export const BasicAvatars: Story = {
|
|
|
92
58
|
/>
|
|
93
59
|
<AvatarFallback>JD</AvatarFallback>
|
|
94
60
|
</Avatar>
|
|
95
|
-
<p className="text-
|
|
61
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
62
|
+
With Image
|
|
63
|
+
</p>
|
|
96
64
|
</div>
|
|
97
65
|
|
|
98
|
-
{/* Avatar with Fallback Only */}
|
|
99
66
|
<div className="space-y-2 text-center">
|
|
100
|
-
<Avatar
|
|
67
|
+
<Avatar>
|
|
101
68
|
<AvatarFallback>AB</AvatarFallback>
|
|
102
69
|
</Avatar>
|
|
103
|
-
<p className="text-
|
|
70
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
71
|
+
Fallback Only
|
|
72
|
+
</p>
|
|
104
73
|
</div>
|
|
105
74
|
|
|
106
|
-
{/* Avatar with Broken Image (shows fallback) */}
|
|
107
75
|
<div className="space-y-2 text-center">
|
|
108
|
-
<Avatar
|
|
76
|
+
<Avatar>
|
|
109
77
|
<AvatarImage src="/broken-image.jpg" alt="Broken" />
|
|
110
78
|
<AvatarFallback>BR</AvatarFallback>
|
|
111
79
|
</Avatar>
|
|
112
|
-
<p className="text-
|
|
80
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
81
|
+
Broken Image
|
|
82
|
+
</p>
|
|
113
83
|
</div>
|
|
114
84
|
|
|
115
|
-
{/* Different Initials */}
|
|
116
85
|
<div className="space-y-2 text-center">
|
|
117
|
-
<Avatar
|
|
86
|
+
<Avatar>
|
|
118
87
|
<AvatarFallback>SM</AvatarFallback>
|
|
119
88
|
</Avatar>
|
|
120
|
-
<p className="text-
|
|
89
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
90
|
+
Initials
|
|
91
|
+
</p>
|
|
121
92
|
</div>
|
|
122
93
|
</div>
|
|
123
94
|
</div>
|
|
@@ -132,43 +103,38 @@ export const BasicAvatars: Story = {
|
|
|
132
103
|
},
|
|
133
104
|
}
|
|
134
105
|
|
|
135
|
-
// 2.
|
|
136
|
-
|
|
106
|
+
// ─── 2. Sizes ─────────────────────────────────────────────────────────────────
|
|
107
|
+
|
|
108
|
+
export const Sizes: Story = {
|
|
137
109
|
render: () => (
|
|
138
110
|
<div className="space-y-8">
|
|
139
|
-
<div className="text-center">
|
|
140
|
-
<h3 className="mb-2 font-medium text-white">Size Variations</h3>
|
|
141
|
-
<p className="text-sm text-white/60">
|
|
142
|
-
Different avatar sizes for various use cases
|
|
143
|
-
</p>
|
|
144
|
-
</div>
|
|
145
|
-
|
|
146
111
|
<div className="flex flex-wrap items-end justify-center gap-6">
|
|
147
|
-
{/* Extra Small */}
|
|
148
112
|
<div className="space-y-2 text-center">
|
|
149
|
-
<Avatar className="
|
|
113
|
+
<Avatar className="size-6">
|
|
150
114
|
<AvatarImage
|
|
151
115
|
src="https://images.unsplash.com/photo-1494790108755-2616b612b47c?w=100&h=100&fit=crop&crop=face"
|
|
152
116
|
alt="User"
|
|
153
117
|
/>
|
|
154
|
-
<AvatarFallback
|
|
118
|
+
<AvatarFallback>XS</AvatarFallback>
|
|
155
119
|
</Avatar>
|
|
156
|
-
<p className="text-
|
|
120
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
121
|
+
Extra Small (24px)
|
|
122
|
+
</p>
|
|
157
123
|
</div>
|
|
158
124
|
|
|
159
|
-
{/* Small */}
|
|
160
125
|
<div className="space-y-2 text-center">
|
|
161
126
|
<Avatar className="size-7">
|
|
162
127
|
<AvatarImage
|
|
163
128
|
src="https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?w=100&h=100&fit=crop&crop=face"
|
|
164
129
|
alt="User"
|
|
165
130
|
/>
|
|
166
|
-
<AvatarFallback
|
|
131
|
+
<AvatarFallback>S</AvatarFallback>
|
|
167
132
|
</Avatar>
|
|
168
|
-
<p className="text-
|
|
133
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
134
|
+
Small (28px)
|
|
135
|
+
</p>
|
|
169
136
|
</div>
|
|
170
137
|
|
|
171
|
-
{/* Default */}
|
|
172
138
|
<div className="space-y-2 text-center">
|
|
173
139
|
<Avatar>
|
|
174
140
|
<AvatarImage
|
|
@@ -177,10 +143,11 @@ export const SizeVariations: Story = {
|
|
|
177
143
|
/>
|
|
178
144
|
<AvatarFallback>M</AvatarFallback>
|
|
179
145
|
</Avatar>
|
|
180
|
-
<p className="text-
|
|
146
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
147
|
+
Default (32px)
|
|
148
|
+
</p>
|
|
181
149
|
</div>
|
|
182
150
|
|
|
183
|
-
{/* Large */}
|
|
184
151
|
<div className="space-y-2 text-center">
|
|
185
152
|
<Avatar className="size-12">
|
|
186
153
|
<AvatarImage
|
|
@@ -189,31 +156,35 @@ export const SizeVariations: Story = {
|
|
|
189
156
|
/>
|
|
190
157
|
<AvatarFallback>L</AvatarFallback>
|
|
191
158
|
</Avatar>
|
|
192
|
-
<p className="text-
|
|
159
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
160
|
+
Large (48px)
|
|
161
|
+
</p>
|
|
193
162
|
</div>
|
|
194
163
|
|
|
195
|
-
{/* Extra Large */}
|
|
196
164
|
<div className="space-y-2 text-center">
|
|
197
165
|
<Avatar className="size-16">
|
|
198
166
|
<AvatarImage
|
|
199
167
|
src="https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?w=100&h=100&fit=crop&crop=face"
|
|
200
168
|
alt="User"
|
|
201
169
|
/>
|
|
202
|
-
<AvatarFallback
|
|
170
|
+
<AvatarFallback>XL</AvatarFallback>
|
|
203
171
|
</Avatar>
|
|
204
|
-
<p className="text-
|
|
172
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
173
|
+
Extra Large (64px)
|
|
174
|
+
</p>
|
|
205
175
|
</div>
|
|
206
176
|
|
|
207
|
-
{/* XXL */}
|
|
208
177
|
<div className="space-y-2 text-center">
|
|
209
|
-
<Avatar className="
|
|
178
|
+
<Avatar className="size-20">
|
|
210
179
|
<AvatarImage
|
|
211
180
|
src="https://images.unsplash.com/photo-1494790108755-2616b612b47c?w=100&h=100&fit=crop&crop=face"
|
|
212
181
|
alt="User"
|
|
213
182
|
/>
|
|
214
|
-
<AvatarFallback
|
|
183
|
+
<AvatarFallback>XXL</AvatarFallback>
|
|
215
184
|
</Avatar>
|
|
216
|
-
<p className="text-
|
|
185
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
186
|
+
XXL (80px)
|
|
187
|
+
</p>
|
|
217
188
|
</div>
|
|
218
189
|
</div>
|
|
219
190
|
</div>
|
|
@@ -222,96 +193,102 @@ export const SizeVariations: Story = {
|
|
|
222
193
|
docs: {
|
|
223
194
|
description: {
|
|
224
195
|
story:
|
|
225
|
-
"Various avatar sizes from extra small (24px) to
|
|
196
|
+
"Various avatar sizes from extra small (24px) to XXL (80px) for different UI contexts.",
|
|
226
197
|
},
|
|
227
198
|
},
|
|
228
199
|
},
|
|
229
200
|
}
|
|
230
201
|
|
|
231
|
-
// 3.
|
|
232
|
-
|
|
202
|
+
// ─── 3. Configurations ───────────────────────────────────────────────────────
|
|
203
|
+
|
|
204
|
+
export const Configurations: Story = {
|
|
233
205
|
render: () => (
|
|
234
206
|
<div className="space-y-8">
|
|
235
|
-
<
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
Different fallback content styles and approaches
|
|
239
|
-
</p>
|
|
240
|
-
</div>
|
|
241
|
-
|
|
207
|
+
<h4 className="text-fm-secondary font-fm-text text-fm-md leading-fm-md font-medium">
|
|
208
|
+
Fallback Styles
|
|
209
|
+
</h4>
|
|
242
210
|
<div className="mx-auto grid max-w-lg grid-cols-2 gap-6 md:grid-cols-4">
|
|
243
|
-
{/* Standard Initials */}
|
|
244
211
|
<div className="space-y-2 text-center">
|
|
245
|
-
<Avatar className="
|
|
212
|
+
<Avatar className="size-12">
|
|
246
213
|
<AvatarFallback>JD</AvatarFallback>
|
|
247
214
|
</Avatar>
|
|
248
|
-
<p className="text-
|
|
215
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
216
|
+
Standard Initials
|
|
217
|
+
</p>
|
|
249
218
|
</div>
|
|
250
219
|
|
|
251
|
-
{/* Single Initial */}
|
|
252
220
|
<div className="space-y-2 text-center">
|
|
253
|
-
<Avatar className="
|
|
221
|
+
<Avatar className="size-12">
|
|
254
222
|
<AvatarFallback>A</AvatarFallback>
|
|
255
223
|
</Avatar>
|
|
256
|
-
<p className="text-
|
|
224
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
225
|
+
Single Initial
|
|
226
|
+
</p>
|
|
257
227
|
</div>
|
|
258
228
|
|
|
259
|
-
{/* Numbers */}
|
|
260
229
|
<div className="space-y-2 text-center">
|
|
261
|
-
<Avatar className="
|
|
230
|
+
<Avatar className="size-12">
|
|
262
231
|
<AvatarFallback>42</AvatarFallback>
|
|
263
232
|
</Avatar>
|
|
264
|
-
<p className="text-
|
|
233
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
234
|
+
Numbers
|
|
235
|
+
</p>
|
|
265
236
|
</div>
|
|
266
237
|
|
|
267
|
-
{/* Custom Background */}
|
|
268
238
|
<div className="space-y-2 text-center">
|
|
269
239
|
<Avatar className="size-12">
|
|
270
|
-
<AvatarFallback className="bg-
|
|
240
|
+
<AvatarFallback className="bg-fm-surface-info-sec text-fm-primary">
|
|
271
241
|
BG
|
|
272
242
|
</AvatarFallback>
|
|
273
243
|
</Avatar>
|
|
274
|
-
<p className="text-
|
|
244
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
245
|
+
Info
|
|
246
|
+
</p>
|
|
275
247
|
</div>
|
|
276
248
|
|
|
277
|
-
{/*
|
|
249
|
+
{/* text-white ensures contrast on vivid bg in both light and dark mode */}
|
|
278
250
|
<div className="space-y-2 text-center">
|
|
279
251
|
<Avatar className="size-12">
|
|
280
|
-
<AvatarFallback className="bg-
|
|
281
|
-
|
|
252
|
+
<AvatarFallback className="bg-fm-secondary-500 text-white">
|
|
253
|
+
AC
|
|
282
254
|
</AvatarFallback>
|
|
283
255
|
</Avatar>
|
|
284
|
-
<p className="text-
|
|
256
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
257
|
+
Accent
|
|
258
|
+
</p>
|
|
285
259
|
</div>
|
|
286
260
|
|
|
287
|
-
{/* Different Color */}
|
|
288
261
|
<div className="space-y-2 text-center">
|
|
289
262
|
<Avatar className="size-12">
|
|
290
|
-
<AvatarFallback className="bg-
|
|
263
|
+
<AvatarFallback className="bg-fm-surface-positive-sec text-fm-primary">
|
|
291
264
|
GN
|
|
292
265
|
</AvatarFallback>
|
|
293
266
|
</Avatar>
|
|
294
|
-
<p className="text-
|
|
267
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
268
|
+
Positive
|
|
269
|
+
</p>
|
|
295
270
|
</div>
|
|
296
271
|
|
|
297
|
-
{/* Orange Theme */}
|
|
298
272
|
<div className="space-y-2 text-center">
|
|
299
273
|
<Avatar className="size-12">
|
|
300
|
-
<AvatarFallback className="bg-
|
|
301
|
-
|
|
274
|
+
<AvatarFallback className="bg-fm-surface-warning-sec text-fm-primary">
|
|
275
|
+
WA
|
|
302
276
|
</AvatarFallback>
|
|
303
277
|
</Avatar>
|
|
304
|
-
<p className="text-
|
|
278
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
279
|
+
Warning
|
|
280
|
+
</p>
|
|
305
281
|
</div>
|
|
306
282
|
|
|
307
|
-
{/* Dark Theme */}
|
|
308
283
|
<div className="space-y-2 text-center">
|
|
309
284
|
<Avatar className="size-12">
|
|
310
|
-
<AvatarFallback className="bg-
|
|
285
|
+
<AvatarFallback className="bg-fm-surface-secondary text-fm-primary">
|
|
311
286
|
DK
|
|
312
287
|
</AvatarFallback>
|
|
313
288
|
</Avatar>
|
|
314
|
-
<p className="text-
|
|
289
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
290
|
+
Surface
|
|
291
|
+
</p>
|
|
315
292
|
</div>
|
|
316
293
|
</div>
|
|
317
294
|
</div>
|
|
@@ -320,28 +297,24 @@ export const FallbackVariations: Story = {
|
|
|
320
297
|
docs: {
|
|
321
298
|
description: {
|
|
322
299
|
story:
|
|
323
|
-
"Various fallback content
|
|
300
|
+
"Various fallback content configurations including initials, numbers, and semantic background color themes from the design system.",
|
|
324
301
|
},
|
|
325
302
|
},
|
|
326
303
|
},
|
|
327
304
|
}
|
|
328
305
|
|
|
329
|
-
// 4.
|
|
330
|
-
export const RealWorldExamples: Story = {
|
|
331
|
-
render: () => (
|
|
332
|
-
<div className="space-y-12">
|
|
333
|
-
<div className="text-center">
|
|
334
|
-
<h3 className="mb-2 font-medium text-white">Real World Examples</h3>
|
|
335
|
-
<p className="text-sm text-white/60">
|
|
336
|
-
Common avatar usage patterns in UI components
|
|
337
|
-
</p>
|
|
338
|
-
</div>
|
|
306
|
+
// ─── 4. Use Cases ─────────────────────────────────────────────────────────────
|
|
339
307
|
|
|
308
|
+
export const UseCases: Story = {
|
|
309
|
+
render: () => (
|
|
310
|
+
<div className="mx-auto max-w-3xl space-y-8 p-8">
|
|
340
311
|
{/* User List */}
|
|
341
312
|
<div className="space-y-4">
|
|
342
|
-
<h4 className="text-
|
|
313
|
+
<h4 className="text-fm-secondary font-fm-text text-fm-md leading-fm-md font-medium">
|
|
314
|
+
User List
|
|
315
|
+
</h4>
|
|
343
316
|
<div className="mx-auto max-w-md space-y-3">
|
|
344
|
-
<div className="flex items-center gap-3 rounded-lg border
|
|
317
|
+
<div className="border-fm-divider-secondary bg-fm-surface-secondary flex items-center gap-3 rounded-lg border p-3">
|
|
345
318
|
<Avatar>
|
|
346
319
|
<AvatarImage
|
|
347
320
|
src="https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?w=100&h=100&fit=crop&crop=face"
|
|
@@ -350,11 +323,15 @@ export const RealWorldExamples: Story = {
|
|
|
350
323
|
<AvatarFallback>JD</AvatarFallback>
|
|
351
324
|
</Avatar>
|
|
352
325
|
<div>
|
|
353
|
-
<p className="text-
|
|
354
|
-
|
|
326
|
+
<p className="text-fm-primary font-fm-text text-fm-sm leading-fm-sm font-medium">
|
|
327
|
+
John Doe
|
|
328
|
+
</p>
|
|
329
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
330
|
+
john.doe@example.com
|
|
331
|
+
</p>
|
|
355
332
|
</div>
|
|
356
333
|
</div>
|
|
357
|
-
<div className="flex items-center gap-3 rounded-lg border
|
|
334
|
+
<div className="border-fm-divider-secondary bg-fm-surface-secondary flex items-center gap-3 rounded-lg border p-3">
|
|
358
335
|
<Avatar>
|
|
359
336
|
<AvatarImage
|
|
360
337
|
src="https://images.unsplash.com/photo-1494790108755-2616b612b47c?w=100&h=100&fit=crop&crop=face"
|
|
@@ -363,19 +340,27 @@ export const RealWorldExamples: Story = {
|
|
|
363
340
|
<AvatarFallback>SW</AvatarFallback>
|
|
364
341
|
</Avatar>
|
|
365
342
|
<div>
|
|
366
|
-
<p className="text-
|
|
367
|
-
|
|
343
|
+
<p className="text-fm-primary font-fm-text text-fm-sm leading-fm-sm font-medium">
|
|
344
|
+
Sarah Wilson
|
|
345
|
+
</p>
|
|
346
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
347
|
+
sarah.wilson@example.com
|
|
348
|
+
</p>
|
|
368
349
|
</div>
|
|
369
350
|
</div>
|
|
370
|
-
<div className="flex items-center gap-3 rounded-lg border
|
|
351
|
+
<div className="border-fm-divider-secondary bg-fm-surface-secondary flex items-center gap-3 rounded-lg border p-3">
|
|
371
352
|
<Avatar>
|
|
372
|
-
<AvatarFallback className="bg-
|
|
353
|
+
<AvatarFallback className="bg-fm-surface-info-sec text-fm-primary">
|
|
373
354
|
MJ
|
|
374
355
|
</AvatarFallback>
|
|
375
356
|
</Avatar>
|
|
376
357
|
<div>
|
|
377
|
-
<p className="text-
|
|
378
|
-
|
|
358
|
+
<p className="text-fm-primary font-fm-text text-fm-sm leading-fm-sm font-medium">
|
|
359
|
+
Michael Johnson
|
|
360
|
+
</p>
|
|
361
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
362
|
+
michael.j@example.com
|
|
363
|
+
</p>
|
|
379
364
|
</div>
|
|
380
365
|
</div>
|
|
381
366
|
</div>
|
|
@@ -383,7 +368,9 @@ export const RealWorldExamples: Story = {
|
|
|
383
368
|
|
|
384
369
|
{/* Comment Thread */}
|
|
385
370
|
<div className="space-y-4">
|
|
386
|
-
<h4 className="text-
|
|
371
|
+
<h4 className="text-fm-secondary font-fm-text text-fm-md leading-fm-md font-medium">
|
|
372
|
+
Comment Thread
|
|
373
|
+
</h4>
|
|
387
374
|
<div className="mx-auto max-w-md space-y-4">
|
|
388
375
|
<div className="flex gap-3">
|
|
389
376
|
<Avatar className="size-8">
|
|
@@ -391,36 +378,41 @@ export const RealWorldExamples: Story = {
|
|
|
391
378
|
src="https://images.unsplash.com/photo-1500648767791-00dcc994a43e?w=100&h=100&fit=crop&crop=face"
|
|
392
379
|
alt="Alex"
|
|
393
380
|
/>
|
|
394
|
-
<AvatarFallback
|
|
381
|
+
<AvatarFallback>AL</AvatarFallback>
|
|
395
382
|
</Avatar>
|
|
396
383
|
<div className="flex-1">
|
|
397
|
-
<div className="rounded-lg border
|
|
398
|
-
<p className="
|
|
384
|
+
<div className="border-fm-divider-secondary bg-fm-surface-secondary rounded-lg border p-3">
|
|
385
|
+
<p className="text-fm-primary font-fm-text text-fm-sm leading-fm-sm mb-1 font-medium">
|
|
399
386
|
Alex Thompson
|
|
400
387
|
</p>
|
|
401
|
-
<p className="text-
|
|
388
|
+
<p className="text-fm-tertiary font-fm-text text-fm-sm leading-fm-sm">
|
|
402
389
|
This looks great! Really like the new design direction.
|
|
403
390
|
</p>
|
|
404
391
|
</div>
|
|
405
|
-
<p className="
|
|
392
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm mt-1">
|
|
393
|
+
2 hours ago
|
|
394
|
+
</p>
|
|
406
395
|
</div>
|
|
407
396
|
</div>
|
|
408
397
|
<div className="flex gap-3">
|
|
398
|
+
{/* text-white ensures contrast on vivid bg in both light and dark mode */}
|
|
409
399
|
<Avatar className="size-8">
|
|
410
|
-
<AvatarFallback className="bg-
|
|
400
|
+
<AvatarFallback className="bg-fm-secondary-500 text-white">
|
|
411
401
|
EM
|
|
412
402
|
</AvatarFallback>
|
|
413
403
|
</Avatar>
|
|
414
404
|
<div className="flex-1">
|
|
415
|
-
<div className="rounded-lg border
|
|
416
|
-
<p className="
|
|
405
|
+
<div className="border-fm-divider-secondary bg-fm-surface-secondary rounded-lg border p-3">
|
|
406
|
+
<p className="text-fm-primary font-fm-text text-fm-sm leading-fm-sm mb-1 font-medium">
|
|
417
407
|
Emma Davis
|
|
418
408
|
</p>
|
|
419
|
-
<p className="text-
|
|
409
|
+
<p className="text-fm-tertiary font-fm-text text-fm-sm leading-fm-sm">
|
|
420
410
|
Agreed! The frosted glass effect is perfect.
|
|
421
411
|
</p>
|
|
422
412
|
</div>
|
|
423
|
-
<p className="
|
|
413
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm mt-1">
|
|
414
|
+
1 hour ago
|
|
415
|
+
</p>
|
|
424
416
|
</div>
|
|
425
417
|
</div>
|
|
426
418
|
</div>
|
|
@@ -428,7 +420,9 @@ export const RealWorldExamples: Story = {
|
|
|
428
420
|
|
|
429
421
|
{/* Team Members */}
|
|
430
422
|
<div className="space-y-4">
|
|
431
|
-
<h4 className="text-
|
|
423
|
+
<h4 className="text-fm-secondary font-fm-text text-fm-md leading-fm-md font-medium">
|
|
424
|
+
Team Members
|
|
425
|
+
</h4>
|
|
432
426
|
<div className="flex items-center justify-center gap-2">
|
|
433
427
|
<Avatar className="size-10">
|
|
434
428
|
<AvatarImage
|
|
@@ -445,17 +439,17 @@ export const RealWorldExamples: Story = {
|
|
|
445
439
|
<AvatarFallback>DS</AvatarFallback>
|
|
446
440
|
</Avatar>
|
|
447
441
|
<Avatar className="size-10">
|
|
448
|
-
<AvatarFallback className="bg-
|
|
442
|
+
<AvatarFallback className="bg-fm-surface-positive-sec text-fm-primary">
|
|
449
443
|
DE
|
|
450
444
|
</AvatarFallback>
|
|
451
445
|
</Avatar>
|
|
452
446
|
<Avatar className="size-10">
|
|
453
|
-
<AvatarFallback className="bg-
|
|
447
|
+
<AvatarFallback className="bg-fm-surface-warning-sec text-fm-primary">
|
|
454
448
|
PM
|
|
455
449
|
</AvatarFallback>
|
|
456
450
|
</Avatar>
|
|
457
451
|
<Avatar className="size-10">
|
|
458
|
-
<AvatarFallback className="bg-
|
|
452
|
+
<AvatarFallback className="bg-fm-surface-secondary text-fm-primary">
|
|
459
453
|
+3
|
|
460
454
|
</AvatarFallback>
|
|
461
455
|
</Avatar>
|
|
@@ -464,6 +458,7 @@ export const RealWorldExamples: Story = {
|
|
|
464
458
|
</div>
|
|
465
459
|
),
|
|
466
460
|
parameters: {
|
|
461
|
+
layout: "fullscreen",
|
|
467
462
|
docs: {
|
|
468
463
|
description: {
|
|
469
464
|
story:
|
|
@@ -473,52 +468,48 @@ export const RealWorldExamples: Story = {
|
|
|
473
468
|
},
|
|
474
469
|
}
|
|
475
470
|
|
|
476
|
-
// 5.
|
|
477
|
-
|
|
471
|
+
// ─── 5. States ────────────────────────────────────────────────────────────────
|
|
472
|
+
|
|
473
|
+
export const States: Story = {
|
|
478
474
|
render: () => (
|
|
479
475
|
<div className="space-y-8">
|
|
480
|
-
<div className="text-center">
|
|
481
|
-
<h3 className="mb-2 font-medium text-white">Loading States</h3>
|
|
482
|
-
<p className="text-sm text-white/60">
|
|
483
|
-
How avatars handle loading and error states
|
|
484
|
-
</p>
|
|
485
|
-
</div>
|
|
486
|
-
|
|
487
476
|
<div className="flex flex-wrap items-center justify-center gap-6">
|
|
488
|
-
{/* Loading State Simulation */}
|
|
489
477
|
<div className="space-y-2 text-center">
|
|
490
478
|
<Avatar>
|
|
491
479
|
<AvatarImage
|
|
492
480
|
src="https://httpstat.us/200?sleep=5000"
|
|
493
481
|
alt="Loading"
|
|
494
482
|
/>
|
|
495
|
-
<AvatarFallback className="animate-pulse
|
|
496
|
-
<div className="h-4 w-4 rounded
|
|
483
|
+
<AvatarFallback className="bg-fm-surface-tertiary animate-pulse">
|
|
484
|
+
<div className="bg-fm-surface-secondary h-4 w-4 rounded"></div>
|
|
497
485
|
</AvatarFallback>
|
|
498
486
|
</Avatar>
|
|
499
|
-
<p className="text-
|
|
487
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
488
|
+
Loading
|
|
489
|
+
</p>
|
|
500
490
|
</div>
|
|
501
491
|
|
|
502
|
-
{/* Error State */}
|
|
503
492
|
<div className="space-y-2 text-center">
|
|
504
493
|
<Avatar>
|
|
505
494
|
<AvatarImage src="/non-existent-image.jpg" alt="Error" />
|
|
506
|
-
<AvatarFallback className="
|
|
495
|
+
<AvatarFallback className="bg-fm-surface-negative-sec text-fm-primary">
|
|
507
496
|
!
|
|
508
497
|
</AvatarFallback>
|
|
509
498
|
</Avatar>
|
|
510
|
-
<p className="text-
|
|
499
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
500
|
+
Error
|
|
501
|
+
</p>
|
|
511
502
|
</div>
|
|
512
503
|
|
|
513
|
-
{/* Skeleton State */}
|
|
514
504
|
<div className="space-y-2 text-center">
|
|
515
|
-
<Avatar className="animate-pulse
|
|
516
|
-
<AvatarFallback className="bg-
|
|
505
|
+
<Avatar className="bg-fm-surface-secondary animate-pulse">
|
|
506
|
+
<AvatarFallback className="bg-fm-surface-tertiary"></AvatarFallback>
|
|
517
507
|
</Avatar>
|
|
518
|
-
<p className="text-
|
|
508
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
509
|
+
Skeleton
|
|
510
|
+
</p>
|
|
519
511
|
</div>
|
|
520
512
|
|
|
521
|
-
{/* Success State */}
|
|
522
513
|
<div className="space-y-2 text-center">
|
|
523
514
|
<Avatar>
|
|
524
515
|
<AvatarImage
|
|
@@ -527,19 +518,18 @@ export const LoadingStates: Story = {
|
|
|
527
518
|
/>
|
|
528
519
|
<AvatarFallback>OK</AvatarFallback>
|
|
529
520
|
</Avatar>
|
|
530
|
-
<p className="text-
|
|
521
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
522
|
+
Loaded
|
|
523
|
+
</p>
|
|
531
524
|
</div>
|
|
532
525
|
</div>
|
|
533
526
|
|
|
534
|
-
<div className="
|
|
535
|
-
<div className="
|
|
536
|
-
<
|
|
537
|
-
Loading Behavior
|
|
538
|
-
</h4>
|
|
539
|
-
<p className="text-xs leading-relaxed text-white/60">
|
|
527
|
+
<div className="flex justify-center">
|
|
528
|
+
<div className="border-fm-divider-secondary bg-fm-surface-secondary max-w-lg rounded-lg border p-4">
|
|
529
|
+
<p className="text-fm-secondary font-fm-text text-fm-md leading-fm-xl">
|
|
540
530
|
Avatars automatically show fallback content while images are loading
|
|
541
|
-
or if they fail to load.
|
|
542
|
-
|
|
531
|
+
or if they fail to load. Customize the fallback appearance to match
|
|
532
|
+
your design system or show loading indicators.
|
|
543
533
|
</p>
|
|
544
534
|
</div>
|
|
545
535
|
</div>
|
|
@@ -549,26 +539,19 @@ export const LoadingStates: Story = {
|
|
|
549
539
|
docs: {
|
|
550
540
|
description: {
|
|
551
541
|
story:
|
|
552
|
-
"
|
|
542
|
+
"Loading, error, skeleton, and success states demonstrating how avatars handle image lifecycle events.",
|
|
553
543
|
},
|
|
554
544
|
},
|
|
555
545
|
},
|
|
556
546
|
}
|
|
557
547
|
|
|
558
|
-
// 6. Accessibility
|
|
559
|
-
|
|
548
|
+
// ─── 6. Accessibility ────────────────────────────────────────────────────────
|
|
549
|
+
|
|
550
|
+
export const Accessibility: Story = {
|
|
560
551
|
render: () => (
|
|
561
552
|
<div className="space-y-8">
|
|
562
|
-
<div className="text-center">
|
|
563
|
-
<h3 className="mb-2 font-medium text-white">Accessibility Features</h3>
|
|
564
|
-
<p className="text-sm text-white/60">
|
|
565
|
-
Proper accessibility implementation with alt text and descriptions
|
|
566
|
-
</p>
|
|
567
|
-
</div>
|
|
568
|
-
|
|
569
553
|
<div className="mx-auto max-w-md space-y-6">
|
|
570
|
-
|
|
571
|
-
<div className="flex items-center gap-3 rounded-lg border border-white/10 bg-white/5 p-4">
|
|
554
|
+
<div className="border-fm-divider-secondary bg-fm-surface-secondary flex items-center gap-3 rounded-lg border p-4">
|
|
572
555
|
<Avatar>
|
|
573
556
|
<AvatarImage
|
|
574
557
|
src="https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?w=100&h=100&fit=crop&crop=face"
|
|
@@ -577,26 +560,32 @@ export const AccessibilityExample: Story = {
|
|
|
577
560
|
<AvatarFallback>JD</AvatarFallback>
|
|
578
561
|
</Avatar>
|
|
579
562
|
<div>
|
|
580
|
-
<p className="text-
|
|
581
|
-
|
|
563
|
+
<p className="text-fm-primary font-fm-text text-fm-sm leading-fm-sm font-medium">
|
|
564
|
+
John Doe
|
|
565
|
+
</p>
|
|
566
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
567
|
+
Software Engineer
|
|
568
|
+
</p>
|
|
582
569
|
</div>
|
|
583
570
|
</div>
|
|
584
571
|
|
|
585
|
-
|
|
586
|
-
<div className="flex items-center gap-3 rounded-lg border border-white/10 bg-white/5 p-4">
|
|
572
|
+
<div className="border-fm-divider-secondary bg-fm-surface-secondary flex items-center gap-3 rounded-lg border p-4">
|
|
587
573
|
<Avatar title="User avatar for Sarah Wilson">
|
|
588
574
|
<AvatarFallback aria-label="Sarah Wilson's initials">
|
|
589
575
|
SW
|
|
590
576
|
</AvatarFallback>
|
|
591
577
|
</Avatar>
|
|
592
578
|
<div>
|
|
593
|
-
<p className="text-
|
|
594
|
-
|
|
579
|
+
<p className="text-fm-primary font-fm-text text-fm-sm leading-fm-sm font-medium">
|
|
580
|
+
Sarah Wilson
|
|
581
|
+
</p>
|
|
582
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
583
|
+
UX Designer
|
|
584
|
+
</p>
|
|
595
585
|
</div>
|
|
596
586
|
</div>
|
|
597
587
|
|
|
598
|
-
|
|
599
|
-
<div className="flex items-center gap-3 rounded-lg border border-white/10 bg-white/5 p-4">
|
|
588
|
+
<div className="border-fm-divider-secondary bg-fm-surface-secondary flex items-center gap-3 rounded-lg border p-4">
|
|
600
589
|
<div className="relative">
|
|
601
590
|
<Avatar>
|
|
602
591
|
<AvatarImage
|
|
@@ -606,30 +595,39 @@ export const AccessibilityExample: Story = {
|
|
|
606
595
|
<AvatarFallback>ED</AvatarFallback>
|
|
607
596
|
</Avatar>
|
|
608
597
|
<div
|
|
609
|
-
className="absolute -right-0.5 -bottom-0.5 h-3 w-3 rounded-full border-2
|
|
598
|
+
className="border-fm-surface-primary bg-fm-surface-positive absolute -right-0.5 -bottom-0.5 h-3 w-3 rounded-full border-2"
|
|
610
599
|
aria-label="Online status indicator"
|
|
611
600
|
title="Currently online"
|
|
612
601
|
></div>
|
|
613
602
|
</div>
|
|
614
603
|
<div>
|
|
615
|
-
<p className="text-
|
|
616
|
-
|
|
604
|
+
<p className="text-fm-primary font-fm-text text-fm-sm leading-fm-sm font-medium">
|
|
605
|
+
Emma Davis
|
|
606
|
+
</p>
|
|
607
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
608
|
+
Product Manager · Online
|
|
609
|
+
</p>
|
|
617
610
|
</div>
|
|
618
611
|
</div>
|
|
619
612
|
</div>
|
|
620
613
|
|
|
621
|
-
<div className="
|
|
622
|
-
<div className="
|
|
623
|
-
<
|
|
624
|
-
|
|
625
|
-
</
|
|
626
|
-
<
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
614
|
+
<div className="flex justify-center">
|
|
615
|
+
<div className="border-fm-divider-secondary bg-fm-surface-secondary max-w-lg space-y-1 rounded-lg border p-4">
|
|
616
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
617
|
+
Use descriptive alt text for avatar images
|
|
618
|
+
</p>
|
|
619
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
620
|
+
Provide aria-label on fallback content
|
|
621
|
+
</p>
|
|
622
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
623
|
+
Include title attributes for additional context
|
|
624
|
+
</p>
|
|
625
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
626
|
+
Ensure sufficient color contrast for fallback text
|
|
627
|
+
</p>
|
|
628
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
629
|
+
Add status indicators with proper aria labels
|
|
630
|
+
</p>
|
|
633
631
|
</div>
|
|
634
632
|
</div>
|
|
635
633
|
</div>
|