@meistrari/tela-build 1.91.0 → 1.92.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,16 @@
2
2
 
3
3
  Latest updates and announcements.
4
4
 
5
+ ## October 21, 2026
6
+
7
+ - [Toggle Group](/components/toggle-group) is restyled to the current design: a `bg-muted` track with 2px padding, 28px options in 13px `text-tertiary`, and the active option on a white pill with a 0.5px `black/16` border and a soft shadow. The pill slides between options, with a `clip-path` revealing the active label, like [Segment Toggle](/components/segment-toggle). Inactive options turn `text-secondary` on hover, and keyboard focus shows a 0.5px `cyan-600` ring.
8
+ - [Toggle Group](/components/toggle-group#icon-only) options show a `label`, an `icon`, or both. An option with only an `icon` renders as a square 28px button named by its `ariaLabel`.
9
+ - [Toggle Group](/components/toggle-group) `v-model` emits the selected option's original value instead of its string form, so boolean and number options no longer need `=== 'true'` conversions in `@update:model-value`.
10
+ - [Toggle Group](/components/toggle-group) drops the `size` prop; every toggle group is the 28px, 13px size.
11
+ - [Toggle Group](/components/toggle-group) options accept `disabled`, and the `option` slot also receives `active`.
12
+ - [Toggle Group](/components/toggle-group) is built on Reka UI instead of Radix Vue, so arrow keys move focus between options.
13
+ - [Toggle Group](/components/toggle-group) has a showcase page.
14
+
5
15
  ## October 16, 2026
6
16
 
7
17
  - [Input](/components/input) drops the `showDescription` prop and `description` slot. Put content on the right of the field with the `trailing` slot.
@@ -0,0 +1,126 @@
1
+ import { Meta, ArgTypes } from '@storybook/blocks';
2
+
3
+ <Meta title="Components/Toggle Group" tags={['new']} />
4
+
5
+ # TelaToggleGroup
6
+
7
+ A row of mutually exclusive options on a muted track, for switching between views or modes in place (Table / Kanban, Combined / Separate). The active option sits on a raised white pill that slides between options. Built on Reka UI's `ToggleGroup`, so arrow keys move between options.
8
+
9
+ ## Examples
10
+
11
+ ### Default
12
+
13
+ ```vue
14
+ <script setup>
15
+ import { ref } from 'vue'
16
+
17
+ const view = ref('kanban')
18
+ const options = [
19
+ { label: 'Table', value: 'table' },
20
+ { label: 'Kanban', value: 'kanban' },
21
+ ]
22
+ </script>
23
+
24
+ <template>
25
+ <TelaToggleGroup v-model="view" :options="options" />
26
+ </template>
27
+ ```
28
+
29
+ ### With Icons
30
+
31
+ An option shows whatever it has: a `label`, an `icon`, or both, with the icon before the label.
32
+
33
+ ```vue
34
+ <script setup>
35
+ import { ref } from 'vue'
36
+
37
+ const view = ref('table')
38
+ const options = [
39
+ { label: 'Table', value: 'table', icon: 'i-ph-table' },
40
+ { label: 'Kanban', value: 'kanban', icon: 'i-ph-kanban' },
41
+ ]
42
+ </script>
43
+
44
+ <template>
45
+ <TelaToggleGroup v-model="view" :options="options" />
46
+ </template>
47
+ ```
48
+
49
+ ### Icon Only
50
+
51
+ An option with an `icon` and no `label` renders as a 28px square. Give it an `ariaLabel` so screen readers and the hover title can name it.
52
+
53
+ ```vue
54
+ <script setup>
55
+ import { ref } from 'vue'
56
+
57
+ const view = ref('kanban')
58
+ const options = [
59
+ { value: 'table', icon: 'i-ph-table', ariaLabel: 'Table' },
60
+ { value: 'kanban', icon: 'i-ph-kanban', ariaLabel: 'Kanban' },
61
+ ]
62
+ </script>
63
+
64
+ <template>
65
+ <TelaToggleGroup v-model="view" :options="options" />
66
+ </template>
67
+ ```
68
+
69
+ ### Full Width
70
+
71
+ Options grow to share the track, which suits forms and modals.
72
+
73
+ ```vue
74
+ <script setup>
75
+ import { ref } from 'vue'
76
+
77
+ const required = ref(false)
78
+ const options = [
79
+ { label: 'No', value: false },
80
+ { label: 'Yes', value: true },
81
+ ]
82
+ </script>
83
+
84
+ <template>
85
+ <div class="w-320px">
86
+ <TelaToggleGroup v-model="required" :options="options" class="w-full" />
87
+ </div>
88
+ </template>
89
+ ```
90
+
91
+ ### Read Only
92
+
93
+ ```vue
94
+ <script setup>
95
+ import { ref } from 'vue'
96
+
97
+ const view = ref('table')
98
+ const options = [
99
+ { label: 'Table', value: 'table' },
100
+ { label: 'Kanban', value: 'kanban' },
101
+ ]
102
+ </script>
103
+
104
+ <template>
105
+ <TelaToggleGroup v-model="view" :options="options" read-only />
106
+ </template>
107
+ ```
108
+
109
+ ## Rules
110
+
111
+ | Part | Style |
112
+ |------|-------|
113
+ | Track | `bg-muted`, 2px padding and gap, 10px radius |
114
+ | Option | 28px tall, 12px horizontal padding, 8px radius, 13px / 520 weight, `text-tertiary` |
115
+ | Active option | `bg` pill with a 0.5px `black/16` border and a `0 2px 3px rgba(64,64,64,0.03)` shadow; slides to the new option while a `clip-path` reveals its `text-primary` label |
116
+ | Hover (inactive) | `text-secondary` |
117
+ | Focus (keyboard) | 0.5px `cyan-600` ring |
118
+ | Icon only (`icon`, no `label`) | 28px square, 8px radius, 14px icon |
119
+
120
+ - One option is always active: clicking the active option keeps it selected.
121
+ - `v-model` keeps the option's value type: boolean, number, and string values come back as they were passed in `options`. Values are compared by `String(value)`, so they must stay distinct as strings.
122
+ - Use it for 2–4 short options. For longer lists use `TelaSelectMenu`; for page-level navigation use `TelaTabs`.
123
+
124
+ ## Props
125
+
126
+ <ArgTypes />
@@ -0,0 +1,179 @@
1
+ <script setup lang="ts" generic="T">
2
+ import type { HTMLAttributes } from 'vue'
3
+ import { ToggleGroupItem, ToggleGroupRoot } from 'reka-ui'
4
+
5
+ const props = defineProps<{
6
+ modelValue: T
7
+ options: {
8
+ label?: string
9
+ value: T
10
+ icon?: string
11
+ ariaLabel?: string
12
+ disabled?: boolean
13
+ [key: string]: unknown
14
+ }[]
15
+ readOnly?: boolean
16
+ class?: HTMLAttributes['class']
17
+ }>()
18
+
19
+ const emit = defineEmits<{
20
+ (e: 'update:modelValue', value: T): void
21
+ }>()
22
+
23
+ defineSlots<{
24
+ option?: (props: { option: ToggleGroupOption, active: boolean }) => unknown
25
+ }>()
26
+
27
+ type ToggleGroupOption = typeof props.options[number]
28
+
29
+ const wrapperRef = ref<HTMLElement>()
30
+ const baseListRef = ref<InstanceType<typeof ToggleGroupRoot>>()
31
+
32
+ const currentValue = computed(() => String(props.modelValue))
33
+
34
+ const hiddenClip = 'inset(0 100% 0 0 round 8px)'
35
+ const pillStyle = ref<Record<string, string>>({ opacity: '0' })
36
+ const clipPath = ref(hiddenClip)
37
+ const enableTransition = ref(false)
38
+
39
+ // an option with an icon and no label renders as a 28px square
40
+ function isIconOnly(option: ToggleGroupOption) {
41
+ return Boolean(option.icon) && !option.label
42
+ }
43
+
44
+ function itemClass(option: ToggleGroupOption) {
45
+ return cn(
46
+ 'flex items-center justify-center gap-5px rounded-8px whitespace-nowrap text-[13px] leading-[16px] font-520 tracking-[-0.2px]',
47
+ isIconOnly(option) ? 'size-28px shrink-0' : 'grow h-28px px-12px',
48
+ )
49
+ }
50
+
51
+ // reka-ui keys items by string, so selections map back to the option's original value
52
+ function onUpdateValue(key: unknown) {
53
+ if (props.readOnly || typeof key !== 'string' || !key)
54
+ return
55
+
56
+ const option = props.options.find(option => String(option.value) === key)
57
+ if (option)
58
+ emit('update:modelValue', option.value)
59
+ }
60
+
61
+ // only a selection change animates; mount, resize, and option changes snap into place
62
+ function updateIndicator(animate = false) {
63
+ enableTransition.value = animate
64
+
65
+ const wrapper = wrapperRef.value
66
+ const list: HTMLElement | undefined = baseListRef.value?.$el
67
+ const active = list?.querySelector<HTMLElement>(`[data-value="${CSS.escape(currentValue.value)}"]`)
68
+
69
+ if (!wrapper?.offsetWidth || !list || !active) {
70
+ pillStyle.value = { opacity: '0' }
71
+ clipPath.value = hiddenClip
72
+ return
73
+ }
74
+
75
+ // items are offset from the list (it's positioned), so add the list's own offset inside the track
76
+ const offsetLeft = list.offsetLeft + active.offsetLeft
77
+ const offsetTop = list.offsetTop + active.offsetTop
78
+ const { offsetWidth, offsetHeight } = active
79
+ const right = wrapper.offsetWidth - offsetLeft - offsetWidth
80
+ const bottom = wrapper.offsetHeight - offsetTop - offsetHeight
81
+
82
+ pillStyle.value = {
83
+ width: `${offsetWidth}px`,
84
+ height: `${offsetHeight}px`,
85
+ transform: `translate(${offsetLeft}px, ${offsetTop}px)`,
86
+ }
87
+ clipPath.value = `inset(${offsetTop}px ${right}px ${bottom}px ${offsetLeft}px round 8px)`
88
+ }
89
+
90
+ watch(() => props.modelValue, () => nextTick(() => updateIndicator(true)))
91
+ watch(() => props.options, () => nextTick(() => updateIndicator()), { deep: true })
92
+
93
+ let resizeObserver: ResizeObserver | undefined
94
+
95
+ onMounted(() => {
96
+ nextTick(() => updateIndicator())
97
+
98
+ if (wrapperRef.value) {
99
+ resizeObserver = new ResizeObserver(() => updateIndicator())
100
+ resizeObserver.observe(wrapperRef.value)
101
+ }
102
+ })
103
+
104
+ onBeforeUnmount(() => {
105
+ resizeObserver?.disconnect()
106
+ })
107
+ </script>
108
+
109
+ <template>
110
+ <div
111
+ ref="wrapperRef"
112
+ :class="cn(
113
+ 'relative inline-flex p-2px rounded-10px bg-muted select-none',
114
+ readOnly && 'opacity-90 cursor-not-allowed',
115
+ props.class,
116
+ )"
117
+ >
118
+ <div
119
+ aria-hidden="true"
120
+ :class="cn(
121
+ 'absolute top-0 left-0 rounded-8px bg border-[0.5px] border-black/16 [box-shadow:0_2px_3px_0_rgba(64,64,64,0.03)] pointer-events-none',
122
+ enableTransition && '[transition:transform_250ms_ease,width_250ms_ease,height_250ms_ease] motion-reduce:transition-none',
123
+ )"
124
+ :style="pillStyle"
125
+ />
126
+
127
+ <ToggleGroupRoot
128
+ ref="baseListRef"
129
+ :model-value="currentValue"
130
+ type="single"
131
+ :disabled="readOnly"
132
+ class="relative flex grow items-center gap-2px"
133
+ @update:model-value="onUpdateValue"
134
+ >
135
+ <ToggleGroupItem
136
+ v-for="option in options"
137
+ :key="String(option.value)"
138
+ :value="String(option.value)"
139
+ :data-value="String(option.value)"
140
+ :disabled="option.disabled"
141
+ :aria-label="isIconOnly(option) ? option.ariaLabel : undefined"
142
+ :title="isIconOnly(option) ? option.ariaLabel : undefined"
143
+ :class="cn(
144
+ itemClass(option),
145
+ 'text-tertiary outline-none transition-colors duration-150 ease-out focus-visible:ring-0.5px focus-visible:ring-cyan-600',
146
+ 'data-[disabled]:cursor-not-allowed data-[disabled]:text-subtle',
147
+ !readOnly && 'cursor-pointer hover:text-secondary',
148
+ )"
149
+ >
150
+ <slot name="option" :option="option" :active="currentValue === String(option.value)">
151
+ <TelaIcon v-if="option.icon" :name="option.icon" size="14px" />
152
+ <span v-if="option.label">{{ option.label }}</span>
153
+ </slot>
154
+ </ToggleGroupItem>
155
+ </ToggleGroupRoot>
156
+
157
+ <div
158
+ aria-hidden="true"
159
+ :class="cn(
160
+ 'absolute inset-0 flex p-2px pointer-events-none',
161
+ enableTransition && '[transition:clip-path_250ms_ease] motion-reduce:transition-none',
162
+ )"
163
+ :style="{ clipPath }"
164
+ >
165
+ <div class="flex grow items-center gap-2px">
166
+ <div
167
+ v-for="option in options"
168
+ :key="String(option.value)"
169
+ :class="cn(itemClass(option), 'text-primary')"
170
+ >
171
+ <slot name="option" :option="option" :active="currentValue === String(option.value)">
172
+ <TelaIcon v-if="option.icon" :name="option.icon" size="14px" />
173
+ <span v-if="option.label">{{ option.label }}</span>
174
+ </slot>
175
+ </div>
176
+ </div>
177
+ </div>
178
+ </div>
179
+ </template>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meistrari/tela-build",
3
- "version": "1.91.0",
3
+ "version": "1.92.0",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "app.config.ts",
@@ -32,12 +32,8 @@
32
32
  "@fontsource-variable/inter": "^5.2.8",
