@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.
Files changed (145) hide show
  1. package/config.d.ts +0 -19
  2. package/config.js +65 -81
  3. package/dist/system/components/UiSnackbar/UiSnackbar.vue.d.ts +5 -0
  4. package/dist/system/components/UiSnackbar/index.d.ts +3 -0
  5. package/dist/system/components/UiSnackbar/types.d.ts +96 -0
  6. package/dist/system/components/core/sonner/Sonner.vue.d.ts +3 -0
  7. package/dist/system/components/core/sonner/index.d.ts +1 -0
  8. package/dist/system/components/index.d.ts +1 -1
  9. package/dist/system/index.d.ts +3 -4
  10. package/dist/system/lib.js +20658 -19240
  11. package/dist/system/patterns/UiSidebar/UiSidebarGroupLabel.vue.d.ts +6 -6
  12. package/dist/system/patterns/UiSidebar/activeIndicator.d.ts +1 -2
  13. package/dist/system/patterns/UiSidebar/index.d.ts +1 -3
  14. package/dist/system/patterns/UiSidebar/types.d.ts +1 -95
  15. package/docs/public-docs/foundations.md +48 -38
  16. package/hover-mix.d.ts +8 -11
  17. package/hover-mix.js +7 -15
  18. package/package.json +6 -4
  19. package/src/components/UiAccordion/UiAccordion.stories.ts +2 -2
  20. package/src/components/UiAlert/UiAlert.stories.ts +4 -4
  21. package/src/components/UiAvatar/UiAvatar.stories.ts +2 -2
  22. package/src/components/UiButton/UiButton.stories.ts +1 -1
  23. package/src/components/UiCalendar/UiCalendar.stories.ts +1 -24
  24. package/src/components/UiCalendar/UiCalendar.vue +16 -0
  25. package/src/components/UiCard/UiCard.stories.ts +4 -4
  26. package/src/components/UiChip/UiChip.vue +1 -1
  27. package/src/components/UiDrawer/UiDrawer.stories.ts +6 -6
  28. package/src/components/UiDropdownMenu/UiDropdownMenu.stories.ts +4 -4
  29. package/src/components/UiDropdownMenu/__tests__/UiDropdownMenu.test.ts +70 -3
  30. package/src/components/UiEmpty/UiEmpty.stories.ts +1 -0
  31. package/src/components/UiFileItem/UiFileItem.vue +1 -1
  32. package/src/components/UiFileItem/__tests__/UiFileItem.test.ts +4 -1
  33. package/src/components/UiFileUploadBox/UiFileUploadBox.stories.ts +2 -2
  34. package/src/components/UiIcon/UiIcon.stories.ts +90 -18
  35. package/src/components/UiInput/UiInput.stories.ts +2 -2
  36. package/src/components/UiKbd/UiKbd.stories.ts +10 -10
  37. package/src/components/UiLabel/UiLabel.stories.ts +2 -2
  38. package/src/components/UiListbox/UiListbox.stories.ts +14 -14
  39. package/src/components/UiListbox/UiListbox.vue +16 -0
  40. package/src/components/UiNavigationMenu/UiNavigationMenu.stories.ts +24 -13
  41. package/src/components/UiPopover/UiPopover.stories.ts +6 -6
  42. package/src/components/UiRadioGroup/UiRadioGroup.stories.ts +22 -22
  43. package/src/components/UiRangeCalendar/UiRangeCalendar.stories.ts +11 -22
  44. package/src/components/UiRangeCalendar/UiRangeCalendar.vue +16 -0
  45. package/src/components/UiSelect/UiSelectItem.vue +1 -1
  46. package/src/components/UiSeparator/UiSeparator.stories.ts +8 -8
  47. package/src/components/UiSheet/UiSheet.stories.ts +12 -12
  48. package/src/components/UiSkeleton/UiSkeleton.stories.ts +20 -20
  49. package/src/components/UiSlider/UiSlider.stories.ts +6 -6
  50. package/src/components/UiSnackbar/UiSnackbar.stories.ts +508 -0
  51. package/src/components/UiSnackbar/UiSnackbar.vue +286 -0
  52. package/src/components/UiSnackbar/__tests__/UiSnackbar.test.ts +17 -0
  53. package/src/components/UiSnackbar/index.ts +4 -0
  54. package/src/components/UiSnackbar/types.ts +97 -0
  55. package/src/components/UiSwitch/UiSwitch.stories.ts +4 -4
  56. package/src/components/UiSwitch/__tests__/UiSwitch.test.ts +9 -2
  57. package/src/components/UiTable/__tests__/UiTableRow.test.ts +10 -0
  58. package/src/components/UiTabs/UiTabs.stories.ts +2 -2
  59. package/src/components/UiTabs/__tests__/UiTabs.test.ts +25 -0
  60. package/src/components/UiTagsInput/UiTagsInput.stories.ts +2 -0
  61. package/src/components/UiToggle/__tests__/UiToggle.test.ts +9 -0
  62. package/src/components/UiToggleGroup/__tests__/UiToggleGroup.test.ts +18 -0
  63. package/src/components/UiTooltip/UiTooltip.stories.ts +7 -7
  64. package/src/components/core/alert/index.ts +3 -2
  65. package/src/components/core/button/index.ts +5 -6
  66. package/src/components/core/calendar/CalendarGrid.vue +1 -1
  67. package/src/components/core/card/Card.vue +1 -1
  68. package/src/components/core/dropdown-menu/DropdownMenuCheckboxItem.vue +14 -13
  69. package/src/components/core/dropdown-menu/DropdownMenuItem.vue +1 -1
  70. package/src/components/core/dropdown-menu/DropdownMenuRadioItem.vue +23 -13
  71. package/src/components/core/dropdown-menu/DropdownMenuSubTrigger.vue +1 -1
  72. package/src/components/core/listbox/ListboxItem.vue +1 -1
  73. package/src/components/core/popover/PopoverContent.vue +1 -1
  74. package/src/components/core/range-calendar/RangeCalendarGrid.vue +1 -1
  75. package/src/components/core/select/SelectItem.vue +1 -1
  76. package/src/components/core/sidebar/SidebarGroupAction.vue +1 -1
  77. package/src/components/core/sidebar/SidebarMenuAction.vue +1 -1
  78. package/src/components/core/sidebar/SidebarMenuSubButton.vue +2 -2
  79. package/src/components/core/sidebar/SidebarTrigger.vue +4 -4
  80. package/src/components/core/sidebar/index.ts +4 -3
  81. package/src/components/core/sonner/Sonner.vue +43 -0
  82. package/src/components/core/sonner/index.ts +1 -0
  83. package/src/components/core/switch/Switch.vue +2 -2
  84. package/src/components/core/table/TableRow.vue +1 -1
  85. package/src/components/core/tabs/TabsList.vue +1 -1
  86. package/src/components/core/tabs/TabsTrigger.vue +1 -1
  87. package/src/components/core/toggle/index.ts +1 -1
  88. package/src/components/core/toggle-group/index.ts +1 -1
  89. package/src/components/index.ts +1 -1
  90. package/src/directives/vHover.stories.ts +1 -1
  91. package/src/index.ts +3 -0
  92. package/src/patterns/UiDataTable/UiDataTable.stories.ts +15 -15
  93. package/src/patterns/UiDataTable/UiDataTableColumnHeader.vue +1 -1
  94. package/src/patterns/UiDataTable/UiDataTablePagination.vue +3 -3
  95. package/src/patterns/UiDataTable/UiDataTableToolbar.vue +1 -1
  96. package/src/patterns/UiDataTable/__tests__/UiDataTable.test.ts +14 -0
  97. package/src/patterns/UiDatePicker/UiDatePicker.stories.ts +4 -4
  98. package/src/patterns/UiDatePicker/UiDatePicker.vue +2 -0
  99. package/src/patterns/UiSidebar/UiSidebar.stories.ts +27 -258
  100. package/src/patterns/UiSidebar/UiSidebarGroup.stories.ts +6 -8
  101. package/src/patterns/UiSidebar/UiSidebarGroupLabel.stories.ts +15 -10
  102. package/src/patterns/UiSidebar/UiSidebarGroupLabel.vue +20 -7
  103. package/src/patterns/UiSidebar/UiSidebarHeader.vue +0 -1
  104. package/src/patterns/UiSidebar/UiSidebarMenuButton.stories.ts +29 -40
  105. package/src/patterns/UiSidebar/UiSidebarMenuButton.vue +9 -6
  106. package/src/patterns/UiSidebar/UiSidebarMenuItem.stories.ts +11 -13
  107. package/src/patterns/UiSidebar/UiSidebarMenuSubItem.vue +8 -5
  108. package/src/patterns/UiSidebar/UiSidebarPopoverMenu.stories.ts +6 -8
  109. package/src/patterns/UiSidebar/UiSidebarPopoverMenuItem.stories.ts +6 -7
  110. package/src/patterns/UiSidebar/UiSidebarPopoverMenuItem.vue +9 -7
  111. package/src/patterns/UiSidebar/UiSidebarPopoverTrigger.stories.ts +3 -3
  112. package/src/patterns/UiSidebar/UiSidebarPopoverTrigger.vue +11 -12
  113. package/src/patterns/UiSidebar/UiSidebarTrigger.vue +1 -1
  114. package/src/patterns/UiSidebar/activeIndicator.ts +1 -2
  115. package/src/patterns/UiSidebar/index.ts +0 -5
  116. package/src/patterns/UiSidebar/types.ts +1 -111
  117. package/src/theme/Background.stories.ts +5 -5
  118. package/src/theme/Border.stories.ts +3 -3
  119. package/src/theme/Extended.stories.ts +6 -6
  120. package/src/theme/Flex.stories.ts +10 -10
  121. package/src/theme/Grid.stories.ts +10 -10
  122. package/src/theme/HoverLayer.stories.ts +215 -0
  123. package/src/theme/Overlay.stories.ts +2 -2
  124. package/src/theme/Shadow.stories.ts +1 -1
  125. package/src/theme/Theme.stories.ts +4 -4
  126. package/src/theme/Typography.stories.ts +21 -21
  127. package/tokens.json +4835 -1369
  128. package/dist/system/components/UiIconButton/UiIconButton.vue.d.ts +0 -25
  129. package/dist/system/components/UiIconButton/index.d.ts +0 -7
  130. package/dist/system/components/UiIconButton/types.d.ts +0 -67
  131. package/dist/system/patterns/UiSidebar/UiSidebarChatHistory.vue.d.ts +0 -20
  132. package/dist/system/patterns/UiSidebar/UiSidebarChatHistoryItem.vue.d.ts +0 -34
  133. package/src/components/UiIconButton/UiIconButton.stories.ts +0 -470
  134. package/src/components/UiIconButton/UiIconButton.vue +0 -76
  135. package/src/components/UiIconButton/__tests__/UiIconButton.test.ts +0 -105
  136. package/src/components/UiIconButton/index.ts +0 -13
  137. package/src/components/UiIconButton/types.ts +0 -87
  138. package/src/patterns/UiSidebar/UiSidebarChatHistory.stories.ts +0 -104
  139. package/src/patterns/UiSidebar/UiSidebarChatHistory.vue +0 -43
  140. package/src/patterns/UiSidebar/UiSidebarChatHistoryItem.stories.ts +0 -204
  141. package/src/patterns/UiSidebar/UiSidebarChatHistoryItem.vue +0 -269
  142. package/src/patterns/UiSidebar/__tests__/UiSidebarChatHistory.test.ts +0 -35
  143. package/src/patterns/UiSidebar/__tests__/UiSidebarChatHistoryItem.test.ts +0 -49
  144. package/src/theme/BackgroundHover.stories.ts +0 -182
  145. package/src/theme/ContentHover.stories.ts +0 -171
