aural-ui 4.0.1 → 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 -1228
- package/dist/components/avatar/Avatar.stories.tsx +219 -235
- 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/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 -636
- 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 +530 -867
- package/dist/components/dialog/Dialog.stories.tsx +501 -950
- package/dist/components/divider/Divider.stories.tsx +264 -527
- package/dist/components/dot-loader/DotLoader.stories.tsx +256 -257
- package/dist/components/drawer/Drawer.stories.tsx +659 -1023
- package/dist/components/dropdown/Dropdown.stories.tsx +643 -1028
- 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 -1254
- 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 +484 -835
- package/dist/components/marquee/Marquee.stories.tsx +356 -712
- package/dist/components/otp-inputs/OtpInputs.stories.tsx +352 -422
- package/dist/components/overlay/Overlay.stories.tsx +452 -824
- package/dist/components/pagination/Pagination.stories.tsx +721 -210
- package/dist/components/popover/Popover.stories.tsx +481 -896
- package/dist/components/radio/Radio.stories.tsx +432 -124
- package/dist/components/resizable/Resizable.stories.tsx +495 -799
- package/dist/components/scroll-area/ScrollArea.stories.tsx +383 -1059
- package/dist/components/search/Search.stories.tsx +312 -595
- package/dist/components/select/Select.stories.tsx +684 -789
- package/dist/components/sheet/Sheet.stories.tsx +671 -950
- package/dist/components/skelton/Skelton.stories.tsx +230 -764
- package/dist/components/slider/Slider.stories.tsx +383 -760
- 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 -916
- package/dist/components/tabs/Tabs.stories.tsx +458 -1455
- 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 -154
- package/dist/components/toast/Toast.stories.tsx +452 -1339
- package/dist/components/toggle/Toggle.stories.tsx +488 -931
- package/dist/components/tooltip/Tooltip.stories.tsx +344 -1388
- 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 +223 -1060
- package/dist/icons/alert-icon/AlertIcon.stories.tsx +106 -968
- package/dist/icons/all-icons.tsx +37 -16
- package/dist/icons/angle-down-icon/AngleDownIcon.stories.tsx +137 -1010
- package/dist/icons/apple-logo-icon/AppleLogoIcon.stories.tsx +145 -935
- package/dist/icons/arrow-box-left-icon/ArrowBoxLeftIcon.stories.tsx +132 -1046
- package/dist/icons/arrow-corner-up-left-icon/ArrowCornerUpLeftIcon.stories.tsx +134 -986
- package/dist/icons/arrow-corner-up-right-icon/ArrowCornerUpRightIcon.stories.tsx +135 -1028
- package/dist/icons/arrow-left-icon/ArrowLeftIcon.stories.tsx +133 -971
- package/dist/icons/arrow-right-icon/ArrowRightIcon.stories.tsx +145 -1123
- package/dist/icons/arrow-right-up-icon/ArrowRightUpIcon.stories.tsx +143 -1252
- package/dist/icons/art-board-icon/ArtBoardIcon.stories.tsx +123 -632
- package/dist/icons/audio-bar-icon/AudioBarIcon.stories.tsx +141 -1223
- package/dist/icons/backward-ten-seconds-icon/BackwardTenSecondsIcon.stories.tsx +164 -1018
- package/dist/icons/bubble-check-icon/BubbleCheckIcon.stories.tsx +121 -1236
- package/dist/icons/bubble-crossed-icon/BubbleCrossedIcon.stories.tsx +121 -1213
- package/dist/icons/bubble-sparkle-icon/BubbleSparkleIcon.stories.tsx +116 -893
- package/dist/icons/camera-icon/CameraIcon.stories.tsx +109 -1254
- package/dist/icons/capital-a-letter-icon/CapitalALetterIcon.stories.tsx +114 -975
- package/dist/icons/chevron-double-left-icon/ChevronDoubleLeftIcon.stories.tsx +157 -994
- package/dist/icons/chevron-double-right-icon/ChevronDoubleRightIcon.stories.tsx +160 -992
- package/dist/icons/chevron-down-icon/ChevronDownIcon.stories.tsx +140 -970
- package/dist/icons/chevron-left-icon/ChevronLeftIcon.stories.tsx +126 -993
- package/dist/icons/chevron-right-icon/ChevronRightIcon.stories.tsx +144 -987
- package/dist/icons/chevron-up-icon/ChevronUpIcon.stories.tsx +141 -1007
- package/dist/icons/circle-tick-icon/CircleTickIcon.stories.tsx +147 -1187
- package/dist/icons/circular-play-icon/CircularPlayIcon.stories.tsx +110 -476
- package/dist/icons/coin-icon/CoinIcon.stories.tsx +120 -1364
- package/dist/icons/coin-toons-icon/CoinToonsIcon.stories.tsx +113 -1360
- package/dist/icons/column-wide-add-icon/ColumnWideAddIcon.stories.tsx +111 -942
- package/dist/icons/command-icon/CommandIcon.stories.tsx +124 -1087
- package/dist/icons/copy-icon/CopyIcon.stories.tsx +119 -996
- package/dist/icons/cross-circle-icon/CrossCircleIcon.stories.tsx +144 -1046
- package/dist/icons/cross-icon/CrossIcon.stories.tsx +136 -999
- package/dist/icons/download-icon/DownloadIcon.stories.tsx +123 -857
- package/dist/icons/edit-big-icon/EditBigIcon.stories.tsx +121 -1080
- package/dist/icons/email-icon/EmailIcon.stories.tsx +112 -979
- package/dist/icons/expand-icon/ExpandIcon.stories.tsx +109 -1146
- package/dist/icons/eye-close-icon/EyeCloseIcon.stories.tsx +141 -1068
- package/dist/icons/eye-open-icon/EyeOpenIcon.stories.tsx +140 -1081
- package/dist/icons/feature-shine-icon/FeatureShineIcon.stories.tsx +124 -1050
- package/dist/icons/file-chart-icon/FileChartIcon.stories.tsx +123 -1091
- package/dist/icons/file-text-icon/FileTextIcon.stories.tsx +122 -633
- package/dist/icons/filter-bar-row-icon/FilterBarRowIcon.stories.tsx +116 -1087
- package/dist/icons/forward-ten-seconds-icon/ForwardTenSecondsIcon.stories.tsx +166 -1020
- package/dist/icons/git-branch-icon/GitBranchIcon.stories.tsx +112 -1182
- package/dist/icons/git-fork-icon/GitForkIcon.stories.tsx +112 -1155
- package/dist/icons/globe-icon/GlobeIcon.stories.tsx +127 -325
- package/dist/icons/google-logo-icon/GoogleLogoIcon.stories.tsx +142 -985
- package/dist/icons/grip-vertical-icon/GripVerticalIcon.stories.tsx +116 -1217
- package/dist/icons/head-icon/HeadIcon.stories.tsx +108 -953
- package/dist/icons/heart-icon/HeartIcon.stories.tsx +117 -1060
- package/dist/icons/image-avatar-sparkle-icon/ImageAvatarSparkleIcon.stories.tsx +116 -716
- package/dist/icons/image-icon/ImageIcon.stories.tsx +102 -1164
- package/dist/icons/import-folder-icon/ImportFolderIcon.stories.tsx +108 -1233
- package/dist/icons/import-left-arrow-folder-icon/ImportLeftArrowFolderIcon.stories.tsx +133 -1289
- package/dist/icons/indian-flag-icon/IndianFlagIcon.stories.tsx +155 -1012
- package/dist/icons/instagram-icon/InstagramIcon.stories.tsx +158 -1438
- package/dist/icons/layout-column-icon/LayoutColumnIcon.stories.tsx +121 -1011
- package/dist/icons/layout-left-icon/LayoutLeftIcon.stories.tsx +116 -981
- package/dist/icons/layout-right-icon/LayoutRightIcon.stories.tsx +116 -979
- package/dist/icons/light-bulb-simple-icon/LightBulbSimpleIcon.stories.tsx +105 -1252
- package/dist/icons/linked-in-icon/LinkedInIcon.stories.tsx +151 -1554
- package/dist/icons/magic-book-icon/MagicBookIcon.stories.tsx +107 -1227
- package/dist/icons/magic-edit-icon/MagicEditIcon.stories.tsx +116 -707
- package/dist/icons/maintenance-icon/MaintenanceIcon.stories.tsx +119 -1226
- package/dist/icons/message-icon/MessageIcon.stories.tsx +111 -557
- package/dist/icons/minimize-icon/MinimizeIcon.stories.tsx +112 -1198
- package/dist/icons/moon-icon/MoonIcon.stories.tsx +117 -557
- package/dist/icons/move-horizontal-icon/MoveHorizontalIcon.stories.tsx +106 -1235
- package/dist/icons/move-vertical-icon/MoveVerticalIcon.stories.tsx +112 -1185
- package/dist/icons/musical-note-icon/MusicalNoteIcon.stories.tsx +116 -1012
- package/dist/icons/notepad-icon/NotepadIcon.stories.tsx +108 -1137
- package/dist/icons/notes-icon/NotesIcon.stories.tsx +116 -1138
- package/dist/icons/page-search-icon/PageSearchIcon.stories.tsx +106 -1146
- package/dist/icons/page-text-icon/PageTextIcon.stories.tsx +119 -719
- package/dist/icons/paint-roll-icon/PaintRollIcon.stories.tsx +110 -999
- package/dist/icons/paper-plane-icon/PaperPlaneIcon.stories.tsx +109 -912
- package/dist/icons/pause-icon/PauseIcon.stories.tsx +110 -1041
- package/dist/icons/pencil-icon/PencilIcon.stories.tsx +112 -1109
- package/dist/icons/phone-icon/PhoneIcon.stories.tsx +112 -1023
- package/dist/icons/plus-icon/PlusIcon.stories.tsx +103 -1132
- package/dist/icons/pocket-studio-icon/PocketStudioIcon.stories.tsx +104 -870
- package/dist/icons/scroll-down-icon/ScrollDownIcon.stories.tsx +99 -476
- package/dist/icons/search-icon/SearchIcon.stories.tsx +108 -1161
- package/dist/icons/setting-icon/SettingIcon.stories.tsx +104 -1009
- package/dist/icons/share-icon/ShareIcon.stories.tsx +117 -1064
- package/dist/icons/shield-icon/ShieldIcon.stories.tsx +114 -974
- package/dist/icons/site-logo-icon/SiteLogoIcon.stories.tsx +134 -1160
- package/dist/icons/skip-backward-icon/SkipBackwardIcon.stories.tsx +169 -1017
- package/dist/icons/skip-forward-icon/SkipForwardIcon.stories.tsx +161 -1016
- package/dist/icons/sparkles-soft-icon/SparklesSoftIcon.stories.tsx +102 -1001
- package/dist/icons/spinner-gradient-icon/SpinnerGradientIcon.stories.tsx +155 -593
- package/dist/icons/spinner-solid-icon/SpinnerSolidIcon.stories.tsx +155 -608
- package/dist/icons/spinner-solid-neutral-icon/SpinnerSolidINeutralcon.stories.tsx +142 -712
- package/dist/icons/star-icon/StarIcon.stories.tsx +120 -946
- package/dist/icons/store-coin-icon/StoreCoinIcon.stories.tsx +109 -1013
- package/dist/icons/suggestion-icon/SuggestionIcon.stories.tsx +113 -891
- package/dist/icons/sun-icon/SunIcon.stories.tsx +117 -864
- package/dist/icons/text-color-icon/TextColorIcon.stories.tsx +113 -989
- package/dist/icons/text-indicator-icon/TextIndicatorIcon.stories.tsx +120 -1027
- package/dist/icons/threads-icon/ThreadsIcon.stories.tsx +153 -1476
- package/dist/icons/tick-circle-icon/TickCircleIcon.stories.tsx +143 -1187
- package/dist/icons/tick-icon/TickIcon.stories.tsx +142 -1322
- package/dist/icons/trash-icon/TrashIcon.stories.tsx +105 -970
- package/dist/icons/twitter-x-icon/TwitterXIcon.stories.tsx +154 -1457
- package/dist/icons/upload-icon/UploadIcon.stories.tsx +112 -930
- package/dist/icons/vertical-menu-icon/VerticalMenuIcon.stories.tsx +115 -1019
- package/dist/icons/video-play-list-icon/VideoPlaylistIcon.stories.tsx +122 -1092
- package/dist/icons/voice-playing-icon/VoicePlayingIcon.stories.tsx +120 -1401
- package/dist/icons/volume-full-icon/VolumeFullIcon.stories.tsx +107 -1212
- package/dist/icons/volume-half-icon/VolumeHalfIcon.stories.tsx +109 -1122
- package/dist/icons/volume-off-icon/VolumeOffIcon.stories.tsx +112 -1124
- package/dist/icons/warning-icon/WarningIcon.stories.tsx +119 -1083
- package/dist/icons/youtube-icon/YoutubeIcon.stories.tsx +158 -983
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- 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-fm-secondary 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-fm-secondary 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-fm-secondary 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-fm-secondary 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="text-fm-primary mb-2 font-medium">Size Variations</h3>
|
|
141
|
-
<p className="text-fm-secondary text-sm">
|
|
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-fm-secondary 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-fm-secondary 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-fm-secondary 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-fm-secondary 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-fm-secondary 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-fm-secondary 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,98 +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
|
-
</h3>
|
|
239
|
-
<p className="text-fm-secondary text-sm">
|
|
240
|
-
Different fallback content styles and approaches
|
|
241
|
-
</p>
|
|
242
|
-
</div>
|
|
243
|
-
|
|
207
|
+
<h4 className="text-fm-secondary font-fm-text text-fm-md leading-fm-md font-medium">
|
|
208
|
+
Fallback Styles
|
|
209
|
+
</h4>
|
|
244
210
|
<div className="mx-auto grid max-w-lg grid-cols-2 gap-6 md:grid-cols-4">
|
|
245
|
-
{/* Standard Initials */}
|
|
246
211
|
<div className="space-y-2 text-center">
|
|
247
|
-
<Avatar className="
|
|
212
|
+
<Avatar className="size-12">
|
|
248
213
|
<AvatarFallback>JD</AvatarFallback>
|
|
249
214
|
</Avatar>
|
|
250
|
-
<p className="text-fm-secondary text-
|
|
215
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
216
|
+
Standard Initials
|
|
217
|
+
</p>
|
|
251
218
|
</div>
|
|
252
219
|
|
|
253
|
-
{/* Single Initial */}
|
|
254
220
|
<div className="space-y-2 text-center">
|
|
255
|
-
<Avatar className="
|
|
221
|
+
<Avatar className="size-12">
|
|
256
222
|
<AvatarFallback>A</AvatarFallback>
|
|
257
223
|
</Avatar>
|
|
258
|
-
<p className="text-fm-secondary text-
|
|
224
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
225
|
+
Single Initial
|
|
226
|
+
</p>
|
|
259
227
|
</div>
|
|
260
228
|
|
|
261
|
-
{/* Numbers */}
|
|
262
229
|
<div className="space-y-2 text-center">
|
|
263
|
-
<Avatar className="
|
|
230
|
+
<Avatar className="size-12">
|
|
264
231
|
<AvatarFallback>42</AvatarFallback>
|
|
265
232
|
</Avatar>
|
|
266
|
-
<p className="text-fm-secondary text-
|
|
233
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
234
|
+
Numbers
|
|
235
|
+
</p>
|
|
267
236
|
</div>
|
|
268
237
|
|
|
269
|
-
{/* Custom Background */}
|
|
270
238
|
<div className="space-y-2 text-center">
|
|
271
239
|
<Avatar className="size-12">
|
|
272
|
-
<AvatarFallback className="bg-
|
|
240
|
+
<AvatarFallback className="bg-fm-surface-info-sec text-fm-primary">
|
|
273
241
|
BG
|
|
274
242
|
</AvatarFallback>
|
|
275
243
|
</Avatar>
|
|
276
|
-
<p className="text-fm-secondary text-
|
|
244
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
245
|
+
Info
|
|
246
|
+
</p>
|
|
277
247
|
</div>
|
|
278
248
|
|
|
279
|
-
{/*
|
|
249
|
+
{/* text-white ensures contrast on vivid bg in both light and dark mode */}
|
|
280
250
|
<div className="space-y-2 text-center">
|
|
281
251
|
<Avatar className="size-12">
|
|
282
|
-
<AvatarFallback className="bg-
|
|
283
|
-
|
|
252
|
+
<AvatarFallback className="bg-fm-secondary-500 text-white">
|
|
253
|
+
AC
|
|
284
254
|
</AvatarFallback>
|
|
285
255
|
</Avatar>
|
|
286
|
-
<p className="text-fm-secondary text-
|
|
256
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
257
|
+
Accent
|
|
258
|
+
</p>
|
|
287
259
|
</div>
|
|
288
260
|
|
|
289
|
-
{/* Different Color */}
|
|
290
261
|
<div className="space-y-2 text-center">
|
|
291
262
|
<Avatar className="size-12">
|
|
292
|
-
<AvatarFallback className="bg-
|
|
263
|
+
<AvatarFallback className="bg-fm-surface-positive-sec text-fm-primary">
|
|
293
264
|
GN
|
|
294
265
|
</AvatarFallback>
|
|
295
266
|
</Avatar>
|
|
296
|
-
<p className="text-fm-secondary text-
|
|
267
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
268
|
+
Positive
|
|
269
|
+
</p>
|
|
297
270
|
</div>
|
|
298
271
|
|
|
299
|
-
{/* Orange Theme */}
|
|
300
272
|
<div className="space-y-2 text-center">
|
|
301
273
|
<Avatar className="size-12">
|
|
302
|
-
<AvatarFallback className="bg-
|
|
303
|
-
|
|
274
|
+
<AvatarFallback className="bg-fm-surface-warning-sec text-fm-primary">
|
|
275
|
+
WA
|
|
304
276
|
</AvatarFallback>
|
|
305
277
|
</Avatar>
|
|
306
|
-
<p className="text-fm-secondary text-
|
|
278
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
279
|
+
Warning
|
|
280
|
+
</p>
|
|
307
281
|
</div>
|
|
308
282
|
|
|
309
|
-
{/* Dark Theme */}
|
|
310
283
|
<div className="space-y-2 text-center">
|
|
311
284
|
<Avatar className="size-12">
|
|
312
|
-
<AvatarFallback className="bg-
|
|
285
|
+
<AvatarFallback className="bg-fm-surface-secondary text-fm-primary">
|
|
313
286
|
DK
|
|
314
287
|
</AvatarFallback>
|
|
315
288
|
</Avatar>
|
|
316
|
-
<p className="text-fm-secondary text-
|
|
289
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
290
|
+
Surface
|
|
291
|
+
</p>
|
|
317
292
|
</div>
|
|
318
293
|
</div>
|
|
319
294
|
</div>
|
|
@@ -322,28 +297,22 @@ export const FallbackVariations: Story = {
|
|
|
322
297
|
docs: {
|
|
323
298
|
description: {
|
|
324
299
|
story:
|
|
325
|
-
"Various fallback content
|
|
300
|
+
"Various fallback content configurations including initials, numbers, and semantic background color themes from the design system.",
|
|
326
301
|
},
|
|
327
302
|
},
|
|
328
303
|
},
|
|
329
304
|
}
|
|
330
305
|
|
|
331
|
-
// 4.
|
|
332
|
-
export const RealWorldExamples: Story = {
|
|
333
|
-
render: () => (
|
|
334
|
-
<div className="space-y-12">
|
|
335
|
-
<div className="text-center">
|
|
336
|
-
<h3 className="text-fm-primary mb-2 font-medium">
|
|
337
|
-
Real World Examples
|
|
338
|
-
</h3>
|
|
339
|
-
<p className="text-fm-secondary text-sm">
|
|
340
|
-
Common avatar usage patterns in UI components
|
|
341
|
-
</p>
|
|
342
|
-
</div>
|
|
306
|
+
// ─── 4. Use Cases ─────────────────────────────────────────────────────────────
|
|
343
307
|
|
|
308
|
+
export const UseCases: Story = {
|
|
309
|
+
render: () => (
|
|
310
|
+
<div className="mx-auto max-w-3xl space-y-8 p-8">
|
|
344
311
|
{/* User List */}
|
|
345
312
|
<div className="space-y-4">
|
|
346
|
-
<h4 className="text-fm-
|
|
313
|
+
<h4 className="text-fm-secondary font-fm-text text-fm-md leading-fm-md font-medium">
|
|
314
|
+
User List
|
|
315
|
+
</h4>
|
|
347
316
|
<div className="mx-auto max-w-md space-y-3">
|
|
348
317
|
<div className="border-fm-divider-secondary bg-fm-surface-secondary flex items-center gap-3 rounded-lg border p-3">
|
|
349
318
|
<Avatar>
|
|
@@ -354,8 +323,12 @@ export const RealWorldExamples: Story = {
|
|
|
354
323
|
<AvatarFallback>JD</AvatarFallback>
|
|
355
324
|
</Avatar>
|
|
356
325
|
<div>
|
|
357
|
-
<p className="text-fm-primary text-sm font-medium">
|
|
358
|
-
|
|
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>
|
|
359
332
|
</div>
|
|
360
333
|
</div>
|
|
361
334
|
<div className="border-fm-divider-secondary bg-fm-surface-secondary flex items-center gap-3 rounded-lg border p-3">
|
|
@@ -367,25 +340,27 @@ export const RealWorldExamples: Story = {
|
|
|
367
340
|
<AvatarFallback>SW</AvatarFallback>
|
|
368
341
|
</Avatar>
|
|
369
342
|
<div>
|
|
370
|
-
<p className="text-fm-primary text-sm font-medium">
|
|
343
|
+
<p className="text-fm-primary font-fm-text text-fm-sm leading-fm-sm font-medium">
|
|
371
344
|
Sarah Wilson
|
|
372
345
|
</p>
|
|
373
|
-
<p className="text-fm-secondary text-
|
|
346
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
374
347
|
sarah.wilson@example.com
|
|
375
348
|
</p>
|
|
376
349
|
</div>
|
|
377
350
|
</div>
|
|
378
351
|
<div className="border-fm-divider-secondary bg-fm-surface-secondary flex items-center gap-3 rounded-lg border p-3">
|
|
379
352
|
<Avatar>
|
|
380
|
-
<AvatarFallback className="bg-
|
|
353
|
+
<AvatarFallback className="bg-fm-surface-info-sec text-fm-primary">
|
|
381
354
|
MJ
|
|
382
355
|
</AvatarFallback>
|
|
383
356
|
</Avatar>
|
|
384
357
|
<div>
|
|
385
|
-
<p className="text-fm-primary text-sm font-medium">
|
|
358
|
+
<p className="text-fm-primary font-fm-text text-fm-sm leading-fm-sm font-medium">
|
|
386
359
|
Michael Johnson
|
|
387
360
|
</p>
|
|
388
|
-
<p className="text-fm-secondary text-
|
|
361
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
362
|
+
michael.j@example.com
|
|
363
|
+
</p>
|
|
389
364
|
</div>
|
|
390
365
|
</div>
|
|
391
366
|
</div>
|
|
@@ -393,7 +368,9 @@ export const RealWorldExamples: Story = {
|
|
|
393
368
|
|
|
394
369
|
{/* Comment Thread */}
|
|
395
370
|
<div className="space-y-4">
|
|
396
|
-
<h4 className="text-fm-
|
|
371
|
+
<h4 className="text-fm-secondary font-fm-text text-fm-md leading-fm-md font-medium">
|
|
372
|
+
Comment Thread
|
|
373
|
+
</h4>
|
|
397
374
|
<div className="mx-auto max-w-md space-y-4">
|
|
398
375
|
<div className="flex gap-3">
|
|
399
376
|
<Avatar className="size-8">
|
|
@@ -401,36 +378,41 @@ export const RealWorldExamples: Story = {
|
|
|
401
378
|
src="https://images.unsplash.com/photo-1500648767791-00dcc994a43e?w=100&h=100&fit=crop&crop=face"
|
|
402
379
|
alt="Alex"
|
|
403
380
|
/>
|
|
404
|
-
<AvatarFallback
|
|
381
|
+
<AvatarFallback>AL</AvatarFallback>
|
|
405
382
|
</Avatar>
|
|
406
383
|
<div className="flex-1">
|
|
407
384
|
<div className="border-fm-divider-secondary bg-fm-surface-secondary rounded-lg border p-3">
|
|
408
|
-
<p className="text-fm-primary
|
|
385
|
+
<p className="text-fm-primary font-fm-text text-fm-sm leading-fm-sm mb-1 font-medium">
|
|
409
386
|
Alex Thompson
|
|
410
387
|
</p>
|
|
411
|
-
<p className="text-fm-tertiary text-sm">
|
|
388
|
+
<p className="text-fm-tertiary font-fm-text text-fm-sm leading-fm-sm">
|
|
412
389
|
This looks great! Really like the new design direction.
|
|
413
390
|
</p>
|
|
414
391
|
</div>
|
|
415
|
-
<p className="text-fm-secondary
|
|
392
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm mt-1">
|
|
393
|
+
2 hours ago
|
|
394
|
+
</p>
|
|
416
395
|
</div>
|
|
417
396
|
</div>
|
|
418
397
|
<div className="flex gap-3">
|
|
398
|
+
{/* text-white ensures contrast on vivid bg in both light and dark mode */}
|
|
419
399
|
<Avatar className="size-8">
|
|
420
|
-
<AvatarFallback className="bg-
|
|
400
|
+
<AvatarFallback className="bg-fm-secondary-500 text-white">
|
|
421
401
|
EM
|
|
422
402
|
</AvatarFallback>
|
|
423
403
|
</Avatar>
|
|
424
404
|
<div className="flex-1">
|
|
425
405
|
<div className="border-fm-divider-secondary bg-fm-surface-secondary rounded-lg border p-3">
|
|
426
|
-
<p className="text-fm-primary
|
|
406
|
+
<p className="text-fm-primary font-fm-text text-fm-sm leading-fm-sm mb-1 font-medium">
|
|
427
407
|
Emma Davis
|
|
428
408
|
</p>
|
|
429
|
-
<p className="text-fm-tertiary text-sm">
|
|
409
|
+
<p className="text-fm-tertiary font-fm-text text-fm-sm leading-fm-sm">
|
|
430
410
|
Agreed! The frosted glass effect is perfect.
|
|
431
411
|
</p>
|
|
432
412
|
</div>
|
|
433
|
-
<p className="text-fm-secondary
|
|
413
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm mt-1">
|
|
414
|
+
1 hour ago
|
|
415
|
+
</p>
|
|
434
416
|
</div>
|
|
435
417
|
</div>
|
|
436
418
|
</div>
|
|
@@ -438,7 +420,9 @@ export const RealWorldExamples: Story = {
|
|
|
438
420
|
|
|
439
421
|
{/* Team Members */}
|
|
440
422
|
<div className="space-y-4">
|
|
441
|
-
<h4 className="text-fm-
|
|
423
|
+
<h4 className="text-fm-secondary font-fm-text text-fm-md leading-fm-md font-medium">
|
|
424
|
+
Team Members
|
|
425
|
+
</h4>
|
|
442
426
|
<div className="flex items-center justify-center gap-2">
|
|
443
427
|
<Avatar className="size-10">
|
|
444
428
|
<AvatarImage
|
|
@@ -455,17 +439,17 @@ export const RealWorldExamples: Story = {
|
|
|
455
439
|
<AvatarFallback>DS</AvatarFallback>
|
|
456
440
|
</Avatar>
|
|
457
441
|
<Avatar className="size-10">
|
|
458
|
-
<AvatarFallback className="bg-
|
|
442
|
+
<AvatarFallback className="bg-fm-surface-positive-sec text-fm-primary">
|
|
459
443
|
DE
|
|
460
444
|
</AvatarFallback>
|
|
461
445
|
</Avatar>
|
|
462
446
|
<Avatar className="size-10">
|
|
463
|
-
<AvatarFallback className="bg-
|
|
447
|
+
<AvatarFallback className="bg-fm-surface-warning-sec text-fm-primary">
|
|
464
448
|
PM
|
|
465
449
|
</AvatarFallback>
|
|
466
450
|
</Avatar>
|
|
467
451
|
<Avatar className="size-10">
|
|
468
|
-
<AvatarFallback className="bg-
|
|
452
|
+
<AvatarFallback className="bg-fm-surface-secondary text-fm-primary">
|
|
469
453
|
+3
|
|
470
454
|
</AvatarFallback>
|
|
471
455
|
</Avatar>
|
|
@@ -474,6 +458,7 @@ export const RealWorldExamples: Story = {
|
|
|
474
458
|
</div>
|
|
475
459
|
),
|
|
476
460
|
parameters: {
|
|
461
|
+
layout: "fullscreen",
|
|
477
462
|
docs: {
|
|
478
463
|
description: {
|
|
479
464
|
story:
|
|
@@ -483,52 +468,48 @@ export const RealWorldExamples: Story = {
|
|
|
483
468
|
},
|
|
484
469
|
}
|
|
485
470
|
|
|
486
|
-
// 5.
|
|
487
|
-
|
|
471
|
+
// ─── 5. States ────────────────────────────────────────────────────────────────
|
|
472
|
+
|
|
473
|
+
export const States: Story = {
|
|
488
474
|
render: () => (
|
|
489
475
|
<div className="space-y-8">
|
|
490
|
-
<div className="text-center">
|
|
491
|
-
<h3 className="text-fm-primary mb-2 font-medium">Loading States</h3>
|
|
492
|
-
<p className="text-fm-secondary text-sm">
|
|
493
|
-
How avatars handle loading and error states
|
|
494
|
-
</p>
|
|
495
|
-
</div>
|
|
496
|
-
|
|
497
476
|
<div className="flex flex-wrap items-center justify-center gap-6">
|
|
498
|
-
{/* Loading State Simulation */}
|
|
499
477
|
<div className="space-y-2 text-center">
|
|
500
478
|
<Avatar>
|
|
501
479
|
<AvatarImage
|
|
502
480
|
src="https://httpstat.us/200?sleep=5000"
|
|
503
481
|
alt="Loading"
|
|
504
482
|
/>
|
|
505
|
-
<AvatarFallback className="animate-pulse
|
|
506
|
-
<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>
|
|
507
485
|
</AvatarFallback>
|
|
508
486
|
</Avatar>
|
|
509
|
-
<p className="text-fm-secondary text-
|
|
487
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
488
|
+
Loading
|
|
489
|
+
</p>
|
|
510
490
|
</div>
|
|
511
491
|
|
|
512
|
-
{/* Error State */}
|
|
513
492
|
<div className="space-y-2 text-center">
|
|
514
493
|
<Avatar>
|
|
515
494
|
<AvatarImage src="/non-existent-image.jpg" alt="Error" />
|
|
516
|
-
<AvatarFallback className="
|
|
495
|
+
<AvatarFallback className="bg-fm-surface-negative-sec text-fm-primary">
|
|
517
496
|
!
|
|
518
497
|
</AvatarFallback>
|
|
519
498
|
</Avatar>
|
|
520
|
-
<p className="text-fm-secondary text-
|
|
499
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
500
|
+
Error
|
|
501
|
+
</p>
|
|
521
502
|
</div>
|
|
522
503
|
|
|
523
|
-
{/* Skeleton State */}
|
|
524
504
|
<div className="space-y-2 text-center">
|
|
525
|
-
<Avatar className="animate-pulse
|
|
526
|
-
<AvatarFallback className="bg-
|
|
505
|
+
<Avatar className="bg-fm-surface-secondary animate-pulse">
|
|
506
|
+
<AvatarFallback className="bg-fm-surface-tertiary"></AvatarFallback>
|
|
527
507
|
</Avatar>
|
|
528
|
-
<p className="text-fm-secondary text-
|
|
508
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
509
|
+
Skeleton
|
|
510
|
+
</p>
|
|
529
511
|
</div>
|
|
530
512
|
|
|
531
|
-
{/* Success State */}
|
|
532
513
|
<div className="space-y-2 text-center">
|
|
533
514
|
<Avatar>
|
|
534
515
|
<AvatarImage
|
|
@@ -537,19 +518,18 @@ export const LoadingStates: Story = {
|
|
|
537
518
|
/>
|
|
538
519
|
<AvatarFallback>OK</AvatarFallback>
|
|
539
520
|
</Avatar>
|
|
540
|
-
<p className="text-fm-secondary text-
|
|
521
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
522
|
+
Loaded
|
|
523
|
+
</p>
|
|
541
524
|
</div>
|
|
542
525
|
</div>
|
|
543
526
|
|
|
544
|
-
<div className="
|
|
545
|
-
<div className="border-fm-divider-secondary bg-fm-surface-secondary
|
|
546
|
-
<
|
|
547
|
-
Loading Behavior
|
|
548
|
-
</h4>
|
|
549
|
-
<p className="text-fm-secondary text-xs leading-relaxed">
|
|
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">
|
|
550
530
|
Avatars automatically show fallback content while images are loading
|
|
551
|
-
or if they fail to load.
|
|
552
|
-
|
|
531
|
+
or if they fail to load. Customize the fallback appearance to match
|
|
532
|
+
your design system or show loading indicators.
|
|
553
533
|
</p>
|
|
554
534
|
</div>
|
|
555
535
|
</div>
|
|
@@ -559,27 +539,18 @@ export const LoadingStates: Story = {
|
|
|
559
539
|
docs: {
|
|
560
540
|
description: {
|
|
561
541
|
story:
|
|
562
|
-
"
|
|
542
|
+
"Loading, error, skeleton, and success states demonstrating how avatars handle image lifecycle events.",
|
|
563
543
|
},
|
|
564
544
|
},
|
|
565
545
|
},
|
|
566
546
|
}
|
|
567
547
|
|
|
568
|
-
// 6. Accessibility
|
|
569
|
-
|
|
548
|
+
// ─── 6. Accessibility ────────────────────────────────────────────────────────
|
|
549
|
+
|
|
550
|
+
export const Accessibility: Story = {
|
|
570
551
|
render: () => (
|
|
571
552
|
<div className="space-y-8">
|
|
572
|
-
<div className="text-center">
|
|
573
|
-
<h3 className="text-fm-primary mb-2 font-medium">
|
|
574
|
-
Accessibility Features
|
|
575
|
-
</h3>
|
|
576
|
-
<p className="text-fm-secondary text-sm">
|
|
577
|
-
Proper accessibility implementation with alt text and descriptions
|
|
578
|
-
</p>
|
|
579
|
-
</div>
|
|
580
|
-
|
|
581
553
|
<div className="mx-auto max-w-md space-y-6">
|
|
582
|
-
{/* Profile with proper alt text */}
|
|
583
554
|
<div className="border-fm-divider-secondary bg-fm-surface-secondary flex items-center gap-3 rounded-lg border p-4">
|
|
584
555
|
<Avatar>
|
|
585
556
|
<AvatarImage
|
|
@@ -589,12 +560,15 @@ export const AccessibilityExample: Story = {
|
|
|
589
560
|
<AvatarFallback>JD</AvatarFallback>
|
|
590
561
|
</Avatar>
|
|
591
562
|
<div>
|
|
592
|
-
<p className="text-fm-primary text-sm font-medium">
|
|
593
|
-
|
|
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>
|
|
594
569
|
</div>
|
|
595
570
|
</div>
|
|
596
571
|
|
|
597
|
-
{/* Fallback with descriptive content */}
|
|
598
572
|
<div className="border-fm-divider-secondary bg-fm-surface-secondary flex items-center gap-3 rounded-lg border p-4">
|
|
599
573
|
<Avatar title="User avatar for Sarah Wilson">
|
|
600
574
|
<AvatarFallback aria-label="Sarah Wilson's initials">
|
|
@@ -602,12 +576,15 @@ export const AccessibilityExample: Story = {
|
|
|
602
576
|
</AvatarFallback>
|
|
603
577
|
</Avatar>
|
|
604
578
|
<div>
|
|
605
|
-
<p className="text-fm-primary text-sm font-medium">
|
|
606
|
-
|
|
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>
|
|
607
585
|
</div>
|
|
608
586
|
</div>
|
|
609
587
|
|
|
610
|
-
{/* Online status indicator */}
|
|
611
588
|
<div className="border-fm-divider-secondary bg-fm-surface-secondary flex items-center gap-3 rounded-lg border p-4">
|
|
612
589
|
<div className="relative">
|
|
613
590
|
<Avatar>
|
|
@@ -624,26 +601,33 @@ export const AccessibilityExample: Story = {
|
|
|
624
601
|
></div>
|
|
625
602
|
</div>
|
|
626
603
|
<div>
|
|
627
|
-
<p className="text-fm-primary text-sm font-medium">
|
|
628
|
-
|
|
629
|
-
|
|
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
|
|
630
609
|
</p>
|
|
631
610
|
</div>
|
|
632
611
|
</div>
|
|
633
612
|
</div>
|
|
634
613
|
|
|
635
|
-
<div className="
|
|
636
|
-
<div className="border-fm-divider-secondary bg-fm-surface-secondary
|
|
637
|
-
<
|
|
638
|
-
|
|
639
|
-
</
|
|
640
|
-
<
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
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>
|
|
647
631
|
</div>
|
|
648
632
|
</div>
|
|
649
633
|
</div>
|