@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,160 @@
|
|
|
1
|
+
import { ref, computed } from 'vue'
|
|
2
|
+
|
|
3
|
+
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
4
|
+
import Status from './status.vue'
|
|
5
|
+
import TelaButton from '../button/button.vue'
|
|
6
|
+
|
|
7
|
+
const allVariants = [
|
|
8
|
+
'pending-run',
|
|
9
|
+
'preparing-run',
|
|
10
|
+
'waiting',
|
|
11
|
+
'on-hold',
|
|
12
|
+
'queued',
|
|
13
|
+
'validation-error',
|
|
14
|
+
'running',
|
|
15
|
+
'executing',
|
|
16
|
+
'processing',
|
|
17
|
+
'verifying',
|
|
18
|
+
'initializing',
|
|
19
|
+
'waiting-user',
|
|
20
|
+
'awaiting-approval',
|
|
21
|
+
'paused',
|
|
22
|
+
'stopped',
|
|
23
|
+
'suspended',
|
|
24
|
+
'running-issues',
|
|
25
|
+
'warning',
|
|
26
|
+
'low-coverage',
|
|
27
|
+
'medium-coverage',
|
|
28
|
+
'completed',
|
|
29
|
+
'success',
|
|
30
|
+
'error',
|
|
31
|
+
'failed',
|
|
32
|
+
'cancelled',
|
|
33
|
+
'archived',
|
|
34
|
+
'reported',
|
|
35
|
+
'expired',
|
|
36
|
+
'pending-review',
|
|
37
|
+
'reviewing',
|
|
38
|
+
'reviewed',
|
|
39
|
+
'approved',
|
|
40
|
+
'approved-changes',
|
|
41
|
+
'reproved',
|
|
42
|
+
'partially-completed',
|
|
43
|
+
] as const
|
|
44
|
+
|
|
45
|
+
const meta: Meta<typeof Status> = {
|
|
46
|
+
title: 'Core/Status',
|
|
47
|
+
component: Status,
|
|
48
|
+
parameters: {
|
|
49
|
+
layout: 'padded',
|
|
50
|
+
docs: {
|
|
51
|
+
description: {
|
|
52
|
+
component: 'A status component that displays different workflow and task statuses with appropriate icons, colors, and labels. Supports multiple status types including pending, running, completed, error, and review states.',
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
argTypes: {
|
|
57
|
+
variant: {
|
|
58
|
+
control: 'select',
|
|
59
|
+
description: 'Visual style variant of the status. Each variant has a predefined color scheme, icon, and label that represents a specific workflow or task state.',
|
|
60
|
+
},
|
|
61
|
+
label: {
|
|
62
|
+
control: 'text',
|
|
63
|
+
description: 'Custom label text to override the default label for the selected variant. If not provided, the default label associated with the variant will be used.',
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export default meta
|
|
69
|
+
|
|
70
|
+
type Story = StoryObj<typeof Status>
|
|
71
|
+
|
|
72
|
+
export const Default: Story = {
|
|
73
|
+
render: () => ({
|
|
74
|
+
components: { Status },
|
|
75
|
+
template: '<Status />',
|
|
76
|
+
}),
|
|
77
|
+
args: {
|
|
78
|
+
variant: 'running',
|
|
79
|
+
},
|
|
80
|
+
parameters: {
|
|
81
|
+
layout: 'centered',
|
|
82
|
+
},
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export const AllVariants: Story = {
|
|
86
|
+
render: () => {
|
|
87
|
+
return {
|
|
88
|
+
components: { Status },
|
|
89
|
+
setup() {
|
|
90
|
+
return { allVariants }
|
|
91
|
+
},
|
|
92
|
+
template: `
|
|
93
|
+
<div style="display: flex; flex-wrap: wrap; gap: 16px; padding: 24px;">
|
|
94
|
+
<Status v-for="variant in allVariants" :key="variant" :variant="variant" />
|
|
95
|
+
</div>
|
|
96
|
+
`,
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
parameters: {
|
|
100
|
+
layout: 'fullscreen',
|
|
101
|
+
docs: {
|
|
102
|
+
description: {
|
|
103
|
+
story: 'Displays all available status variants in a grid layout. Each variant has a unique combination of icon, color scheme, and default label representing different workflow states.',
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export const AnimatedTransitions: Story = {
|
|
110
|
+
render: () => {
|
|
111
|
+
return {
|
|
112
|
+
components: { Status, TelaButton },
|
|
113
|
+
setup() {
|
|
114
|
+
const submitting = ref(false)
|
|
115
|
+
const submitted = ref(false)
|
|
116
|
+
|
|
117
|
+
const currentVariant = computed(() => {
|
|
118
|
+
if (submitted.value)
|
|
119
|
+
return 'completed'
|
|
120
|
+
|
|
121
|
+
if (submitting.value)
|
|
122
|
+
return 'running'
|
|
123
|
+
|
|
124
|
+
return 'pending-run'
|
|
125
|
+
})
|
|
126
|
+
|
|
127
|
+
function handleSubmit() {
|
|
128
|
+
submitting.value = true
|
|
129
|
+
|
|
130
|
+
setTimeout(() => {
|
|
131
|
+
submitting.value = false
|
|
132
|
+
submitted.value = true
|
|
133
|
+
|
|
134
|
+
setTimeout(() => {
|
|
135
|
+
submitted.value = false
|
|
136
|
+
}, 2000)
|
|
137
|
+
}, 2500)
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
return { currentVariant, handleSubmit }
|
|
141
|
+
},
|
|
142
|
+
template: `
|
|
143
|
+
<div style="padding: 24px;">
|
|
144
|
+
<div style="display: flex; flex-direction: column; gap: 16px; align-items: center;">
|
|
145
|
+
<Status :variant="currentVariant" />
|
|
146
|
+
<TelaButton
|
|
147
|
+
size="sm"
|
|
148
|
+
@click="handleSubmit"
|
|
149
|
+
>
|
|
150
|
+
Submit
|
|
151
|
+
</TelaButton>
|
|
152
|
+
</div>
|
|
153
|
+
</div>
|
|
154
|
+
`,
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
parameters: {
|
|
158
|
+
layout: 'centered',
|
|
159
|
+
},
|
|
160
|
+
}
|
|
@@ -0,0 +1,420 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { TelaCustomIconName, TelaStatusVariant } from '~/types'
|
|
3
|
+
|
|
4
|
+
import TelaIconCustom from '../icon/custom.vue'
|
|
5
|
+
|
|
6
|
+
type StatusConfig = {
|
|
7
|
+
label: string
|
|
8
|
+
backgroundColor: string
|
|
9
|
+
textColor: string
|
|
10
|
+
iconName: TelaCustomIconName
|
|
11
|
+
iconColor: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const props = withDefaults(defineProps<{
|
|
15
|
+
variant?: TelaStatusVariant
|
|
16
|
+
label?: string
|
|
17
|
+
}>(), {
|
|
18
|
+
variant: 'running',
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
const variantConfig: Record<TelaStatusVariant, StatusConfig> = {
|
|
22
|
+
'pending-run': {
|
|
23
|
+
label: 'Pending Run',
|
|
24
|
+
backgroundColor: 'bg-neutral-100',
|
|
25
|
+
textColor: 'text-primary',
|
|
26
|
+
iconName: 'circle',
|
|
27
|
+
iconColor: 'neutral-400',
|
|
28
|
+
},
|
|
29
|
+
'preparing-run': {
|
|
30
|
+
label: 'Preparing to Run',
|
|
31
|
+
backgroundColor: 'bg-neutral-100',
|
|
32
|
+
textColor: 'text-neutral-700',
|
|
33
|
+
iconName: 'circle',
|
|
34
|
+
iconColor: 'neutral-500',
|
|
35
|
+
},
|
|
36
|
+
'waiting': {
|
|
37
|
+
label: 'Waiting',
|
|
38
|
+
backgroundColor: 'bg-neutral-100',
|
|
39
|
+
textColor: 'text-neutral-700',
|
|
40
|
+
iconName: 'pause',
|
|
41
|
+
iconColor: 'neutral-500',
|
|
42
|
+
},
|
|
43
|
+
'on-hold': {
|
|
44
|
+
label: 'On Hold',
|
|
45
|
+
backgroundColor: 'bg-neutral-100',
|
|
46
|
+
textColor: 'text-neutral-700',
|
|
47
|
+
iconName: 'pause',
|
|
48
|
+
iconColor: 'neutral-500',
|
|
49
|
+
},
|
|
50
|
+
'queued': {
|
|
51
|
+
label: 'Queued',
|
|
52
|
+
backgroundColor: 'bg-neutral-100',
|
|
53
|
+
textColor: 'text-neutral-700',
|
|
54
|
+
iconName: 'queued',
|
|
55
|
+
iconColor: 'neutral-500',
|
|
56
|
+
},
|
|
57
|
+
'validation-error': {
|
|
58
|
+
label: 'Validation Error',
|
|
59
|
+
backgroundColor: 'bg-red-50',
|
|
60
|
+
textColor: 'text-red-700',
|
|
61
|
+
iconName: 'close',
|
|
62
|
+
iconColor: 'red-500',
|
|
63
|
+
},
|
|
64
|
+
'running': {
|
|
65
|
+
label: 'Running',
|
|
66
|
+
backgroundColor: 'bg-neutral-100',
|
|
67
|
+
textColor: 'text-primary',
|
|
68
|
+
iconName: 'circle-notch',
|
|
69
|
+
iconColor: 'neutral-400',
|
|
70
|
+
},
|
|
71
|
+
'executing': {
|
|
72
|
+
label: 'Executing',
|
|
73
|
+
backgroundColor: 'bg-neutral-100',
|
|
74
|
+
textColor: 'text-primary',
|
|
75
|
+
iconName: 'circle-notch',
|
|
76
|
+
iconColor: 'neutral-400',
|
|
77
|
+
},
|
|
78
|
+
'processing': {
|
|
79
|
+
label: 'Processing',
|
|
80
|
+
backgroundColor: 'bg-neutral-100',
|
|
81
|
+
textColor: 'text-primary',
|
|
82
|
+
iconName: 'circle-notch',
|
|
83
|
+
iconColor: 'neutral-400',
|
|
84
|
+
},
|
|
85
|
+
'verifying': {
|
|
86
|
+
label: 'Verifying',
|
|
87
|
+
backgroundColor: 'bg-neutral-100',
|
|
88
|
+
textColor: 'text-primary',
|
|
89
|
+
iconName: 'circle-notch',
|
|
90
|
+
iconColor: 'neutral-400',
|
|
91
|
+
},
|
|
92
|
+
'initializing': {
|
|
93
|
+
label: 'Initializing',
|
|
94
|
+
backgroundColor: 'bg-neutral-100',
|
|
95
|
+
textColor: 'text-primary',
|
|
96
|
+
iconName: 'circle-notch',
|
|
97
|
+
iconColor: 'neutral-400',
|
|
98
|
+
},
|
|
99
|
+
'waiting-user': {
|
|
100
|
+
label: 'Waiting for User',
|
|
101
|
+
backgroundColor: 'bg-sky-100',
|
|
102
|
+
textColor: 'text-sky-700',
|
|
103
|
+
iconName: 'circle-minus',
|
|
104
|
+
iconColor: 'sky-500',
|
|
105
|
+
},
|
|
106
|
+
'awaiting-approval': {
|
|
107
|
+
label: 'Awaiting Approval',
|
|
108
|
+
backgroundColor: 'bg-sky-100',
|
|
109
|
+
textColor: 'text-sky-700',
|
|
110
|
+
iconName: 'circle-minus',
|
|
111
|
+
iconColor: 'sky-500',
|
|
112
|
+
},
|
|
113
|
+
'paused': {
|
|
114
|
+
label: 'Paused',
|
|
115
|
+
backgroundColor: 'bg-neutral-100',
|
|
116
|
+
textColor: 'text-neutral-700',
|
|
117
|
+
iconName: 'pause',
|
|
118
|
+
iconColor: 'neutral-500',
|
|
119
|
+
},
|
|
120
|
+
'stopped': {
|
|
121
|
+
label: 'Stopped',
|
|
122
|
+
backgroundColor: 'bg-neutral-100',
|
|
123
|
+
textColor: 'text-primary',
|
|
124
|
+
iconName: 'stop',
|
|
125
|
+
iconColor: 'neutral-700',
|
|
126
|
+
},
|
|
127
|
+
'suspended': {
|
|
128
|
+
label: 'Suspended',
|
|
129
|
+
backgroundColor: 'bg-neutral-100',
|
|
130
|
+
textColor: 'text-secondary',
|
|
131
|
+
iconName: 'circle-dashed',
|
|
132
|
+
iconColor: 'neutral-100',
|
|
133
|
+
},
|
|
134
|
+
'running-issues': {
|
|
135
|
+
label: 'Running with Issues',
|
|
136
|
+
backgroundColor: 'bg-amber-100',
|
|
137
|
+
textColor: 'text-amber-700',
|
|
138
|
+
iconName: 'warning',
|
|
139
|
+
iconColor: 'amber-700',
|
|
140
|
+
},
|
|
141
|
+
'warning': {
|
|
142
|
+
label: 'Warning',
|
|
143
|
+
backgroundColor: 'bg-amber-100',
|
|
144
|
+
textColor: 'text-amber-700',
|
|
145
|
+
iconName: 'circle-warning',
|
|
146
|
+
iconColor: 'amber-500',
|
|
147
|
+
},
|
|
148
|
+
'low-coverage': {
|
|
149
|
+
label: 'Low coverage',
|
|
150
|
+
backgroundColor: 'bg-amber-100',
|
|
151
|
+
textColor: 'text-amber-700',
|
|
152
|
+
iconName: 'half-slice',
|
|
153
|
+
iconColor: 'amber-500',
|
|
154
|
+
},
|
|
155
|
+
'medium-coverage': {
|
|
156
|
+
label: 'Medium coverage',
|
|
157
|
+
backgroundColor: 'bg-amber-100',
|
|
158
|
+
textColor: 'text-amber-700',
|
|
159
|
+
iconName: 'slice',
|
|
160
|
+
iconColor: 'amber-500',
|
|
161
|
+
},
|
|
162
|
+
'completed': {
|
|
163
|
+
label: 'Completed',
|
|
164
|
+
backgroundColor: 'bg-green-100',
|
|
165
|
+
textColor: 'text-green-700',
|
|
166
|
+
iconName: 'check',
|
|
167
|
+
iconColor: 'green-600',
|
|
168
|
+
},
|
|
169
|
+
'success': {
|
|
170
|
+
label: 'Success',
|
|
171
|
+
backgroundColor: 'bg-green-100',
|
|
172
|
+
textColor: 'text-green-700',
|
|
173
|
+
iconName: 'check',
|
|
174
|
+
iconColor: 'green-600',
|
|
175
|
+
},
|
|
176
|
+
'pending-review': {
|
|
177
|
+
label: 'Pending Review',
|
|
178
|
+
backgroundColor: 'bg-sky-100',
|
|
179
|
+
textColor: 'text-sky-700',
|
|
180
|
+
iconName: 'circle',
|
|
181
|
+
iconColor: 'sky-500',
|
|
182
|
+
},
|
|
183
|
+
'approved': {
|
|
184
|
+
label: 'Approved',
|
|
185
|
+
backgroundColor: 'bg-green-100',
|
|
186
|
+
textColor: 'text-green-700',
|
|
187
|
+
iconName: 'check',
|
|
188
|
+
iconColor: 'green-600',
|
|
189
|
+
},
|
|
190
|
+
'approved-changes': {
|
|
191
|
+
label: 'Approved with Changes',
|
|
192
|
+
backgroundColor: 'bg-emerald-50',
|
|
193
|
+
textColor: 'text-emerald-700',
|
|
194
|
+
iconName: 'check-dashed',
|
|
195
|
+
iconColor: 'emerald-600',
|
|
196
|
+
},
|
|
197
|
+
'reproved': {
|
|
198
|
+
label: 'Reproved',
|
|
199
|
+
backgroundColor: 'bg-red-50',
|
|
200
|
+
textColor: 'text-red-700',
|
|
201
|
+
iconName: 'close',
|
|
202
|
+
iconColor: 'red-500',
|
|
203
|
+
},
|
|
204
|
+
'reviewing': {
|
|
205
|
+
label: 'Reviewing',
|
|
206
|
+
backgroundColor: 'bg-sky-100',
|
|
207
|
+
textColor: 'text-sky-700',
|
|
208
|
+
iconName: 'circle-notch',
|
|
209
|
+
iconColor: 'sky-500',
|
|
210
|
+
},
|
|
211
|
+
'reviewed': {
|
|
212
|
+
label: 'Reviewed',
|
|
213
|
+
backgroundColor: 'bg-sky-100',
|
|
214
|
+
textColor: 'text-sky-700',
|
|
215
|
+
iconName: 'check',
|
|
216
|
+
iconColor: 'sky-500',
|
|
217
|
+
},
|
|
218
|
+
'error': {
|
|
219
|
+
label: 'Error',
|
|
220
|
+
backgroundColor: 'bg-red-50',
|
|
221
|
+
textColor: 'text-red-700',
|
|
222
|
+
iconName: 'close',
|
|
223
|
+
iconColor: 'red-500',
|
|
224
|
+
},
|
|
225
|
+
'failed': {
|
|
226
|
+
label: 'Failed',
|
|
227
|
+
backgroundColor: 'bg-red-50',
|
|
228
|
+
textColor: 'text-red-700',
|
|
229
|
+
iconName: 'close',
|
|
230
|
+
iconColor: 'red-500',
|
|
231
|
+
},
|
|
232
|
+
'cancelled': {
|
|
233
|
+
label: 'Cancelled',
|
|
234
|
+
backgroundColor: 'bg-neutral-100',
|
|
235
|
+
textColor: 'text-secondary',
|
|
236
|
+
iconName: 'close',
|
|
237
|
+
iconColor: 'neutral-400',
|
|
238
|
+
},
|
|
239
|
+
'archived': {
|
|
240
|
+
label: 'Archived',
|
|
241
|
+
backgroundColor: 'bg-neutral-100',
|
|
242
|
+
textColor: 'text-secondary',
|
|
243
|
+
iconName: 'arrow-down',
|
|
244
|
+
iconColor: 'neutral-400',
|
|
245
|
+
},
|
|
246
|
+
'reported': {
|
|
247
|
+
label: 'Reported',
|
|
248
|
+
backgroundColor: 'bg-neutral-100',
|
|
249
|
+
textColor: 'text-secondary',
|
|
250
|
+
iconName: 'reported',
|
|
251
|
+
iconColor: 'neutral-400',
|
|
252
|
+
},
|
|
253
|
+
'expired': {
|
|
254
|
+
label: 'Expired',
|
|
255
|
+
backgroundColor: 'bg-neutral-100',
|
|
256
|
+
textColor: 'text-secondary',
|
|
257
|
+
iconName: 'circle-warning',
|
|
258
|
+
iconColor: 'neutral-400',
|
|
259
|
+
},
|
|
260
|
+
'partially-completed': {
|
|
261
|
+
label: 'Partially Completed',
|
|
262
|
+
backgroundColor: 'bg-neutral-100',
|
|
263
|
+
textColor: 'text-primary',
|
|
264
|
+
iconName: 'semi-circle',
|
|
265
|
+
iconColor: 'neutral-400',
|
|
266
|
+
},
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
const currentStatus = computed<StatusConfig>(() => {
|
|
270
|
+
const variant = props.variant ?? 'running'
|
|
271
|
+
|
|
272
|
+
return variantConfig[variant] ?? variantConfig.running
|
|
273
|
+
})
|
|
274
|
+
|
|
275
|
+
const backgroundColor = computed(() => currentStatus.value.backgroundColor)
|
|
276
|
+
const textColor = computed(() => currentStatus.value.textColor)
|
|
277
|
+
const iconName = computed(() => currentStatus.value.iconName)
|
|
278
|
+
const iconColor = computed(() => currentStatus.value.iconColor)
|
|
279
|
+
const statusLabel = computed(() => props.label || currentStatus.value.label)
|
|
280
|
+
|
|
281
|
+
const contentMeasure = useTemplateRef<HTMLElement>('contentMeasure')
|
|
282
|
+
const widthContent = ref(0)
|
|
283
|
+
|
|
284
|
+
const computedWidthContent = computed(() => {
|
|
285
|
+
if (widthContent.value > 0) {
|
|
286
|
+
return `${widthContent.value}px`
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
return undefined
|
|
290
|
+
})
|
|
291
|
+
|
|
292
|
+
watch(
|
|
293
|
+
() => [props.variant, statusLabel.value],
|
|
294
|
+
() => {
|
|
295
|
+
nextTick(() => {
|
|
296
|
+
if (contentMeasure.value) {
|
|
297
|
+
const clone = contentMeasure.value.cloneNode(true) as HTMLElement
|
|
298
|
+
|
|
299
|
+
clone.style.position = 'absolute'
|
|
300
|
+
clone.style.visibility = 'hidden'
|
|
301
|
+
clone.style.width = 'auto'
|
|
302
|
+
|
|
303
|
+
document.body.appendChild(clone)
|
|
304
|
+
|
|
305
|
+
widthContent.value = clone.offsetWidth
|
|
306
|
+
|
|
307
|
+
document.body.removeChild(clone)
|
|
308
|
+
}
|
|
309
|
+
})
|
|
310
|
+
},
|
|
311
|
+
{ immediate: true },
|
|
312
|
+
)
|
|
313
|
+
|
|
314
|
+
const shineClass = computed(() => {
|
|
315
|
+
const baseColor = currentStatus.value.textColor.replace('text-', '')
|
|
316
|
+
|
|
317
|
+
const gradientMap: Record<string, string> = {
|
|
318
|
+
'primary': 'bg-[linear-gradient(110deg,#1F2937_35%,#9CA3AF_50%,#1F2937_75%)]',
|
|
319
|
+
'sky-700': 'bg-[linear-gradient(110deg,#0369a1_35%,#93D2F8_50%,#0369a1_75%)]',
|
|
320
|
+
'amber-700': 'bg-[linear-gradient(110deg,#b45309_35%,#fcd34d_50%,#b45309_75%)]',
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
return [
|
|
324
|
+
gradientMap[baseColor] || gradientMap.primary,
|
|
325
|
+
'bg-[length:350%_100%] bg-clip-text text-transparent animate-shine',
|
|
326
|
+
]
|
|
327
|
+
})
|
|
328
|
+
|
|
329
|
+
const isShineVisible = computed(() => ['running', 'executing', 'processing', 'verifying', 'initializing', 'reviewing'].includes(props.variant))
|
|
330
|
+
|
|
331
|
+
function iconVariants() {
|
|
332
|
+
return {
|
|
333
|
+
initial: {
|
|
334
|
+
opacity: 0,
|
|
335
|
+
scale: 0.6,
|
|
336
|
+
},
|
|
337
|
+
animate: {
|
|
338
|
+
opacity: 1,
|
|
339
|
+
scale: 1,
|
|
340
|
+
},
|
|
341
|
+
exit: {
|
|
342
|
+
opacity: 0,
|
|
343
|
+
scale: 0.56,
|
|
344
|
+
},
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
function textVariants() {
|
|
349
|
+
return {
|
|
350
|
+
initial: {
|
|
351
|
+
opacity: 0,
|
|
352
|
+
x: -15,
|
|
353
|
+
},
|
|
354
|
+
animate: {
|
|
355
|
+
opacity: 1,
|
|
356
|
+
x: 0,
|
|
357
|
+
},
|
|
358
|
+
exit: {
|
|
359
|
+
opacity: 0,
|
|
360
|
+
x: -15,
|
|
361
|
+
},
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
const SPRING_CONFIG = {
|
|
366
|
+
type: 'spring',
|
|
367
|
+
duration: 0.4,
|
|
368
|
+
bounce: 0,
|
|
369
|
+
} as const
|
|
370
|
+
</script>
|
|
371
|
+
|
|
372
|
+
<template>
|
|
373
|
+
<MotionConfig :transition="SPRING_CONFIG">
|
|
374
|
+
<div :class="cn('relative w-fit px-[6px] py-[3px] rounded-[8px] select-none overflow-hidden', backgroundColor)">
|
|
375
|
+
<div
|
|
376
|
+
class="[transition:width_0.16s_ease-out]"
|
|
377
|
+
:style="computedWidthContent ? { width: computedWidthContent } : {}"
|
|
378
|
+
>
|
|
379
|
+
<div ref="contentMeasure">
|
|
380
|
+
<AnimatePresence mode="popLayout" :initial="false">
|
|
381
|
+
<Motion
|
|
382
|
+
:key="`${props.variant}-${statusLabel}`"
|
|
383
|
+
flex items-center gap-4px
|
|
384
|
+
v-bind="{ initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 } }"
|
|
385
|
+
>
|
|
386
|
+
<div :class="cn('relative z-1 p-[2px]', backgroundColor)">
|
|
387
|
+
<Motion :key="`icon-${iconName}`" v-bind="iconVariants()">
|
|
388
|
+
<TelaIconCustom :name="iconName" :color="iconColor" />
|
|
389
|
+
</Motion>
|
|
390
|
+
</div>
|
|
391
|
+
<Motion
|
|
392
|
+
:key="`text-${statusLabel}`"
|
|
393
|
+
as="span"
|
|
394
|
+
v-bind="textVariants()"
|
|
395
|
+
:class="cn('body-14-medium whitespace-nowrap', isShineVisible ? shineClass : textColor)"
|
|
396
|
+
>
|
|
397
|
+
{{ statusLabel }}
|
|
398
|
+
</Motion>
|
|
399
|
+
</Motion>
|
|
400
|
+
</AnimatePresence>
|
|
401
|
+
</div>
|
|
402
|
+
</div>
|
|
403
|
+
</div>
|
|
404
|
+
</MotionConfig>
|
|
405
|
+
</template>
|
|
406
|
+
|
|
407
|
+
<style scoped>
|
|
408
|
+
.animate-shine {
|
|
409
|
+
animation: shine 6s 0.05s linear infinite;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
@keyframes shine {
|
|
413
|
+
0% {
|
|
414
|
+
background-position: 350% 0;
|
|
415
|
+
}
|
|
416
|
+
100% {
|
|
417
|
+
background-position: -350% 0;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
</style>
|