@aleph-alpha/ui-library 2.4.4 → 2.5.2
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/config.d.ts +33 -2
- package/config.js +145 -47
- package/dist/system/components/UiAvatar/UiAvatar.vue.d.ts +4 -1
- package/dist/system/components/UiAvatar/UiAvatarGroup.vue.d.ts +18 -0
- package/dist/system/components/UiAvatar/index.d.ts +1 -0
- package/dist/system/components/UiAvatar/types.d.ts +12 -1
- package/dist/system/components/UiFileItem/UiFileItem.vue.d.ts +6 -1
- package/dist/system/components/UiFileItem/types.d.ts +30 -10
- package/dist/system/components/UiFileType/UiFileType.vue.d.ts +8 -0
- package/dist/system/components/UiFileType/index.d.ts +2 -0
- package/dist/system/components/UiFileType/types.d.ts +33 -0
- package/dist/system/components/UiItem/UiItem.vue.d.ts +8 -1
- package/dist/system/components/UiItem/constants.d.ts +4 -3
- package/dist/system/components/UiItem/index.d.ts +1 -1
- package/dist/system/components/UiItem/types.d.ts +53 -13
- package/dist/system/components/core/avatar/Avatar.vue.d.ts +2 -0
- package/dist/system/components/core/avatar/index.d.ts +1 -0
- package/dist/system/components/core/calendar/Calendar.vue.d.ts +247 -3
- package/dist/system/components/core/item/Item.vue.d.ts +1 -1
- package/dist/system/components/core/item/ItemAction.vue.d.ts +25 -0
- package/dist/system/components/core/item/index.d.ts +8 -4
- package/dist/system/components/core/popover/PopoverContent.vue.d.ts +1 -1
- package/dist/system/components/core/range-calendar/RangeCalendar.vue.d.ts +139 -2
- package/dist/system/components/index.d.ts +1 -0
- package/dist/system/lib/activeIndicator.d.ts +1 -0
- package/dist/system/lib.js +6700 -6448
- package/dist/system/patterns/UiSidebar/activeIndicator.d.ts +1 -15
- package/package.json +1 -1
- package/src/components/UiAvatar/UiAvatar.stories.ts +103 -12
- package/src/components/UiAvatar/UiAvatar.vue +6 -1
- package/src/components/UiAvatar/UiAvatarGroup.vue +16 -0
- package/src/components/UiAvatar/UiAvatarImage.vue +1 -1
- package/src/components/UiAvatar/__tests__/UiAvatar.test.ts +86 -0
- package/src/components/UiAvatar/index.ts +1 -0
- package/src/components/UiAvatar/types.ts +15 -1
- package/src/components/UiButton/UiButton.stories.ts +60 -0
- package/src/components/UiCodeBlock/UiCodeBlock.vue +7 -2
- package/src/components/UiField/UiField.stories.ts +15 -9
- package/src/components/UiFileItem/UiFileItem.stories.ts +344 -185
- package/src/components/UiFileItem/UiFileItem.vue +110 -70
- package/src/components/UiFileItem/__tests__/UiFileItem.test.ts +64 -3
- package/src/components/UiFileItem/types.ts +33 -10
- package/src/components/UiFileType/UiFileType.stories.ts +193 -0
- package/src/components/UiFileType/UiFileType.vue +114 -0
- package/src/components/UiFileType/__tests__/UiFileType.test.ts +41 -0
- package/src/components/UiFileType/index.ts +2 -0
- package/src/components/UiFileType/types.ts +38 -0
- package/src/components/UiFileUploadBox/UiFileUploadBox.vue +58 -56
- package/src/components/UiItem/UiItem.stories.ts +555 -855
- package/src/components/UiItem/UiItem.vue +59 -4
- package/src/components/UiItem/UiItemMedia.vue +1 -1
- package/src/components/UiItem/__tests__/UiItem.test.ts +432 -26
- package/src/components/UiItem/constants.ts +16 -2
- package/src/components/UiItem/index.ts +1 -1
- package/src/components/UiItem/types.ts +64 -13
- package/src/components/UiKbd/UiKbd.stories.ts +1 -1
- package/src/components/UiListbox/UiListbox.stories.ts +1 -1
- package/src/components/UiNavigationMenu/UiNavigationMenu.stories.ts +4 -4
- package/src/components/UiSelect/UiSelectTrigger.vue +8 -2
- package/src/components/UiSelect/__tests__/UiSelectGroup.test.ts +2 -2
- package/src/components/UiSnackbar/UiSnackbar.stories.ts +1 -0
- package/src/components/UiTable/UiTable.stories.ts +6 -2
- package/src/components/UiTable/__tests__/UiTableRow.test.ts +4 -2
- package/src/components/UiTabs/UiTabs.stories.ts +2 -2
- package/src/components/UiTagsInput/UiTagsInput.stories.ts +12 -2
- package/src/components/core/avatar/Avatar.vue +17 -1
- package/src/components/core/avatar/AvatarFallback.vue +1 -1
- package/src/components/core/{item/ItemActions.vue → avatar/AvatarGroup.vue} +7 -2
- package/src/components/core/avatar/index.ts +1 -0
- package/src/components/core/button/index.ts +1 -1
- package/src/components/core/calendar/Calendar.vue +17 -1
- package/src/components/core/checkbox/Checkbox.vue +1 -0
- package/src/components/core/drawer/DrawerContent.vue +1 -1
- package/src/components/core/item/Item.vue +2 -2
- package/src/components/core/item/ItemAction.vue +30 -0
- package/src/components/core/item/ItemContent.vue +1 -1
- package/src/components/core/item/ItemDescription.vue +1 -1
- package/src/components/core/item/ItemGroup.vue +0 -1
- package/src/components/core/item/index.ts +32 -9
- package/src/components/core/kbd/Kbd.vue +1 -1
- package/src/components/core/listbox/ListboxContent.vue +1 -0
- package/src/components/core/native-select/NativeSelect.vue +6 -0
- package/src/components/core/range-calendar/RangeCalendar.vue +19 -0
- package/src/components/core/skeleton/Skeleton.vue +3 -1
- package/src/components/core/slider/Slider.vue +2 -1
- package/src/components/core/table/TableFooter.vue +4 -1
- package/src/components/core/table/TableRow.vue +1 -1
- package/src/components/index.ts +1 -0
- package/src/directives/vHover.stories.ts +16 -12
- package/src/lib/activeIndicator.ts +1 -0
- package/src/patterns/UiDataTable/UiDataTable.stories.ts +2 -2
- package/src/patterns/UiSidebar/UiSidebarMenuButton.vue +2 -2
- package/src/patterns/UiSidebar/UiSidebarMenuSubItem.vue +2 -2
- package/src/patterns/UiSidebar/UiSidebarPopoverMenuItem.vue +2 -2
- package/src/patterns/UiSidebar/UiSidebarPopoverTrigger.vue +2 -2
- package/src/patterns/UiSidebar/__tests__/UiSidebarMenuButton.test.ts +33 -0
- package/src/patterns/UiSidebar/activeIndicator.ts +1 -16
- package/src/theme/Background.stories.ts +16 -0
- package/src/theme/BorderRadius.stories.ts +12 -12
- package/src/theme/Flex.stories.ts +1 -1
- package/src/theme/Theme.stories.ts +3 -3
- package/tokens.json +4273 -1152
- /package/dist/system/components/core/{item/ItemActions.vue.d.ts → avatar/AvatarGroup.vue.d.ts} +0 -0
|
@@ -2,7 +2,7 @@ import type { VariantProps } from 'class-variance-authority';
|
|
|
2
2
|
import { cva } from 'class-variance-authority';
|
|
3
3
|
|
|
4
4
|
export { default as Item } from './Item.vue';
|
|
5
|
-
export { default as
|
|
5
|
+
export { default as ItemAction } from './ItemAction.vue';
|
|
6
6
|
export { default as ItemContent } from './ItemContent.vue';
|
|
7
7
|
export { default as ItemDescription } from './ItemDescription.vue';
|
|
8
8
|
export { default as ItemFooter } from './ItemFooter.vue';
|
|
@@ -13,17 +13,23 @@ export { default as ItemSeparator } from './ItemSeparator.vue';
|
|
|
13
13
|
export { default as ItemTitle } from './ItemTitle.vue';
|
|
14
14
|
|
|
15
15
|
export const itemVariants = cva(
|
|
16
|
-
'group/item flex items-center
|
|
16
|
+
'group/item flex items-center text-sm rounded-md transition-[background-color,color,box-shadow] [a]:transition-colors duration-100 flex-wrap outline-none focus-visible:ring-ring/50 focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50',
|
|
17
17
|
{
|
|
18
18
|
variants: {
|
|
19
19
|
variant: {
|
|
20
20
|
default: 'bg-transparent',
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
active:
|
|
22
|
+
'ui-active-indicator ui-active-indicator-active cursor-pointer bg-background-surface-muted-subtle',
|
|
23
|
+
outline: 'bg-transparent ring-1 ring-inset ring-border-surface-default',
|
|
24
|
+
hover:
|
|
25
|
+
'cursor-pointer bg-transparent hover:bg-background-surface-muted-subtle',
|
|
26
|
+
'hover-action':
|
|
27
|
+
'cursor-pointer bg-transparent hover:bg-background-surface-muted-subtle has-[button:hover]:hover:bg-transparent has-[[data-slot=item-action]:hover]:hover:bg-transparent',
|
|
23
28
|
},
|
|
24
29
|
size: {
|
|
25
|
-
default: 'p-
|
|
26
|
-
sm: '
|
|
30
|
+
default: 'p-3 gap-4 ',
|
|
31
|
+
sm: 'p-2 gap-2.5',
|
|
32
|
+
minimal: 'p-2 gap-2.5',
|
|
27
33
|
},
|
|
28
34
|
},
|
|
29
35
|
defaultVariants: {
|
|
@@ -34,14 +40,16 @@ export const itemVariants = cva(
|
|
|
34
40
|
);
|
|
35
41
|
|
|
36
42
|
export const itemMediaVariants = cva(
|
|
37
|
-
'flex shrink-0 items-center justify-center gap-2 group-has-[[data-slot=item-description]]/item:self-start [&_svg]:pointer-events-none group-has-[[data-slot=item-description]]/item:translate-y-0.5',
|
|
43
|
+
'flex shrink-0 rounded-full items-center justify-center gap-2 group-has-[[data-slot=item-description]]/item:self-start [&_svg]:pointer-events-none group-has-[[data-slot=item-description]]/item:translate-y-0.5',
|
|
38
44
|
{
|
|
39
45
|
variants: {
|
|
40
46
|
variant: {
|
|
41
47
|
default: 'bg-transparent',
|
|
42
|
-
icon: "size-8
|
|
48
|
+
icon: "size-8 bg-background-surface-muted [&_svg:not([class*='size-'])]:size-4",
|
|
43
49
|
image:
|
|
44
|
-
'size-10
|
|
50
|
+
'size-10 overflow-hidden [&_[data-slot=avatar]]:size-full [&_[data-slot=avatar]]:rounded-full [&_img]:size-full [&_img]:object-cover',
|
|
51
|
+
'avatar-group':
|
|
52
|
+
'rounded-none items-center justify-start overflow-visible [&_[data-slot=avatar-group]]:shrink-0',
|
|
45
53
|
},
|
|
46
54
|
},
|
|
47
55
|
defaultVariants: {
|
|
@@ -50,5 +58,20 @@ export const itemMediaVariants = cva(
|
|
|
50
58
|
},
|
|
51
59
|
);
|
|
52
60
|
|
|
61
|
+
export const itemActionVariants = cva('flex items-center gap-2', {
|
|
62
|
+
variants: {
|
|
63
|
+
variant: {
|
|
64
|
+
default: '',
|
|
65
|
+
text: 'label-12-regular text-content-on-surface-muted',
|
|
66
|
+
button:
|
|
67
|
+
"size-6 justify-center rounded-sm text-content-on-surface-primary hover:bg-background-surface-muted-subtle has-[button]:hover:bg-transparent [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
defaultVariants: {
|
|
71
|
+
variant: 'default',
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
|
|
53
75
|
export type ItemVariants = VariantProps<typeof itemVariants>;
|
|
54
76
|
export type ItemMediaVariants = VariantProps<typeof itemMediaVariants>;
|
|
77
|
+
export type ItemActionVariants = VariantProps<typeof itemActionVariants>;
|
|
@@ -10,7 +10,7 @@ const props = defineProps<{ class?: HTMLAttributes['class'] }>();
|
|
|
10
10
|
data-slot="kbd"
|
|
11
11
|
:class="
|
|
12
12
|
cn(
|
|
13
|
-
'pointer-events-none inline-flex h-5 select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono text-[10px] font-medium text-muted-foreground',
|
|
13
|
+
'pointer-events-none inline-flex h-5 select-none items-center gap-1 rounded border bg-background-surface-muted px-1.5 font-mono text-[10px] font-medium text-muted-foreground',
|
|
14
14
|
props.class,
|
|
15
15
|
)
|
|
16
16
|
"
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import type { AcceptableValue } from 'reka-ui';
|
|
3
3
|
import type { HTMLAttributes } from 'vue';
|
|
4
4
|
import { reactiveOmit, useVModel } from '@vueuse/core';
|
|
5
|
+
import { computed, useAttrs } from 'vue';
|
|
5
6
|
import { UiIcon } from '@/components/UiIcon';
|
|
6
7
|
import { cn } from '@/lib/utils';
|
|
7
8
|
|
|
@@ -22,6 +23,10 @@ const modelValue = useVModel(props, 'modelValue', emit, {
|
|
|
22
23
|
passive: true,
|
|
23
24
|
defaultValue: '',
|
|
24
25
|
});
|
|
26
|
+
const attrs = useAttrs();
|
|
27
|
+
const ariaLabel = computed(
|
|
28
|
+
() => (attrs['aria-label'] as string | undefined) ?? 'Select value',
|
|
29
|
+
);
|
|
25
30
|
|
|
26
31
|
const delegatedProps = reactiveOmit(props, 'class');
|
|
27
32
|
</script>
|
|
@@ -34,6 +39,7 @@ const delegatedProps = reactiveOmit(props, 'class');
|
|
|
34
39
|
<select
|
|
35
40
|
v-bind="{ ...$attrs, ...delegatedProps }"
|
|
36
41
|
v-model="modelValue"
|
|
42
|
+
:aria-label="ariaLabel"
|
|
37
43
|
data-slot="native-select"
|
|
38
44
|
:class="
|
|
39
45
|
cn(
|
|
@@ -3,6 +3,7 @@ import type { RangeCalendarRootEmits, RangeCalendarRootProps } from 'reka-ui';
|
|
|
3
3
|
import type { HTMLAttributes } from 'vue';
|
|
4
4
|
import { reactiveOmit } from '@vueuse/core';
|
|
5
5
|
import { RangeCalendarRoot, useForwardPropsEmits } from 'reka-ui';
|
|
6
|
+
import { nextTick, onMounted, ref, watch } from 'vue';
|
|
6
7
|
import { cn } from '@/lib/utils';
|
|
7
8
|
import {
|
|
8
9
|
RangeCalendarCell,
|
|
@@ -27,10 +28,28 @@ const emits = defineEmits<RangeCalendarRootEmits>();
|
|
|
27
28
|
const delegatedProps = reactiveOmit(props, 'class');
|
|
28
29
|
|
|
29
30
|
const forwarded = useForwardPropsEmits(delegatedProps, emits);
|
|
31
|
+
const rangeCalendarRootRef = ref<InstanceType<typeof RangeCalendarRoot> | null>(
|
|
32
|
+
null,
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
function removeUnsupportedReadonlyAttributes() {
|
|
36
|
+
nextTick(() => {
|
|
37
|
+
const root = rangeCalendarRootRef.value?.$el as HTMLElement | undefined;
|
|
38
|
+
root
|
|
39
|
+
?.querySelectorAll('[role="application"][aria-readonly]')
|
|
40
|
+
.forEach((el) => {
|
|
41
|
+
el.removeAttribute('aria-readonly');
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
onMounted(removeUnsupportedReadonlyAttributes);
|
|
47
|
+
watch(() => props.readonly, removeUnsupportedReadonlyAttributes);
|
|
30
48
|
</script>
|
|
31
49
|
|
|
32
50
|
<template>
|
|
33
51
|
<RangeCalendarRoot
|
|
52
|
+
ref="rangeCalendarRootRef"
|
|
34
53
|
#default="{ grid, weekDays }"
|
|
35
54
|
data-slot="range-calendar"
|
|
36
55
|
:class="cn('p-3', props.class)"
|
|
@@ -8,6 +8,8 @@ const props = defineProps<{ class?: HTMLAttributes['class'] }>();
|
|
|
8
8
|
<template>
|
|
9
9
|
<div
|
|
10
10
|
data-slot="skeleton"
|
|
11
|
-
:class="
|
|
11
|
+
:class="
|
|
12
|
+
cn('bg-background-surface-muted animate-pulse rounded-md', props.class)
|
|
13
|
+
"
|
|
12
14
|
/>
|
|
13
15
|
</template>
|
|
@@ -35,7 +35,7 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits);
|
|
|
35
35
|
>
|
|
36
36
|
<SliderTrack
|
|
37
37
|
data-slot="slider-track"
|
|
38
|
-
class="bg-muted relative grow overflow-hidden rounded-full data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5"
|
|
38
|
+
class="bg-background-surface-muted relative grow overflow-hidden rounded-full data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5"
|
|
39
39
|
>
|
|
40
40
|
<SliderRange
|
|
41
41
|
data-slot="slider-range"
|
|
@@ -47,6 +47,7 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits);
|
|
|
47
47
|
v-for="(_, key) in modelValue"
|
|
48
48
|
:key="key"
|
|
49
49
|
data-slot="slider-thumb"
|
|
50
|
+
:aria-label="(modelValue?.length ?? 0) > 1 ? `Value ${key + 1}` : 'Value'"
|
|
50
51
|
class="bg-white border-primary ring-ring/50 block size-4 shrink-0 rounded-full border shadow-sm transition-[color,box-shadow] hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50"
|
|
51
52
|
/>
|
|
52
53
|
</SliderRoot>
|
|
@@ -11,7 +11,10 @@ const props = defineProps<{
|
|
|
11
11
|
<tfoot
|
|
12
12
|
data-slot="table-footer"
|
|
13
13
|
:class="
|
|
14
|
-
cn(
|
|
14
|
+
cn(
|
|
15
|
+
'bg-background-surface-muted/50 border-t font-medium [&>tr]:last:border-b-0',
|
|
16
|
+
props.class,
|
|
17
|
+
)
|
|
15
18
|
"
|
|
16
19
|
>
|
|
17
20
|
<slot />
|
|
@@ -14,7 +14,7 @@ const props = defineProps<{
|
|
|
14
14
|
:data-state="props.dataState"
|
|
15
15
|
:class="
|
|
16
16
|
cn(
|
|
17
|
-
'hover:bg-background-surface-muted-subtle has-[button:hover]:hover:bg-transparent data-[state=selected]:bg-muted border-b transition-colors',
|
|
17
|
+
'hover:bg-background-surface-muted-subtle has-[button:hover]:hover:bg-transparent data-[state=selected]:bg-background-surface-muted border-b transition-colors',
|
|
18
18
|
props.class,
|
|
19
19
|
)
|
|
20
20
|
"
|
package/src/components/index.ts
CHANGED
|
@@ -24,6 +24,7 @@ const VHoverDemo = defineComponent({
|
|
|
24
24
|
<div class="p-8 bg-white dark:bg-background">
|
|
25
25
|
<style>
|
|
26
26
|
.copy-btn { cursor: pointer; transition: all 0.15s; }
|
|
27
|
+
.copy-btn:focus-visible { outline: 2px solid oklch(var(--border-surface-focus-ring)); outline-offset: 2px; }
|
|
27
28
|
.copy-btn:hover { background: rgba(0,0,0,0.05); }
|
|
28
29
|
.copy-btn.copied { background: #22c55e22; }
|
|
29
30
|
.copy-btn.copied::after { content: ' ✓'; color: #22c55e; }
|
|
@@ -49,16 +50,17 @@ const VHoverDemo = defineComponent({
|
|
|
49
50
|
<button
|
|
50
51
|
type="button"
|
|
51
52
|
v-hover="'subtle'"
|
|
52
|
-
class="h-24 w-40 rounded-md bg-background-
|
|
53
|
+
class="h-24 w-40 rounded-md bg-background-surface-secondary body-14-medium text-content-on-surface-primary flex items-center justify-center border border-border-surface-default shadow-xs"
|
|
53
54
|
>
|
|
54
55
|
subtle
|
|
55
56
|
</button>
|
|
56
57
|
<div class="text-center">
|
|
57
58
|
<span class="label-12-medium text-content-on-surface-primary block">subtle</span>
|
|
58
|
-
<
|
|
59
|
-
|
|
59
|
+
<button
|
|
60
|
+
type="button"
|
|
61
|
+
class="copy-btn label-12-regular text-content-on-surface-muted block mt-0.5 px-1 py-0.5 rounded border-0 bg-transparent"
|
|
60
62
|
@click="copyVHover('subtle', $event)"
|
|
61
|
-
>v-hover="'subtle'"</code>
|
|
63
|
+
><code>v-hover="'subtle'"</code></button>
|
|
62
64
|
</div>
|
|
63
65
|
</div>
|
|
64
66
|
|
|
@@ -66,16 +68,17 @@ const VHoverDemo = defineComponent({
|
|
|
66
68
|
<button
|
|
67
69
|
type="button"
|
|
68
70
|
v-hover="'default'"
|
|
69
|
-
class="h-24 w-40 rounded-md bg-background-
|
|
71
|
+
class="h-24 w-40 rounded-md bg-background-surface-secondary body-14-medium text-content-on-surface-primary flex items-center justify-center border border-border-surface-default shadow-xs"
|
|
70
72
|
>
|
|
71
73
|
default
|
|
72
74
|
</button>
|
|
73
75
|
<div class="text-center">
|
|
74
76
|
<span class="label-12-medium text-content-on-surface-primary block">default</span>
|
|
75
|
-
<
|
|
76
|
-
|
|
77
|
+
<button
|
|
78
|
+
type="button"
|
|
79
|
+
class="copy-btn label-12-regular text-content-on-surface-muted block mt-0.5 px-1 py-0.5 rounded border-0 bg-transparent"
|
|
77
80
|
@click="copyVHover('default', $event)"
|
|
78
|
-
>v-hover="'default'"</code>
|
|
81
|
+
><code>v-hover="'default'"</code></button>
|
|
79
82
|
</div>
|
|
80
83
|
</div>
|
|
81
84
|
|
|
@@ -83,16 +86,17 @@ const VHoverDemo = defineComponent({
|
|
|
83
86
|
<button
|
|
84
87
|
type="button"
|
|
85
88
|
v-hover="'strong'"
|
|
86
|
-
class="h-24 w-40 rounded-md bg-background-
|
|
89
|
+
class="h-24 w-40 rounded-md bg-background-surface-secondary body-14-medium text-content-on-surface-primary flex items-center justify-center border border-border-surface-default shadow-xs"
|
|
87
90
|
>
|
|
88
91
|
strong
|
|
89
92
|
</button>
|
|
90
93
|
<div class="text-center">
|
|
91
94
|
<span class="label-12-medium text-content-on-surface-primary block">strong</span>
|
|
92
|
-
<
|
|
93
|
-
|
|
95
|
+
<button
|
|
96
|
+
type="button"
|
|
97
|
+
class="copy-btn label-12-regular text-content-on-surface-muted block mt-0.5 px-1 py-0.5 rounded border-0 bg-transparent"
|
|
94
98
|
@click="copyVHover('strong', $event)"
|
|
95
|
-
>v-hover="'strong'"</code>
|
|
99
|
+
><code>v-hover="'strong'"</code></button>
|
|
96
100
|
</div>
|
|
97
101
|
</div>
|
|
98
102
|
</div>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const ACTIVE_INDICATOR_CLASS = 'ui-active-indicator';
|
|
@@ -1861,7 +1861,7 @@ const cellFormattingColumns: ColumnDef<Payment>[] = [
|
|
|
1861
1861
|
return h(
|
|
1862
1862
|
'div',
|
|
1863
1863
|
{
|
|
1864
|
-
class: `text-right font-medium ${amount > 500 ? 'text-green-
|
|
1864
|
+
class: `text-right font-medium ${amount > 500 ? 'text-green-800' : 'text-muted-foreground'}`,
|
|
1865
1865
|
},
|
|
1866
1866
|
formatted,
|
|
1867
1867
|
);
|
|
@@ -1927,7 +1927,7 @@ const columns: ColumnDef<Payment>[] = [
|
|
|
1927
1927
|
currency: 'EUR',
|
|
1928
1928
|
}).format(amount);
|
|
1929
1929
|
return h('div', {
|
|
1930
|
-
class: \`text-right font-medium \${amount > 500 ? 'text-green-
|
|
1930
|
+
class: \`text-right font-medium \${amount > 500 ? 'text-green-800' : 'text-muted-foreground'}\`,
|
|
1931
1931
|
}, formatted);
|
|
1932
1932
|
},
|
|
1933
1933
|
},
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed, useAttrs, useSlots } from 'vue';
|
|
3
3
|
import { SidebarMenuButton } from '@/components/core/sidebar';
|
|
4
|
+
import { ACTIVE_INDICATOR_CLASS } from '@/lib/activeIndicator';
|
|
4
5
|
import { cn } from '@/lib/utils';
|
|
5
|
-
import { SIDEBAR_ACTIVE_INDICATOR_CLASS } from './activeIndicator';
|
|
6
6
|
import type {
|
|
7
7
|
UiSidebarMenuButtonEmits,
|
|
8
8
|
UiSidebarMenuButtonProps,
|
|
@@ -39,7 +39,7 @@ const containerClass = computed(() =>
|
|
|
39
39
|
'has-[:focus-visible]:border-border-surface-focus-ring has-[:focus-visible]:ring-[3px] has-[:focus-visible]:ring-ring/50',
|
|
40
40
|
// Row hover/active fill for transparent sidebar items.
|
|
41
41
|
'hover:bg-background-surface-muted-subtle data-[active=true]:bg-background-surface-muted-subtle',
|
|
42
|
-
|
|
42
|
+
ACTIVE_INDICATOR_CLASS,
|
|
43
43
|
),
|
|
44
44
|
);
|
|
45
45
|
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { computed, useAttrs } from 'vue';
|
|
3
3
|
import { Primitive } from 'reka-ui';
|
|
4
4
|
import { SidebarMenuSubItem as UiSidebarMenuItem } from '@/components/core/sidebar';
|
|
5
|
+
import { ACTIVE_INDICATOR_CLASS } from '@/lib/activeIndicator';
|
|
5
6
|
import { cn } from '@/lib/utils';
|
|
6
|
-
import { SIDEBAR_ACTIVE_INDICATOR_CLASS } from './activeIndicator';
|
|
7
7
|
import type { UiSidebarMenuSubItemProps } from './types';
|
|
8
8
|
|
|
9
9
|
defineOptions({
|
|
@@ -23,7 +23,7 @@ const containerClass = computed(() =>
|
|
|
23
23
|
// Same hover/active fill as UiSidebarMenuButton so sub-items visually match primary rows.
|
|
24
24
|
'relative flex h-8 w-full min-w-0 items-center gap-2 rounded-md border border-transparent px-2 py-1.5 transition-colors hover:bg-background-surface-muted-subtle data-[active=true]:bg-background-surface-muted-subtle',
|
|
25
25
|
'has-[:focus-visible]:border-border-surface-focus-ring has-[:focus-visible]:ring-[3px] has-[:focus-visible]:ring-ring/50',
|
|
26
|
-
|
|
26
|
+
ACTIVE_INDICATOR_CLASS,
|
|
27
27
|
),
|
|
28
28
|
);
|
|
29
29
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed, useAttrs } from 'vue';
|
|
3
3
|
import { Primitive } from 'reka-ui';
|
|
4
|
+
import { ACTIVE_INDICATOR_CLASS } from '@/lib/activeIndicator';
|
|
4
5
|
import { cn } from '@/lib/utils';
|
|
5
|
-
import { SIDEBAR_ACTIVE_INDICATOR_CLASS } from './activeIndicator';
|
|
6
6
|
import type { UiSidebarPopoverMenuItemProps } from './types';
|
|
7
7
|
|
|
8
8
|
defineOptions({
|
|
@@ -24,7 +24,7 @@ const containerClass = computed(() =>
|
|
|
24
24
|
'transition-colors hover-layer hover-layer-default',
|
|
25
25
|
// Hover/active tint relative to the `secondary` surface the popover menu sits on.
|
|
26
26
|
'has-[:focus-visible]:border-border-surface-focus-ring has-[:focus-visible]:ring-[3px] has-[:focus-visible]:ring-ring/50',
|
|
27
|
-
|
|
27
|
+
ACTIVE_INDICATOR_CLASS,
|
|
28
28
|
),
|
|
29
29
|
);
|
|
30
30
|
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { computed, useAttrs } from 'vue';
|
|
3
3
|
import { SidebarMenuButton } from '@/components/core/sidebar';
|
|
4
4
|
import { UiIcon } from '@/components/UiIcon';
|
|
5
|
+
import { ACTIVE_INDICATOR_CLASS } from '@/lib/activeIndicator';
|
|
5
6
|
import { cn } from '@/lib/utils';
|
|
6
|
-
import { SIDEBAR_ACTIVE_INDICATOR_CLASS } from './activeIndicator';
|
|
7
7
|
import type { UiSidebarPopoverTriggerProps } from './types';
|
|
8
8
|
|
|
9
9
|
defineOptions({
|
|
@@ -25,7 +25,7 @@ const containerClass = computed(() =>
|
|
|
25
25
|
'has-[:focus-visible]:border-border-surface-focus-ring has-[:focus-visible]:ring-[3px] has-[:focus-visible]:ring-ring/50',
|
|
26
26
|
// Row hover/active fill for transparent sidebar triggers.
|
|
27
27
|
'hover:bg-background-surface-muted-subtle data-[active=true]:bg-background-surface-muted-subtle',
|
|
28
|
-
|
|
28
|
+
ACTIVE_INDICATOR_CLASS,
|
|
29
29
|
),
|
|
30
30
|
);
|
|
31
31
|
|
|
@@ -45,6 +45,39 @@ describe('UiSidebarMenuButton', () => {
|
|
|
45
45
|
expect(getAllByRole('button', { name: 'Item' })).toHaveLength(1);
|
|
46
46
|
});
|
|
47
47
|
|
|
48
|
+
test('uses the shared active indicator class', () => {
|
|
49
|
+
const Harness = defineComponent({
|
|
50
|
+
components: {
|
|
51
|
+
UiSidebarProvider,
|
|
52
|
+
UiSidebar,
|
|
53
|
+
UiSidebarContent,
|
|
54
|
+
UiSidebarMenu,
|
|
55
|
+
UiSidebarMenuItem,
|
|
56
|
+
UiSidebarMenuButton,
|
|
57
|
+
},
|
|
58
|
+
template: `
|
|
59
|
+
<UiSidebarProvider :default-open="true">
|
|
60
|
+
<UiSidebar collapsible="none">
|
|
61
|
+
<UiSidebarContent>
|
|
62
|
+
<UiSidebarMenu>
|
|
63
|
+
<UiSidebarMenuItem>
|
|
64
|
+
<UiSidebarMenuButton :is-active="true">
|
|
65
|
+
Item
|
|
66
|
+
</UiSidebarMenuButton>
|
|
67
|
+
</UiSidebarMenuItem>
|
|
68
|
+
</UiSidebarMenu>
|
|
69
|
+
</UiSidebarContent>
|
|
70
|
+
</UiSidebar>
|
|
71
|
+
</UiSidebarProvider>
|
|
72
|
+
`,
|
|
73
|
+
});
|
|
74
|
+
const { container } = render(Harness);
|
|
75
|
+
|
|
76
|
+
const activeIndicator = container.querySelector('.ui-active-indicator');
|
|
77
|
+
expect(activeIndicator).toBeInTheDocument();
|
|
78
|
+
expect(activeIndicator).toHaveAttribute('data-active', 'true');
|
|
79
|
+
});
|
|
80
|
+
|
|
48
81
|
test('renders label and emits end-icon-click when endIconClickable', async () => {
|
|
49
82
|
const user = userEvent.setup();
|
|
50
83
|
const onEndIconClick = vi.fn();
|
|
@@ -1,16 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Shared class string for the left-edge active indicator used by every
|
|
3
|
-
* sidebar row (menu button, sub-menu item, popover trigger, popover menu item).
|
|
4
|
-
*
|
|
5
|
-
* The `::before` pseudo-element is always mounted so CSS has something to
|
|
6
|
-
* transition. At rest it's painted from `scale-x-0` + `opacity-0` with its
|
|
7
|
-
* transform anchored on the left edge (`origin-left`); when the row's
|
|
8
|
-
* `data-active="true"` flips on, the bar paints in from left to right while
|
|
9
|
-
* fading in, using a 200ms linear curve that matches the sidebar collapse
|
|
10
|
-
* and group-content height transitions so all sidebar motion stays in sync.
|
|
11
|
-
*
|
|
12
|
-
* Kept as a string constant (rather than generated via `cn`) so UnoCSS's
|
|
13
|
-
* static scanner picks up every utility class for atomic CSS generation.
|
|
14
|
-
*/
|
|
15
|
-
export const SIDEBAR_ACTIVE_INDICATOR_CLASS =
|
|
16
|
-
'before:absolute before:z-10 before:top-1/2 before:left-0 before:h-1/2 before:w-0.5 before:-translate-y-1/2 before:origin-left before:scale-x-0 before:rounded-full before:bg-background-accent-default before:opacity-0 before:transition-[transform,opacity] before:duration-200 before:ease-linear before:content-[""] data-[active=true]:before:scale-x-100 data-[active=true]:before:opacity-100';
|
|
1
|
+
export { ACTIVE_INDICATOR_CLASS as SIDEBAR_ACTIVE_INDICATOR_CLASS } from '@/lib/activeIndicator';
|
|
@@ -267,6 +267,22 @@ export const Accent: Story = {
|
|
|
267
267
|
<code class="copy-btn label-12-regular text-content-on-surface-muted block mt-0.5 px-1 py-0.5 rounded" onclick="copyToClipboard('bg-background-accent-soft', this)">bg-background-accent-soft</code>
|
|
268
268
|
</div>
|
|
269
269
|
</div>
|
|
270
|
+
|
|
271
|
+
<div class="flex flex-col items-center gap-1.5">
|
|
272
|
+
<div class="w-16 h-16 rounded-md bg-background-accent-pink border border-border-surface-default"></div>
|
|
273
|
+
<div class="text-center">
|
|
274
|
+
<span class="label-12-medium text-content-on-surface-primary block">pink</span>
|
|
275
|
+
<code class="copy-btn label-12-regular text-content-on-surface-muted block mt-0.5 px-1 py-0.5 rounded" onclick="copyToClipboard('bg-background-accent-pink', this)">bg-background-accent-pink</code>
|
|
276
|
+
</div>
|
|
277
|
+
</div>
|
|
278
|
+
|
|
279
|
+
<div class="flex flex-col items-center gap-1.5">
|
|
280
|
+
<div class="w-16 h-16 rounded-md bg-background-accent-yellow border border-border-surface-default"></div>
|
|
281
|
+
<div class="text-center">
|
|
282
|
+
<span class="label-12-medium text-content-on-surface-primary block">yellow</span>
|
|
283
|
+
<code class="copy-btn label-12-regular text-content-on-surface-muted block mt-0.5 px-1 py-0.5 rounded" onclick="copyToClipboard('bg-background-accent-yellow', this)">bg-background-accent-yellow</code>
|
|
284
|
+
</div>
|
|
285
|
+
</div>
|
|
270
286
|
</div>
|
|
271
287
|
</div>
|
|
272
288
|
`,
|
|
@@ -53,58 +53,58 @@ export const RadiusScale: Story = {
|
|
|
53
53
|
</p>
|
|
54
54
|
</div>
|
|
55
55
|
|
|
56
|
-
<div class="grid grid-cols-2 sm:grid-cols-3
|
|
57
|
-
<div class="
|
|
56
|
+
<div class="grid grid-cols-2 sm:grid-cols-3 gap-6">
|
|
57
|
+
<div class="text-center">
|
|
58
58
|
<div class="mx-auto h-40 w-32 bg-background-accent-soft border border-border-surface-default rounded-none"></div>
|
|
59
59
|
<code class="copy-btn label-12-regular text-content-on-surface-muted block mt-3" onclick="copyToClipboard('rounded-none', this)">rounded-none</code>
|
|
60
60
|
</div>
|
|
61
61
|
|
|
62
|
-
<div class="
|
|
62
|
+
<div class="text-center">
|
|
63
63
|
<div class="mx-auto h-40 w-32 bg-background-accent-soft border border-border-surface-default rounded-xs"></div>
|
|
64
64
|
<code class="copy-btn label-12-regular text-content-on-surface-muted block mt-3" onclick="copyToClipboard('rounded-xs', this)">rounded-xs</code>
|
|
65
65
|
</div>
|
|
66
66
|
|
|
67
|
-
<div class="
|
|
67
|
+
<div class="text-center">
|
|
68
68
|
<div class="mx-auto h-40 w-32 bg-background-accent-soft border border-border-surface-default rounded-sm"></div>
|
|
69
69
|
<code class="copy-btn label-12-regular text-content-on-surface-muted block mt-3" onclick="copyToClipboard('rounded-sm', this)">rounded-sm</code>
|
|
70
70
|
</div>
|
|
71
71
|
|
|
72
|
-
<div class="
|
|
72
|
+
<div class="text-center">
|
|
73
73
|
<div class="mx-auto h-40 w-32 bg-background-accent-soft border border-border-surface-default rounded"></div>
|
|
74
74
|
<code class="copy-btn label-12-regular text-content-on-surface-muted block mt-3" onclick="copyToClipboard('rounded', this)">rounded</code>
|
|
75
75
|
</div>
|
|
76
76
|
|
|
77
|
-
<div class="
|
|
77
|
+
<div class="text-center">
|
|
78
78
|
<div class="mx-auto h-40 w-32 bg-background-accent-soft border border-border-surface-default rounded-md"></div>
|
|
79
79
|
<code class="copy-btn label-12-regular text-content-on-surface-muted block mt-3" onclick="copyToClipboard('rounded-md', this)">rounded-md</code>
|
|
80
80
|
</div>
|
|
81
81
|
|
|
82
|
-
<div class="
|
|
82
|
+
<div class="text-center">
|
|
83
83
|
<div class="mx-auto h-40 w-32 bg-background-accent-soft border border-border-surface-default rounded-lg"></div>
|
|
84
84
|
<code class="copy-btn label-12-regular text-content-on-surface-muted block mt-3" onclick="copyToClipboard('rounded-lg', this)">rounded-lg</code>
|
|
85
85
|
</div>
|
|
86
86
|
|
|
87
|
-
<div class="
|
|
87
|
+
<div class="text-center">
|
|
88
88
|
<div class="mx-auto h-40 w-32 bg-background-accent-soft border border-border-surface-default rounded-xl"></div>
|
|
89
89
|
<code class="copy-btn label-12-regular text-content-on-surface-muted block mt-3" onclick="copyToClipboard('rounded-xl', this)">rounded-xl</code>
|
|
90
90
|
</div>
|
|
91
91
|
|
|
92
|
-
<div class="
|
|
92
|
+
<div class="text-center">
|
|
93
93
|
<div class="mx-auto h-40 w-32 bg-background-accent-soft border border-border-surface-default rounded-2xl"></div>
|
|
94
94
|
<code class="copy-btn label-12-regular text-content-on-surface-muted block mt-3" onclick="copyToClipboard('rounded-2xl', this)">rounded-2xl</code>
|
|
95
95
|
</div>
|
|
96
96
|
|
|
97
|
-
<div class="
|
|
97
|
+
<div class="text-center">
|
|
98
98
|
<div class="mx-auto h-40 w-32 bg-background-accent-soft border border-border-surface-default rounded-3xl"></div>
|
|
99
99
|
<code class="copy-btn label-12-regular text-content-on-surface-muted block mt-3" onclick="copyToClipboard('rounded-3xl', this)">rounded-3xl</code>
|
|
100
100
|
</div>
|
|
101
101
|
|
|
102
|
-
<div class="
|
|
102
|
+
<div class="text-center">
|
|
103
103
|
<div class="mx-auto h-40 w-32 bg-background-accent-soft border border-border-surface-default rounded-4xl"></div>
|
|
104
104
|
<code class="copy-btn label-12-regular text-content-on-surface-muted block mt-3" onclick="copyToClipboard('rounded-4xl', this)">rounded-4xl</code>
|
|
105
105
|
</div>
|
|
106
106
|
|
|
107
|
-
<div class="
|
|
107
|
+
<div class="text-center">
|
|
108
108
|
<div class="mx-auto h-40 w-32 bg-background-accent-soft border border-border-surface-default rounded-full"></div>
|
|
109
109
|
<code class="copy-btn label-12-regular text-content-on-surface-muted block mt-3" onclick="copyToClipboard('rounded-full', this)">rounded-full</code>
|
|
110
110
|
</div>
|
|
@@ -287,7 +287,7 @@ export const Wrap: Story = {
|
|
|
287
287
|
<div class="gap-y-8">
|
|
288
288
|
<div>
|
|
289
289
|
<code class="copy-btn label-12-regular text-content-on-surface-muted block mb-2 px-1 py-0.5 rounded w-fit" onclick="copyToClipboard('flex flex-nowrap', this)">flex flex-nowrap</code>
|
|
290
|
-
<div class="flex flex-nowrap gap-2 p-4 bg-background-surface-muted rounded-md overflow-x-auto max-w-md">
|
|
290
|
+
<div class="flex flex-nowrap gap-2 p-4 bg-background-surface-muted rounded-md overflow-x-auto max-w-md" tabindex="0" aria-label="No-wrap flex example">
|
|
291
291
|
<div class="w-24 h-16 flex-shrink-0 bg-background-accent-default rounded flex items-center justify-center text-content-on-accent-default">1</div>
|
|
292
292
|
<div class="w-24 h-16 flex-shrink-0 bg-background-accent-default rounded flex items-center justify-center text-content-on-accent-default">2</div>
|
|
293
293
|
<div class="w-24 h-16 flex-shrink-0 bg-background-accent-default rounded flex items-center justify-center text-content-on-accent-default">3</div>
|
|
@@ -254,7 +254,7 @@ export const OnStatus: Story = {
|
|
|
254
254
|
|
|
255
255
|
<div class="flex flex-wrap gap-6">
|
|
256
256
|
<div class="flex flex-col items-center gap-1.5">
|
|
257
|
-
<div class="w-16 h-16 rounded-md bg-background-
|
|
257
|
+
<div class="w-16 h-16 rounded-md bg-background-status-success border border-border-surface-default flex items-center justify-center">
|
|
258
258
|
<span class="text-content-on-status-success heading-m">Aa</span>
|
|
259
259
|
</div>
|
|
260
260
|
<div class="text-center">
|
|
@@ -264,7 +264,7 @@ export const OnStatus: Story = {
|
|
|
264
264
|
</div>
|
|
265
265
|
|
|
266
266
|
<div class="flex flex-col items-center gap-1.5">
|
|
267
|
-
<div class="w-16 h-16 rounded-md bg-background-
|
|
267
|
+
<div class="w-16 h-16 rounded-md bg-background-status-warning border border-border-surface-default flex items-center justify-center">
|
|
268
268
|
<span class="text-content-on-status-warning heading-m">Aa</span>
|
|
269
269
|
</div>
|
|
270
270
|
<div class="text-center">
|
|
@@ -274,7 +274,7 @@ export const OnStatus: Story = {
|
|
|
274
274
|
</div>
|
|
275
275
|
|
|
276
276
|
<div class="flex flex-col items-center gap-1.5">
|
|
277
|
-
<div class="w-16 h-16 rounded-md bg-background-
|
|
277
|
+
<div class="w-16 h-16 rounded-md bg-background-status-error border border-border-surface-default flex items-center justify-center">
|
|
278
278
|
<span class="text-content-on-status-error heading-m">Aa</span>
|
|
279
279
|
</div>
|
|
280
280
|
<div class="text-center">
|