@aleph-alpha/ui-library 2.0.0 → 2.2.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/config.d.ts +0 -19
- package/config.js +65 -81
- package/dist/system/components/UiSnackbar/UiSnackbar.vue.d.ts +5 -0
- package/dist/system/components/UiSnackbar/index.d.ts +3 -0
- package/dist/system/components/UiSnackbar/types.d.ts +96 -0
- package/dist/system/components/core/sonner/Sonner.vue.d.ts +3 -0
- package/dist/system/components/core/sonner/index.d.ts +1 -0
- package/dist/system/components/index.d.ts +1 -1
- package/dist/system/index.d.ts +3 -4
- package/dist/system/lib.js +20658 -19240
- package/dist/system/patterns/UiSidebar/UiSidebarGroupLabel.vue.d.ts +6 -6
- package/dist/system/patterns/UiSidebar/activeIndicator.d.ts +1 -2
- package/dist/system/patterns/UiSidebar/index.d.ts +1 -3
- package/dist/system/patterns/UiSidebar/types.d.ts +1 -95
- package/docs/public-docs/foundations.md +48 -38
- package/hover-mix.d.ts +8 -11
- package/hover-mix.js +7 -15
- package/package.json +6 -4
- package/src/components/UiAccordion/UiAccordion.stories.ts +2 -2
- package/src/components/UiAlert/UiAlert.stories.ts +4 -4
- package/src/components/UiAvatar/UiAvatar.stories.ts +2 -2
- package/src/components/UiButton/UiButton.stories.ts +1 -1
- package/src/components/UiCalendar/UiCalendar.stories.ts +1 -24
- package/src/components/UiCalendar/UiCalendar.vue +16 -0
- package/src/components/UiCard/UiCard.stories.ts +4 -4
- package/src/components/UiChip/UiChip.vue +1 -1
- package/src/components/UiDrawer/UiDrawer.stories.ts +6 -6
- package/src/components/UiDropdownMenu/UiDropdownMenu.stories.ts +4 -4
- package/src/components/UiDropdownMenu/__tests__/UiDropdownMenu.test.ts +70 -3
- package/src/components/UiEmpty/UiEmpty.stories.ts +1 -0
- package/src/components/UiFileItem/UiFileItem.vue +1 -1
- package/src/components/UiFileItem/__tests__/UiFileItem.test.ts +4 -1
- package/src/components/UiFileUploadBox/UiFileUploadBox.stories.ts +2 -2
- package/src/components/UiIcon/UiIcon.stories.ts +90 -18
- package/src/components/UiInput/UiInput.stories.ts +2 -2
- package/src/components/UiKbd/UiKbd.stories.ts +10 -10
- package/src/components/UiLabel/UiLabel.stories.ts +2 -2
- package/src/components/UiListbox/UiListbox.stories.ts +14 -14
- package/src/components/UiListbox/UiListbox.vue +16 -0
- package/src/components/UiNavigationMenu/UiNavigationMenu.stories.ts +24 -13
- package/src/components/UiPopover/UiPopover.stories.ts +6 -6
- package/src/components/UiRadioGroup/UiRadioGroup.stories.ts +22 -22
- package/src/components/UiRangeCalendar/UiRangeCalendar.stories.ts +11 -22
- package/src/components/UiRangeCalendar/UiRangeCalendar.vue +16 -0
- package/src/components/UiSelect/UiSelectItem.vue +1 -1
- package/src/components/UiSeparator/UiSeparator.stories.ts +8 -8
- package/src/components/UiSheet/UiSheet.stories.ts +12 -12
- package/src/components/UiSkeleton/UiSkeleton.stories.ts +20 -20
- package/src/components/UiSlider/UiSlider.stories.ts +6 -6
- package/src/components/UiSnackbar/UiSnackbar.stories.ts +508 -0
- package/src/components/UiSnackbar/UiSnackbar.vue +286 -0
- package/src/components/UiSnackbar/__tests__/UiSnackbar.test.ts +17 -0
- package/src/components/UiSnackbar/index.ts +4 -0
- package/src/components/UiSnackbar/types.ts +97 -0
- package/src/components/UiSwitch/UiSwitch.stories.ts +4 -4
- package/src/components/UiSwitch/__tests__/UiSwitch.test.ts +9 -2
- package/src/components/UiTable/__tests__/UiTableRow.test.ts +10 -0
- package/src/components/UiTabs/UiTabs.stories.ts +2 -2
- package/src/components/UiTabs/__tests__/UiTabs.test.ts +25 -0
- package/src/components/UiTagsInput/UiTagsInput.stories.ts +2 -0
- package/src/components/UiToggle/__tests__/UiToggle.test.ts +9 -0
- package/src/components/UiToggleGroup/__tests__/UiToggleGroup.test.ts +18 -0
- package/src/components/UiTooltip/UiTooltip.stories.ts +7 -7
- package/src/components/core/alert/index.ts +3 -2
- package/src/components/core/button/index.ts +5 -6
- package/src/components/core/calendar/CalendarGrid.vue +1 -1
- package/src/components/core/card/Card.vue +1 -1
- package/src/components/core/dropdown-menu/DropdownMenuCheckboxItem.vue +14 -13
- package/src/components/core/dropdown-menu/DropdownMenuItem.vue +1 -1
- package/src/components/core/dropdown-menu/DropdownMenuRadioItem.vue +23 -13
- package/src/components/core/dropdown-menu/DropdownMenuSubTrigger.vue +1 -1
- package/src/components/core/listbox/ListboxItem.vue +1 -1
- package/src/components/core/popover/PopoverContent.vue +1 -1
- package/src/components/core/range-calendar/RangeCalendarGrid.vue +1 -1
- package/src/components/core/select/SelectItem.vue +1 -1
- package/src/components/core/sidebar/SidebarGroupAction.vue +1 -1
- package/src/components/core/sidebar/SidebarMenuAction.vue +1 -1
- package/src/components/core/sidebar/SidebarMenuSubButton.vue +2 -2
- package/src/components/core/sidebar/SidebarTrigger.vue +4 -4
- package/src/components/core/sidebar/index.ts +4 -3
- package/src/components/core/sonner/Sonner.vue +43 -0
- package/src/components/core/sonner/index.ts +1 -0
- package/src/components/core/switch/Switch.vue +2 -2
- package/src/components/core/table/TableRow.vue +1 -1
- package/src/components/core/tabs/TabsList.vue +1 -1
- package/src/components/core/tabs/TabsTrigger.vue +1 -1
- package/src/components/core/toggle/index.ts +1 -1
- package/src/components/core/toggle-group/index.ts +1 -1
- package/src/components/index.ts +1 -1
- package/src/directives/vHover.stories.ts +1 -1
- package/src/index.ts +3 -0
- package/src/patterns/UiDataTable/UiDataTable.stories.ts +15 -15
- package/src/patterns/UiDataTable/UiDataTableColumnHeader.vue +1 -1
- package/src/patterns/UiDataTable/UiDataTablePagination.vue +3 -3
- package/src/patterns/UiDataTable/UiDataTableToolbar.vue +1 -1
- package/src/patterns/UiDataTable/__tests__/UiDataTable.test.ts +14 -0
- package/src/patterns/UiDatePicker/UiDatePicker.stories.ts +4 -4
- package/src/patterns/UiDatePicker/UiDatePicker.vue +2 -0
- package/src/patterns/UiSidebar/UiSidebar.stories.ts +27 -258
- package/src/patterns/UiSidebar/UiSidebarGroup.stories.ts +6 -8
- package/src/patterns/UiSidebar/UiSidebarGroupLabel.stories.ts +15 -10
- package/src/patterns/UiSidebar/UiSidebarGroupLabel.vue +20 -7
- package/src/patterns/UiSidebar/UiSidebarHeader.vue +0 -1
- package/src/patterns/UiSidebar/UiSidebarMenuButton.stories.ts +29 -40
- package/src/patterns/UiSidebar/UiSidebarMenuButton.vue +9 -6
- package/src/patterns/UiSidebar/UiSidebarMenuItem.stories.ts +11 -13
- package/src/patterns/UiSidebar/UiSidebarMenuSubItem.vue +8 -5
- package/src/patterns/UiSidebar/UiSidebarPopoverMenu.stories.ts +6 -8
- package/src/patterns/UiSidebar/UiSidebarPopoverMenuItem.stories.ts +6 -7
- package/src/patterns/UiSidebar/UiSidebarPopoverMenuItem.vue +9 -7
- package/src/patterns/UiSidebar/UiSidebarPopoverTrigger.stories.ts +3 -3
- package/src/patterns/UiSidebar/UiSidebarPopoverTrigger.vue +11 -12
- package/src/patterns/UiSidebar/UiSidebarTrigger.vue +1 -1
- package/src/patterns/UiSidebar/activeIndicator.ts +1 -2
- package/src/patterns/UiSidebar/index.ts +0 -5
- package/src/patterns/UiSidebar/types.ts +1 -111
- package/src/theme/Background.stories.ts +5 -5
- package/src/theme/Border.stories.ts +3 -3
- package/src/theme/Extended.stories.ts +6 -6
- package/src/theme/Flex.stories.ts +10 -10
- package/src/theme/Grid.stories.ts +10 -10
- package/src/theme/HoverLayer.stories.ts +215 -0
- package/src/theme/Overlay.stories.ts +2 -2
- package/src/theme/Shadow.stories.ts +1 -1
- package/src/theme/Theme.stories.ts +4 -4
- package/src/theme/Typography.stories.ts +21 -21
- package/tokens.json +4835 -1369
- package/dist/system/components/UiIconButton/UiIconButton.vue.d.ts +0 -25
- package/dist/system/components/UiIconButton/index.d.ts +0 -7
- package/dist/system/components/UiIconButton/types.d.ts +0 -67
- package/dist/system/patterns/UiSidebar/UiSidebarChatHistory.vue.d.ts +0 -20
- package/dist/system/patterns/UiSidebar/UiSidebarChatHistoryItem.vue.d.ts +0 -34
- package/src/components/UiIconButton/UiIconButton.stories.ts +0 -470
- package/src/components/UiIconButton/UiIconButton.vue +0 -76
- package/src/components/UiIconButton/__tests__/UiIconButton.test.ts +0 -105
- package/src/components/UiIconButton/index.ts +0 -13
- package/src/components/UiIconButton/types.ts +0 -87
- package/src/patterns/UiSidebar/UiSidebarChatHistory.stories.ts +0 -104
- package/src/patterns/UiSidebar/UiSidebarChatHistory.vue +0 -43
- package/src/patterns/UiSidebar/UiSidebarChatHistoryItem.stories.ts +0 -204
- package/src/patterns/UiSidebar/UiSidebarChatHistoryItem.vue +0 -269
- package/src/patterns/UiSidebar/__tests__/UiSidebarChatHistory.test.ts +0 -35
- package/src/patterns/UiSidebar/__tests__/UiSidebarChatHistoryItem.test.ts +0 -49
- package/src/theme/BackgroundHover.stories.ts +0 -182
- package/src/theme/ContentHover.stories.ts +0 -171
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
/**
|
|
3
|
-
* @deprecated `UiIconButton` will be removed in `@aleph-alpha/ui-library` **v1.26.0**.
|
|
4
|
-
* It is being merged into `UiButton` — use `UiButton` with an icon-only child and an
|
|
5
|
-
* `aria-label` instead.
|
|
6
|
-
*/
|
|
7
|
-
import { Button as ShadcnButton } from '@/components/core/button';
|
|
8
|
-
import { UiSpinner } from '@/components/UiSpinner';
|
|
9
|
-
import { computed } from 'vue';
|
|
10
|
-
import type {
|
|
11
|
-
UiIconButtonProps,
|
|
12
|
-
UiIconButtonSize,
|
|
13
|
-
UiIconButtonVariant,
|
|
14
|
-
} from './types';
|
|
15
|
-
|
|
16
|
-
defineOptions({
|
|
17
|
-
name: 'UiIconButton',
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
const props = withDefaults(defineProps<UiIconButtonProps>(), {
|
|
21
|
-
variant: 'default',
|
|
22
|
-
size: 'icon',
|
|
23
|
-
asChild: false,
|
|
24
|
-
type: 'button',
|
|
25
|
-
disabled: false,
|
|
26
|
-
loading: false,
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
const variantMap: Record<
|
|
30
|
-
UiIconButtonVariant,
|
|
31
|
-
'default' | 'destructive' | 'outline' | 'secondary' | 'ghost' | 'link'
|
|
32
|
-
> = {
|
|
33
|
-
default: 'default',
|
|
34
|
-
destructive: 'destructive',
|
|
35
|
-
outline: 'outline',
|
|
36
|
-
secondary: 'secondary',
|
|
37
|
-
ghost: 'ghost',
|
|
38
|
-
link: 'link',
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
const sizeMap: Record<UiIconButtonSize, UiIconButtonSize> = {
|
|
42
|
-
icon: 'icon',
|
|
43
|
-
'icon-sm': 'icon-sm',
|
|
44
|
-
'icon-sm-no-padding': 'icon-sm-no-padding',
|
|
45
|
-
'icon-lg': 'icon-lg',
|
|
46
|
-
default: 'default',
|
|
47
|
-
sm: 'sm',
|
|
48
|
-
lg: 'lg',
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
const isDisabled = computed(() => props.disabled || props.loading);
|
|
52
|
-
|
|
53
|
-
function handleClick(e: MouseEvent) {
|
|
54
|
-
if (isDisabled.value) {
|
|
55
|
-
e.preventDefault();
|
|
56
|
-
e.stopPropagation();
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
</script>
|
|
60
|
-
|
|
61
|
-
<template>
|
|
62
|
-
<ShadcnButton
|
|
63
|
-
:variant="variantMap[props.variant]"
|
|
64
|
-
:size="sizeMap[props.size]"
|
|
65
|
-
:aria-label="props.ariaLabel"
|
|
66
|
-
:as-child="props.asChild"
|
|
67
|
-
:type="props.type"
|
|
68
|
-
:disabled="isDisabled"
|
|
69
|
-
:aria-busy="props.loading ? 'true' : undefined"
|
|
70
|
-
@click="handleClick"
|
|
71
|
-
>
|
|
72
|
-
<!-- Spinner when loading and not using asChild -->
|
|
73
|
-
<UiSpinner v-if="props.loading && !props.asChild" aria-label="Loading" />
|
|
74
|
-
<slot v-else />
|
|
75
|
-
</ShadcnButton>
|
|
76
|
-
</template>
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { render } from '@testing-library/vue';
|
|
2
|
-
import userEvent from '@testing-library/user-event';
|
|
3
|
-
import { describe, expect, test } from 'vitest';
|
|
4
|
-
import { h } from 'vue';
|
|
5
|
-
import { MockIcon } from '@/__tests__/test-utils';
|
|
6
|
-
import UiIconButton from '../UiIconButton.vue';
|
|
7
|
-
|
|
8
|
-
describe('UiIconButton', () => {
|
|
9
|
-
test('renders with icon, type="button", and required aria-label', () => {
|
|
10
|
-
const { getByRole, getByTestId } = render(UiIconButton, {
|
|
11
|
-
props: { ariaLabel: 'Delete item' },
|
|
12
|
-
slots: { default: () => h(MockIcon) },
|
|
13
|
-
});
|
|
14
|
-
const button = getByRole('button');
|
|
15
|
-
expect(button).toHaveAttribute('type', 'button');
|
|
16
|
-
expect(button).toHaveAttribute('aria-label', 'Delete item');
|
|
17
|
-
expect(getByTestId('mock-icon')).toBeInTheDocument();
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
describe('Variants (contract test)', () => {
|
|
21
|
-
const variants = [
|
|
22
|
-
'default',
|
|
23
|
-
'destructive',
|
|
24
|
-
'outline',
|
|
25
|
-
'secondary',
|
|
26
|
-
'ghost',
|
|
27
|
-
'link',
|
|
28
|
-
] as const;
|
|
29
|
-
|
|
30
|
-
test.each(variants)('accepts variant="%s"', (variant) => {
|
|
31
|
-
const { getByRole } = render(UiIconButton, {
|
|
32
|
-
props: { ariaLabel: 'Icon', variant },
|
|
33
|
-
slots: { default: '🔍' },
|
|
34
|
-
});
|
|
35
|
-
expect(getByRole('button')).toBeInTheDocument();
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
describe('Sizes (contract test)', () => {
|
|
40
|
-
const sizes = ['icon', 'icon-sm', 'icon-lg'] as const;
|
|
41
|
-
|
|
42
|
-
test.each(sizes)('accepts size="%s"', (size) => {
|
|
43
|
-
const { getByRole } = render(UiIconButton, {
|
|
44
|
-
props: { ariaLabel: 'Icon', size },
|
|
45
|
-
slots: { default: '🔍' },
|
|
46
|
-
});
|
|
47
|
-
expect(getByRole('button')).toBeInTheDocument();
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
test('emits click event when clicked', async () => {
|
|
52
|
-
const user = userEvent.setup();
|
|
53
|
-
const { getByRole, emitted } = render(UiIconButton, {
|
|
54
|
-
props: { ariaLabel: 'Click me' },
|
|
55
|
-
slots: { default: '🔍' },
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
await user.click(getByRole('button'));
|
|
59
|
-
|
|
60
|
-
expect(emitted('click')).toHaveLength(1);
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
test('is disabled when disabled prop is true', () => {
|
|
64
|
-
const { getByRole } = render(UiIconButton, {
|
|
65
|
-
props: { ariaLabel: 'Test', disabled: true },
|
|
66
|
-
slots: { default: '🔍' },
|
|
67
|
-
});
|
|
68
|
-
expect(getByRole('button')).toBeDisabled();
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
describe('Loading State', () => {
|
|
72
|
-
test('is disabled with aria-busy and shows spinner when loading', () => {
|
|
73
|
-
const { getByRole, getByLabelText, queryByTestId } = render(
|
|
74
|
-
UiIconButton,
|
|
75
|
-
{
|
|
76
|
-
props: { ariaLabel: 'Test', loading: true },
|
|
77
|
-
slots: { default: () => h(MockIcon) },
|
|
78
|
-
},
|
|
79
|
-
);
|
|
80
|
-
const button = getByRole('button');
|
|
81
|
-
expect(button).toBeDisabled();
|
|
82
|
-
expect(button).toHaveAttribute('aria-busy', 'true');
|
|
83
|
-
expect(getByLabelText('Loading')).toBeInTheDocument();
|
|
84
|
-
expect(queryByTestId('mock-icon')).not.toBeInTheDocument();
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
test('does not show spinner in asChild mode when loading', () => {
|
|
88
|
-
const { queryByLabelText } = render(UiIconButton, {
|
|
89
|
-
props: { ariaLabel: 'Test', loading: true, asChild: true },
|
|
90
|
-
slots: { default: '🔍' },
|
|
91
|
-
});
|
|
92
|
-
expect(queryByLabelText('Loading')).not.toBeInTheDocument();
|
|
93
|
-
});
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
describe('asChild Mode', () => {
|
|
97
|
-
test('shows slot content even when loading in asChild mode', () => {
|
|
98
|
-
const { getByTestId } = render(UiIconButton, {
|
|
99
|
-
props: { ariaLabel: 'Test', asChild: true, loading: true },
|
|
100
|
-
slots: { default: () => h(MockIcon) },
|
|
101
|
-
});
|
|
102
|
-
expect(getByTestId('mock-icon')).toBeInTheDocument();
|
|
103
|
-
});
|
|
104
|
-
});
|
|
105
|
-
});
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @deprecated `UiIconButton` and its associated types will be removed in
|
|
3
|
-
* `@aleph-alpha/ui-library` **v1.26.0**. They are being merged into `UiButton` —
|
|
4
|
-
* use `UiButton` with an icon-only child and an `aria-label` instead.
|
|
5
|
-
*/
|
|
6
|
-
export { default as UiIconButton } from './UiIconButton.vue';
|
|
7
|
-
export type {
|
|
8
|
-
UiIconButtonProps,
|
|
9
|
-
UiIconButtonVariant,
|
|
10
|
-
UiIconButtonSize,
|
|
11
|
-
UiIconButtonIconSize,
|
|
12
|
-
UiIconButtonDefaultSize,
|
|
13
|
-
} from './types';
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Visual style variants for UiIconButton.
|
|
3
|
-
* @deprecated Will be removed in `@aleph-alpha/ui-library` **v1.26.0** — UiIconButton is being merged into `UiButton`. Use `UiButtonVariant` instead.
|
|
4
|
-
*/
|
|
5
|
-
export type UiIconButtonVariant =
|
|
6
|
-
| 'default'
|
|
7
|
-
| 'destructive'
|
|
8
|
-
| 'outline'
|
|
9
|
-
| 'secondary'
|
|
10
|
-
| 'ghost'
|
|
11
|
-
| 'link';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Icon-mode size variants for UiIconButton (square, icon-only dimensions).
|
|
15
|
-
* @deprecated Will be removed in `@aleph-alpha/ui-library` **v1.26.0** — UiIconButton is being merged into `UiButton`. Use the equivalent `UiButton` size instead.
|
|
16
|
-
*/
|
|
17
|
-
export type UiIconButtonIconSize =
|
|
18
|
-
| 'icon'
|
|
19
|
-
| 'icon-sm'
|
|
20
|
-
| 'icon-lg'
|
|
21
|
-
| 'icon-sm-no-padding';
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Non-icon (text-style) size variants for UiIconButton.
|
|
25
|
-
* @deprecated Will be removed in `@aleph-alpha/ui-library` **v1.26.0** — UiIconButton is being merged into `UiButton`. Use the equivalent `UiButton` size instead.
|
|
26
|
-
*/
|
|
27
|
-
export type UiIconButtonDefaultSize = 'default' | 'sm' | 'lg';
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Size variants for UiIconButton.
|
|
31
|
-
* @deprecated Will be removed in `@aleph-alpha/ui-library` **v1.26.0** — UiIconButton is being merged into `UiButton`. Use `UiButtonSize` instead.
|
|
32
|
-
*/
|
|
33
|
-
export type UiIconButtonSize = UiIconButtonIconSize | UiIconButtonDefaultSize;
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* A button that displays only an icon without text. Use for compact
|
|
37
|
-
* actions like close, edit, delete, or toolbar buttons.
|
|
38
|
-
* @deprecated `UiIconButton` will be removed in `@aleph-alpha/ui-library` **v1.26.0**.
|
|
39
|
-
* It is being merged into `UiButton` — use `UiButton` with an icon-only child and an
|
|
40
|
-
* `aria-label` instead (e.g. `<UiButton size="icon-sm" aria-label="Close"><UiIcon name="x" /></UiButton>`).
|
|
41
|
-
* @category Actions
|
|
42
|
-
* @useCases close button, edit action, toolbar button, compact action
|
|
43
|
-
* @keywords iconbutton, icon, button, action, close, edit, delete
|
|
44
|
-
* @related UiButton, UiIcon
|
|
45
|
-
*/
|
|
46
|
-
export interface UiIconButtonProps {
|
|
47
|
-
/**
|
|
48
|
-
* The visual style of the button.
|
|
49
|
-
* @default 'default'
|
|
50
|
-
*/
|
|
51
|
-
variant?: UiIconButtonVariant;
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* The size of the icon button.
|
|
55
|
-
* @default 'icon'
|
|
56
|
-
*/
|
|
57
|
-
size?: UiIconButtonSize;
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Whether to render as a child (Slot) instead of a wrapper element.
|
|
61
|
-
* Useful for tooltips or wrapping other components.
|
|
62
|
-
* @default false
|
|
63
|
-
*/
|
|
64
|
-
asChild?: boolean;
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* The native button type.
|
|
68
|
-
* @default 'button'
|
|
69
|
-
*/
|
|
70
|
-
type?: 'button' | 'submit' | 'reset';
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Disables the button.
|
|
74
|
-
*/
|
|
75
|
-
disabled?: boolean;
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Shows a loading state and prevents interaction.
|
|
79
|
-
*/
|
|
80
|
-
loading?: boolean;
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Accessible label for the button.
|
|
84
|
-
* **REQUIRED** because the button renders only an icon (no visible text).
|
|
85
|
-
*/
|
|
86
|
-
ariaLabel: string;
|
|
87
|
-
}
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/vue3-vite';
|
|
2
|
-
import { ref } from 'vue';
|
|
3
|
-
import UiSidebar from './UiSidebar.vue';
|
|
4
|
-
import UiSidebarChatHistory from './UiSidebarChatHistory.vue';
|
|
5
|
-
import UiSidebarChatHistoryItem from './UiSidebarChatHistoryItem.vue';
|
|
6
|
-
import UiSidebarContent from './UiSidebarContent.vue';
|
|
7
|
-
import UiSidebarHeader from './UiSidebarHeader.vue';
|
|
8
|
-
import UiSidebarProvider from './UiSidebarProvider.vue';
|
|
9
|
-
|
|
10
|
-
const meta: Meta<typeof UiSidebarChatHistory> = {
|
|
11
|
-
title: 'Patterns/UiSidebar/UiSidebarChatHistory (Deprecated)',
|
|
12
|
-
component: UiSidebarChatHistory,
|
|
13
|
-
tags: ['autodocs', 'deprecated'],
|
|
14
|
-
parameters: {
|
|
15
|
-
layout: 'padded',
|
|
16
|
-
docs: {
|
|
17
|
-
description: {
|
|
18
|
-
component:
|
|
19
|
-
'**Deprecated.** Use `CkHistoryWrapper` from `@aleph-alpha/chat-kit` instead. This component will be removed in a future release.\n\nVertical stack for chat history rows (`UiSidebarChatHistoryItem`). Toggle **`withGap`** to add spacing between items; hidden when the sidebar is in icon-collapsed mode (`group-data-[collapsible=icon]`).',
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
argTypes: {
|
|
24
|
-
withGap: {
|
|
25
|
-
control: 'boolean',
|
|
26
|
-
description: 'When true, applies vertical gap between child items.',
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export default meta;
|
|
32
|
-
|
|
33
|
-
type Story = StoryObj<typeof UiSidebarChatHistory>;
|
|
34
|
-
|
|
35
|
-
export const Default: Story = {
|
|
36
|
-
render: () => ({
|
|
37
|
-
components: {
|
|
38
|
-
UiSidebar,
|
|
39
|
-
UiSidebarChatHistory,
|
|
40
|
-
UiSidebarChatHistoryItem,
|
|
41
|
-
UiSidebarContent,
|
|
42
|
-
UiSidebarHeader,
|
|
43
|
-
UiSidebarProvider,
|
|
44
|
-
},
|
|
45
|
-
setup() {
|
|
46
|
-
const actionCount = ref(0);
|
|
47
|
-
const items = [
|
|
48
|
-
{
|
|
49
|
-
title: 'Project Proposal Overview',
|
|
50
|
-
metaStart: 'Today',
|
|
51
|
-
metaEnd: 'Innsbruck',
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
title: 'Project Proposal Overview',
|
|
55
|
-
metaStart: 'Today',
|
|
56
|
-
metaEnd: 'Innsbruck',
|
|
57
|
-
isActive: true,
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
title: 'Project Proposal Overview',
|
|
61
|
-
metaStart: 'Today',
|
|
62
|
-
metaEnd: 'Innsbruck',
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
title: 'Project Proposal Overview',
|
|
66
|
-
metaStart: 'Today',
|
|
67
|
-
metaEnd: 'Innsbruck',
|
|
68
|
-
},
|
|
69
|
-
];
|
|
70
|
-
|
|
71
|
-
function handleActionClick() {
|
|
72
|
-
actionCount.value += 1;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
return { actionCount, handleActionClick, items };
|
|
76
|
-
},
|
|
77
|
-
template: `
|
|
78
|
-
<UiSidebarProvider :default-open="true">
|
|
79
|
-
<div class="bg-background-surface-primary p-4">
|
|
80
|
-
<UiSidebar class="w-[22rem]" collapsible="icon">
|
|
81
|
-
<UiSidebarHeader tooltip="Toggle sidebar">Preview</UiSidebarHeader>
|
|
82
|
-
<UiSidebarContent class="p-0">
|
|
83
|
-
<UiSidebarChatHistory>
|
|
84
|
-
<UiSidebarChatHistoryItem
|
|
85
|
-
v-for="(item, index) in items"
|
|
86
|
-
:key="index"
|
|
87
|
-
:title="item.title"
|
|
88
|
-
:meta-start="item.metaStart"
|
|
89
|
-
:meta-end="item.metaEnd"
|
|
90
|
-
:is-active="item.isActive"
|
|
91
|
-
action-tooltip="More actions"
|
|
92
|
-
@action-click="handleActionClick"
|
|
93
|
-
/>
|
|
94
|
-
</UiSidebarChatHistory>
|
|
95
|
-
</UiSidebarContent>
|
|
96
|
-
</UiSidebar>
|
|
97
|
-
<p class="label-12-regular mt-3 text-content-on-surface-muted">
|
|
98
|
-
Action clicks: {{ actionCount }}
|
|
99
|
-
</p>
|
|
100
|
-
</div>
|
|
101
|
-
</UiSidebarProvider>
|
|
102
|
-
`,
|
|
103
|
-
}),
|
|
104
|
-
};
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { computed, useAttrs } from 'vue';
|
|
3
|
-
import { cn } from '@/lib/utils';
|
|
4
|
-
import type { UiSidebarChatHistoryProps } from './types';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @deprecated Use `CkHistoryWrapper` from `@aleph-alpha/chat-kit` instead.
|
|
8
|
-
* This sidebar-coupled component will be removed in a future release.
|
|
9
|
-
*/
|
|
10
|
-
defineOptions({
|
|
11
|
-
name: 'UiSidebarChatHistory',
|
|
12
|
-
inheritAttrs: false,
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
const props = withDefaults(defineProps<UiSidebarChatHistoryProps>(), {
|
|
16
|
-
withGap: true,
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
const attrs = useAttrs();
|
|
20
|
-
|
|
21
|
-
const historyClass = computed(() =>
|
|
22
|
-
cn(
|
|
23
|
-
'flex w-full min-w-0 flex-col p-2 group-data-[collapsible=icon]:hidden',
|
|
24
|
-
props.withGap && 'gap-1',
|
|
25
|
-
attrs.class as string | undefined,
|
|
26
|
-
),
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
const passthroughAttrs = computed(() => {
|
|
30
|
-
const { class: _class, ...rest } = attrs as Record<string, unknown>;
|
|
31
|
-
return rest;
|
|
32
|
-
});
|
|
33
|
-
</script>
|
|
34
|
-
|
|
35
|
-
<template>
|
|
36
|
-
<div
|
|
37
|
-
v-bind="passthroughAttrs"
|
|
38
|
-
data-slot="sidebar-chat-history"
|
|
39
|
-
:class="historyClass"
|
|
40
|
-
>
|
|
41
|
-
<slot />
|
|
42
|
-
</div>
|
|
43
|
-
</template>
|
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/vue3-vite';
|
|
2
|
-
import { ref } from 'vue';
|
|
3
|
-
import { MoreHorizontal, Pencil, Trash2 } from 'lucide-vue-next';
|
|
4
|
-
import UiSidebar from './UiSidebar.vue';
|
|
5
|
-
import UiSidebarContent from './UiSidebarContent.vue';
|
|
6
|
-
import UiSidebarChatHistoryItem from './UiSidebarChatHistoryItem.vue';
|
|
7
|
-
import UiSidebarPopoverMenuItem from './UiSidebarPopoverMenuItem.vue';
|
|
8
|
-
import UiSidebarHeader from './UiSidebarHeader.vue';
|
|
9
|
-
import UiSidebarProvider from './UiSidebarProvider.vue';
|
|
10
|
-
|
|
11
|
-
const meta: Meta<typeof UiSidebarChatHistoryItem> = {
|
|
12
|
-
title: 'Patterns/UiSidebar/UiSidebarChatHistoryItem (Deprecated)',
|
|
13
|
-
component: UiSidebarChatHistoryItem,
|
|
14
|
-
tags: ['autodocs', 'deprecated'],
|
|
15
|
-
parameters: {
|
|
16
|
-
layout: 'padded',
|
|
17
|
-
docs: {
|
|
18
|
-
description: {
|
|
19
|
-
component:
|
|
20
|
-
'**Deprecated.** Use `CkHistoryItem` from `@aleph-alpha/chat-kit` instead. This component will be removed in a future release.\n\nSingle chat history entry: title, optional meta line, row focus ring, and trailing action (button or popover). Emits **`action-click`** when the action is a plain button; use **`actionPopover`** with `#action-popover` slot for menu content.',
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
args: {
|
|
25
|
-
title: 'Project Proposal Overview',
|
|
26
|
-
metaStart: 'Today',
|
|
27
|
-
metaEnd: 'Innsbruck',
|
|
28
|
-
actionTooltip: 'More actions',
|
|
29
|
-
},
|
|
30
|
-
argTypes: {
|
|
31
|
-
title: {
|
|
32
|
-
control: 'text',
|
|
33
|
-
description: 'Primary line shown for the conversation.',
|
|
34
|
-
},
|
|
35
|
-
metaStart: {
|
|
36
|
-
control: 'text',
|
|
37
|
-
description: 'Leading metadata segment under the title.',
|
|
38
|
-
},
|
|
39
|
-
metaEnd: {
|
|
40
|
-
control: 'text',
|
|
41
|
-
description:
|
|
42
|
-
'Trailing metadata segment (often separated visually from metaStart).',
|
|
43
|
-
},
|
|
44
|
-
isActive: {
|
|
45
|
-
control: 'boolean',
|
|
46
|
-
description: 'Active row treatment (rail + background).',
|
|
47
|
-
},
|
|
48
|
-
showAction: {
|
|
49
|
-
control: 'boolean',
|
|
50
|
-
description: 'Whether the end action column is rendered.',
|
|
51
|
-
},
|
|
52
|
-
showActionOnHover: {
|
|
53
|
-
control: 'boolean',
|
|
54
|
-
description: 'Fade in the action until row hover/focus-within.',
|
|
55
|
-
},
|
|
56
|
-
actionTooltip: {
|
|
57
|
-
control: 'text',
|
|
58
|
-
description:
|
|
59
|
-
'Tooltip for the action control (ignored when `actionPopover` is true).',
|
|
60
|
-
},
|
|
61
|
-
actionAriaLabel: {
|
|
62
|
-
control: 'text',
|
|
63
|
-
description: 'Accessible name for the action control.',
|
|
64
|
-
},
|
|
65
|
-
actionPopover: {
|
|
66
|
-
control: 'boolean',
|
|
67
|
-
description:
|
|
68
|
-
'Use popover for the action; supply body via `#action-popover` slot.',
|
|
69
|
-
},
|
|
70
|
-
actionPopoverSide: {
|
|
71
|
-
control: 'select',
|
|
72
|
-
options: ['top', 'right', 'bottom', 'left'],
|
|
73
|
-
description: 'Popover placement relative to the action trigger.',
|
|
74
|
-
},
|
|
75
|
-
actionPopoverAlign: {
|
|
76
|
-
control: 'select',
|
|
77
|
-
options: ['start', 'center', 'end'],
|
|
78
|
-
description: 'Popover alignment along the cross axis.',
|
|
79
|
-
},
|
|
80
|
-
actionPopoverSideOffset: {
|
|
81
|
-
control: 'number',
|
|
82
|
-
description: 'Offset in pixels between trigger and popover content.',
|
|
83
|
-
},
|
|
84
|
-
actionIcon: {
|
|
85
|
-
control: false,
|
|
86
|
-
description: 'Custom icon component (assign in code).',
|
|
87
|
-
},
|
|
88
|
-
},
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
export default meta;
|
|
92
|
-
|
|
93
|
-
type Story = StoryObj<typeof UiSidebarChatHistoryItem>;
|
|
94
|
-
|
|
95
|
-
const renderStory = (args: Story['args']) => ({
|
|
96
|
-
components: {
|
|
97
|
-
MoreHorizontal,
|
|
98
|
-
UiSidebar,
|
|
99
|
-
UiSidebarContent,
|
|
100
|
-
UiSidebarChatHistoryItem,
|
|
101
|
-
UiSidebarHeader,
|
|
102
|
-
UiSidebarProvider,
|
|
103
|
-
},
|
|
104
|
-
setup() {
|
|
105
|
-
const actionCount = ref(0);
|
|
106
|
-
|
|
107
|
-
function handleActionClick() {
|
|
108
|
-
actionCount.value += 1;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
return { actionCount, args, handleActionClick };
|
|
112
|
-
},
|
|
113
|
-
template: `
|
|
114
|
-
<UiSidebarProvider :default-open="true">
|
|
115
|
-
<div class="max-w-sm bg-background-surface-primary p-4">
|
|
116
|
-
<UiSidebar class="w-[22rem]" collapsible="icon">
|
|
117
|
-
<UiSidebarHeader tooltip="Toggle sidebar">Preview</UiSidebarHeader>
|
|
118
|
-
<UiSidebarContent class="p-2">
|
|
119
|
-
<UiSidebarChatHistoryItem v-bind="args" @action-click="handleActionClick" />
|
|
120
|
-
</UiSidebarContent>
|
|
121
|
-
</UiSidebar>
|
|
122
|
-
<p class="label-12-regular mt-3 text-content-on-surface-muted">
|
|
123
|
-
Action clicks: {{ actionCount }}
|
|
124
|
-
</p>
|
|
125
|
-
</div>
|
|
126
|
-
</UiSidebarProvider>
|
|
127
|
-
`,
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
export const Default: Story = {
|
|
131
|
-
render: renderStory,
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
export const Active: Story = {
|
|
135
|
-
args: {
|
|
136
|
-
isActive: true,
|
|
137
|
-
},
|
|
138
|
-
render: renderStory,
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
export const AlwaysShowAction: Story = {
|
|
142
|
-
args: {
|
|
143
|
-
showActionOnHover: false,
|
|
144
|
-
},
|
|
145
|
-
render: renderStory,
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
export const NoMeta: Story = {
|
|
149
|
-
args: {
|
|
150
|
-
metaStart: '',
|
|
151
|
-
metaEnd: '',
|
|
152
|
-
},
|
|
153
|
-
render: renderStory,
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
export const WithActionPopover: Story = {
|
|
157
|
-
args: {
|
|
158
|
-
actionPopover: true,
|
|
159
|
-
actionTooltip: '',
|
|
160
|
-
actionAriaLabel: 'Chat options',
|
|
161
|
-
},
|
|
162
|
-
render: (args) => ({
|
|
163
|
-
components: {
|
|
164
|
-
Pencil,
|
|
165
|
-
Trash2,
|
|
166
|
-
UiSidebar,
|
|
167
|
-
UiSidebarContent,
|
|
168
|
-
UiSidebarChatHistoryItem,
|
|
169
|
-
UiSidebarHeader,
|
|
170
|
-
UiSidebarPopoverMenuItem,
|
|
171
|
-
UiSidebarProvider,
|
|
172
|
-
},
|
|
173
|
-
setup() {
|
|
174
|
-
return { args };
|
|
175
|
-
},
|
|
176
|
-
template: `
|
|
177
|
-
<UiSidebarProvider :default-open="true">
|
|
178
|
-
<div class="max-w-sm bg-background-surface-primary p-4">
|
|
179
|
-
<UiSidebar class="w-[22rem]" collapsible="icon">
|
|
180
|
-
<UiSidebarHeader tooltip="Toggle sidebar">Preview</UiSidebarHeader>
|
|
181
|
-
<UiSidebarContent class="p-2">
|
|
182
|
-
<UiSidebarChatHistoryItem v-bind="args">
|
|
183
|
-
<template #action-popover>
|
|
184
|
-
<div class="flex flex-col gap-0.5 p-1">
|
|
185
|
-
<UiSidebarPopoverMenuItem label="Rename" as="button">
|
|
186
|
-
<template #icon>
|
|
187
|
-
<Pencil :size="16" />
|
|
188
|
-
</template>
|
|
189
|
-
</UiSidebarPopoverMenuItem>
|
|
190
|
-
<UiSidebarPopoverMenuItem label="Delete" as="button">
|
|
191
|
-
<template #icon>
|
|
192
|
-
<Trash2 :size="16" />
|
|
193
|
-
</template>
|
|
194
|
-
</UiSidebarPopoverMenuItem>
|
|
195
|
-
</div>
|
|
196
|
-
</template>
|
|
197
|
-
</UiSidebarChatHistoryItem>
|
|
198
|
-
</UiSidebarContent>
|
|
199
|
-
</UiSidebar>
|
|
200
|
-
</div>
|
|
201
|
-
</UiSidebarProvider>
|
|
202
|
-
`,
|
|
203
|
-
}),
|
|
204
|
-
};
|