@@ -1,25 +0,0 @@
1
- import { UiIconButtonProps, UiIconButtonSize, UiIconButtonVariant } from './types';
2
- declare function __VLS_template(): {
3
- attrs: Partial<{}>;
4
- slots: {
5
- default?(_: {}): any;
6
- };
7
- refs: {};
8
- rootEl: any;
9
- };
10
- type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
11
- declare const __VLS_component: import('vue').DefineComponent<UiIconButtonProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<UiIconButtonProps> & Readonly<{}>, {
12
- disabled: boolean;
13
- asChild: boolean;
14
- type: "button" | "submit" | "reset";
15
- size: UiIconButtonSize;
16
- variant: UiIconButtonVariant;
17
- loading: boolean;
18
- }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
19
- declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
20
- export default _default;
21
- type __VLS_WithTemplateSlots<T, S> = T & {
22
- new (): {
23
- $slots: S;
24
- };
25
- };
@@ -1,7 +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 { UiIconButtonProps, UiIconButtonVariant, UiIconButtonSize, UiIconButtonIconSize, UiIconButtonDefaultSize, } from './types';
@@ -1,67 +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 = 'default' | 'destructive' | 'outline' | 'secondary' | 'ghost' | 'link';
6
- /**
7
- * Icon-mode size variants for UiIconButton (square, icon-only dimensions).
8
- * @deprecated Will be removed in `@aleph-alpha/ui-library` **v1.26.0** — UiIconButton is being merged into `UiButton`. Use the equivalent `UiButton` size instead.
9
- */
10
- export type UiIconButtonIconSize = 'icon' | 'icon-sm' | 'icon-lg' | 'icon-sm-no-padding';
11
- /**
12
- * Non-icon (text-style) size variants for UiIconButton.
13
- * @deprecated Will be removed in `@aleph-alpha/ui-library` **v1.26.0** — UiIconButton is being merged into `UiButton`. Use the equivalent `UiButton` size instead.
14
- */
15
- export type UiIconButtonDefaultSize = 'default' | 'sm' | 'lg';
16
- /**
17
- * Size variants for UiIconButton.
18
- * @deprecated Will be removed in `@aleph-alpha/ui-library` **v1.26.0** — UiIconButton is being merged into `UiButton`. Use `UiButtonSize` instead.
19
- */
20
- export type UiIconButtonSize = UiIconButtonIconSize | UiIconButtonDefaultSize;
21
- /**
22
- * A button that displays only an icon without text. Use for compact
23
- * actions like close, edit, delete, or toolbar buttons.
24
- * @deprecated `UiIconButton` will be removed in `@aleph-alpha/ui-library` **v1.26.0**.
25
- * It is being merged into `UiButton` — use `UiButton` with an icon-only child and an
26
- * `aria-label` instead (e.g. `<UiButton size="icon-sm" aria-label="Close"><UiIcon name="x" /></UiButton>`).
27
- * @category Actions
28
- * @useCases close button, edit action, toolbar button, compact action
29
- * @keywords iconbutton, icon, button, action, close, edit, delete
30
- * @related UiButton, UiIcon
31
- */
32
- export interface UiIconButtonProps {
33
- /**
34
- * The visual style of the button.
35
- * @default 'default'
36
- */
37
- variant?: UiIconButtonVariant;
38
- /**
39
- * The size of the icon button.
40
- * @default 'icon'
41
- */
42
- size?: UiIconButtonSize;
43
- /**
44
- * Whether to render as a child (Slot) instead of a wrapper element.
45
- * Useful for tooltips or wrapping other components.
46
- * @default false
47
- */
48
- asChild?: boolean;
49
- /**
50
- * The native button type.
51
- * @default 'button'
52
- */
53
- type?: 'button' | 'submit' | 'reset';
54
- /**
55
- * Disables the button.
56
- */
57
- disabled?: boolean;
58
- /**
59
- * Shows a loading state and prevents interaction.
60
- */
61
- loading?: boolean;
62
- /**
63
- * Accessible label for the button.
64
- * **REQUIRED** because the button renders only an icon (no visible text).
65
- */
66
- ariaLabel: string;
67
- }
@@ -1,20 +0,0 @@
1
- import { UiSidebarChatHistoryProps } from './types';
2
- declare function __VLS_template(): {
3
- attrs: Partial<{}>;
4
- slots: {
5
- default?(_: {}): any;
6
- };
7
- refs: {};
8
- rootEl: any;
9
- };
10
- type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
11
- declare const __VLS_component: import('vue').DefineComponent<UiSidebarChatHistoryProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<UiSidebarChatHistoryProps> & Readonly<{}>, {
12
- withGap: boolean;
13
- }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
14
- declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
15
- export default _default;
16
- type __VLS_WithTemplateSlots<T, S> = T & {
17
- new (): {
18
- $slots: S;
19
- };
20
- };
@@ -1,34 +0,0 @@
1
- import { UiSidebarChatHistoryItemProps } from './types';
2
- declare function __VLS_template(): {
3
- attrs: Partial<{}>;
4
- slots: {
5
- meta?(_: {}): any;
6
- 'action-popover'?(_: {}): any;
7
- };
8
- refs: {};
9
- rootEl: any;
10
- };
11
- type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
12
- declare const __VLS_component: import('vue').DefineComponent<UiSidebarChatHistoryItemProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
13
- "action-click": (event: MouseEvent) => any;
14
- }, string, import('vue').PublicProps, Readonly<UiSidebarChatHistoryItemProps> & Readonly<{
15
- "onAction-click"?: ((event: MouseEvent) => any) | undefined;
16
- }>, {
17
- as: import('reka-ui').AsTag | import('vue').Component;
18
- isActive: boolean;
19
- showAction: boolean;
20
- showActionOnHover: boolean;
21
- actionTooltip: string;
22
- actionAriaLabel: string;
23
- actionPopover: boolean;
24
- actionPopoverSide: "top" | "right" | "bottom" | "left";
25
- actionPopoverAlign: "start" | "center" | "end";
26
- actionPopoverSideOffset: number;
27
- }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
28
- declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
29
- export default _default;
30
- type __VLS_WithTemplateSlots<T, S> = T & {
31
- new (): {
32
- $slots: S;
33
- };
34
- };
@@ -1,470 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/vue3-vite';
2
- import UiIconButton from './UiIconButton.vue';
3
- import { UiIcon } from '../UiIcon';
4
-
5
- /**
6
- * @deprecated `UiIconButton` will be removed in `@aleph-alpha/ui-library` **v1.26.0**.
7
- * It is being merged into `UiButton` — use `UiButton` with an icon-only child and an
8
- * `aria-label` instead.
9
- */
10
- const meta: Meta<typeof UiIconButton> = {
11
- title: 'Components/UiIconButton',
12
- component: UiIconButton,
13
- tags: ['autodocs', 'deprecated'],
14
- parameters: {
15
- docs: {
16
- description: {
17
- component:
18
- '> **Deprecated — scheduled for removal in `@aleph-alpha/ui-library` v1.26.0.** ' +
19
- '`UiIconButton` is being merged into `UiButton`. Migrate to `UiButton` with an ' +
20
- 'icon-only child and an `aria-label` instead, e.g. ' +
21
- '`<UiButton size="icon-sm" aria-label="Close"><UiIcon name="x" /></UiButton>`.',
22
- },
23
- },
24
- },
25
- argTypes: {
26
- variant: {
27
- control: 'select',
28
- options: [
29
- 'default',
30
- 'destructive',
31
- 'outline',
32
- 'secondary',
33
- 'ghost',
34
- 'link',
35
- ],
36
- description: 'The visual style of the button',
37
- },
38
- size: {
39
- control: 'select',
40
- options: ['icon', 'icon-sm', 'icon-lg'],
41
- description: 'The size of the icon button',
42
- },
43
- asChild: {
44
- control: 'boolean',
45
- description:
46
- 'Whether to render as a child (Slot) instead of a wrapper element',
47
- },
48
- ariaLabel: {
49
- control: 'text',
50
- description: 'Accessible label (required for icon buttons)',
51
- },
52
- disabled: {
53
- control: 'boolean',
54
- description: 'Disables the button',
55
- },
56
- loading: {
57
- control: 'boolean',
58
- description: 'Shows a loading state and prevents interaction',
59
- },
60
- },
61
- args: {
62
- variant: 'default',
63
- size: 'icon',
64
- asChild: false,
65
- ariaLabel: 'Icon button',
66
- disabled: false,
67
- loading: false,
68
- },
69
- };
70
-
71
- export default meta;
72
-
73
- type Story = StoryObj<typeof UiIconButton>;
74
-
75
- const defaultTemplateSource = `<script setup lang="ts">
76
- import { UiIconButton, UiIcon } from '@aleph-alpha/ui-library'
77
- </script>
78
-
79
- <template>
80
- <UiIconButton aria-label="Next">
81
- <UiIcon name="chevron-right" :size="16" />
82
- </UiIconButton>
83
- </template>`;
84
-
85
- /**
86
- * Default icon button.
87
- */
88
- export const Default: Story = {
89
- render: (args) => ({
90
- components: { UiIconButton, UiIcon },
91
- setup() {
92
- return { args };
93
- },
94
- template: `<UiIconButton :variant="args.variant" :size="args.size" :disabled="args.disabled" :loading="args.loading" :aria-label="args.ariaLabel">
95
- <UiIcon name="chevron-right" :size="16" />
96
- </UiIconButton>`,
97
- }),
98
- parameters: {
99
- docs: {
100
- source: {
101
- code: defaultTemplateSource,
102
- },
103
- },
104
- },
105
- };
106
-
107
- const secondaryTemplateSource = `<script setup lang="ts">
108
- import { UiIconButton, UiIcon } from '@aleph-alpha/ui-library'
109
- </script>
110
-
111
- <template>
112
- <UiIconButton variant="secondary" aria-label="Next">
113
- <UiIcon name="chevron-right" :size="16" />
114
- </UiIconButton>
115
- </template>`;
116
-
117
- /**
118
- * Secondary icon button variant.
119
- */
120
- export const Secondary: Story = {
121
- render: () => ({
122
- components: { UiIconButton, UiIcon },
123
- template: `<UiIconButton variant="secondary" aria-label="Next">
124
- <UiIcon name="chevron-right" :size="16" />
125
- </UiIconButton>`,
126
- }),
127
- parameters: {
128
- docs: {
129
- source: {
130
- code: secondaryTemplateSource,
131
- },
132
- },
133
- },
134
- };
135
-
136
- const destructiveTemplateSource = `<script setup lang="ts">
137
- import { UiIconButton, UiIcon } from '@aleph-alpha/ui-library'
138
- </script>
139
-
140
- <template>
141
- <UiIconButton variant="destructive" aria-label="Delete">
142
- <UiIcon name="chevron-right" :size="16" />
143
- </UiIconButton>
144
- </template>`;
145
-
146
- /**
147
- * Destructive icon button variant.
148
- */
149
- export const Destructive: Story = {
150
- render: () => ({
151
- components: { UiIconButton, UiIcon },
152
- template: `<UiIconButton variant="destructive" aria-label="Delete">
153
- <UiIcon name="chevron-right" :size="16" />
154
- </UiIconButton>`,
155
- }),
156
- parameters: {
157
- docs: {
158
- source: {
159
- code: destructiveTemplateSource,
160
- },
161
- },
162
- },
163
- };
164
-
165
- const outlineTemplateSource = `<script setup lang="ts">
166
- import { UiIconButton, UiIcon } from '@aleph-alpha/ui-library'
167
- </script>
168
-
169
- <template>
170
- <UiIconButton variant="outline" aria-label="Next">
171
- <UiIcon name="chevron-right" :size="16" />
172
- </UiIconButton>
173
- </template>`;
174
-
175
- /**
176
- * Outline icon button variant.
177
- */
178
- export const Outline: Story = {
179
- render: () => ({
180
- components: { UiIconButton, UiIcon },
181
- template: `<UiIconButton variant="outline" aria-label="Next">
182
- <UiIcon name="chevron-right" :size="16" />
183
- </UiIconButton>`,
184
- }),
185
- parameters: {
186
- docs: {
187
- source: {
188
- code: outlineTemplateSource,
189
- },
190
- },
191
- },
192
- };
193
-
194
- const ghostTemplateSource = `<script setup lang="ts">
195
- import { UiIconButton, UiIcon } from '@aleph-alpha/ui-library'
196
- </script>
197
-
198
- <template>
199
- <UiIconButton variant="ghost" aria-label="Next">
200
- <UiIcon name="chevron-right" :size="16" />
201
- </UiIconButton>
202
- </template>`;
203
-
204
- /**
205
- * Ghost icon button variant.
206
- */
207
- export const Ghost: Story = {
208
- render: () => ({
209
- components: { UiIconButton, UiIcon },
210
- template: `<UiIconButton variant="ghost" aria-label="Next">
211
- <UiIcon name="chevron-right" :size="16" />
212
- </UiIconButton>`,
213
- }),
214
- parameters: {
215
- docs: {
216
- source: {
217
- code: ghostTemplateSource,
218
- },
219
- },
220
- },
221
- };
222
-
223
- const linkTemplateSource = `<script setup lang="ts">
224
- import { UiIconButton, UiIcon } from '@aleph-alpha/ui-library'
225
- </script>
226
-
227
- <template>
228
- <UiIconButton variant="link" aria-label="Next">
229
- <UiIcon name="chevron-right" :size="16" />
230
- </UiIconButton>
231
- </template>`;
232
-
233
- /**
234
- * Link icon button variant.
235
- */
236
- export const Link: Story = {
237
- render: () => ({
238
- components: { UiIconButton, UiIcon },
239
- template: `<UiIconButton variant="link" aria-label="Next">
240
- <UiIcon name="chevron-right" :size="16" />
241
- </UiIconButton>`,
242
- }),
243
- parameters: {
244
- docs: {
245
- source: {
246
- code: linkTemplateSource,
247
- },
248
- },
249
- },
250
- };
251
-
252
- const loadingTemplateSource = `<script setup lang="ts">
253
- import { UiIconButton, UiIcon } from '@aleph-alpha/ui-library'
254
- </script>
255
-
256
- <template>
257
- <UiIconButton :loading="true" aria-label="Loading">
258
- <UiIcon name="chevron-right" :size="16" />
259
- </UiIconButton>
260
- </template>`;
261
-
262
- /**
263
- * Loading state shows a spinner.
264
- */
265
- export const Loading: Story = {
266
- render: () => ({
267
- components: { UiIconButton, UiIcon },
268
- template: `<UiIconButton :loading="true" aria-label="Loading">
269
- <UiIcon name="chevron-right" :size="16" />
270
- </UiIconButton>`,
271
- }),
272
- parameters: {
273
- docs: {
274
- source: {
275
- code: loadingTemplateSource,
276
- },
277
- },
278
- },
279
- };
280
-
281
- const disabledTemplateSource = `<script setup lang="ts">
282
- import { UiIconButton, UiIcon } from '@aleph-alpha/ui-library'
283
- </script>
284
-
285
- <template>
286
- <UiIconButton :disabled="true" aria-label="Disabled">
287
- <UiIcon name="chevron-right" :size="16" />
288
- </UiIconButton>
289
- </template>`;
290
-
291
- /**
292
- * Disabled state.
293
- */
294
- export const Disabled: Story = {
295
- render: () => ({
296
- components: { UiIconButton, UiIcon },
297
- template: `<UiIconButton :disabled="true" aria-label="Disabled">
298
- <UiIcon name="chevron-right" :size="16" />
299
- </UiIconButton>`,
300
- }),
301
- parameters: {
302
- docs: {
303
- source: {
304
- code: disabledTemplateSource,
305
- },
306
- },
307
- },
308
- };
309
-
310
- const allVariantsTemplateSource = `<script setup lang="ts">
311
- import { UiIconButton, UiIcon } from '@aleph-alpha/ui-library'
312
- </script>
313
-
314
- <template>
315
- <div class="flex flex-wrap items-center gap-4">
316
- <UiIconButton variant="default" aria-label="Default">
317
- <UiIcon name="chevron-right" :size="16" />
318
- </UiIconButton>
319
- <UiIconButton variant="secondary" aria-label="Secondary">
320
- <UiIcon name="chevron-right" :size="16" />
321
- </UiIconButton>
322
- <UiIconButton variant="destructive" aria-label="Destructive">
323
- <UiIcon name="chevron-right" :size="16" />
324
- </UiIconButton>
325
- <UiIconButton variant="outline" aria-label="Outline">
326
- <UiIcon name="chevron-right" :size="16" />
327
- </UiIconButton>
328
- <UiIconButton variant="ghost" aria-label="Ghost">
329
- <UiIcon name="chevron-right" :size="16" />
330
- </UiIconButton>
331
- <UiIconButton variant="link" aria-label="Link">
332
- <UiIcon name="chevron-right" :size="16" />
333
- </UiIconButton>
334
- </div>
335
- </template>`;
336
-
337
- /**
338
- * All icon button variants side by side.
339
- */
340
- export const AllVariants: Story = {
341
- render: () => ({
342
- components: { UiIconButton, UiIcon },
343
- template: `<div class="flex flex-wrap items-center gap-4">
344
- <UiIconButton variant="default" aria-label="Default">
345
- <UiIcon name="chevron-right" :size="16" />
346
- </UiIconButton>
347
- <UiIconButton variant="secondary" aria-label="Secondary">
348
- <UiIcon name="chevron-right" :size="16" />
349
- </UiIconButton>
350
- <UiIconButton variant="destructive" aria-label="Destructive">
351
- <UiIcon name="chevron-right" :size="16" />
352
- </UiIconButton>
353
- <UiIconButton variant="outline" aria-label="Outline">
354
- <UiIcon name="chevron-right" :size="16" />
355
- </UiIconButton>
356
- <UiIconButton variant="ghost" aria-label="Ghost">
357
- <UiIcon name="chevron-right" :size="16" />
358
- </UiIconButton>
359
- <UiIconButton variant="link" aria-label="Link">
360
- <UiIcon name="chevron-right" :size="16" />
361
- </UiIconButton>
362
- </div>`,
363
- }),
364
- parameters: {
365
- docs: {
366
- source: {
367
- code: allVariantsTemplateSource,
368
- },
369
- },
370
- },
371
- };
372
-
373
- const allSizesTemplateSource = `<script setup lang="ts">
374
- import { UiIconButton, UiIcon } from '@aleph-alpha/ui-library'
375
- </script>
376
-
377
- <template>
378
- <div class="flex flex-wrap items-end gap-4">
379
- <div class="flex flex-col items-center gap-2">
380
- <span class="label-12-regular text-muted-foreground">icon-sm</span>
381
- <UiIconButton size="icon-sm" variant="outline" aria-label="Small Icon">
382
- <UiIcon name="chevron-right" :size="16" />
383
- </UiIconButton>
384
- </div>
385
- <div class="flex flex-col items-center gap-2">
386
- <span class="label-12-regular text-muted-foreground">icon</span>
387
- <UiIconButton size="icon" variant="outline" aria-label="Default Icon">
388
- <UiIcon name="chevron-right" :size="16" />
389
- </UiIconButton>
390
- </div>
391
- <div class="flex flex-col items-center gap-2">
392
- <span class="label-12-regular text-muted-foreground">icon-lg</span>
393
- <UiIconButton size="icon-lg" variant="outline" aria-label="Large Icon">
394
- <UiIcon name="chevron-right" :size="20" />
395
- </UiIconButton>
396
- </div>
397
- </div>
398
- </template>`;
399
-
400
- /**
401
- * All icon button sizes.
402
- */
403
- export const AllSizes: Story = {
404
- render: () => ({
405
- components: { UiIconButton, UiIcon },
406
- template: `<div class="flex flex-wrap items-end gap-4">
407
- <div class="flex flex-col items-center gap-2">
408
- <span class="label-12-regular text-muted-foreground">icon-sm</span>
409
- <UiIconButton size="icon-sm" variant="outline" aria-label="Small Icon">
410
- <UiIcon name="chevron-right" :size="16" />
411
- </UiIconButton>
412
- </div>
413
- <div class="flex flex-col items-center gap-2">
414
- <span class="label-12-regular text-muted-foreground">icon</span>
415
- <UiIconButton size="icon" variant="outline" aria-label="Default Icon">
416
- <UiIcon name="chevron-right" :size="16" />
417
- </UiIconButton>
418
- </div>
419
- <div class="flex flex-col items-center gap-2">
420
- <span class="label-12-regular text-muted-foreground">icon-lg</span>
421
- <UiIconButton size="icon-lg" variant="outline" aria-label="Large Icon">
422
- <UiIcon name="chevron-right" :size="20" />
423
- </UiIconButton>
424
- </div>
425
- </div>`,
426
- }),
427
- parameters: {
428
- docs: {
429
- source: {
430
- code: allSizesTemplateSource,
431
- },
432
- },
433
- },
434
- };
435
-
436
- const asChildTemplateSource = `<script setup lang="ts">
437
- import { UiIconButton, UiIcon } from '@aleph-alpha/ui-library'
438
- </script>
439
-
440
- <template>
441
- <UiIconButton :as-child="true" aria-label="Navigate">
442
- <a href="#">
443
- <UiIcon name="chevron-right" :size="16" />
444
- </a>
445
- </UiIconButton>
446
- </template>`;
447
-
448
- /**
449
- * Use `as-child` to render icon button styling on a link or custom element.
450
- * Perfect for navigation arrows, external link icons, or router integration.
451
- *
452
- * **Note:** The `aria-label` is still required for accessibility even when using `as-child`.
453
- */
454
- export const AsChild: Story = {
455
- render: () => ({
456
- components: { UiIconButton, UiIcon },
457
- template: `<UiIconButton :as-child="true" aria-label="Navigate">
458
- <a href="#">
459
- <UiIcon name="chevron-right" :size="16" />
460
- </a>
461
- </UiIconButton>`,
462
- }),
463
- parameters: {
464
- docs: {
465
- source: {
466
- code: asChildTemplateSource,
467
- },
468
- },
469
- },
470
- };