@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,13 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'vue'
|
|
3
|
+
|
|
4
|
+
const props = defineProps<{
|
|
5
|
+
class?: HTMLAttributes['class']
|
|
6
|
+
}>()
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<template>
|
|
10
|
+
<tr :class="cn('border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted', props.class)">
|
|
11
|
+
<slot />
|
|
12
|
+
</tr>
|
|
13
|
+
</template>
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import { Meta, Canvas, ArgTypes } from '@storybook/blocks';
|
|
2
|
+
import * as TableStories from './table.stories.ts';
|
|
3
|
+
|
|
4
|
+
<Meta of={TableStories} />
|
|
5
|
+
|
|
6
|
+
# TelaTable
|
|
7
|
+
|
|
8
|
+
A complete table component system built with semantic HTML table elements and styled for modern interfaces.
|
|
9
|
+
|
|
10
|
+
## Props
|
|
11
|
+
|
|
12
|
+
<ArgTypes />
|
|
13
|
+
|
|
14
|
+
## Components
|
|
15
|
+
|
|
16
|
+
The Table system consists of these components:
|
|
17
|
+
|
|
18
|
+
### Core Table Structure
|
|
19
|
+
- `TelaTable` - Root table container with overflow handling
|
|
20
|
+
- `TelaTableHeader` - Table header section (`<thead>`)
|
|
21
|
+
- `TelaTableBody` - Table body section (`<tbody>`)
|
|
22
|
+
- `TelaTableFooter` - Table footer section (`<tfoot>`)
|
|
23
|
+
|
|
24
|
+
### Table Content
|
|
25
|
+
- `TelaTableRow` - Table row with hover effects (`<tr>`)
|
|
26
|
+
- `TelaTableHead` - Header cell with proper styling (`<th>`)
|
|
27
|
+
- `TelaTableCell` - Data cell with consistent padding (`<td>`)
|
|
28
|
+
|
|
29
|
+
### Optional Elements
|
|
30
|
+
- `TelaTableCaption` - Accessible table description (`<caption>`)
|
|
31
|
+
- `TelaTableEmpty` - Empty state component for when no data is available
|
|
32
|
+
|
|
33
|
+
## Examples
|
|
34
|
+
|
|
35
|
+
### Basic Usage
|
|
36
|
+
|
|
37
|
+
<Canvas of={TableStories.Default} />
|
|
38
|
+
|
|
39
|
+
### Table with Empty State
|
|
40
|
+
|
|
41
|
+
<Canvas of={TableStories.EmptyState} />
|
|
42
|
+
|
|
43
|
+
### Data Table with Footer
|
|
44
|
+
|
|
45
|
+
<Canvas of={TableStories.WithFooter} />
|
|
46
|
+
|
|
47
|
+
### Selectable Rows with Checkboxes
|
|
48
|
+
|
|
49
|
+
<Canvas of={TableStories.WithCheckboxes} />
|
|
50
|
+
|
|
51
|
+
### Custom Styled Table
|
|
52
|
+
|
|
53
|
+
<Canvas of={TableStories.CustomStyling} />
|
|
54
|
+
|
|
55
|
+
### Responsive Scrollable Table
|
|
56
|
+
|
|
57
|
+
<Canvas of={TableStories.ResponsiveTable} />
|
|
58
|
+
|
|
59
|
+
### Basic Usage Code
|
|
60
|
+
|
|
61
|
+
```vue
|
|
62
|
+
<TelaTable>
|
|
63
|
+
<TelaTableCaption>A list of your recent invoices.</TelaTableCaption>
|
|
64
|
+
<TelaTableHeader>
|
|
65
|
+
<TelaTableRow>
|
|
66
|
+
<TelaTableHead>Invoice</TelaTableHead>
|
|
67
|
+
<TelaTableHead>Status</TelaTableHead>
|
|
68
|
+
<TelaTableHead>Method</TelaTableHead>
|
|
69
|
+
<TelaTableHead class="text-right">Amount</TelaTableHead>
|
|
70
|
+
</TelaTableRow>
|
|
71
|
+
</TelaTableHeader>
|
|
72
|
+
<TelaTableBody>
|
|
73
|
+
<TelaTableRow>
|
|
74
|
+
<TelaTableCell class="font-medium">INV001</TelaTableCell>
|
|
75
|
+
<TelaTableCell>Paid</TelaTableCell>
|
|
76
|
+
<TelaTableCell>Credit Card</TelaTableCell>
|
|
77
|
+
<TelaTableCell class="text-right">$250.00</TelaTableCell>
|
|
78
|
+
</TelaTableRow>
|
|
79
|
+
<TelaTableRow>
|
|
80
|
+
<TelaTableCell class="font-medium">INV002</TelaTableCell>
|
|
81
|
+
<TelaTableCell>Pending</TelaTableCell>
|
|
82
|
+
<TelaTableCell>PayPal</TelaTableCell>
|
|
83
|
+
<TelaTableCell class="text-right">$150.00</TelaTableCell>
|
|
84
|
+
</TelaTableRow>
|
|
85
|
+
</TelaTableBody>
|
|
86
|
+
</TelaTable>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Table with Empty State Code
|
|
90
|
+
|
|
91
|
+
```vue
|
|
92
|
+
<TelaTable>
|
|
93
|
+
<TelaTableCaption>No invoices found.</TelaTableCaption>
|
|
94
|
+
<TelaTableHeader>
|
|
95
|
+
<TelaTableRow>
|
|
96
|
+
<TelaTableHead>Invoice</TelaTableHead>
|
|
97
|
+
<TelaTableHead>Status</TelaTableHead>
|
|
98
|
+
<TelaTableHead>Method</TelaTableHead>
|
|
99
|
+
<TelaTableHead class="text-right">Amount</TelaTableHead>
|
|
100
|
+
</TelaTableRow>
|
|
101
|
+
</TelaTableHeader>
|
|
102
|
+
<TelaTableBody>
|
|
103
|
+
<TelaTableRow>
|
|
104
|
+
<TelaTableCell colspan="4">
|
|
105
|
+
<TelaTableEmpty>
|
|
106
|
+
<div class="text-center py-8">
|
|
107
|
+
<p class="text-muted-foreground">No data available</p>
|
|
108
|
+
</div>
|
|
109
|
+
</TelaTableEmpty>
|
|
110
|
+
</TelaTableCell>
|
|
111
|
+
</TelaTableRow>
|
|
112
|
+
</TelaTableBody>
|
|
113
|
+
</TelaTable>
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Data Table with Footer Code
|
|
117
|
+
|
|
118
|
+
```vue
|
|
119
|
+
<TelaTable>
|
|
120
|
+
<TelaTableHeader>
|
|
121
|
+
<TelaTableRow>
|
|
122
|
+
<TelaTableHead>Product</TelaTableHead>
|
|
123
|
+
<TelaTableHead>Quantity</TelaTableHead>
|
|
124
|
+
<TelaTableHead class="text-right">Price</TelaTableHead>
|
|
125
|
+
<TelaTableHead class="text-right">Total</TelaTableHead>
|
|
126
|
+
</TelaTableRow>
|
|
127
|
+
</TelaTableHeader>
|
|
128
|
+
<TelaTableBody>
|
|
129
|
+
<TelaTableRow>
|
|
130
|
+
<TelaTableCell>Product A</TelaTableCell>
|
|
131
|
+
<TelaTableCell>2</TelaTableCell>
|
|
132
|
+
<TelaTableCell class="text-right">$50.00</TelaTableCell>
|
|
133
|
+
<TelaTableCell class="text-right">$100.00</TelaTableCell>
|
|
134
|
+
</TelaTableRow>
|
|
135
|
+
<TelaTableRow>
|
|
136
|
+
<TelaTableCell>Product B</TelaTableCell>
|
|
137
|
+
<TelaTableCell>1</TelaTableCell>
|
|
138
|
+
<TelaTableCell class="text-right">$75.00</TelaTableCell>
|
|
139
|
+
<TelaTableCell class="text-right">$75.00</TelaTableCell>
|
|
140
|
+
</TelaTableRow>
|
|
141
|
+
</TelaTableBody>
|
|
142
|
+
<TelaTableFooter>
|
|
143
|
+
<TelaTableRow>
|
|
144
|
+
<TelaTableCell colspan="3" class="font-medium">Total</TelaTableCell>
|
|
145
|
+
<TelaTableCell class="text-right font-medium">$175.00</TelaTableCell>
|
|
146
|
+
</TelaTableRow>
|
|
147
|
+
</TelaTableFooter>
|
|
148
|
+
</TelaTable>
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Selectable Rows with Checkboxes Code
|
|
152
|
+
|
|
153
|
+
```vue
|
|
154
|
+
<TelaTable>
|
|
155
|
+
<TelaTableHeader>
|
|
156
|
+
<TelaTableRow>
|
|
157
|
+
<TelaTableHead class="w-12">
|
|
158
|
+
<input type="checkbox" class="checkbox" />
|
|
159
|
+
</TelaTableHead>
|
|
160
|
+
<TelaTableHead>Name</TelaTableHead>
|
|
161
|
+
<TelaTableHead>Email</TelaTableHead>
|
|
162
|
+
<TelaTableHead>Role</TelaTableHead>
|
|
163
|
+
</TelaTableRow>
|
|
164
|
+
</TelaTableHeader>
|
|
165
|
+
<TelaTableBody>
|
|
166
|
+
<TelaTableRow>
|
|
167
|
+
<TelaTableCell>
|
|
168
|
+
<input type="checkbox" class="checkbox" />
|
|
169
|
+
</TelaTableCell>
|
|
170
|
+
<TelaTableCell class="font-medium">John Doe</TelaTableCell>
|
|
171
|
+
<TelaTableCell>john@example.com</TelaTableCell>
|
|
172
|
+
<TelaTableCell>Admin</TelaTableCell>
|
|
173
|
+
</TelaTableRow>
|
|
174
|
+
<TelaTableRow>
|
|
175
|
+
<TelaTableCell>
|
|
176
|
+
<input type="checkbox" class="checkbox" />
|
|
177
|
+
</TelaTableCell>
|
|
178
|
+
<TelaTableCell class="font-medium">Jane Smith</TelaTableCell>
|
|
179
|
+
<TelaTableCell>jane@example.com</TelaTableCell>
|
|
180
|
+
<TelaTableCell>User</TelaTableCell>
|
|
181
|
+
</TelaTableRow>
|
|
182
|
+
</TelaTableBody>
|
|
183
|
+
</TelaTable>
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## Props
|
|
187
|
+
|
|
188
|
+
<ArgTypes />
|
|
189
|
+
|
|
190
|
+
## Components
|
|
191
|
+
|
|
192
|
+
The Table system consists of these components:
|
|
193
|
+
|
|
194
|
+
### Core Table Structure
|
|
195
|
+
- `TelaTable` - Root table container with overflow handling
|
|
196
|
+
- `TelaTableHeader` - Table header section (`<thead>`)
|
|
197
|
+
- `TelaTableBody` - Table body section (`<tbody>`)
|
|
198
|
+
- `TelaTableFooter` - Table footer section (`<tfoot>`)
|
|
199
|
+
|
|
200
|
+
### Table Content
|
|
201
|
+
- `TelaTableRow` - Table row with hover effects (`<tr>`)
|
|
202
|
+
- `TelaTableHead` - Header cell with proper styling (`<th>`)
|
|
203
|
+
- `TelaTableCell` - Data cell with consistent padding (`<td>`)
|
|
204
|
+
|
|
205
|
+
### Optional Elements
|
|
206
|
+
- `TelaTableCaption` - Accessible table description (`<caption>`)
|
|
207
|
+
- `TelaTableEmpty` - Empty state component for when no data is available
|
|
208
|
+
|
|
209
|
+
## Features
|
|
210
|
+
|
|
211
|
+
- **Responsive**: Horizontal scrolling on smaller screens
|
|
212
|
+
- **Accessible**: Proper semantic HTML structure with caption support
|
|
213
|
+
- **Styled**: Consistent padding, borders, and hover states
|
|
214
|
+
- **Flexible**: Support for custom classes on all components
|
|
215
|
+
- **Empty States**: Built-in empty state handling
|
|
216
|
+
- **Selection**: Optimized spacing for checkbox columns
|
|
217
|
+
|
|
218
|
+
## Styling Classes
|
|
219
|
+
|
|
220
|
+
Each component accepts a `class` prop for custom styling:
|
|
221
|
+
|
|
222
|
+
```vue
|
|
223
|
+
<TelaTable class="border-2">
|
|
224
|
+
<TelaTableRow class="bg-accent">
|
|
225
|
+
<TelaTableCell class="font-bold text-primary">
|
|
226
|
+
Custom styled content
|
|
227
|
+
</TelaTableCell>
|
|
228
|
+
</TelaTableRow>
|
|
229
|
+
</TelaTable>
|
|
230
|
+
```
|
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
2
|
+
import TelaTable from './table.vue'
|
|
3
|
+
import TelaTableHeader from './table-header.vue'
|
|
4
|
+
import TelaTableBody from './table-body.vue'
|
|
5
|
+
import TelaTableFooter from './table-footer.vue'
|
|
6
|
+
import TelaTableRow from './table-row.vue'
|
|
7
|
+
import TelaTableHead from './table-head.vue'
|
|
8
|
+
import TelaTableCell from './table-cell.vue'
|
|
9
|
+
import TelaTableCaption from './table-caption.vue'
|
|
10
|
+
import TelaTableEmpty from './table-empty.vue'
|
|
11
|
+
|
|
12
|
+
const meta: Meta<typeof TelaTable> = {
|
|
13
|
+
title: 'tela/table',
|
|
14
|
+
component: TelaTable,
|
|
15
|
+
argTypes: {
|
|
16
|
+
class: {
|
|
17
|
+
control: 'text',
|
|
18
|
+
description: 'Custom CSS classes for styling',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export default meta
|
|
24
|
+
type Story = StoryObj<typeof meta>
|
|
25
|
+
|
|
26
|
+
export const Default: Story = {
|
|
27
|
+
render: args => ({
|
|
28
|
+
components: {
|
|
29
|
+
TelaTable,
|
|
30
|
+
TelaTableHeader,
|
|
31
|
+
TelaTableBody,
|
|
32
|
+
TelaTableRow,
|
|
33
|
+
TelaTableHead,
|
|
34
|
+
TelaTableCell,
|
|
35
|
+
TelaTableCaption,
|
|
36
|
+
},
|
|
37
|
+
setup() {
|
|
38
|
+
return { args }
|
|
39
|
+
},
|
|
40
|
+
template: `
|
|
41
|
+
<TelaTable v-bind="args">
|
|
42
|
+
<TelaTableCaption>A list of your recent invoices.</TelaTableCaption>
|
|
43
|
+
<TelaTableHeader>
|
|
44
|
+
<TelaTableRow>
|
|
45
|
+
<TelaTableHead class="w-[100px]">Invoice</TelaTableHead>
|
|
46
|
+
<TelaTableHead>Status</TelaTableHead>
|
|
47
|
+
<TelaTableHead>Method</TelaTableHead>
|
|
48
|
+
<TelaTableHead class="text-right">Amount</TelaTableHead>
|
|
49
|
+
</TelaTableRow>
|
|
50
|
+
</TelaTableHeader>
|
|
51
|
+
<TelaTableBody>
|
|
52
|
+
<TelaTableRow>
|
|
53
|
+
<TelaTableCell class="font-medium">INV001</TelaTableCell>
|
|
54
|
+
<TelaTableCell>Paid</TelaTableCell>
|
|
55
|
+
<TelaTableCell>Credit Card</TelaTableCell>
|
|
56
|
+
<TelaTableCell class="text-right">$250.00</TelaTableCell>
|
|
57
|
+
</TelaTableRow>
|
|
58
|
+
<TelaTableRow>
|
|
59
|
+
<TelaTableCell class="font-medium">INV002</TelaTableCell>
|
|
60
|
+
<TelaTableCell>Pending</TelaTableCell>
|
|
61
|
+
<TelaTableCell>PayPal</TelaTableCell>
|
|
62
|
+
<TelaTableCell class="text-right">$150.00</TelaTableCell>
|
|
63
|
+
</TelaTableRow>
|
|
64
|
+
<TelaTableRow>
|
|
65
|
+
<TelaTableCell class="font-medium">INV003</TelaTableCell>
|
|
66
|
+
<TelaTableCell>Unpaid</TelaTableCell>
|
|
67
|
+
<TelaTableCell>Bank Transfer</TelaTableCell>
|
|
68
|
+
<TelaTableCell class="text-right">$350.00</TelaTableCell>
|
|
69
|
+
</TelaTableRow>
|
|
70
|
+
<TelaTableRow>
|
|
71
|
+
<TelaTableCell class="font-medium">INV004</TelaTableCell>
|
|
72
|
+
<TelaTableCell>Paid</TelaTableCell>
|
|
73
|
+
<TelaTableCell>Credit Card</TelaTableCell>
|
|
74
|
+
<TelaTableCell class="text-right">$450.00</TelaTableCell>
|
|
75
|
+
</TelaTableRow>
|
|
76
|
+
</TelaTableBody>
|
|
77
|
+
</TelaTable>
|
|
78
|
+
`,
|
|
79
|
+
}),
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export const WithFooter: Story = {
|
|
83
|
+
render: args => ({
|
|
84
|
+
components: {
|
|
85
|
+
TelaTable,
|
|
86
|
+
TelaTableHeader,
|
|
87
|
+
TelaTableBody,
|
|
88
|
+
TelaTableFooter,
|
|
89
|
+
TelaTableRow,
|
|
90
|
+
TelaTableHead,
|
|
91
|
+
TelaTableCell,
|
|
92
|
+
},
|
|
93
|
+
setup() {
|
|
94
|
+
return { args }
|
|
95
|
+
},
|
|
96
|
+
template: `
|
|
97
|
+
<TelaTable v-bind="args">
|
|
98
|
+
<TelaTableHeader>
|
|
99
|
+
<TelaTableRow>
|
|
100
|
+
<TelaTableHead>Product</TelaTableHead>
|
|
101
|
+
<TelaTableHead class="text-center">Quantity</TelaTableHead>
|
|
102
|
+
<TelaTableHead class="text-right">Price</TelaTableHead>
|
|
103
|
+
<TelaTableHead class="text-right">Total</TelaTableHead>
|
|
104
|
+
</TelaTableRow>
|
|
105
|
+
</TelaTableHeader>
|
|
106
|
+
<TelaTableBody>
|
|
107
|
+
<TelaTableRow>
|
|
108
|
+
<TelaTableCell>Product A</TelaTableCell>
|
|
109
|
+
<TelaTableCell class="text-center">2</TelaTableCell>
|
|
110
|
+
<TelaTableCell class="text-right">$50.00</TelaTableCell>
|
|
111
|
+
<TelaTableCell class="text-right">$100.00</TelaTableCell>
|
|
112
|
+
</TelaTableRow>
|
|
113
|
+
<TelaTableRow>
|
|
114
|
+
<TelaTableCell>Product B</TelaTableCell>
|
|
115
|
+
<TelaTableCell class="text-center">1</TelaTableCell>
|
|
116
|
+
<TelaTableCell class="text-right">$75.00</TelaTableCell>
|
|
117
|
+
<TelaTableCell class="text-right">$75.00</TelaTableCell>
|
|
118
|
+
</TelaTableRow>
|
|
119
|
+
<TelaTableRow>
|
|
120
|
+
<TelaTableCell>Product C</TelaTableCell>
|
|
121
|
+
<TelaTableCell class="text-center">3</TelaTableCell>
|
|
122
|
+
<TelaTableCell class="text-right">$30.00</TelaTableCell>
|
|
123
|
+
<TelaTableCell class="text-right">$90.00</TelaTableCell>
|
|
124
|
+
</TelaTableRow>
|
|
125
|
+
</TelaTableBody>
|
|
126
|
+
<TelaTableFooter>
|
|
127
|
+
<TelaTableRow>
|
|
128
|
+
<TelaTableCell colspan="3" class="font-medium">Total</TelaTableCell>
|
|
129
|
+
<TelaTableCell class="text-right font-medium">$265.00</TelaTableCell>
|
|
130
|
+
</TelaTableRow>
|
|
131
|
+
</TelaTableFooter>
|
|
132
|
+
</TelaTable>
|
|
133
|
+
`,
|
|
134
|
+
}),
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export const EmptyState: Story = {
|
|
138
|
+
render: args => ({
|
|
139
|
+
components: {
|
|
140
|
+
TelaTable,
|
|
141
|
+
TelaTableHeader,
|
|
142
|
+
TelaTableBody,
|
|
143
|
+
TelaTableRow,
|
|
144
|
+
TelaTableHead,
|
|
145
|
+
TelaTableCell,
|
|
146
|
+
TelaTableEmpty,
|
|
147
|
+
TelaTableCaption,
|
|
148
|
+
},
|
|
149
|
+
setup() {
|
|
150
|
+
return { args }
|
|
151
|
+
},
|
|
152
|
+
template: `
|
|
153
|
+
<TelaTable v-bind="args">
|
|
154
|
+
<TelaTableCaption>No data available.</TelaTableCaption>
|
|
155
|
+
<TelaTableHeader>
|
|
156
|
+
<TelaTableRow>
|
|
157
|
+
<TelaTableHead>Invoice</TelaTableHead>
|
|
158
|
+
<TelaTableHead>Status</TelaTableHead>
|
|
159
|
+
<TelaTableHead>Method</TelaTableHead>
|
|
160
|
+
<TelaTableHead class="text-right">Amount</TelaTableHead>
|
|
161
|
+
</TelaTableRow>
|
|
162
|
+
</TelaTableHeader>
|
|
163
|
+
<TelaTableBody>
|
|
164
|
+
<TelaTableRow>
|
|
165
|
+
<TelaTableCell colspan="4">
|
|
166
|
+
<TelaTableEmpty>
|
|
167
|
+
<div class="flex flex-col items-center justify-center py-12 text-center">
|
|
168
|
+
<svg class="w-12 h-12 text-gray-400 mb-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
169
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
|
|
170
|
+
</svg>
|
|
171
|
+
<p class="text-muted-foreground mb-1">No invoices found</p>
|
|
172
|
+
<p class="text-sm text-muted-foreground">Your invoices will appear here once created.</p>
|
|
173
|
+
</div>
|
|
174
|
+
</TelaTableEmpty>
|
|
175
|
+
</TelaTableCell>
|
|
176
|
+
</TelaTableRow>
|
|
177
|
+
</TelaTableBody>
|
|
178
|
+
</TelaTable>
|
|
179
|
+
`,
|
|
180
|
+
}),
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export const WithCheckboxes: Story = {
|
|
184
|
+
render: args => ({
|
|
185
|
+
components: {
|
|
186
|
+
TelaTable,
|
|
187
|
+
TelaTableHeader,
|
|
188
|
+
TelaTableBody,
|
|
189
|
+
TelaTableRow,
|
|
190
|
+
TelaTableHead,
|
|
191
|
+
TelaTableCell,
|
|
192
|
+
},
|
|
193
|
+
setup() {
|
|
194
|
+
const selectedRows = ref<number[]>([])
|
|
195
|
+
const allSelected = computed(() => selectedRows.value.length === 4)
|
|
196
|
+
|
|
197
|
+
const toggleAll = () => {
|
|
198
|
+
if (allSelected.value) {
|
|
199
|
+
selectedRows.value = []
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
selectedRows.value = [0, 1, 2, 3]
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
const toggleRow = (index: number) => {
|
|
207
|
+
const idx = selectedRows.value.indexOf(index)
|
|
208
|
+
if (idx > -1) {
|
|
209
|
+
selectedRows.value.splice(idx, 1)
|
|
210
|
+
}
|
|
211
|
+
else {
|
|
212
|
+
selectedRows.value.push(index)
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
return { args, selectedRows, allSelected, toggleAll, toggleRow }
|
|
217
|
+
},
|
|
218
|
+
template: `
|
|
219
|
+
<TelaTable v-bind="args">
|
|
220
|
+
<TelaTableHeader>
|
|
221
|
+
<TelaTableRow>
|
|
222
|
+
<TelaTableHead class="w-12">
|
|
223
|
+
<input
|
|
224
|
+
type="checkbox"
|
|
225
|
+
:checked="allSelected"
|
|
226
|
+
@change="toggleAll"
|
|
227
|
+
class="w-4 h-4 rounded border-gray-300"
|
|
228
|
+
/>
|
|
229
|
+
</TelaTableHead>
|
|
230
|
+
<TelaTableHead>Name</TelaTableHead>
|
|
231
|
+
<TelaTableHead>Email</TelaTableHead>
|
|
232
|
+
<TelaTableHead>Role</TelaTableHead>
|
|
233
|
+
<TelaTableHead>Status</TelaTableHead>
|
|
234
|
+
</TelaTableRow>
|
|
235
|
+
</TelaTableHeader>
|
|
236
|
+
<TelaTableBody>
|
|
237
|
+
<TelaTableRow v-for="(user, index) in [
|
|
238
|
+
{ name: 'John Doe', email: 'john@example.com', role: 'Admin', status: 'Active' },
|
|
239
|
+
{ name: 'Jane Smith', email: 'jane@example.com', role: 'User', status: 'Active' },
|
|
240
|
+
{ name: 'Bob Johnson', email: 'bob@example.com', role: 'User', status: 'Inactive' },
|
|
241
|
+
{ name: 'Alice Williams', email: 'alice@example.com', role: 'Moderator', status: 'Active' }
|
|
242
|
+
]" :key="index">
|
|
243
|
+
<TelaTableCell>
|
|
244
|
+
<input
|
|
245
|
+
type="checkbox"
|
|
246
|
+
:checked="selectedRows.includes(index)"
|
|
247
|
+
@change="toggleRow(index)"
|
|
248
|
+
class="w-4 h-4 rounded border-gray-300"
|
|
249
|
+
/>
|
|
250
|
+
</TelaTableCell>
|
|
251
|
+
<TelaTableCell class="font-medium">{{ user.name }}</TelaTableCell>
|
|
252
|
+
<TelaTableCell>{{ user.email }}</TelaTableCell>
|
|
253
|
+
<TelaTableCell>{{ user.role }}</TelaTableCell>
|
|
254
|
+
<TelaTableCell>
|
|
255
|
+
<span :class="user.status === 'Active' ? 'text-green-600' : 'text-gray-500'">
|
|
256
|
+
{{ user.status }}
|
|
257
|
+
</span>
|
|
258
|
+
</TelaTableCell>
|
|
259
|
+
</TelaTableRow>
|
|
260
|
+
</TelaTableBody>
|
|
261
|
+
</TelaTable>
|
|
262
|
+
`,
|
|
263
|
+
}),
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
export const CustomStyling: Story = {
|
|
267
|
+
render: args => ({
|
|
268
|
+
components: {
|
|
269
|
+
TelaTable,
|
|
270
|
+
TelaTableHeader,
|
|
271
|
+
TelaTableBody,
|
|
272
|
+
TelaTableRow,
|
|
273
|
+
TelaTableHead,
|
|
274
|
+
TelaTableCell,
|
|
275
|
+
},
|
|
276
|
+
setup() {
|
|
277
|
+
return { args }
|
|
278
|
+
},
|
|
279
|
+
template: `
|
|
280
|
+
<TelaTable class="border-2 border-blue-200" v-bind="args">
|
|
281
|
+
<TelaTableHeader>
|
|
282
|
+
<TelaTableRow class="bg-blue-50">
|
|
283
|
+
<TelaTableHead class="text-blue-900 font-bold">Task</TelaTableHead>
|
|
284
|
+
<TelaTableHead class="text-blue-900 font-bold">Priority</TelaTableHead>
|
|
285
|
+
<TelaTableHead class="text-blue-900 font-bold">Status</TelaTableHead>
|
|
286
|
+
<TelaTableHead class="text-blue-900 font-bold text-right">Progress</TelaTableHead>
|
|
287
|
+
</TelaTableRow>
|
|
288
|
+
</TelaTableHeader>
|
|
289
|
+
<TelaTableBody>
|
|
290
|
+
<TelaTableRow class="hover:bg-blue-50/50">
|
|
291
|
+
<TelaTableCell class="font-medium">Design System Update</TelaTableCell>
|
|
292
|
+
<TelaTableCell>
|
|
293
|
+
<span class="px-2 py-1 text-xs rounded bg-red-100 text-red-700">High</span>
|
|
294
|
+
</TelaTableCell>
|
|
295
|
+
<TelaTableCell>
|
|
296
|
+
<span class="px-2 py-1 text-xs rounded bg-yellow-100 text-yellow-700">In Progress</span>
|
|
297
|
+
</TelaTableCell>
|
|
298
|
+
<TelaTableCell class="text-right">75%</TelaTableCell>
|
|
299
|
+
</TelaTableRow>
|
|
300
|
+
<TelaTableRow class="hover:bg-blue-50/50">
|
|
301
|
+
<TelaTableCell class="font-medium">API Documentation</TelaTableCell>
|
|
302
|
+
<TelaTableCell>
|
|
303
|
+
<span class="px-2 py-1 text-xs rounded bg-yellow-100 text-yellow-700">Medium</span>
|
|
304
|
+
</TelaTableCell>
|
|
305
|
+
<TelaTableCell>
|
|
306
|
+
<span class="px-2 py-1 text-xs rounded bg-green-100 text-green-700">Complete</span>
|
|
307
|
+
</TelaTableCell>
|
|
308
|
+
<TelaTableCell class="text-right">100%</TelaTableCell>
|
|
309
|
+
</TelaTableRow>
|
|
310
|
+
<TelaTableRow class="hover:bg-blue-50/50">
|
|
311
|
+
<TelaTableCell class="font-medium">Bug Fixes</TelaTableCell>
|
|
312
|
+
<TelaTableCell>
|
|
313
|
+
<span class="px-2 py-1 text-xs rounded bg-red-100 text-red-700">High</span>
|
|
314
|
+
</TelaTableCell>
|
|
315
|
+
<TelaTableCell>
|
|
316
|
+
<span class="px-2 py-1 text-xs rounded bg-blue-100 text-blue-700">Review</span>
|
|
317
|
+
</TelaTableCell>
|
|
318
|
+
<TelaTableCell class="text-right">90%</TelaTableCell>
|
|
319
|
+
</TelaTableRow>
|
|
320
|
+
</TelaTableBody>
|
|
321
|
+
</TelaTable>
|
|
322
|
+
`,
|
|
323
|
+
}),
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
export const ResponsiveTable: Story = {
|
|
327
|
+
render: args => ({
|
|
328
|
+
components: {
|
|
329
|
+
TelaTable,
|
|
330
|
+
TelaTableHeader,
|
|
331
|
+
TelaTableBody,
|
|
332
|
+
TelaTableRow,
|
|
333
|
+
TelaTableHead,
|
|
334
|
+
TelaTableCell,
|
|
335
|
+
TelaTableCaption,
|
|
336
|
+
},
|
|
337
|
+
setup() {
|
|
338
|
+
return { args }
|
|
339
|
+
},
|
|
340
|
+
template: `
|
|
341
|
+
<div class="max-w-[600px] border-1px rounded-lg p-4">
|
|
342
|
+
<TelaTable v-bind="args">
|
|
343
|
+
<TelaTableCaption>Scroll horizontally to see all columns</TelaTableCaption>
|
|
344
|
+
<TelaTableHeader>
|
|
345
|
+
<TelaTableRow>
|
|
346
|
+
<TelaTableHead class="min-w-[150px]">Employee</TelaTableHead>
|
|
347
|
+
<TelaTableHead class="min-w-[150px]">Department</TelaTableHead>
|
|
348
|
+
<TelaTableHead class="min-w-[120px]">Location</TelaTableHead>
|
|
349
|
+
<TelaTableHead class="min-w-[100px]">Start Date</TelaTableHead>
|
|
350
|
+
<TelaTableHead class="min-w-[120px]">Salary</TelaTableHead>
|
|
351
|
+
<TelaTableHead class="min-w-[100px]">Status</TelaTableHead>
|
|
352
|
+
</TelaTableRow>
|
|
353
|
+
</TelaTableHeader>
|
|
354
|
+
<TelaTableBody>
|
|
355
|
+
<TelaTableRow>
|
|
356
|
+
<TelaTableCell class="font-medium">Sarah Johnson</TelaTableCell>
|
|
357
|
+
<TelaTableCell>Engineering</TelaTableCell>
|
|
358
|
+
<TelaTableCell>San Francisco</TelaTableCell>
|
|
359
|
+
<TelaTableCell>2021-03-15</TelaTableCell>
|
|
360
|
+
<TelaTableCell>$125,000</TelaTableCell>
|
|
361
|
+
<TelaTableCell>Active</TelaTableCell>
|
|
362
|
+
</TelaTableRow>
|
|
363
|
+
<TelaTableRow>
|
|
364
|
+
<TelaTableCell class="font-medium">Michael Chen</TelaTableCell>
|
|
365
|
+
<TelaTableCell>Product</TelaTableCell>
|
|
366
|
+
<TelaTableCell>New York</TelaTableCell>
|
|
367
|
+
<TelaTableCell>2020-07-20</TelaTableCell>
|
|
368
|
+
<TelaTableCell>$115,000</TelaTableCell>
|
|
369
|
+
<TelaTableCell>Active</TelaTableCell>
|
|
370
|
+
</TelaTableRow>
|
|
371
|
+
<TelaTableRow>
|
|
372
|
+
<TelaTableCell class="font-medium">Emily Davis</TelaTableCell>
|
|
373
|
+
<TelaTableCell>Marketing</TelaTableCell>
|
|
374
|
+
<TelaTableCell>London</TelaTableCell>
|
|
375
|
+
<TelaTableCell>2022-01-10</TelaTableCell>
|
|
376
|
+
<TelaTableCell>$95,000</TelaTableCell>
|
|
377
|
+
<TelaTableCell>Active</TelaTableCell>
|
|
378
|
+
</TelaTableRow>
|
|
379
|
+
</TelaTableBody>
|
|
380
|
+
</TelaTable>
|
|
381
|
+
</div>
|
|
382
|
+
`,
|
|
383
|
+
}),
|
|
384
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'vue'
|
|
3
|
+
|
|
4
|
+
const props = defineProps<{
|
|
5
|
+
class?: HTMLAttributes['class']
|
|
6
|
+
}>()
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<template>
|
|
10
|
+
<div class="relative w-full overflow-auto">
|
|
11
|
+
<table :class="cn('w-full caption-bottom text-sm', props.class)">
|
|
12
|
+
<slot />
|
|
13
|
+
</table>
|
|
14
|
+
</div>
|
|
15
|
+
</template>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'vue'
|
|
3
|
+
import { reactiveOmit } from '@vueuse/core'
|
|
4
|
+
import { TabsContent } from 'reka-ui'
|
|
5
|
+
import type { TabsContentProps } from 'reka-ui'
|
|
6
|
+
import { cn } from '@/lib/utils'
|
|
7
|
+
|
|
8
|
+
const props = defineProps<TabsContentProps & { class?: HTMLAttributes['class'] }>()
|
|
9
|
+
|
|
10
|
+
const delegatedProps = reactiveOmit(props, 'class')
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<template>
|
|
14
|
+
<TabsContent
|
|
15
|
+
:class="cn('focus-visible:outline-none pt-2', props.class)"
|
|
16
|
+
v-bind="delegatedProps"
|
|
17
|
+
>
|
|
18
|
+
<slot />
|
|
19
|
+
</TabsContent>
|
|
20
|
+
</template>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'vue'
|
|
3
|
+
import { reactiveOmit } from '@vueuse/core'
|
|
4
|
+
|
|
5
|
+
import { TabsIndicator } from 'reka-ui'
|
|
6
|
+
import type { TabsIndicatorProps } from 'reka-ui'
|
|
7
|
+
|
|
8
|
+
import { cn } from '@/lib/utils'
|
|
9
|
+
|
|
10
|
+
const props = defineProps<TabsIndicatorProps & { class?: HTMLAttributes['class'] }>()
|
|
11
|
+
|
|
12
|
+
const delegatedProps = reactiveOmit(props, 'class')
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<template>
|
|
16
|
+
<TabsIndicator
|
|
17
|
+
v-bind="delegatedProps"
|
|
18
|
+
:class="cn('absolute left-0 h-[1.5px] bottom-0 w-[--reka-tabs-indicator-size] translate-x-[--reka-tabs-indicator-position] translate-y-[1px] rounded-full transition-[width,transform] duration-300', props.class)"
|
|
19
|
+
>
|
|
20
|
+
<div class="bg-black w-full h-full" />
|
|
21
|
+
</TabsIndicator>
|
|
22
|
+
</template>
|