33
33
  "@iconify-json/ph": "1.2.2",
34
34
  "@internationalized/date": "3.6.0",
35
- "@internationalized/number": "3.6.0",
36
35
  "@meistrari/auth-core": "^1.42.0",
37
36
  "@number-flow/vue": "^0.3.2",
38
- "@nuxt/icon": "^1.9.0",
39
- "@nuxtjs/color-mode": "^3.5.2",
40
- "@nuxtjs/tailwindcss": "6.12.2",
41
37
  "@types/mdast": "4.0.4",
42
38
  "@unocss/nuxt": "66.5.12",
43
39
  "@unocss/transformer-directives": "66.5.12",
@@ -49,14 +45,10 @@
49
45
  "clsx": "2.1.1",
50
46
  "comark": "0.5.1",
51
47
  "glob": "11.0.0",
52
- "gsap": "3.12.5",
53
- "import-in-the-middle": "1.11.2",
54
48
  "lucide-vue-next": "0.456.0",
55
49
  "mdast-util-mdx": "3.0.0",
56
- "motion": "10.16.4",
57
50
  "motion-v": "2.3.0",
58
51
  "nitropack": "2.13.4",
59
- "number-flow": "0.4.1",
60
52
  "nuxt-svgo": "4.2.6",
61
53
  "pathe": "1.1.2",
