aural-ui 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +456 -0
- package/dist/components/aspect-ratio/AspectRatio.stories.tsx +1327 -0
- package/dist/components/aspect-ratio/index.tsx +10 -0
- package/dist/components/aspect-ratio/meta.ts +8 -0
- package/dist/components/avatar/Avatar.stories.tsx +645 -0
- package/dist/components/avatar/index.tsx +50 -0
- package/dist/components/avatar/meta.ts +8 -0
- package/dist/components/badge/Badge.stories.tsx +169 -0
- package/dist/components/badge/index.tsx +28 -0
- package/dist/components/badge/meta.ts +6 -0
- package/dist/components/banner/Banner.stories.tsx +475 -0
- package/dist/components/banner/index.tsx +256 -0
- package/dist/components/banner/meta.ts +36 -0
- package/dist/components/button/Button.stories.tsx +74 -0
- package/dist/components/button/index.tsx +158 -0
- package/dist/components/button/meta.ts +33 -0
- package/dist/components/card/Card.stories.tsx +377 -0
- package/dist/components/card/index.tsx +85 -0
- package/dist/components/card/meta.ts +14 -0
- package/dist/components/char-count/CharCount.stories.tsx +334 -0
- package/dist/components/char-count/index.tsx +51 -0
- package/dist/components/char-count/meta.ts +13 -0
- package/dist/components/checkbox/Checkbox.stories.tsx +209 -0
- package/dist/components/checkbox/index.tsx +34 -0
- package/dist/components/checkbox/meta.ts +19 -0
- package/dist/components/chip/Chip.stories.tsx +207 -0
- package/dist/components/chip/index.tsx +92 -0
- package/dist/components/chip/meta.ts +17 -0
- package/dist/components/circular-loader/CircularLoader.stories.tsx +741 -0
- package/dist/components/circular-loader/index.tsx +138 -0
- package/dist/components/circular-loader/meta.ts +11 -0
- package/dist/components/collapsible/Collapsible.stories.tsx +319 -0
- package/dist/components/collapsible/index.tsx +158 -0
- package/dist/components/collapsible/meta.ts +22 -0
- package/dist/components/command/Command.stories.tsx +996 -0
- package/dist/components/command/index.tsx +324 -0
- package/dist/components/command/meta.ts +18 -0
- package/dist/components/dialog/Dialog.stories.tsx +963 -0
- package/dist/components/dialog/index.tsx +250 -0
- package/dist/components/dialog/meta.ts +28 -0
- package/dist/components/divider/Divider.stories.tsx +633 -0
- package/dist/components/divider/index.tsx +181 -0
- package/dist/components/divider/meta.ts +12 -0
- package/dist/components/dot-loader/DotLoader.stories.tsx +352 -0
- package/dist/components/dot-loader/index.tsx +78 -0
- package/dist/components/dot-loader/meta.ts +14 -0
- package/dist/components/dropdown/Dropdown.stories.tsx +1210 -0
- package/dist/components/dropdown/index.tsx +479 -0
- package/dist/components/dropdown/meta.ts +21 -0
- package/dist/components/form/Form.stories.tsx +320 -0
- package/dist/components/form/index.tsx +183 -0
- package/dist/components/form/meta.ts +11 -0
- package/dist/components/helper-text/HelperText.stories.tsx +254 -0
- package/dist/components/helper-text/index.tsx +102 -0
- package/dist/components/helper-text/meta.ts +18 -0
- package/dist/components/hover-card/HoverCard.stories.tsx +1328 -0
- package/dist/components/hover-card/index.tsx +42 -0
- package/dist/components/hover-card/meta.ts +12 -0
- package/dist/components/icon-button/IconButton.stories.tsx +252 -0
- package/dist/components/icon-button/index.tsx +130 -0
- package/dist/components/icon-button/meta.ts +20 -0
- package/dist/components/if-else/if-else.stories.tsx +100 -0
- package/dist/components/if-else/index.tsx +56 -0
- package/dist/components/if-else/meta.ts +6 -0
- package/dist/components/index.ts +70 -0
- package/dist/components/input/Input.stories.tsx +431 -0
- package/dist/components/input/index.tsx +487 -0
- package/dist/components/input/meta.ts +28 -0
- package/dist/components/label/Label.stories.tsx +200 -0
- package/dist/components/label/index.tsx +43 -0
- package/dist/components/label/meta.ts +14 -0
- package/dist/components/list/List.stories.tsx +963 -0
- package/dist/components/list/index.tsx +567 -0
- package/dist/components/list/meta.ts +24 -0
- package/dist/components/marquee/Marquee.stories.tsx +819 -0
- package/dist/components/marquee/index.tsx +107 -0
- package/dist/components/marquee/meta.ts +6 -0
- package/dist/components/overlay/Overlay.stories.tsx +954 -0
- package/dist/components/overlay/index.tsx +58 -0
- package/dist/components/overlay/meta.ts +10 -0
- package/dist/components/pagination/Pagination.stories.tsx +354 -0
- package/dist/components/pagination/index.tsx +455 -0
- package/dist/components/pagination/meta.ts +29 -0
- package/dist/components/popover/Popover.stories.tsx +1037 -0
- package/dist/components/popover/index.tsx +67 -0
- package/dist/components/popover/meta.ts +12 -0
- package/dist/components/radio/Radio.stories.tsx +146 -0
- package/dist/components/radio/index.tsx +41 -0
- package/dist/components/radio/meta.ts +19 -0
- package/dist/components/resizable/Resizable.stories.tsx +866 -0
- package/dist/components/resizable/index.tsx +55 -0
- package/dist/components/resizable/meta.ts +12 -0
- package/dist/components/scroll-area/ScrollArea.stories.tsx +1104 -0
- package/dist/components/scroll-area/index.tsx +55 -0
- package/dist/components/scroll-area/meta.ts +8 -0
- package/dist/components/search/Search.stories.tsx +678 -0
- package/dist/components/search/index.tsx +141 -0
- package/dist/components/search/meta.ts +6 -0
- package/dist/components/select/Select.stories.tsx +962 -0
- package/dist/components/select/index.tsx +512 -0
- package/dist/components/select/meta.ts +40 -0
- package/dist/components/sheet/Sheet.stories.tsx +1060 -0
- package/dist/components/sheet/index.tsx +440 -0
- package/dist/components/sheet/meta.ts +38 -0
- package/dist/components/skelton/Skelton.stories.tsx +859 -0
- package/dist/components/skelton/index.tsx +17 -0
- package/dist/components/skelton/meta.ts +6 -0
- package/dist/components/slider/Slider.stories.tsx +876 -0
- package/dist/components/slider/index.tsx +156 -0
- package/dist/components/slider/meta.ts +29 -0
- package/dist/components/stepper/Stepper.stories.tsx +639 -0
- package/dist/components/stepper/index.tsx +650 -0
- package/dist/components/stepper/meta.ts +19 -0
- package/dist/components/switch/Switch.stories.tsx +85 -0
- package/dist/components/switch/index.tsx +37 -0
- package/dist/components/switch/meta.ts +24 -0
- package/dist/components/switch-case/SwitchCase.stories.tsx +209 -0
- package/dist/components/switch-case/index.tsx +89 -0
- package/dist/components/switch-case/meta.ts +6 -0
- package/dist/components/table/Table.stories.tsx +1095 -0
- package/dist/components/table/index.tsx +113 -0
- package/dist/components/table/meta.ts +20 -0
- package/dist/components/tabs/Tabs.stories.tsx +1379 -0
- package/dist/components/tabs/index.tsx +186 -0
- package/dist/components/tabs/meta.ts +25 -0
- package/dist/components/tag/Tag.stories.tsx +625 -0
- package/dist/components/tag/index.tsx +320 -0
- package/dist/components/tag/meta.ts +52 -0
- package/dist/components/textarea/TextArea.stories.tsx +723 -0
- package/dist/components/textarea/index.tsx +480 -0
- package/dist/components/textarea/meta.ts +23 -0
- package/dist/components/toast/Toast.stories.tsx +1427 -0
- package/dist/components/toast/index.tsx +26 -0
- package/dist/components/toast/meta.ts +19 -0
- package/dist/components/toggle/Toggle.stories.tsx +1093 -0
- package/dist/components/toggle/index.tsx +44 -0
- package/dist/components/toggle/meta.ts +19 -0
- package/dist/components/tooltip/Tooltip.stories.tsx +1548 -0
- package/dist/components/tooltip/index.tsx +304 -0
- package/dist/components/tooltip/meta.ts +21 -0
- package/dist/components/typography/Typography.stories.tsx +197 -0
- package/dist/components/typography/index.tsx +184 -0
- package/dist/components/typography/meta.ts +38 -0
- package/dist/fonts/LabGrotesque-Regular.ttf +0 -0
- package/dist/fonts/LabGrotesqueTRIAL-Bold.otf +0 -0
- package/dist/fonts/LabGrotesqueTRIAL-Light.otf +0 -0
- package/dist/fonts/LabGrotesqueTRIAL-Medium.otf +0 -0
- package/dist/fonts/LabGrotesqueTRIAL-Regular.otf +0 -0
- package/dist/fonts/PPSupplySans-Regular (1).otf +0 -0
- package/dist/fonts/PPSupplySans-Regular.otf +0 -0
- package/dist/fonts/PPSupplySans-Ultralight.otf +0 -0
- package/dist/hooks/index.ts +3 -0
- package/dist/hooks/use-previous/UsePrevious.stories.tsx +997 -0
- package/dist/hooks/use-previous/index.ts +15 -0
- package/dist/hooks/use-previous/meta.ts +6 -0
- package/dist/hooks/use-standalone-pagination/UseStandalonePagination.stories.tsx +983 -0
- package/dist/hooks/use-standalone-pagination/index.ts +146 -0
- package/dist/hooks/use-standalone-pagination/meta.ts +6 -0
- package/dist/icons/Icons.stories.tsx +29 -0
- package/dist/icons/alert-icon/AlertIcon.stories.tsx +991 -0
- package/dist/icons/alert-icon/index.tsx +48 -0
- package/dist/icons/alert-icon/meta.ts +8 -0
- package/dist/icons/all-icons.tsx +738 -0
- package/dist/icons/angle-down-icon/AngleDownIcon.stories.tsx +1031 -0
- package/dist/icons/angle-down-icon/index.tsx +25 -0
- package/dist/icons/angle-down-icon/meta.ts +8 -0
- package/dist/icons/arrow-box-left-icon/ArrowBoxLeftIcon.stories.tsx +1080 -0
- package/dist/icons/arrow-box-left-icon/index.tsx +24 -0
- package/dist/icons/arrow-box-left-icon/meta.ts +8 -0
- package/dist/icons/arrow-right-icon/ArrowRightIcon.stories.tsx +1151 -0
- package/dist/icons/arrow-right-icon/index.tsx +26 -0
- package/dist/icons/arrow-right-icon/meta.ts +8 -0
- package/dist/icons/arrow-right-up-icon/ArrowRightUpIcon.stories.tsx +1273 -0
- package/dist/icons/arrow-right-up-icon/index.tsx +24 -0
- package/dist/icons/arrow-right-up-icon/meta.ts +8 -0
- package/dist/icons/art-board-icon/ArtBoardIcon.stories.tsx +670 -0
- package/dist/icons/art-board-icon/index.tsx +24 -0
- package/dist/icons/art-board-icon/meta.ts +7 -0
- package/dist/icons/audio-bar-icon/AudioBarIcon.stories.tsx +1244 -0
- package/dist/icons/audio-bar-icon/index.tsx +19 -0
- package/dist/icons/audio-bar-icon/meta.ts +8 -0
- package/dist/icons/bubble-check-icon/BubbleCheckIcon.stories.tsx +1239 -0
- package/dist/icons/bubble-check-icon/index.tsx +24 -0
- package/dist/icons/bubble-check-icon/meta.ts +8 -0
- package/dist/icons/bubble-crossed-icon/BubbleCrossedIcon.stories.tsx +1228 -0
- package/dist/icons/bubble-crossed-icon/index.tsx +24 -0
- package/dist/icons/bubble-crossed-icon/meta.ts +8 -0
- package/dist/icons/bubble-sparkle-icon/BubbleSparkleIcon.stories.tsx +912 -0
- package/dist/icons/bubble-sparkle-icon/index.tsx +26 -0
- package/dist/icons/bubble-sparkle-icon/meta.ts +8 -0
- package/dist/icons/chevron-double-left-icon/ChevronDoubleLeftIcon.stories.tsx +1021 -0
- package/dist/icons/chevron-double-left-icon/index.tsx +34 -0
- package/dist/icons/chevron-double-left-icon/meta.ts +8 -0
- package/dist/icons/chevron-double-right-icon/ChevronDoubleRightIcon.stories.tsx +1021 -0
- package/dist/icons/chevron-double-right-icon/index.tsx +34 -0
- package/dist/icons/chevron-double-right-icon/meta.ts +8 -0
- package/dist/icons/chevron-down-icon/ChevronDownIcon.stories.tsx +1001 -0
- package/dist/icons/chevron-down-icon/index.tsx +27 -0
- package/dist/icons/chevron-down-icon/meta.ts +8 -0
- package/dist/icons/chevron-left-icon/ChevronLeftIcon.stories.tsx +1029 -0
- package/dist/icons/chevron-left-icon/index.tsx +27 -0
- package/dist/icons/chevron-left-icon/meta.ts +8 -0
- package/dist/icons/chevron-right-icon/ChevronRightIcon.stories.tsx +1021 -0
- package/dist/icons/chevron-right-icon/index.tsx +27 -0
- package/dist/icons/chevron-right-icon/meta.ts +8 -0
- package/dist/icons/chevron-up-icon/ChevronUpIcon.stories.tsx +1036 -0
- package/dist/icons/chevron-up-icon/index.tsx +27 -0
- package/dist/icons/chevron-up-icon/meta.ts +8 -0
- package/dist/icons/command-icon/CommandIcon.stories.tsx +1098 -0
- package/dist/icons/command-icon/index.tsx +24 -0
- package/dist/icons/command-icon/meta.ts +8 -0
- package/dist/icons/cross-circle-icon/CrossCircleIcon.stories.tsx +1061 -0
- package/dist/icons/cross-circle-icon/index.tsx +23 -0
- package/dist/icons/cross-circle-icon/meta.ts +8 -0
- package/dist/icons/cross-icon/CrossIcon.stories.tsx +1027 -0
- package/dist/icons/cross-icon/index.tsx +24 -0
- package/dist/icons/cross-icon/meta.ts +8 -0
- package/dist/icons/edit-big-icon/EditBigIcon.stories.tsx +1092 -0
- package/dist/icons/edit-big-icon/index.tsx +22 -0
- package/dist/icons/edit-big-icon/meta.ts +8 -0
- package/dist/icons/eye-close-icon/EyeCloseIcon.stories.tsx +1090 -0
- package/dist/icons/eye-close-icon/index.tsx +26 -0
- package/dist/icons/eye-close-icon/meta.ts +8 -0
- package/dist/icons/eye-open-icon/EyeOpenIcon.stories.tsx +1098 -0
- package/dist/icons/eye-open-icon/index.tsx +24 -0
- package/dist/icons/eye-open-icon/meta.ts +8 -0
- package/dist/icons/feature-shine-icon/FeatureShineIcon.stories.tsx +1071 -0
- package/dist/icons/feature-shine-icon/index.tsx +29 -0
- package/dist/icons/feature-shine-icon/meta.ts +8 -0
- package/dist/icons/file-chart-icon/FileChartIcon.stories.tsx +1115 -0
- package/dist/icons/file-chart-icon/index.tsx +24 -0
- package/dist/icons/file-chart-icon/meta.ts +8 -0
- package/dist/icons/file-text-icon/FileTextIcon.stories.tsx +668 -0
- package/dist/icons/file-text-icon/index.tsx +24 -0
- package/dist/icons/file-text-icon/meta.ts +8 -0
- package/dist/icons/grip-vertical-icon/GripVerticalIcon.stories.tsx +1239 -0
- package/dist/icons/grip-vertical-icon/index.tsx +28 -0
- package/dist/icons/grip-vertical-icon/meta.ts +8 -0
- package/dist/icons/image-icon/ImageIcon.stories.tsx +1181 -0
- package/dist/icons/image-icon/index.tsx +24 -0
- package/dist/icons/image-icon/meta.ts +8 -0
- package/dist/icons/import-folder-icon/ImportFolderIcon.stories.tsx +1248 -0
- package/dist/icons/import-folder-icon/index.tsx +22 -0
- package/dist/icons/import-folder-icon/meta.ts +8 -0
- package/dist/icons/index.ts +46 -0
- package/dist/icons/light-bulb-simple-icon/LightBulbSimpleIcon.stories.tsx +1272 -0
- package/dist/icons/light-bulb-simple-icon/index.tsx +24 -0
- package/dist/icons/light-bulb-simple-icon/meta.ts +8 -0
- package/dist/icons/magic-book-icon/MagicBookIcon.stories.tsx +1245 -0
- package/dist/icons/magic-book-icon/index.tsx +32 -0
- package/dist/icons/magic-book-icon/meta.ts +8 -0
- package/dist/icons/maintenance-icon/MaintenanceIcon.stories.tsx +1251 -0
- package/dist/icons/maintenance-icon/index.tsx +23 -0
- package/dist/icons/maintenance-icon/meta.ts +8 -0
- package/dist/icons/message-icon/MessageIcon.stories.tsx +595 -0
- package/dist/icons/message-icon/index.tsx +30 -0
- package/dist/icons/message-icon/meta.ts +8 -0
- package/dist/icons/move-horizontal-icon/MoveHorizontalIcon.stories.tsx +1245 -0
- package/dist/icons/move-horizontal-icon/index.tsx +23 -0
- package/dist/icons/move-horizontal-icon/meta.ts +8 -0
- package/dist/icons/move-vertical-icon/MoveVerticalIcon.stories.tsx +1196 -0
- package/dist/icons/move-vertical-icon/index.tsx +23 -0
- package/dist/icons/move-vertical-icon/meta.ts +8 -0
- package/dist/icons/page-search-icon/PageSearchIcon.stories.tsx +1167 -0
- package/dist/icons/page-search-icon/index.tsx +21 -0
- package/dist/icons/page-search-icon/meta.ts +8 -0
- package/dist/icons/pencil-icon/PencilIcon.stories.tsx +1131 -0
- package/dist/icons/pencil-icon/index.tsx +21 -0
- package/dist/icons/pencil-icon/meta.ts +8 -0
- package/dist/icons/plus-icon/PlusIcon.stories.tsx +1151 -0
- package/dist/icons/plus-icon/index.tsx +24 -0
- package/dist/icons/plus-icon/meta.ts +8 -0
- package/dist/icons/search-icon/SearchIcon.stories.tsx +1181 -0
- package/dist/icons/search-icon/index.tsx +24 -0
- package/dist/icons/search-icon/meta.ts +8 -0
- package/dist/icons/site-logo-icon/SiteLogoIcon.stories.tsx +1167 -0
- package/dist/icons/site-logo-icon/index.tsx +79 -0
- package/dist/icons/site-logo-icon/meta.ts +8 -0
- package/dist/icons/spinner-gradient-icon/SpinnerGradientIcon.stories.tsx +637 -0
- package/dist/icons/spinner-gradient-icon/index.tsx +53 -0
- package/dist/icons/spinner-gradient-icon/meta.ts +8 -0
- package/dist/icons/spinner-solid-icon/SpinnerSolidIcon.stories.tsx +644 -0
- package/dist/icons/spinner-solid-icon/index.tsx +59 -0
- package/dist/icons/spinner-solid-icon/meta.ts +8 -0
- package/dist/icons/spinner-solid-neutral-icon/SpinnerSolidINeutralcon.stories.tsx +736 -0
- package/dist/icons/spinner-solid-neutral-icon/index.tsx +53 -0
- package/dist/icons/spinner-solid-neutral-icon/meta.ts +8 -0
- package/dist/icons/tick-circle-icon/TickCircleIcon.stories.tsx +1204 -0
- package/dist/icons/tick-circle-icon/index.tsx +23 -0
- package/dist/icons/tick-circle-icon/meta.ts +8 -0
- package/dist/icons/tick-icon/TickIcon.stories.tsx +1340 -0
- package/dist/icons/tick-icon/index.tsx +24 -0
- package/dist/icons/tick-icon/meta.ts +8 -0
- package/dist/icons/trash-icon/TrashIcon.stories.tsx +996 -0
- package/dist/icons/trash-icon/index.tsx +24 -0
- package/dist/icons/trash-icon/meta.ts +8 -0
- package/dist/icons/upload-icon/UploadIcon.stories.tsx +947 -0
- package/dist/icons/upload-icon/index.tsx +24 -0
- package/dist/icons/upload-icon/meta.ts +8 -0
- package/dist/icons/vertical-menu-icon/VerticalMenuIcon.stories.tsx +1045 -0
- package/dist/icons/vertical-menu-icon/index.tsx +27 -0
- package/dist/icons/vertical-menu-icon/meta.ts +8 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +206 -0
- package/dist/lib/utils.ts +6 -0
- package/dist/styles/aural-theme.css +1008 -0
- package/package.json +142 -0
|
@@ -0,0 +1,741 @@
|
|
|
1
|
+
import React, { useState } from "react"
|
|
2
|
+
import { Button } from "@components/button"
|
|
3
|
+
import type { Meta, StoryObj } from "@storybook/react"
|
|
4
|
+
|
|
5
|
+
import CircularLoader from "."
|
|
6
|
+
|
|
7
|
+
const meta: Meta<typeof CircularLoader> = {
|
|
8
|
+
title: "Components/UI/CircularLoader",
|
|
9
|
+
component: CircularLoader,
|
|
10
|
+
parameters: {
|
|
11
|
+
layout: "centered",
|
|
12
|
+
backgrounds: {
|
|
13
|
+
default: "dark",
|
|
14
|
+
values: [
|
|
15
|
+
{ name: "dark", value: "#0a0a0a" },
|
|
16
|
+
{ name: "darker", value: "#000000" },
|
|
17
|
+
{ name: "light", value: "#ffffff" },
|
|
18
|
+
],
|
|
19
|
+
},
|
|
20
|
+
docs: {
|
|
21
|
+
description: {
|
|
22
|
+
component: `
|
|
23
|
+
# CircularLoader Component
|
|
24
|
+
|
|
25
|
+
An accessible circular loading spinner component with multiple variants, customizable sizing, and comprehensive screen reader support. Built with proper ARIA attributes and semantic HTML.
|
|
26
|
+
|
|
27
|
+
## Features
|
|
28
|
+
|
|
29
|
+
- **Multiple Variants**: Three distinct spinner designs (gradient, solid, neutral)
|
|
30
|
+
- **Size Options**: Four predefined sizes (sm, md, lg, xl) for different contexts
|
|
31
|
+
- **Accessibility First**: Full ARIA support with screen reader compatibility
|
|
32
|
+
- **Customizable Text**: Optional visual text with separate screen reader messages
|
|
33
|
+
- **Live Regions**: Configurable aria-live announcements for dynamic updates
|
|
34
|
+
- **Flexible Styling**: Custom classes for root, loader, and text elements
|
|
35
|
+
- **Semantic HTML**: Proper role and status indicators
|
|
36
|
+
|
|
37
|
+
## Accessibility Features
|
|
38
|
+
|
|
39
|
+
- **ARIA Labels**: Automatic labeling for screen readers
|
|
40
|
+
- **Live Regions**: Announces loading state changes
|
|
41
|
+
- **Screen Reader Text**: Hidden text for assistive technologies
|
|
42
|
+
- **Keyboard Safe**: Non-focusable decorative elements
|
|
43
|
+
- **Status Role**: Proper semantic meaning for loading states
|
|
44
|
+
|
|
45
|
+
## Usage Examples
|
|
46
|
+
|
|
47
|
+
### Basic Loading
|
|
48
|
+
\`\`\`tsx
|
|
49
|
+
import CircularLoader from '@/components/circular-loader'
|
|
50
|
+
|
|
51
|
+
// Simple loading with visual text
|
|
52
|
+
<CircularLoader text="Loading..." />
|
|
53
|
+
|
|
54
|
+
// Screen reader only (no visual text)
|
|
55
|
+
<CircularLoader aria-label="Loading user data" />
|
|
56
|
+
\`\`\`
|
|
57
|
+
|
|
58
|
+
### Different Variants
|
|
59
|
+
\`\`\`tsx
|
|
60
|
+
// Gradient spinner (default)
|
|
61
|
+
<CircularLoader variant="v1" text="Loading..." />
|
|
62
|
+
|
|
63
|
+
// Solid spinner
|
|
64
|
+
<CircularLoader variant="v2" text="Processing..." />
|
|
65
|
+
|
|
66
|
+
// Neutral spinner
|
|
67
|
+
<CircularLoader variant="v3" text="Please wait..." />
|
|
68
|
+
\`\`\`
|
|
69
|
+
|
|
70
|
+
### Size Variations
|
|
71
|
+
\`\`\`tsx
|
|
72
|
+
// Small loader for buttons
|
|
73
|
+
<CircularLoader size="sm" text="Save" />
|
|
74
|
+
|
|
75
|
+
// Large loader for page loading
|
|
76
|
+
<CircularLoader size="xl" text="Loading application..." />
|
|
77
|
+
\`\`\`
|
|
78
|
+
|
|
79
|
+
### Advanced Accessibility
|
|
80
|
+
\`\`\`tsx
|
|
81
|
+
// Custom loading message for screen readers
|
|
82
|
+
<CircularLoader
|
|
83
|
+
text="Submitting form..."
|
|
84
|
+
loadingMessage="Your form is being processed, please wait"
|
|
85
|
+
aria-live="assertive"
|
|
86
|
+
/>
|
|
87
|
+
|
|
88
|
+
// Programmatic control
|
|
89
|
+
<CircularLoader
|
|
90
|
+
id="form-loader"
|
|
91
|
+
aria-label="Saving changes"
|
|
92
|
+
aria-live="polite"
|
|
93
|
+
/>
|
|
94
|
+
\`\`\`
|
|
95
|
+
|
|
96
|
+
### Custom Styling
|
|
97
|
+
\`\`\`tsx
|
|
98
|
+
<CircularLoader
|
|
99
|
+
variant="v2"
|
|
100
|
+
size="lg"
|
|
101
|
+
text="Loading..."
|
|
102
|
+
classes={{
|
|
103
|
+
root: "my-8",
|
|
104
|
+
loader: "text-blue-500",
|
|
105
|
+
text: "text-gray-600 font-medium"
|
|
106
|
+
}}
|
|
107
|
+
/>
|
|
108
|
+
\`\`\`
|
|
109
|
+
`,
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
argTypes: {
|
|
114
|
+
variant: {
|
|
115
|
+
control: { type: "select" },
|
|
116
|
+
options: ["v1", "v2", "v3"],
|
|
117
|
+
description: "Visual variant of the spinner",
|
|
118
|
+
},
|
|
119
|
+
size: {
|
|
120
|
+
control: { type: "select" },
|
|
121
|
+
options: ["sm", "md", "lg", "xl"],
|
|
122
|
+
description: "Size of the spinner",
|
|
123
|
+
},
|
|
124
|
+
text: {
|
|
125
|
+
control: "text",
|
|
126
|
+
description: "Visible text displayed below the spinner",
|
|
127
|
+
},
|
|
128
|
+
"aria-label": {
|
|
129
|
+
control: "text",
|
|
130
|
+
description:
|
|
131
|
+
"Accessible label for screen readers when no text is provided",
|
|
132
|
+
},
|
|
133
|
+
"aria-live": {
|
|
134
|
+
control: { type: "select" },
|
|
135
|
+
options: ["polite", "assertive", "off"],
|
|
136
|
+
description: "How screen readers announce loading state changes",
|
|
137
|
+
},
|
|
138
|
+
loadingMessage: {
|
|
139
|
+
control: "text",
|
|
140
|
+
description: "Custom loading message for screen readers",
|
|
141
|
+
},
|
|
142
|
+
className: {
|
|
143
|
+
control: "text",
|
|
144
|
+
description: "Additional CSS classes for the spinner icon",
|
|
145
|
+
},
|
|
146
|
+
classes: {
|
|
147
|
+
control: "object",
|
|
148
|
+
description: "Custom classes for different parts of the component",
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
tags: ["autodocs"],
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export default meta
|
|
155
|
+
type Story = StoryObj<typeof CircularLoader>
|
|
156
|
+
|
|
157
|
+
// Story parameters for consistent dark theme
|
|
158
|
+
const storyParameters = {
|
|
159
|
+
backgrounds: {
|
|
160
|
+
default: "dark",
|
|
161
|
+
values: [
|
|
162
|
+
{ name: "dark", value: "#0a0a0a" },
|
|
163
|
+
{ name: "darker", value: "#000000" },
|
|
164
|
+
],
|
|
165
|
+
},
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// 1. Basic Examples
|
|
169
|
+
export const Default: Story = {
|
|
170
|
+
args: {
|
|
171
|
+
text: "Loading...",
|
|
172
|
+
variant: "v1",
|
|
173
|
+
size: "md",
|
|
174
|
+
},
|
|
175
|
+
parameters: storyParameters,
|
|
176
|
+
render: (args) => (
|
|
177
|
+
<div className="flex h-32 items-center justify-center rounded-lg bg-gradient-to-br from-gray-900 to-gray-800 p-8 text-white">
|
|
178
|
+
<CircularLoader {...args} />
|
|
179
|
+
</div>
|
|
180
|
+
),
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// 2. Variant Showcase
|
|
184
|
+
export const Variants: Story = {
|
|
185
|
+
parameters: {
|
|
186
|
+
...storyParameters,
|
|
187
|
+
docs: {
|
|
188
|
+
description: {
|
|
189
|
+
story:
|
|
190
|
+
"Different visual variants of the CircularLoader component with consistent accessibility features.",
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
render: () => (
|
|
195
|
+
<div className="space-y-8 rounded-lg bg-gradient-to-br from-gray-900 to-gray-800 p-8 text-white">
|
|
196
|
+
<div className="text-center">
|
|
197
|
+
<h3 className="mb-4 text-xl font-bold text-white">Spinner Variants</h3>
|
|
198
|
+
<p className="text-sm text-white/60">
|
|
199
|
+
Three distinct visual styles with full accessibility support
|
|
200
|
+
</p>
|
|
201
|
+
</div>
|
|
202
|
+
|
|
203
|
+
<div className="grid grid-cols-1 gap-8 md:grid-cols-3">
|
|
204
|
+
<div className="text-center">
|
|
205
|
+
<div className="mb-4 flex h-32 items-center justify-center rounded-lg border border-white/10 bg-white/5">
|
|
206
|
+
<CircularLoader variant="v1" text="Gradient" size="lg" />
|
|
207
|
+
</div>
|
|
208
|
+
<div className="space-y-1">
|
|
209
|
+
<div className="font-medium text-white">Variant V1</div>
|
|
210
|
+
<div className="text-xs text-white/60">
|
|
211
|
+
Gradient spinner with smooth transitions
|
|
212
|
+
</div>
|
|
213
|
+
</div>
|
|
214
|
+
</div>
|
|
215
|
+
|
|
216
|
+
<div className="text-center">
|
|
217
|
+
<div className="mb-4 flex h-32 items-center justify-center rounded-lg border border-white/10 bg-white/5">
|
|
218
|
+
<CircularLoader variant="v2" text="Solid" size="lg" />
|
|
219
|
+
</div>
|
|
220
|
+
<div className="space-y-1">
|
|
221
|
+
<div className="font-medium text-white">Variant V2</div>
|
|
222
|
+
<div className="text-xs text-white/60">
|
|
223
|
+
Solid spinner with consistent theming
|
|
224
|
+
</div>
|
|
225
|
+
</div>
|
|
226
|
+
</div>
|
|
227
|
+
|
|
228
|
+
<div className="text-center">
|
|
229
|
+
<div className="mb-4 flex h-32 items-center justify-center rounded-lg border border-white/10 bg-white/5">
|
|
230
|
+
<CircularLoader variant="v3" text="Neutral" size="lg" />
|
|
231
|
+
</div>
|
|
232
|
+
<div className="space-y-1">
|
|
233
|
+
<div className="font-medium text-white">Variant V3</div>
|
|
234
|
+
<div className="text-xs text-white/60">
|
|
235
|
+
Neutral spinner for any theme
|
|
236
|
+
</div>
|
|
237
|
+
</div>
|
|
238
|
+
</div>
|
|
239
|
+
</div>
|
|
240
|
+
</div>
|
|
241
|
+
),
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
// 3. Size Variations
|
|
245
|
+
export const Sizes: Story = {
|
|
246
|
+
parameters: {
|
|
247
|
+
...storyParameters,
|
|
248
|
+
docs: {
|
|
249
|
+
description: {
|
|
250
|
+
story:
|
|
251
|
+
"Different sizes of the CircularLoader for various use cases from small inline loaders to large page loaders.",
|
|
252
|
+
},
|
|
253
|
+
},
|
|
254
|
+
},
|
|
255
|
+
render: () => (
|
|
256
|
+
<div className="space-y-8 rounded-lg bg-gradient-to-br from-gray-900 to-gray-800 p-8 text-white">
|
|
257
|
+
<div className="text-center">
|
|
258
|
+
<h3 className="mb-4 text-xl font-bold text-white">Size Variations</h3>
|
|
259
|
+
<p className="text-sm text-white/60">
|
|
260
|
+
Four predefined sizes for different contexts and use cases
|
|
261
|
+
</p>
|
|
262
|
+
</div>
|
|
263
|
+
|
|
264
|
+
<div className="grid grid-cols-2 gap-6 md:grid-cols-4">
|
|
265
|
+
<div className="text-center">
|
|
266
|
+
<div className="mb-4 flex h-24 items-center justify-center rounded-lg border border-white/10 bg-white/5">
|
|
267
|
+
<CircularLoader size="sm" text="Small" />
|
|
268
|
+
</div>
|
|
269
|
+
<div className="space-y-1">
|
|
270
|
+
<div className="font-medium text-white">Small</div>
|
|
271
|
+
<div className="text-xs text-white/60">
|
|
272
|
+
16×16px - Inline elements
|
|
273
|
+
</div>
|
|
274
|
+
</div>
|
|
275
|
+
</div>
|
|
276
|
+
|
|
277
|
+
<div className="text-center">
|
|
278
|
+
<div className="mb-4 flex h-24 items-center justify-center rounded-lg border border-white/10 bg-white/5">
|
|
279
|
+
<CircularLoader size="md" text="Medium" />
|
|
280
|
+
</div>
|
|
281
|
+
<div className="space-y-1">
|
|
282
|
+
<div className="font-medium text-white">Medium</div>
|
|
283
|
+
<div className="text-xs text-white/60">24×24px - Default size</div>
|
|
284
|
+
</div>
|
|
285
|
+
</div>
|
|
286
|
+
|
|
287
|
+
<div className="text-center">
|
|
288
|
+
<div className="mb-4 flex h-24 items-center justify-center rounded-lg border border-white/10 bg-white/5">
|
|
289
|
+
<CircularLoader size="lg" text="Large" />
|
|
290
|
+
</div>
|
|
291
|
+
<div className="space-y-1">
|
|
292
|
+
<div className="font-medium text-white">Large</div>
|
|
293
|
+
<div className="text-xs text-white/60">
|
|
294
|
+
32×32px - Prominent loading
|
|
295
|
+
</div>
|
|
296
|
+
</div>
|
|
297
|
+
</div>
|
|
298
|
+
|
|
299
|
+
<div className="text-center">
|
|
300
|
+
<div className="mb-4 flex h-24 items-center justify-center rounded-lg border border-white/10 bg-white/5">
|
|
301
|
+
<CircularLoader size="xl" text="Extra Large" />
|
|
302
|
+
</div>
|
|
303
|
+
<div className="space-y-1">
|
|
304
|
+
<div className="font-medium text-white">Extra Large</div>
|
|
305
|
+
<div className="text-xs text-white/60">48×48px - Page loading</div>
|
|
306
|
+
</div>
|
|
307
|
+
</div>
|
|
308
|
+
</div>
|
|
309
|
+
</div>
|
|
310
|
+
),
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
// 4. Accessibility Features
|
|
314
|
+
export const AccessibilityFeatures: Story = {
|
|
315
|
+
parameters: {
|
|
316
|
+
...storyParameters,
|
|
317
|
+
docs: {
|
|
318
|
+
description: {
|
|
319
|
+
story:
|
|
320
|
+
"Comprehensive accessibility features including ARIA labels, live regions, and screen reader support.",
|
|
321
|
+
},
|
|
322
|
+
},
|
|
323
|
+
},
|
|
324
|
+
render: () => (
|
|
325
|
+
<div className="space-y-8 rounded-lg bg-gradient-to-br from-gray-900 to-gray-800 p-8 text-white">
|
|
326
|
+
<div className="text-center">
|
|
327
|
+
<h3 className="mb-4 text-xl font-bold text-white">
|
|
328
|
+
Accessibility Features
|
|
329
|
+
</h3>
|
|
330
|
+
<p className="text-sm text-white/60">
|
|
331
|
+
Built with comprehensive screen reader support and ARIA attributes
|
|
332
|
+
</p>
|
|
333
|
+
</div>
|
|
334
|
+
|
|
335
|
+
<div className="grid grid-cols-1 gap-6 md:grid-cols-2">
|
|
336
|
+
<div className="space-y-6">
|
|
337
|
+
<div className="rounded-lg border border-white/10 bg-white/5 p-6">
|
|
338
|
+
<h4 className="mb-4 text-lg font-semibold text-white">
|
|
339
|
+
Visual + Screen Reader
|
|
340
|
+
</h4>
|
|
341
|
+
<div className="mb-4 flex items-center justify-center">
|
|
342
|
+
<CircularLoader text="Loading data..." size="lg" />
|
|
343
|
+
</div>
|
|
344
|
+
<div className="text-sm text-white/70">
|
|
345
|
+
Shows visible text and provides the same message to screen readers
|
|
346
|
+
</div>
|
|
347
|
+
</div>
|
|
348
|
+
|
|
349
|
+
<div className="rounded-lg border border-white/10 bg-white/5 p-6">
|
|
350
|
+
<h4 className="mb-4 text-lg font-semibold text-white">
|
|
351
|
+
Screen Reader Only
|
|
352
|
+
</h4>
|
|
353
|
+
<div className="mb-4 flex items-center justify-center">
|
|
354
|
+
<CircularLoader
|
|
355
|
+
aria-label="Processing user authentication"
|
|
356
|
+
size="lg"
|
|
357
|
+
/>
|
|
358
|
+
</div>
|
|
359
|
+
<div className="text-sm text-white/70">
|
|
360
|
+
No visible text but provides descriptive label for screen readers
|
|
361
|
+
</div>
|
|
362
|
+
</div>
|
|
363
|
+
</div>
|
|
364
|
+
|
|
365
|
+
<div className="space-y-6">
|
|
366
|
+
<div className="rounded-lg border border-white/10 bg-white/5 p-6">
|
|
367
|
+
<h4 className="mb-4 text-lg font-semibold text-white">
|
|
368
|
+
Custom Loading Message
|
|
369
|
+
</h4>
|
|
370
|
+
<div className="mb-4 flex items-center justify-center">
|
|
371
|
+
<CircularLoader
|
|
372
|
+
text="Saving..."
|
|
373
|
+
loadingMessage="Your changes are being saved to the server"
|
|
374
|
+
size="lg"
|
|
375
|
+
/>
|
|
376
|
+
</div>
|
|
377
|
+
<div className="text-sm text-white/70">
|
|
378
|
+
Visual text differs from detailed screen reader message
|
|
379
|
+
</div>
|
|
380
|
+
</div>
|
|
381
|
+
|
|
382
|
+
<div className="rounded-lg border border-white/10 bg-white/5 p-6">
|
|
383
|
+
<h4 className="mb-4 text-lg font-semibold text-white">
|
|
384
|
+
Assertive Announcements
|
|
385
|
+
</h4>
|
|
386
|
+
<div className="mb-4 flex items-center justify-center">
|
|
387
|
+
<CircularLoader
|
|
388
|
+
text="Critical process..."
|
|
389
|
+
aria-live="assertive"
|
|
390
|
+
size="lg"
|
|
391
|
+
/>
|
|
392
|
+
</div>
|
|
393
|
+
<div className="text-sm text-white/70">
|
|
394
|
+
Immediately announces changes to screen readers
|
|
395
|
+
</div>
|
|
396
|
+
</div>
|
|
397
|
+
</div>
|
|
398
|
+
</div>
|
|
399
|
+
|
|
400
|
+
<div className="rounded-lg border border-blue-500/20 bg-blue-500/10 p-6">
|
|
401
|
+
<h4 className="mb-4 text-lg font-semibold text-blue-200">
|
|
402
|
+
Accessibility Best Practices
|
|
403
|
+
</h4>
|
|
404
|
+
<div className="grid grid-cols-1 gap-4 md:grid-cols-2">
|
|
405
|
+
<div>
|
|
406
|
+
<h5 className="mb-2 font-medium text-blue-200">
|
|
407
|
+
Built-in Features
|
|
408
|
+
</h5>
|
|
409
|
+
<ul className="space-y-1 text-sm text-blue-200/80">
|
|
410
|
+
<li>• Role="status" for loading states</li>
|
|
411
|
+
<li>• ARIA-live regions for dynamic updates</li>
|
|
412
|
+
<li>• ARIA-hidden on decorative elements</li>
|
|
413
|
+
<li>• Screen reader optimized text</li>
|
|
414
|
+
<li>• Keyboard navigation safe</li>
|
|
415
|
+
</ul>
|
|
416
|
+
</div>
|
|
417
|
+
<div>
|
|
418
|
+
<h5 className="mb-2 font-medium text-blue-200">Usage Guidelines</h5>
|
|
419
|
+
<ul className="space-y-1 text-sm text-blue-200/80">
|
|
420
|
+
<li>• Always provide context about what's loading</li>
|
|
421
|
+
<li>• Use "polite" for non-critical updates</li>
|
|
422
|
+
<li>• Use "assertive" for important changes</li>
|
|
423
|
+
<li>• Test with screen readers</li>
|
|
424
|
+
<li>• Consider reduced motion preferences</li>
|
|
425
|
+
</ul>
|
|
426
|
+
</div>
|
|
427
|
+
</div>
|
|
428
|
+
</div>
|
|
429
|
+
</div>
|
|
430
|
+
),
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
// 5. Real-world Usage Examples
|
|
434
|
+
export const UsageExamples: Story = {
|
|
435
|
+
parameters: {
|
|
436
|
+
...storyParameters,
|
|
437
|
+
docs: {
|
|
438
|
+
description: {
|
|
439
|
+
story:
|
|
440
|
+
"Real-world usage examples showing CircularLoader in different UI contexts and scenarios.",
|
|
441
|
+
},
|
|
442
|
+
},
|
|
443
|
+
},
|
|
444
|
+
render: () => {
|
|
445
|
+
const [buttonLoading, setButtonLoading] = useState(false)
|
|
446
|
+
const [cardLoading, setCardLoading] = useState(false)
|
|
447
|
+
const [pageLoading, setPageLoading] = useState(false)
|
|
448
|
+
|
|
449
|
+
const handleButtonClick = () => {
|
|
450
|
+
setButtonLoading(true)
|
|
451
|
+
setTimeout(() => setButtonLoading(false), 3000)
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
const handleCardRefresh = () => {
|
|
455
|
+
setCardLoading(true)
|
|
456
|
+
setTimeout(() => setCardLoading(false), 2000)
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
const handlePageRefresh = () => {
|
|
460
|
+
setPageLoading(true)
|
|
461
|
+
setTimeout(() => setPageLoading(false), 4000)
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
return (
|
|
465
|
+
<div className="space-y-8 rounded-lg bg-gradient-to-br from-gray-900 to-gray-800 p-8 text-white">
|
|
466
|
+
<div className="text-center">
|
|
467
|
+
<h3 className="mb-4 text-xl font-bold text-white">
|
|
468
|
+
Real-world Usage
|
|
469
|
+
</h3>
|
|
470
|
+
<p className="text-sm text-white/60">
|
|
471
|
+
Common UI patterns and contexts where CircularLoader is used
|
|
472
|
+
</p>
|
|
473
|
+
</div>
|
|
474
|
+
|
|
475
|
+
<div className="grid grid-cols-1 gap-8 lg:grid-cols-3">
|
|
476
|
+
{/* Button Loading */}
|
|
477
|
+
<div className="space-y-4">
|
|
478
|
+
<h4 className="text-lg font-semibold text-white">Button Loading</h4>
|
|
479
|
+
<div className="space-y-3">
|
|
480
|
+
<Button
|
|
481
|
+
onClick={handleButtonClick}
|
|
482
|
+
disabled={buttonLoading}
|
|
483
|
+
className="w-full"
|
|
484
|
+
>
|
|
485
|
+
{buttonLoading ? (
|
|
486
|
+
<div className="flex items-center gap-2">
|
|
487
|
+
<CircularLoader size="sm" aria-label="Saving changes" />
|
|
488
|
+
<span>Saving...</span>
|
|
489
|
+
</div>
|
|
490
|
+
) : (
|
|
491
|
+
"Save Changes"
|
|
492
|
+
)}
|
|
493
|
+
</Button>
|
|
494
|
+
<div className="text-xs text-white/60">
|
|
495
|
+
Inline loader in button with accessible label
|
|
496
|
+
</div>
|
|
497
|
+
</div>
|
|
498
|
+
</div>
|
|
499
|
+
|
|
500
|
+
{/* Card Loading */}
|
|
501
|
+
<div className="space-y-4">
|
|
502
|
+
<h4 className="text-lg font-semibold text-white">Card Loading</h4>
|
|
503
|
+
<div className="rounded-lg border border-white/10 bg-white/5 p-4">
|
|
504
|
+
{cardLoading ? (
|
|
505
|
+
<div className="flex h-32 items-center justify-center">
|
|
506
|
+
<CircularLoader
|
|
507
|
+
text="Refreshing data..."
|
|
508
|
+
loadingMessage="Refreshing chart data from server"
|
|
509
|
+
size="lg"
|
|
510
|
+
/>
|
|
511
|
+
</div>
|
|
512
|
+
) : (
|
|
513
|
+
<div className="space-y-3">
|
|
514
|
+
<div className="h-4 rounded bg-white/10"></div>
|
|
515
|
+
<div className="h-4 rounded bg-white/10"></div>
|
|
516
|
+
<div className="h-4 w-3/4 rounded bg-white/10"></div>
|
|
517
|
+
<Button
|
|
518
|
+
onClick={handleCardRefresh}
|
|
519
|
+
size="sm"
|
|
520
|
+
className="mt-2"
|
|
521
|
+
>
|
|
522
|
+
Refresh Data
|
|
523
|
+
</Button>
|
|
524
|
+
</div>
|
|
525
|
+
)}
|
|
526
|
+
</div>
|
|
527
|
+
<div className="text-xs text-white/60">
|
|
528
|
+
Content area with detailed loading message
|
|
529
|
+
</div>
|
|
530
|
+
</div>
|
|
531
|
+
|
|
532
|
+
{/* Page Loading */}
|
|
533
|
+
<div className="space-y-4">
|
|
534
|
+
<h4 className="text-lg font-semibold text-white">Page Loading</h4>
|
|
535
|
+
<div className="rounded-lg border border-white/10 bg-white/5 p-4">
|
|
536
|
+
{pageLoading ? (
|
|
537
|
+
<div className="flex h-32 items-center justify-center">
|
|
538
|
+
<CircularLoader
|
|
539
|
+
text="Loading application..."
|
|
540
|
+
aria-live="assertive"
|
|
541
|
+
size="xl"
|
|
542
|
+
variant="v2"
|
|
543
|
+
/>
|
|
544
|
+
</div>
|
|
545
|
+
) : (
|
|
546
|
+
<div className="space-y-3">
|
|
547
|
+
<div className="text-center">
|
|
548
|
+
<div className="mb-2 text-sm font-medium text-white">
|
|
549
|
+
Application Ready
|
|
550
|
+
</div>
|
|
551
|
+
<Button
|
|
552
|
+
onClick={handlePageRefresh}
|
|
553
|
+
variant="outline"
|
|
554
|
+
size="sm"
|
|
555
|
+
>
|
|
556
|
+
Simulate Loading
|
|
557
|
+
</Button>
|
|
558
|
+
</div>
|
|
559
|
+
</div>
|
|
560
|
+
)}
|
|
561
|
+
</div>
|
|
562
|
+
<div className="text-xs text-white/60">
|
|
563
|
+
Full page loading with assertive announcements
|
|
564
|
+
</div>
|
|
565
|
+
</div>
|
|
566
|
+
</div>
|
|
567
|
+
|
|
568
|
+
{/* Form Submission Example */}
|
|
569
|
+
<div className="rounded-lg border border-white/10 bg-white/5 p-6">
|
|
570
|
+
<h4 className="mb-4 text-lg font-semibold text-white">
|
|
571
|
+
Form Submission
|
|
572
|
+
</h4>
|
|
573
|
+
<div className="space-y-4">
|
|
574
|
+
<div className="grid grid-cols-1 gap-4 md:grid-cols-2">
|
|
575
|
+
<input
|
|
576
|
+
type="text"
|
|
577
|
+
placeholder="Name"
|
|
578
|
+
className="rounded-lg border border-white/20 bg-white/10 p-3 text-white placeholder-white/50"
|
|
579
|
+
/>
|
|
580
|
+
<input
|
|
581
|
+
type="email"
|
|
582
|
+
placeholder="Email"
|
|
583
|
+
className="rounded-lg border border-white/20 bg-white/10 p-3 text-white placeholder-white/50"
|
|
584
|
+
/>
|
|
585
|
+
</div>
|
|
586
|
+
<textarea
|
|
587
|
+
placeholder="Message"
|
|
588
|
+
rows={3}
|
|
589
|
+
className="w-full rounded-lg border border-white/20 bg-white/10 p-3 text-white placeholder-white/50"
|
|
590
|
+
/>
|
|
591
|
+
<div className="flex items-center justify-between">
|
|
592
|
+
<div className="flex items-center gap-2">
|
|
593
|
+
<CircularLoader size="sm" aria-label="Submitting form" />
|
|
594
|
+
<span className="text-sm text-white/70">
|
|
595
|
+
Submitting your message...
|
|
596
|
+
</span>
|
|
597
|
+
</div>
|
|
598
|
+
<Button disabled>Submit</Button>
|
|
599
|
+
</div>
|
|
600
|
+
</div>
|
|
601
|
+
</div>
|
|
602
|
+
</div>
|
|
603
|
+
)
|
|
604
|
+
},
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
// 6. Interactive Playground
|
|
608
|
+
export const Playground: Story = {
|
|
609
|
+
parameters: {
|
|
610
|
+
...storyParameters,
|
|
611
|
+
docs: {
|
|
612
|
+
description: {
|
|
613
|
+
story:
|
|
614
|
+
"Interactive playground to experiment with all CircularLoader configurations and accessibility features.",
|
|
615
|
+
},
|
|
616
|
+
},
|
|
617
|
+
},
|
|
618
|
+
args: {
|
|
619
|
+
variant: "v1",
|
|
620
|
+
size: "md",
|
|
621
|
+
text: "Loading...",
|
|
622
|
+
"aria-label": "",
|
|
623
|
+
"aria-live": "polite",
|
|
624
|
+
loadingMessage: "",
|
|
625
|
+
className: "",
|
|
626
|
+
classes: {},
|
|
627
|
+
},
|
|
628
|
+
argTypes: {
|
|
629
|
+
variant: {
|
|
630
|
+
control: { type: "select" },
|
|
631
|
+
options: ["v1", "v2", "v3"],
|
|
632
|
+
description: "Visual variant of the spinner",
|
|
633
|
+
},
|
|
634
|
+
size: {
|
|
635
|
+
control: { type: "select" },
|
|
636
|
+
options: ["sm", "md", "lg", "xl"],
|
|
637
|
+
description: "Size of the spinner",
|
|
638
|
+
},
|
|
639
|
+
text: {
|
|
640
|
+
control: "text",
|
|
641
|
+
description: "Visible text displayed below the spinner",
|
|
642
|
+
},
|
|
643
|
+
"aria-label": {
|
|
644
|
+
control: "text",
|
|
645
|
+
description:
|
|
646
|
+
"Accessible label for screen readers when no text is provided",
|
|
647
|
+
},
|
|
648
|
+
"aria-live": {
|
|
649
|
+
control: { type: "select" },
|
|
650
|
+
options: ["polite", "assertive", "off"],
|
|
651
|
+
description: "How screen readers announce loading state changes",
|
|
652
|
+
},
|
|
653
|
+
loadingMessage: {
|
|
654
|
+
control: "text",
|
|
655
|
+
description: "Custom loading message for screen readers",
|
|
656
|
+
},
|
|
657
|
+
className: {
|
|
658
|
+
control: "text",
|
|
659
|
+
description: "Additional CSS classes for the spinner icon",
|
|
660
|
+
},
|
|
661
|
+
classes: {
|
|
662
|
+
control: "object",
|
|
663
|
+
description: "Custom classes for different parts of the component",
|
|
664
|
+
},
|
|
665
|
+
},
|
|
666
|
+
render: (args) => (
|
|
667
|
+
<div className="space-y-8 rounded-lg bg-gradient-to-br from-gray-900 to-gray-800 p-8 text-white">
|
|
668
|
+
<div className="text-center">
|
|
669
|
+
<h3 className="mb-4 text-xl font-bold text-white">
|
|
670
|
+
Interactive Playground
|
|
671
|
+
</h3>
|
|
672
|
+
<p className="text-sm text-white/60">
|
|
673
|
+
Experiment with all CircularLoader configurations and accessibility
|
|
674
|
+
features
|
|
675
|
+
</p>
|
|
676
|
+
</div>
|
|
677
|
+
|
|
678
|
+
<div className="flex items-center justify-center">
|
|
679
|
+
<div className="rounded-lg border border-white/10 bg-white/5 p-8">
|
|
680
|
+
<CircularLoader {...args} />
|
|
681
|
+
</div>
|
|
682
|
+
</div>
|
|
683
|
+
|
|
684
|
+
<div className="rounded-lg border border-white/10 bg-white/5 p-6">
|
|
685
|
+
<h4 className="mb-4 text-lg font-semibold text-white">
|
|
686
|
+
Current Configuration
|
|
687
|
+
</h4>
|
|
688
|
+
<div className="grid grid-cols-2 gap-4 text-sm">
|
|
689
|
+
<div>
|
|
690
|
+
<div className="font-medium text-white">Variant:</div>
|
|
691
|
+
<div className="text-white/70">{args.variant}</div>
|
|
692
|
+
</div>
|
|
693
|
+
<div>
|
|
694
|
+
<div className="font-medium text-white">Size:</div>
|
|
695
|
+
<div className="text-white/70">{args.size}</div>
|
|
696
|
+
</div>
|
|
697
|
+
<div>
|
|
698
|
+
<div className="font-medium text-white">Visual Text:</div>
|
|
699
|
+
<div className="text-white/70">{args.text || "None"}</div>
|
|
700
|
+
</div>
|
|
701
|
+
<div>
|
|
702
|
+
<div className="font-medium text-white">ARIA Label:</div>
|
|
703
|
+
<div className="text-white/70">{args["aria-label"] || "None"}</div>
|
|
704
|
+
</div>
|
|
705
|
+
<div>
|
|
706
|
+
<div className="font-medium text-white">ARIA Live:</div>
|
|
707
|
+
<div className="text-white/70">{args["aria-live"]}</div>
|
|
708
|
+
</div>
|
|
709
|
+
<div>
|
|
710
|
+
<div className="font-medium text-white">Loading Message:</div>
|
|
711
|
+
<div className="text-white/70">{args.loadingMessage || "None"}</div>
|
|
712
|
+
</div>
|
|
713
|
+
</div>
|
|
714
|
+
</div>
|
|
715
|
+
|
|
716
|
+
<div className="rounded-lg border border-green-500/20 bg-green-500/10 p-6">
|
|
717
|
+
<h4 className="mb-4 text-lg font-semibold text-green-200">
|
|
718
|
+
Accessibility Info
|
|
719
|
+
</h4>
|
|
720
|
+
<div className="space-y-2 text-sm text-green-200/80">
|
|
721
|
+
<div>
|
|
722
|
+
<strong>Screen Reader Message:</strong>{" "}
|
|
723
|
+
{args.text ||
|
|
724
|
+
args.loadingMessage ||
|
|
725
|
+
args["aria-label"] ||
|
|
726
|
+
"Loading"}
|
|
727
|
+
</div>
|
|
728
|
+
<div>
|
|
729
|
+
<strong>Announcement Type:</strong> {args["aria-live"]}
|
|
730
|
+
</div>
|
|
731
|
+
<div>
|
|
732
|
+
<strong>Role:</strong> status
|
|
733
|
+
</div>
|
|
734
|
+
<div>
|
|
735
|
+
<strong>Focusable:</strong> No (decorative spinner)
|
|
736
|
+
</div>
|
|
737
|
+
</div>
|
|
738
|
+
</div>
|
|
739
|
+
</div>
|
|
740
|
+
),
|
|
741
|
+
}
|