@meistrari/tela-build 1.89.0 → 1.90.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/CHANGELOG.md CHANGED
@@ -14,6 +14,7 @@ Latest updates and announcements.
14
14
  - [Video Player](/components/video-player) without a `poster` shows a frame from the start of the video as its thumbnail instead of an empty surface. A `poster` still takes precedence.
15
15
  - [Video Player](/components/video-player) opens on a centered play button and a duration badge instead of the full control bar; the controls take over once playback starts.
16
16
  - [Video Player](/components/video-player) accepts a `preview` clip that loops muted as the cover until playback starts. It holds still when the user prefers reduced motion.
17
+ - [Timeline Waterfall](/components/timeline-waterfall) `scrollToId` centers the row by scrolling only the timeline's own scroller. It used `scrollIntoView`, which also scrolled every scrollable ancestor, so focusing a row could shift the page or modal hosting the timeline, sideways included.
17
18
 
18
19
  ## October 15, 2026
19
20
 
@@ -29,10 +30,15 @@ Latest updates and announcements.
29
30
 
30
31
  ## October 14, 2026
31
32
 
33
+ - [Chat Task Review](/templates/chat#task-review) allows submitting blank corrections so hosts can clear strings and scalar lists. Cleared field drafts emit an empty string for preview; untouched inputs emit `null`.
34
+ - [Modal](/components/modal#below-the-floating-chat) keeps the floating chat open when Escape dismisses a higher-priority layer.
32
35
  - [Avatar](/components/avatar) corner radius now scales with `size` to match Figma instead of a flat 6px: `2xs` 6px, `xs` 8px, `sm` 10px, `md` (and the default) 12px, `lg` 20px, `xl` 22px. The radius is still a class, so a `class` like `rounded-full` overrides it. The switch-workspace modal drops its `!rounded-[10px]` avatar override, and its selection ring follows the 12px radius with a transparent 2px gap, so the hovered row background shows through instead of a white band.
33
36
 
34
37
  ## October 9, 2026
35
38
 
39
+ - New [Chat Task Review](/templates/chat#task-review) (`TelaChatTaskReview`): a controlled card for reviewing an extracted output field by field, with the [Answer](/templates/chat#answer) card's header, lettered options and footer, plus a value preview, a correction input, summary counts and editable item rows (with optional placeholders). It emits `draft` with the text being typed so hosts can preview it.
40
+ - [Modal](/components/modal#below-the-floating-chat) adds `below-floating-chat`: the modal renders under the [floating chat](/templates/chat#floating) as a non-modal dialog, so an open chat stays visible and usable on top of it, and Escape closes the chat first, then the modal.
41
+ - [Floating chat](/templates/chat#floating) marks its launcher and window with `data-tela-floating-window`.
36
42
  - [Typography](/typography) adds the styles that only existed in Figma: `display-{large|medium|small}-<weight>`, `paragraph-{20|16|14|quote}-<weight>`, `button-{16|14|12}-<weight>` (same `<family>-<size>-<weight>` pattern as `body-*` and `heading-*`), the 10px body size (`body-10-*`), and an `underline` weight (`body-14-underline`) that renders regular weight with an underline.
37
43
  - `TelaLinkDecoration` is removed. Use a plain `<a>` (or `<span>`) with a `body-<size>-underline` token instead: `<TelaLinkDecoration :href="url">Docs</TelaLinkDecoration>` → `<a :href="url" body-12-underline text-gray-900>Docs</a>`. The underline keeps the same 3px offset.
38
44
  - [Typography](/typography) `body-caption-<size>-<weight>` is replaced by `body-<size>-<weight>-uppercase` (`body-caption-9-medium` → `body-9-medium-uppercase`). Rendering is unchanged: uppercase with 0.05em tracking.
@@ -1092,6 +1092,88 @@ Keyboard, while the card is expanded and enabled:
1092
1092
 
1093
1093
  Shortcuts are scoped to the card. Pass `keyboard-target` to listen on a host container instead (for example the chat body, so the keys work while focus is elsewhere in the conversation); keystrokes typed into inputs, with modifiers, held down, or during IME composition are always ignored. Changing `question.id` moves focus to the new question, and collapsing returns focus to the collapse button.
1094
1094
 
1095
+ ### Task Review
1096
+
1097
+ A review card for checking an extracted output field by field, built on the same card, header, rows and footer as [Answer](#answer). Each step shows a value to check, lettered options (`A`, `B`, `C`) and an optional correction input that takes the next letter. Steps can also carry a summary list (counts before or after a review) or a list of rows to confirm or correct one by one, for items of a list. It is fully controlled: the host builds the steps, saves corrections and decides what comes next; the card only emits intent.
1098
+
1099
+ ```vue
1100
+ <script setup lang="ts">
1101
+ import type { TelaChatTaskReviewStep } from '@meistrari/tela-build/types'
1102
+
1103
+ const steps: TelaChatTaskReviewStep[] = [
1104
+ {
1105
+ id: 'overview',
1106
+ eyebrow: '#30 menu10.jpg',
1107
+ title: 'Review task',
1108
+ summary: [
1109
+ { id: 'auto', label: 'Auto-accepted', count: 128 },
1110
+ { id: 'suggest', label: 'Suggested corrections', count: 3 },
1111
+ { id: 'review', label: 'To review', count: 12 },
1112
+ ],
1113
+ options: [{ id: 'start', label: 'Start review' }],
1114
+ },
1115
+ {
1116
+ id: 'tipo_documento',
1117
+ eyebrow: '#30 menu10.jpg',
1118
+ title: 'tipo_documento',
1119
+ value: { text: 'cardapio' },
1120
+ recommendFirst: true,
1121
+ options: [
1122
+ { id: 'use', label: 'Use "cardápio"', description: 'Corrected this way in 6 tasks' },
1123
+ { id: 'keep', label: 'Keep "cardapio"' },
1124
+ ],
1125
+ input: { placeholder: 'Type the correction…' },
1126
+ },
1127
+ {
1128
+ id: 'itens.3',
1129
+ eyebrow: 'itens · 4 of 16',
1130
+ title: 'SPICY TIKKA CHICKEN TACO',
1131
+ rows: [
1132
+ { id: 'nome', label: 'nome', value: { text: 'SPICY TIKKA CHICKEN TACO' }, status: 'auto' },
1133
+ { id: 'preco', label: 'preco', value: { text: '$4.50' }, status: 'pending' },
1134
+ { id: 'categoria', label: 'categoria', value: { text: '', empty: true }, status: 'pending' },
1135
+ ],
1136
+ options: [{ id: 'all-correct', label: 'Everything in this item is correct' }],
1137
+ },
1138
+ ]
1139
+
1140
+ const index = ref(0)
1141
+ const expanded = ref(true)
1142
+ const step = computed(() => steps[index.value]!)
1143
+
1144
+ function advance() {
1145
+ index.value = (index.value + 1) % steps.length
1146
+ }
1147
+ </script>
1148
+
1149
+ <template>
1150
+ <div class="w-full max-w-450px">
1151
+ <TelaChatTaskReview
1152
+ v-model:expanded="expanded"
1153
+ :step="step"
1154
+ :current="index + 1"
1155
+ :total="steps.length"
1156
+ show-navigation
1157
+ :can-previous="index > 0"
1158
+ :can-next="index < steps.length - 1"
1159
+ @select="advance"
1160
+ @correct="advance"
1161
+ @previous="index--"
1162
+ @next="index++"
1163
+ @skip="advance"
1164
+ />
1165
+ </div>
1166
+ </template>
1167
+ ```
1168
+
1169
+ Keyboard, while the card is expanded and enabled:
1170
+
1171
+ - **`A`–`D`** select the option with that letter; the letter after the last option focuses the correction input.
1172
+ - **`Enter`** in the correction input emits `correct` with the typed text; in a row being edited it emits `correctRow` (or `confirmRow` when the text is unchanged), and **`Escape`** cancels the edit. Empty corrections are emitted too; the host validates whether the field can be cleared. The `draft` event distinguishes untouched inputs (`null`) from intentionally cleared inputs (`''`), so the host can preview empty values. Changing steps resets the input to untouched.
1173
+ - **`←` / `→`** emit `previous` / `next` when `canPrevious` / `canNext` allow it.
1174
+
1175
+ Shortcuts are scoped to the card, and keystrokes typed into inputs are ignored. Changing `step.id` clears the correction input and moves focus to the new step. An option's `description` shows under its label.
1176
+
1095
1177
  ### Working Indicator
1096
1178
 
1097
1179
  The running state of an assistant turn: a small `TelaLoadersSquare`, a label (`Working` by default) and an elapsed counter. Show it whenever something is running. A running turn is one `TelaChatMessage`: put the indicator and anything else the wait needs (a shimmering activity line, a reasoning trace) inside it, and the message stacks them 8px apart while the conversation keeps its 16px between turns. Pass `started-at` (epoch ms) and it ticks by itself; pass `elapsed` (seconds) to drive it from the host, for example from a server-reported duration.
@@ -1246,6 +1328,7 @@ import { TelaChatIconsAnthropic, TelaChatIconsGemini, TelaChatIconsOpenai } from
1246
1328
  | `TelaChatFloatingWindow` | Anchored popover shell for the floating variant (`open` / `@update:open`). |
1247
1329
  | `TelaChatSidepanelWindow` | Always-open, in-flow docked column for the sidepanel variant. |
1248
1330
  | `TelaChatAnswer` | Controlled single/multiple-choice question card; emits intent only, the host owns state and submission. |
1331
+ | `TelaChatTaskReview` | Controlled field-by-field review card (value, lettered options, correction input, item rows); emits intent only. |
1249
1332
  | `TelaChatWorkingIndicator` | Running-turn row: square loader, label, elapsed time. |
1250
1333
  | `TelaChatStopRunButton` | Replaces the prompt input while a turn runs; centered pill that emits `stop`. |
1251
1334
  | `TelaChatAnimateEnter` | Enter/exit preset (fade, slide, slight scale) for a surface that comes and goes; when it wraps the prompt input or stop button the body docks the wrapper. Pair with `AnimatePresence`. |
@@ -1582,6 +1665,61 @@ type TelaChatAnswerLabels = {
1582
1665
  }
1583
1666
  ```
1584
1667
 
1668
+ ### Task Review
1669
+
1670
+ ```typescript
1671
+ type TaskReviewProps = {
1672
+ step: TelaChatTaskReviewStep
1673
+ current?: number // default: 1; display only
1674
+ total?: number // default: 1; "current of total" shows when total > 1
1675
+ expanded?: boolean // default: true; v-model:expanded
1676
+ disabled?: boolean // blocks options, inputs, row actions, navigation and skip; collapse stays available
1677
+ loading?: boolean // skeleton rows instead of the step body
1678
+ submitting?: boolean // same as disabled, plus a status line; also blocks dismiss
1679
+ error?: string // default: ''; rendered as an alert under the footer
1680
+ showNavigation?: boolean // previous / next arrows in the footer
1681
+ canPrevious?: boolean
1682
+ canNext?: boolean
1683
+ showSkip?: boolean // default: true
1684
+ labels?: Partial<TelaChatTaskReviewLabels>
1685
+ }
1686
+
1687
+ type TaskReviewEmits = {
1688
+ 'select': [id: string] // a lettered option
1689
+ 'correct': [value: string] // Enter in the correction input
1690
+ 'confirmRow': [id: string]
1691
+ 'correctRow': [id: string, value: string]
1692
+ 'update:expanded': [value: boolean]
1693
+ 'previous': []
1694
+ 'next': []
1695
+ 'skip': []
1696
+ 'dismiss': []
1697
+ 'draft': [value: string | null, rowId?: string] // text being typed (rowId while editing a row); null when nothing is typed, for live previews
1698
+ }
1699
+
1700
+ // import type { ... } from '@meistrari/tela-build/types'
1701
+ type TelaChatTaskReviewStep = {
1702
+ id: string // changing it resets the input and focus
1703
+ eyebrow?: string // small line above the title, joined with the progress
1704
+ title: string
1705
+ value?: { text: string, empty?: boolean } // the value under review; empty shows the empty label
1706
+ summary?: { id: string, label: string, count: number }[]
1707
+ rows?: TelaChatTaskReviewRow[]
1708
+ options: { id: string, label: string, description?: string }[] // description shows under the label
1709
+ recommendFirst?: boolean // appends "(recommended)" to the first option
1710
+ input?: { placeholder: string } // correction input after the options
1711
+ }
1712
+
1713
+ type TelaChatTaskReviewRow = {
1714
+ id: string
1715
+ label: string
1716
+ value: { text: string, empty?: boolean }
1717
+ status: 'pending' | 'confirmed' | 'corrected' | 'auto' // only pending rows show the confirm action
1718
+ editable?: boolean // default: true; false hides the edit action (auto rows never show it)
1719
+ placeholder?: string // placeholder for the row's edit input
1720
+ }
1721
+ ```
1722
+
1585
1723
  ### Working Indicator
1586
1724
 
1587
1725
  ```typescript
@@ -1640,7 +1778,7 @@ type TextShimmerProps = {
1640
1778
  - **Keep the primitives logic-free.** Fetch, stream, and persist in the host; pass results down as props and slots. No primitive owns message state.
1641
1779
  - **`contained` for user messages, `flat` for assistant messages.** Assistant output reads as page text; user input reads as a sent bubble.
1642
1780
  - **Never hand-roll the toolbar layout.** `TelaChatPromptInputTools` (attachment actions) on the left, `TelaChatPromptInputActions` with `TelaChatModelSelector` + `TelaChatPromptSubmitButton` on the right. Always the same order; never substitute a raw `<div class="flex items-center gap-4px">`.
1643
- - **Floating chat dismissal.** Outside clicks close the chat by default; set `closeOnOutsideClick` to `false` to keep it open while using the host page. Focus changes keep it open. Close it using the launcher toggle or Escape. Components guaranteed to render above the shared widget layer (`z-599`) must mark their open overlay or content with `data-tela-escape-layer`; Escape then closes that layer before the chat. Never add the marker to a surface at or below the widget layer.
1781
+ - **Floating chat dismissal.** Outside clicks close the chat by default; set `closeOnOutsideClick` to `false` to keep it open while using the host page. Focus changes keep it open. Close it using the launcher toggle or Escape. Components guaranteed to render above the shared widget layer (`z-599`) must mark their open overlay or content with `data-tela-escape-layer`; Escape then closes that layer before the chat. Never add the marker to a surface at or below the widget layer. A [Modal](/components/modal#below-the-floating-chat) with `below-floating-chat` sits under the widget layer: the chat stays usable over it and Escape closes the chat first, then the modal. The launcher and window carry `data-tela-floating-window` so such a modal ignores interactions with them.
1644
1782
  - **`TelaChatAnswer` never talks to the server.** Parsing the model's questions, limits on how many questions or options to ask, saved answers, retries and what happens after the last question all live in the host (or its adapter). Every event is intent only; `dismiss` does not remove the card.
1645
1783
  - **Dock the active answer card above the prompt input.** Put both inside one `[data-chat-composer]` wrapper with a 12px gap so `TelaChatBody` pins and measures them together. Only one card should be interactive at a time, especially when sharing a `keyboardTarget`.
1646
1784
  - **One shell per page.** Never mount `TelaChatFloatingWindow` and `TelaChatSidepanelWindow` at the same time.
@@ -1687,6 +1825,7 @@ Where each primitive lives in `components/tela/chat/`. Component names come from
1687
1825
  | `conversation/` | `TelaChatConversation` and `TelaChatConversationContent`, the message list. |
1688
1826
  | `message/` | `TelaChatMessage` with avatar, content, and feedback controls. |
1689
1827
  | `answer/` | `TelaChatAnswer`, choice questions the assistant asks inline. |
1828
+ | `task-review/` | `TelaChatTaskReview`, the card for confirming or correcting extracted values one by one. |
1690
1829
  | `chat-empty-state.vue` | `TelaChatEmptyState`, shown before the first message. |
1691
1830
  | `chat-suggestions.vue`, `chat-suggestion.vue` | Suggested prompts. |
1692
1831
  | `chat-reasoning-step.vue` | `TelaChatReasoningStep`, collapsible tool or reasoning entry. |
@@ -1,3 +1,37 @@
1
1
  export function hasOpenEscapeLayer(root: ParentNode = document) {
2
2
  return Boolean(root.querySelector('[data-tela-escape-layer][data-state="open"]'))
3
3
  }
4
+
5
+ export function hasOpenFloatingWindow(root: ParentNode = document) {
6
+ return Boolean(root.querySelector('[data-tela-floating-window][data-state="open"]'))
7
+ }
8
+
9
+ export function isInsideFloatingWindow(target: EventTarget | null) {
10
+ return target instanceof Element && Boolean(target.closest('[data-tela-floating-window]'))
11
+ }
12
+
13
+ const floatingWindowClosers = new Set<() => void>()
14
+ const escapesClosingFloatingWindow = new WeakSet<Event>()
15
+
16
+ export function registerFloatingWindowCloser(close: () => void) {
17
+ floatingWindowClosers.add(close)
18
+ return () => {
19
+ floatingWindowClosers.delete(close)
20
+ }
21
+ }
22
+
23
+ export function closeFloatingWindows() {
24
+ floatingWindowClosers.forEach(close => close())
25
+ }
26
+
27
+ export function markEscapeClosingFloatingWindow(event: Event) {
28
+ escapesClosingFloatingWindow.add(event)
29
+ }
30
+
31
+ /**
32
+ * Whether this Escape belongs to the floating chat: it is open, or its own handler already closed it
33
+ * for this same event (listener order between the chat and other layers is not guaranteed).
34
+ */
35
+ export function isFloatingWindowEscape(event: Event) {
36
+ return escapesClosingFloatingWindow.has(event) || hasOpenFloatingWindow()
37
+ }
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { hasOpenEscapeLayer } from './escape-layer'
2
+ import { hasOpenEscapeLayer, markEscapeClosingFloatingWindow, registerFloatingWindowCloser } from './escape-layer'
3
3
  import { chatShellContextKey } from '../chat-shell-context'
4
4
  import { floatingWindowContextKey } from './floating-window-context'
5
5
 
@@ -112,7 +112,7 @@ let previousPaddingRight = ''
112
112
  let hasScrollLock = false
113
113
  let deferNextDismissal = false
114
114
 
115
- function handleEscapeKeyDown() {
115
+ function handleEscapeKeyDown(event?: KeyboardEvent) {
116
116
  deferNextDismissal = hasOpenEscapeLayer()
117
117
 
118
118
  if (deferNextDismissal) {
@@ -120,8 +120,16 @@ function handleEscapeKeyDown() {
120
120
  deferNextDismissal = false
121
121
  })
122
122
  }
123
+ else if (event && props.open) {
124
+ markEscapeClosingFloatingWindow(event)
125
+ }
123
126
  }
124
127
 
128
+ const unregisterCloser = registerFloatingWindowCloser(() => {
129
+ if (props.open)
130
+ emit('update:open', false)
131
+ })
132
+
125
133
  function handleOpenUpdate(value: boolean) {
126
134
  // A kept-mounted window stays a dismissable layer while closed, so Escape
127
135
  // and outside interactions still reach it; there is nothing left to close.
@@ -207,6 +215,7 @@ watch(() => props.open, (open) => {
207
215
  }, { immediate: true })
208
216
 
209
217
  onBeforeUnmount(() => {
218
+ unregisterCloser()
210
219
  clearTimeout(unlockTimer)
211
220
  clearTimeout(hideTimer)
212
221
  unlockScroll()
@@ -288,7 +297,9 @@ function focusEditorIn(content: HTMLElement) {
288
297
  <template>
289
298
  <TelaPopover :open="open" @update:open="handleOpenUpdate">
290
299
  <div
291
- ref="launcher" :class="cn(
300
+ ref="launcher"
301
+ data-tela-floating-window
302
+ :class="cn(
292
303
  'bottom-16px z-599',
293
304
  contained ? 'absolute' : 'fixed',
294
305
  position === 'left' ? 'left-16px' : contained ? 'right-16px' : 'right-[calc(16px+var(--scrollbar-width,0px))]',
@@ -308,6 +319,7 @@ function focusEditorIn(content: HTMLElement) {
308
319
  :side-offset="sideOffset"
309
320
  :force-mount="forceMountContent"
310
321
  :data-content-hidden="contentHidden || undefined"
322
+ data-tela-floating-window
311
323
  :class="cn(
312
324
  'widget-popover relative w-[min(480px,calc(100vw-32px))] p-0 z-599! transition-[height] duration-200 ease-out',
313
325
  expanded
@@ -0,0 +1,124 @@
1
+ import { readFileSync } from 'node:fs'
2
+ import { runInNewContext } from 'node:vm'
3
+ import { createSourceFile, isFunctionDeclaration, ScriptTarget, transpile } from 'typescript'
4
+ import { afterEach, describe, expect, it, vi } from 'vitest'
5
+ import { effectScope, nextTick, reactive, ref, watch } from 'vue'
6
+
7
+ const source = readFileSync(new URL('./task-review.vue', import.meta.url), 'utf8').split('<script setup lang="ts">')[1]!.split('</script>')[0]!
8
+ const functions = createSourceFile('review.ts', source, ScriptTarget.Latest, true).statements.filter(isFunctionDeclaration).map(node => node.getText()).join('\n')
9
+
10
+ function setup() {
11
+ const emit = vi.fn()
12
+ const context = {
13
+ interactive: { value: true },
14
+ draft: { value: '' },
15
+ rowDraft: { value: '' },
16
+ editingRow: { value: 'name' },
17
+ editedRowValue: { value: 'old' },
18
+ emit,
19
+ }
20
+ runInNewContext(transpile(functions), context)
21
+ return {
22
+ ...context,
23
+ submit: () => runInNewContext('submitCorrection()', context),
24
+ submitRow: () => runInNewContext('submitRowEdit()', context),
25
+ enter: (event: { isComposing: boolean, keyCode: number, preventDefault: () => void }) => {
26
+ runInNewContext('onEnter(event, submitCorrection)', { ...context, event })
27
+ },
28
+ }
29
+ }
30
+
31
+ describe('task review empty corrections', () => {
32
+ it('emits an empty field correction for the host to validate', () => {
33
+ const state = setup()
34
+ state.submit()
35
+ expect(state.emit).toHaveBeenCalledWith('correct', '')
36
+ })
37
+
38
+ it('emits an empty row correction and retains the draft for retries', () => {
39
+ const state = setup()
40
+ state.submitRow()
41
+ expect(state.emit).toHaveBeenCalledWith('correctRow', 'name', '')
42
+ expect(state.editingRow.value).toBe('name')
43
+ })
44
+
45
+ it('confirms an unchanged empty row', () => {
46
+ const state = setup()
47
+ state.editedRowValue.value = ''
48
+ state.submitRow()
49
+ expect(state.emit).toHaveBeenCalledWith('confirmRow', 'name')
50
+ })
51
+
52
+ it('still blocks submission while disabled or composing', () => {
53
+ const state = setup()
54
+ state.interactive.value = false
55
+ state.submit()
56
+ state.submitRow()
57
+ expect(state.emit).not.toHaveBeenCalled()
58
+ state.interactive.value = true
59
+ const event = { isComposing: true, keyCode: 229, preventDefault: vi.fn() }
60
+ state.enter(event)
61
+ expect(state.emit).not.toHaveBeenCalled()
62
+ expect(event.preventDefault).not.toHaveBeenCalled()
63
+ })
64
+ })
65
+
66
+ const scopes: ReturnType<typeof effectScope>[] = []
67
+ afterEach(() => scopes.splice(0).forEach(scope => scope.stop()))
68
+
69
+ function setupDraftPreview() {
70
+ const scope = effectScope()
71
+ scopes.push(scope)
72
+ const emit = vi.fn()
73
+ const context = {
74
+ draft: ref(''),
75
+ draftEdited: ref(false),
76
+ rowDraft: ref(''),
77
+ editingRow: ref<string | null>(null),
78
+ props: reactive({ step: { id: 'first' }, expanded: false }),
79
+ emit,
80
+ watch,
81
+ nextTick,
82
+ }
83
+ const watchers = createSourceFile('review.ts', source, ScriptTarget.Latest, true).statements.filter(node => node.getText().startsWith('watch(')).slice(0, 2).map(node => node.getText()).join('\n')
84
+ scope.run(() => runInNewContext(transpile(watchers), context))
85
+ return {
86
+ ...context,
87
+ update: async (value: string) => {
88
+ context.draftEdited.value = true
89
+ context.draft.value = value
90
+ await nextTick()
91
+ },
92
+ }
93
+ }
94
+
95
+ describe('task review draft previews', () => {
96
+ it('previews an intentionally cleared field as empty', async () => {
97
+ const state = setupDraftPreview()
98
+ await state.update('replacement')
99
+ expect(state.emit).toHaveBeenLastCalledWith('draft', 'replacement')
100
+ await state.update('')
101
+ expect(state.emit).toHaveBeenLastCalledWith('draft', '')
102
+ })
103
+
104
+ it('does not preview untouched inputs and resets editing on step changes', async () => {
105
+ const state = setupDraftPreview()
106
+ await nextTick()
107
+ expect(state.emit).not.toHaveBeenCalled()
108
+ await state.update('replacement')
109
+ state.props.step.id = 'second'
110
+ await nextTick()
111
+ expect(state.emit).toHaveBeenLastCalledWith('draft', null)
112
+ expect(state.draftEdited.value).toBe(false)
113
+ })
114
+
115
+ it('keeps empty row drafts and restores an untouched field after cancelling', async () => {
116
+ const state = setupDraftPreview()
117
+ state.editingRow.value = 'name'
118
+ await nextTick()
119
+ expect(state.emit).toHaveBeenLastCalledWith('draft', '', 'name')
120
+ state.editingRow.value = null
121
+ await nextTick()
122
+ expect(state.emit).toHaveBeenLastCalledWith('draft', null)
123
+ })
124
+ })
@@ -0,0 +1,324 @@
1
+ <script setup lang="ts">
2
+ import type { TelaChatTaskReviewLabels, TelaChatTaskReviewRow, TelaChatTaskReviewStep } from '../../../../types/chat-task-review'
3
+
4
+ const props = withDefaults(defineProps<{
5
+ step: TelaChatTaskReviewStep
6
+ current?: number
7
+ total?: number
8
+ expanded?: boolean
9
+ disabled?: boolean
10
+ loading?: boolean
11
+ submitting?: boolean
12
+ error?: string
13
+ showNavigation?: boolean
14
+ canPrevious?: boolean
15
+ canNext?: boolean
16
+ showSkip?: boolean
17
+ labels?: Partial<TelaChatTaskReviewLabels>
18
+ }>(), {
19
+ current: 1,
20
+ total: 1,
21
+ expanded: true,
22
+ showSkip: true,
23
+ error: '',
24
+ labels: () => ({}),
25
+ })
26
+
27
+ const emit = defineEmits<{
28
+ 'select': [id: string]
29
+ 'correct': [value: string]
30
+ 'confirmRow': [id: string]
31
+ 'correctRow': [id: string, value: string]
32
+ 'update:expanded': [value: boolean]
33
+ 'previous': []
34
+ 'next': []
35
+ 'skip': []
36
+ 'dismiss': []
37
+ 'draft': [value: string | null, rowId?: string]
38
+ }>()
39
+
40
+ const copy = computed<TelaChatTaskReviewLabels>(() => ({
41
+ minimize: 'Minimize review',
42
+ expand: 'Expand review',
43
+ dismiss: 'Dismiss review',
44
+ previous: 'Previous field',
45
+ next: 'Next field',
46
+ skip: 'Skip',
47
+ recommended: '(recommended)',
48
+ empty: 'Empty field',
49
+ confirmRow: 'Mark as correct',
50
+ editRow: 'Correct value',
51
+ status: { confirmed: 'Correct', corrected: 'Corrected', auto: 'Auto-accepted' },
52
+ progress: (current, total) => `${current} of ${total}`,
53
+ submitting: 'Saving…',
54
+ ...props.labels,
55
+ }))
56
+
57
+ const uid = useId()
58
+ const stepPanel = ref<HTMLElement | null>(null)
59
+ const correctionInput = ref<{ focusInput: () => void } | null>(null)
60
+ const draft = ref('')
61
+ const draftEdited = ref(false)
62
+ const editingRow = ref<string | null>(null)
63
+ const rowDraft = ref('')
64
+
65
+ const interactive = computed(() => !props.disabled && !props.submitting && !props.loading)
66
+ const hasBody = computed(() => props.loading || Boolean(props.step.value || props.step.summary?.length || props.step.rows?.length || props.step.options.length || props.step.input))
67
+ const inputShortcutIndex = computed(() => props.step.input ? props.step.options.length : -1)
68
+ const progressLabel = computed(() => [props.step.eyebrow, props.total > 1 ? copy.value.progress(props.current, props.total) : null].filter(Boolean).join(' · '))
69
+
70
+ watch([draft, rowDraft, editingRow, draftEdited], ([value, rowValue, rowId, edited]) => {
71
+ if (rowId)
72
+ emit('draft', rowValue, rowId)
73
+ else emit('draft', edited ? value : null)
74
+ })
75
+
76
+ watch(() => props.step.id, async () => {
77
+ draftEdited.value = false
78
+ draft.value = ''
79
+ editingRow.value = null
80
+ await nextTick()
81
+ if (props.expanded)
82
+ stepPanel.value?.focus()
83
+ })
84
+
85
+ function shortcut(index: number) {
86
+ return 'ABCD'[index] ?? ''
87
+ }
88
+
89
+ function select(id: string) {
90
+ if (interactive.value)
91
+ emit('select', id)
92
+ }
93
+
94
+ function submitCorrection() {
95
+ if (interactive.value)
96
+ emit('correct', draft.value.trim())
97
+ }
98
+
99
+ function startRowEdit(row: TelaChatTaskReviewRow) {
100
+ editingRow.value = row.id
101
+ rowDraft.value = row.value.empty ? '' : row.value.text
102
+ }
103
+
104
+ const editedRowValue = computed(() => props.step.rows?.find(row => row.id === editingRow.value)?.value.text)
105
+
106
+ watch([editingRow, editedRowValue], ([id, value], [previousId, previousValue]) => {
107
+ if (id && id === previousId && value !== previousValue)
108
+ editingRow.value = null
109
+ })
110
+
111
+ function submitRowEdit() {
112
+ const value = rowDraft.value.trim()
113
+ if (!interactive.value || !editingRow.value)
114
+ return
115
+ if (value !== editedRowValue.value)
116
+ return emit('correctRow', editingRow.value, value)
117
+ emit('confirmRow', editingRow.value)
118
+ editingRow.value = null
119
+ }
120
+
121
+ function onEnter(event: KeyboardEvent, submit: () => void) {
122
+ if (event.isComposing || event.keyCode === 229)
123
+ return
124
+ event.preventDefault()
125
+ submit()
126
+ }
127
+
128
+ function onKeydown(event: KeyboardEvent) {
129
+ if (!interactive.value || !props.expanded || event.defaultPrevented || event.repeat || event.isComposing || event.keyCode === 229 || event.shiftKey || event.ctrlKey || event.altKey || event.metaKey)
130
+ return
131
+ if (event.target instanceof Element && event.target.closest('input, textarea, [contenteditable="true"]'))
132
+ return
133
+
134
+ const index = /^[a-d]$/i.test(event.key) ? event.key.toLowerCase().charCodeAt(0) - 97 : -1
135
+ const option = props.step.options[index]
136
+ if (option)
137
+ select(option.id)
138
+ else if (index >= 0 && index === inputShortcutIndex.value)
139
+ correctionInput.value?.focusInput()
140
+ else if (event.key === 'ArrowLeft' && props.canPrevious)
141
+ emit('previous')
142
+ else if (event.key === 'ArrowRight' && props.canNext)
143
+ emit('next')
144
+ else
145
+ return
146
+ event.preventDefault()
147
+ event.stopPropagation()
148
+ }
149
+ </script>
150
+
151
+ <template>
152
+ <div tabindex="-1" outline-none @keydown="onKeydown">
153
+ <TelaCard size="sm" class="!p-0 w-450px" mx-auto max-w-full overflow-hidden>
154
+ <TelaCollapsible :open="expanded" @update:open="emit('update:expanded', $event)">
155
+ <div
156
+ flex items-center justify-between gap-8px min-h-56px py-8px pl-16px pr-12px
157
+ :class="{ 'cursor-pointer': !expanded }"
158
+ @click="!expanded && emit('update:expanded', true)"
159
+ >
160
+ <div flex="~ col" gap-6px min-w-0>
161
+ <span v-if="progressLabel" role="status" aria-live="polite" body-10-regular text-tertiary truncate>{{ progressLabel }}</span>
162
+ <h5 :id="`${uid}-${step.id}-title`" heading-h5-semibold text-primary text-balance break-words>
163
+ {{ step.title }}
164
+ </h5>
165
+ </div>
166
+ <div v-if="hasBody" flex items-center shrink-0 mr--3px>
167
+ <TelaCollapsibleTrigger as-child>
168
+ <TelaIconButton
169
+ data-task-review-collapse
170
+ size="sm"
171
+ icon="i-ph-caret-down"
172
+ color="secondary"
173
+ :icon-class="cn('transition-all ease-in-out', { 'rotate-180': expanded })"
174
+ :aria-label="expanded ? copy.minimize : copy.expand"
175
+ @click.stop
176
+ />
177
+ </TelaCollapsibleTrigger>
178
+ <TelaIconButton
179
+ size="sm"
180
+ icon="i-ph-x"
181
+ color="secondary"
182
+ :aria-label="copy.dismiss"
183
+ :disabled="submitting"
184
+ @click.stop="emit('dismiss')"
185
+ />
186
+ </div>
187
+ </div>
188
+ <TelaCollapsibleContent class="mt--4px">
189
+ <div :key="step.id" ref="stepPanel" tabindex="-1" outline-none flex="~ col">
190
+ <div v-if="loading" flex="~ col" gap-8px px-16px pt-4px pb-12px>
191
+ <TelaSkeleton h-36px w-full />
192
+ <TelaSkeleton h-36px w-full />
193
+ <TelaSkeleton h-36px w="2/3" />
194
+ </div>
195
+ <template v-else>
196
+ <div
197
+ v-if="step.value"
198
+ mx-16px mb-8px px-10px py-8px rounded-8px bg-muted body-14-regular break-words whitespace-pre-wrap
199
+ :class="step.value.empty ? 'text-tertiary' : 'text-primary'"
200
+ >
201
+ {{ step.value.empty ? copy.empty : step.value.text }}
202
+ </div>
203
+
204
+ <ul v-if="step.summary?.length" flex="~ col" gap-4px list-none m-0 mb-8px px-16px py-0>
205
+ <li v-for="item in step.summary" :key="item.id" flex items-center justify-between gap-8px body-14-regular>
206
+ <span text-secondary>{{ item.label }}</span>
207
+ <span body-14-medium text-primary>{{ item.count }}</span>
208
+ </li>
209
+ </ul>
210
+
211
+ <ul v-if="step.rows?.length" :aria-labelledby="`${uid}-${step.id}-title`" flex="~ col" gap-2px list-none m-0 mb-4px py-0 px-6px max-h-200px overflow-y-auto>
212
+ <li
213
+ v-for="row in step.rows"
214
+ :key="row.id"
215
+ flex items-center gap-8px px-10px py-6px rounded-8px
216
+ :class="{ 'hover:bg-muted': interactive && row.status === 'pending' }"
217
+ :data-status="row.status"
218
+ >
219
+ <div flex="~ col" gap-2px flex-1 min-w-0>
220
+ <span body-12-regular text-tertiary truncate>{{ row.label }}</span>
221
+ <TelaInput
222
+ v-if="editingRow === row.id"
223
+ v-model="rowDraft"
224
+ hide-label
225
+ autofocus
226
+ :placeholder="row.placeholder"
227
+ :disabled="!interactive"
228
+ @keydown.enter="onEnter($event, submitRowEdit)"
229
+ @keydown.esc.stop.prevent="editingRow = null"
230
+ @blur="editingRow = null"
231
+ />
232
+ <span
233
+ v-else
234
+ body-14-regular break-words
235
+ :class="row.status === 'auto' || row.value.empty ? 'text-tertiary' : 'text-primary'"
236
+ >
237
+ {{ row.value.empty ? copy.empty : row.value.text }}
238
+ </span>
239
+ </div>
240
+ <div v-if="editingRow !== row.id" flex items-center gap-2px shrink-0>
241
+ <span v-if="row.status !== 'pending'" body-12-regular text-tertiary mr-4px>{{ copy.status[row.status] }}</span>
242
+ <TelaIconButton
243
+ v-if="row.status === 'pending'"
244
+ size="3xs"
245
+ icon="i-ph-check-bold"
246
+ color="secondary"
247
+ :aria-label="copy.confirmRow"
248
+ :disabled="!interactive"
249
+ @click="emit('confirmRow', row.id)"
250
+ />
251
+ <TelaIconButton
252
+ v-if="row.editable !== false && row.status !== 'auto'"
253
+ size="3xs"
254
+ icon="i-ph-pencil-simple"
255
+ color="secondary"
256
+ :aria-label="copy.editRow"
257
+ :disabled="!interactive"
258
+ @click="startRowEdit(row)"
259
+ />
260
+ </div>
261
+ </li>
262
+ </ul>
263
+
264
+ <ul :aria-labelledby="`${uid}-${step.id}-title`" flex="~ col" gap-4px list-none m-0 py-0 px-6px>
265
+ <li v-for="(option, optionIndex) in step.options" :key="option.id" relative block list-none m-0 p-0>
266
+ <span v-if="optionIndex > 0" aria-hidden="true" absolute top="-2px" inset-x-8px border-t-0.5px border-solid border />
267
+ <TelaButton
268
+ variant="ghost"
269
+ w-full justify-between gap-8px text-left whitespace-normal
270
+ class="!py-8px !rounded-8px ![--padding-x:10px] duration-0! !bg-transparent enabled:hover:!bg-muted"
271
+ :aria-keyshortcuts="shortcut(optionIndex) || undefined"
272
+ :disabled="!interactive"
273
+ @click="select(option.id)"
274
+ >
275
+ <span flex="~ col" gap-2px min-w-0>
276
+ <span body-14-regular text-primary break-words>
277
+ {{ option.label }}<span v-if="step.recommendFirst && optionIndex === 0" text-secondary ml-4px>{{ copy.recommended }}</span>
278
+ </span>
279
+ <span v-if="option.description" body-12-regular text-tertiary>{{ option.description }}</span>
280
+ </span>
281
+ <TelaKbd v-if="shortcut(optionIndex)" shrink-0>
282
+ {{ shortcut(optionIndex) }}
283
+ </TelaKbd>
284
+ </TelaButton>
285
+ </li>
286
+ <li v-if="step.input" relative flex items-center gap-8px list-none m-0 pl-10px pr-10px py-4px>
287
+ <span v-if="step.options.length > 0" aria-hidden="true" absolute top="-2px" inset-x-8px border-t-0.5px border-solid border />
288
+ <TelaInput
289
+ ref="correctionInput"
290
+ v-model="draft"
291
+ hide-label
292
+ flex-1
293
+ :placeholder="step.input.placeholder"
294
+ :disabled="!interactive"
295
+ @update:model-value="draftEdited = true"
296
+ @keydown.enter="onEnter($event, submitCorrection)"
297
+ />
298
+ <TelaKbd v-if="shortcut(inputShortcutIndex)" shrink-0>
299
+ {{ shortcut(inputShortcutIndex) }}
300
+ </TelaKbd>
301
+ </li>
302
+ </ul>
303
+ </template>
304
+
305
+ <div v-if="showNavigation || showSkip" flex items-center justify-between gap-8px px-16px py-8px>
306
+ <div v-if="showNavigation" ml--6px flex items-center>
307
+ <TelaIconButton size="3xs" icon="i-ph-caret-left-bold" color="secondary" :aria-label="copy.previous" :disabled="!interactive || !canPrevious" class="disabled:bg-transparent!" @click="emit('previous')" />
308
+ <TelaIconButton size="3xs" icon="i-ph-caret-right-bold" color="secondary" :aria-label="copy.next" :disabled="!interactive || !canNext" class="disabled:bg-transparent!" @click="emit('next')" />
309
+ </div>
310
+ <div v-if="showSkip" flex items-center gap-2px ml-auto mr--4px>
311
+ <TelaButton size="sm" variant="ghost" class="rounded-[6px]!" :disabled="!interactive" @click="emit('skip')">
312
+ {{ copy.skip }}
313
+ </TelaButton>
314
+ </div>
315
+ </div>
316
+ <div v-else h-8px />
317
+ <span v-if="submitting" role="status" body-12-regular text-secondary px-16px pt-4px pb-12px>{{ copy.submitting }}</span>
318
+ <span v-if="error" role="alert" body-12-regular text-primary px-16px pt-4px pb-12px>{{ error }}</span>
319
+ </div>
320
+ </TelaCollapsibleContent>
321
+ </TelaCollapsible>
322
+ </TelaCard>
323
+ </div>
324
+ </template>
@@ -0,0 +1,43 @@
1
+ // @vitest-environment happy-dom
2
+ import { readFileSync } from 'node:fs'
3
+ import { resolve } from 'node:path'
4
+ import { runInNewContext } from 'node:vm'
5
+ import { createSourceFile, isFunctionDeclaration, ScriptTarget, transpile } from 'typescript'
6
+ import { afterEach, describe, expect, it, vi } from 'vitest'
7
+ import { closeFloatingWindows, hasOpenEscapeLayer, isFloatingWindowEscape, registerFloatingWindowCloser } from '../chat/floating/escape-layer'
8
+
9
+ const source = readFileSync(resolve(__dirname, 'modal.vue'), 'utf8').split('<script setup lang="ts">')[1]!.split('</script>')[0]!
10
+ const handler = createSourceFile('modal.ts', source, ScriptTarget.Latest, true).statements.find(node => isFunctionDeclaration(node) && node.name?.text === 'handleEscapeKeyDown')!
11
+ afterEach(() => {
12
+ document.body.innerHTML = ''
13
+ })
14
+
15
+ function pressEscape() {
16
+ const event = new KeyboardEvent('keydown', { key: 'Escape', cancelable: true })
17
+ runInNewContext(`${transpile(handler.getText())}\nhandleEscapeKeyDown(event)`, {
18
+ event,
19
+ props: { belowFloatingChat: true, preventClose: false },
20
+ closeFloatingWindows,
21
+ hasOpenEscapeLayer,
22
+ isFloatingWindowEscape,
23
+ })
24
+ return event
25
+ }
26
+
27
+ describe('modal below the floating chat', () => {
28
+ it('closes the chat only after higher layers are closed', () => {
29
+ document.body.innerHTML = '<div data-tela-floating-window data-state="open"></div><div data-tela-escape-layer data-state="open"></div>'
30
+ const close = vi.fn()
31
+ const unregister = registerFloatingWindowCloser(close)
32
+ try {
33
+ expect(pressEscape().defaultPrevented).toBe(true)
34
+ expect(close).not.toHaveBeenCalled()
35
+ document.querySelector('[data-tela-escape-layer]')!.setAttribute('data-state', 'closed')
36
+ expect(pressEscape().defaultPrevented).toBe(true)
37
+ expect(close).toHaveBeenCalledTimes(1)
38
+ }
39
+ finally {
40
+ unregister()
41
+ }
42
+ })
43
+ })
@@ -198,6 +198,18 @@ async function save() {
198
198
  </template>
199
199
  ```
200
200
 
201
+ ## Below the Floating Chat
202
+
203
+ `below-floating-chat` is for a modal the user works in next to the floating chat, for example a record the assistant is walking them through. The modal renders under the chat layer as a non-modal dialog: the open chat stays visible and usable on top of it, clicking or typing in the chat does not close the modal, and Escape closes the topmost layer first (the chat, then the modal). Focus is not trapped, so the chat can take it.
204
+
205
+ ```vue
206
+ <TelaModal v-model="isOpen" size="lg" fullscreen below-floating-chat>
207
+ <template #content>
208
+ <!-- record the assistant is reviewing with the user -->
209
+ </template>
210
+ </TelaModal>
211
+ ```
212
+
201
213
  ## Custom Title and Actions
202
214
 
203
215
  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.
@@ -343,8 +355,9 @@ To migrate a modal, replace `modal-width` with `size`, drop `compact`, `hide-div
343
355
 
344
356
  ## Accessibility
345
357
 
346
- - Focus is trapped inside the modal and returns to the trigger on close.
358
+ - Focus is trapped inside the modal (except with `below-floating-chat`) and returns to the trigger on close.
347
359
  - Escape and outside clicks close the modal unless `prevent-close` is set.
360
+ - With `below-floating-chat`, focus is not trapped and an open floating chat takes Escape first.
348
361
  - `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
362
  - The close button is labelled by `close-label` when provided, or the shared `useTelaLabels().close` label (English fallback: `"Close"`).
350
363
  - Open and close animations fall back to a fade when the user prefers reduced motion.
@@ -1,6 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  import { computed, reactive, ref, useAttrs, watch } from 'vue'
3
3
  import { useResizeObserver } from '@vueuse/core'
4
+ import { hasOpenEscapeLayer, closeFloatingWindows, isFloatingWindowEscape, isInsideFloatingWindow } from '../chat/floating/escape-layer'
4
5
 
5
6
  import {
6
7
  DialogClose,
@@ -51,6 +52,11 @@ const props = withDefaults(defineProps<{
51
52
  hideEnterAnimation?: boolean
52
53
  /** Accessible name for the close button. Defaults to the `close` label from `provideTelaLabels`. */
53
54
  closeLabel?: string
55
+ /**
56
+ * Keeps an open floating chat above the modal and usable: the modal renders below the chat layer as a
57
+ * non-modal dialog, interacting with the chat does not close it, and Escape closes the chat first.
58
+ */
59
+ belowFloatingChat?: boolean
54
60
  }>(), {
55
61
  modalWidth: 'md',
56
62
  isCloseIcon: true,
@@ -78,6 +84,8 @@ const labels = useTelaLabels()
78
84
  const attrs = useAttrs()
79
85
 
80
86
  const isLegacy = computed(() => !props.size)
87
+ const overlayComponent = computed(() => props.belowFloatingChat ? 'div' : DialogOverlay)
88
+ const overlayLayer = computed(() => props.belowFloatingChat ? 'z-598' : 'z-600')
81
89
 
82
90
  const forwardedAttrs = computed(() => {
83
91
  const { onPointerDownOutside, ...rest } = attrs as Record<string, unknown>
@@ -136,7 +144,8 @@ const sizedAttrs = computed(() => {
136
144
  })
137
145
 
138
146
  const sizedOverlayClass = computed(() => cn(
139
- 'fixed inset-0 z-600 flex items-center justify-center p-[16px] bg-#000/48',
147
+ 'fixed inset-0 flex items-center justify-center p-[16px] bg-#000/48',
148
+ overlayLayer.value,
140
149
  // same timing as the popover-enter-exit content (css/animations.css)
141
150
  'overlay-enter-exit',
142
151
  props.fullscreen && 'p-0',
@@ -185,6 +194,11 @@ function handlePointerDownOutside(event: any) {
185
194
  event.preventDefault()
186
195
  }
187
196
 
197
+ // The chat's menus and popovers render in portals outside its window.
198
+ const insidePortaledMenu = target instanceof Element && Boolean(target.closest('[data-reka-popper-content-wrapper], [data-radix-popper-content-wrapper]'))
199
+ if (props.belowFloatingChat && (isInsideFloatingWindow(target) || insidePortaledMenu))
200
+ event.preventDefault()
201
+
188
202
  if (props.preventClose)
189
203
  event.preventDefault()
190
204
 
@@ -201,15 +215,34 @@ function handlePointerDownOutside(event: any) {
201
215
  }
202
216
 
203
217
  function handleEscapeKeyDown(event: KeyboardEvent) {
218
+ if (props.belowFloatingChat && isFloatingWindowEscape(event)) {
219
+ event.preventDefault()
220
+ if (!hasOpenEscapeLayer())
221
+ closeFloatingWindows()
222
+ return
223
+ }
224
+
204
225
  if (props.preventClose)
205
226
  event.preventDefault()
206
227
  }
228
+
229
+ function handleFocusOutside(event: CustomEvent) {
230
+ if (props.belowFloatingChat)
231
+ event.preventDefault()
232
+ }
207
233
  </script>
208
234
 
209
235
  <template>
210
- <DialogRoot v-model:open="open">
236
+ <DialogRoot v-model:open="open" :modal="!belowFloatingChat">
211
237
  <DialogPortal>
212
- <DialogOverlay v-if="isLegacy" data-tela-escape-layer :class="`DialogOverlay overlay-enter-exit ${overlayClass ?? ''}`" bg="#000/35" z-600 overflow-y-auto flex items-center justify-center :p-16px="!fullscreen">
238
+ <component
239
+ :is="overlayComponent"
240
+ v-if="isLegacy && (open || !belowFloatingChat)"
241
+ :data-state="belowFloatingChat ? 'open' : undefined"
242
+ :data-tela-escape-layer="belowFloatingChat ? undefined : ''"
243
+ :class="`DialogOverlay overlay-enter-exit ${overlayLayer} ${overlayClass ?? ''}`"
244
+ bg="#000/35" overflow-y-auto flex items-center justify-center :p-16px="!fullscreen"
245
+ >
213
246
  <DialogContent
214
247
  :data-animation="hideEnterAnimation"
215
248
  :class="cn('DialogContent shadow-xl', modalMaxWidth, !hideEnterAnimation && 'popover-enter-exit', dialogContentClass)"
@@ -221,6 +254,7 @@ function handleEscapeKeyDown(event: KeyboardEvent) {
221
254
  v-bind="{ ...forwardedAttrs, ...describedBy }"
222
255
  overflow-y-hidden
223
256
  @pointer-down-outside="handlePointerDownOutside"
257
+ @focus-outside="handleFocusOutside"
224
258
  @escape-key-down="handleEscapeKeyDown"
225
259
  >
226
260
  <div
@@ -303,13 +337,20 @@ function handleEscapeKeyDown(event: KeyboardEvent) {
303
337
  <slot name="footer" :close="close" />
304
338
  </div>
305
339
  </DialogContent>
306
- </DialogOverlay>
307
-
308
- <DialogOverlay v-else data-tela-escape-layer :class="sizedOverlayClass">
340
+ </component>
341
+
342
+ <component
343
+ :is="overlayComponent"
344
+ v-else-if="!isLegacy && (open || !belowFloatingChat)"
345
+ :data-state="belowFloatingChat ? 'open' : undefined"
346
+ :data-tela-escape-layer="belowFloatingChat ? undefined : ''"
347
+ :class="sizedOverlayClass"
348
+ >
309
349
  <DialogContent
310
350
  :class="sizedContentClass"
311
351
  v-bind="{ ...sizedAttrs, ...describedBy }"
312
352
  @pointer-down-outside="handlePointerDownOutside"
353
+ @focus-outside="handleFocusOutside"
313
354
  @escape-key-down="handleEscapeKeyDown"
314
355
  >
315
356
  <div v-if="showHeader" :class="sizedHeaderClass">
@@ -377,7 +418,7 @@ function handleEscapeKeyDown(event: KeyboardEvent) {
377
418
  <slot name="footer" :close="close" />
378
419
  </div>
379
420
  </DialogContent>
380
- </DialogOverlay>
421
+ </component>
381
422
  </DialogPortal>
382
423
  </DialogRoot>
383
424
  </template>
@@ -645,17 +645,26 @@ describe('timelineWaterfall', () => {
645
645
  },
646
646
  },
647
647
  })
648
- const scrollIntoView = vi.fn()
648
+ const scroller = wrapper.get('.timeline-scroll')
649
+ const scrollTo = vi.fn()
650
+ Object.assign(scroller.element, { scrollTo })
649
651
  const anchor = wrapper.find('[data-scroll-id="enqueued-only"]')
650
- if (anchor.exists())
652
+ const scrollIntoView = vi.fn()
653
+ if (anchor.exists()) {
651
654
  Object.assign(anchor.element, { scrollIntoView })
655
+ vi.spyOn(anchor.element, 'getBoundingClientRect').mockReturnValue(DOMRect.fromRect({ x: 900, y: 500, width: 100, height: 20 }))
656
+ }
657
+ vi.spyOn(scroller.element, 'getBoundingClientRect').mockReturnValue(DOMRect.fromRect({ x: 0, y: 0, width: 400, height: 200 }))
658
+ vi.spyOn(scroller.element, 'clientWidth', 'get').mockReturnValue(400)
659
+ vi.spyOn(scroller.element, 'clientHeight', 'get').mockReturnValue(200)
652
660
 
653
661
  // Act
654
662
  await (wrapper.vm as unknown as { scrollToId: (id: string) => Promise<void> }).scrollToId('enqueued-only')
655
663
 
656
- // Assert
664
+ // Assert: only the timeline's own scroller moves, centering the anchor.
657
665
  expect(anchor.exists()).toBe(true)
658
- expect(scrollIntoView).toHaveBeenCalledWith({ behavior: 'smooth', block: 'center', inline: 'center' })
666
+ expect(scrollIntoView).not.toHaveBeenCalled()
667
+ expect(scrollTo).toHaveBeenCalledWith({ top: 410, left: 750, behavior: 'smooth' })
659
668
  })
660
669
 
661
670
  it('aligns a thin, status-colored queue tail with its execution bar and gives both the same details', () => {
@@ -171,9 +171,18 @@ async function scrollToId(id: string, options?: { focus?: boolean }) {
171
171
  if (el)
172
172
  break
173
173
  }
174
- if (!el)
174
+ const container = scrollEl.value
175
+ if (!el || !container)
175
176
  return
176
- el.scrollIntoView({ behavior: 'smooth', block: 'center', inline: 'center' })
177
+ // Centers the row in the timeline's own scroller; `scrollIntoView` would also scroll every
178
+ // scrollable ancestor, shifting the page or modal that hosts the timeline.
179
+ const containerRect = container.getBoundingClientRect()
180
+ const rect = el.getBoundingClientRect()
181
+ container.scrollTo({
182
+ top: container.scrollTop + rect.top - containerRect.top - (container.clientHeight - rect.height) / 2,
183
+ left: container.scrollLeft + rect.left - containerRect.left - (container.clientWidth - rect.width) / 2,
184
+ behavior: 'smooth',
185
+ })
177
186
  }
178
187
 
179
188
  watch(focusedRowId, (val, _prev, onCleanup) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meistrari/tela-build",
3
- "version": "1.89.0",
3
+ "version": "1.90.0",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "app.config.ts",
@@ -0,0 +1,42 @@
1
+ export interface TelaChatTaskReviewOption {
2
+ id: string
3
+ label: string
4
+ description?: string
5
+ }
6
+
7
+ export interface TelaChatTaskReviewRow {
8
+ id: string
9
+ label: string
10
+ value: { text: string, empty?: boolean }
11
+ status: 'pending' | 'confirmed' | 'corrected' | 'auto'
12
+ editable?: boolean
13
+ placeholder?: string
14
+ }
15
+
16
+ export interface TelaChatTaskReviewStep {
17
+ id: string
18
+ eyebrow?: string
19
+ title: string
20
+ value?: { text: string, empty?: boolean }
21
+ summary?: { id: string, label: string, count: number }[]
22
+ rows?: TelaChatTaskReviewRow[]
23
+ options: TelaChatTaskReviewOption[]
24
+ recommendFirst?: boolean
25
+ input?: { placeholder: string }
26
+ }
27
+
28
+ export interface TelaChatTaskReviewLabels {
29
+ minimize: string
30
+ expand: string
31
+ dismiss: string
32
+ previous: string
33
+ next: string
34
+ skip: string
35
+ recommended: string
36
+ empty: string
37
+ confirmRow: string
38
+ editRow: string
39
+ status: Record<Exclude<TelaChatTaskReviewRow['status'], 'pending'>, string>
40
+ progress: (current: number, total: number) => string
41
+ submitting: string
42
+ }
package/types/index.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from './chat-answer'
2
+ export * from './chat-task-review'
2
3
  export * from './custom-icon'
3
4
  export * from './status'