@meistrari/tela-build 1.107.0 → 2.1.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.
Files changed (76) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/components/tela/avatar/avatar-fallback.vue +28 -0
  3. package/components/tela/avatar/avatar.mdx +12 -0
  4. package/components/tela/avatar/avatar.vue +4 -2
  5. package/components/tela/button/button.mdx +1 -1
  6. package/components/tela/card/card.mdx +15 -11
  7. package/components/tela/chat/chat.mdx +113 -0
  8. package/components/tela/chat/usage/usage-meter.vue +80 -0
  9. package/components/tela/chat/usage/usage-popover.vue +77 -0
  10. package/components/tela/dropdown-menu/dropdown-menu.mdx +1 -1
  11. package/components/tela/file-upload/file-upload.mdx +1 -2
  12. package/components/tela/filter/filter-content.vue +27 -3
  13. package/components/tela/filter/filter-trigger.vue +6 -6
  14. package/components/tela/filter/filter.mdx +31 -4
  15. package/components/tela/filter/filter.vue +4 -0
  16. package/components/tela/modal/modal.mdx +8 -5
  17. package/components/tela/popover/popover.mdx +9 -3
  18. package/components/tela/progress-bar/progress-bar.mdx +6 -2
  19. package/components/tela/progress-bar/progress-bar.vue +2 -1
  20. package/components/tela/side-sheet/side-sheet.mdx +4 -2
  21. package/components/tela/sidebar/sidebar-logo.vue +1 -3
  22. package/components/tela/sidebar/sidebar.mdx +3 -3
  23. package/css/animations.css +20 -0
  24. package/docs/animations.md +58 -120
  25. package/docs/design-review.md +79 -0
  26. package/docs/index.md +258 -0
  27. package/docs/sounds.md +1 -1
  28. package/docs/spacing-and-surfaces.md +116 -0
  29. package/docs/tokens.md +64 -73
  30. package/docs/typography.md +63 -53
  31. package/lib/__tests__/doc-generator.test.ts +86 -6
  32. package/lib/doc-generator.ts +160 -72
  33. package/lib/extractors/volar-extract.ts +12 -1
  34. package/lib/tela-build-skill.ts +46 -1
  35. package/package.json +1 -1
  36. package/types/chat-usage.ts +14 -0
  37. package/types/index.ts +1 -0
  38. package/components/tela/collapsible-section/collapsible-section.mdx +0 -180
  39. package/components/tela/collapsible-section/collapsible-section.vue +0 -51
  40. package/components/tela/collapsible-section-with-actions.vue +0 -60
  41. package/components/tela/confirm-button/confirm-button.vue +0 -141
  42. package/components/tela/date-range-picker.vue +0 -223
  43. package/components/tela/dialog/dialog.mdx +0 -170
  44. package/components/tela/dialog/dialog.vue +0 -186
  45. package/components/tela/expandable-input.vue +0 -96
  46. package/components/tela/filter/filter-content.test.ts +0 -60
  47. package/components/tela/filters/checkbox-filter.vue +0 -165
  48. package/components/tela/filters/date-filter.vue +0 -209
  49. package/components/tela/filters/user-filter.vue +0 -271
  50. package/components/tela/initials.vue +0 -33
  51. package/components/tela/inline-input.vue +0 -77
  52. package/components/tela/live-label.vue +0 -48
  53. package/components/tela/long-press-button.vue +0 -98
  54. package/components/tela/multiple-select/multiple-select.mdx +0 -310
  55. package/components/tela/multiple-select/multiple-select.vue +0 -652
  56. package/components/tela/pane.vue +0 -118
  57. package/components/tela/popover-list/popover-list-nested.vue +0 -108
  58. package/components/tela/popover-list/popover-list.vue +0 -193
  59. package/components/tela/selector/selector.vue +0 -47
  60. package/components/tela/sheet/sheet-close.vue +0 -12
  61. package/components/tela/sheet/sheet-content.vue +0 -61
  62. package/components/tela/sheet/sheet-description.vue +0 -23
  63. package/components/tela/sheet/sheet-footer.vue +0 -18
  64. package/components/tela/sheet/sheet-header.vue +0 -15
  65. package/components/tela/sheet/sheet-root.vue +0 -18
  66. package/components/tela/sheet/sheet-title.vue +0 -23
  67. package/components/tela/sheet/sheet-trigger.vue +0 -12
  68. package/components/tela/sheet/sheet.client.vue +0 -154
  69. package/components/tela/sheet/sheet.mdx +0 -176
  70. package/components/tela/sheet/variants.ts +0 -22
  71. package/components/tela/skeleton-icon.vue +0 -24
  72. package/components/tela/span.vue +0 -24
  73. package/components/tela/variable-input.vue +0 -104
  74. package/components/tela/wide-button/wide-button.vue +0 -40
  75. package/docs/interfaces.md +0 -467
  76. package/docs/surfaces.md +0 -127
package/CHANGELOG.md CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  Latest updates and announcements.
4
4
 
