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,1104 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react"
|
|
3
|
+
|
|
4
|
+
import { ScrollArea, ScrollBar } from "."
|
|
5
|
+
|
|
6
|
+
const meta: Meta<typeof ScrollArea> = {
|
|
7
|
+
title: "Components/UI/ScrollArea",
|
|
8
|
+
component: ScrollArea,
|
|
9
|
+
parameters: {
|
|
10
|
+
layout: "centered",
|
|
11
|
+
backgrounds: {
|
|
12
|
+
default: "dark",
|
|
13
|
+
values: [
|
|
14
|
+
{ name: "dark", value: "#0a0a0a" },
|
|
15
|
+
{ name: "light", value: "#ffffff" },
|
|
16
|
+
],
|
|
17
|
+
},
|
|
18
|
+
docs: {
|
|
19
|
+
description: {
|
|
20
|
+
component: `
|
|
21
|
+
# ScrollArea Component
|
|
22
|
+
|
|
23
|
+
A custom scrollable area component built on Radix UI primitives with styled scrollbars and smooth scrolling behavior.
|
|
24
|
+
|
|
25
|
+
## Features
|
|
26
|
+
|
|
27
|
+
- **Custom Scrollbars**: Styled scrollbars that match your design system
|
|
28
|
+
- **Smooth Scrolling**: Optimized scrolling performance with native feel
|
|
29
|
+
- **Keyboard Navigation**: Full keyboard support for accessibility
|
|
30
|
+
- **Focus Management**: Proper focus ring and outline handling
|
|
31
|
+
- **Cross-browser**: Consistent appearance across different browsers
|
|
32
|
+
- **Touch Support**: Touch-friendly scrolling on mobile devices
|
|
33
|
+
- **Orientation Support**: Both vertical and horizontal scrolling
|
|
34
|
+
|
|
35
|
+
## Component Structure
|
|
36
|
+
|
|
37
|
+
- **ScrollArea**: Root container that manages the scrollable region
|
|
38
|
+
- **ScrollBar**: Custom scrollbar component with thumb indicator
|
|
39
|
+
- **Viewport**: The actual scrollable content area
|
|
40
|
+
- **Corner**: Corner element for when both scrollbars are present
|
|
41
|
+
|
|
42
|
+
## Usage Examples
|
|
43
|
+
|
|
44
|
+
### Basic Vertical Scroll
|
|
45
|
+
\`\`\`tsx
|
|
46
|
+
<ScrollArea className="h-72 w-48">
|
|
47
|
+
<div className="p-4">
|
|
48
|
+
{/* Long content that needs scrolling */}
|
|
49
|
+
</div>
|
|
50
|
+
</ScrollArea>
|
|
51
|
+
\`\`\`
|
|
52
|
+
|
|
53
|
+
### Horizontal Scroll
|
|
54
|
+
\`\`\`tsx
|
|
55
|
+
<ScrollArea className="w-72 whitespace-nowrap">
|
|
56
|
+
<div className="flex w-max gap-4 p-4">
|
|
57
|
+
{/* Wide content that needs horizontal scrolling */}
|
|
58
|
+
</div>
|
|
59
|
+
<ScrollBar orientation="horizontal" />
|
|
60
|
+
</ScrollArea>
|
|
61
|
+
\`\`\`
|
|
62
|
+
|
|
63
|
+
### Both Directions
|
|
64
|
+
\`\`\`tsx
|
|
65
|
+
<ScrollArea className="h-72 w-72">
|
|
66
|
+
<div className="w-[800px] h-[600px] p-4">
|
|
67
|
+
{/* Content that overflows both directions */}
|
|
68
|
+
</div>
|
|
69
|
+
<ScrollBar orientation="horizontal" />
|
|
70
|
+
</ScrollArea>
|
|
71
|
+
\`\`\`
|
|
72
|
+
`,
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
tags: ["autodocs"],
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export default meta
|
|
80
|
+
type Story = StoryObj<typeof ScrollArea>
|
|
81
|
+
|
|
82
|
+
// 1. Basic Vertical Scroll
|
|
83
|
+
export const BasicVerticalScroll: Story = {
|
|
84
|
+
render: () => (
|
|
85
|
+
<div className="space-y-8">
|
|
86
|
+
<div className="text-center">
|
|
87
|
+
<h3 className="mb-2 font-medium text-white">Basic Vertical Scroll</h3>
|
|
88
|
+
<p className="text-sm text-white/60">
|
|
89
|
+
Standard vertical scrolling with custom styled scrollbar
|
|
90
|
+
</p>
|
|
91
|
+
</div>
|
|
92
|
+
|
|
93
|
+
<div className="flex flex-wrap justify-center gap-8">
|
|
94
|
+
{/* Text Content */}
|
|
95
|
+
<div className="space-y-2">
|
|
96
|
+
<h4 className="text-sm font-medium text-white/80">Text Content</h4>
|
|
97
|
+
<ScrollArea className="h-72 w-80 rounded-lg border border-white/10 bg-white/5">
|
|
98
|
+
<div className="p-4">
|
|
99
|
+
<h4 className="mb-4 text-sm leading-none font-medium text-white">
|
|
100
|
+
The Art of Web Development
|
|
101
|
+
</h4>
|
|
102
|
+
<div className="space-y-4 text-sm text-white/80">
|
|
103
|
+
<p>
|
|
104
|
+
Web development is an ever-evolving field that combines
|
|
105
|
+
creativity with technical expertise. Modern developers must
|
|
106
|
+
master a wide array of technologies, from frontend frameworks
|
|
107
|
+
like React and Vue to backend systems built with Node.js,
|
|
108
|
+
Python, or Go.
|
|
109
|
+
</p>
|
|
110
|
+
<p>
|
|
111
|
+
The importance of user experience cannot be overstated. Every
|
|
112
|
+
line of code we write should be with the end user in mind.
|
|
113
|
+
Performance, accessibility, and intuitive design are not just
|
|
114
|
+
buzzwords—they are fundamental requirements for successful web
|
|
115
|
+
applications.
|
|
116
|
+
</p>
|
|
117
|
+
<p>
|
|
118
|
+
Component-driven development has revolutionized how we build
|
|
119
|
+
user interfaces. By creating reusable, modular components, we
|
|
120
|
+
can maintain consistency across large applications while
|
|
121
|
+
reducing development time and improving code quality.
|
|
122
|
+
</p>
|
|
123
|
+
<p>
|
|
124
|
+
CSS has grown tremendously powerful with features like Grid,
|
|
125
|
+
Flexbox, and custom properties. Combined with modern tools
|
|
126
|
+
like Tailwind CSS, we can create beautiful, responsive designs
|
|
127
|
+
with unprecedented efficiency.
|
|
128
|
+
</p>
|
|
129
|
+
<p>
|
|
130
|
+
The future of web development looks bright with emerging
|
|
131
|
+
technologies like WebAssembly, Web Components, and progressive
|
|
132
|
+
enhancement techniques that make the web more capable and
|
|
133
|
+
accessible to everyone.
|
|
134
|
+
</p>
|
|
135
|
+
<p>
|
|
136
|
+
Testing and quality assurance remain critical aspects of
|
|
137
|
+
professional development. Unit tests, integration tests, and
|
|
138
|
+
end-to-end testing help ensure our applications work reliably
|
|
139
|
+
across different environments and use cases.
|
|
140
|
+
</p>
|
|
141
|
+
</div>
|
|
142
|
+
</div>
|
|
143
|
+
</ScrollArea>
|
|
144
|
+
</div>
|
|
145
|
+
|
|
146
|
+
{/* List Content */}
|
|
147
|
+
<div className="space-y-2">
|
|
148
|
+
<h4 className="text-sm font-medium text-white/80">List Content</h4>
|
|
149
|
+
<ScrollArea className="h-72 w-80 rounded-lg border border-white/10 bg-white/5">
|
|
150
|
+
<div className="p-4">
|
|
151
|
+
<h4 className="mb-4 text-sm leading-none font-medium text-white">
|
|
152
|
+
Popular Programming Languages
|
|
153
|
+
</h4>
|
|
154
|
+
<div className="space-y-2">
|
|
155
|
+
{[
|
|
156
|
+
{
|
|
157
|
+
name: "JavaScript",
|
|
158
|
+
desc: "Dynamic web programming language",
|
|
159
|
+
},
|
|
160
|
+
{ name: "TypeScript", desc: "Typed superset of JavaScript" },
|
|
161
|
+
{ name: "Python", desc: "Versatile and beginner-friendly" },
|
|
162
|
+
{ name: "Java", desc: "Object-oriented enterprise language" },
|
|
163
|
+
{
|
|
164
|
+
name: "C#",
|
|
165
|
+
desc: "Microsoft's modern programming language",
|
|
166
|
+
},
|
|
167
|
+
{ name: "Go", desc: "Fast and efficient systems language" },
|
|
168
|
+
{ name: "Rust", desc: "Memory-safe systems programming" },
|
|
169
|
+
{
|
|
170
|
+
name: "Swift",
|
|
171
|
+
desc: "Apple's modern programming language",
|
|
172
|
+
},
|
|
173
|
+
{ name: "Kotlin", desc: "Modern alternative to Java" },
|
|
174
|
+
{ name: "PHP", desc: "Server-side web development" },
|
|
175
|
+
{ name: "Ruby", desc: "Elegant and expressive language" },
|
|
176
|
+
{
|
|
177
|
+
name: "C++",
|
|
178
|
+
desc: "Powerful systems programming language",
|
|
179
|
+
},
|
|
180
|
+
{ name: "Dart", desc: "Language for Flutter development" },
|
|
181
|
+
{ name: "Scala", desc: "Functional programming on JVM" },
|
|
182
|
+
{ name: "Elixir", desc: "Concurrent and fault-tolerant" },
|
|
183
|
+
].map((lang, index) => (
|
|
184
|
+
<div
|
|
185
|
+
key={index}
|
|
186
|
+
className="rounded-lg border border-white/10 bg-white/5 p-3"
|
|
187
|
+
>
|
|
188
|
+
<div className="font-medium text-white">{lang.name}</div>
|
|
189
|
+
<div className="text-xs text-white/60">{lang.desc}</div>
|
|
190
|
+
</div>
|
|
191
|
+
))}
|
|
192
|
+
</div>
|
|
193
|
+
</div>
|
|
194
|
+
</ScrollArea>
|
|
195
|
+
</div>
|
|
196
|
+
</div>
|
|
197
|
+
</div>
|
|
198
|
+
),
|
|
199
|
+
parameters: {
|
|
200
|
+
docs: {
|
|
201
|
+
description: {
|
|
202
|
+
story:
|
|
203
|
+
"Basic vertical scrolling examples with text content and list items showing custom scrollbar styling.",
|
|
204
|
+
},
|
|
205
|
+
},
|
|
206
|
+
},
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
// 2. Horizontal Scroll
|
|
210
|
+
export const HorizontalScroll: Story = {
|
|
211
|
+
render: () => (
|
|
212
|
+
<div className="space-y-8">
|
|
213
|
+
<div className="text-center">
|
|
214
|
+
<h3 className="mb-2 font-medium text-white">Horizontal Scroll</h3>
|
|
215
|
+
<p className="text-sm text-white/60">
|
|
216
|
+
Horizontal scrolling with custom scrollbar orientation
|
|
217
|
+
</p>
|
|
218
|
+
</div>
|
|
219
|
+
|
|
220
|
+
<div className="space-y-6">
|
|
221
|
+
{/* Image Gallery */}
|
|
222
|
+
<div className="space-y-2">
|
|
223
|
+
<h4 className="text-sm font-medium text-white/80">Image Gallery</h4>
|
|
224
|
+
<ScrollArea className="w-full max-w-4xl rounded-lg border border-white/10 bg-white/5 whitespace-nowrap">
|
|
225
|
+
<div className="flex w-max gap-4 p-4">
|
|
226
|
+
{[
|
|
227
|
+
{
|
|
228
|
+
id: 1,
|
|
229
|
+
color: "from-blue-500 to-purple-600",
|
|
230
|
+
name: "Mountain Vista",
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
id: 2,
|
|
234
|
+
color: "from-green-500 to-teal-600",
|
|
235
|
+
name: "Forest Path",
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
id: 3,
|
|
239
|
+
color: "from-orange-500 to-red-600",
|
|
240
|
+
name: "Desert Sunset",
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
id: 4,
|
|
244
|
+
color: "from-purple-500 to-pink-600",
|
|
245
|
+
name: "Ocean Waves",
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
id: 5,
|
|
249
|
+
color: "from-teal-500 to-cyan-600",
|
|
250
|
+
name: "City Lights",
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
id: 6,
|
|
254
|
+
color: "from-yellow-500 to-orange-600",
|
|
255
|
+
name: "Golden Hour",
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
id: 7,
|
|
259
|
+
color: "from-indigo-500 to-blue-600",
|
|
260
|
+
name: "Starry Night",
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
id: 8,
|
|
264
|
+
color: "from-pink-500 to-rose-600",
|
|
265
|
+
name: "Cherry Blossoms",
|
|
266
|
+
},
|
|
267
|
+
].map((item) => (
|
|
268
|
+
<div key={item.id} className="flex-none space-y-2">
|
|
269
|
+
<div
|
|
270
|
+
className={`h-32 w-48 rounded-lg bg-gradient-to-br ${item.color} flex items-center justify-center font-medium text-white`}
|
|
271
|
+
>
|
|
272
|
+
{item.name}
|
|
273
|
+
</div>
|
|
274
|
+
<p className="text-center text-xs text-white/60">
|
|
275
|
+
{item.name}
|
|
276
|
+
</p>
|
|
277
|
+
</div>
|
|
278
|
+
))}
|
|
279
|
+
</div>
|
|
280
|
+
<ScrollBar orientation="horizontal" />
|
|
281
|
+
</ScrollArea>
|
|
282
|
+
</div>
|
|
283
|
+
|
|
284
|
+
{/* Tag List */}
|
|
285
|
+
<div className="space-y-2">
|
|
286
|
+
<h4 className="text-sm font-medium text-white/80">Technology Tags</h4>
|
|
287
|
+
<ScrollArea className="w-full max-w-2xl rounded-lg border border-white/10 bg-white/5 whitespace-nowrap">
|
|
288
|
+
<div className="flex w-max gap-2 p-4">
|
|
289
|
+
{[
|
|
290
|
+
"React",
|
|
291
|
+
"Vue.js",
|
|
292
|
+
"Angular",
|
|
293
|
+
"Svelte",
|
|
294
|
+
"Next.js",
|
|
295
|
+
"Nuxt.js",
|
|
296
|
+
"Gatsby",
|
|
297
|
+
"TypeScript",
|
|
298
|
+
"JavaScript",
|
|
299
|
+
"Node.js",
|
|
300
|
+
"Express",
|
|
301
|
+
"Fastify",
|
|
302
|
+
"Koa",
|
|
303
|
+
"MongoDB",
|
|
304
|
+
"PostgreSQL",
|
|
305
|
+
"MySQL",
|
|
306
|
+
"Redis",
|
|
307
|
+
"GraphQL",
|
|
308
|
+
"REST API",
|
|
309
|
+
"Docker",
|
|
310
|
+
"Kubernetes",
|
|
311
|
+
"AWS",
|
|
312
|
+
"Vercel",
|
|
313
|
+
"Netlify",
|
|
314
|
+
"Firebase",
|
|
315
|
+
].map((tag, index) => (
|
|
316
|
+
<div
|
|
317
|
+
key={index}
|
|
318
|
+
className="flex-none rounded-full border border-blue-500/30 bg-blue-500/20 px-3 py-1 text-xs text-blue-300"
|
|
319
|
+
>
|
|
320
|
+
{tag}
|
|
321
|
+
</div>
|
|
322
|
+
))}
|
|
323
|
+
</div>
|
|
324
|
+
<ScrollBar orientation="horizontal" />
|
|
325
|
+
</ScrollArea>
|
|
326
|
+
</div>
|
|
327
|
+
|
|
328
|
+
{/* Timeline */}
|
|
329
|
+
<div className="space-y-2">
|
|
330
|
+
<h4 className="text-sm font-medium text-white/80">
|
|
331
|
+
Project Timeline
|
|
332
|
+
</h4>
|
|
333
|
+
<ScrollArea className="w-full max-w-3xl rounded-lg border border-white/10 bg-white/5 whitespace-nowrap">
|
|
334
|
+
<div className="flex w-max gap-6 p-4">
|
|
335
|
+
{[
|
|
336
|
+
{ phase: "Planning", duration: "2 weeks", status: "completed" },
|
|
337
|
+
{ phase: "Design", duration: "3 weeks", status: "completed" },
|
|
338
|
+
{
|
|
339
|
+
phase: "Development",
|
|
340
|
+
duration: "8 weeks",
|
|
341
|
+
status: "in-progress",
|
|
342
|
+
},
|
|
343
|
+
{ phase: "Testing", duration: "2 weeks", status: "pending" },
|
|
344
|
+
{ phase: "Deployment", duration: "1 week", status: "pending" },
|
|
345
|
+
{ phase: "Launch", duration: "1 week", status: "pending" },
|
|
346
|
+
].map((item, index) => (
|
|
347
|
+
<div key={index} className="flex-none space-y-2">
|
|
348
|
+
<div className="w-32 rounded-lg border border-white/10 bg-white/5 p-3">
|
|
349
|
+
<div
|
|
350
|
+
className={`mb-2 h-2 w-2 rounded-full ${
|
|
351
|
+
item.status === "completed"
|
|
352
|
+
? "bg-green-500"
|
|
353
|
+
: item.status === "in-progress"
|
|
354
|
+
? "bg-yellow-500"
|
|
355
|
+
: "bg-gray-500"
|
|
356
|
+
}`}
|
|
357
|
+
></div>
|
|
358
|
+
<div className="text-sm font-medium text-white">
|
|
359
|
+
{item.phase}
|
|
360
|
+
</div>
|
|
361
|
+
<div className="text-xs text-white/60">{item.duration}</div>
|
|
362
|
+
</div>
|
|
363
|
+
</div>
|
|
364
|
+
))}
|
|
365
|
+
</div>
|
|
366
|
+
<ScrollBar orientation="horizontal" />
|
|
367
|
+
</ScrollArea>
|
|
368
|
+
</div>
|
|
369
|
+
</div>
|
|
370
|
+
</div>
|
|
371
|
+
),
|
|
372
|
+
parameters: {
|
|
373
|
+
docs: {
|
|
374
|
+
description: {
|
|
375
|
+
story:
|
|
376
|
+
"Horizontal scrolling examples including image galleries, tag lists, and timeline components with horizontal scrollbars.",
|
|
377
|
+
},
|
|
378
|
+
},
|
|
379
|
+
},
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
// 3. Both Directions
|
|
383
|
+
export const BothDirectionsScroll: Story = {
|
|
384
|
+
render: () => (
|
|
385
|
+
<div className="space-y-8">
|
|
386
|
+
<div className="text-center">
|
|
387
|
+
<h3 className="mb-2 font-medium text-white">Two-Dimensional Scroll</h3>
|
|
388
|
+
<p className="text-sm text-white/60">
|
|
389
|
+
Content that scrolls both horizontally and vertically
|
|
390
|
+
</p>
|
|
391
|
+
</div>
|
|
392
|
+
|
|
393
|
+
<div className="space-y-6">
|
|
394
|
+
{/* Data Table */}
|
|
395
|
+
<div className="space-y-2">
|
|
396
|
+
<h4 className="text-sm font-medium text-white/80">Data Table</h4>
|
|
397
|
+
<ScrollArea className="h-80 w-full max-w-4xl rounded-lg border border-white/10 bg-white/5">
|
|
398
|
+
<div className="w-[1200px] p-4">
|
|
399
|
+
<table className="w-full text-sm">
|
|
400
|
+
<thead>
|
|
401
|
+
<tr className="border-b border-white/10">
|
|
402
|
+
<th className="p-2 text-left text-white">ID</th>
|
|
403
|
+
<th className="p-2 text-left text-white">Name</th>
|
|
404
|
+
<th className="p-2 text-left text-white">Email</th>
|
|
405
|
+
<th className="p-2 text-left text-white">Role</th>
|
|
406
|
+
<th className="p-2 text-left text-white">Department</th>
|
|
407
|
+
<th className="p-2 text-left text-white">Location</th>
|
|
408
|
+
<th className="p-2 text-left text-white">Start Date</th>
|
|
409
|
+
<th className="p-2 text-left text-white">Salary</th>
|
|
410
|
+
<th className="p-2 text-left text-white">Status</th>
|
|
411
|
+
</tr>
|
|
412
|
+
</thead>
|
|
413
|
+
<tbody>
|
|
414
|
+
{Array.from({ length: 50 }, (_, i) => (
|
|
415
|
+
<tr key={i} className="border-b border-white/5">
|
|
416
|
+
<td className="p-2 text-white/80">{1000 + i}</td>
|
|
417
|
+
<td className="p-2 text-white/80">Employee {i + 1}</td>
|
|
418
|
+
<td className="p-2 text-white/60">
|
|
419
|
+
employee{i + 1}@company.com
|
|
420
|
+
</td>
|
|
421
|
+
<td className="p-2 text-white/60">
|
|
422
|
+
{["Developer", "Designer", "Manager", "Analyst"][i % 4]}
|
|
423
|
+
</td>
|
|
424
|
+
<td className="p-2 text-white/60">
|
|
425
|
+
{["Engineering", "Design", "Marketing", "Sales"][i % 4]}
|
|
426
|
+
</td>
|
|
427
|
+
<td className="p-2 text-white/60">
|
|
428
|
+
{
|
|
429
|
+
["San Francisco", "New York", "London", "Tokyo"][
|
|
430
|
+
i % 4
|
|
431
|
+
]
|
|
432
|
+
}
|
|
433
|
+
</td>
|
|
434
|
+
<td className="p-2 text-white/60">
|
|
435
|
+
{new Date(
|
|
436
|
+
2020 + (i % 4),
|
|
437
|
+
i % 12,
|
|
438
|
+
(i % 28) + 1
|
|
439
|
+
).toLocaleDateString()}
|
|
440
|
+
</td>
|
|
441
|
+
<td className="p-2 text-white/60">
|
|
442
|
+
${(50000 + i * 1000).toLocaleString()}
|
|
443
|
+
</td>
|
|
444
|
+
<td className="p-2">
|
|
445
|
+
<span
|
|
446
|
+
className={`rounded-full px-2 py-1 text-xs ${
|
|
447
|
+
i % 3 === 0
|
|
448
|
+
? "bg-green-500/20 text-green-400"
|
|
449
|
+
: i % 3 === 1
|
|
450
|
+
? "bg-yellow-500/20 text-yellow-400"
|
|
451
|
+
: "bg-red-500/20 text-red-400"
|
|
452
|
+
}`}
|
|
453
|
+
>
|
|
454
|
+
{i % 3 === 0
|
|
455
|
+
? "Active"
|
|
456
|
+
: i % 3 === 1
|
|
457
|
+
? "Away"
|
|
458
|
+
: "Inactive"}
|
|
459
|
+
</span>
|
|
460
|
+
</td>
|
|
461
|
+
</tr>
|
|
462
|
+
))}
|
|
463
|
+
</tbody>
|
|
464
|
+
</table>
|
|
465
|
+
</div>
|
|
466
|
+
<ScrollBar orientation="horizontal" />
|
|
467
|
+
</ScrollArea>
|
|
468
|
+
</div>
|
|
469
|
+
|
|
470
|
+
{/* Large Canvas */}
|
|
471
|
+
<div className="space-y-2">
|
|
472
|
+
<h4 className="text-sm font-medium text-white/80">Design Canvas</h4>
|
|
473
|
+
<ScrollArea className="h-96 w-full max-w-2xl rounded-lg border border-white/10 bg-white/5">
|
|
474
|
+
<div className="h-[1200px] w-[1500px] bg-gradient-to-br from-blue-900/20 to-purple-900/20 p-4">
|
|
475
|
+
<div className="relative h-full w-full">
|
|
476
|
+
{/* Grid Pattern */}
|
|
477
|
+
<div
|
|
478
|
+
className="absolute inset-0 opacity-20"
|
|
479
|
+
style={{
|
|
480
|
+
backgroundImage: `
|
|
481
|
+
linear-gradient(rgba(255,255,255,0.1) 1px, transparent 1px),
|
|
482
|
+
linear-gradient(90deg, rgba(255,255,255,0.1) 1px, transparent 1px)
|
|
483
|
+
`,
|
|
484
|
+
backgroundSize: "50px 50px",
|
|
485
|
+
}}
|
|
486
|
+
/>
|
|
487
|
+
|
|
488
|
+
{/* Design Elements */}
|
|
489
|
+
<div className="absolute top-20 left-20 flex h-32 w-48 items-center justify-center rounded-lg border border-blue-400/50 bg-blue-500/30 text-white">
|
|
490
|
+
Header Component
|
|
491
|
+
</div>
|
|
492
|
+
<div className="absolute top-60 left-20 flex h-40 w-64 items-center justify-center rounded-lg border border-green-400/50 bg-green-500/30 text-white">
|
|
493
|
+
Navigation Menu
|
|
494
|
+
</div>
|
|
495
|
+
<div className="absolute top-20 left-80 flex h-96 w-80 items-center justify-center rounded-lg border border-purple-400/50 bg-purple-500/30 text-white">
|
|
496
|
+
Main Content Area
|
|
497
|
+
</div>
|
|
498
|
+
<div className="absolute top-20 right-20 flex h-64 w-56 items-center justify-center rounded-lg border border-orange-400/50 bg-orange-500/30 text-white">
|
|
499
|
+
Sidebar Widget
|
|
500
|
+
</div>
|
|
501
|
+
<div className="absolute bottom-20 left-20 flex h-24 w-[calc(100%-160px)] items-center justify-center rounded-lg border border-gray-400/50 bg-gray-500/30 text-white">
|
|
502
|
+
Footer Component
|
|
503
|
+
</div>
|
|
504
|
+
</div>
|
|
505
|
+
</div>
|
|
506
|
+
<ScrollBar orientation="horizontal" />
|
|
507
|
+
</ScrollArea>
|
|
508
|
+
</div>
|
|
509
|
+
</div>
|
|
510
|
+
</div>
|
|
511
|
+
),
|
|
512
|
+
parameters: {
|
|
513
|
+
docs: {
|
|
514
|
+
description: {
|
|
515
|
+
story:
|
|
516
|
+
"Two-dimensional scrolling examples including data tables and design canvases that require both horizontal and vertical scrolling.",
|
|
517
|
+
},
|
|
518
|
+
},
|
|
519
|
+
},
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
// 4. Different Sizes
|
|
523
|
+
export const DifferentSizes: Story = {
|
|
524
|
+
render: () => (
|
|
525
|
+
<div className="space-y-8">
|
|
526
|
+
<div className="text-center">
|
|
527
|
+
<h3 className="mb-2 font-medium text-white">Different Sizes</h3>
|
|
528
|
+
<p className="text-sm text-white/60">
|
|
529
|
+
ScrollArea components in various sizes and configurations
|
|
530
|
+
</p>
|
|
531
|
+
</div>
|
|
532
|
+
|
|
533
|
+
<div className="grid grid-cols-1 gap-6 md:grid-cols-2 lg:grid-cols-3">
|
|
534
|
+
{/* Small */}
|
|
535
|
+
<div className="space-y-2">
|
|
536
|
+
<h4 className="text-sm font-medium text-white/80">Small (h-40)</h4>
|
|
537
|
+
<ScrollArea className="h-40 w-full rounded-lg border border-white/10 bg-white/5">
|
|
538
|
+
<div className="p-3">
|
|
539
|
+
<h5 className="mb-2 text-sm font-medium text-white">
|
|
540
|
+
Quick Notes
|
|
541
|
+
</h5>
|
|
542
|
+
<div className="space-y-2 text-xs text-white/70">
|
|
543
|
+
{Array.from({ length: 15 }, (_, i) => (
|
|
544
|
+
<div key={i} className="rounded bg-white/5 p-2">
|
|
545
|
+
Note item {i + 1}: This is a quick note or reminder item.
|
|
546
|
+
</div>
|
|
547
|
+
))}
|
|
548
|
+
</div>
|
|
549
|
+
</div>
|
|
550
|
+
</ScrollArea>
|
|
551
|
+
</div>
|
|
552
|
+
|
|
553
|
+
{/* Medium */}
|
|
554
|
+
<div className="space-y-2">
|
|
555
|
+
<h4 className="text-sm font-medium text-white/80">Medium (h-64)</h4>
|
|
556
|
+
<ScrollArea className="h-64 w-full rounded-lg border border-white/10 bg-white/5">
|
|
557
|
+
<div className="p-4">
|
|
558
|
+
<h5 className="mb-3 text-sm font-medium text-white">Task List</h5>
|
|
559
|
+
<div className="space-y-3">
|
|
560
|
+
{Array.from({ length: 12 }, (_, i) => (
|
|
561
|
+
<div
|
|
562
|
+
key={i}
|
|
563
|
+
className="flex items-center gap-3 rounded-lg bg-white/5 p-3"
|
|
564
|
+
>
|
|
565
|
+
<div
|
|
566
|
+
className={`h-3 w-3 rounded-full ${
|
|
567
|
+
i % 3 === 0 ? "bg-green-500" : "bg-gray-500"
|
|
568
|
+
}`}
|
|
569
|
+
></div>
|
|
570
|
+
<div>
|
|
571
|
+
<div className="text-sm text-white">Task {i + 1}</div>
|
|
572
|
+
<div className="text-xs text-white/60">
|
|
573
|
+
{i % 3 === 0 ? "Completed" : "Pending"}
|
|
574
|
+
</div>
|
|
575
|
+
</div>
|
|
576
|
+
</div>
|
|
577
|
+
))}
|
|
578
|
+
</div>
|
|
579
|
+
</div>
|
|
580
|
+
</ScrollArea>
|
|
581
|
+
</div>
|
|
582
|
+
|
|
583
|
+
{/* Large */}
|
|
584
|
+
<div className="space-y-2">
|
|
585
|
+
<h4 className="text-sm font-medium text-white/80">Large (h-96)</h4>
|
|
586
|
+
<ScrollArea className="h-96 w-full rounded-lg border border-white/10 bg-white/5">
|
|
587
|
+
<div className="p-4">
|
|
588
|
+
<h5 className="mb-4 text-sm font-medium text-white">
|
|
589
|
+
Activity Feed
|
|
590
|
+
</h5>
|
|
591
|
+
<div className="space-y-4">
|
|
592
|
+
{Array.from({ length: 20 }, (_, i) => (
|
|
593
|
+
<div key={i} className="flex gap-3 rounded-lg bg-white/5 p-3">
|
|
594
|
+
<div className="flex h-8 w-8 items-center justify-center rounded-full bg-gradient-to-br from-blue-500 to-purple-600 text-xs font-medium text-white">
|
|
595
|
+
{String.fromCharCode(65 + (i % 26))}
|
|
596
|
+
</div>
|
|
597
|
+
<div className="flex-1">
|
|
598
|
+
<div className="text-sm text-white">
|
|
599
|
+
User {i + 1} performed an action
|
|
600
|
+
</div>
|
|
601
|
+
<div className="text-xs text-white/60">
|
|
602
|
+
{Math.floor(Math.random() * 60)} minutes ago
|
|
603
|
+
</div>
|
|
604
|
+
</div>
|
|
605
|
+
</div>
|
|
606
|
+
))}
|
|
607
|
+
</div>
|
|
608
|
+
</div>
|
|
609
|
+
</ScrollArea>
|
|
610
|
+
</div>
|
|
611
|
+
</div>
|
|
612
|
+
</div>
|
|
613
|
+
),
|
|
614
|
+
parameters: {
|
|
615
|
+
docs: {
|
|
616
|
+
description: {
|
|
617
|
+
story:
|
|
618
|
+
"ScrollArea components in different sizes from small notification lists to large activity feeds.",
|
|
619
|
+
},
|
|
620
|
+
},
|
|
621
|
+
},
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
// 5. Real World Examples
|
|
625
|
+
export const RealWorldExamples: Story = {
|
|
626
|
+
render: () => (
|
|
627
|
+
<div className="space-y-8">
|
|
628
|
+
<div className="text-center">
|
|
629
|
+
<h3 className="mb-2 font-medium text-white">Real World Examples</h3>
|
|
630
|
+
<p className="text-sm text-white/60">
|
|
631
|
+
Common use cases for scrollable areas in applications
|
|
632
|
+
</p>
|
|
633
|
+
</div>
|
|
634
|
+
|
|
635
|
+
<div className="grid grid-cols-1 gap-6 lg:grid-cols-2">
|
|
636
|
+
{/* Chat Messages */}
|
|
637
|
+
<div className="space-y-2">
|
|
638
|
+
<h4 className="text-sm font-medium text-white/80">Chat Messages</h4>
|
|
639
|
+
<ScrollArea className="h-80 w-full rounded-lg border border-white/10 bg-white/5">
|
|
640
|
+
<div className="space-y-4 p-4">
|
|
641
|
+
{[
|
|
642
|
+
{
|
|
643
|
+
user: "Alice",
|
|
644
|
+
message: "Hey everyone! How's the project going?",
|
|
645
|
+
time: "10:30",
|
|
646
|
+
self: false,
|
|
647
|
+
},
|
|
648
|
+
{
|
|
649
|
+
user: "You",
|
|
650
|
+
message:
|
|
651
|
+
"Going well! Just finished the new component library.",
|
|
652
|
+
time: "10:32",
|
|
653
|
+
self: true,
|
|
654
|
+
},
|
|
655
|
+
{
|
|
656
|
+
user: "Bob",
|
|
657
|
+
message: "That's awesome! Can't wait to try it out.",
|
|
658
|
+
time: "10:33",
|
|
659
|
+
self: false,
|
|
660
|
+
},
|
|
661
|
+
{
|
|
662
|
+
user: "Alice",
|
|
663
|
+
message: "Same here! Are there any examples we can look at?",
|
|
664
|
+
time: "10:35",
|
|
665
|
+
self: false,
|
|
666
|
+
},
|
|
667
|
+
{
|
|
668
|
+
user: "You",
|
|
669
|
+
message:
|
|
670
|
+
"Yes! I've created a Storybook with all the components and examples.",
|
|
671
|
+
time: "10:36",
|
|
672
|
+
self: true,
|
|
673
|
+
},
|
|
674
|
+
{
|
|
675
|
+
user: "Carol",
|
|
676
|
+
message:
|
|
677
|
+
"Perfect timing! I was just about to ask about documentation.",
|
|
678
|
+
time: "10:38",
|
|
679
|
+
self: false,
|
|
680
|
+
},
|
|
681
|
+
{
|
|
682
|
+
user: "Bob",
|
|
683
|
+
message: "The dark theme looks really good btw 👍",
|
|
684
|
+
time: "10:40",
|
|
685
|
+
self: false,
|
|
686
|
+
},
|
|
687
|
+
{
|
|
688
|
+
user: "You",
|
|
689
|
+
message:
|
|
690
|
+
"Thanks! We spent a lot of time getting the frosted glass effects right.",
|
|
691
|
+
time: "10:41",
|
|
692
|
+
self: true,
|
|
693
|
+
},
|
|
694
|
+
{
|
|
695
|
+
user: "Alice",
|
|
696
|
+
message:
|
|
697
|
+
"It really shows! The attention to detail is impressive.",
|
|
698
|
+
time: "10:43",
|
|
699
|
+
self: false,
|
|
700
|
+
},
|
|
701
|
+
{
|
|
702
|
+
user: "Carol",
|
|
703
|
+
message: "Should we schedule a demo session for the team?",
|
|
704
|
+
time: "10:45",
|
|
705
|
+
self: false,
|
|
706
|
+
},
|
|
707
|
+
{
|
|
708
|
+
user: "You",
|
|
709
|
+
message: "Great idea! How about tomorrow at 2 PM?",
|
|
710
|
+
time: "10:46",
|
|
711
|
+
self: true,
|
|
712
|
+
},
|
|
713
|
+
{
|
|
714
|
+
user: "Bob",
|
|
715
|
+
message: "Works for me! I'll send out calendar invites.",
|
|
716
|
+
time: "10:47",
|
|
717
|
+
self: false,
|
|
718
|
+
},
|
|
719
|
+
].map((msg, i) => (
|
|
720
|
+
<div
|
|
721
|
+
key={i}
|
|
722
|
+
className={`flex ${msg.self ? "justify-end" : "justify-start"}`}
|
|
723
|
+
>
|
|
724
|
+
<div
|
|
725
|
+
className={`max-w-xs rounded-lg p-3 ${
|
|
726
|
+
msg.self
|
|
727
|
+
? "bg-blue-500 text-white"
|
|
728
|
+
: "bg-white/10 text-white"
|
|
729
|
+
}`}
|
|
730
|
+
>
|
|
731
|
+
{!msg.self && (
|
|
732
|
+
<div className="mb-1 text-xs font-medium text-white/80">
|
|
733
|
+
{msg.user}
|
|
734
|
+
</div>
|
|
735
|
+
)}
|
|
736
|
+
<div className="text-sm">{msg.message}</div>
|
|
737
|
+
<div
|
|
738
|
+
className={`mt-1 text-xs ${
|
|
739
|
+
msg.self ? "text-blue-100" : "text-white/60"
|
|
740
|
+
}`}
|
|
741
|
+
>
|
|
742
|
+
{msg.time}
|
|
743
|
+
</div>
|
|
744
|
+
</div>
|
|
745
|
+
</div>
|
|
746
|
+
))}
|
|
747
|
+
</div>
|
|
748
|
+
</ScrollArea>
|
|
749
|
+
</div>
|
|
750
|
+
|
|
751
|
+
{/* File Explorer */}
|
|
752
|
+
<div className="space-y-2">
|
|
753
|
+
<h4 className="text-sm font-medium text-white/80">File Explorer</h4>
|
|
754
|
+
<ScrollArea className="h-80 w-full rounded-lg border border-white/10 bg-white/5">
|
|
755
|
+
<div className="text-fm-primary p-2">
|
|
756
|
+
{[
|
|
757
|
+
{
|
|
758
|
+
name: "📁 Documents",
|
|
759
|
+
type: "folder",
|
|
760
|
+
size: "",
|
|
761
|
+
modified: "Today",
|
|
762
|
+
},
|
|
763
|
+
{
|
|
764
|
+
name: "📁 Images",
|
|
765
|
+
type: "folder",
|
|
766
|
+
size: "",
|
|
767
|
+
modified: "Yesterday",
|
|
768
|
+
},
|
|
769
|
+
{
|
|
770
|
+
name: "📁 Projects",
|
|
771
|
+
type: "folder",
|
|
772
|
+
size: "",
|
|
773
|
+
modified: "2 days ago",
|
|
774
|
+
},
|
|
775
|
+
{
|
|
776
|
+
name: "📄 README.md",
|
|
777
|
+
type: "file",
|
|
778
|
+
size: "2.1 KB",
|
|
779
|
+
modified: "Today",
|
|
780
|
+
},
|
|
781
|
+
{
|
|
782
|
+
name: "📄 package.json",
|
|
783
|
+
type: "file",
|
|
784
|
+
size: "1.8 KB",
|
|
785
|
+
modified: "Today",
|
|
786
|
+
},
|
|
787
|
+
{
|
|
788
|
+
name: "🖼️ hero-image.jpg",
|
|
789
|
+
type: "file",
|
|
790
|
+
size: "245 KB",
|
|
791
|
+
modified: "Yesterday",
|
|
792
|
+
},
|
|
793
|
+
{
|
|
794
|
+
name: "📄 index.html",
|
|
795
|
+
type: "file",
|
|
796
|
+
size: "3.2 KB",
|
|
797
|
+
modified: "2 days ago",
|
|
798
|
+
},
|
|
799
|
+
{
|
|
800
|
+
name: "🎨 styles.css",
|
|
801
|
+
type: "file",
|
|
802
|
+
size: "12.5 KB",
|
|
803
|
+
modified: "Today",
|
|
804
|
+
},
|
|
805
|
+
{
|
|
806
|
+
name: "⚡ app.js",
|
|
807
|
+
type: "file",
|
|
808
|
+
size: "8.7 KB",
|
|
809
|
+
modified: "Today",
|
|
810
|
+
},
|
|
811
|
+
{
|
|
812
|
+
name: "📄 config.json",
|
|
813
|
+
type: "file",
|
|
814
|
+
size: "892 B",
|
|
815
|
+
modified: "3 days ago",
|
|
816
|
+
},
|
|
817
|
+
{
|
|
818
|
+
name: "🖼️ logo.svg",
|
|
819
|
+
type: "file",
|
|
820
|
+
size: "3.4 KB",
|
|
821
|
+
modified: "Yesterday",
|
|
822
|
+
},
|
|
823
|
+
{
|
|
824
|
+
name: "📄 .gitignore",
|
|
825
|
+
type: "file",
|
|
826
|
+
size: "156 B",
|
|
827
|
+
modified: "5 days ago",
|
|
828
|
+
},
|
|
829
|
+
{
|
|
830
|
+
name: "📁 node_modules",
|
|
831
|
+
type: "folder",
|
|
832
|
+
size: "",
|
|
833
|
+
modified: "Today",
|
|
834
|
+
},
|
|
835
|
+
{
|
|
836
|
+
name: "📄 tsconfig.json",
|
|
837
|
+
type: "file",
|
|
838
|
+
size: "654 B",
|
|
839
|
+
modified: "Yesterday",
|
|
840
|
+
},
|
|
841
|
+
{
|
|
842
|
+
name: "🔧 webpack.config.js",
|
|
843
|
+
type: "file",
|
|
844
|
+
size: "2.9 KB",
|
|
845
|
+
modified: "3 days ago",
|
|
846
|
+
},
|
|
847
|
+
].map((item, i) => (
|
|
848
|
+
<div
|
|
849
|
+
key={i}
|
|
850
|
+
className="flex cursor-pointer items-center justify-between rounded p-2 hover:bg-white/10"
|
|
851
|
+
>
|
|
852
|
+
<div className="flex min-w-0 flex-1 items-center gap-2">
|
|
853
|
+
<span className="text-sm">{item.name}</span>
|
|
854
|
+
</div>
|
|
855
|
+
<div className="flex items-center gap-4 text-xs text-white/60">
|
|
856
|
+
<span className="w-12 text-right">{item.size}</span>
|
|
857
|
+
<span className="w-20 text-right">{item.modified}</span>
|
|
858
|
+
</div>
|
|
859
|
+
</div>
|
|
860
|
+
))}
|
|
861
|
+
</div>
|
|
862
|
+
</ScrollArea>
|
|
863
|
+
</div>
|
|
864
|
+
|
|
865
|
+
{/* Code Editor Sidebar */}
|
|
866
|
+
<div className="space-y-2">
|
|
867
|
+
<h4 className="text-sm font-medium text-white/80">
|
|
868
|
+
Code Editor Sidebar
|
|
869
|
+
</h4>
|
|
870
|
+
<ScrollArea className="h-80 w-full rounded-lg border border-white/10 bg-white/5">
|
|
871
|
+
<div className="p-2">
|
|
872
|
+
<div className="space-y-1">
|
|
873
|
+
<div className="p-2 text-xs font-medium tracking-wide text-white/80 uppercase">
|
|
874
|
+
Explorer
|
|
875
|
+
</div>
|
|
876
|
+
{[
|
|
877
|
+
{ name: "src", level: 0, type: "folder", expanded: true },
|
|
878
|
+
{
|
|
879
|
+
name: "components",
|
|
880
|
+
level: 1,
|
|
881
|
+
type: "folder",
|
|
882
|
+
expanded: true,
|
|
883
|
+
},
|
|
884
|
+
{ name: "Button.tsx", level: 2, type: "file" },
|
|
885
|
+
{ name: "Button.stories.tsx", level: 2, type: "file" },
|
|
886
|
+
{ name: "Avatar.tsx", level: 2, type: "file" },
|
|
887
|
+
{ name: "Avatar.stories.tsx", level: 2, type: "file" },
|
|
888
|
+
{ name: "ScrollArea.tsx", level: 2, type: "file" },
|
|
889
|
+
{ name: "hooks", level: 1, type: "folder", expanded: false },
|
|
890
|
+
{ name: "utils", level: 1, type: "folder", expanded: true },
|
|
891
|
+
{ name: "cn.ts", level: 2, type: "file" },
|
|
892
|
+
{ name: "types.ts", level: 2, type: "file" },
|
|
893
|
+
{ name: "index.ts", level: 1, type: "file" },
|
|
894
|
+
{ name: "App.tsx", level: 1, type: "file" },
|
|
895
|
+
{ name: "public", level: 0, type: "folder", expanded: false },
|
|
896
|
+
{ name: "package.json", level: 0, type: "file" },
|
|
897
|
+
{ name: "tsconfig.json", level: 0, type: "file" },
|
|
898
|
+
{ name: "tailwind.config.js", level: 0, type: "file" },
|
|
899
|
+
{ name: "vite.config.ts", level: 0, type: "file" },
|
|
900
|
+
].map((item, i) => (
|
|
901
|
+
<div
|
|
902
|
+
key={i}
|
|
903
|
+
className="flex cursor-pointer items-center gap-1 rounded p-1 text-sm hover:bg-white/10"
|
|
904
|
+
style={{ paddingLeft: `${8 + item.level * 16}px` }}
|
|
905
|
+
>
|
|
906
|
+
{item.type === "folder" && (
|
|
907
|
+
<span className="text-white/60">
|
|
908
|
+
{item.expanded ? "📂" : "📁"}
|
|
909
|
+
</span>
|
|
910
|
+
)}
|
|
911
|
+
{item.type === "file" && (
|
|
912
|
+
<span className="text-white/60">📄</span>
|
|
913
|
+
)}
|
|
914
|
+
<span className="text-white/90">{item.name}</span>
|
|
915
|
+
</div>
|
|
916
|
+
))}
|
|
917
|
+
</div>
|
|
918
|
+
</div>
|
|
919
|
+
</ScrollArea>
|
|
920
|
+
</div>
|
|
921
|
+
|
|
922
|
+
{/* Settings Panel */}
|
|
923
|
+
<div className="space-y-2">
|
|
924
|
+
<h4 className="text-sm font-medium text-white/80">Settings Panel</h4>
|
|
925
|
+
<ScrollArea className="h-80 w-full rounded-lg border border-white/10 bg-white/5">
|
|
926
|
+
<div className="space-y-6 p-4">
|
|
927
|
+
{[
|
|
928
|
+
{
|
|
929
|
+
section: "Appearance",
|
|
930
|
+
settings: [
|
|
931
|
+
{ label: "Theme", value: "Dark", type: "select" },
|
|
932
|
+
{ label: "Font Size", value: "Medium", type: "select" },
|
|
933
|
+
{ label: "Animations", value: true, type: "toggle" },
|
|
934
|
+
],
|
|
935
|
+
},
|
|
936
|
+
{
|
|
937
|
+
section: "Behavior",
|
|
938
|
+
settings: [
|
|
939
|
+
{ label: "Auto Save", value: true, type: "toggle" },
|
|
940
|
+
{
|
|
941
|
+
label: "Smart Suggestions",
|
|
942
|
+
value: false,
|
|
943
|
+
type: "toggle",
|
|
944
|
+
},
|
|
945
|
+
{
|
|
946
|
+
label: "Keyboard Shortcuts",
|
|
947
|
+
value: true,
|
|
948
|
+
type: "toggle",
|
|
949
|
+
},
|
|
950
|
+
],
|
|
951
|
+
},
|
|
952
|
+
{
|
|
953
|
+
section: "Privacy",
|
|
954
|
+
settings: [
|
|
955
|
+
{ label: "Analytics", value: false, type: "toggle" },
|
|
956
|
+
{ label: "Crash Reports", value: true, type: "toggle" },
|
|
957
|
+
{ label: "Usage Data", value: false, type: "toggle" },
|
|
958
|
+
],
|
|
959
|
+
},
|
|
960
|
+
{
|
|
961
|
+
section: "Advanced",
|
|
962
|
+
settings: [
|
|
963
|
+
{ label: "Developer Mode", value: false, type: "toggle" },
|
|
964
|
+
{
|
|
965
|
+
label: "Experimental Features",
|
|
966
|
+
value: false,
|
|
967
|
+
type: "toggle",
|
|
968
|
+
},
|
|
969
|
+
{ label: "Debug Logging", value: false, type: "toggle" },
|
|
970
|
+
],
|
|
971
|
+
},
|
|
972
|
+
].map((group, i) => (
|
|
973
|
+
<div key={i}>
|
|
974
|
+
<h5 className="mb-3 text-sm font-medium text-white">
|
|
975
|
+
{group.section}
|
|
976
|
+
</h5>
|
|
977
|
+
<div className="space-y-3">
|
|
978
|
+
{group.settings.map((setting, j) => (
|
|
979
|
+
<div
|
|
980
|
+
key={j}
|
|
981
|
+
className="flex items-center justify-between"
|
|
982
|
+
>
|
|
983
|
+
<span className="text-sm text-white/80">
|
|
984
|
+
{setting.label}
|
|
985
|
+
</span>
|
|
986
|
+
{setting.type === "toggle" ? (
|
|
987
|
+
<div
|
|
988
|
+
className={`h-5 w-10 rounded-full p-1 ${
|
|
989
|
+
setting.value ? "bg-blue-500" : "bg-gray-600"
|
|
990
|
+
}`}
|
|
991
|
+
>
|
|
992
|
+
<div
|
|
993
|
+
className={`h-3 w-3 rounded-full bg-white transition-transform ${
|
|
994
|
+
setting.value
|
|
995
|
+
? "translate-x-5"
|
|
996
|
+
: "translate-x-0"
|
|
997
|
+
}`}
|
|
998
|
+
></div>
|
|
999
|
+
</div>
|
|
1000
|
+
) : (
|
|
1001
|
+
<span className="text-sm text-white/60">
|
|
1002
|
+
{setting.value}
|
|
1003
|
+
</span>
|
|
1004
|
+
)}
|
|
1005
|
+
</div>
|
|
1006
|
+
))}
|
|
1007
|
+
</div>
|
|
1008
|
+
</div>
|
|
1009
|
+
))}
|
|
1010
|
+
</div>
|
|
1011
|
+
</ScrollArea>
|
|
1012
|
+
</div>
|
|
1013
|
+
</div>
|
|
1014
|
+
</div>
|
|
1015
|
+
),
|
|
1016
|
+
parameters: {
|
|
1017
|
+
docs: {
|
|
1018
|
+
description: {
|
|
1019
|
+
story:
|
|
1020
|
+
"Real-world examples including chat interfaces, file explorers, code editor sidebars, and settings panels demonstrating practical ScrollArea usage.",
|
|
1021
|
+
},
|
|
1022
|
+
},
|
|
1023
|
+
},
|
|
1024
|
+
}
|
|
1025
|
+
|
|
1026
|
+
// 6. Performance Example
|
|
1027
|
+
export const PerformanceExample: Story = {
|
|
1028
|
+
render: () => (
|
|
1029
|
+
<div className="space-y-8">
|
|
1030
|
+
<div className="text-center">
|
|
1031
|
+
<h3 className="mb-2 font-medium text-white">Performance Example</h3>
|
|
1032
|
+
<p className="text-sm text-white/60">
|
|
1033
|
+
Large datasets handled efficiently with virtual scrolling simulation
|
|
1034
|
+
</p>
|
|
1035
|
+
</div>
|
|
1036
|
+
|
|
1037
|
+
<div className="space-y-4">
|
|
1038
|
+
<div className="text-center">
|
|
1039
|
+
<div className="inline-block rounded-lg border border-white/10 bg-white/5 p-4">
|
|
1040
|
+
<h4 className="mb-2 text-sm font-medium text-white">
|
|
1041
|
+
Large Dataset
|
|
1042
|
+
</h4>
|
|
1043
|
+
<p className="text-xs leading-relaxed text-white/60">
|
|
1044
|
+
This example shows 1000+ items in a scrollable area. The
|
|
1045
|
+
ScrollArea component handles smooth scrolling even with large
|
|
1046
|
+
amounts of content.
|
|
1047
|
+
</p>
|
|
1048
|
+
</div>
|
|
1049
|
+
</div>
|
|
1050
|
+
|
|
1051
|
+
<ScrollArea className="mx-auto h-96 w-full max-w-2xl rounded-lg border border-white/10 bg-white/5">
|
|
1052
|
+
<div className="p-4">
|
|
1053
|
+
<h4 className="mb-4 text-sm leading-none font-medium text-white">
|
|
1054
|
+
Large Item List (1000 items)
|
|
1055
|
+
</h4>
|
|
1056
|
+
<div className="space-y-1">
|
|
1057
|
+
{Array.from({ length: 1000 }, (_, i) => (
|
|
1058
|
+
<div
|
|
1059
|
+
key={i}
|
|
1060
|
+
className="flex items-center justify-between rounded-lg bg-white/5 p-3 transition-colors hover:bg-white/10"
|
|
1061
|
+
>
|
|
1062
|
+
<div className="flex items-center gap-3">
|
|
1063
|
+
<div
|
|
1064
|
+
className={`flex h-8 w-8 items-center justify-center rounded-full text-xs font-medium text-white ${
|
|
1065
|
+
[
|
|
1066
|
+
"bg-blue-500",
|
|
1067
|
+
"bg-green-500",
|
|
1068
|
+
"bg-purple-500",
|
|
1069
|
+
"bg-orange-500",
|
|
1070
|
+
][i % 4]
|
|
1071
|
+
}`}
|
|
1072
|
+
>
|
|
1073
|
+
{i + 1}
|
|
1074
|
+
</div>
|
|
1075
|
+
<div>
|
|
1076
|
+
<div className="text-sm font-medium text-white">
|
|
1077
|
+
Item {i + 1}
|
|
1078
|
+
</div>
|
|
1079
|
+
<div className="text-xs text-white/60">
|
|
1080
|
+
Category:{" "}
|
|
1081
|
+
{["Development", "Design", "Marketing", "Sales"][i % 4]}
|
|
1082
|
+
</div>
|
|
1083
|
+
</div>
|
|
1084
|
+
</div>
|
|
1085
|
+
<div className="text-xs text-white/60">
|
|
1086
|
+
{new Date(Date.now() - i * 60000).toLocaleTimeString()}
|
|
1087
|
+
</div>
|
|
1088
|
+
</div>
|
|
1089
|
+
))}
|
|
1090
|
+
</div>
|
|
1091
|
+
</div>
|
|
1092
|
+
</ScrollArea>
|
|
1093
|
+
</div>
|
|
1094
|
+
</div>
|
|
1095
|
+
),
|
|
1096
|
+
parameters: {
|
|
1097
|
+
docs: {
|
|
1098
|
+
description: {
|
|
1099
|
+
story:
|
|
1100
|
+
"Performance demonstration with 1000+ items showing how ScrollArea maintains smooth scrolling with large datasets.",
|
|
1101
|
+
},
|
|
1102
|
+
},
|
|
1103
|
+
},
|
|
1104
|
+
}
|