@meistrari/tela-build 1.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/README.md +75 -0
- package/app.config.ts +73 -0
- package/components/tela/animated/animated-calculating-number.vue +16 -0
- package/components/tela/animated/animated-number.mdx +248 -0
- package/components/tela/animated/animated-number.stories.ts +52 -0
- package/components/tela/animated/animated-number.vue +23 -0
- package/components/tela/animated/animated-text.vue +124 -0
- package/components/tela/animated/animated-value.vue +68 -0
- package/components/tela/avatar/avatar.mdx +117 -0
- package/components/tela/avatar/avatar.stories.ts +62 -0
- package/components/tela/avatar/avatar.vue +71 -0
- package/components/tela/avatar/group/avatar-group.stories.ts +78 -0
- package/components/tela/avatar/group/avatar-group.vue +46 -0
- package/components/tela/badge/badge.mdx +154 -0
- package/components/tela/badge/badge.stories.ts +82 -0
- package/components/tela/badge/badge.vue +41 -0
- package/components/tela/button/button.mdx +155 -0
- package/components/tela/button/button.stories.ts +202 -0
- package/components/tela/button/button.vue +107 -0
- package/components/tela/card.vue +30 -0
- package/components/tela/chart/chart-bar.vue +58 -0
- package/components/tela/chat/chat.mdx +268 -0
- package/components/tela/chat/chat.stories.ts +253 -0
- package/components/tela/chat/command/index.vue +41 -0
- package/components/tela/chat/command/mention/index.vue +138 -0
- package/components/tela/chat/index.vue +112 -0
- package/components/tela/chat/pure-text-input/chat-text-input.vue +190 -0
- package/components/tela/chat/text-input/chat-text-input.stories.ts +128 -0
- package/components/tela/chat/text-input/index.vue +217 -0
- package/components/tela/chat/text-message/chat-text-message.stories.ts +138 -0
- package/components/tela/chat/text-message/index.vue +355 -0
- package/components/tela/chat/types.ts +19 -0
- package/components/tela/checkbox/checkbox-card.vue +30 -0
- package/components/tela/checkbox/checkbox.mdx +164 -0
- package/components/tela/checkbox/checkbox.stories.ts +104 -0
- package/components/tela/checkbox/checkbox.vue +43 -0
- package/components/tela/collapsible/Collapsible.vue +15 -0
- package/components/tela/collapsible/CollapsibleContent.vue +59 -0
- package/components/tela/collapsible/CollapsibleTrigger.vue +12 -0
- package/components/tela/collapsible/collapsible.mdx +157 -0
- package/components/tela/collapsible-section/collapsible-section.mdx +180 -0
- package/components/tela/collapsible-section/collapsible-section.stories.ts +53 -0
- package/components/tela/collapsible-section/collapsible-section.vue +51 -0
- package/components/tela/collapsible-section-with-actions.vue +98 -0
- package/components/tela/combobox/combobox-anchor.vue +24 -0
- package/components/tela/combobox/combobox-empty.vue +19 -0
- package/components/tela/combobox/combobox-group.vue +24 -0
- package/components/tela/combobox/combobox-indicator.vue +22 -0
- package/components/tela/combobox/combobox-input.vue +31 -0
- package/components/tela/combobox/combobox-item.vue +28 -0
- package/components/tela/combobox/combobox-label.vue +24 -0
- package/components/tela/combobox/combobox-list.vue +90 -0
- package/components/tela/combobox/combobox-module-selector.vue +366 -0
- package/components/tela/combobox/combobox-root.vue +15 -0
- package/components/tela/combobox/combobox-trigger.vue +12 -0
- package/components/tela/combobox/combobox.mdx +285 -0
- package/components/tela/combobox/combobox.stories.ts +232 -0
- package/components/tela/combobox/combobox.vue +497 -0
- package/components/tela/command/command-dialog.vue +22 -0
- package/components/tela/command/command-empty.vue +25 -0
- package/components/tela/command/command-group.vue +46 -0
- package/components/tela/command/command-input.vue +38 -0
- package/components/tela/command/command-item.vue +78 -0
- package/components/tela/command/command-list.vue +78 -0
- package/components/tela/command/command-separator.vue +23 -0
- package/components/tela/command/command-shortcut.vue +13 -0
- package/components/tela/command/command.vue +88 -0
- package/components/tela/command/dialog-base.vue +15 -0
- package/components/tela/command/dialog-content.vue +50 -0
- package/components/tela/command/utils.ts +15 -0
- package/components/tela/complex-table/complex-table-cell.stories.ts +145 -0
- package/components/tela/complex-table/complex-table-cell.vue +45 -0
- package/components/tela/complex-table/complex-table-header-cell.stories.ts +103 -0
- package/components/tela/complex-table/complex-table-header-cell.vue +48 -0
- package/components/tela/complex-table/complex-table-header.stories.ts +89 -0
- package/components/tela/complex-table/complex-table-header.vue +70 -0
- package/components/tela/complex-table/complex-table-row.vue +199 -0
- package/components/tela/complex-table/complex-table-virtualized.vue +326 -0
- package/components/tela/complex-table/complex-table.stories.ts +358 -0
- package/components/tela/complex-table/complex-table.vue +237 -0
- package/components/tela/complex-table/composables/table-common.ts +93 -0
- package/components/tela/complex-table/composables/table-selection.ts +87 -0
- package/components/tela/complex-table/composables/virtual-scroll.ts +252 -0
- package/components/tela/complex-table/styles/table-shared.css +170 -0
- package/components/tela/complex-table/types.ts +63 -0
- package/components/tela/complex-table/utils.ts +35 -0
- package/components/tela/confirm-button/confirm-button.vue +137 -0
- package/components/tela/confirmation-modal/confirmation-modal.vue +72 -0
- package/components/tela/copy-button.vue +86 -0
- package/components/tela/date-range-picker.vue +221 -0
- package/components/tela/dialog/dialog.mdx +170 -0
- package/components/tela/dialog/dialog.vue +182 -0
- package/components/tela/disabled-area.vue +16 -0
- package/components/tela/disclaimer/disclaimer.mdx +238 -0
- package/components/tela/disclaimer/disclaimer.stories.ts +196 -0
- package/components/tela/disclaimer/disclaimer.vue +125 -0
- package/components/tela/dropdown-menu/DropdownMenu.vue +121 -0
- package/components/tela/dropdown-menu/DropdownMenuCheckboxItem.vue +40 -0
- package/components/tela/dropdown-menu/DropdownMenuContent.vue +75 -0
- package/components/tela/dropdown-menu/DropdownMenuGroup.vue +12 -0
- package/components/tela/dropdown-menu/DropdownMenuItem.vue +137 -0
- package/components/tela/dropdown-menu/DropdownMenuLabel.vue +26 -0
- package/components/tela/dropdown-menu/DropdownMenuRadioGroup.vue +18 -0
- package/components/tela/dropdown-menu/DropdownMenuRadioItem.vue +40 -0
- package/components/tela/dropdown-menu/DropdownMenuRoot.vue +15 -0
- package/components/tela/dropdown-menu/DropdownMenuSeparator.vue +21 -0
- package/components/tela/dropdown-menu/DropdownMenuShortcut.vue +14 -0
- package/components/tela/dropdown-menu/DropdownMenuSub.vue +18 -0
- package/components/tela/dropdown-menu/DropdownMenuSubContent.vue +30 -0
- package/components/tela/dropdown-menu/DropdownMenuSubTrigger.vue +35 -0
- package/components/tela/dropdown-menu/DropdownMenuTrigger.vue +14 -0
- package/components/tela/dropdown-menu/dropdown-menu.mdx +265 -0
- package/components/tela/dropdown-menu/dropdown-menu.stories.ts +156 -0
- package/components/tela/expandable-input.vue +96 -0
- package/components/tela/file-drop.vue +37 -0
- package/components/tela/file-upload/file-upload.mdx +189 -0
- package/components/tela/file-upload/file-upload.stories.ts +48 -0
- package/components/tela/file-upload/file-upload.vue +205 -0
- package/components/tela/filters/checkbox-filter.stories.ts +218 -0
- package/components/tela/filters/checkbox-filter.vue +165 -0
- package/components/tela/filters/date-filter.stories.ts +258 -0
- package/components/tela/filters/date-filter.vue +200 -0
- package/components/tela/filters/user-filter.stories.ts +344 -0
- package/components/tela/filters/user-filter.vue +271 -0
- package/components/tela/hover-card/hover-card.mdx +221 -0
- package/components/tela/hover-card/hover-card.stories.ts +87 -0
- package/components/tela/hover-card/hover-card.vue +61 -0
- package/components/tela/icon/custom.vue +319 -0
- package/components/tela/icon/spinner.vue +12 -0
- package/components/tela/icon-button/icon-button.vue +114 -0
- package/components/tela/icon.vue +37 -0
- package/components/tela/initials.vue +28 -0
- package/components/tela/inline-input.vue +77 -0
- package/components/tela/input/input.mdx +182 -0
- package/components/tela/input/input.stories.ts +153 -0
- package/components/tela/input/tela-input.vue +240 -0
- package/components/tela/kbd/kbd-return.vue +6 -0
- package/components/tela/kbd/kbd.mdx +238 -0
- package/components/tela/kbd/kbd.vue +18 -0
- package/components/tela/label/label.mdx +121 -0
- package/components/tela/label/label.stories.ts +37 -0
- package/components/tela/label/label.vue +25 -0
- package/components/tela/link-decoration/link-decoration.vue +19 -0
- package/components/tela/live-label.vue +32 -0
- package/components/tela/long-press-button.vue +98 -0
- package/components/tela/menubar/menubar-content.vue +77 -0
- package/components/tela/menubar/menubar-item.vue +32 -0
- package/components/tela/menubar/menubar-label.vue +14 -0
- package/components/tela/menubar/menubar-menu.vue +12 -0
- package/components/tela/menubar/menubar-root.vue +30 -0
- package/components/tela/menubar/menubar-separator.vue +17 -0
- package/components/tela/menubar/menubar-shortcut.vue +14 -0
- package/components/tela/menubar/menubar-sub-content.vue +36 -0
- package/components/tela/menubar/menubar-sub-trigger.vue +28 -0
- package/components/tela/menubar/menubar-sub.vue +20 -0
- package/components/tela/menubar/menubar-trigger.vue +27 -0
- package/components/tela/menubar/menubar.vue +298 -0
- package/components/tela/modal/modal.mdx +145 -0
- package/components/tela/modal/modal.vue +242 -0
- package/components/tela/multiple-select/multiple-select.mdx +274 -0
- package/components/tela/multiple-select/multiple-select.stories.ts +325 -0
- package/components/tela/multiple-select/multiple-select.vue +666 -0
- package/components/tela/pane.vue +110 -0
- package/components/tela/popover/popover-content.vue +48 -0
- package/components/tela/popover/popover-trigger.vue +12 -0
- package/components/tela/popover/popover.mdx +239 -0
- package/components/tela/popover/popover.stories.ts +150 -0
- package/components/tela/popover/popover.vue +15 -0
- package/components/tela/popover-list/popover-list-nested.vue +104 -0
- package/components/tela/popover-list/popover-list.stories.ts +330 -0
- package/components/tela/popover-list/popover-list.vue +191 -0
- package/components/tela/radio-button.vue +66 -0
- package/components/tela/radio-group/radio-group-item.vue +40 -0
- package/components/tela/radio-group/radio-group-root.vue +26 -0
- package/components/tela/radio-group/radio-group.mdx +78 -0
- package/components/tela/radio-group/radio-group.stories.ts +106 -0
- package/components/tela/radio-group/radio-group.vue +23 -0
- package/components/tela/range-calendar.stories.ts +110 -0
- package/components/tela/range-calendar.vue +109 -0
- package/components/tela/scroll-area/scroll-area.mdx +183 -0
- package/components/tela/scroll-area/scroll-area.vue +30 -0
- package/components/tela/scroll-area/scroll-bar.vue +31 -0
- package/components/tela/segment-toggle.stories.ts +114 -0
- package/components/tela/segment-toggle.vue +66 -0
- package/components/tela/select-menu/select-menu-content.vue +106 -0
- package/components/tela/select-menu/select-menu-down-button.vue +20 -0
- package/components/tela/select-menu/select-menu-group.vue +16 -0
- package/components/tela/select-menu/select-menu-item.vue +40 -0
- package/components/tela/select-menu/select-menu-root.vue +15 -0
- package/components/tela/select-menu/select-menu-trigger.vue +34 -0
- package/components/tela/select-menu/select-menu-up-button.vue +20 -0
- package/components/tela/select-menu/select-menu-value.vue +12 -0
- package/components/tela/select-menu/select-menu.mdx +221 -0
- package/components/tela/select-menu/select-menu.stories.ts +91 -0
- package/components/tela/select-menu/select-menu.vue +165 -0
- package/components/tela/selector/selector.vue +47 -0
- package/components/tela/sheet/sheet-close.vue +12 -0
- package/components/tela/sheet/sheet-content.vue +57 -0
- package/components/tela/sheet/sheet-description.vue +23 -0
- package/components/tela/sheet/sheet-footer.vue +18 -0
- package/components/tela/sheet/sheet-header.vue +15 -0
- package/components/tela/sheet/sheet-root.vue +18 -0
- package/components/tela/sheet/sheet-title.vue +23 -0
- package/components/tela/sheet/sheet-trigger.vue +12 -0
- package/components/tela/sheet/sheet.client.vue +150 -0
- package/components/tela/sheet/sheet.mdx +176 -0
- package/components/tela/sheet/sheet.stories.ts +201 -0
- package/components/tela/sheet/variants.ts +22 -0
- package/components/tela/side-sheet/side-sheet.mdx +131 -0
- package/components/tela/side-sheet/side-sheet.stories.ts +134 -0
- package/components/tela/side-sheet/side-sheet.vue +106 -0
- package/components/tela/skeleton/skeleton.mdx +165 -0
- package/components/tela/skeleton/skeleton.stories.ts +35 -0
- package/components/tela/skeleton/skeleton.vue +45 -0
- package/components/tela/skeleton-icon.vue +24 -0
- package/components/tela/span.vue +24 -0
- package/components/tela/star-button.vue +70 -0
- package/components/tela/status/status-lean.vue +30 -0
- package/components/tela/status/status.mdx +187 -0
- package/components/tela/status/status.stories.ts +160 -0
- package/components/tela/status/status.vue +420 -0
- package/components/tela/status-bar/status-bar.mdx +178 -0
- package/components/tela/status-bar/status-bar.stories.ts +64 -0
- package/components/tela/status-bar/status-bar.vue +56 -0
- package/components/tela/status-bar/types.ts +5 -0
- package/components/tela/switch/switch.mdx +118 -0
- package/components/tela/switch/switch.stories.ts +80 -0
- package/components/tela/switch/switch.vue +56 -0
- package/components/tela/table/table-body.vue +13 -0
- package/components/tela/table/table-caption.vue +13 -0
- package/components/tela/table/table-cell.vue +20 -0
- package/components/tela/table/table-empty.vue +37 -0
- package/components/tela/table/table-footer.vue +13 -0
- package/components/tela/table/table-head.vue +13 -0
- package/components/tela/table/table-header.vue +13 -0
- package/components/tela/table/table-row.vue +13 -0
- package/components/tela/table/table.mdx +230 -0
- package/components/tela/table/table.stories.ts +384 -0
- package/components/tela/table/table.vue +15 -0
- package/components/tela/tabs/tabs-content.vue +20 -0
- package/components/tela/tabs/tabs-indicator.vue +22 -0
- package/components/tela/tabs/tabs-list.vue +23 -0
- package/components/tela/tabs/tabs-root.vue +15 -0
- package/components/tela/tabs/tabs-trigger.vue +27 -0
- package/components/tela/tabs/tabs.mdx +138 -0
- package/components/tela/tabs/tabs.stories.ts +72 -0
- package/components/tela/tabs/tabs.vue +61 -0
- package/components/tela/tags/tags-select.mdx +318 -0
- package/components/tela/tags/tags-select.stories.ts +47 -0
- package/components/tela/tags/tags-select.vue +637 -0
- package/components/tela/tags/tags.mdx +151 -0
- package/components/tela/tags/tags.stories.ts +118 -0
- package/components/tela/tags/tags.vue +112 -0
- package/components/tela/textarea/textarea.mdx +102 -0
- package/components/tela/textarea/textarea.stories.ts +50 -0
- package/components/tela/textarea/textarea.vue +34 -0
- package/components/tela/toggle-group.vue +91 -0
- package/components/tela/tooltip/tooltip-content.vue +45 -0
- package/components/tela/tooltip/tooltip-provider.vue +12 -0
- package/components/tela/tooltip/tooltip-root.vue +15 -0
- package/components/tela/tooltip/tooltip-trigger.vue +12 -0
- package/components/tela/tooltip/tooltip.mdx +196 -0
- package/components/tela/tooltip/tooltip.stories.ts +200 -0
- package/components/tela/tooltip/tooltip.vue +91 -0
- package/components/tela/tooltip-group/tooltip-group-trigger.vue +92 -0
- package/components/tela/tooltip-group/tooltip-group.mdx +236 -0
- package/components/tela/tooltip-group/tooltip-group.stories.ts +465 -0
- package/components/tela/tooltip-group/tooltip-group.vue +35 -0
- package/components/tela/transparent-input.vue +151 -0
- package/components/tela/variable-icon.vue +28 -0
- package/components/tela/variable-input.vue +77 -0
- package/components/tela/wide-button/wide-button.vue +40 -0
- package/components.json +18 -0
- package/composables/status-toast.ts +67 -0
- package/css/reset.css +386 -0
- package/css/text.css +22 -0
- package/lib/doc-generator.ts +903 -0
- package/lib/extractors/volar-extract.ts +186 -0
- package/lib/type-resolver.ts +402 -0
- package/lib/utils.ts +6 -0
- package/modules/tela-build-docs/index.ts +139 -0
- package/nuxt.config.ts +80 -0
- package/package.json +84 -0
- package/plugins/test-id.ts +7 -0
- package/tsconfig.json +7 -0
- package/types/custom-icon.ts +1 -0
- package/types/index.ts +2 -0
- package/types/status.ts +1 -0
- package/unocss.config.ts +89 -0
- package/utils/component-utils.ts +30 -0
- package/utils/design-tokens.ts +431 -0
- package/utils/fold.ts +8 -0
- package/utils/select-menu.ts +10 -0
- package/utils/status.ts +1 -0
- package/utils/without-keys.ts +34 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { Meta, Canvas, ArgTypes } from '@storybook/blocks';
|
|
2
|
+
import * as RadioGroupStories from './radio-group.stories';
|
|
3
|
+
|
|
4
|
+
<Meta of={RadioGroupStories} />
|
|
5
|
+
|
|
6
|
+
# TelaRadioGroup
|
|
7
|
+
|
|
8
|
+
Radio group component for selecting one option from mutually exclusive choices.
|
|
9
|
+
|
|
10
|
+
## Examples
|
|
11
|
+
|
|
12
|
+
### With Label
|
|
13
|
+
|
|
14
|
+
<Canvas of={RadioGroupStories.WithLabel} />
|
|
15
|
+
|
|
16
|
+
### Disabled
|
|
17
|
+
|
|
18
|
+
<Canvas of={RadioGroupStories.Disabled} />
|
|
19
|
+
|
|
20
|
+
### Basic Usage
|
|
21
|
+
|
|
22
|
+
```vue
|
|
23
|
+
<TelaRadioGroup
|
|
24
|
+
:options="[
|
|
25
|
+
{ label: 'Small', value: 'small' },
|
|
26
|
+
{ label: 'Medium', value: 'medium' },
|
|
27
|
+
{ label: 'Large', value: 'large' }
|
|
28
|
+
]"
|
|
29
|
+
default-value="medium"
|
|
30
|
+
/>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Horizontal Layout
|
|
34
|
+
|
|
35
|
+
```vue
|
|
36
|
+
<TelaRadioGroup
|
|
37
|
+
:options="options"
|
|
38
|
+
orientation="horizontal"
|
|
39
|
+
default-value="option1"
|
|
40
|
+
/>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Manual Construction
|
|
44
|
+
|
|
45
|
+
```vue
|
|
46
|
+
<TelaRadioGroupRoot default-value="comfortable">
|
|
47
|
+
<div class="flex items-center">
|
|
48
|
+
<TelaRadioGroupItem id="default" value="default" />
|
|
49
|
+
<label for="default" class="text-black-900 text-[14px] pl-2 cursor-pointer">
|
|
50
|
+
Default
|
|
51
|
+
</label>
|
|
52
|
+
</div>
|
|
53
|
+
<div class="flex items-center">
|
|
54
|
+
<TelaRadioGroupItem id="comfortable" value="comfortable" />
|
|
55
|
+
<label for="comfortable" class="text-black-900 text-[14px] pl-2 cursor-pointer">
|
|
56
|
+
Comfortable
|
|
57
|
+
</label>
|
|
58
|
+
</div>
|
|
59
|
+
</TelaRadioGroupRoot>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Props
|
|
63
|
+
|
|
64
|
+
<ArgTypes />
|
|
65
|
+
|
|
66
|
+
```typescript
|
|
67
|
+
type Option = {
|
|
68
|
+
label: string
|
|
69
|
+
value: string
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Components
|
|
74
|
+
|
|
75
|
+
The RadioGroup consists of these components:
|
|
76
|
+
- `TelaRadioGroup` - High-level component with options array
|
|
77
|
+
- `TelaRadioGroupRoot` - Container for radio items (extends reka-ui)
|
|
78
|
+
- `TelaRadioGroupItem` - Individual radio button (extends reka-ui)
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
2
|
+
import RadioGroupRoot from './radio-group-root.vue'
|
|
3
|
+
import RadioGroupItem from './radio-group-item.vue'
|
|
4
|
+
import TelaRadioGroup from './radio-group.vue'
|
|
5
|
+
|
|
6
|
+
const meta: Meta<typeof TelaRadioGroup> = {
|
|
7
|
+
title: 'Core/RadioGroup',
|
|
8
|
+
component: TelaRadioGroup,
|
|
9
|
+
parameters: {
|
|
10
|
+
layout: 'centered',
|
|
11
|
+
docs: {
|
|
12
|
+
description: {
|
|
13
|
+
component: 'A radio group component that allows users to select a single option from a set of mutually exclusive choices. Built on reka-ui with support for v-model binding, disabled states, and horizontal/vertical orientations. Also includes a higher-level TelaRadioGroup component that accepts options as props.',
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
argTypes: {
|
|
18
|
+
options: {
|
|
19
|
+
description: 'Array of options with label and value',
|
|
20
|
+
control: { type: 'object' },
|
|
21
|
+
},
|
|
22
|
+
defaultValue: {
|
|
23
|
+
description: 'Default selected value',
|
|
24
|
+
control: { type: 'text' },
|
|
25
|
+
},
|
|
26
|
+
orientation: {
|
|
27
|
+
description: 'Layout orientation',
|
|
28
|
+
control: { type: 'select' },
|
|
29
|
+
options: ['vertical', 'horizontal'],
|
|
30
|
+
defaultValue: 'vertical',
|
|
31
|
+
},
|
|
32
|
+
class: {
|
|
33
|
+
description: 'Additional CSS classes',
|
|
34
|
+
control: { type: 'text' },
|
|
35
|
+
table: {
|
|
36
|
+
type: { summary: 'string' },
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export default meta
|
|
43
|
+
|
|
44
|
+
type Story = StoryObj<typeof meta>
|
|
45
|
+
|
|
46
|
+
export const Default: Story = {
|
|
47
|
+
render: () => ({
|
|
48
|
+
components: { RadioGroupRoot, RadioGroupItem },
|
|
49
|
+
template: `<RadioGroupRoot>
|
|
50
|
+
<RadioGroupItem value="r1" />
|
|
51
|
+
</RadioGroupRoot>`,
|
|
52
|
+
}),
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export const Disabled: Story = {
|
|
56
|
+
render: () => ({
|
|
57
|
+
components: { RadioGroupRoot, RadioGroupItem },
|
|
58
|
+
template: `<div class="flex gap-6px">
|
|
59
|
+
<RadioGroupRoot default-value="r1">
|
|
60
|
+
<RadioGroupItem value="r1" disabled />
|
|
61
|
+
</RadioGroupRoot>
|
|
62
|
+
<RadioGroupRoot>
|
|
63
|
+
<RadioGroupItem value="r1" disabled />
|
|
64
|
+
</RadioGroupRoot>
|
|
65
|
+
</div>`,
|
|
66
|
+
}),
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export const WithLabel: Story = {
|
|
70
|
+
render: () => ({
|
|
71
|
+
components: { RadioGroupRoot, RadioGroupItem },
|
|
72
|
+
template: `<RadioGroupRoot default-value="comfortable" orientation="horizontal">
|
|
73
|
+
<div class="flex items-center">
|
|
74
|
+
<RadioGroupItem id="r1" value="default" />
|
|
75
|
+
<label for="r1" class="text-gray-900 text-[14px] pl-2 cursor-pointer">Default</label>
|
|
76
|
+
</div>
|
|
77
|
+
<div class="flex items-center">
|
|
78
|
+
<RadioGroupItem id="r2" value="comfortable" />
|
|
79
|
+
<label for="r2" class="text-gray-900 text-[14px] pl-2 cursor-pointer">Comfortable</label>
|
|
80
|
+
</div>
|
|
81
|
+
<div class="flex items-center">
|
|
82
|
+
<RadioGroupItem id="r3" value="compact" />
|
|
83
|
+
<label for="r3" class="text-gray-900 text-[14px] pl-2 cursor-pointer">Compact</label>
|
|
84
|
+
</div>
|
|
85
|
+
</RadioGroupRoot>`,
|
|
86
|
+
}),
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export const WithProps: StoryObj<Meta<typeof TelaRadioGroup>> = {
|
|
90
|
+
args: {
|
|
91
|
+
options: [
|
|
92
|
+
{ label: 'Small', value: 'small' },
|
|
93
|
+
{ label: 'Medium', value: 'medium' },
|
|
94
|
+
{ label: 'Large', value: 'large' },
|
|
95
|
+
],
|
|
96
|
+
defaultValue: 'small',
|
|
97
|
+
orientation: 'vertical',
|
|
98
|
+
},
|
|
99
|
+
render: args => ({
|
|
100
|
+
components: { TelaRadioGroup },
|
|
101
|
+
setup() {
|
|
102
|
+
return { args }
|
|
103
|
+
},
|
|
104
|
+
template: `<TelaRadioGroup v-bind="args" />`,
|
|
105
|
+
}),
|
|
106
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'vue'
|
|
3
|
+
|
|
4
|
+
type Option = {
|
|
5
|
+
label: string
|
|
6
|
+
value: string
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
defineProps<{ class?: HTMLAttributes['class'], options: Option[], defaultValue?: string, orientation?: 'vertical' | 'horizontal' }>()
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<TelaRadioGroupRoot :default-value="defaultValue" :orientation="orientation">
|
|
14
|
+
<div
|
|
15
|
+
v-for="option in options"
|
|
16
|
+
:key="option.value"
|
|
17
|
+
class="flex items-center"
|
|
18
|
+
>
|
|
19
|
+
<TelaRadioGroupItem :id="option.value" :value="option.value" />
|
|
20
|
+
<label :for="option.value" class="text-gray-900 text-[14px] pl-2 cursor-pointer">{{ option.label }}</label>
|
|
21
|
+
</div>
|
|
22
|
+
</TelaRadioGroupRoot>
|
|
23
|
+
</template>
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
2
|
+
import TelaRangeCalendar from './range-calendar.vue'
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof TelaRangeCalendar> = {
|
|
5
|
+
title: 'Tela/RangeCalendar',
|
|
6
|
+
component: TelaRangeCalendar,
|
|
7
|
+
tags: ['autodocs'],
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: 'centered',
|
|
10
|
+
docs: {
|
|
11
|
+
description: {
|
|
12
|
+
component: 'A range calendar component built with Radix Vue that allows users to select a date range with an intuitive calendar interface. Supports date range selection, navigation between months, and customizable styling. Useful for date pickers, booking systems, and scheduling interfaces.',
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
argTypes: {
|
|
17
|
+
modelValue: {
|
|
18
|
+
control: 'object',
|
|
19
|
+
description: 'The selected date range (v-model). Should be an object with `start` and `end` date properties.',
|
|
20
|
+
},
|
|
21
|
+
disabled: {
|
|
22
|
+
control: 'boolean',
|
|
23
|
+
description: 'Disable date selection and navigation.',
|
|
24
|
+
},
|
|
25
|
+
minDate: {
|
|
26
|
+
control: 'object',
|
|
27
|
+
description: 'Minimum selectable date. Dates before this will be disabled.',
|
|
28
|
+
},
|
|
29
|
+
maxDate: {
|
|
30
|
+
control: 'object',
|
|
31
|
+
description: 'Maximum selectable date. Dates after this will be disabled.',
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
render: () => {
|
|
35
|
+
return {
|
|
36
|
+
components: { TelaRangeCalendar },
|
|
37
|
+
template: `
|
|
38
|
+
<div style="padding: 20px; display: flex; justify-content: center;">
|
|
39
|
+
<TelaRangeCalendar />
|
|
40
|
+
</div>
|
|
41
|
+
`,
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export default meta
|
|
47
|
+
type Story = StoryObj<typeof TelaRangeCalendar>
|
|
48
|
+
|
|
49
|
+
export const Default: Story = {
|
|
50
|
+
name: 'Default',
|
|
51
|
+
render: () => ({
|
|
52
|
+
components: { TelaRangeCalendar },
|
|
53
|
+
template: `
|
|
54
|
+
<div style="padding: 20px; display: flex; justify-content: center;">
|
|
55
|
+
<TelaRangeCalendar />
|
|
56
|
+
</div>
|
|
57
|
+
`,
|
|
58
|
+
}),
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export const InContainer: Story = {
|
|
62
|
+
name: 'In Container',
|
|
63
|
+
render: () => ({
|
|
64
|
+
components: { TelaRangeCalendar },
|
|
65
|
+
template: `
|
|
66
|
+
<div style="padding: 20px; border: 1px solid #e5e7eb; border-radius: 8px; max-width: 600px; margin: 0 auto;">
|
|
67
|
+
<h3 style="margin: 0 0 16px 0; font-size: 18px; font-weight: 600;">Select Date Range</h3>
|
|
68
|
+
<TelaRangeCalendar />
|
|
69
|
+
</div>
|
|
70
|
+
`,
|
|
71
|
+
}),
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export const WithBackground: Story = {
|
|
75
|
+
name: 'With Background',
|
|
76
|
+
render: () => ({
|
|
77
|
+
components: { TelaRangeCalendar },
|
|
78
|
+
template: `
|
|
79
|
+
<div style="padding: 40px; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); min-height: 400px; display: flex; justify-content: center; align-items: center;">
|
|
80
|
+
<TelaRangeCalendar />
|
|
81
|
+
</div>
|
|
82
|
+
`,
|
|
83
|
+
}),
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export const Centered: Story = {
|
|
87
|
+
name: 'Centered Layout',
|
|
88
|
+
render: () => ({
|
|
89
|
+
components: { TelaRangeCalendar },
|
|
90
|
+
template: `
|
|
91
|
+
<div style="padding: 40px; display: flex; flex-direction: column; align-items: center; gap: 20px;">
|
|
92
|
+
<h2 style="margin: 0; color: #374151;">Choose Your Dates</h2>
|
|
93
|
+
<p style="margin: 0; color: #6b7280; text-align: center;">Select a start and end date for your reservation</p>
|
|
94
|
+
<TelaRangeCalendar />
|
|
95
|
+
</div>
|
|
96
|
+
`,
|
|
97
|
+
}),
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export const CompactView: Story = {
|
|
101
|
+
name: 'Compact View',
|
|
102
|
+
render: () => ({
|
|
103
|
+
components: { TelaRangeCalendar },
|
|
104
|
+
template: `
|
|
105
|
+
<div style="padding: 10px; max-width: 400px;">
|
|
106
|
+
<TelaRangeCalendar />
|
|
107
|
+
</div>
|
|
108
|
+
`,
|
|
109
|
+
}),
|
|
110
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { Icon } from '@iconify/vue'
|
|
3
|
+
import { RangeCalendarCell, RangeCalendarCellTrigger, RangeCalendarGrid, RangeCalendarGridBody, RangeCalendarGridHead, RangeCalendarGridRow, RangeCalendarHeadCell, RangeCalendarHeader, RangeCalendarHeading, RangeCalendarNext, RangeCalendarPrev, RangeCalendarRoot } from 'radix-vue'
|
|
4
|
+
</script>
|
|
5
|
+
|
|
6
|
+
<template>
|
|
7
|
+
<RangeCalendarRoot
|
|
8
|
+
v-slot="{ weekDays, grid }"
|
|
9
|
+
bg-white
|
|
10
|
+
rounded-xl
|
|
11
|
+
p-4
|
|
12
|
+
shadow-xl
|
|
13
|
+
fixed-weeks
|
|
14
|
+
>
|
|
15
|
+
<RangeCalendarHeader flex="~ items-center justify-between">
|
|
16
|
+
<RangeCalendarPrev
|
|
17
|
+
flex="~ items-center justify-center"
|
|
18
|
+
cursor-pointer
|
|
19
|
+
text-black
|
|
20
|
+
rounded-9px
|
|
21
|
+
bg-transparent
|
|
22
|
+
w-8 h-8
|
|
23
|
+
hover:bg-gray-200
|
|
24
|
+
class="active:scale-98 active:transition-all focus:shadow-[0_0_0_2px] focus:shadow-black"
|
|
25
|
+
>
|
|
26
|
+
<Icon
|
|
27
|
+
icon="radix-icons:chevron-left"
|
|
28
|
+
w-6 h-6
|
|
29
|
+
/>
|
|
30
|
+
</RangeCalendarPrev>
|
|
31
|
+
<RangeCalendarHeading body-14-semibold text-black />
|
|
32
|
+
<RangeCalendarNext
|
|
33
|
+
flex="~ items-center justify-center"
|
|
34
|
+
cursor-pointer
|
|
35
|
+
text-black
|
|
36
|
+
rounded-9px
|
|
37
|
+
bg-transparent
|
|
38
|
+
w-8 h-8
|
|
39
|
+
hover:bg-gray-200
|
|
40
|
+
class="active:scale-98 active:transition-all focus:shadow-[0_0_0_2px] focus:shadow-black"
|
|
41
|
+
>
|
|
42
|
+
<Icon
|
|
43
|
+
icon="radix-icons:chevron-right"
|
|
44
|
+
w-6 h-6
|
|
45
|
+
/>
|
|
46
|
+
</RangeCalendarNext>
|
|
47
|
+
</RangeCalendarHeader>
|
|
48
|
+
<div
|
|
49
|
+
flex="~ col"
|
|
50
|
+
space-y-4
|
|
51
|
+
pt-4
|
|
52
|
+
sm:flex-row
|
|
53
|
+
sm:space-x-4
|
|
54
|
+
sm:space-y-0
|
|
55
|
+
>
|
|
56
|
+
<RangeCalendarGrid
|
|
57
|
+
v-for="month in grid"
|
|
58
|
+
:key="month.value.toString()"
|
|
59
|
+
w-full
|
|
60
|
+
border-collapse
|
|
61
|
+
select-none
|
|
62
|
+
space-y-1
|
|
63
|
+
>
|
|
64
|
+
<RangeCalendarGridHead>
|
|
65
|
+
<RangeCalendarGridRow w-full flex="~ justify-between" mb-1>
|
|
66
|
+
<RangeCalendarHeadCell
|
|
67
|
+
v-for="day in weekDays"
|
|
68
|
+
:key="day"
|
|
69
|
+
w-8
|
|
70
|
+
rounded-md
|
|
71
|
+
body-12-semibold
|
|
72
|
+
text-black
|
|
73
|
+
>
|
|
74
|
+
{{ day }}
|
|
75
|
+
</RangeCalendarHeadCell>
|
|
76
|
+
</RangeCalendarGridRow>
|
|
77
|
+
</RangeCalendarGridHead>
|
|
78
|
+
<RangeCalendarGridBody>
|
|
79
|
+
<RangeCalendarGridRow
|
|
80
|
+
v-for="(weekDates, index) in month.rows"
|
|
81
|
+
:key="`weekDate-${index}`"
|
|
82
|
+
flex="~ justify-between"
|
|
83
|
+
w-full
|
|
84
|
+
>
|
|
85
|
+
<RangeCalendarCell
|
|
86
|
+
v-for="weekDate in weekDates"
|
|
87
|
+
:key="weekDate.toString()"
|
|
88
|
+
:date="weekDate"
|
|
89
|
+
>
|
|
90
|
+
<RangeCalendarCellTrigger
|
|
91
|
+
:day="weekDate"
|
|
92
|
+
:month="month.value"
|
|
93
|
+
relative
|
|
94
|
+
flex="~ items-center justify-center"
|
|
95
|
+
rounded-full
|
|
96
|
+
whitespace-nowrap
|
|
97
|
+
body-12-semibold
|
|
98
|
+
text-black
|
|
99
|
+
w-8 h-8
|
|
100
|
+
outline-none
|
|
101
|
+
class=" hover:bg-white! hover:shadow-[#2563eb] hover:shadow-[0_0_0_2px] data-[outside-view]:text-black/30 data-[selected]:!bg-blue-200 data-[selected]:text-[#1e3a8a]! hover:bg-blue-200 data-[highlighted]:bg-blue-200 data-[highlighted]:text-[#1e3a8a]! data-[unavailable]:pointer-events-none data-[unavailable]:text-black/30 data-[unavailable]:line-through before:absolute before:top-[5px] before:hidden before:rounded-full before:w-1 before:h-1 before:bg-white data-[today]:before:block data-[today]:text-[#1e3a8a]! data-[today]:underline data-[today]:underline-offset-4"
|
|
102
|
+
/>
|
|
103
|
+
</RangeCalendarCell>
|
|
104
|
+
</RangeCalendarGridRow>
|
|
105
|
+
</RangeCalendarGridBody>
|
|
106
|
+
</RangeCalendarGrid>
|
|
107
|
+
</div>
|
|
108
|
+
</RangeCalendarRoot>
|
|
109
|
+
</template>
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { Meta, ArgTypes } from '@storybook/blocks';
|
|
2
|
+
|
|
3
|
+
<Meta title="Utility/ScrollArea" />
|
|
4
|
+
|
|
5
|
+
# TelaScrollArea
|
|
6
|
+
|
|
7
|
+
A scroll area component that provides custom-styled scrollbars. Built on reka-ui for consistent scrollbar appearance across browsers. Useful for creating scrollable containers with better visual consistency than native scrollbars.
|
|
8
|
+
|
|
9
|
+
## Components
|
|
10
|
+
|
|
11
|
+
- `TelaScrollArea` - Root scroll container
|
|
12
|
+
- `TelaScrollAreaViewport` - Scrollable viewport
|
|
13
|
+
- `TelaScrollAreaScrollbar` - Custom scrollbar
|
|
14
|
+
- `TelaScrollAreaThumb` - Scrollbar thumb
|
|
15
|
+
|
|
16
|
+
## Props
|
|
17
|
+
|
|
18
|
+
```typescript
|
|
19
|
+
type ScrollAreaProps = {
|
|
20
|
+
type?: 'auto' | 'always' | 'scroll' | 'hover'
|
|
21
|
+
dir?: 'ltr' | 'rtl'
|
|
22
|
+
scrollHideDelay?: number
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Examples
|
|
27
|
+
|
|
28
|
+
### Basic Usage
|
|
29
|
+
|
|
30
|
+
```vue
|
|
31
|
+
<TelaScrollArea class="h-200px w-350px">
|
|
32
|
+
<div class="p-4">
|
|
33
|
+
<p>Long content that needs scrolling...</p>
|
|
34
|
+
<p>More content...</p>
|
|
35
|
+
<p>Even more content...</p>
|
|
36
|
+
<!-- ... many more lines -->
|
|
37
|
+
</div>
|
|
38
|
+
</TelaScrollArea>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### With Custom Height
|
|
42
|
+
|
|
43
|
+
```vue
|
|
44
|
+
<TelaScrollArea class="h-96 w-full">
|
|
45
|
+
<div class="space-y-4">
|
|
46
|
+
{/* Long list of items */}
|
|
47
|
+
</div>
|
|
48
|
+
</TelaScrollArea>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Horizontal Scroll
|
|
52
|
+
|
|
53
|
+
```vue
|
|
54
|
+
<TelaScrollArea class="w-full">
|
|
55
|
+
<div class="flex gap-4 p-4" style="width: 2000px">
|
|
56
|
+
<div v-for="i in 20" :key="i" class="flex-shrink-0 w-200px h-150px bg-gray-200 rounded">
|
|
57
|
+
Item {{ i }}
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
</TelaScrollArea>
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Both Directions
|
|
64
|
+
|
|
65
|
+
```vue
|
|
66
|
+
<TelaScrollArea class="h-400px w-600px">
|
|
67
|
+
<div style="width: 1200px">
|
|
68
|
+
<div v-for="i in 50" :key="i" class="p-4 border-b">
|
|
69
|
+
Row {{ i }} with very long content that extends beyond the visible area horizontally
|
|
70
|
+
</div>
|
|
71
|
+
</div>
|
|
72
|
+
</TelaScrollArea>
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Auto Hide
|
|
76
|
+
|
|
77
|
+
```vue
|
|
78
|
+
<TelaScrollArea
|
|
79
|
+
type="hover"
|
|
80
|
+
:scroll-hide-delay="600"
|
|
81
|
+
class="h-300px w-400px"
|
|
82
|
+
>
|
|
83
|
+
<div class="p-4">
|
|
84
|
+
Scrollbars appear on hover and hide after 600ms
|
|
85
|
+
</div>
|
|
86
|
+
</TelaScrollArea>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Always Visible
|
|
90
|
+
|
|
91
|
+
```vue
|
|
92
|
+
<TelaScrollArea
|
|
93
|
+
type="always"
|
|
94
|
+
class="h-300px w-400px"
|
|
95
|
+
>
|
|
96
|
+
<div class="p-4">
|
|
97
|
+
Scrollbars always visible
|
|
98
|
+
</div>
|
|
99
|
+
</TelaScrollArea>
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Chat Messages
|
|
103
|
+
|
|
104
|
+
```vue
|
|
105
|
+
<TelaScrollArea class="h-500px w-350px">
|
|
106
|
+
<div class="p-4 space-y-3">
|
|
107
|
+
<div v-for="message in messages" :key="message.id" class="flex gap-2">
|
|
108
|
+
<TelaAvatar :src="message.avatar" size="sm" />
|
|
109
|
+
<div>
|
|
110
|
+
<div class="font-semibold">{{ message.author }}</div>
|
|
111
|
+
<div class="text-sm">{{ message.content }}</div>
|
|
112
|
+
</div>
|
|
113
|
+
</div>
|
|
114
|
+
</div>
|
|
115
|
+
</TelaScrollArea>
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Data Table
|
|
119
|
+
|
|
120
|
+
```vue
|
|
121
|
+
<TelaScrollArea class="h-400px w-full">
|
|
122
|
+
<table class="w-full">
|
|
123
|
+
<thead class="sticky top-0 bg-white">
|
|
124
|
+
<tr>
|
|
125
|
+
<th>Name</th>
|
|
126
|
+
<th>Email</th>
|
|
127
|
+
<th>Role</th>
|
|
128
|
+
</tr>
|
|
129
|
+
</thead>
|
|
130
|
+
<tbody>
|
|
131
|
+
<tr v-for="user in users" :key="user.id">
|
|
132
|
+
<td>{{ user.name }}</td>
|
|
133
|
+
<td>{{ user.email }}</td>
|
|
134
|
+
<td>{{ user.role }}</td>
|
|
135
|
+
</tr>
|
|
136
|
+
</tbody>
|
|
137
|
+
</table>
|
|
138
|
+
</TelaScrollArea>
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Scroll Types
|
|
142
|
+
|
|
143
|
+
- **auto**: Native scrollbar behavior
|
|
144
|
+
- **always**: Scrollbars always visible
|
|
145
|
+
- **scroll**: Scrollbars visible when scrolling
|
|
146
|
+
- **hover**: Scrollbars appear on hover
|
|
147
|
+
|
|
148
|
+
## Features
|
|
149
|
+
|
|
150
|
+
- **Custom Styled**: Consistent scrollbar appearance
|
|
151
|
+
- **Cross-browser**: Works the same everywhere
|
|
152
|
+
- **Both Directions**: Horizontal and vertical scrolling
|
|
153
|
+
- **Auto Hide**: Hide scrollbars when not in use
|
|
154
|
+
- **Smooth Scrolling**: Native smooth scroll support
|
|
155
|
+
- **Accessible**: Keyboard navigation support
|
|
156
|
+
- **Touch Friendly**: Works on touch devices
|
|
157
|
+
|
|
158
|
+
## Use Cases
|
|
159
|
+
|
|
160
|
+
- **Chat Windows**: Scrollable message lists
|
|
161
|
+
- **Data Tables**: Large datasets
|
|
162
|
+
- **Content Panels**: Long-form content
|
|
163
|
+
- **Image Galleries**: Horizontal scrolling
|
|
164
|
+
- **Sidebars**: Scrollable navigation
|
|
165
|
+
- **Modals**: Scrollable modal content
|
|
166
|
+
|
|
167
|
+
## Best Practices
|
|
168
|
+
|
|
169
|
+
1. **Set Explicit Height**: Always set height on container
|
|
170
|
+
2. **Use Auto Type**: Best for most cases
|
|
171
|
+
3. **Consider Content**: Horizontal scroll for wide content
|
|
172
|
+
4. **Sticky Headers**: Use for table headers
|
|
173
|
+
5. **Scroll Padding**: Add padding to scrollable content
|
|
174
|
+
|
|
175
|
+
## Accessibility
|
|
176
|
+
|
|
177
|
+
- Built on reka-ui primitives
|
|
178
|
+
- Keyboard navigation (Arrow keys, Page Up/Down)
|
|
179
|
+
- Focus scrolling support
|
|
180
|
+
- Screen reader compatible
|
|
181
|
+
- Respects reduced motion preferences
|
|
182
|
+
- Native scroll behavior maintained
|
|
183
|
+
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import {
|
|
3
|
+
ScrollAreaCorner,
|
|
4
|
+
ScrollAreaRoot,
|
|
5
|
+
|
|
6
|
+
ScrollAreaViewport,
|
|
7
|
+
} from 'reka-ui'
|
|
8
|
+
import type { ScrollAreaRootProps } from 'reka-ui'
|
|
9
|
+
import { computed } from 'vue'
|
|
10
|
+
import type { HTMLAttributes } from 'vue'
|
|
11
|
+
import ScrollBar from './scroll-bar.vue'
|
|
12
|
+
|
|
13
|
+
const props = defineProps<ScrollAreaRootProps & { class?: HTMLAttributes['class'] }>()
|
|
14
|
+
|
|
15
|
+
const delegatedProps = computed(() => {
|
|
16
|
+
const { class: _, ...delegated } = props
|
|
17
|
+
|
|
18
|
+
return delegated
|
|
19
|
+
})
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<template>
|
|
23
|
+
<ScrollAreaRoot v-bind="delegatedProps" :class="cn('relative overflow-hidden', props.class)">
|
|
24
|
+
<ScrollAreaViewport class="h-full w-full rounded-[inherit]">
|
|
25
|
+
<slot />
|
|
26
|
+
</ScrollAreaViewport>
|
|
27
|
+
<ScrollBar />
|
|
28
|
+
<ScrollAreaCorner />
|
|
29
|
+
</ScrollAreaRoot>
|
|
30
|
+
</template>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ScrollAreaScrollbar, ScrollAreaThumb } from 'reka-ui'
|
|
3
|
+
import type { ScrollAreaScrollbarProps } from 'reka-ui'
|
|
4
|
+
import { computed } from 'vue'
|
|
5
|
+
import type { HTMLAttributes } from 'vue'
|
|
6
|
+
|
|
7
|
+
const props = withDefaults(defineProps<ScrollAreaScrollbarProps & { class?: HTMLAttributes['class'] }>(), {
|
|
8
|
+
orientation: 'vertical',
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
const delegatedProps = computed(() => {
|
|
12
|
+
const { class: _, ...delegated } = props
|
|
13
|
+
|
|
14
|
+
return delegated
|
|
15
|
+
})
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<template>
|
|
19
|
+
<ScrollAreaScrollbar
|
|
20
|
+
v-bind="delegatedProps"
|
|
21
|
+
:class="
|
|
22
|
+
cn('flex touch-none select-none transition-colors',
|
|
23
|
+
orientation === 'vertical'
|
|
24
|
+
&& 'h-full w-2 border-l border-l-transparent p-px',
|
|
25
|
+
orientation === 'horizontal'
|
|
26
|
+
&& 'h-2.5 flex-col border-t border-t-transparent p-px',
|
|
27
|
+
props.class)"
|
|
28
|
+
>
|
|
29
|
+
<ScrollAreaThumb class="relative flex-1 rounded-full bg-border" />
|
|
30
|
+
</ScrollAreaScrollbar>
|
|
31
|
+
</template>
|