@meistrari/tela-build 1.92.1 → 1.93.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,8 @@ Latest updates and announcements.
5
5
  ## October 22, 2026
6
6
 
7
7
  - `TelaAnimatedValue` now animates the incoming value: vertical slides in from 10px above with a fade over 100ms, horizontal from `enterOffset` (default 20px) over 200ms. The enter styles used the Vue 2 `.slide-fade-enter` class, which Vue 3 never applies, so the new value used to appear instantly after the old one left. This also reaches the letter change in the [Avatar](/components/avatar#with-initials-fallback) initials fallback (`TelaInitials`) and `TelaAnimatedCalculatingNumber`.
8
+ - [Combobox](/components/combobox#loading) accepts `loading`, which renders the new `loading` slot in place of the options and the empty state, so a list that is still arriving no longer shows "No options found". When `loading` turns off, the options fade in over 150ms, without animation under `prefers-reduced-motion`.
9
+ - [Combobox](/components/combobox#with-badges) renders an option's `badge` as an outlined [Badge](/components/badge) next to its label, after the Multimodal badge, for example to mark a saved value that is no longer in the list.
8
10
 
9
11
  ## October 21, 2026
10
12
 
@@ -18,6 +20,9 @@ Latest updates and announcements.
18
20
 
19
21
  ## October 16, 2026
20
22
 
23
+ - [Combobox](/components/combobox) closes immediately on selection and emits each selection once, avoiding duplicate persistence updates.
24
+ - [Combobox](/components/combobox) exports `ComboboxOption` from `types/combobox` and supports an optional `fallbackLabel` for saved values absent from the options, preserving the legacy first-option fallback when omitted.
25
+ - [Combobox](/components/combobox) adds a `dropdown-status` slot for non-selectable loading/error content inside the dropdown, and emits `update:open` when its open state changes.
21
26
  - [Input](/components/input) drops the `showDescription` prop and `description` slot. Put content on the right of the field with the `trailing` slot.
22
27
  - [Input](/components/input) no longer has a clear button. The `showClearButton` and `clearLabel` props are removed.
23
28
  - [Input](/components/input) no longer renders a label above the value. The `label`, `hideLabel`, and `labelClass` props and the `label-leading` slot are removed.
@@ -153,6 +153,41 @@ const options = [
153
153
  />
154
154
  ```
155
155
 
156
+ ### With Badges
157
+
158
+ `badge` renders an outlined badge next to the option label.
159
+
160
+ ```vue
161
+ <TelaCombobox
162
+ v-model="selected"
163
+ :options="[
164
+ { value: 'gpt-5', label: 'GPT-5', description: 'Advanced reasoning' },
165
+ { value: 'legacy', label: 'legacy', description: 'Saved in this version', badge: 'Not in catalog' }
166
+ ]"
167
+ />
168
+ ```
169
+
170
+ ### Loading
171
+
172
+ While `loading` is set, the list renders the `loading` slot instead of the options and the empty state, so a list that has not arrived yet never reads as "No options found". Put a skeleton shaped like the real rows in the slot, and a status line in `dropdown-status`. When `loading` turns off, the options fade in over 150ms, without animation under `prefers-reduced-motion`.
173
+
174
+ ```vue
175
+ <TelaCombobox v-model="selected" :options="options" :loading="!options.length">
176
+ <template #dropdown-status>
177
+ <div v-if="!options.length" role="status" aria-live="polite" flex items-center gap-8px px-12px py-8px body-12-medium text-secondary>
178
+ <TelaLoadersSquare size="sm" />
179
+ Loading options
180
+ </div>
181
+ </template>
182
+ <template #loading>
183
+ <div aria-hidden="true" flex flex-col gap-8px p-12px>
184
+ <TelaSkeleton class="w-160px h-10px rounded-4px" />
185
+ <TelaSkeleton class="w-120px h-10px rounded-4px" />
186
+ </div>
187
+ </template>
188
+ </TelaCombobox>
189
+ ```
190
+
156
191
  ### Read-Only State
157
192
 
158
193
  ```vue
@@ -246,6 +281,8 @@ type ComboboxProps = {
246
281
  labelIconVisible?: boolean
247
282
  descriptionClass?: string
248
283
  hasSearchbar?: boolean
284
+ /** Renders the `loading` slot instead of the options and the empty state. */
285
+ loading?: boolean
249
286
  /** Label props (i18n). Pass strings for all UI labels so the component stays i18n-agnostic. In the application, use `useComboboxLabels()` from `~/composables/combobox-labels`. */
250
287
  labelSelect?: string
251
288
  labelTabAll?: string
@@ -305,6 +342,8 @@ Example with explicit labels:
305
342
  ## Slots
306
343
 
307
344
  - `tags` - Custom tags/badges for each option (receives `option` as slot prop)
345
+ - `dropdown-status` - Non-selectable status content below the search field, such as loading or error messages
346
+ - `loading` - Placeholder content shown in place of the options and the empty state while `loading` is set
308
347
 
309
348
  ## Components
310
349
 
@@ -0,0 +1,95 @@
1
+ // @vitest-environment happy-dom
2
+ import { mount } from '@vue/test-utils'
3
+ import { computed, defineComponent, nextTick, ref, useId, watch } from 'vue'
4
+ import { expect, it, vi } from 'vitest'
5
+ import Combobox from './combobox.vue'
6
+
7
+ vi.stubGlobal('computed', computed)
8
+ vi.stubGlobal('ref', ref)
9
+ vi.stubGlobal('watch', watch)
10
+ vi.stubGlobal('nextTick', nextTick)
11
+ vi.stubGlobal('useId', useId)
12
+ vi.stubGlobal('useTelaLabels', () => ({}))
13
+ vi.stubGlobal('cn', (...values: unknown[]) => values.filter(Boolean).join(' '))
14
+ const Container = defineComponent({ template: '<div><slot /></div>' })
15
+ const Root = defineComponent({ name: 'Root', props: ['open', 'disabled'], emits: ['update:open'], template: '<div><button :disabled="disabled" @click="$emit(\'update:open\', !open)">Toggle</button><slot v-if="open" /></div>' })
16
+ it('opens without changing selection and renders dropdown status through the native list', async () => {
17
+ const wrapper = mount(Combobox, {
18
+ props: { options: [{ value: 'historic', label: 'Historic' }], modelValue: 'historic' },
19
+ slots: { 'dropdown-status': '<div role="status">Loading models</div>' },
20
+ global: { mocks: { cn: (...values: unknown[]) => values.filter(Boolean).join(' ') }, stubs: { TelaComboboxRoot: Root, TelaComboboxAnchor: Container, TelaComboboxTrigger: Container, TelaComboboxList: Container, TelaScrollArea: Container, TelaComboboxGroup: Container, TelaComboboxItem: Container, TelaComboboxItemIndicator: true, TelaComboboxInput: true, TelaIcon: true } },
21
+ })
22
+ await wrapper.get('button').trigger('click')
23
+ expect(wrapper.get('[role="status"]').text()).toBe('Loading models')
24
+ expect(wrapper.emitted('update:open')).toEqual([[true]])
25
+ expect(wrapper.emitted('update:modelValue')).toBeUndefined()
26
+ await wrapper.get('button').trigger('click')
27
+ expect(wrapper.emitted('update:open')).toEqual([[true], [false]])
28
+ wrapper.unmount()
29
+ })
30
+
31
+ it.each([
32
+ ['historic', 'Saved model', 'Saved model'],
33
+ ['historic', undefined, 'First'],
34
+ ['', 'Saved model', 'Choose'],
35
+ ['first', 'Saved model', 'First'],
36
+ ])('trigger resolves %s with fallback %s', (modelValue, fallbackLabel, expected) => {
37
+ const wrapper = mount(Combobox, {
38
+ props: { options: [{ value: 'first', label: 'First' }], modelValue, fallbackLabel, placeholder: 'Choose' },
39
+ global: { mocks: { cn: () => '' }, stubs: { TelaComboboxRoot: Container, TelaComboboxAnchor: Container, TelaComboboxTrigger: Container, TelaComboboxList: true, TelaIcon: true } },
40
+ })
41
+
42
+ expect(wrapper.text()).toContain(expected)
43
+ expect(wrapper.emitted('update:modelValue')).toBeUndefined()
44
+ wrapper.unmount()
45
+ })
46
+
47
+ it('closes and emits one selection while the controlled value is still pending', async () => {
48
+ const SelectingRoot = defineComponent({
49
+ props: ['open', 'modelValue'],
50
+ emits: ['update:open', 'update:modelValue'],
51
+ template: '<div><button @click="$emit(\'update:open\', true)">Open</button><button v-if="open" @click="$emit(\'update:modelValue\', \'second\')">Choose second</button><slot /></div>',
52
+ })
53
+ const wrapper = mount(Combobox, {
54
+ props: { options: [{ value: 'first', label: 'First' }, { value: 'second', label: 'Second' }], modelValue: 'first' },
55
+ global: { mocks: { cn: () => '' }, stubs: { TelaComboboxRoot: SelectingRoot, TelaComboboxAnchor: Container, TelaComboboxTrigger: Container, TelaComboboxList: true, TelaIcon: true } },
56
+ })
57
+ await wrapper.get('button').trigger('click')
58
+
59
+ await wrapper.get('button:nth-child(2)').trigger('click')
60
+
61
+ expect(wrapper.findComponent(SelectingRoot).props('open')).toBe(false)
62
+ expect(wrapper.emitted('update:modelValue')).toEqual([['second']])
63
+ expect(wrapper.emitted('select')).toEqual([['second']])
64
+ wrapper.unmount()
65
+ })
66
+
67
+ it('renders an option badge next to its label', async () => {
68
+ const wrapper = mount(Combobox, {
69
+ props: { options: [{ value: 'legacy', label: 'legacy', description: 'Saved in this version', badge: 'Not in catalog' }, { value: 'plain', label: 'plain' }] },
70
+ global: { mocks: { cn: (...values: unknown[]) => values.filter(Boolean).join(' ') }, stubs: { TelaComboboxRoot: Root, TelaComboboxAnchor: Container, TelaComboboxTrigger: Container, TelaComboboxList: Container, TelaComboboxGroup: Container, TelaComboboxLabel: Container, TelaComboboxItem: { props: ['value'], template: '<div data-item :data-value="value.value"><slot /></div>' }, TelaComboboxIndicator: true, TelaComboboxInput: true, TelaBadge: { template: '<span data-badge><slot /></span>' }, TelaIcon: true } },
71
+ })
72
+ await wrapper.get('button').trigger('click')
73
+
74
+ expect(wrapper.get('[data-value="legacy"] [data-badge]').text()).toBe('Not in catalog')
75
+ expect(wrapper.find('[data-value="plain"] [data-badge]').exists()).toBe(false)
76
+ wrapper.unmount()
77
+ })
78
+
79
+ it('replaces the options and the empty state with the loading slot while loading', async () => {
80
+ const wrapper = mount(Combobox, {
81
+ props: { options: [], loading: true },
82
+ slots: { loading: '<div data-loading>Skeleton</div>' },
83
+ global: { mocks: { cn: (...values: unknown[]) => values.filter(Boolean).join(' ') }, stubs: { TelaComboboxRoot: Root, TelaComboboxAnchor: Container, TelaComboboxTrigger: Container, TelaComboboxList: Container, TelaComboboxGroup: Container, TelaComboboxLabel: Container, TelaComboboxItem: { props: ['value'], template: '<div data-item :data-value="value.value"><slot /></div>' }, TelaComboboxIndicator: true, TelaComboboxInput: true, TelaComboboxEmpty: { template: '<div data-empty><slot /></div>' }, TelaButton: true, TelaIcon: true } },
84
+ })
85
+ await wrapper.get('button').trigger('click')
86
+
87
+ expect(wrapper.find('[data-loading]').exists()).toBe(true)
88
+ expect(wrapper.find('[data-empty]').exists()).toBe(false)
89
+
90
+ await wrapper.setProps({ options: [{ value: 'listed', label: 'Listed' }], loading: false })
91
+
92
+ expect(wrapper.find('[data-loading]').exists()).toBe(false)
93
+ expect(wrapper.find('[data-value="listed"]').exists()).toBe(true)
94
+ wrapper.unmount()
95
+ })
@@ -1,30 +1,14 @@
1
1
  <script setup lang="ts">
2
- import type { Component, ComponentPublicInstance, Ref } from 'vue'
2
+ import type { ComponentPublicInstance, Ref } from 'vue'
3
3
  import { useEventListener, useMagicKeys } from '@vueuse/core'
4
4
 
5
- interface ComboboxOption {
6
- value: string
7
- label: string
8
- description?: string
9
- icon?: string | Component
10
- externalIconSrc?: string
11
- maxInputTokens?: number
12
- maxOutputTokens?: number
13
- group?: string
14
- badge?: string
15
- tabs?: string[]
16
- to?: string
17
- isMultiModal?: boolean
18
- features?: Array<{ text: string }>
19
- cost?: number
20
- children?: ComboboxOption[]
21
- triggerLabel?: string
22
- }
5
+ import type { ComboboxOption } from '../../../types/combobox'
23
6
 
24
7
  type ComboboxOptions = ComboboxOption[]
25
8
 
26
9
  const props = withDefaults(defineProps<{
27
10
  modelValue?: string
11
+ fallbackLabel?: string
28
12
  placeholder?: string
29
13
  inputPlaceholder?: string
30
14
  options: ComboboxOptions
@@ -68,6 +52,7 @@ const props = withDefaults(defineProps<{
68
52
  labelCreateDescription?: string
69
53
  labelCreateWithSearch?: (search: string) => string
70
54
  labelCreatePlaceholder?: string
55
+ loading?: boolean
71
56
  }>(), {
72
57
  compact: true,
73
58
  align: 'start',
@@ -95,10 +80,12 @@ const props = withDefaults(defineProps<{
95
80
  allowCreate: false,
96
81
  labelCreate: 'Create new',
97
82
  labelCreatePlaceholder: 'Name',
83
+ loading: false,
98
84
  })
99
85
 
100
86
  const emit = defineEmits<{
101
87
  'update:modelValue': [value: string]
88
+ 'update:open': [open: boolean]
102
89
  'select': [value: string]
103
90
  'create': [search: string]
104
91
  }>()
@@ -110,11 +97,12 @@ const selectedTab = ref('all')
110
97
  const search = ref('')
111
98
  const innerValue = ref<string>('')
112
99
  const isOpen = ref(false)
100
+ watch(isOpen, open => emit('update:open', open))
113
101
  const isCreating = ref(false)
114
102
  const createName = ref('')
115
103
  const createInputEl = ref<HTMLInputElement>()
116
104
 
117
- const currentOption = computed(() => {
105
+ const currentOption = computed<ComboboxOption>(() => {
118
106
  if (!innerValue.value && !props.modelValue && props.placeholder) {
119
107
  return { label: props.placeholder, value: '' }
120
108
  }
@@ -133,6 +121,9 @@ const currentOption = computed(() => {
133
121
  }
134
122
  }
135
123
 
124
+ if (value && props.fallbackLabel !== undefined)
125
+ return { value, label: props.fallbackLabel }
126
+
136
127
  return props.options[0] ?? { label: props.placeholder || props.labelSelect, value: '' }
137
128
  })
138
129
 
@@ -165,6 +156,9 @@ const hasGroups = computed(() => props.options.some(option => option.group))
165
156
  const hasTabs = computed(() => props.options.some(option => option.tabs && option.tabs.length > 0))
166
157
 
167
158
  const groupedOptions = computed(() => {
159
+ if (props.loading)
160
+ return []
161
+
168
162
  let filteredOptions = props.options
169
163
 
170
164
  if (selectedTab.value !== 'all') {
@@ -400,29 +394,15 @@ function handleSelect(option: any) {
400
394
  const found = props.options.find(o => o.value === value)
401
395
  if (found?.children?.length)
402
396
  return
397
+ innerValue.value = ''
398
+ onOpenChange(false)
403
399
  emit('select', value)
404
400
  emit('update:modelValue', value)
405
401
  }
406
402
 
407
- watch(innerValue, (raw) => {
408
- if (!raw)
409
- return
410
-
411
- const value = typeof raw === 'string' ? raw : (raw as any)?.value
412
- if (!value || value === createOptionValue)
413
- return
414
-
415
- const option = props.options.find(o => o.value === value)
416
- if (!option)
417
- return
418
-
419
- if (option.children?.length)
420
- return
421
-
422
- innerValue.value = ''
423
-
424
- emit('select', value)
425
- emit('update:modelValue', value)
403
+ const revealOptions = ref(false)
404
+ watch(() => props.loading, (loading, wasLoading) => {
405
+ revealOptions.value = !loading && wasLoading
426
406
  })
427
407
 
428
408
  const labels = useTelaLabels()
@@ -478,6 +458,7 @@ const labels = useTelaLabels()
478
458
  />
479
459
  </template>
480
460
  </TelaComboboxInput>
461
+ <slot name="dropdown-status" />
481
462
  <TelaTabsRoot v-if="hasTabs" v-model="selectedTab">
482
463
  <TelaTabsList class="sticky z-10 top-0 shrink-0 flex gap-2 w-full">
483
464
  <TelaTabsIndicator />
@@ -538,8 +519,9 @@ const labels = useTelaLabels()
538
519
  </div>
539
520
  </TelaComboboxItem>
540
521
  </div>
522
+ <slot v-if="loading" name="loading" />
541
523
  <TelaComboboxEmpty
542
- v-if="isEmpty && !showCreateOption && !isCreating"
524
+ v-else-if="isEmpty && !showCreateOption && !isCreating"
543
525
  class="flex flex-col items-center justify-center gap-5 px-7"
544
526
  >
545
527
  <div class="flex flex-col items-center justify-center gap-3">
@@ -568,7 +550,7 @@ const labels = useTelaLabels()
568
550
  </TelaButton>
569
551
  </TelaComboboxEmpty>
570
552
  <template v-for="group in groupedOptions" :key="group.heading">
571
- <TelaComboboxGroup :heading="group.heading">
553
+ <TelaComboboxGroup :heading="group.heading" :class="revealOptions && 'combobox-reveal'">
572
554
  <TelaComboboxLabel v-if="!search.trim() && hasGroupingLabels">
573
555
  {{ group.heading }}
574
556
  </TelaComboboxLabel>
@@ -602,6 +584,9 @@ const labels = useTelaLabels()
602
584
  <TelaBadge v-if="item.isMultiModal" variant="filled" class="py-[2px] bg-muted" text-class="leading-none">
603
585
  {{ labelMultimodal }}
604
586
  </TelaBadge>
587
+ <TelaBadge v-if="item.badge" text-class="leading-none">
588
+ {{ item.badge }}
589
+ </TelaBadge>
605
590
  <span v-if="item.cost !== undefined" class="text-10px font-540 ml-1px">
606
591
  <span class="text-primary">{{ renderCostIndicator(item.cost)?.blackSymbols }}</span>
607
592
  <span class="text-neutral-300">{{ renderCostIndicator(item.cost)?.graySymbols }}</span>
@@ -690,4 +675,24 @@ const labels = useTelaLabels()
690
675
  .nuxt-icon {
691
676
  margin-bottom: 0;
692
677
  }
678
+
679
+ .combobox-reveal {
680
+ animation: combobox-reveal 150ms cubic-bezier(0.23, 1, 0.32, 1);
681
+ }
682
+
683
+ @keyframes combobox-reveal {
684
+ from {
685
+ opacity: 0;
686
+ }
687
+
688
+ to {
689
+ opacity: 1;
690
+ }
691
+ }
692
+
693
+ @media (prefers-reduced-motion: reduce) {
694
+ .combobox-reveal {
695
+ animation: none;
696
+ }
697
+ }
693
698
  </style>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meistrari/tela-build",
3
- "version": "1.92.1",
3
+ "version": "1.93.1",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "app.config.ts",
@@ -86,6 +86,6 @@
86
86
  "vue-tsc": "3.3.11",
87
87
  "@vitejs/plugin-vue": "6.0.8",
88
88
  "happy-dom": "20.14.0",
89
- "vite": "8.2.2"
89
+ "vite": "8.2.4"
90
90
  }
91
91
  }
@@ -0,0 +1,20 @@
1
+ import type { Component } from 'vue'
2
+
3
+ export interface ComboboxOption {
4
+ value: string
5
+ label: string
6
+ description?: string
7
+ icon?: string | Component
8
+ externalIconSrc?: string
9
+ maxInputTokens?: number
10
+ maxOutputTokens?: number
11
+ group?: string
12
+ badge?: string
13
+ tabs?: string[]
14
+ to?: string
15
+ isMultiModal?: boolean
16
+ features?: Array<{ text: string }>
17
+ cost?: number
18
+ children?: ComboboxOption[]
19
+ triggerLabel?: string
20
+ }
package/types/index.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from './chat-answer'
2
2
  export * from './chat-task-review'
3
+ export * from './combobox'
3
4
  export * from './custom-icon'
4
5
  export * from './status'