5
+ ## November 25, 2026
6
+
7
+ - [Chat → Usage](/templates/chat#usage) New `TelaChatUsageMeter` and `TelaChatUsagePopover` show the assistant's monthly usage. The meter is an 18px progress ring that fills clockwise with `percent` and opens the popover above it (`v-model:open`). The popover is a 256px card with the renewal (`renews-in-days`), the monthly limit bar and its percentage, plus what its `state` adds: `warning` a notice with the share left, `limit` the limit notice with **Turn on extra usage** and **Not now** (emit `activate` and `dismiss`, and close the meter's popover), and `additional` the formatted `additional-amount`. It renders on its own too, for hosts that show the body without the ring. Set `calculating` while a new value is on its way: the ring pulses over the last value (a steady dimmer ring under reduced motion), the meter's `aria-label` reads `labels.calculating` and sets `aria-busy`, and the popover shows `labels.calculating` ("Calculating…") in place of the percentage. Copy comes from `labels` (`TelaChatUsageLabels`), with English defaults.
8
+ - [Progress Bar](/components/progress-bar) New `variant="blue"` (sky-500 fill). `auto` never picks it, and the other variants are unchanged.
9
+
5
10
  ## November 18, 2026
6
11
 
7
12
  - [Chat → Empty State](/templates/chat#empty-state) `TelaChatEmptyState` has a `#header` slot that replaces the title and description, so a host can render its own greeting, such as a logo above a custom title.
@@ -14,6 +19,23 @@ Latest updates and announcements.
14
19
 
15
20
  ## November 17, 2026
16
21
 
22
+ - **Breaking (2.0.0):** removed 20 outdated components, so an app that still renders one of them gets an unresolved tag after upgrading to 2.0.0. Apps on a `^1.x` range stay on 1.x until they bump. Each has a replacement:
23
+ - `TelaDialog`: [Modal](/components/modal). For a yes-or-no question, use `TelaConfirmationModal`, which stays.
24
+ - `TelaSheet` and its parts (`TelaSheetRoot`, `TelaSheetContent`, `TelaSheetHeader`, `TelaSheetFooter`, `TelaSheetTitle`, `TelaSheetDescription`, `TelaSheetTrigger`, `TelaSheetClose`): [Side Sheet](/components/side-sheet) for a panel on the side, or [Modal](/components/modal) for content that needs the whole screen.
25
+ - `TelaCollapsibleSection` and `TelaCollapsibleSectionWithActions`: [Collapsible](/components/collapsible).
26
+ - `TelaMultipleSelect` and `TelaPopoverList`: [Dropdown Menu](/components/dropdown-menu) with `TelaDropdownMenuCheckboxItem`.
27
+ - `TelaInitials`: [Avatar](/components/avatar), which renders the initial of `alt` with the new `TelaAvatarFallback`. Override it through the avatar's `fallback` slot.
28
+ - `TelaFiltersCheckboxFilter`, `TelaFiltersDateFilter`, `TelaFiltersUserFilter` and `TelaDateRangePicker`: [Filter](/components/filter), with [Range Calendar](/components/range-calendar) in a filter's `#footer-{key}` slot for a custom date range.
29
+ - `TelaConfirmButton`, `TelaWideButton` and `TelaLongPressButton`: [Button](/components/button).
30
+ - `TelaInlineInput`, `TelaExpandableInput` and `TelaVariableInput`: [Input](/components/input) and [Textarea](/components/textarea).
31
+ - `TelaLiveLabel`: [Status](/components/status).
32
+ - `TelaSkeletonIcon`: [Skeleton](/components/skeleton).
33
+ - `TelaSpan`, `TelaPane` and `TelaSelector`: plain markup with the design tokens.
34
+ - [Filter](/components/filter#apply-button) The `header-{key}` and `footer-{key}` slots receive `close`, and `TelaFilter` emits `openChange` with the open filter's key (or `null` when it closes). Together they let a filter apply its selection from an Apply button instead of on every click.
35
+ - [Filter](/components/filter) The popover animates its size only when it opens or moves to another filter. Inside one filter its height follows the content in the same frame, so content that animates itself (a calendar revealed in a `TelaCollapsible`) no longer leaves the content and the popover out of step, and a list filtered by a search no longer animates on each keystroke.
36
+ - [Filter](/components/filter) Home and End in a search input inside a filter's header move the caret again, instead of jumping focus to the first or last option.
37
+ - [Filter](/components/filter#scrollable-options) A long option list still scrolls, but its scrollbar is now transparent.
38
+ - [Filter](/components/filter) The selected-count badge on a trigger is 12px tall and centered with the label. It was 20px: its 8px digit lost the badge's own line height and took the label's 18px. The digit now uses the badge's 9px text.
17
39
  - [Onboarding Card](/components/onboarding-card) is a new component for short, step-by-step feature introductions: a 280px card with an illustration from the `#thumb` slot, a title and a description per step, step dots that double as navigation, and "Skip" with a next arrow, or "Got it" on the last step. The current step is bound with `v-model:step`, and `skip` and `finish` leave dismissing to the host. All copy comes from `steps` and `labels`. The card has no entrance of its own, so the host animates it in (the docs show a `Motion` with `as-child`), and each step advances by itself after `duration` (default 5000ms, `0` turns it off) while the current dot fills like a progress bar. Hovering or keyboard focus pauses it, and the last step waits for the user. Between steps the illustration fades out and the next one remounts, so `#thumb` content can play its own entrance. Going to the last step, "Skip" fades out and the arrow widens into the finish button. Under `prefers-reduced-motion`, only the progress fill still moves.
18
40
  - [Chat → Model Selector](/templates/chat#model-selector) When `reasoning-options` changes and no longer includes the selected level, `v-model:reasoning` is cleared, so the menu and the parent agree.
19
41
  - [Combobox](/components/combobox) Table layout matches the design specs: group headings and the Cost / Input / Output headers are 10px semibold, provider icons are 15px inside their 20px box, and token limits are 11px uppercase on every row, in primary text on the selected and highlighted rows. The trigger drops the `Claude ` prefix (`Claude Opus 5` reads `Opus 5`).
@@ -0,0 +1,28 @@
1
+ <script setup lang="ts">
2
+ import type { AvatarSize } from './avatar.vue'
3
+
4
+ const props = defineProps<{
5
+ /** The word whose first letter is shown, usually the person's or workspace's name. */
6
+ word: string
7
+ size?: AvatarSize
8
+ class?: string
9
+ }>()
10
+
11
+ const initial = computed(() => props.word.charAt(0).toUpperCase())
12
+
13
+ const textSizes: Record<AvatarSize | 'default', string> = {
14
+ '2xs': 'text-11px',
15
+ 'xs': 'text-12px',
16
+ 'sm': 'text-16px',
17
+ 'md': 'text-20px',
18
+ 'lg': 'text-28px',
19
+ 'xl': 'text-32px',
20
+ 'default': 'text-18px',
21
+ }
22
+ </script>
23
+
24
+ <template>
25
+ <div :class="cn('flex size-full items-center justify-center bg-neutral-950', textSizes[props.size ?? 'default'], props.class)">
26
+ <TelaAnimatedValue :value="initial" class="text-center font-540 leading-18px text-inverse" />
27
+ </div>
28
+ </template>
@@ -38,6 +38,18 @@ A flexible avatar component that displays user images with fallback support. Aut
38
38
 
39
39
  The component automatically generates initials from the `alt` text when no image is provided.
40
40
 
41
+ ### Custom Fallback
42
+
43
+ The initial is `TelaAvatarFallback`. Override it through the `fallback` slot, for example to show the initial of a different word:
44
+
45
+ ```vue
46
+ <TelaAvatar size="sm">
47
+ <template #fallback>
48
+ <TelaAvatarFallback word="Workspace" size="sm" />
49
+ </template>
50
+ </TelaAvatar>
51
+ ```
52
+
41
53
  ### Different Sizes
42
54
 
43
55
  ```vue
@@ -71,7 +71,7 @@ watch(() => props.image, () => {
71
71
  :class="[radiusClass, props.class]"
72
72
  bg-cover
73
73
  bg-center
74
- overflow-hidden
74
+ overflow-hidden select-none
75
75
  flex items-center justify-center
76
76
  :style="style"
77
77
  >
@@ -91,6 +91,8 @@ watch(() => props.image, () => {
91
91
  </template>
92
92
  </ClientOnly>
93
93
  <TelaIcon v-else-if="errorLoadingImage" name="i-ph-image-broken" text="icon-tertiary" size="lg" />
94
- <TelaInitials v-else-if="alt" :size="size" :word="alt" />
94
+ <slot v-else-if="alt || $slots.fallback" name="fallback">
95
+ <TelaAvatarFallback :word="alt ?? ''" :size="size" />
96
+ </slot>
95
97
  </div>
96
98
  </template>
@@ -116,7 +116,7 @@ Three sizes, `md` by default. Each one sets its own text, padding, radius and ic
116
116
  Go to Home
117
117
  </TelaButton>
118
118
 
119
- <TelaButton to="https://example.com" target="_blank" variant="ghost">
119
+ <TelaButton to="https://example.com" target="_blank" variant="secondary">
120
120
  External Link
121
121
  </TelaButton>
122
122
  ```
@@ -8,7 +8,7 @@ A surface container component used to group related content with consistent visu
8
8
  - Attributify spacing/radius props (`p-*`, `px-*`, `py-*`, `rounded-*`) are intentionally ignored on `<TelaCard>` to keep `size` deterministic. If you need a forced override, use `class` with the important modifier (e.g. `class="!p-0"`).
9
9
  - Cards in grids must use `h-full` for consistent heights.
10
10
  - **Never** wrap `TelaTable` in `TelaCard` — tables are their own surface.
11
- - Small gaps look like accidents next to large typography. Use at least `gap-4px` when a card contains a large typographic element — prefer `gap-6px` when the large text is the primary content.
11
+ - A label and the large value it names are one unit: keep them tight (0–4px), and separate that unit from the rest of the card with a clearly larger gap. `TelaHomeMetricsCard` uses no gap inside the pair and 36px below it; use it for metric cards.
12
12
 
13
13
  ## Size Prop
14
14
 
@@ -63,22 +63,26 @@ Cards in grids must use `h-full` for consistent heights.
63
63
  </div>
64
64
  ```
65
65
 
66
- ### Gap with Large Text
66
+ ### Label and value
67
67
 
68
68
  ```vue
69
- <!-- Wrong — too tight -->
70
- <TelaCard size="sm">
71
- <div flex flex-col gap-1>
72
- <span body-12-medium text-secondary>Total Requests</span>
69
+ <!-- Wrong — one gap for everything, so the value floats between the label and the chart -->
70
+ <TelaCard size="xs" h-full>
71
+ <div flex flex-col gap-16px>
72
+ <span body-12-regular text-secondary>Total Requests</span>
73
73
  <span heading-h2-semibold text-primary>128,430</span>
74
+ <RequestsChart />
74
75
  </div>
75
76
  </TelaCard>
76
77
 
77
- <!-- Correct -->
78
- <TelaCard size="sm" h-full>
79
- <div flex flex-col gap-4px>
80
- <span body-12-medium text-secondary>Total Requests</span>
81
- <h1 heading-h1-semibold text-primary>128,430</h1>
78
+ <!-- Correct — the label and value are one unit, set apart from the rest -->
79
+ <TelaCard size="xs" h-full>
80
+ <div flex flex-col gap-36px>
81
+ <div flex flex-col>
82
+ <span body-12-regular text-secondary>Total Requests</span>
83
+ <h2 heading-h2-semibold text-primary>128,430</h2>
84
+ </div>
85
+ <RequestsChart />
82
86
  </div>
83
87
  </TelaCard>
84
88
  ```
@@ -1318,6 +1318,80 @@ function save(id: string, value: { title: string, description: string }) {
1318
1318
 
1319
1319
  **`Escape`** in the inline editor cancels it. While an item is open, the other pencils and remove buttons hide and "Add step" is disabled; disable the actions bar too (`:disabled="!!editingId"`), so the plan is never submitted with an unsaved edit.
1320
1320
 
1321
+ ### Usage
1322
+
1323
+ How much of the assistant's monthly allowance the user has spent. `TelaChatUsageMeter` is a small progress ring that opens `TelaChatUsagePopover` above it; the popover is also a component of its own, so a host can show the same body without the ring (in an onboarding card, for example). Both only render: the host fetches the usage, picks the `state`, formats the amount and decides what activating or dismissing does.
1324
+
1325
+ | State | When | Popover |
1326
+ | --- | --- | --- |
1327
+ | `normal` | under 80% | Renewal, the monthly limit bar and its percentage |
1328
+ | `warning` | 80% to 99% | Adds a notice with the share that is left |
1329
+ | `limit` | 100%, no additional usage | The limit notice with **Turn on extra usage** and **Not now** |
1330
+ | `additional` | 100%, additional usage on | A full bar and the amount spent beyond the allowance (`additional-amount`) |
1331
+
1332
+ ```vue
1333
+ <template>
1334
+ <div flex flex-wrap items-start gap-16px>
1335
+ <TelaChatUsagePopover :percent="32" :renews-in-days="12" />
1336
+ <TelaChatUsagePopover :percent="80" :renews-in-days="5" state="warning" />
1337
+ <TelaChatUsagePopover :percent="100" :renews-in-days="5" state="limit" />
1338
+ <TelaChatUsagePopover :percent="100" :renews-in-days="2" state="additional" additional-amount="US$ 32" />
1339
+ </div>
1340
+ </template>
1341
+ ```
1342
+
1343
+ The meter fills clockwise with the percentage and is a full ring at 100%. Clicking it opens the popover; **Turn on extra usage** and **Not now** close it and emit `activate` and `dismiss`. Bind `v-model:open` to open it from the host, for example when the user reaches the limit.
1344
+
1345
+ ```vue
1346
+ <script setup lang="ts">
1347
+ const open = ref(false)
1348
+ const additional = ref(false)
1349
+ </script>
1350
+
1351
+ <template>
1352
+ <div flex items-center gap-16px>
1353
+ <TelaChatUsageMeter :percent="32" :renews-in-days="12" />
1354
+ <TelaChatUsageMeter :percent="86" :renews-in-days="5" state="warning" />
1355
+ <TelaChatUsageMeter
1356
+ v-model:open="open"
1357
+ :percent="100"
1358
+ :renews-in-days="5"
1359
+ :state="additional ? 'additional' : 'limit'"
1360
+ additional-amount="US$ 0"
1361
+ @activate="additional = true"
1362
+ />
1363
+ </div>
1364
+ </template>
1365
+ ```
1366
+
1367
+ The usage the host reads lags behind the last reply, so after each answer set `calculating` until the new value arrives. The meter's ring pulses (it holds at a dimmer opacity under reduced motion) and keeps showing the last value, while its `aria-label` reads `labels.calculating` and it sets `aria-busy`; the popover shows `labels.calculating` in place of the percentage and leaves the rest as it was.
1368
+
1369
+ ```vue
1370
+ <template>
1371
+ <div flex items-start gap-16px>
1372
+ <TelaChatUsageMeter :percent="32" :renews-in-days="12" calculating />
1373
+ <TelaChatUsagePopover :percent="32" :renews-in-days="12" calculating />
1374
+ </div>
1375
+ </template>
1376
+ ```
1377
+
1378
+ All copy comes from `labels`, with English defaults. The functions get the value to show; `trigger` gets the percentage as text (`32%`), or `labels.calculating` while calculating:
1379
+
1380
+ ```ts
1381
+ const labels: Partial<TelaChatUsageLabels> = {
1382
+ trigger: value => `Uso do assistente: ${value}`,
1383
+ title: 'Assistente',
1384
+ renewsIn: days => `Renova em ${days} ${days === 1 ? 'dia' : 'dias'}`,
1385
+ monthlyLimit: 'Limite mensal',
1386
+ warning: remaining => `Restam ${remaining}% de uso este mês. Você pode ativar uso adicional ao chegar em 100%.`,
1387
+ limit: 'Você usou o limite de cortesia deste mês. Ative o uso adicional para continuar usando.',
1388
+ activate: 'Ativar uso adicional',
1389
+ dismiss: 'Agora não',
1390
+ additional: 'adicionais',
1391
+ calculating: 'Calculando…',
1392
+ }
1393
+ ```
1394
+
1321
1395
  ### Working Indicator
1322
1396
 
1323
1397
  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.
@@ -1478,6 +1552,8 @@ import { TelaChatIconsAnthropic, TelaChatIconsGemini, TelaChatIconsGrok, TelaCha
1478
1552
  | `TelaChatTaskReview` | Controlled field-by-field review card (value, lettered options, correction input, item rows); emits intent only. |
1479
1553
  | `TelaChatPlan` | Controlled plan card: items or numbered steps with inline editing, and an edit mode to reorder, remove and add steps; emits intent only. |
1480
1554
  | `TelaChatPlanActions` | Bar under a plan: submit, "Edit plan" and a hint, or Save plan / Cancel while editing. |
1555
+ | `TelaChatUsageMeter` | Progress ring for the assistant's monthly usage; opens `TelaChatUsagePopover`. |
1556
+ | `TelaChatUsagePopover` | Usage body: renewal, monthly limit bar, and the warning, limit or additional-usage content for its `state`; emits intent only. |
1481
1557
  | `TelaChatWorkingIndicator` | Running-turn row: square loader, label, elapsed time. |
1482
1558
  | `TelaChatStopRunButton` | Replaces the prompt input while a turn runs; centered pill that emits `stop`. |
1483
1559
  | `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`. |
@@ -1924,6 +2000,42 @@ type TelaChatPlanItem = {
1924
2000
  }
1925
2001
  ```
1926
2002
 
2003
+ ### Usage
2004
+
2005
+ ```typescript
2006
+ type UsagePopoverProps = {
2007
+ percent: number // share of the monthly allowance used; rounded and clamped to 0-100
2008
+ renewsInDays: number // passed to labels.renewsIn
2009
+ state?: TelaChatUsageState // 'normal' | 'warning' | 'limit' | 'additional'; default: 'normal'
2010
+ additionalAmount?: string // already formatted, "US$ 32"; shown only in the 'additional' state
2011
+ calculating?: boolean // a new value is on its way; shows labels.calculating for the percentage; default: false
2012
+ labels?: Partial<TelaChatUsageLabels>
2013
+ }
2014
+
2015
+ type UsagePopoverEmits = { activate: [], dismiss: [] } // the 'limit' state's buttons
2016
+
2017
+ type UsageMeterProps = UsagePopoverProps & {
2018
+ open?: boolean // v-model:open; activate and dismiss close it
2019
+ // calculating also pulses the ring over the last value, sets aria-busy and passes labels.calculating to labels.trigger
2020
+ }
2021
+
2022
+ type UsageMeterEmits = UsagePopoverEmits
2023
+
2024
+ // import type { ... } from '@meistrari/tela-build/types'
2025
+ type TelaChatUsageLabels = {
2026
+ trigger: (value: string) => string // meter aria-label; "Usage: 32%", "Usage: Calculating…"
2027
+ title: string // "Assistant"
2028
+ renewsIn: (days: number) => string // "Renews in 12 days"
2029
+ monthlyLimit: string // "Monthly limit"; also the bar's aria-label
2030
+ warning: (remaining: number) => string // 'warning' notice; remaining = 100 - percent
2031
+ limit: string // 'limit' notice
2032
+ activate: string // "Turn on extra usage"
2033
+ dismiss: string // "Not now"
2034
+ additional: string // after the amount: "US$ 32 extra"
2035
+ calculating: string // replaces the percentage while calculating; "Calculating…"
2036
+ }
2037
+ ```
2038
+
1927
2039
  ### Working Indicator
1928
2040
 
1929
2041
  ```typescript
@@ -2031,6 +2143,7 @@ Where each primitive lives in `components/tela/chat/`. Component names come from
2031
2143
  | `answer/` | `TelaChatAnswer`, choice questions the assistant asks inline. |
2032
2144
  | `task-review/` | `TelaChatTaskReview`, the card for confirming or correcting extracted values one by one. |
2033
2145
  | `plan/` | `TelaChatPlan` and `TelaChatPlanActions`, a plan the user can edit before the assistant builds it. |
2146
+ | `usage/` | `TelaChatUsageMeter` and `TelaChatUsagePopover`, the assistant's monthly usage. |
2034
2147
  | `chat-empty-state.vue` | `TelaChatEmptyState`, shown before the first message. |
2035
2148
  | `chat-suggestions.vue`, `chat-suggestion.vue` | Suggested prompts. |
2036
2149
  | `chat-reasoning-step.vue` | `TelaChatReasoningStep`, collapsible tool or reasoning entry. |
@@ -0,0 +1,80 @@
1
+ <script setup lang="ts">
2
+ import type { TelaChatUsageLabels, TelaChatUsageState } from '../../../../types/chat-usage'
3
+
4
+ const props = withDefaults(defineProps<{
5
+ percent: number
6
+ renewsInDays: number
7
+ state?: TelaChatUsageState
8
+ additionalAmount?: string
9
+ labels?: Partial<TelaChatUsageLabels>
10
+ calculating?: boolean
11
+ }>(), {
12
+ state: 'normal',
13
+ calculating: false,
14
+ labels: () => ({}),
15
+ })
16
+
17
+ const emit = defineEmits<{
18
+ activate: []
19
+ dismiss: []
20
+ }>()
21
+
22
+ const open = defineModel<boolean>('open', { default: false })
23
+
24
+ // Length of each gap between the used arc and the track, on a 100-unit circumference.
25
+ const GAP = 8.6
26
+
27
+ const used = computed(() => Math.min(100, Math.max(0, Math.round(props.percent))))
28
+ const track = computed(() => used.value === 0 ? 100 : 100 - used.value - 2 * GAP)
29
+ const shown = computed(() => props.calculating ? (props.labels.calculating ?? 'Calculating…') : `${used.value}%`)
30
+ const triggerLabel = computed(() => props.labels.trigger?.(shown.value) ?? `Usage: ${shown.value}`)
31
+ </script>
32
+
33
+ <template>
34
+ <TelaPopover v-model:open="open">
35
+ <TelaPopoverTrigger as-child>
36
+ <button
37
+ type="button"
38
+ size-18px flex items-center justify-center shrink-0 rounded-6px cursor-pointer outline-none
39
+ hover:bg-muted focus-visible:ring-0.5px focus-visible:ring-cyan-600
40
+ class="data-[state=open]:bg-muted"
41
+ :aria-label="triggerLabel"
42
+ :aria-busy="calculating || undefined"
43
+ >
44
+ <svg
45
+ viewBox="0 0 18 18" size-18px fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" aria-hidden="true"
46
+ :class="calculating && 'motion-safe:animate-[usageCalculating_1.1s_linear_infinite] motion-reduce:opacity-55'"
47
+ >
48
+ <g transform="rotate(-90 9 9)">
49
+ <circle
50
+ v-if="track > 0"
51
+ cx="9" cy="9" r="5.75" pathLength="100"
52
+ text-icon-subtle
53
+ :stroke-dasharray="`${track} ${100 - track}`"
54
+ :stroke-dashoffset="-(used + GAP)"
55
+ />
56
+ <circle
57
+ v-if="used > 0"
58
+ cx="9" cy="9" r="5.75" pathLength="100"
59
+ text-primary
60
+ :stroke-dasharray="`${used} ${100 - used}`"
61
+ />
62
+ </g>
63
+ </svg>
64
+ </button>
65
+ </TelaPopoverTrigger>
66
+ <TelaPopoverContent
67
+ side="top"
68
+ align="end"
69
+ :side-offset="6"
70
+ data-tela-escape-layer
71
+ class="!w-auto !rounded-none !border-0 !bg-transparent !p-0 !shadow-none"
72
+ >
73
+ <TelaChatUsagePopover
74
+ v-bind="props"
75
+ @activate="open = false; emit('activate')"
76
+ @dismiss="open = false; emit('dismiss')"
77
+ />
78
+ </TelaPopoverContent>
79
+ </TelaPopover>
80
+ </template>
@@ -0,0 +1,77 @@
1
+ <script setup lang="ts">
2
+ import type { TelaChatUsageLabels, TelaChatUsageState } from '../../../../types/chat-usage'
3
+
4
+ const props = withDefaults(defineProps<{
5
+ percent: number
6
+ renewsInDays: number
7
+ state?: TelaChatUsageState
8
+ additionalAmount?: string
9
+ labels?: Partial<TelaChatUsageLabels>
10
+ calculating?: boolean
11
+ }>(), {
12
+ state: 'normal',
13
+ calculating: false,
14
+ labels: () => ({}),
15
+ })
16
+
17
+ const emit = defineEmits<{
18
+ activate: []
19
+ dismiss: []
20
+ }>()
21
+
22
+ const copy = computed<Omit<TelaChatUsageLabels, 'trigger'>>(() => ({
23
+ title: 'Assistant',
24
+ renewsIn: days => `Renews in ${days} ${days === 1 ? 'day' : 'days'}`,
25
+ monthlyLimit: 'Monthly limit',
26
+ warning: remaining => `${remaining}% of this month's usage left. You can turn on extra usage when you reach 100%.`,
27
+ limit: 'You\'ve used this month\'s allowance. Turn on extra usage to keep using it.',
28
+ activate: 'Turn on extra usage',
29
+ dismiss: 'Not now',
30
+ additional: 'extra',
31
+ calculating: 'Calculating…',
32
+ ...props.labels,
33
+ }))
34
+
35
+ const used = computed(() => Math.min(100, Math.max(0, Math.round(props.percent))))
36
+ </script>
37
+
38
+ <template>
39
+ <div flex="~ col" gap-16px w-256px pt-10px px-12px pb-12px bg rounded-12px border-0.5px border shadow-flying>
40
+ <div flex items-center justify-between gap-8px>
41
+ <span body-11-semibold text-primary>{{ copy.title }}</span>
42
+ <span body-11-regular text-secondary>{{ copy.renewsIn(renewsInDays) }}</span>
43
+ </div>
44
+
45
+ <div flex="~ col" gap-8px>
46
+ <div flex="~ col" gap-6px>
47
+ <div flex items-center justify-between gap-8px>
48
+ <span body-11-medium text-primary>{{ copy.monthlyLimit }}</span>
49
+ <span body-11-regular text-secondary>{{ calculating ? copy.calculating : `${used}%` }}</span>
50
+ </div>
51
+ <TelaProgressBar :model-value="used" variant="blue" :aria-label="copy.monthlyLimit" />
52
+ </div>
53
+
54
+ <p v-if="state === 'warning'" body-11-regular text-secondary>
55
+ {{ copy.warning(100 - used) }}
56
+ </p>
57
+
58
+ <template v-else-if="state === 'limit'">
59
+ <p body-11-regular text-secondary>
60
+ {{ copy.limit }}
61
+ </p>
62
+ <div flex flex-wrap items-center gap-6px>
63
+ <TelaButton size="sm" whitespace-nowrap @click="emit('activate')">
64
+ {{ copy.activate }}
65
+ </TelaButton>
66
+ <TelaButton size="sm" variant="secondary" whitespace-nowrap @click="emit('dismiss')">
67
+ {{ copy.dismiss }}
68
+ </TelaButton>
69
+ </div>
70
+ </template>
71
+
72
+ <p v-else-if="state === 'additional' && additionalAmount" body-11-regular text-secondary>
73
+ <span body-11-semibold text-primary>{{ additionalAmount }}</span> {{ copy.additional }}
74
+ </p>
75
+ </div>
76
+ </div>
77
+ </template>
@@ -199,7 +199,7 @@ const items = ref([
199
199
  }
200
200
  ]"
201
201
  >
202
- <TelaButton variant="ghost">⋮</TelaButton>
202
+ <TelaIconButton icon="i-ph-dots-three" color="secondary" label="More actions" />
203
203
  </TelaDropdownMenu>
204
204
  ```
205
205
 
@@ -109,8 +109,7 @@ const removeFile = (index) => {
109
109
  >
110
110
  <span>{{ file.name }} ({{ formatFileSize(file.size) }})</span>
111
111
  <TelaButton
112
- size="sm"
113
- variant="ghost"
112
+ variant="secondary"
114
113
  @click="removeFile(index)"
115
114
  >
116
115
  Remove
@@ -30,6 +30,20 @@ const fadeTransition = {
30
30
  const contentMeasure = useTemplateRef<HTMLElement>('contentMeasure')
31
31
  const { height: heightContent } = useElementSize(contentMeasure)
32
32
 
33
+ // The popover animates its size only while it opens or moves to another filter. Inside one filter its height is
34
+ // left to layout, so it follows its content in the same frame: content that animates itself (a calendar in a
35
+ // collapsible) drives the height without two animations fighting, and a list shrinking as the user types a search
36
+ // doesn't animate on keystrokes.
37
+ const isChangingFilter = ref(false)
38
+ const { start: startFilterChange } = useTimeoutFn(() => {
39
+ isChangingFilter.value = false
40
+ }, 300, { immediate: false })
41
+
42
+ watch(() => props.configs.map(config => config.key).join('|'), () => {
43
+ isChangingFilter.value = true
44
+ startFilterChange()
45
+ }, { immediate: true })
46
+
33
47
  const computedHeightContent = computed(() => {
34
48
  if (heightContent.value > 0) {
35
49
  return `${heightContent.value}px`
@@ -114,6 +128,13 @@ function onItemsKeydown(event: KeyboardEvent) {
114
128
  return
115
129
  }
116
130
 
131
+ // Home and End move the caret in a search input in the header; don't take them over for the list
132
+ const target = event.target as HTMLElement | null
133
+ const isEditing = Boolean(target?.closest('input, textarea, [contenteditable="true"]'))
134
+ if (isEditing && (event.key === 'Home' || event.key === 'End')) {
135
+ return
136
+ }
137
+
117
138
  const currentIndex = buttons.indexOf(document.activeElement as HTMLButtonElement)
118
139
 
119
140
  switch (event.key) {
@@ -201,8 +222,8 @@ function getSlideMotionVariants(index: number, closingState: boolean) {
201
222
  @pointer-down-outside="emit('pointerDownOutside', $event)"
202
223
  >
203
224
  <div
204
- class="[transition:height_0.25s_ease-out,width_0.25s_ease-out]"
205
- :style="{ width, ...(computedHeightContent ? { height: computedHeightContent } : {}) }"
225
+ :class="isChangingFilter ? '[transition:height_0.25s_ease-out,width_0.25s_ease-out]' : '[transition:width_0.25s_ease-out]'"
226
+ :style="{ width, ...(isChangingFilter && computedHeightContent ? { height: computedHeightContent } : {}) }"
206
227
  >
207
228
  <div ref="contentMeasure" @keydown="onItemsKeydown" @pointerover="onItemsPointerOver">
208
229
  <AnimatePresence mode="popLayout" :initial="false">
@@ -218,10 +239,12 @@ function getSlideMotionVariants(index: number, closingState: boolean) {
218
239
  :filter="cfg.config"
219
240
  :selected="props.modelValue[cfg.config.key] ?? []"
220
241
  :toggle="(value: string) => toggleOption(cfg.config.key, value, cfg.config.selectionMode)"
242
+ :close="() => emit('select')"
221
243
  />
222
244
 
223
245
  <div mx--4px>
224
- <TelaScrollArea :class="cn('flex flex-col', cfg.config.optionsClass)" tabindex="-1">
246
+ <!-- the list still scrolls; its scrollbar is transparent -->
247
+ <TelaScrollArea :class="cn('flex flex-col', cfg.config.optionsClass)" scroll-thumb-class="opacity-0" tabindex="-1">
225
248
  <div px-4px>
226
249
  <component
227
250
  :is="cfg.config.selectionMode === 'single' ? TelaRadioGroupRoot : 'div'"
@@ -272,6 +295,7 @@ function getSlideMotionVariants(index: number, closingState: boolean) {
272
295
  :filter="cfg.config"
273
296
  :selected="props.modelValue[cfg.config.key] ?? []"
274
297
  :toggle="(value: string) => toggleOption(cfg.config.key, value, cfg.config.selectionMode)"
298
+ :close="() => emit('select')"
275
299
  />
276
300
  </Motion>
277
301
  </AnimatePresence>
@@ -19,7 +19,7 @@ defineEmits<{
19
19
  type="button"
20
20
  :data-active="isActive || undefined"
21
21
  :class="cn(
22
- 'group inline-flex h-[32px] items-center gap-[7px] px-[12px] border-l-[0.5px] border-y-[0.5px] border-strong bg-background outline-none transition-all duration-150',
22
+ 'group inline-flex h-[32px] items-center gap-[7px] px-[12px] border-l-[0.5px] border-y-[0.5px] border-strong bg-background outline-none transition-colors duration-150',
23
23
  'text-[14px] leading-[18px] -tracking-[0.15px] font-540 text-primary',
24
24
  'focus-visible:ring-2 focus-visible:ring-border [&:not([data-active])]:hover:bg-subtle data-[active]:bg-muted first:rounded-l-[10px] last:rounded-r-[10px] last:border-r-[0.5px]',
25
25
  triggerClass,
@@ -27,19 +27,19 @@ defineEmits<{
27
27
  :aria-label="filter.showCount && count ? `${filter.label}, ${count} selected` : undefined"
28
28
  @click="$emit('click')"
29
29
  >
30
- <div inline-flex items-center>
31
- <span button-14-semibold text-primary>{{ filter.label }}</span>
30
+ <div class="inline-flex items-center">
31
+ <span class="button-14-semibold text-primary">{{ filter.label }}</span>
32
32
 
33
33
  <AnimatePresence>
34
34
  <Motion
35
35
  v-if="count && (filter.selectionMode === 'multiple' || filter.showCount)"
36
- mt--3px ml-5px
36
+ class="ml-[5px] flex items-center"
37
37
  :initial="{ width: 0, x: -20, scale: 0, opacity: 0 }"
38
38
  :animate="{ width: 'auto', x: 0, scale: 1, opacity: 1 }"
39
39
  :exit="{ width: 0, x: -20, scale: 0, opacity: 0 }"
40
40
  :transition="{ duration: 0.15, ease: 'easeOut' }"
41
41
  >
42
- <TelaBadge variant="filled" class="py-[1px] px-[4px] rounded-[4px]" text-class="tabular-nums text-[8px]">
42
+ <TelaBadge variant="filled" class="py-[2px] px-[4px] rounded-[4px]">
43
43
  <TelaAnimatedNumber :value="count || 0" />
44
44
  </TelaBadge>
45
45
  </Motion>
@@ -49,7 +49,7 @@ defineEmits<{
49
49
  name="i-ph-caret-down-bold"
50
50
  size="12px"
51
51
  color="icon-secondary"
52
- class="shrink-0 transition-all ease-out duration-150 group-data-[active]:rotate-180"
52
+ class="shrink-0 transition-transform ease-out duration-150 group-data-[active]:rotate-180"
53
53
  />
54
54
  </button>
55
55
  </template>