@meistrari/tela-build 1.77.4 → 1.78.1
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/CHANGELOG.md +48 -0
- package/components/tela/confirmation-modal/confirmation-modal.vue +17 -19
- package/components/tela/filters/user-filter.vue +1 -1
- package/components/tela/modal/modal.mdx +298 -142
- package/components/tela/modal/modal.vue +209 -64
- package/components/tela/modal/switch-workspace/switch-workspace-content.vue +1 -1
- package/components/tela/modal/switch-workspace/switch-workspace.vue +15 -42
- package/components/tela/modal/switch-workspace/types.ts +9 -0
- package/components/tela/preview/preview.mdx +8 -4
- package/components/tela/uploader/uploader-preview.vue +26 -26
- package/components/tela/uploader/uploader.mdx +29 -45
- package/css/animations.css +30 -0
- package/docs/interfaces.md +17 -39
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -11,6 +11,54 @@ Latest updates and announcements.
|
|
|
11
11
|
|
|
12
12
|
- `TelaTransparentInput` only emits `blur` on an outside click when its input has focus. Without `displayIcon`, the first click anywhere on the page used to emit `blur`, so title fields saved an unchanged value on every visit.
|
|
13
13
|
|
|
14
|
+
### Modal: new design, action required
|
|
15
|
+
|
|
16
|
+
[Modal](/components/modal) has a new design: a built-in header (title, description, close button), a body that scrolls between a pinned header and footer, and a right-aligned footer. **Your existing modals don't change until you update them.** Without `size`, `TelaModal` keeps rendering the legacy layout, which is now deprecated and will be removed in a future major version.
|
|
17
|
+
|
|
18
|
+
**What you need to do.** For each `TelaModal` in your app:
|
|
19
|
+
|
|
20
|
+
1. Add `size`, chosen by content: `sm` (320px) for confirmations, single-field prompts and create modals; `md` (480px) for forms and share panels; `lg` (840px) for tables, galleries and previews.
|
|
21
|
+
2. Move the title and subtitle into the `title` and `description` props, and delete any hand-built header and close button: the modal renders both.
|
|
22
|
+
3. Move the action buttons into the `footer` slot, without a wrapper `div`. Drop Cancel/Back buttons that only close the modal, since the close button does that. Footer buttons use the default size: never `size="lg"`, `size="sm"` or a custom `class`.
|
|
23
|
+
4. Remove the legacy props: `modal-width`, `compact`, `hide-dividers`, `small-title`, `is-close-icon-absolute`, `:is-close-icon="false"`, and width or padding overrides such as `class="w-420px!"` or `dialog-content-class="!p-20px"`. Your editor shows these as deprecated.
|
|
24
|
+
|
|
25
|
+
```vue
|
|
26
|
+
<!-- Before -->
|
|
27
|
+
<TelaModal v-model="isOpen" modal-width="md" :compact="true" :hide-dividers="true" :is-close-icon="false">
|
|
28
|
+
<div flex="~ col" w-full gap-16px>
|
|
29
|
+
<div flex="~ row justify-between" items-start>
|
|
30
|
+
<h4 heading-h4-semibold text-primary>Create project</h4>
|
|
31
|
+
<TelaIconButton icon="i-ph-x" size="md" color="secondary" p-8px mt--12px mr--16px @click="isOpen = false" />
|
|
32
|
+
</div>
|
|
33
|
+
<TelaInput v-model="name" label="Name" w-full />
|
|
34
|
+
<div flex gap-8px justify-end>
|
|
35
|
+
<TelaButton variant="secondary" @click="isOpen = false">Cancel</TelaButton>
|
|
36
|
+
<TelaButton @click="create">Create</TelaButton>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
</TelaModal>
|
|
40
|
+
|
|
41
|
+
<!-- After -->
|
|
42
|
+
<TelaModal v-model="isOpen" size="sm" title="Create project">
|
|
43
|
+
<TelaInput v-model="name" label="Name" w-full />
|
|
44
|
+
<template #footer>
|
|
45
|
+
<TelaButton @click="create">Create</TelaButton>
|
|
46
|
+
</template>
|
|
47
|
+
</TelaModal>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Full-bleed viewers that draw their own header (file previews, detail pages) use `size="lg"` (or `fullscreen`) with `hide-header`, and put their content in the unpadded `content` slot. See [Modal](/components/modal) for every example.
|
|
51
|
+
|
|
52
|
+
**What changes without any action:**
|
|
53
|
+
|
|
54
|
+
- Every modal, in both layouts, now opens and closes with the same scale-and-fade as popovers, selects and dropdowns (`popover-enter-exit`), and its backdrop fades on the same timing (`overlay-enter-exit`, also in `css/animations.css`).
|
|
55
|
+
- `TelaConfirmationModal` already uses the new design. Its props and events are unchanged; its message renders under the title in the scrollable body, so long messages never push the buttons out of view.
|
|
56
|
+
- `preventClose` now works: it blocks Escape, outside clicks and the close button while set (e.g. during a save). Some apps already passed it, but it had no effect until now.
|
|
57
|
+
- The close button has an accessible label, `closeLabel` (default `'Close'`). Pass a translated string in localized apps.
|
|
58
|
+
- Modals with a hidden header no longer point `aria-describedby` at a missing description, which silences radix-vue's dev warning.
|
|
59
|
+
|
|
60
|
+
**Also new:** every slot receives a `close` function; `title` and `description` slots take rich content; `content-class`, `header-class`, `title-class`, `dialog-content-class` and `class` merge with the defaults, so `content-class="p-0"` gives an edge-to-edge body. Hairline dividers appear only while content scrolls under the header or footer.
|
|
61
|
+
|
|
14
62
|
## September 25, 2026
|
|
15
63
|
|
|
16
64
|
- [Radio Group](/components/radio-group) and `TelaRadioButton` share one look: `border-strong` border on `bg` (hover `border-accent` on `bg-subtle`), a 5px `neutral-900` border that pops in with a scale animation when checked, and `border`/`bg-muted` when disabled. `TelaRadioButton` now styles its `disabled` state, and `TelaRadioGroup` generates unique ids with `useId()`.
|
|
@@ -4,6 +4,7 @@ import TelaButton from '../button/button.vue'
|
|
|
4
4
|
|
|
5
5
|
const props = defineProps<{
|
|
6
6
|
title: string
|
|
7
|
+
/** @deprecated No effect: the modal uses the sized layout. */
|
|
7
8
|
compact?: boolean
|
|
8
9
|
variant?: 'primary' | 'danger'
|
|
9
10
|
confirmButtonText?: string
|
|
@@ -19,6 +20,7 @@ const emit = defineEmits<{
|
|
|
19
20
|
}>()
|
|
20
21
|
|
|
21
22
|
const open = defineModel<boolean>('open')
|
|
23
|
+
const messageId = useId()
|
|
22
24
|
|
|
23
25
|
const confirmButtonVariant = computed(() => {
|
|
24
26
|
return props.variant === 'danger' ? 'danger' : 'primary'
|
|
@@ -28,30 +30,26 @@ const confirmButtonVariant = computed(() => {
|
|
|
28
30
|
<template>
|
|
29
31
|
<TelaModal
|
|
30
32
|
v-model:model-value="open"
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
size="sm"
|
|
34
|
+
:title="props.title"
|
|
35
|
+
:header-class="$slots.default ? 'pb-[4px]' : undefined"
|
|
33
36
|
:overlay-class="props.overlayClass"
|
|
34
|
-
:
|
|
35
|
-
:
|
|
37
|
+
:prevent-close="props.loading"
|
|
38
|
+
:aria-describedby="$slots.default ? messageId : undefined"
|
|
36
39
|
@close="emit('cancel')"
|
|
37
40
|
>
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
</h6>
|
|
42
|
-
<div body-16-regular text-gray-700 mt-4px>
|
|
43
|
-
<slot />
|
|
44
|
-
</div>
|
|
41
|
+
<!-- the message lives in the scrollable body, not the fixed header, so long text never pushes the buttons out -->
|
|
42
|
+
<div v-if="$slots.default" :id="messageId" class="body-14-regular text-secondary">
|
|
43
|
+
<slot />
|
|
45
44
|
</div>
|
|
45
|
+
|
|
46
46
|
<template #footer>
|
|
47
|
-
<
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
</TelaButton>
|
|
54
|
-
</div>
|
|
47
|
+
<TelaButton :disabled="props.loading" variant="secondary" @click="emit('cancel')">
|
|
48
|
+
{{ props.cancelButtonText ?? 'Cancel' }}
|
|
49
|
+
</TelaButton>
|
|
50
|
+
<TelaButton :loading="props.loading" :variant="confirmButtonVariant" :data-testid="props.confirmButtonTestId" @click="emit('confirm')">
|
|
51
|
+
{{ props.confirmButtonText ?? 'Confirm' }}
|
|
52
|
+
</TelaButton>
|
|
55
53
|
</template>
|
|
56
54
|
</TelaModal>
|
|
57
55
|
</template>
|
|
@@ -4,99 +4,129 @@ import { Meta, ArgTypes } from '@storybook/blocks';
|
|
|
4
4
|
|
|
5
5
|
# TelaModal
|
|
6
6
|
|
|
7
|
-
A modal dialog
|
|
7
|
+
A modal dialog that displays content in a centered overlay. Use it for confirmations, forms, and content that needs the user's full attention.
|
|
8
8
|
|
|
9
|
-
`TelaDialog` is deprecated — **always** use `TelaModal`.
|
|
9
|
+
Pass `size` to get the modal layout: a header with title, description and close button, a body that scrolls on its own, and a right-aligned footer. `TelaDialog` is deprecated — **always** use `TelaModal`.
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
```vue
|
|
12
|
+
<script setup lang="ts">
|
|
13
|
+
import { ref } from 'vue'
|
|
14
|
+
|
|
15
|
+
const isOpen = ref(false)
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<template>
|
|
19
|
+
<TelaButton @click="isOpen = true">
|
|
20
|
+
Open modal
|
|
21
|
+
</TelaButton>
|
|
12
22
|
|
|
13
|
-
|
|
14
|
-
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
23
|
+
<TelaModal
|
|
24
|
+
v-model="isOpen"
|
|
25
|
+
size="sm"
|
|
26
|
+
title="Create tasks"
|
|
27
|
+
description="Add the required information before creating"
|
|
28
|
+
>
|
|
29
|
+
<template #footer>
|
|
30
|
+
<TelaButton @click="isOpen = false">
|
|
31
|
+
Create
|
|
32
|
+
</TelaButton>
|
|
33
|
+
</template>
|
|
34
|
+
</TelaModal>
|
|
35
|
+
</template>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Sizes
|
|
19
39
|
|
|
20
|
-
|
|
40
|
+
| Size | Width | Use for |
|
|
41
|
+
|---|---|---|
|
|
42
|
+
| `sm` | 320px | Confirmations and single-field prompts |
|
|
43
|
+
| `md` | 480px | Forms and most content |
|
|
44
|
+
| `lg` | 840px | Tables, previews, side-by-side content |
|
|
45
|
+
|
|
46
|
+
The width is a maximum: below it the modal shrinks to the viewport with a 16px gutter.
|
|
21
47
|
|
|
22
48
|
```vue
|
|
23
|
-
<
|
|
24
|
-
|
|
25
|
-
modal-width="md"
|
|
26
|
-
:compact="true"
|
|
27
|
-
:hide-dividers="true"
|
|
28
|
-
:is-close-icon="false"
|
|
29
|
-
>
|
|
30
|
-
<div flex="~ col" w-full gap-16px>
|
|
31
|
-
<!-- Header -->
|
|
32
|
-
<div flex="~ row justify-between" items-start>
|
|
33
|
-
<div flex="~ col" gap-4px>
|
|
34
|
-
<h4 heading-h4-semibold text-primary>Dialog Title</h4>
|
|
35
|
-
<p body-14-regular text-secondary>Dialog subtitle or description.</p>
|
|
36
|
-
</div>
|
|
49
|
+
<script setup lang="ts">
|
|
50
|
+
import { ref } from 'vue'
|
|
37
51
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
icon="i-ph-x"
|
|
41
|
-
size="md"
|
|
42
|
-
color="secondary"
|
|
43
|
-
outline-none
|
|
44
|
-
p-8px mt--12px mr--16px
|
|
45
|
-
@click="isOpen = false"
|
|
46
|
-
/>
|
|
47
|
-
</div>
|
|
52
|
+
const isOpen = ref(false)
|
|
53
|
+
const size = ref<'sm' | 'md' | 'lg'>('sm')
|
|
48
54
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
55
|
+
function open(value: 'sm' | 'md' | 'lg') {
|
|
56
|
+
size.value = value
|
|
57
|
+
isOpen.value = true
|
|
58
|
+
}
|
|
59
|
+
</script>
|
|
53
60
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
</
|
|
61
|
+
<template>
|
|
62
|
+
<div flex gap-8px>
|
|
63
|
+
<TelaButton variant="secondary" @click="open('sm')">
|
|
64
|
+
Small
|
|
65
|
+
</TelaButton>
|
|
66
|
+
<TelaButton variant="secondary" @click="open('md')">
|
|
67
|
+
Medium
|
|
68
|
+
</TelaButton>
|
|
69
|
+
<TelaButton variant="secondary" @click="open('lg')">
|
|
70
|
+
Large
|
|
71
|
+
</TelaButton>
|
|
59
72
|
</div>
|
|
60
|
-
|
|
73
|
+
|
|
74
|
+
<TelaModal
|
|
75
|
+
v-model="isOpen"
|
|
76
|
+
:size="size"
|
|
77
|
+
:title="`${size.toUpperCase()} modal`"
|
|
78
|
+
description="The width is capped by the size and shrinks on small screens."
|
|
79
|
+
>
|
|
80
|
+
<p body-14-regular text-primary>
|
|
81
|
+
Modal content goes here.
|
|
82
|
+
</p>
|
|
83
|
+
</TelaModal>
|
|
84
|
+
</template>
|
|
61
85
|
```
|
|
62
86
|
|
|
63
|
-
|
|
87
|
+
## Form
|
|
64
88
|
|
|
65
|
-
|
|
89
|
+
The default slot is the body. The `footer` slot lays its children out in a row with an 8px gap, aligned right. Every slot receives a `close` function.
|
|
66
90
|
|
|
67
91
|
```vue
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
<TelaTextarea v-model="val" w-full />
|
|
71
|
-
<TelaToggleGroup v-model="val" :options="opts" w-full />
|
|
72
|
-
<TelaSelectMenu v-model="val" :options="opts" trigger-class="w-full" />
|
|
73
|
-
<TelaCombobox v-model="val" :options="opts" trigger-class="w-full" />
|
|
92
|
+
<script setup lang="ts">
|
|
93
|
+
import { ref } from 'vue'
|
|
74
94
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
```
|
|
95
|
+
const isOpen = ref(false)
|
|
96
|
+
const name = ref('')
|
|
97
|
+
</script>
|
|
79
98
|
|
|
80
|
-
|
|
99
|
+
<template>
|
|
100
|
+
<TelaButton @click="isOpen = true">
|
|
101
|
+
New project
|
|
102
|
+
</TelaButton>
|
|
81
103
|
|
|
82
|
-
<
|
|
104
|
+
<TelaModal
|
|
105
|
+
v-model="isOpen"
|
|
106
|
+
size="md"
|
|
107
|
+
title="Create project"
|
|
108
|
+
description="Projects group workflows, agents and their shared credentials."
|
|
109
|
+
>
|
|
110
|
+
<TelaInput v-model="name" label="Name" placeholder="Acme onboarding" w-full />
|
|
83
111
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
112
|
+
<template #footer="{ close }">
|
|
113
|
+
<TelaButton variant="secondary" @click="close">
|
|
114
|
+
Cancel
|
|
115
|
+
</TelaButton>
|
|
116
|
+
<TelaButton :disabled="!name" @click="close">
|
|
117
|
+
Create project
|
|
118
|
+
</TelaButton>
|
|
119
|
+
</template>
|
|
120
|
+
</TelaModal>
|
|
121
|
+
</template>
|
|
92
122
|
```
|
|
93
123
|
|
|
94
|
-
##
|
|
124
|
+
## Scrolling Content
|
|
95
125
|
|
|
96
|
-
|
|
126
|
+
The modal never grows past the viewport. The header and footer stay in place while the body scrolls in a `TelaScrollArea`, and a hairline appears under the header and above the footer only while content is scrolled beneath them. Set `hide-dividers` to turn those hairlines off.
|
|
97
127
|
|
|
98
128
|
```vue
|
|
99
|
-
<script setup>
|
|
129
|
+
<script setup lang="ts">
|
|
100
130
|
import { ref } from 'vue'
|
|
101
131
|
|
|
102
132
|
const isOpen = ref(false)
|
|
@@ -104,113 +134,239 @@ const isOpen = ref(false)
|
|
|
104
134
|
|
|
105
135
|
<template>
|
|
106
136
|
<TelaButton @click="isOpen = true">
|
|
107
|
-
|
|
137
|
+
Version history
|
|
108
138
|
</TelaButton>
|
|
109
139
|
|
|
110
|
-
<TelaModal
|
|
111
|
-
|
|
140
|
+
<TelaModal
|
|
141
|
+
v-model="isOpen"
|
|
142
|
+
size="md"
|
|
143
|
+
title="Version history"
|
|
144
|
+
description="Every published version of this workflow."
|
|
145
|
+
>
|
|
146
|
+
<div flex="~ col" gap-12px>
|
|
147
|
+
<p v-for="version in 40" :key="version" body-14-regular text-primary>
|
|
148
|
+
Version {{ version }}
|
|
149
|
+
</p>
|
|
150
|
+
</div>
|
|
151
|
+
|
|
152
|
+
<template #footer>
|
|
153
|
+
<TelaButton @click="isOpen = false">
|
|
154
|
+
Done
|
|
155
|
+
</TelaButton>
|
|
156
|
+
</template>
|
|
112
157
|
</TelaModal>
|
|
113
158
|
</template>
|
|
114
159
|
```
|
|
115
160
|
|
|
116
|
-
|
|
161
|
+
## Prevent Close
|
|
162
|
+
|
|
163
|
+
`prevent-close` blocks Escape, outside clicks and the close button, e.g. while a request is in flight. Closing through `v-model` or the slot `close` function still works.
|
|
117
164
|
|
|
118
165
|
```vue
|
|
119
|
-
<
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
166
|
+
<script setup lang="ts">
|
|
167
|
+
import { ref } from 'vue'
|
|
168
|
+
|
|
169
|
+
const isOpen = ref(false)
|
|
170
|
+
const isSaving = ref(false)
|
|
171
|
+
|
|
172
|
+
async function save() {
|
|
173
|
+
isSaving.value = true
|
|
174
|
+
await new Promise(resolve => setTimeout(resolve, 1500))
|
|
175
|
+
isSaving.value = false
|
|
176
|
+
isOpen.value = false
|
|
177
|
+
}
|
|
178
|
+
</script>
|
|
179
|
+
|
|
180
|
+
<template>
|
|
181
|
+
<TelaButton @click="isOpen = true">
|
|
182
|
+
Save changes
|
|
183
|
+
</TelaButton>
|
|
184
|
+
|
|
185
|
+
<TelaModal
|
|
186
|
+
v-model="isOpen"
|
|
187
|
+
size="sm"
|
|
188
|
+
title="Save changes?"
|
|
189
|
+
description="Your draft will be published."
|
|
190
|
+
:prevent-close="isSaving"
|
|
191
|
+
>
|
|
192
|
+
<template #footer>
|
|
193
|
+
<TelaButton :loading="isSaving" @click="save">
|
|
194
|
+
Save
|
|
129
195
|
</TelaButton>
|
|
130
|
-
</
|
|
131
|
-
</
|
|
132
|
-
</
|
|
196
|
+
</template>
|
|
197
|
+
</TelaModal>
|
|
198
|
+
</template>
|
|
133
199
|
```
|
|
134
200
|
|
|
135
|
-
|
|
201
|
+
## Custom Title and Actions
|
|
202
|
+
|
|
203
|
+
The `title` and `description` slots take rich content and stay wired to the dialog's accessible name and description. The `actions` slot replaces the close button and is centered on the title's first line. Set `:is-close-icon="false"` to hide the close button.
|
|
136
204
|
|
|
137
205
|
```vue
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
<p>Compact modal</p>
|
|
141
|
-
</TelaModal>
|
|
206
|
+
<script setup lang="ts">
|
|
207
|
+
import { ref } from 'vue'
|
|
142
208
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
<p>Standard modal</p>
|
|
146
|
-
</TelaModal>
|
|
209
|
+
const isOpen = ref(false)
|
|
210
|
+
</script>
|
|
147
211
|
|
|
148
|
-
|
|
149
|
-
<
|
|
150
|
-
|
|
151
|
-
</
|
|
212
|
+
<template>
|
|
213
|
+
<TelaButton @click="isOpen = true">
|
|
214
|
+
Open details
|
|
215
|
+
</TelaButton>
|
|
152
216
|
|
|
153
|
-
|
|
154
|
-
<
|
|
155
|
-
|
|
156
|
-
</
|
|
217
|
+
<TelaModal v-model="isOpen" size="md">
|
|
218
|
+
<template #title>
|
|
219
|
+
Invoice <span text-secondary>#1042</span>
|
|
220
|
+
</template>
|
|
221
|
+
<template #description>
|
|
222
|
+
Issued on September 29, 2026
|
|
223
|
+
</template>
|
|
224
|
+
<template #actions="{ close }">
|
|
225
|
+
<TelaIconButton icon="i-ph-arrow-square-out" size="md" color="secondary" aria-label="Open in new tab" />
|
|
226
|
+
<TelaIconButton icon="i-ph-x" size="md" color="secondary" aria-label="Close" @click="close" />
|
|
227
|
+
</template>
|
|
228
|
+
|
|
229
|
+
<p body-14-regular text-primary>
|
|
230
|
+
Invoice content.
|
|
231
|
+
</p>
|
|
232
|
+
</TelaModal>
|
|
233
|
+
</template>
|
|
157
234
|
```
|
|
158
235
|
|
|
159
|
-
|
|
236
|
+
## Custom Layout
|
|
237
|
+
|
|
238
|
+
For layouts the header, body and footer don't cover, fill the `content` slot: it replaces the body with an unpadded area, so combine it with `hide-header` for a blank canvas. Use `fullscreen` to cover the whole viewport.
|
|
160
239
|
|
|
161
240
|
```vue
|
|
162
|
-
<
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
>
|
|
167
|
-
|
|
241
|
+
<script setup lang="ts">
|
|
242
|
+
import { ref } from 'vue'
|
|
243
|
+
|
|
244
|
+
const isOpen = ref(false)
|
|
245
|
+
</script>
|
|
246
|
+
|
|
247
|
+
<template>
|
|
248
|
+
<TelaButton @click="isOpen = true">
|
|
249
|
+
Preview file
|
|
250
|
+
</TelaButton>
|
|
251
|
+
|
|
252
|
+
<TelaModal v-model="isOpen" size="lg" hide-header title="File preview">
|
|
253
|
+
<template #content="{ close }">
|
|
254
|
+
<div flex="~ col" items-center justify-center gap-16px h-400px bg-subtle>
|
|
255
|
+
<p body-14-regular text-secondary>
|
|
256
|
+
Edge-to-edge content
|
|
257
|
+
</p>
|
|
258
|
+
<TelaButton variant="secondary" @click="close">
|
|
259
|
+
Close
|
|
260
|
+
</TelaButton>
|
|
261
|
+
</div>
|
|
262
|
+
</template>
|
|
263
|
+
</TelaModal>
|
|
264
|
+
</template>
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
## Customization
|
|
268
|
+
|
|
269
|
+
The `size` layout is built from UnoCSS utilities, and each part merges its class prop through `cn()` (tailwind-merge), so an override replaces the default instead of stacking with it:
|
|
270
|
+
|
|
271
|
+
| Prop | Element |
|
|
272
|
+
|---|---|
|
|
273
|
+
| `class`, `dialog-content-class` | The modal surface |
|
|
274
|
+
| `overlay-class` | The backdrop |
|
|
275
|
+
| `header-class` | Header row (title, description, actions) |
|
|
276
|
+
| `title-class` | Title |
|
|
277
|
+
| `content-class` | Body (`p-0` for edge-to-edge content) |
|
|
278
|
+
|
|
279
|
+
Standard and bracketed values merge cleanly: `p-0`, `rounded-none`, `max-w-[560px]`. Values tailwind-merge can't classify, like UnoCSS shorthands (`px-32px`) or typography shortcuts (`heading-h3-semibold`), need `!` to win.
|
|
280
|
+
|
|
281
|
+
```vue
|
|
282
|
+
<TelaModal v-model="isOpen" size="md" title="Edge to edge" content-class="p-0">
|
|
283
|
+
<img src="/cover.png" w-full>
|
|
168
284
|
</TelaModal>
|
|
169
285
|
```
|
|
170
286
|
|
|
171
|
-
|
|
287
|
+
## Legacy Layout
|
|
288
|
+
|
|
289
|
+
Without `size`, `TelaModal` renders the original layout, unchanged: a fixed 400px surface capped by `modal-width` (`sm` 300px, `md` 500px, `lg` 900px, `xl` 1024px), 24px padding, and a header, body and footer tuned through `compact`, `hide-dividers`, `is-close-icon`, `is-close-icon-absolute` and `small-title`. Existing modals keep rendering exactly as before. Those props have no effect when `size` is set.
|
|
290
|
+
|
|
291
|
+
To migrate a modal, replace `modal-width` with `size`, drop `compact`, `hide-dividers` and `:is-close-icon="false"`, move a hand-built header into `title` / `description`, and move footer buttons into the `footer` slot. Width overrides such as `class="w-420px!"` usually go away: choose the closest size instead.
|
|
172
292
|
|
|
173
293
|
```vue
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
>
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
294
|
+
<!-- Before -->
|
|
295
|
+
<TelaModal v-model="isOpen" modal-width="md" :compact="true" :hide-dividers="true" :is-close-icon="false">
|
|
296
|
+
<div flex="~ col" w-full gap-16px>
|
|
297
|
+
<div flex="~ row justify-between" items-start>
|
|
298
|
+
<div flex="~ col" gap-4px>
|
|
299
|
+
<h4 heading-h4-semibold text-primary>Dialog Title</h4>
|
|
300
|
+
<p body-14-regular text-secondary>Dialog description.</p>
|
|
301
|
+
</div>
|
|
302
|
+
<TelaIconButton icon="i-ph-x" size="md" color="secondary" p-8px mt--12px mr--16px @click="isOpen = false" />
|
|
303
|
+
</div>
|
|
304
|
+
<TelaInput v-model="name" label="Name" w-full />
|
|
305
|
+
<div flex gap-8px justify-end>
|
|
306
|
+
<TelaButton variant="secondary" @click="isOpen = false">Cancel</TelaButton>
|
|
307
|
+
<TelaButton>Submit</TelaButton>
|
|
308
|
+
</div>
|
|
309
|
+
</div>
|
|
310
|
+
</TelaModal>
|
|
311
|
+
|
|
312
|
+
<!-- After -->
|
|
313
|
+
<TelaModal v-model="isOpen" size="sm" title="Dialog Title" description="Dialog description.">
|
|
314
|
+
<TelaInput v-model="name" label="Name" w-full />
|
|
315
|
+
<template #footer="{ close }">
|
|
316
|
+
<TelaButton variant="secondary" @click="close">Cancel</TelaButton>
|
|
317
|
+
<TelaButton>Submit</TelaButton>
|
|
182
318
|
</template>
|
|
183
319
|
</TelaModal>
|
|
184
320
|
```
|
|
185
321
|
|
|
186
|
-
##
|
|
322
|
+
## Rules
|
|
187
323
|
|
|
188
|
-
- `
|
|
189
|
-
- `
|
|
190
|
-
- `footer`
|
|
324
|
+
- **Always** pass `size` in new code. Omitting it renders the legacy layout.
|
|
325
|
+
- **Always** use the `title` and `description` props (or slots) instead of building a header — they set the dialog's accessible name and description.
|
|
326
|
+
- Put footer buttons directly in the `footer` slot — no wrapper `div`. Secondary action first, primary action last.
|
|
327
|
+
- **Never** pass `size="lg"`, `size="sm"` or a custom `class` to a `TelaButton` in the `footer` slot. Footer buttons use the default size and styling so every modal footer matches.
|
|
328
|
+
- Use `prevent-close` while a request triggered from the modal is in flight.
|
|
329
|
+
- Every control inside a modal must fill the modal width. `w-full` on the root of a compound component (`TelaSelectMenu`, `TelaCombobox`) does not reach the trigger — use `trigger-class="w-full"` instead.
|
|
191
330
|
|
|
192
|
-
|
|
331
|
+
```vue
|
|
332
|
+
<!-- Correct -->
|
|
333
|
+
<TelaInput v-model="val" label="Name" w-full />
|
|
334
|
+
<TelaTextarea v-model="val" w-full />
|
|
335
|
+
<TelaToggleGroup v-model="val" :options="opts" w-full />
|
|
336
|
+
<TelaSelectMenu v-model="val" :options="opts" trigger-class="w-full" />
|
|
337
|
+
<TelaCombobox v-model="val" :options="opts" trigger-class="w-full" />
|
|
193
338
|
|
|
194
|
-
|
|
195
|
-
-
|
|
339
|
+
<!-- Wrong — w-full on root doesn't reach the trigger -->
|
|
340
|
+
<TelaSelectMenu v-model="val" :options="opts" w-full />
|
|
341
|
+
<TelaCombobox v-model="val" :options="opts" w-full />
|
|
342
|
+
```
|
|
196
343
|
|
|
197
|
-
##
|
|
344
|
+
## Accessibility
|
|
198
345
|
|
|
199
|
-
-
|
|
200
|
-
-
|
|
201
|
-
-
|
|
202
|
-
-
|
|
203
|
-
-
|
|
204
|
-
- **Scrollable Content**: Long content scrolls within modal
|
|
205
|
-
- **Focus Trap**: Keeps focus within modal
|
|
206
|
-
- **Accessible**: Proper ARIA attributes and keyboard navigation
|
|
346
|
+
- Focus is trapped inside the modal and returns to the trigger on close.
|
|
347
|
+
- Escape and outside clicks close the modal unless `prevent-close` is set.
|
|
348
|
+
- `title` and `description` become the dialog's `aria-labelledby` and `aria-describedby`. When the header is hidden, the title still labels the dialog through a visually hidden element.
|
|
349
|
+
- The close button is labelled by `close-label` (default `"Close"`); pass a translated string in localized apps.
|
|
350
|
+
- Open and close animations fall back to a fade when the user prefers reduced motion.
|
|
207
351
|
|
|
208
|
-
##
|
|
352
|
+
## Props
|
|
209
353
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
354
|
+
<ArgTypes />
|
|
355
|
+
|
|
356
|
+
## Slots
|
|
357
|
+
|
|
358
|
+
All slots receive `{ close }`.
|
|
359
|
+
|
|
360
|
+
- `default` — Body, rendered in a `TelaScrollArea` that scrolls when the content is taller than the viewport.
|
|
361
|
+
- `title` — Rich title content (replaces the `title` text).
|
|
362
|
+
- `description` — Rich description content (replaces the `description` text).
|
|
363
|
+
- `actions` — Replaces the close button, centered on the title's first line.
|
|
364
|
+
- `footer` — Right-aligned row of actions.
|
|
365
|
+
- `content` — Replaces the body with an unpadded area.
|
|
366
|
+
- `header` — Replaces the title and description.
|
|
367
|
+
- `header-leading` — Legacy layout only: content before a centered title.
|
|
368
|
+
|
|
369
|
+
## Events
|
|
216
370
|
|
|
371
|
+
- `update:modelValue` — Emitted when the modal opens or closes.
|
|
372
|
+
- `close` — Emitted when the modal closes, whatever closed it.
|