@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,104 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
2
|
+
import { ref } from 'vue'
|
|
3
|
+
|
|
4
|
+
import Checkbox from './checkbox.vue'
|
|
5
|
+
import TelaCheckboxCard from './checkbox-card.vue'
|
|
6
|
+
|
|
7
|
+
const meta: Meta<typeof Checkbox> = {
|
|
8
|
+
title: 'Core/Checkbox',
|
|
9
|
+
component: Checkbox,
|
|
10
|
+
parameters: {
|
|
11
|
+
layout: 'centered',
|
|
12
|
+
docs: {
|
|
13
|
+
description: {
|
|
14
|
+
component: 'A checkbox component built on reka-ui. Supports v-model binding, disabled states, and integrates with forms. Also includes a checkbox card variant for more complex use cases with labels and descriptions.',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
argTypes: {
|
|
19
|
+
modelValue: {
|
|
20
|
+
control: 'boolean',
|
|
21
|
+
description: 'The checked state (v-model). True when checked, false when unchecked.',
|
|
22
|
+
},
|
|
23
|
+
disabled: {
|
|
24
|
+
control: 'boolean',
|
|
25
|
+
description: 'Disable the checkbox, preventing user interaction.',
|
|
26
|
+
},
|
|
27
|
+
required: {
|
|
28
|
+
control: 'boolean',
|
|
29
|
+
description: 'Mark the checkbox as required in forms.',
|
|
30
|
+
},
|
|
31
|
+
name: {
|
|
32
|
+
control: 'text',
|
|
33
|
+
description: 'Name attribute for form submission.',
|
|
34
|
+
},
|
|
35
|
+
value: {
|
|
36
|
+
control: 'text',
|
|
37
|
+
description: 'Value attribute for form submission when checked.',
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
args: {
|
|
41
|
+
disabled: false,
|
|
42
|
+
},
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export default meta
|
|
46
|
+
|
|
47
|
+
type Story = StoryObj<typeof meta>
|
|
48
|
+
|
|
49
|
+
export const Default: Story = {
|
|
50
|
+
render: () => ({
|
|
51
|
+
components: { Checkbox },
|
|
52
|
+
template: `<Checkbox />`,
|
|
53
|
+
}),
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export const WithLabel: Story = {
|
|
57
|
+
render: () => ({
|
|
58
|
+
components: { Checkbox },
|
|
59
|
+
setup() {
|
|
60
|
+
const checked = ref(false)
|
|
61
|
+
return { checked }
|
|
62
|
+
},
|
|
63
|
+
template: `
|
|
64
|
+
<div class="flex items-center gap-2">
|
|
65
|
+
<Checkbox id="checkbox" v-model="checked" />
|
|
66
|
+
<label for="checkbox">Make it available to all workspaces</label>
|
|
67
|
+
</div>
|
|
68
|
+
`,
|
|
69
|
+
}),
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export const Disabled: Story = {
|
|
73
|
+
render: () => ({
|
|
74
|
+
components: { Checkbox },
|
|
75
|
+
template: `<Checkbox disabled />`,
|
|
76
|
+
}),
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export const WithModelValue: Story = {
|
|
80
|
+
render: () => ({
|
|
81
|
+
components: { Checkbox },
|
|
82
|
+
setup() {
|
|
83
|
+
const checked = ref(false)
|
|
84
|
+
return { checked }
|
|
85
|
+
},
|
|
86
|
+
template: `
|
|
87
|
+
<div class="flex items-center gap-2">
|
|
88
|
+
<Checkbox v-model="checked" />
|
|
89
|
+
<label>Unchecked by default</label>
|
|
90
|
+
</div>
|
|
91
|
+
`,
|
|
92
|
+
}),
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export const Card: Story = {
|
|
96
|
+
render: () => ({
|
|
97
|
+
components: { TelaCheckboxCard },
|
|
98
|
+
template: `
|
|
99
|
+
<div class="flex flex-col gap-4">
|
|
100
|
+
<TelaCheckboxCard label="Make available to all workspaces" description="All workspaces will have access to this template." />
|
|
101
|
+
</div>
|
|
102
|
+
`,
|
|
103
|
+
}),
|
|
104
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { CheckboxIndicator, CheckboxRoot, useForwardPropsEmits } from 'reka-ui'
|
|
3
|
+
import type { CheckboxRootEmits, CheckboxRootProps } from 'reka-ui'
|
|
4
|
+
import { reactiveOmit } from '@vueuse/core'
|
|
5
|
+
import type { HTMLAttributes } from 'vue'
|
|
6
|
+
|
|
7
|
+
const props = defineProps<CheckboxRootProps & { class?: HTMLAttributes['class'] }>()
|
|
8
|
+
const emits = defineEmits<CheckboxRootEmits>()
|
|
9
|
+
|
|
10
|
+
const delegatedProps = reactiveOmit(props, 'class')
|
|
11
|
+
|
|
12
|
+
const forwarded = useForwardPropsEmits(delegatedProps, emits)
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<template>
|
|
16
|
+
<CheckboxRoot
|
|
17
|
+
v-bind="forwarded"
|
|
18
|
+
:class="cn(
|
|
19
|
+
'grid place-content-center peer w-16px h-16px shrink-0 rounded-5px border-[1px] border-gray-300 bg-white-1000 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-cyan-600',
|
|
20
|
+
'hover:data-[state=unchecked]:bg-gray-100 data-[state=checked]:border-transparent data-[state=checked]:bg-gray-950 hover:data-[state=checked]:bg-gray-700',
|
|
21
|
+
'disabled:cursor-not-allowed disabled:bg-gray-100 disabled:border-gray-200 disabled:data-[state=checked]:bg-gray-300',
|
|
22
|
+
props.class,
|
|
23
|
+
)"
|
|
24
|
+
>
|
|
25
|
+
<CheckboxIndicator class="grid place-content-center">
|
|
26
|
+
<svg
|
|
27
|
+
viewBox="0 0 24 24"
|
|
28
|
+
fill="none"
|
|
29
|
+
stroke-linecap="round"
|
|
30
|
+
stroke-linejoin="round"
|
|
31
|
+
class="shrink-0 stroke-3 stroke-white-1000 w-14px h-11px"
|
|
32
|
+
>
|
|
33
|
+
<Motion
|
|
34
|
+
as="path"
|
|
35
|
+
d="M5 13 L10 18 L20 6"
|
|
36
|
+
:initial="{ scale: 0.85, pathLength: 0 }"
|
|
37
|
+
:animate="{ scale: 1, pathLength: 1 }"
|
|
38
|
+
:transition="{ duration: 0.2, ease: [0.645, 0.045, 0.355, 1] }"
|
|
39
|
+
/>
|
|
40
|
+
</svg>
|
|
41
|
+
</CheckboxIndicator>
|
|
42
|
+
</CheckboxRoot>
|
|
43
|
+
</template>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { CollapsibleRootEmits, CollapsibleRootProps } from 'radix-vue'
|
|
3
|
+
import { CollapsibleRoot, useForwardPropsEmits } from 'radix-vue'
|
|
4
|
+
|
|
5
|
+
const props = defineProps<CollapsibleRootProps>()
|
|
6
|
+
const emits = defineEmits<CollapsibleRootEmits>()
|
|
7
|
+
|
|
8
|
+
const forwarded = useForwardPropsEmits(props, emits)
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<template>
|
|
12
|
+
<CollapsibleRoot v-slot="{ open }" v-bind="forwarded">
|
|
13
|
+
<slot :open="open" />
|
|
14
|
+
</CollapsibleRoot>
|
|
15
|
+
</template>
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { CollapsibleContent } from 'radix-vue'
|
|
3
|
+
import type { CollapsibleContentProps } from 'radix-vue'
|
|
4
|
+
|
|
5
|
+
const props = defineProps<CollapsibleContentProps & { autoscroll?: boolean }>()
|
|
6
|
+
|
|
7
|
+
const containerEl = ref()
|
|
8
|
+
|
|
9
|
+
function handleOpenAutoComplete() {
|
|
10
|
+
if (props.autoscroll) {
|
|
11
|
+
nextTick(() => {
|
|
12
|
+
setTimeout(() => {
|
|
13
|
+
containerEl.value?.scrollIntoView({ behavior: 'smooth' })
|
|
14
|
+
}, 300)
|
|
15
|
+
})
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<template>
|
|
21
|
+
<CollapsibleContent
|
|
22
|
+
v-bind="props"
|
|
23
|
+
data-collapsible-content
|
|
24
|
+
class="overflow-hidden collapsible-content"
|
|
25
|
+
@animation-start="handleOpenAutoComplete"
|
|
26
|
+
>
|
|
27
|
+
<div ref="containerEl">
|
|
28
|
+
<slot />
|
|
29
|
+
</div>
|
|
30
|
+
</CollapsibleContent>
|
|
31
|
+
</template>
|
|
32
|
+
|
|
33
|
+
<style scoped>
|
|
34
|
+
@keyframes slide-down {
|
|
35
|
+
from {
|
|
36
|
+
height: 0;
|
|
37
|
+
}
|
|
38
|
+
to {
|
|
39
|
+
height: var(--radix-collapsible-content-height);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@keyframes slide-up {
|
|
44
|
+
from {
|
|
45
|
+
height: var(--radix-collapsible-content-height);
|
|
46
|
+
}
|
|
47
|
+
to {
|
|
48
|
+
height: 0;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.collapsible-content[data-state='open'] {
|
|
53
|
+
animation: slide-down 270ms ease;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.collapsible-content[data-state='closed'] {
|
|
57
|
+
animation: slide-up 270ms ease;
|
|
58
|
+
}
|
|
59
|
+
</style>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { CollapsibleTrigger } from 'radix-vue'
|
|
3
|
+
import type { CollapsibleTriggerProps } from 'radix-vue'
|
|
4
|
+
|
|
5
|
+
const props = defineProps<CollapsibleTriggerProps>()
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<template>
|
|
9
|
+
<CollapsibleTrigger v-bind="props">
|
|
10
|
+
<slot />
|
|
11
|
+
</CollapsibleTrigger>
|
|
12
|
+
</template>
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { Meta, ArgTypes } from '@storybook/blocks';
|
|
2
|
+
|
|
3
|
+
<Meta title="Utility/Collapsible" />
|
|
4
|
+
|
|
5
|
+
# TelaCollapsible
|
|
6
|
+
|
|
7
|
+
A set of composable collapsible components built on reka-ui. Provides full control over collapsible behavior with trigger and content components. Useful for building custom collapsible interfaces, accordions, and expandable sections.
|
|
8
|
+
|
|
9
|
+
## Components
|
|
10
|
+
|
|
11
|
+
- `TelaCollapsible` - Root container (or `TelaCollapsibleRoot`)
|
|
12
|
+
- `TelaCollapsibleTrigger` - Trigger button
|
|
13
|
+
- `TelaCollapsibleContent` - Collapsible content
|
|
14
|
+
|
|
15
|
+
## Props
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
type CollapsibleProps = {
|
|
19
|
+
defaultOpen?: boolean
|
|
20
|
+
open?: boolean
|
|
21
|
+
disabled?: boolean
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Examples
|
|
26
|
+
|
|
27
|
+
### Basic Usage
|
|
28
|
+
|
|
29
|
+
```vue
|
|
30
|
+
<script setup>
|
|
31
|
+
import { ref } from 'vue'
|
|
32
|
+
|
|
33
|
+
const isOpen = ref(false)
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
<template>
|
|
37
|
+
<TelaCollapsible v-model:open="isOpen">
|
|
38
|
+
<TelaCollapsibleTrigger as-child>
|
|
39
|
+
<TelaButton>
|
|
40
|
+
{{ isOpen ? 'Hide' : 'Show' }} Details
|
|
41
|
+
</TelaButton>
|
|
42
|
+
</TelaCollapsibleTrigger>
|
|
43
|
+
<TelaCollapsibleContent>
|
|
44
|
+
<div class="p-4">
|
|
45
|
+
Collapsible content goes here
|
|
46
|
+
</div>
|
|
47
|
+
</TelaCollapsibleContent>
|
|
48
|
+
</TelaCollapsible>
|
|
49
|
+
</template>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Custom Trigger
|
|
53
|
+
|
|
54
|
+
```vue
|
|
55
|
+
<TelaCollapsible>
|
|
56
|
+
<TelaCollapsibleTrigger class="flex items-center gap-2 p-2 hover:bg-gray-100 rounded">
|
|
57
|
+
<TelaIcon name="i-ph-caret-right" class="transition-transform data-[state=open]:rotate-90" />
|
|
58
|
+
<span>Click to expand</span>
|
|
59
|
+
</TelaCollapsibleTrigger>
|
|
60
|
+
<TelaCollapsibleContent>
|
|
61
|
+
<div class="ml-6 p-4">
|
|
62
|
+
Content inside collapsible
|
|
63
|
+
</div>
|
|
64
|
+
</TelaCollapsibleContent>
|
|
65
|
+
</TelaCollapsible>
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Accordion (Multiple Collapsibles)
|
|
69
|
+
|
|
70
|
+
```vue
|
|
71
|
+
<script setup>
|
|
72
|
+
import { ref } from 'vue'
|
|
73
|
+
|
|
74
|
+
const openItems = ref(['item-1'])
|
|
75
|
+
</script>
|
|
76
|
+
|
|
77
|
+
<template>
|
|
78
|
+
<div class="space-y-2">
|
|
79
|
+
<TelaCollapsible
|
|
80
|
+
v-for="item in ['item-1', 'item-2', 'item-3']"
|
|
81
|
+
:key="item"
|
|
82
|
+
:open="openItems.includes(item)"
|
|
83
|
+
@update:open="(open) => {
|
|
84
|
+
if (open) {
|
|
85
|
+
openItems = [item]
|
|
86
|
+
} else {
|
|
87
|
+
openItems = []
|
|
88
|
+
}
|
|
89
|
+
}"
|
|
90
|
+
>
|
|
91
|
+
<TelaCollapsibleTrigger class="w-full p-4 bg-gray-100 hover:bg-gray-200 rounded">
|
|
92
|
+
Section {{ item }}
|
|
93
|
+
</TelaCollapsibleTrigger>
|
|
94
|
+
<TelaCollapsibleContent>
|
|
95
|
+
<div class="p-4 border border-t-0 rounded-b">
|
|
96
|
+
Content for {{ item }}
|
|
97
|
+
</div>
|
|
98
|
+
</TelaCollapsibleContent>
|
|
99
|
+
</TelaCollapsible>
|
|
100
|
+
</div>
|
|
101
|
+
</template>
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Default Open
|
|
105
|
+
|
|
106
|
+
```vue
|
|
107
|
+
<TelaCollapsible :default-open="true">
|
|
108
|
+
<TelaCollapsibleTrigger>
|
|
109
|
+
Toggle Section
|
|
110
|
+
</TelaCollapsibleTrigger>
|
|
111
|
+
<TelaCollapsibleContent>
|
|
112
|
+
This starts open by default
|
|
113
|
+
</TelaCollapsibleContent>
|
|
114
|
+
</TelaCollapsible>
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Disabled
|
|
118
|
+
|
|
119
|
+
```vue
|
|
120
|
+
<TelaCollapsible disabled>
|
|
121
|
+
<TelaCollapsibleTrigger>
|
|
122
|
+
Cannot Open
|
|
123
|
+
</TelaCollapsibleTrigger>
|
|
124
|
+
<TelaCollapsibleContent>
|
|
125
|
+
This content is not accessible
|
|
126
|
+
</TelaCollapsibleContent>
|
|
127
|
+
</TelaCollapsible>
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Features
|
|
131
|
+
|
|
132
|
+
- **Composable**: Build custom collapsible UIs
|
|
133
|
+
- **Controlled/Uncontrolled**: Use with or without v-model
|
|
134
|
+
- **Default State**: Set initial open/closed state
|
|
135
|
+
- **Disabled Support**: Prevent toggling
|
|
136
|
+
- **Smooth Animations**: Built-in transitions
|
|
137
|
+
- **Accessible**: Proper ARIA attributes
|
|
138
|
+
- **Keyboard Support**: Space/Enter to toggle
|
|
139
|
+
|
|
140
|
+
## Use Cases
|
|
141
|
+
|
|
142
|
+
- **Accordions**: Multiple collapsible sections
|
|
143
|
+
- **Details Panels**: Show/hide additional info
|
|
144
|
+
- **Navigation**: Collapsible menu sections
|
|
145
|
+
- **FAQ**: Questions with collapsible answers
|
|
146
|
+
- **Forms**: Collapsible form sections
|
|
147
|
+
- **Filters**: Expandable filter groups
|
|
148
|
+
|
|
149
|
+
## Accessibility
|
|
150
|
+
|
|
151
|
+
- Built on reka-ui primitives
|
|
152
|
+
- Proper ARIA attributes (aria-expanded, aria-controls)
|
|
153
|
+
- Keyboard navigation (Space/Enter)
|
|
154
|
+
- Focus management
|
|
155
|
+
- Screen reader support
|
|
156
|
+
- Data attributes for styling states
|
|
157
|
+
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { Meta, Canvas, ArgTypes } from '@storybook/blocks';
|
|
2
|
+
import * as CollapsibleSectionStories from './collapsible-section.stories.ts';
|
|
3
|
+
|
|
4
|
+
<Meta of={CollapsibleSectionStories} />
|
|
5
|
+
|
|
6
|
+
# TelaCollapsibleSection
|
|
7
|
+
|
|
8
|
+
A collapsible section component that can expand and collapse to show/hide content. Supports different titles for open and closed states, icons, and default open state. Useful for organizing content into expandable sections, accordions, and detail views.
|
|
9
|
+
|
|
10
|
+
## Examples
|
|
11
|
+
|
|
12
|
+
### Basic Usage
|
|
13
|
+
|
|
14
|
+
```vue
|
|
15
|
+
<TelaCollapsibleSection
|
|
16
|
+
title="Hide Details"
|
|
17
|
+
title-closed="Show Details"
|
|
18
|
+
:default-open="true"
|
|
19
|
+
>
|
|
20
|
+
<p>This content can be collapsed and expanded.</p>
|
|
21
|
+
</TelaCollapsibleSection>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### With Different Titles
|
|
25
|
+
|
|
26
|
+
```vue
|
|
27
|
+
<TelaCollapsibleSection
|
|
28
|
+
title="Collapse"
|
|
29
|
+
title-closed="Expand"
|
|
30
|
+
>
|
|
31
|
+
<div class="p-4">
|
|
32
|
+
<p>Content that can be toggled</p>
|
|
33
|
+
</div>
|
|
34
|
+
</TelaCollapsibleSection>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### With Icon
|
|
38
|
+
|
|
39
|
+
```vue
|
|
40
|
+
<TelaCollapsibleSection
|
|
41
|
+
title="Close"
|
|
42
|
+
title-closed="Open"
|
|
43
|
+
icon="i-ph-info"
|
|
44
|
+
>
|
|
45
|
+
<p>Collapsible content with an icon</p>
|
|
46
|
+
</TelaCollapsibleSection>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Default Closed
|
|
50
|
+
|
|
51
|
+
```vue
|
|
52
|
+
<TelaCollapsibleSection
|
|
53
|
+
title="Hide"
|
|
54
|
+
title-closed="Show More"
|
|
55
|
+
:default-open="false"
|
|
56
|
+
>
|
|
57
|
+
<p>This starts collapsed</p>
|
|
58
|
+
</TelaCollapsibleSection>
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### FAQ Section
|
|
62
|
+
|
|
63
|
+
```vue
|
|
64
|
+
<div class="space-y-4">
|
|
65
|
+
<TelaCollapsibleSection
|
|
66
|
+
title="Hide Answer"
|
|
67
|
+
title-closed="What is your return policy?"
|
|
68
|
+
:default-open="false"
|
|
69
|
+
>
|
|
70
|
+
<p class="p-4 bg-gray-50 rounded">
|
|
71
|
+
We offer a 30-day return policy on all items...
|
|
72
|
+
</p>
|
|
73
|
+
</TelaCollapsibleSection>
|
|
74
|
+
|
|
75
|
+
<TelaCollapsibleSection
|
|
76
|
+
title="Hide Answer"
|
|
77
|
+
title-closed="How long does shipping take?"
|
|
78
|
+
:default-open="false"
|
|
79
|
+
>
|
|
80
|
+
<p class="p-4 bg-gray-50 rounded">
|
|
81
|
+
Standard shipping takes 5-7 business days...
|
|
82
|
+
</p>
|
|
83
|
+
</TelaCollapsibleSection>
|
|
84
|
+
</div>
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Details Panel
|
|
88
|
+
|
|
89
|
+
```vue
|
|
90
|
+
<TelaCollapsibleSection
|
|
91
|
+
title="Hide Details"
|
|
92
|
+
title-closed="Show Full Details"
|
|
93
|
+
icon="i-ph-info-circle"
|
|
94
|
+
:default-open="true"
|
|
95
|
+
>
|
|
96
|
+
<div class="p-4 space-y-3">
|
|
97
|
+
<div>
|
|
98
|
+
<strong>Name:</strong> Product Name
|
|
99
|
+
</div>
|
|
100
|
+
<div>
|
|
101
|
+
<strong>SKU:</strong> ABC-123
|
|
102
|
+
</div>
|
|
103
|
+
<div>
|
|
104
|
+
<strong>Price:</strong> $99.99
|
|
105
|
+
</div>
|
|
106
|
+
<div>
|
|
107
|
+
<strong>Description:</strong> Detailed product description...
|
|
108
|
+
</div>
|
|
109
|
+
</div>
|
|
110
|
+
</TelaCollapsibleSection>
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Settings Section
|
|
114
|
+
|
|
115
|
+
```vue
|
|
116
|
+
<TelaCollapsibleSection
|
|
117
|
+
title="Hide Advanced Settings"
|
|
118
|
+
title-closed="Show Advanced Settings"
|
|
119
|
+
:default-open="false"
|
|
120
|
+
>
|
|
121
|
+
<div class="p-4 space-y-3">
|
|
122
|
+
<TelaInput label="API Key" type="password" />
|
|
123
|
+
<TelaInput label="Webhook URL" />
|
|
124
|
+
<TelaCheckbox label="Enable notifications" />
|
|
125
|
+
</div>
|
|
126
|
+
</TelaCollapsibleSection>
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Props
|
|
130
|
+
|
|
131
|
+
<ArgTypes />
|
|
132
|
+
|
|
133
|
+
```typescript
|
|
134
|
+
type CollapsibleSectionProps = {
|
|
135
|
+
title?: string
|
|
136
|
+
titleClosed?: string
|
|
137
|
+
icon?: string
|
|
138
|
+
defaultOpen?: boolean
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Slots
|
|
143
|
+
|
|
144
|
+
- `default` - Content that can be collapsed/expanded
|
|
145
|
+
|
|
146
|
+
## Features
|
|
147
|
+
|
|
148
|
+
- **Smooth Animation**: Content animates when expanding/collapsing
|
|
149
|
+
- **Custom Titles**: Different titles for open and closed states
|
|
150
|
+
- **Icon Support**: Add icons to the trigger button
|
|
151
|
+
- **Default State**: Start open or closed
|
|
152
|
+
- **Keyboard Accessible**: Can be toggled with keyboard
|
|
153
|
+
- **Accessible**: Proper ARIA attributes
|
|
154
|
+
|
|
155
|
+
## Use Cases
|
|
156
|
+
|
|
157
|
+
- **FAQ Sections**: Questions with collapsible answers
|
|
158
|
+
- **Details Panels**: Show/hide detailed information
|
|
159
|
+
- **Settings**: Hide advanced options until needed
|
|
160
|
+
- **Accordions**: Stack multiple collapsible sections
|
|
161
|
+
- **Content Organization**: Manage long-form content
|
|
162
|
+
- **Navigation**: Collapsible menu sections
|
|
163
|
+
|
|
164
|
+
## Best Practices
|
|
165
|
+
|
|
166
|
+
1. **Clear Titles**: Make it obvious what will expand
|
|
167
|
+
2. **Consistent Pattern**: Use same title pattern across sections
|
|
168
|
+
3. **Default State**: Choose wisely based on importance
|
|
169
|
+
4. **Group Related**: Keep related content together
|
|
170
|
+
5. **Don't Nest Deeply**: Avoid too many nested collapsibles
|
|
171
|
+
6. **Provide Icons**: Visual indicators help understanding
|
|
172
|
+
|
|
173
|
+
## Accessibility
|
|
174
|
+
|
|
175
|
+
- Built on reka-ui Collapsible primitives
|
|
176
|
+
- Proper ARIA attributes (aria-expanded, aria-controls)
|
|
177
|
+
- Keyboard navigation (Space/Enter to toggle)
|
|
178
|
+
- Focus management
|
|
179
|
+
- Screen reader support
|
|
180
|
+
- Smooth transitions for reduced motion preferences
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
2
|
+
|
|
3
|
+
import CollapsibleSection from './collapsible-section.vue'
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof CollapsibleSection> = {
|
|
6
|
+
title: 'Core/CollapsibleSection',
|
|
7
|
+
component: CollapsibleSection,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: 'centered',
|
|
10
|
+
docs: {
|
|
11
|
+
description: {
|
|
12
|
+
component: 'A collapsible section component that can expand and collapse to show/hide content. Supports different titles for open and closed states, icons, and default open state. Useful for organizing content into expandable sections, accordions, and detail views.',
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
argTypes: {
|
|
17
|
+
title: {
|
|
18
|
+
control: 'text',
|
|
19
|
+
description: 'Title text displayed when the section is open.',
|
|
20
|
+
},
|
|
21
|
+
titleClosed: {
|
|
22
|
+
control: 'text',
|
|
23
|
+
description: 'Title text displayed when the section is closed.',
|
|
24
|
+
},
|
|
25
|
+
icon: {
|
|
26
|
+
control: 'text',
|
|
27
|
+
description: 'Icon name or class to display in the trigger button.',
|
|
28
|
+
},
|
|
29
|
+
defaultOpen: {
|
|
30
|
+
control: 'boolean',
|
|
31
|
+
description: 'Whether the section should be open by default when the component mounts.',
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
args: {
|
|
35
|
+
title: 'Close',
|
|
36
|
+
titleClosed: 'Open',
|
|
37
|
+
defaultOpen: true,
|
|
38
|
+
},
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export default meta
|
|
42
|
+
|
|
43
|
+
type Story = StoryObj<typeof meta>
|
|
44
|
+
|
|
45
|
+
export const Default: Story = {
|
|
46
|
+
render: args => ({
|
|
47
|
+
components: { CollapsibleSection },
|
|
48
|
+
setup() {
|
|
49
|
+
return { args }
|
|
50
|
+
},
|
|
51
|
+
template: `<CollapsibleSection v-bind="args"><p>This is the content inside the collapsible section.</p></CollapsibleSection>`,
|
|
52
|
+
}),
|
|
53
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
const props = defineProps<{
|
|
3
|
+
title?: string
|
|
4
|
+
titleClosed?: string
|
|
5
|
+
icon?: string
|
|
6
|
+
defaultOpen?: boolean
|
|
7
|
+
}>()
|
|
8
|
+
|
|
9
|
+
const emit = defineEmits(['close', 'open'])
|
|
10
|
+
|
|
11
|
+
const isOpen = ref(props.defaultOpen)
|
|
12
|
+
watch(isOpen, (newVal) => {
|
|
13
|
+
emit(newVal ? 'open' : 'close')
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
function close() {
|
|
17
|
+
isOpen.value = false
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
defineExpose({
|
|
21
|
+
close,
|
|
22
|
+
})
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<template>
|
|
26
|
+
<TelaCollapsible v-model:open="isOpen">
|
|
27
|
+
<slot name="trigger" :is-open="isOpen">
|
|
28
|
+
<TelaCollapsibleTrigger w-full relative flex justify-center focus:outline-none>
|
|
29
|
+
<button
|
|
30
|
+
relative b="0.5px solid gray-300" flex items-center
|
|
31
|
+
pr-8px pl-10px py-5px gap-4px rounded-6px
|
|
32
|
+
transition ease
|
|
33
|
+
justify-between
|
|
34
|
+
hover="bg-gray-50"
|
|
35
|
+
active="ring-2 ring-gray-200 b-gray-700 bg-#E8E8E9"
|
|
36
|
+
shadow="[0px_1px_4px_0px_#677F9408]"
|
|
37
|
+
>
|
|
38
|
+
<span body-12-semibold text-gray-700>
|
|
39
|
+
{{ (!isOpen && titleClosed) || title }}
|
|
40
|
+
</span>
|
|
41
|
+
|
|
42
|
+
<TelaIcon name="i-ph-caret-down-bold" size="sm" text-gray-700 transition-all :class="isOpen && 'rotate-180'" />
|
|
43
|
+
</button>
|
|
44
|
+
</TelaCollapsibleTrigger>
|
|
45
|
+
</slot>
|
|
46
|
+
|
|
47
|
+
<TelaCollapsibleContent>
|
|
48
|
+
<slot />
|
|
49
|
+
</TelaCollapsibleContent>
|
|
50
|
+
</TelaCollapsible>
|
|
51
|
+
</template>
|