@meistrari/tela-build 2.0.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.
- package/CHANGELOG.md +5 -0
- package/components/tela/chat/chat.mdx +113 -0
- package/components/tela/chat/usage/usage-meter.vue +80 -0
- package/components/tela/chat/usage/usage-popover.vue +77 -0
- package/components/tela/progress-bar/progress-bar.mdx +6 -2
- package/components/tela/progress-bar/progress-bar.vue +2 -1
- package/css/animations.css +20 -0
- package/package.json +1 -1
- package/types/chat-usage.ts +14 -0
- package/types/index.ts +1 -0
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.
|
|
@@ -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>
|
|
@@ -68,7 +68,11 @@ The indicator color defaults to `variant="auto"`, deriving from the fill %. Pass
|
|
|
68
68
|
<TelaProgressBar :model-value="90" variant="red" /> <!-- forced red, regardless of fill -->
|
|
69
69
|
```
|
|
70
70
|
|
|
71
|
-
`variant` accepts `'auto' | 'green' | 'yellow' | 'red'`.
|
|
71
|
+
`variant` accepts `'auto' | 'green' | 'yellow' | 'red' | 'blue'`. `blue` is never picked by `auto`; use it for neutral quotas where the fill is neither good nor bad, like the chat usage popover's monthly limit:
|
|
72
|
+
|
|
73
|
+
```vue
|
|
74
|
+
<TelaProgressBar :model-value="32" variant="blue" />
|
|
75
|
+
```
|
|
72
76
|
|
|
73
77
|
### Auto thresholds
|
|
74
78
|
|
|
@@ -99,7 +103,7 @@ import type { HTMLAttributes } from 'vue'
|
|
|
99
103
|
|
|
100
104
|
type TelaProgressBarProps = ProgressRootProps & {
|
|
101
105
|
class?: HTMLAttributes['class']
|
|
102
|
-
variant?: 'auto' | 'green' | 'yellow' | 'red' // indicator color — defaults to 'auto'
|
|
106
|
+
variant?: 'auto' | 'green' | 'yellow' | 'red' | 'blue' // indicator color — defaults to 'auto'
|
|
103
107
|
greenThreshold?: number // auto: fill % for green — defaults to 67
|
|
104
108
|
yellowThreshold?: number // auto: fill % for yellow — defaults to 34
|
|
105
109
|
}
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
ProgressRoot,
|
|
8
8
|
} from 'reka-ui'
|
|
9
9
|
|
|
10
|
-
type ProgressColor = 'green' | 'yellow' | 'red'
|
|
10
|
+
type ProgressColor = 'green' | 'yellow' | 'red' | 'blue'
|
|
11
11
|
type ProgressVariant = ProgressColor | 'auto'
|
|
12
12
|
|
|
13
13
|
const props = withDefaults(
|
|
@@ -31,6 +31,7 @@ const colorClass: Record<ProgressColor, string> = {
|
|
|
31
31
|
green: 'bg-green-400',
|
|
32
32
|
yellow: 'bg-amber-400',
|
|
33
33
|
red: 'bg-red-400',
|
|
34
|
+
blue: 'bg-sky-500',
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
const progress = computed(() => {
|
package/css/animations.css
CHANGED
|
@@ -64,3 +64,23 @@
|
|
|
64
64
|
opacity: 0;
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
|
+
|
|
68
|
+
/*
|
|
69
|
+
* TelaChatUsageMeter's ring while a new usage value is on its way. Same rhythm
|
|
70
|
+
* as TelaSkeleton's pulse, so the last value stays readable underneath.
|
|
71
|
+
*/
|
|
72
|
+
@keyframes usageCalculating {
|
|
73
|
+
0%,
|
|
74
|
+
22.73% {
|
|
75
|
+
opacity: 1;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
50%,
|
|
79
|
+
77.27% {
|
|
80
|
+
opacity: 0.55;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
100% {
|
|
84
|
+
opacity: 1;
|
|
85
|
+
}
|
|
86
|
+
}
|
package/package.json
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type TelaChatUsageState = 'normal' | 'warning' | 'limit' | 'additional'
|
|
2
|
+
|
|
3
|
+
export interface TelaChatUsageLabels {
|
|
4
|
+
trigger: (value: string) => string
|
|
5
|
+
title: string
|
|
6
|
+
renewsIn: (days: number) => string
|
|
7
|
+
monthlyLimit: string
|
|
8
|
+
warning: (remaining: number) => string
|
|
9
|
+
limit: string
|
|
10
|
+
activate: string
|
|
11
|
+
dismiss: string
|
|
12
|
+
additional: string
|
|
13
|
+
calculating: string
|
|
14
|
+
}
|