@meistrari/tela-build 1.95.0 → 1.97.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 +27 -0
- package/components/tela/checkbox/checkbox.vue +3 -3
- package/components/tela/code-block/code-block.vue +1 -1
- package/components/tela/sidebar/sidebar-content.vue +30 -3
- package/components/tela/sidebar/sidebar-context.ts +13 -0
- package/components/tela/sidebar/sidebar-divider.vue +3 -0
- package/components/tela/sidebar/sidebar-footer.vue +11 -1
- package/components/tela/sidebar/sidebar-header.vue +13 -1
- package/components/tela/sidebar/sidebar-item.vue +66 -31
- package/components/tela/sidebar/sidebar-logo.vue +11 -4
- package/components/tela/sidebar/sidebar-user.vue +4 -2
- package/components/tela/sidebar/sidebar.mdx +50 -0
- package/components/tela/sidebar/sidebar.vue +24 -2
- package/components/tela/skeleton/skeleton.vue +1 -1
- package/components/tela/status/status.vue +19 -19
- package/components/tela/switch/switch.vue +101 -5
- package/components/tela/tooltip/tooltip-content.vue +1 -1
- package/components/tela/tooltip-group/tooltip-group-trigger.vue +11 -4
- package/components/tela/tooltip-group/tooltip-group.mdx +7 -0
- package/package.json +1 -1
- package/utils/design-tokens.ts +11 -11
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,33 @@
|
|
|
2
2
|
|
|
3
3
|
Latest updates and announcements.
|
|
4
4
|
|
|
5
|
+
## October 30, 2026
|
|
6
|
+
|
|
7
|
+
- [Switch](/components/switch) Toggling animates the thumb as a stretching pill: it slides at a near-constant speed while stretching from its trailing edge, squashes as it lands, then springs back to a circle with a slight overshoot over 500ms. The track color crossfades over 300ms. The thumb's small stretch toward the other side (16 → 18px on `sm`, 18 → 20px on `md`) now shows on hover instead of while pressed. Toggling drops it, and it comes back the next time the pointer leaves and hovers the switch again. Toggling again mid-animation reverses from wherever the thumb is instead of jumping to the far end. Switches don't animate on mount, and the animation is skipped under `prefers-reduced-motion`.
|
|
8
|
+
- [Checkbox](/components/checkbox) scales down to 93% while pressed, easing over 200ms. Disabled checkboxes don't scale, and neither do any under `prefers-reduced-motion`.
|
|
9
|
+
|
|
10
|
+
## October 29, 2026
|
|
11
|
+
|
|
12
|
+
- [Tooltip Group](/components/tooltip-group) `TelaTooltipGroupTrigger` honors `disabled`: a disabled trigger doesn't open its tooltip, and one that's open closes as soon as it's disabled.
|
|
13
|
+
- [Sidebar](/patterns/sidebar#minimized) items no longer show their label tooltip in the `default` variant after the sidebar switches from `minimized` while mounted.
|
|
14
|
+
- [Colors](/colors) The `subtle`, `muted` and `lowered` surfaces and the primary, secondary, ghost, disabled and loading button colors now come from the warmer stone palette instead of neutral, so every component and `bg-*` class built on them shifts slightly warm.
|
|
15
|
+
- [Skeleton](/components/skeleton) and [Status](/components/status) backgrounds use the `bg-muted` surface instead of `bg-neutral-100`, so they follow the stone palette. [Code Block](/components/code-block)'s loading lines no longer override it with `bg-neutral-200`.
|
|
16
|
+
- [Tooltip](/components/tooltip) The tooltip background is `stone-800` instead of `neutral-800`.
|
|
17
|
+
|
|
18
|
+
## October 28, 2026
|
|
19
|
+
|
|
20
|
+
- [Sidebar](/patterns/sidebar#minimized) `TelaSidebarLogo` no longer has a bottom margin in the `minimized` variant; `TelaSidebarHeader` spaces its first child 8px from the rest instead. A menu trigger wrapping the logo is now the logo's size, so its menu opens 4px below the logo as in the default variant.
|
|
21
|
+
- [Sidebar](/patterns/sidebar#minimized) sets `data-variant` on its `<aside>` and is a named `sidebar` group, so its parts and your own content can style the minimized rail with `group-data-[variant=minimized]/sidebar:` classes. The built-in parts now size themselves this way, with no visual change.
|
|
22
|
+
- [Sidebar](/patterns/sidebar) `TelaSidebarContent` fades its top and bottom edges only when items are scrolled past them, so the first and last items are no longer faded at rest.
|
|
23
|
+
- [Sidebar](/patterns/sidebar#minimized) items in the `minimized` variant show the `bg-lowered` surface on hover, the same one shown while active, instead of the white surface with a `border-strong` outline. It still scales in from the center on hover.
|
|
24
|
+
|
|
25
|
+
## October 27, 2026
|
|
26
|
+
|
|
27
|
+
- [Sidebar](/patterns/sidebar#minimized) has a `minimized` variant: a 48px icon rail where each item's label shows in a tooltip to the right, grouped with `TelaTooltipGroup`. Items are 32px with 18px icons, the logo and user avatar are 24px, and the user menu opens to the right. Switching `variant` on a mounted sidebar animates over 300ms (width, item and logo sizes, and the labels collapsing) instead of swapping the markup, and skips the animation under `prefers-reduced-motion`.
|
|
28
|
+
- [Sidebar](/patterns/sidebar#telasidebardivider) has a `TelaSidebarDivider`: a short 16px line for separating groups of items, such as the header's actions from the navigation.
|
|
29
|
+
- [Sidebar](/patterns/sidebar#telasidebaritem) `TelaSidebarItem` passes extra attributes such as `aria-label` to its button or link, and accepts `as` to render as another element, such as a `span` inside a menu trigger that is already a button. `activeIcon` replaces the `-fill` icon shown while active.
|
|
30
|
+
- [Tooltip Group](/components/tooltip-group) `TelaTooltipGroupTrigger` accepts `asChild`, which puts the trigger on the slotted element instead of wrapping it in a `<button>`, for children that are already buttons or links.
|
|
31
|
+
|
|
5
32
|
## October 26, 2026
|
|
6
33
|
|
|
7
34
|
- [Sidebar](/patterns/sidebar#telasidebaruser) `TelaSidebarUser` menu opens at a 242px minimum width (was 200px), with the name in 14px semibold and the email in `text-tertiary`.
|
|
@@ -16,9 +16,9 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits)
|
|
|
16
16
|
<CheckboxRoot
|
|
17
17
|
v-bind="forwarded"
|
|
18
18
|
:class="cn(
|
|
19
|
-
'checkbox grid place-content-center peer
|
|
19
|
+
'checkbox grid place-content-center peer size-16px shrink-0 rounded-5px border-[1px] border-strong bg focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-cyan-600',
|
|
20
20
|
'hover:data-[state=unchecked]:bg-muted data-[state=checked]:border-transparent data-[state=checked]:bg-btn-primary hover:data-[state=checked]:bg-btn-primary-active',
|
|
21
|
-
'disabled:cursor-not-allowed disabled:bg-muted disabled:border disabled:data-[state=checked]:bg-neutral-300',
|
|
21
|
+
'disabled:cursor-not-allowed disabled:bg-muted disabled:border disabled:data-[state=checked]:bg-neutral-300 motion-safe:not-disabled:active:scale-93',
|
|
22
22
|
props.class,
|
|
23
23
|
)"
|
|
24
24
|
>
|
|
@@ -55,6 +55,6 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits)
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
.checkbox {
|
|
58
|
-
transition: background-color 125ms ease-out, border-color 125ms ease-out;
|
|
58
|
+
transition: background-color 125ms ease-out, border-color 125ms ease-out, transform 200ms cubic-bezier(0.22, 1, 0.36, 1);
|
|
59
59
|
}
|
|
60
60
|
</style>
|
|
@@ -87,7 +87,7 @@ watchEffect((onCleanup) => {
|
|
|
87
87
|
class="w-2.75rem shrink-0 pr-1rem text-right font-mono text-tertiary text-13px"
|
|
88
88
|
>{{ i }}</span>
|
|
89
89
|
<TelaSkeleton
|
|
90
|
-
class="h-14px rounded-2px
|
|
90
|
+
class="h-14px rounded-2px"
|
|
91
91
|
:class="i % 3 === 0 ? 'w-90%' : i % 3 === 1 ? 'w-4/5' : 'w-3/5'"
|
|
92
92
|
/>
|
|
93
93
|
</div>
|
|
@@ -1,9 +1,36 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { useScroll } from '@vueuse/core'
|
|
3
|
+
import { sidebarTransition } from './sidebar-context'
|
|
4
|
+
|
|
5
|
+
const scrollEl = ref<HTMLElement | null>(null)
|
|
6
|
+
const { arrivedState } = useScroll(scrollEl)
|
|
7
|
+
|
|
8
|
+
const maskClass = computed(() => cn(
|
|
9
|
+
arrivedState.top
|
|
10
|
+
? '[--sidebar-fade-top:black]'
|
|
11
|
+
: '[--sidebar-fade-top:transparent]',
|
|
12
|
+
arrivedState.bottom
|
|
13
|
+
? '[--sidebar-fade-bottom:black]'
|
|
14
|
+
: '[--sidebar-fade-bottom:transparent]',
|
|
15
|
+
))
|
|
16
|
+
</script>
|
|
17
|
+
|
|
1
18
|
<template>
|
|
2
19
|
<div
|
|
3
|
-
|
|
4
|
-
class="
|
|
20
|
+
ref="scrollEl"
|
|
21
|
+
:class="cn(
|
|
22
|
+
'flex flex-col h-full overflow-y-auto no-scrollbar',
|
|
23
|
+
'[mask-image:linear-gradient(to_bottom,var(--sidebar-fade-top),black_20px,black_calc(100%_-_20px),var(--sidebar-fade-bottom))]',
|
|
24
|
+
maskClass,
|
|
25
|
+
)"
|
|
5
26
|
>
|
|
6
|
-
<nav
|
|
27
|
+
<nav
|
|
28
|
+
:class="cn(
|
|
29
|
+
'flex flex-col items-center h-full mb-48px gap-14px px-10px pt-12px transition-[gap,padding]',
|
|
30
|
+
'group-data-[variant=minimized]/sidebar:gap-4px group-data-[variant=minimized]/sidebar:px-8px group-data-[variant=minimized]/sidebar:pt-2px',
|
|
31
|
+
sidebarTransition,
|
|
32
|
+
)"
|
|
33
|
+
>
|
|
7
34
|
<slot />
|
|
8
35
|
</nav>
|
|
9
36
|
</div>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { computed, inject } from 'vue'
|
|
2
|
+
import type { InjectionKey, Ref } from 'vue'
|
|
3
|
+
|
|
4
|
+
export type SidebarVariant = 'default' | 'minimized'
|
|
5
|
+
|
|
6
|
+
export const sidebarVariantKey: InjectionKey<Ref<SidebarVariant>> = Symbol('tela-sidebar-variant')
|
|
7
|
+
|
|
8
|
+
export function useSidebarVariant() {
|
|
9
|
+
const variant = inject(sidebarVariantKey, null)
|
|
10
|
+
return computed(() => variant?.value === 'minimized')
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const sidebarTransition = 'duration-300 ease-out motion-reduce:transition-none'
|
|
@@ -1,5 +1,15 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { sidebarTransition } from './sidebar-context'
|
|
3
|
+
</script>
|
|
4
|
+
|
|
1
5
|
<template>
|
|
2
|
-
<footer
|
|
6
|
+
<footer
|
|
7
|
+
:class="cn(
|
|
8
|
+
'flex flex-col items-center justify-center gap-16px pb-24px transition-[gap,padding]',
|
|
9
|
+
'group-data-[variant=minimized]/sidebar:gap-4px group-data-[variant=minimized]/sidebar:pb-12px',
|
|
10
|
+
sidebarTransition,
|
|
11
|
+
)"
|
|
12
|
+
>
|
|
3
13
|
<slot />
|
|
4
14
|
</footer>
|
|
5
15
|
</template>
|
|
@@ -1,5 +1,17 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { sidebarTransition } from './sidebar-context'
|
|
3
|
+
</script>
|
|
4
|
+
|
|
1
5
|
<template>
|
|
2
|
-
<header
|
|
6
|
+
<header
|
|
7
|
+
:class="cn(
|
|
8
|
+
'sticky top-0 z-10 flex flex-col items-center justify-center gap-24px pt-24px pb-12px transition-[gap,padding]',
|
|
9
|
+
'group-data-[variant=minimized]/sidebar:gap-4px group-data-[variant=minimized]/sidebar:pt-10px group-data-[variant=minimized]/sidebar:pb-4px',
|
|
10
|
+
// The extra space below the logo sits outside it, so a menu trigger wrapping the logo stays the logo's size
|
|
11
|
+
'group-data-[variant=minimized]/sidebar:[&>:first-child]:mb-8px [&>:first-child]:transition-[margin] [&>:first-child]:duration-300 [&>:first-child]:ease-out motion-reduce:[&>:first-child]:transition-none',
|
|
12
|
+
sidebarTransition,
|
|
13
|
+
)"
|
|
14
|
+
>
|
|
3
15
|
<slot />
|
|
4
16
|
</header>
|
|
5
17
|
</template>
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { NuxtLink } from '#components'
|
|
3
|
+
import TelaTooltipGroupTrigger from '../tooltip-group/tooltip-group-trigger.vue'
|
|
4
|
+
import { sidebarTransition, useSidebarVariant } from './sidebar-context'
|
|
5
|
+
|
|
6
|
+
defineOptions({ inheritAttrs: false })
|
|
3
7
|
|
|
4
8
|
const props = defineProps<{
|
|
5
9
|
icon: string
|
|
@@ -8,13 +12,24 @@ const props = defineProps<{
|
|
|
8
12
|
onClick?: () => void
|
|
9
13
|
isActive: boolean
|
|
10
14
|
disabled?: boolean
|
|
15
|
+
/** Icon while active; defaults to the `-fill` version of `icon` */
|
|
16
|
+
activeIcon?: string
|
|
17
|
+
/** Renders the item as this element instead of a button or link, e.g. `span` inside a trigger that is already a button */
|
|
18
|
+
as?: string
|
|
11
19
|
}>()
|
|
12
20
|
|
|
13
|
-
const
|
|
21
|
+
const isMinimized = useSidebarVariant()
|
|
22
|
+
|
|
23
|
+
const hasTooltip = computed(() => isMinimized.value && Boolean(props.label))
|
|
14
24
|
|
|
15
|
-
const
|
|
25
|
+
const iconName = computed(() => props.isActive ? props.activeIcon ?? `${props.icon}-fill` : props.icon)
|
|
26
|
+
|
|
27
|
+
const rootIs = computed(() => props.as ?? (props.disabled || !props.to ? 'button' : NuxtLink))
|
|
16
28
|
|
|
17
29
|
const rootAttrs = computed(() => {
|
|
30
|
+
if (props.as) {
|
|
31
|
+
return {}
|
|
32
|
+
}
|
|
18
33
|
if (props.disabled || !props.to) {
|
|
19
34
|
return {
|
|
20
35
|
type: 'button',
|
|
@@ -27,36 +42,56 @@ const rootAttrs = computed(() => {
|
|
|
27
42
|
</script>
|
|
28
43
|
|
|
29
44
|
<template>
|
|
30
|
-
<
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
flex="~ col" items-center justify-center gap-2px outline-none
|
|
35
|
-
:data-active="isActive && !props.disabled"
|
|
36
|
-
>
|
|
37
|
-
<div relative size-40px flex items-center justify-center rounded-10px>
|
|
38
|
-
<TelaIcon
|
|
39
|
-
:name="iconName"
|
|
40
|
-
size="20px"
|
|
41
|
-
relative z-1
|
|
42
|
-
color="icon-tertiary duration-150 ease-out group-[:hover:not(:disabled)]:icon group-focus-visible:icon group-data-[active=true]:icon"
|
|
43
|
-
/>
|
|
44
|
-
<div
|
|
45
|
-
:class="cn(
|
|
46
|
-
'absolute inset-0 size-full rounded-[14px] z-0 border-[0.5px] border-transparent',
|
|
47
|
-
isActive ? 'bg-neutral-200 group-focus-visible:border-strong' : 'bg scale-10 opacity-0 duration-150 ease-out origin-center group-hover:border-strong group-hover:scale-100 group-hover:opacity-100 group-focus-visible:border-strong group-focus-visible:scale-100 group-focus-visible:opacity-100',
|
|
48
|
-
)"
|
|
49
|
-
/>
|
|
50
|
-
</div>
|
|
51
|
-
<p
|
|
52
|
-
v-if="label"
|
|
45
|
+
<TelaTooltipGroupTrigger :content="label" side="right" as-child :disabled="!hasTooltip">
|
|
46
|
+
<component
|
|
47
|
+
:is="rootIs"
|
|
48
|
+
v-bind="{ 'aria-label': isMinimized ? label : undefined, ...$attrs, ...rootAttrs }"
|
|
53
49
|
:class="cn(
|
|
54
|
-
'
|
|
55
|
-
|
|
56
|
-
'group-data-[active=true]:text-primary group-data-[active=true]:font-550',
|
|
50
|
+
'group disabled:opacity-60 disabled:cursor-not-allowed flex flex-col items-center justify-center gap-2px group-data-[variant=minimized]/sidebar:gap-0 outline-none transition-[gap]',
|
|
51
|
+
sidebarTransition,
|
|
57
52
|
)"
|
|
53
|
+
:data-active="isActive && !props.disabled"
|
|
58
54
|
>
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
55
|
+
<div
|
|
56
|
+
:class="cn(
|
|
57
|
+
'relative flex items-center justify-center size-40px rounded-10px group-data-[variant=minimized]/sidebar:size-32px group-data-[variant=minimized]/sidebar:rounded-8px transition-all',
|
|
58
|
+
sidebarTransition,
|
|
59
|
+
)"
|
|
60
|
+
>
|
|
61
|
+
<TelaIcon
|
|
62
|
+
:name="iconName"
|
|
63
|
+
size="20px"
|
|
64
|
+
:class="cn('relative z-1 group-data-[variant=minimized]/sidebar:scale-90 transition-transform', sidebarTransition)"
|
|
65
|
+
color="icon-tertiary duration-150 ease-out group-[:hover:not(:disabled)]:icon group-focus-visible:icon group-data-[active=true]:icon"
|
|
66
|
+
/>
|
|
67
|
+
<div
|
|
68
|
+
:class="cn(
|
|
69
|
+
'absolute inset-0 size-full z-0 rounded-[14px] border-[0.5px] border-transparent bg duration-150 ease-out origin-center',
|
|
70
|
+
'scale-10 opacity-0 group-hover:scale-100 group-hover:opacity-100 group-focus-visible:scale-100 group-focus-visible:opacity-100',
|
|
71
|
+
'group-[:hover:not([data-active=true])]:border-strong group-focus-visible:border-strong',
|
|
72
|
+
'group-data-[active=true]:scale-100 group-data-[active=true]:opacity-100 group-data-[active=true]:bg-lowered',
|
|
73
|
+
'group-data-[variant=minimized]/sidebar:rounded-10px group-data-[variant=minimized]/sidebar:bg-lowered group-data-[variant=minimized]/sidebar:group-hover:border-transparent',
|
|
74
|
+
)"
|
|
75
|
+
/>
|
|
76
|
+
</div>
|
|
77
|
+
<div
|
|
78
|
+
v-if="label"
|
|
79
|
+
:aria-hidden="isMinimized || undefined"
|
|
80
|
+
:class="cn(
|
|
81
|
+
'grid grid-rows-[1fr] opacity-100 group-data-[variant=minimized]/sidebar:grid-rows-[0fr] group-data-[variant=minimized]/sidebar:opacity-0 group-data-[variant=minimized]/sidebar:w-0 transition-[grid-template-rows,opacity]',
|
|
82
|
+
sidebarTransition,
|
|
83
|
+
)"
|
|
84
|
+
>
|
|
85
|
+
<p
|
|
86
|
+
:class="cn(
|
|
87
|
+
'min-h-0 overflow-hidden text-[11px] leading-[12px] -tracking-0.2px font-460 text-tertiary duration-150 ease-out',
|
|
88
|
+
'group-[:hover:not(:disabled)]:text-primary group-focus-visible:text-primary',
|
|
89
|
+
'group-data-[active=true]:text-primary group-data-[active=true]:font-550',
|
|
90
|
+
)"
|
|
91
|
+
>
|
|
92
|
+
{{ label }}
|
|
93
|
+
</p>
|
|
94
|
+
</div>
|
|
95
|
+
</component>
|
|
96
|
+
</TelaTooltipGroupTrigger>
|
|
62
97
|
</template>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { NuxtLink } from '#components'
|
|
3
|
+
import { sidebarTransition } from './sidebar-context'
|
|
3
4
|
|
|
4
5
|
defineProps<{
|
|
5
6
|
src?: string | null
|
|
@@ -12,10 +13,16 @@ defineProps<{
|
|
|
12
13
|
<component
|
|
13
14
|
:is="to ? NuxtLink : 'div'"
|
|
14
15
|
:to="to"
|
|
15
|
-
class="
|
|
16
|
+
:class="cn(
|
|
17
|
+
'block size-40px rounded-12px overflow-hidden outline-none focus-within:ring-0.5px focus-within:ring-border-strong transition-all',
|
|
18
|
+
'group-data-[variant=minimized]/sidebar:size-24px group-data-[variant=minimized]/sidebar:rounded-6px',
|
|
19
|
+
sidebarTransition,
|
|
20
|
+
)"
|
|
16
21
|
>
|
|
17
|
-
<
|
|
18
|
-
|
|
19
|
-
|
|
22
|
+
<div :class="cn('size-40px origin-top-left transition-transform group-data-[variant=minimized]/sidebar:scale-60', sidebarTransition)">
|
|
23
|
+
<img v-if="src" :src="src" :alt="alt" class="size-40px object-cover">
|
|
24
|
+
<TelaInitials v-else-if="alt" size="md" :word="alt" />
|
|
25
|
+
<div v-else class="size-40px bg-black" />
|
|
26
|
+
</div>
|
|
20
27
|
</component>
|
|
21
28
|
</template>
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
import { sidebarTransition } from './sidebar-context'
|
|
3
|
+
|
|
2
4
|
defineProps<{
|
|
3
5
|
image?: string
|
|
4
6
|
name?: string
|
|
@@ -29,8 +31,8 @@ const labels = useTelaLabels()
|
|
|
29
31
|
:class="cn('group', image ? 'ring-transparent focus-within:ring-border-strong' : 'ring-border-strong focus-within:ring-border-accent')"
|
|
30
32
|
rounded-full overflow-hidden ring-0.5px
|
|
31
33
|
>
|
|
32
|
-
<img v-if="image" :src="image" :alt="name"
|
|
33
|
-
<div v-else
|
|
34
|
+
<img v-if="image" :src="image" :alt="name" :class="cn('object-cover size-32px group-data-[variant=minimized]/sidebar:size-24px transition-[width,height]', sidebarTransition)">
|
|
35
|
+
<div v-else :class="cn('bg size-32px group-data-[variant=minimized]/sidebar:size-24px transition-[width,height]', sidebarTransition)" />
|
|
34
36
|
</button>
|
|
35
37
|
</TelaDropdownMenuTrigger>
|
|
36
38
|
<TelaDropdownMenuContent align="start" side="top" class="min-w-242px!">
|
|
@@ -97,12 +97,52 @@ Place the sidebar and main content in a flex row. The sidebar is `sticky`; the `
|
|
|
97
97
|
|
|
98
98
|
<Canvas of={SidebarStories.SingleItem} />
|
|
99
99
|
|
|
100
|
+
### Minimized
|
|
101
|
+
|
|
102
|
+
`variant="minimized"` renders a 48px icon rail. Items drop their label row and show the label in a tooltip to the right instead, through a `TelaTooltipGroup`, so moving between items opens the next tooltip without a delay. Icons are 18px on 32px items, the logo and the user avatar are 24px, and a `TelaSidebarDivider` separates the header's actions from the navigation. The user menu opens to the right.
|
|
103
|
+
|
|
104
|
+
```vue
|
|
105
|
+
<TelaSidebar variant="minimized" sticky top-0 h-screen>
|
|
106
|
+
<TelaSidebarHeader>
|
|
107
|
+
<TelaSidebarLogo src="/tela-logo.svg" alt="Tela" to="/" />
|
|
108
|
+
<TelaSidebarItem icon="i-ph-magnifying-glass" label="Search" :is-active="false" :on-click="openSearch" />
|
|
109
|
+
<TelaSidebarItem icon="i-ph-plus" label="New" :is-active="false" :on-click="openCreate" />
|
|
110
|
+
<TelaSidebarDivider />
|
|
111
|
+
</TelaSidebarHeader>
|
|
112
|
+
|
|
113
|
+
<TelaSidebarContent>
|
|
114
|
+
<TelaSidebarItem
|
|
115
|
+
v-for="item in items"
|
|
116
|
+
:key="item.label"
|
|
117
|
+
:icon="item.icon"
|
|
118
|
+
:label="item.label"
|
|
119
|
+
:to="item.path"
|
|
120
|
+
:is-active="isItemActive(item)"
|
|
121
|
+
/>
|
|
122
|
+
</TelaSidebarContent>
|
|
123
|
+
|
|
124
|
+
<TelaSidebarFooter>
|
|
125
|
+
<TelaSidebarItem icon="i-ph-bell" label="Activity" :is-active="route.path === '/activity'" to="/activity" />
|
|
126
|
+
<TelaSidebarItem icon="i-ph-question" label="Help" :is-active="false" :on-click="openHelp" />
|
|
127
|
+
<TelaSidebarUser :image="user.image" :name="user.name" :email="user.email" :actions="actions" />
|
|
128
|
+
</TelaSidebarFooter>
|
|
129
|
+
</TelaSidebar>
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Always pass `label` to items in the minimized rail: it becomes the tooltip and the item's accessible name.
|
|
133
|
+
|
|
100
134
|
## Components
|
|
101
135
|
|
|
102
136
|
### TelaSidebar
|
|
103
137
|
|
|
104
138
|
Root wrapper. Renders as an `<aside>` with fixed 80px width, full height, and a right border. Place `TelaSidebarHeader`, `TelaSidebarContent`, and `TelaSidebarFooter` as direct children.
|
|
105
139
|
|
|
140
|
+
```typescript
|
|
141
|
+
interface TelaSidebarProps {
|
|
142
|
+
variant?: 'default' | 'minimized' // `minimized` is a 48px icon rail with labels in tooltips (default: 'default')
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
106
146
|
### TelaSidebarHeader
|
|
107
147
|
|
|
108
148
|
Top section of the sidebar. Stacks children vertically with 24px gap and vertical padding. Use for logos or workspace switchers.
|
|
@@ -135,11 +175,21 @@ interface TelaSidebarItemProps {
|
|
|
135
175
|
to?: string // Route path — renders as a link
|
|
136
176
|
onClick?: () => void // Click handler when not using `to`
|
|
137
177
|
disabled?: boolean // Renders as a non-interactive button with reduced opacity
|
|
178
|
+
activeIcon?: string // Icon while active — defaults to the `-fill` version of `icon`
|
|
179
|
+
as?: string // Renders as this element instead, e.g. `span` inside a menu trigger that is already a button
|
|
138
180
|
}
|
|
139
181
|
```
|
|
140
182
|
|
|
141
183
|
<ArgTypes of={SidebarStories} />
|
|
142
184
|
|
|
185
|
+
### TelaSidebarDivider
|
|
186
|
+
|
|
187
|
+
A short 16px horizontal line in `bg-border` with 4px vertical margin, for separating groups of items, such as the header's actions from the navigation in the minimized rail. Decorative, so it's hidden from assistive technology.
|
|
188
|
+
|
|
189
|
+
```vue
|
|
190
|
+
<TelaSidebarDivider />
|
|
191
|
+
```
|
|
192
|
+
|
|
143
193
|
### TelaSidebarFooter
|
|
144
194
|
|
|
145
195
|
Bottom section of the sidebar. Always contains `TelaSidebarUser` for account controls. Optionally add secondary `TelaSidebarItem` actions (e.g. activity, notifications) above it.
|
|
@@ -1,5 +1,27 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { sidebarTransition, sidebarVariantKey } from './sidebar-context'
|
|
3
|
+
import type { SidebarVariant } from './sidebar-context'
|
|
4
|
+
|
|
5
|
+
const props = withDefaults(defineProps<{
|
|
6
|
+
/** `minimized` is a 48px icon rail: labels move into tooltips shown to the right of each item */
|
|
7
|
+
variant?: SidebarVariant
|
|
8
|
+
}>(), {
|
|
9
|
+
variant: 'default',
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
provide(sidebarVariantKey, toRef(props, 'variant'))
|
|
13
|
+
</script>
|
|
14
|
+
|
|
1
15
|
<template>
|
|
2
|
-
<aside
|
|
3
|
-
|
|
16
|
+
<aside
|
|
17
|
+
:data-variant="variant"
|
|
18
|
+
:class="cn(
|
|
19
|
+
'group/sidebar flex flex-col items-center h-screen w-80px data-[variant=minimized]:w-48px bg border-r-0.5px border transition-[width,background-color,border-color]',
|
|
20
|
+
sidebarTransition,
|
|
21
|
+
)"
|
|
22
|
+
>
|
|
23
|
+
<TelaTooltipGroup>
|
|
24
|
+
<slot />
|
|
25
|
+
</TelaTooltipGroup>
|
|
4
26
|
</aside>
|
|
5
27
|
</template>
|
|
@@ -9,7 +9,7 @@ const props = defineProps<{
|
|
|
9
9
|
<template>
|
|
10
10
|
<div
|
|
11
11
|
aria-hidden="true"
|
|
12
|
-
:class="cn('skeleton-pulse relative overflow-hidden rounded-8px bg-
|
|
12
|
+
:class="cn('skeleton-pulse relative overflow-hidden rounded-8px bg-muted', props.class)"
|
|
13
13
|
/>
|
|
14
14
|
</template>
|
|
15
15
|
|
|
@@ -32,35 +32,35 @@ const props = withDefaults(defineProps<{
|
|
|
32
32
|
const variantConfig: Record<TelaStatusVariant, StatusConfig> = {
|
|
33
33
|
'pending-run': {
|
|
34
34
|
label: 'Pending Run',
|
|
35
|
-
backgroundColor: 'bg-
|
|
35
|
+
backgroundColor: 'bg-muted',
|
|
36
36
|
textColor: 'text-primary',
|
|
37
37
|
iconName: 'circle',
|
|
38
38
|
iconColor: 'neutral-400',
|
|
39
39
|
},
|
|
40
40
|
'preparing-run': {
|
|
41
41
|
label: 'Preparing to Run',
|
|
42
|
-
backgroundColor: 'bg-
|
|
42
|
+
backgroundColor: 'bg-muted',
|
|
43
43
|
textColor: 'text-neutral-700',
|
|
44
44
|
iconName: 'circle',
|
|
45
45
|
iconColor: 'neutral-500',
|
|
46
46
|
},
|
|
47
47
|
'waiting': {
|
|
48
48
|
label: 'Waiting',
|
|
49
|
-
backgroundColor: 'bg-
|
|
49
|
+
backgroundColor: 'bg-muted',
|
|
50
50
|
textColor: 'text-neutral-700',
|
|
51
51
|
iconName: 'pause',
|
|
52
52
|
iconColor: 'neutral-500',
|
|
53
53
|
},
|
|
54
54
|
'on-hold': {
|
|
55
55
|
label: 'On Hold',
|
|
56
|
-
backgroundColor: 'bg-
|
|
56
|
+
backgroundColor: 'bg-muted',
|
|
57
57
|
textColor: 'text-neutral-700',
|
|
58
58
|
iconName: 'pause',
|
|
59
59
|
iconColor: 'neutral-500',
|
|
60
60
|
},
|
|
61
61
|
'queued': {
|
|
62
62
|
label: 'Queued',
|
|
63
|
-
backgroundColor: 'bg-
|
|
63
|
+
backgroundColor: 'bg-muted',
|
|
64
64
|
textColor: 'text-neutral-700',
|
|
65
65
|
iconName: 'queued',
|
|
66
66
|
iconColor: 'neutral-500',
|
|
@@ -74,35 +74,35 @@ const variantConfig: Record<TelaStatusVariant, StatusConfig> = {
|
|
|
74
74
|
},
|
|
75
75
|
'running': {
|
|
76
76
|
label: 'Running',
|
|
77
|
-
backgroundColor: 'bg-
|
|
77
|
+
backgroundColor: 'bg-muted',
|
|
78
78
|
textColor: 'text-primary',
|
|
79
79
|
iconName: 'circle-notch',
|
|
80
80
|
iconColor: 'neutral-400',
|
|
81
81
|
},
|
|
82
82
|
'executing': {
|
|
83
83
|
label: 'Executing',
|
|
84
|
-
backgroundColor: 'bg-
|
|
84
|
+
backgroundColor: 'bg-muted',
|
|
85
85
|
textColor: 'text-primary',
|
|
86
86
|
iconName: 'circle-notch',
|
|
87
87
|
iconColor: 'neutral-400',
|
|
88
88
|
},
|
|
89
89
|
'processing': {
|
|
90
90
|
label: 'Processing',
|
|
91
|
-
backgroundColor: 'bg-
|
|
91
|
+
backgroundColor: 'bg-muted',
|
|
92
92
|
textColor: 'text-primary',
|
|
93
93
|
iconName: 'circle-notch',
|
|
94
94
|
iconColor: 'neutral-400',
|
|
95
95
|
},
|
|
96
96
|
'verifying': {
|
|
97
97
|
label: 'Verifying',
|
|
98
|
-
backgroundColor: 'bg-
|
|
98
|
+
backgroundColor: 'bg-muted',
|
|
99
99
|
textColor: 'text-primary',
|
|
100
100
|
iconName: 'circle-notch',
|
|
101
101
|
iconColor: 'neutral-400',
|
|
102
102
|
},
|
|
103
103
|
'initializing': {
|
|
104
104
|
label: 'Initializing',
|
|
105
|
-
backgroundColor: 'bg-
|
|
105
|
+
backgroundColor: 'bg-muted',
|
|
106
106
|
textColor: 'text-primary',
|
|
107
107
|
iconName: 'circle-notch',
|
|
108
108
|
iconColor: 'neutral-400',
|
|
@@ -123,21 +123,21 @@ const variantConfig: Record<TelaStatusVariant, StatusConfig> = {
|
|
|
123
123
|
},
|
|
124
124
|
'paused': {
|
|
125
125
|
label: 'Paused',
|
|
126
|
-
backgroundColor: 'bg-
|
|
126
|
+
backgroundColor: 'bg-muted',
|
|
127
127
|
textColor: 'text-neutral-700',
|
|
128
128
|
iconName: 'pause',
|
|
129
129
|
iconColor: 'neutral-500',
|
|
130
130
|
},
|
|
131
131
|
'stopped': {
|
|
132
132
|
label: 'Stopped',
|
|
133
|
-
backgroundColor: 'bg-
|
|
133
|
+
backgroundColor: 'bg-muted',
|
|
134
134
|
textColor: 'text-primary',
|
|
135
135
|
iconName: 'stop',
|
|
136
136
|
iconColor: 'neutral-700',
|
|
137
137
|
},
|
|
138
138
|
'suspended': {
|
|
139
139
|
label: 'Suspended',
|
|
140
|
-
backgroundColor: 'bg-
|
|
140
|
+
backgroundColor: 'bg-muted',
|
|
141
141
|
textColor: 'text-secondary',
|
|
142
142
|
iconName: 'circle-dashed',
|
|
143
143
|
iconColor: 'neutral-100',
|
|
@@ -158,7 +158,7 @@ const variantConfig: Record<TelaStatusVariant, StatusConfig> = {
|
|
|
158
158
|
},
|
|
159
159
|
'no-coverage': {
|
|
160
160
|
label: 'No coverage',
|
|
161
|
-
backgroundColor: 'bg-
|
|
161
|
+
backgroundColor: 'bg-muted',
|
|
162
162
|
textColor: 'text-neutral-700',
|
|
163
163
|
iconName: 'circle',
|
|
164
164
|
iconColor: 'neutral-400',
|
|
@@ -263,35 +263,35 @@ const variantConfig: Record<TelaStatusVariant, StatusConfig> = {
|
|
|
263
263
|
},
|
|
264
264
|
'cancelled': {
|
|
265
265
|
label: 'Cancelled',
|
|
266
|
-
backgroundColor: 'bg-
|
|
266
|
+
backgroundColor: 'bg-muted',
|
|
267
267
|
textColor: 'text-secondary',
|
|
268
268
|
iconName: 'close',
|
|
269
269
|
iconColor: 'neutral-400',
|
|
270
270
|
},
|
|
271
271
|
'archived': {
|
|
272
272
|
label: 'Archived',
|
|
273
|
-
backgroundColor: 'bg-
|
|
273
|
+
backgroundColor: 'bg-muted',
|
|
274
274
|
textColor: 'text-secondary',
|
|
275
275
|
iconName: 'arrow-down',
|
|
276
276
|
iconColor: 'neutral-400',
|
|
277
277
|
},
|
|
278
278
|
'reported': {
|
|
279
279
|
label: 'Reported',
|
|
280
|
-
backgroundColor: 'bg-
|
|
280
|
+
backgroundColor: 'bg-muted',
|
|
281
281
|
textColor: 'text-secondary',
|
|
282
282
|
iconName: 'reported',
|
|
283
283
|
iconColor: 'neutral-400',
|
|
284
284
|
},
|
|
285
285
|
'expired': {
|
|
286
286
|
label: 'Expired',
|
|
287
|
-
backgroundColor: 'bg-
|
|
287
|
+
backgroundColor: 'bg-muted',
|
|
288
288
|
textColor: 'text-secondary',
|
|
289
289
|
iconName: 'circle-warning',
|
|
290
290
|
iconColor: 'neutral-400',
|
|
291
291
|
},
|
|
292
292
|
'partially-completed': {
|
|
293
293
|
label: 'Partially Completed',
|
|
294
|
-
backgroundColor: 'bg-
|
|
294
|
+
backgroundColor: 'bg-muted',
|
|
295
295
|
textColor: 'text-primary',
|
|
296
296
|
iconName: 'semi-circle',
|
|
297
297
|
iconColor: 'neutral-400',
|
|
@@ -19,6 +19,42 @@ const delegatedProps = reactiveOmit(props, 'class')
|
|
|
19
19
|
|
|
20
20
|
const forwarded = useForwardPropsEmits(delegatedProps, emits)
|
|
21
21
|
|
|
22
|
+
const hasToggled = ref(false)
|
|
23
|
+
const thumbRef = ref<InstanceType<typeof SwitchThumb>>()
|
|
24
|
+
|
|
25
|
+
const start = ref({ x: 0, shift: 0, scale: 1, reach: 1 })
|
|
26
|
+
|
|
27
|
+
function captureStart() {
|
|
28
|
+
hasToggled.value = true
|
|
29
|
+
|
|
30
|
+
const el: HTMLElement | undefined = thumbRef.value?.$el
|
|
31
|
+
|
|
32
|
+
if (!el)
|
|
33
|
+
return
|
|
34
|
+
|
|
35
|
+
const pillStyle = getComputedStyle(el, '::before')
|
|
36
|
+
const pill = new DOMMatrix(pillStyle.transform)
|
|
37
|
+
const originX = Number.parseFloat(pillStyle.transformOrigin)
|
|
38
|
+
const width = el.offsetWidth
|
|
39
|
+
const left = originX + pill.m41 - originX * pill.a
|
|
40
|
+
const isTurningOn = el.dataset.state !== 'checked'
|
|
41
|
+
const x = new DOMMatrix(getComputedStyle(el).transform).m41
|
|
42
|
+
const track = el.parentElement
|
|
43
|
+
const trackStyle = track ? getComputedStyle(track) : undefined
|
|
44
|
+
const travel = track && trackStyle
|
|
45
|
+
? track.clientWidth - Number.parseFloat(trackStyle.paddingLeft) - Number.parseFloat(trackStyle.paddingRight) - width
|
|
46
|
+
: 0
|
|
47
|
+
|
|
48
|
+
start.value = {
|
|
49
|
+
x,
|
|
50
|
+
shift: isTurningOn ? left : left - width + width * pill.a,
|
|
51
|
+
scale: pill.a,
|
|
52
|
+
reach: travel > 0 ? Math.min(1, Math.max(0, (isTurningOn ? travel - x : x) / travel)) : 1,
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
watch(() => props.modelValue, captureStart, { flush: 'pre' })
|
|
57
|
+
|
|
22
58
|
const resolvedSize = computed(() => props.size || 'sm')
|
|
23
59
|
|
|
24
60
|
const sizeStyle = computed(() => (({
|
|
@@ -27,30 +63,90 @@ const sizeStyle = computed(() => (({
|
|
|
27
63
|
}) as Record<SwitchSize, string>)[resolvedSize.value] ?? '')
|
|
28
64
|
|
|
29
65
|
const thumbSizeStyle = computed(() => (({
|
|
30
|
-
sm: 'w-16px h-16px data-[state=checked]:translate-x-3
|
|
31
|
-
md: 'w-18px h-18px data-[state=checked]:translate-x-4
|
|
66
|
+
sm: 'w-16px h-16px [--switch-width:16px] [--switch-travel:0.75rem] [--switch-stretch:0.75] data-[state=checked]:translate-x-3',
|
|
67
|
+
md: 'w-18px h-18px [--switch-width:18px] [--switch-travel:1rem] [--switch-stretch:0.889] data-[state=checked]:translate-x-4',
|
|
32
68
|
}) as Record<SwitchSize, string>)[resolvedSize.value] ?? '')
|
|
69
|
+
|
|
70
|
+
const isHovered = ref(false)
|
|
71
|
+
const isStretchArmed = ref(true)
|
|
72
|
+
|
|
73
|
+
function onPointerLeave() {
|
|
74
|
+
isHovered.value = false
|
|
75
|
+
isStretchArmed.value = true
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function onToggle() {
|
|
79
|
+
captureStart()
|
|
80
|
+
isStretchArmed.value = false
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const hoverStretch = computed(() => resolvedSize.value === 'md' ? 1.111 : 1.125)
|
|
84
|
+
|
|
85
|
+
const thumbStyle = computed(() => ({
|
|
86
|
+
'--switch-rest': isHovered.value && isStretchArmed.value && !props.disabled ? hoverStretch.value : 1,
|
|
87
|
+
'--switch-start': `${start.value.x}px`,
|
|
88
|
+
'--switch-shift': `${start.value.shift}px`,
|
|
89
|
+
'--switch-from': start.value.scale,
|
|
90
|
+
'--switch-reach': start.value.reach,
|
|
91
|
+
}))
|
|
33
92
|
</script>
|
|
34
93
|
|
|
35
94
|
<template>
|
|
36
95
|
<SwitchRoot
|
|
37
96
|
v-bind="forwarded"
|
|
38
97
|
:class="cn(
|
|
39
|
-
'group peer inline-flex w-32px h-20px shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-cyan-600 disabled:cursor-not-allowed disabled:opacity-50',
|
|
98
|
+
'group peer inline-flex w-32px h-20px shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors duration-300 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-cyan-600 disabled:cursor-not-allowed disabled:opacity-50',
|
|
40
99
|
'data-[state=unchecked]:bg-neutral-200 not-disabled:data-[state=unchecked]:hover:bg-neutral-300 data-[state=checked]:bg-green-500 not-disabled:data-[state=checked]:hover:bg-green-600',
|
|
41
100
|
sizeStyle,
|
|
42
101
|
props.class,
|
|
43
102
|
)"
|
|
103
|
+
@update:model-value="onToggle"
|
|
104
|
+
@pointerenter="isHovered = true"
|
|
105
|
+
@pointerleave="onPointerLeave"
|
|
44
106
|
>
|
|
45
107
|
<SwitchThumb
|
|
108
|
+
ref="thumbRef"
|
|
46
109
|
:class="cn(
|
|
47
110
|
'relative isolate flex items-center justify-center rounded-full ring-0 transition-[transform,filter] duration-350 ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:transition-none data-[state=checked]:drop-shadow-md',
|
|
48
|
-
'before:content-empty before:absolute before:inset-0 before:-z-1 before:rounded-full before:bg before:origin-left data-[state=checked]:before:origin-right',
|
|
49
|
-
'before:transition-[transform,background-color] before:duration-
|
|
111
|
+
'before:content-empty before:absolute before:inset-0 before:-z-1 before:rounded-full before:bg before:scale-x-[var(--switch-rest)] before:origin-left data-[state=checked]:before:origin-right',
|
|
112
|
+
'before:transition-[transform,background-color] before:duration-160 before:ease-out motion-reduce:before:transition-none hover:before:bg-muted',
|
|
113
|
+
hasToggled && [
|
|
114
|
+
'motion-safe:data-[state=checked]:animate-[switchThumbOn_0.5s_linear] motion-safe:data-[state=checked]:before:animate-[switchPillOn_0.5s_linear]',
|
|
115
|
+
'motion-safe:data-[state=unchecked]:animate-[switchThumbOff_0.5s_linear] motion-safe:data-[state=unchecked]:before:animate-[switchPillOff_0.5s_linear]',
|
|
116
|
+
],
|
|
50
117
|
thumbSizeStyle,
|
|
51
118
|
)"
|
|
119
|
+
:style="thumbStyle"
|
|
52
120
|
>
|
|
53
121
|
<slot name="thumb" />
|
|
54
122
|
</SwitchThumb>
|
|
55
123
|
</SwitchRoot>
|
|
56
124
|
</template>
|
|
125
|
+
|
|
126
|
+
<style>
|
|
127
|
+
@keyframes switchThumbOn {
|
|
128
|
+
0% { transform: translateX(var(--switch-start)); }
|
|
129
|
+
51%, 100% { transform: translateX(var(--switch-travel)); }
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
@keyframes switchThumbOff {
|
|
133
|
+
0% { transform: translateX(var(--switch-start)); }
|
|
134
|
+
51%, 100% { transform: translateX(0); }
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
@keyframes switchPillOn {
|
|
138
|
+
0% { transform-origin: left center; transform: translateX(var(--switch-shift)) scaleX(var(--switch-from)); }
|
|
139
|
+
24% { transform: translateX(0) scaleX(calc(1 + var(--switch-stretch) * var(--switch-reach) * 0.46)); }
|
|
140
|
+
51% { transform: translateX(calc(var(--switch-width) * (1 - var(--switch-rest)))) scaleX(calc(var(--switch-rest) - var(--switch-stretch) * 0.08)); animation-timing-function: ease-out; }
|
|
141
|
+
66% { transform: translateX(calc(var(--switch-width) * (1 - var(--switch-rest)))) scaleX(calc(var(--switch-rest) + var(--switch-stretch) * 0.02)); animation-timing-function: ease-in-out; }
|
|
142
|
+
100% { transform-origin: left center; transform: translateX(calc(var(--switch-width) * (1 - var(--switch-rest)))) scaleX(var(--switch-rest)); }
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
@keyframes switchPillOff {
|
|
146
|
+
0% { transform-origin: right center; transform: translateX(var(--switch-shift)) scaleX(var(--switch-from)); }
|
|
147
|
+
24% { transform: translateX(0) scaleX(calc(1 + var(--switch-stretch) * var(--switch-reach) * 0.46)); }
|
|
148
|
+
51% { transform: translateX(calc(var(--switch-width) * (var(--switch-rest) - 1))) scaleX(calc(var(--switch-rest) - var(--switch-stretch) * 0.08)); animation-timing-function: ease-out; }
|
|
149
|
+
66% { transform: translateX(calc(var(--switch-width) * (var(--switch-rest) - 1))) scaleX(calc(var(--switch-rest) + var(--switch-stretch) * 0.02)); animation-timing-function: ease-in-out; }
|
|
150
|
+
100% { transform-origin: right center; transform: translateX(calc(var(--switch-width) * (var(--switch-rest) - 1))) scaleX(var(--switch-rest)); }
|
|
151
|
+
}
|
|
152
|
+
</style>
|
|
@@ -46,7 +46,7 @@ const isGrouped = computed(() => activeId !== null && activeId.value !== null &&
|
|
|
46
46
|
<TooltipPortal :disabled="disablePortal">
|
|
47
47
|
<TooltipContent
|
|
48
48
|
v-bind="{ ...forwarded, ...$attrs }"
|
|
49
|
-
:class="cn('tooltip-content origin-[var(--reka-tooltip-content-transform-origin)] z-1000 relative rounded-[8px] py-[5px] px-[10px] pointer-events-auto body-12-semibold text-white bg-
|
|
49
|
+
:class="cn('tooltip-content origin-[var(--reka-tooltip-content-transform-origin)] z-1000 relative rounded-[8px] py-[5px] px-[10px] pointer-events-auto body-12-semibold text-white bg-stone-800', props.class)"
|
|
50
50
|
:data-grouped="isGrouped || undefined"
|
|
51
51
|
@click="$emit('click', $event)"
|
|
52
52
|
>
|
|
@@ -10,6 +10,8 @@ export type TooltipProps = TooltipBodyProps & {
|
|
|
10
10
|
open?: boolean
|
|
11
11
|
disableClosingTrigger?: boolean
|
|
12
12
|
triggerClass?: string
|
|
13
|
+
/** Merge the trigger onto the slotted element instead of wrapping it in a `<button>`, for children that are already interactive */
|
|
14
|
+
asChild?: boolean
|
|
13
15
|
}
|
|
14
16
|
|
|
15
17
|
const props = withDefaults(defineProps<TooltipProps>(), {
|
|
@@ -21,11 +23,16 @@ defineEmits<{
|
|
|
21
23
|
(e: 'clickContent', event: Event): void
|
|
22
24
|
}>()
|
|
23
25
|
|
|
26
|
+
const isOpen = ref(false)
|
|
27
|
+
|
|
24
28
|
const tooltipRootProps = computed(() => {
|
|
25
|
-
const rootProps: any = {
|
|
29
|
+
const rootProps: any = {
|
|
30
|
+
'open': props.open ?? (isOpen.value && !props.disabled),
|
|
31
|
+
'onUpdate:open': (open: boolean) => { isOpen.value = open },
|
|
32
|
+
}
|
|
26
33
|
|
|
27
|
-
if (props.
|
|
28
|
-
rootProps.
|
|
34
|
+
if (props.disabled) {
|
|
35
|
+
rootProps.disabled = true
|
|
29
36
|
}
|
|
30
37
|
|
|
31
38
|
if (props.disableClosingTrigger) {
|
|
@@ -38,7 +45,7 @@ const tooltipRootProps = computed(() => {
|
|
|
38
45
|
|
|
39
46
|
<template>
|
|
40
47
|
<TelaTooltipRoot v-bind="tooltipRootProps">
|
|
41
|
-
<TelaTooltipTrigger :class="triggerClass">
|
|
48
|
+
<TelaTooltipTrigger :class="triggerClass" :as-child="asChild">
|
|
42
49
|
<slot />
|
|
43
50
|
</TelaTooltipTrigger>
|
|
44
51
|
<TelaTooltipBody
|
|
@@ -225,6 +225,13 @@ type TooltipGroupProps = {
|
|
|
225
225
|
3. **Consistent Positioning**: Use same side for all in group
|
|
226
226
|
4. **Brief Content**: Keep tooltip text concise
|
|
227
227
|
5. **Icon Buttons**: Especially useful with icon-only buttons
|
|
228
|
+
6. **Interactive Children**: The trigger wraps its slot in a `<button>`. When the child is already a button or link, pass `as-child` so the trigger merges onto it instead of nesting buttons:
|
|
229
|
+
|
|
230
|
+
```vue
|
|
231
|
+
<TelaTooltipGroupTrigger content="Home" side="right" as-child>
|
|
232
|
+
<NuxtLink to="/">...</NuxtLink>
|
|
233
|
+
</TelaTooltipGroupTrigger>
|
|
234
|
+
```
|
|
228
235
|
|
|
229
236
|
## Accessibility
|
|
230
237
|
|
package/package.json
CHANGED
package/utils/design-tokens.ts
CHANGED
|
@@ -317,18 +317,18 @@ const LEGACY_COLORS = {
|
|
|
317
317
|
}
|
|
318
318
|
|
|
319
319
|
const BTN_COLORS = {
|
|
320
|
-
'btn-primary': BASE_COLORS.
|
|
321
|
-
'btn-primary-hover': BASE_COLORS.
|
|
322
|
-
'btn-primary-active': BASE_COLORS.
|
|
320
|
+
'btn-primary': BASE_COLORS.stone[900],
|
|
321
|
+
'btn-primary-hover': BASE_COLORS.stone[800],
|
|
322
|
+
'btn-primary-active': BASE_COLORS.stone[700],
|
|
323
323
|
'btn-secondary': BASE_COLORS.white.DEFAULT,
|
|
324
|
-
'btn-secondary-hover': BASE_COLORS.
|
|
325
|
-
'btn-secondary-active': BASE_COLORS.
|
|
324
|
+
'btn-secondary-hover': BASE_COLORS.stone[50],
|
|
325
|
+
'btn-secondary-active': BASE_COLORS.stone[100],
|
|
326
326
|
'btn-ghost': BASE_COLORS.transparent,
|
|
327
|
-
'btn-ghost-hover': BASE_COLORS.
|
|
327
|
+
'btn-ghost-hover': BASE_COLORS.stone[100],
|
|
328
328
|
'btn-danger': BASE_COLORS.red[100],
|
|
329
329
|
'btn-danger-hover': BASE_COLORS.red[50],
|
|
330
|
-
'btn-disabled': BASE_COLORS.
|
|
331
|
-
'btn-loading': BASE_COLORS.
|
|
330
|
+
'btn-disabled': BASE_COLORS.stone[100],
|
|
331
|
+
'btn-loading': BASE_COLORS.stone[200],
|
|
332
332
|
'btn-dark': 'rgba(255, 255, 255, 0.04)',
|
|
333
333
|
'btn-dark-hover': 'rgba(255, 255, 255, 0.08)',
|
|
334
334
|
'btn-dark-active': 'rgba(255, 255, 255, 0.1)',
|
|
@@ -336,9 +336,9 @@ const BTN_COLORS = {
|
|
|
336
336
|
|
|
337
337
|
const BACKGROUND_COLORS = {
|
|
338
338
|
DEFAULT: BASE_COLORS.white.DEFAULT,
|
|
339
|
-
subtle: BASE_COLORS.
|
|
340
|
-
muted: BASE_COLORS.
|
|
341
|
-
lowered: BASE_COLORS.
|
|
339
|
+
subtle: BASE_COLORS.stone[50],
|
|
340
|
+
muted: BASE_COLORS.stone[100],
|
|
341
|
+
lowered: BASE_COLORS.stone[200],
|
|
342
342
|
success: BASE_COLORS.green[200],
|
|
343
343
|
error: BASE_COLORS.red[200],
|
|
344
344
|
warning: BASE_COLORS.amber[200],
|