@meistrari/tela-build 1.88.0 → 1.89.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
@@ -4,12 +4,17 @@ Latest updates and announcements.
4
4
 
5
5
  ## October 16, 2026
6
6
 
7
+ - [Input](/components/input) drops the `showDescription` prop and `description` slot. Put content on the right of the field with the `trailing` slot.
8
+ - [Input](/components/input) no longer has a clear button. The `showClearButton` and `clearLabel` props are removed.
9
+ - [Input](/components/input) no longer renders a label above the value. The `label`, `hideLabel`, and `labelClass` props and the `label-leading` slot are removed.
10
+ - [Input](/components/input#with-error) shows `error` as a warning icon on the right of the field, with the message in a tooltip that opens on hover and while the field has focus, instead of a line of text under the field. Screen readers announce the message through `aria-description`, and the input sets `aria-invalid`.
7
11
  - [Video Player](/components/video-player#exposed-methods) exposes `seekTo(seconds)` and `play()` through a template ref, so outside controls like a chapter list can jump to a moment and start playback. It also emits `timeupdate` with the current time in seconds, so those controls can follow along as the video plays.
8
12
  - [Video Player](/components/video-player) corners no longer show a dark fringe: the black backdrop only appears in fullscreen, and the border is a softer 0.5px `black/8` instead of `rgba(0, 0, 0, 0.65)`.
9
13
  - [Video Player](/components/video-player) playback speed always shows a decimal: `1.0×` and `2.0×` instead of `1×` and `2×`, matching `1.25×` and `1.5×`.
10
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.
11
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.
12
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.
13
18
 
14
19
  ## October 15, 2026
15
20
 
@@ -5,12 +5,13 @@ import * as InputStories from './input.stories.ts';
5
5
 
6
6
  # TelaInput
7
7
 
8
- A flexible input component that supports both text input and textarea modes. Includes features like labels, error states, icons, clear buttons, and validation feedback. Supports v-model binding for two-way data binding.
8
+ A flexible input component that supports both text input and textarea modes. Includes features like error states, icons, and validation feedback. Supports v-model binding for two-way data binding.
9
9
 
10
10
  ## Rules
11
11
 
12
12
  - **Always** use `size="md"` (default). When a `TelaInput` sits next to a `TelaButton` in the same row, both must be `md` — never mix sizes, it creates misaligned rows.
13
13
  - Inside a `TelaModal`, the input must be `w-full`.
14
+ - **Always** pass a validation error through the `error` prop whenever the field has one. Never render your own error text or icon next to the input; `error` shows the warning icon and tooltip, turns the field red, and links the message to the input for screen readers.
14
15
 
15
16
  ### Search
16
17
 
@@ -18,19 +19,15 @@ Search fields **never** have a submit button. Use an inline `TelaInput` that fil
18
19
 
19
20
  ```vue
20
21
  <!-- Correct -->
21
- <TelaInput v-model="query" placeholder="Search..." hide-label />
22
+ <TelaInput v-model="query" placeholder="Search..." />
22
23
 
23
24
  <!-- Wrong — no submit button next to a search input -->
24
- <TelaInput v-model="query" placeholder="Search..." hide-label />
25
+ <TelaInput v-model="query" placeholder="Search..." />
25
26
  <TelaButton>Search</TelaButton>
26
27
  ```
27
28
 
28
29
  ## Examples
29
30
 
30
- ### With Clear Button
31
-
32
- <Canvas of={InputStories.ClearButton} />
33
-
34
31
  ### With Icon
35
32
 
36
33
  <Canvas of={InputStories.WithIcon} />
@@ -64,23 +61,11 @@ const value = ref('')
64
61
  </template>
65
62
  ```
66
63
 
67
- ### With Clear Button Code
68
-
69
- ```vue
70
- <TelaInput
71
- v-model="value"
72
- placeholder="you@example.com"
73
- show-clear-button
74
- clear-label="Clear"
75
- />
76
- ```
77
-
78
64
  ### With Icon Code
79
65
 
80
66
  ```vue
81
67
  <TelaInput
82
68
  v-model="searchQuery"
83
- label="Search"
84
69
  icon="i-ph-magnifying-glass"
85
70
  placeholder="Search..."
86
71
  />
@@ -88,9 +73,11 @@ const value = ref('')
88
73
 
89
74
  ### With Error Code
90
75
 
76
+ `error` turns the field red and puts a warning icon on the right. The message shows in a tooltip when you hover the icon or focus the field, and screen readers announce it with the input.
77
+
91
78
  ```vue
92
79
  <TelaInput
93
- v-model="email"
80
+ model-value="gustavo@"
94
81
  placeholder="you@example.com"
95
82
  error="Please enter a valid email address"
96
83
  />
@@ -119,7 +106,6 @@ const value = ref('')
119
106
  ```vue
120
107
  <TelaInput
121
108
  v-model="value"
122
- label-class="text-blue-600 font-bold"
123
109
  input-class="border-blue-400"
124
110
  />
125
111
  ```
@@ -142,22 +128,16 @@ const value = ref('')
142
128
  type InputProps = {
143
129
  id?: string
144
130
  modelValue?: string | number
145
- label?: string
146
131
  placeholder?: string
147
- hideLabel?: boolean
148
132
  disabled?: boolean
149
133
  error?: string | false
150
- showClearButton?: boolean
151
- clearLabel?: string // overrides the shared useTelaLabels().clear label (English fallback: 'Clear')
152
134
  tabindex?: number
153
135
  autofocus?: boolean
154
136
  autocomplete?: 'on' | 'off'
155
137
  type?: string
156
- labelClass?: string
157
138
  inputFontClass?: string
158
139
  inputClass?: string
159
140
  icon?: string
160
- showDescription?: boolean
161
141
  maxlength?: number
162
142
  }
163
143
  ```
@@ -165,21 +145,17 @@ type InputProps = {
165
145
  ## Features
166
146
 
167
147
  - **Flexible Input Types**: Supports text, email, password, number, textarea, and more
168
- - **Label Support**: Built-in label with hide option for accessibility
169
- - **Error Handling**: Display validation errors with styling
148
+ - **Error Handling**: Validation errors as a warning icon with the message in a tooltip
170
149
  - **Icon Integration**: Add icons inside the input field
171
- - **Clear Button**: Quick clear functionality with a host-provided accessible tooltip label
172
150
  - **Auto-focus**: Automatically focus on mount
173
151
  - **Disabled State**: Proper disabled styling and behavior
174
152
  - **Character Limit**: Maxlength support with counter
175
- - **Custom Classes**: Granular control over label, input, and font styling
153
+ - **Custom Classes**: Granular control over input and font styling
176
154
  - **Two-way Binding**: Full v-model support
177
155
  - **Textarea Mode**: Multi-line input support
178
156
 
179
157
  ## Accessibility
180
158
 
181
- - Proper label-input association with `for` and `id` attributes
182
- - Hidden label option maintains accessibility
183
159
  - Error messages properly associated with input
184
160
  - Keyboard navigation support
185
161
  - Focus visible states
@@ -0,0 +1,56 @@
1
+ // @vitest-environment happy-dom
2
+ import { computed, nextTick, onBeforeUnmount, onMounted, ref, useTemplateRef, watch } from 'vue'
3
+ import { mount } from '@vue/test-utils'
4
+ import { describe, expect, it, vi } from 'vitest'
5
+ import Input from './input.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('onMounted', onMounted)
12
+ vi.stubGlobal('onBeforeUnmount', onBeforeUnmount)
13
+ vi.stubGlobal('useTemplateRef', useTemplateRef)
14
+ vi.stubGlobal('useTextareaAutosize', () => ({ textarea: ref(), input: ref('') }))
15
+ vi.stubGlobal('useElementBounding', () => ({ width: ref(0) }))
16
+ vi.stubGlobal('useResizeObserver', () => {})
17
+
18
+ const stubs = {
19
+ TelaIcon: true,
20
+ TelaTooltip: { template: '<div><slot /></div>' },
21
+ }
22
+
23
+ describe('telaInput error', () => {
24
+ it('shows a warning icon with the message in a tooltip', () => {
25
+ const wrapper = mount(Input, { props: { modelValue: 'luiz@', error: 'Enter a valid email' }, global: { stubs: { ...stubs, TelaTooltip: { props: ['content'], template: '<div data-tooltip :data-content="content"><slot /></div>' } } } })
26
+
27
+ expect(wrapper.get('[data-tooltip]').attributes('data-content')).toBe('Enter a valid email')
28
+ })
29
+
30
+ it('marks the input invalid and describes it with the message', () => {
31
+ const wrapper = mount(Input, { props: { modelValue: 'luiz@', error: 'Enter a valid email' }, global: { stubs } })
32
+
33
+ const input = wrapper.get('input')
34
+ expect(input.attributes('aria-invalid')).toBe('true')
35
+ expect(input.attributes('aria-description')).toBe('Enter a valid email')
36
+ })
37
+
38
+ it('opens the error tooltip while the input has focus', async () => {
39
+ const wrapper = mount(Input, { props: { modelValue: 'luiz@', error: 'Enter a valid email' }, global: { stubs: { ...stubs, TelaTooltip: { props: ['open'], template: '<div data-tooltip :data-open="String(open)"><slot /></div>' } } } })
40
+
41
+ const tooltip = () => wrapper.get('[data-tooltip]').attributes('data-open')
42
+ expect(tooltip()).toBe('undefined')
43
+ await wrapper.get('input').trigger('focus')
44
+ expect(tooltip()).toBe('true')
45
+ await wrapper.get('input').trigger('blur')
46
+ expect(tooltip()).toBe('undefined')
47
+ })
48
+
49
+ it('adds no aria wiring without an error', () => {
50
+ const wrapper = mount(Input, { props: { modelValue: '' }, global: { stubs } })
51
+
52
+ const input = wrapper.get('input')
53
+ expect(input.attributes('aria-invalid')).toBeUndefined()
54
+ expect(input.attributes('aria-description')).toBeUndefined()
55
+ })
56
+ })
@@ -4,25 +4,18 @@ import type { InputTypeHTMLAttribute } from 'vue'
4
4
  const props = withDefaults(defineProps<{
5
5
  id?: string
6
6
  modelValue: string | number | undefined
7
- label?: string
8
7
  placeholder?: string
9
- hideLabel?: boolean
10
8
  disabled?: boolean
11
9
  error?: string | false
12
- showClearButton?: boolean
13
- clearLabel?: string
14
10
  tabindex?: number
15
11
  autofocus?: boolean
16
12
  autocomplete?: 'off' | 'on'
17
13
  type?: InputTypeHTMLAttribute | 'textarea'
18
14
  variant?: 'default' | 'ghost'
19
- labelClass?: string
20
15
  inputFontClass?: string
21
16
  inputClass?: string
22
17
  icon?: string
23
- showDescription?: boolean
24
18
  maxlength?: number
25
- /** @deprecated TelaInput has a single size — omit this prop. */
26
19
  size?: 'sm' | 'md'
27
20
  }>(), {
28
21
  variant: 'default',
@@ -34,9 +27,6 @@ const emit = defineEmits<{
34
27
  'blur': [string]
35
28
  }>()
36
29
 
37
- const labels = useTelaLabels()
38
- const resolvedClearLabel = computed(() => props.clearLabel ?? labels.value.clear)
39
-
40
30
  const isTextarea = computed(() => props.type === 'textarea')
41
31
  const attributes = computed(() => ({
42
32
  type: isTextarea.value ? undefined : props.type,
@@ -52,17 +42,22 @@ function handleInput(data: Event | string) {
52
42
  emit('update:modelValue', ((data as Event).target as HTMLInputElement).value)
53
43
  }
54
44
 
45
+ const isFocused = ref(false)
46
+
47
+ function handleFocus() {
48
+ isFocused.value = true
49
+ emit('focus')
50
+ }
51
+
55
52
  function handleBlur(data: Event | string) {
53
+ isFocused.value = false
54
+
56
55
  if (isTextarea.value)
57
56
  emit('blur', data as string)
58
57
  else
59
58
  emit('blur', ((data as Event).target as HTMLInputElement).value)
60
59
  }
61
60
 
62
- function clearContent() {
63
- emit('update:modelValue', '')
64
- }
65
-
66
61
  const container = ref<HTMLElement>()
67
62
  const { textarea: inputRef, input: textareaInput } = useTextareaAutosize({ styleProp: 'minHeight' })
68
63
 
@@ -96,33 +91,6 @@ onMounted(() => {
96
91
  const trailingContent = useTemplateRef('trailing-content')
97
92
  const { width: trailingWidth } = useElementBounding(trailingContent)
98
93
 
99
- const errorContainerRef = ref<HTMLElement>()
100
- const isErrorTruncated = ref(false)
101
-
102
- function checkTruncation() {
103
- if (!errorContainerRef.value)
104
- return
105
-
106
- const span = errorContainerRef.value.querySelector('span')
107
- if (span) {
108
- isErrorTruncated.value = span.scrollWidth > span.clientWidth
109
- }
110
- }
111
-
112
- watch(() => props.error, async () => {
113
- if (props.error) {
114
- await nextTick()
115
- checkTruncation()
116
- }
117
- else {
118
- isErrorTruncated.value = false
119
- }
120
- }, { immediate: true })
121
-
122
- useResizeObserver(errorContainerRef, () => {
123
- checkTruncation()
124
- })
125
-
126
94
  defineExpose({
127
95
  focusInput,
128
96
  })
@@ -138,9 +106,9 @@ defineExpose({
138
106
  px-10px py-4px
139
107
  rounded-10px bg-white
140
108
  :class="[
141
- props.variant === 'default' && 'border-0.5px border [box-shadow:0_1px_4px_0_rgba(103,127,148,0.03)] focus-within-border-strong focus-within-ring-2 focus-within-ring-gray-100',
142
- disabled && '!bg-gray-50 cursor-not-allowed color-gray-600',
143
- error && '!border-red-900 !text-red-900 !bg-[#FFDBDB66]',
109
+ props.variant === 'default' && 'border-0.5px border [box-shadow:0_1px_4px_0_rgba(103,127,148,0.03)] focus-within-border-strong focus-within-ring-1.5 focus-within-ring-border-subtle',
110
+ disabled && '!bg-subtle cursor-not-allowed text-secondary',
111
+ error && '!border-red-800 !text-red-900 !bg-red-100 focus-within-ring-red-200',
144
112
  props.inputClass,
145
113
  $attrs.class,
146
114
  ]"
@@ -156,15 +124,6 @@ defineExpose({
156
124
  marginRight: `${trailingWidth - 0}px`,
157
125
  }"
158
126
  >
159
- <label
160
- v-if="label"
161
- :for="id"
162
- body-12-semibold text-tertiary flex align-center
163
- :class="[disabled && 'cursor-not-allowed', props.labelClass]"
164
- >
165
- <slot name="label-leading" />
166
- {{ label }}
167
- </label>
168
127
  <component
169
128
  :is="isTextarea ? 'textarea' : 'input'"
170
129
  :id="id"
@@ -182,10 +141,12 @@ defineExpose({
182
141
  z-0
183
142
  h-full
184
143
  body-14-regular
185
- class="placeholder-text-tertiary focus-visible:outline-none!"
144
+ class="placeholder-text-tertiary caret-icon-tertiary aria-[invalid=true]:placeholder:text-red-900/60 aria-[invalid=true]:caret-red-800 focus-visible:outline-none!"
186
145
  resize-none
187
146
  :disabled="disabled"
188
147
  :tabindex="tabindex"
148
+ :aria-description="error || undefined"
149
+ :aria-invalid="error ? true : undefined"
189
150
  :class="[
190
151
  disabled && 'cursor-not-allowed',
191
152
  props.inputFontClass ? props.inputFontClass : 'text-14px',
@@ -194,55 +155,30 @@ defineExpose({
194
155
  @input="handleInput"
195
156
  @update:model-value="handleInput"
196
157
  @blur="handleBlur"
197
- @focus="emit('focus')"
158
+ @focus="handleFocus"
198
159
  />
199
160
  </div>
200
161
 
201
- <div v-if="!showClearButton" ref="trailing-content" absolute top-0 right-0 :bg="error ? '' : 'bg-inherit'" h-full flex="~ col" px-8px>
202
- <div flex-auto />
203
- <slot name="trailing" />
162
+ <div v-if="$slots.trailing || error" ref="trailing-content" absolute top-0 right-0 :class="!error && 'bg-inherit'" h-full flex="~ col" px-8px>
204
163
  <div flex-auto />
205
- </div>
206
-
207
- <div v-if="showDescription" class="body-12-regular text-gray-500">
208
- <slot name="description" />
209
- </div>
210
164
 
211
- <div v-if="showClearButton && modelValue" class="top-60% -translate-y-60%" right-1 absolute>
212
- <TelaTooltip
213
- :content="resolvedClearLabel"
214
- >
215
- <button
216
- hover:bg="#EBEFF199"
217
- transition
218
- p-4px rounded-full
219
- class="group"
220
- tabindex="-1"
221
- type="button"
222
- :aria-label="resolvedClearLabel"
223
- @click="clearContent"
165
+ <div class="flex items-center gap-6px">
166
+ <div class="flex flex-col">
167
+ <slot name="trailing" />
168
+ </div>
169
+ <TelaTooltip
170
+ v-if="error"
171
+ :content="error"
172
+ :open="isFocused || undefined"
173
+ trigger-class="cursor-help"
174
+ content-class="max-w-300px break-words z-999"
224
175
  >
225
- <TelaIcon name="i-ph-x-circle-light" text="#031E22" op-40 group-hover:op-100 transition />
226
- </button>
227
- </TelaTooltip>
176
+ <TelaIcon name="i-ph-warning-bold" size="16px" color="red-900" />
177
+ </TelaTooltip>
178
+ </div>
179
+
180
+ <div flex-auto />
228
181
  </div>
229
182
  </div>
230
- <TelaTooltip
231
- v-if="error"
232
- :content="error"
233
- :disabled="!isErrorTruncated"
234
- content-class="max-w-300px break-words z-[12000]"
235
- >
236
- <div
237
- ref="errorContainerRef"
238
- absolute bottom--14px left-0 right-0
239
- body-10-medium text-red-900 flex items-center gap-3px
240
- overflow-hidden text-ellipsis whitespace-nowrap
241
- pr-2
242
- >
243
- <TelaIcon name="i-ph-warning-bold" size="sm" text="red-900" text-16px flex-shrink-0 />
244
- <span class="overflow-hidden text-ellipsis">{{ error }}</span>
245
- </div>
246
- </TelaTooltip>
247
183
  </div>
248
184
  </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) => {
@@ -200,16 +200,26 @@ const EditorComponent = defineComponent({
200
200
  </div>
201
201
 
202
202
  <div v-if="data" class="space-y-3">
203
- <TelaInput
204
- v-model="editName"
205
- label="Name"
206
- :placeholder="data.name"
207
- />
208
- <TelaInput
209
- v-model="editEmail"
210
- label="Email"
211
- :placeholder="data.email"
212
- />
203
+ <div class="flex flex-col gap-8px">
204
+ <TelaLabel for="demo-edit-name">
205
+ Name
206
+ </TelaLabel>
207
+ <TelaInput
208
+ id="demo-edit-name"
209
+ v-model="editName"
210
+ :placeholder="data.name"
211
+ />
212
+ </div>
213
+ <div class="flex flex-col gap-8px">
214
+ <TelaLabel for="demo-edit-email">
215
+ Email
216
+ </TelaLabel>
217
+ <TelaInput
218
+ id="demo-edit-email"
219
+ v-model="editEmail"
220
+ :placeholder="data.email"
221
+ />
222
+ </div>
213
223
  <TelaButton
214
224
  variant="primary"
215
225
  size="sm"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meistrari/tela-build",
3
- "version": "1.88.0",
3
+ "version": "1.89.1",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "app.config.ts",