62
54
  "pdfjs-dist": "4.10.38",
@@ -66,11 +58,9 @@
66
58
  "remark-mdx": "3.1.1",
67
59
  "remark-parse": "11.0.0",
68
60
  "remark-stringify": "11.0.0",
69
- "resize-observer-polyfill": "1.5.1",
70
61
  "scule": "1.3.0",
71
62
  "shiki": "2.5.0",
72
63
  "tailwind-merge": "2.5.4",
73
- "tailwindcss-animate": "1.0.7",
74
64
  "ts-morph": "22.0.0",
75
65
  "typescript": "5.8.2",
76
66
  "unified": "11.0.5",
@@ -89,7 +79,6 @@
89
79
  "devDependencies": {
90
80
  "@nuxt/kit": "4.5.2",
91
81
  "@types/node": "22.19.0",
92
- "fs-extra": "11.2.0",
93
82
  "gray-matter": "4.0.3",
94
83
  "nuxt": "4.5.2",
95
84
  "vue": "3.5.42",
@@ -1,91 +0,0 @@
1
- <script setup lang="ts">
2
- import { ToggleGroupItem, ToggleGroupRoot } from 'radix-vue'
3
-
4
- const props = defineProps<{
5
- modelValue: unknown
6
- readOnly?: boolean
7
- size?: 'sm' | 'md'
8
- options: ({
9
- label: string
10
- value: unknown
11
- icon?: string
12
- } & Record<string, any>)[]
13
- }>()
14
-
15
- const emit = defineEmits(['update:modelValue'])
16
-
17
- const currentValue = ref()
18
- watch(() => props.modelValue, newValue => currentValue.value = String(newValue), { immediate: true })
19
-
20
- const sizeStyles = computed(() => {
21
- switch (props.size) {
22
- case 'sm':
23
- return 'text-11px py-3px px-8px'
24
- case 'md':
25
- default:
26
- return 'text-11px leading-14px py-8px px-12px'
27
- }
28
- })
29
-
30
- function onUpdateValue(newValue: string) {
31
- if (props.readOnly)
32
- return
33
-
34
- if (newValue) {
35
- currentValue.value = newValue
36
- emit('update:modelValue', newValue)
37
- }
38
- }
39
- </script>
40
-
41
- <template>
42
- <ToggleGroupRoot
43
- :model-value="currentValue"
44
- type="single"
45
- rounded="8.5px"
46
- flex-inline
47
- font-semibold
48
- h-30px
49
- :class="[
50
- readOnly && '!op-50',
51
- ]"
52
- class="bg-gray-300"
53
- :disabled="readOnly"
54
- @update:model-value="(val) => onUpdateValue(val as string)"
55
- >
56
- <ToggleGroupItem
57
- v-for="option in options"
58
- :key="String(option.value)"
59
- :value="String(option.value)"
60
- rounded="8.5px"
61
- py-8px
62
- px-12px
63
- b-0.5px b-gray-300
64
- flex
65
- items-center
66
- justify-center
67
- body-12-medium
68
- text-gray-700
69
- grow
70
- :class="[
71
- sizeStyles,
72
- currentValue === String(option.value) && 'bg-white subtle-shadow text-gray-800',
73
- !readOnly && currentValue !== String(option.value) && 'hover:white-800 hover:text-gray-700 cursor-pointer',
74
- readOnly && 'cursor-not-allowed',
75
- ]"
76
- class="group"
77
- outline-gray-300
78
- transition ease
79
- >
80
- <div v-if="$slots.option">
81
- <slot name="option" :option="option" />
82
- </div>
83
- <div v-else flex gap-4px items-center justify-center>
84
- <TelaIcon v-if="option.icon" :name="option.icon" size="sm" />
85
- <span>
86
- {{ option.label }}
87
- </span>
88
- </div>
89
- </ToggleGroupItem>
90
- </ToggleGroupRoot>
91
- </template>