@aleph-alpha/ui-library 2.10.0 → 2.12.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 (171) hide show
  1. package/config.d.ts +8 -2
  2. package/config.js +85 -73
  3. package/dist/system/components/UiAutocomplete/UiAutocomplete.vue.d.ts +0 -1
  4. package/dist/system/components/UiAutocomplete/types.d.ts +0 -3
  5. package/dist/system/components/UiDialog/UiDialogDescription.vue.d.ts +2 -1
  6. package/dist/system/components/UiDialog/UiDialogFooter.vue.d.ts +1 -2
  7. package/dist/system/components/UiDialog/UiDialogHeader.vue.d.ts +1 -2
  8. package/dist/system/components/UiDialog/UiDialogTitle.vue.d.ts +2 -1
  9. package/dist/system/components/UiDialog/types.d.ts +10 -4
  10. package/dist/system/components/UiDropdownMenu/UiDropdownMenuSub.vue.d.ts +3 -1
  11. package/dist/system/components/UiField/UiFieldError.vue.d.ts +8 -1
  12. package/dist/system/components/UiInput/UiInput.vue.d.ts +16 -1
  13. package/dist/system/components/UiSelect/UiSelect.vue.d.ts +4 -5
  14. package/dist/system/components/UiSelect/UiSelectContent.vue.d.ts +0 -1
  15. package/dist/system/components/UiSelect/UiSelectItem.vue.d.ts +2 -9
  16. package/dist/system/components/UiSelect/UiSelectTrigger.vue.d.ts +0 -2
  17. package/dist/system/components/UiSelect/UiSelectValue.vue.d.ts +0 -3
  18. package/dist/system/components/UiSelect/types.d.ts +26 -6
  19. package/dist/system/components/UiStepper/UiStepperDescription.vue.d.ts +3 -1
  20. package/dist/system/components/UiStepper/UiStepperIndicator.vue.d.ts +3 -1
  21. package/dist/system/components/UiStepper/UiStepperItem.vue.d.ts +3 -1
  22. package/dist/system/components/UiTagsInput/types.d.ts +1 -2
  23. package/dist/system/components/core/accordion/AccordionItem.vue.d.ts +3 -1
  24. package/dist/system/components/core/calendar/CalendarHeading.vue.d.ts +2 -2
  25. package/dist/system/components/core/dropdown-menu/DropdownMenuSub.vue.d.ts +3 -1
  26. package/dist/system/components/core/range-calendar/RangeCalendarHeading.vue.d.ts +2 -2
  27. package/dist/system/components/core/stepper/StepperDescription.vue.d.ts +3 -1
  28. package/dist/system/components/core/stepper/StepperIndicator.vue.d.ts +3 -1
  29. package/dist/system/components/core/stepper/StepperItem.vue.d.ts +3 -1
  30. package/dist/system/index.d.ts +2 -1
  31. package/dist/system/lib/utils.d.ts +6 -0
  32. package/dist/system/lib.js +9685 -9895
  33. package/dist/system/patterns/UiSidebar/UiSidebarContent.vue.d.ts +1 -2
  34. package/dist/system/patterns/UiSidebar/UiSidebarFooter.vue.d.ts +1 -2
  35. package/dist/system/patterns/UiSidebar/UiSidebarGroupContent.vue.d.ts +1 -2
  36. package/dist/system/patterns/UiSidebar/UiSidebarInset.vue.d.ts +1 -2
  37. package/dist/system/patterns/UiSidebar/UiSidebarMenu.vue.d.ts +1 -2
  38. package/dist/system/patterns/UiSidebar/UiSidebarMenuItem.vue.d.ts +1 -2
  39. package/dist/system/patterns/UiSidebar/UiSidebarProvider.vue.d.ts +1 -2
  40. package/dist/system/patterns/UiSidebar/UiSidebarRail.vue.d.ts +1 -2
  41. package/dist/system/patterns/UiSidebar/__tests__/sidebar-test-helpers.d.ts +9 -9
  42. package/dist/system/patterns/UiSidebar/types.d.ts +8 -16
  43. package/dist/system/story-sidebar-icons.json +10 -0
  44. package/package.json +5 -2
  45. package/src/@types/shims-vue.d.ts +1 -1
  46. package/src/__tests__/test-utils.ts +1 -1
  47. package/src/components/UiAlertDialog/UiAlertDialogAction.vue +1 -1
  48. package/src/components/UiAlertDialog/UiAlertDialogCancel.vue +1 -1
  49. package/src/components/UiAlertDialog/UiAlertDialogContent.vue +4 -1
  50. package/src/components/UiAlertDialog/UiAlertDialogDescription.vue +1 -1
  51. package/src/components/UiAlertDialog/UiAlertDialogTitle.vue +1 -1
  52. package/src/components/UiAlertDialog/UiAlertDialogTrigger.vue +1 -1
  53. package/src/components/UiAutocomplete/UiAutocomplete.vue +9 -9
  54. package/src/components/UiAutocomplete/__tests__/UiAutocomplete.test.ts +76 -5
  55. package/src/components/UiAutocomplete/types.ts +0 -3
  56. package/src/components/UiBadge/UiBadge.vue +1 -1
  57. package/src/components/UiBadge/constants.ts +1 -1
  58. package/src/components/UiBadge/types.ts +1 -1
  59. package/src/components/UiButton/UiButton.stories.ts +286 -198
  60. package/src/components/UiButton/mcp-docs.json +49 -0
  61. package/src/components/UiCalendar/UiCalendar.vue +2 -5
  62. package/src/components/UiCalendar/__tests__/UiCalendar.test.ts +4 -2
  63. package/src/components/UiCheckbox/UiCheckbox.stories.ts +176 -2
  64. package/src/components/UiCheckbox/mcp-docs.json +36 -0
  65. package/src/components/UiChip/types.ts +1 -1
  66. package/src/components/UiDialog/UiDialogFooter.vue +0 -3
  67. package/src/components/UiDialog/UiDialogHeader.vue +0 -3
  68. package/src/components/UiDialog/types.ts +10 -4
  69. package/src/components/UiDropdownMenu/__tests__/UiDropdownMenu.test.ts +1 -1
  70. package/src/components/UiField/UiField.stories.ts +265 -3
  71. package/src/components/UiField/UiField.vue +9 -2
  72. package/src/components/UiField/UiFieldError.vue +3 -3
  73. package/src/components/UiField/mcp-docs.json +72 -0
  74. package/src/components/UiFileItem/UiFileItem.stories.ts +11 -11
  75. package/src/components/UiFileUploadBox/UiFileUploadBox.vue +1 -1
  76. package/src/components/UiIcon/UiIcon.vue +3 -2
  77. package/src/components/UiInput/UiInput.vue +19 -3
  78. package/src/components/UiInput/mcp-docs.json +51 -0
  79. package/src/components/UiItem/UiItem.stories.ts +118 -2
  80. package/src/components/UiItem/__tests__/UiItem.test.ts +3 -5
  81. package/src/components/UiItem/mcp-docs.json +25 -0
  82. package/src/components/UiLabel/UiLabel.vue +1 -1
  83. package/src/components/UiListbox/UiListbox.vue +3 -6
  84. package/src/components/UiListbox/UiListboxFilter.vue +1 -1
  85. package/src/components/UiListbox/UiListboxItem.vue +1 -1
  86. package/src/components/UiProgress/UiProgress.vue +1 -1
  87. package/src/components/UiRadioGroup/UiRadioGroup.vue +1 -1
  88. package/src/components/UiRadioGroup/UiRadioGroupItem.vue +2 -2
  89. package/src/components/UiRadioGroup/__tests__/UiRadioGroup.test.ts +2 -2
  90. package/src/components/UiRangeCalendar/UiRangeCalendar.vue +2 -5
  91. package/src/components/UiRangeCalendar/__tests__/UiRangeCalendar.test.ts +9 -6
  92. package/src/components/UiSelect/UiSelect.stories.ts +4 -90
  93. package/src/components/UiSelect/UiSelect.vue +66 -144
  94. package/src/components/UiSelect/UiSelectContent.vue +8 -21
  95. package/src/components/UiSelect/UiSelectItem.vue +0 -82
  96. package/src/components/UiSelect/UiSelectTrigger.vue +1 -62
  97. package/src/components/UiSelect/UiSelectValue.vue +1 -47
  98. package/src/components/UiSelect/__tests__/UiSelect.test.ts +47 -98
  99. package/src/components/UiSelect/__tests__/UiSelectContent.test.ts +36 -3
  100. package/src/components/UiSelect/__tests__/UiSelectItem.test.ts +1 -1
  101. package/src/components/UiSelect/__tests__/UiSelectTrigger.test.ts +2 -2
  102. package/src/components/UiSelect/types.ts +29 -6
  103. package/src/components/UiSwitch/UiSwitch.vue +1 -1
  104. package/src/components/UiTagsInput/UiTagsInput.vue +1 -1
  105. package/src/components/UiTagsInput/UiTagsInputInput.vue +1 -1
  106. package/src/components/UiTagsInput/UiTagsInputItem.vue +1 -1
  107. package/src/components/UiTagsInput/types.ts +1 -4
  108. package/src/components/UiTooltip/UiTooltip.stories.ts +0 -8
  109. package/src/components/core/accordion/AccordionItem.vue +1 -1
  110. package/src/components/core/alert-dialog/AlertDialogContent.vue +1 -1
  111. package/src/components/core/badge/Badge.vue +2 -5
  112. package/src/components/core/calendar/CalendarHeading.vue +1 -1
  113. package/src/components/core/dropdown-menu/DropdownMenuSub.vue +1 -1
  114. package/src/components/core/item/index.ts +1 -1
  115. package/src/components/core/listbox/Listbox.vue +2 -5
  116. package/src/components/core/listbox/ListboxContent.vue +2 -5
  117. package/src/components/core/listbox/ListboxFilter.vue +2 -5
  118. package/src/components/core/listbox/ListboxGroup.vue +2 -5
  119. package/src/components/core/listbox/ListboxGroupLabel.vue +2 -5
  120. package/src/components/core/listbox/ListboxItem.vue +2 -5
  121. package/src/components/core/listbox/ListboxItemIndicator.vue +2 -5
  122. package/src/components/core/range-calendar/RangeCalendarHeading.vue +1 -1
  123. package/src/components/core/sidebar/SidebarContent.vue +4 -5
  124. package/src/components/core/sidebar/SidebarFooter.vue +4 -5
  125. package/src/components/core/sidebar/SidebarGroup.vue +4 -5
  126. package/src/components/core/sidebar/SidebarHeader.vue +4 -5
  127. package/src/components/core/sidebar/SidebarMenu.vue +4 -5
  128. package/src/components/core/sidebar/SidebarMenuAction.vue +1 -1
  129. package/src/components/core/sidebar/SidebarMenuButtonChild.vue +1 -1
  130. package/src/components/core/sidebar/SidebarMenuSkeleton.vue +1 -1
  131. package/src/components/core/sidebar/SidebarMenuSubButton.vue +1 -1
  132. package/src/components/core/sidebar/SidebarSeparator.vue +4 -5
  133. package/src/components/core/stepper/StepperDescription.vue +1 -1
  134. package/src/components/core/stepper/StepperIndicator.vue +1 -1
  135. package/src/components/core/stepper/StepperItem.vue +1 -1
  136. package/src/components/core/tags-input/TagsInput.vue +2 -5
  137. package/src/components/core/tags-input/TagsInputInput.vue +2 -5
  138. package/src/components/core/tags-input/TagsInputItem.vue +2 -5
  139. package/src/components/core/tags-input/TagsInputItemDelete.vue +2 -5
  140. package/src/components/core/tags-input/TagsInputItemText.vue +2 -5
  141. package/src/components/core/toggle/Toggle.vue +1 -1
  142. package/src/index.ts +30 -5
  143. package/src/lib/useDrag.ts +1 -0
  144. package/src/lib/utils.ts +12 -0
  145. package/src/patterns/UiDataTable/UiDataTable.mock.ts +13 -4
  146. package/src/patterns/UiDataTable/UiDataTable.vue +1 -0
  147. package/src/patterns/UiDataTable/__tests__/UiDataTable.test.ts +11 -2
  148. package/src/patterns/UiDatePicker/__tests__/UiDatePicker.test.ts +28 -39
  149. package/src/patterns/UiSidebar/UiSidebarContent.vue +0 -3
  150. package/src/patterns/UiSidebar/UiSidebarFooter.vue +0 -3
  151. package/src/patterns/UiSidebar/UiSidebarGroup.vue +4 -5
  152. package/src/patterns/UiSidebar/UiSidebarGroupContent.vue +0 -3
  153. package/src/patterns/UiSidebar/UiSidebarHeader.vue +4 -5
  154. package/src/patterns/UiSidebar/UiSidebarInset.vue +0 -3
  155. package/src/patterns/UiSidebar/UiSidebarMenu.vue +0 -3
  156. package/src/patterns/UiSidebar/UiSidebarMenuButton.vue +4 -5
  157. package/src/patterns/UiSidebar/UiSidebarMenuItem.vue +0 -3
  158. package/src/patterns/UiSidebar/UiSidebarMenuSub.vue +4 -5
  159. package/src/patterns/UiSidebar/UiSidebarMenuSubItem.vue +4 -5
  160. package/src/patterns/UiSidebar/UiSidebarPopoverMenu.vue +4 -5
  161. package/src/patterns/UiSidebar/UiSidebarPopoverMenuItem.vue +4 -5
  162. package/src/patterns/UiSidebar/UiSidebarPopoverTrigger.vue +4 -5
  163. package/src/patterns/UiSidebar/UiSidebarProvider.vue +0 -3
  164. package/src/patterns/UiSidebar/UiSidebarRail.vue +0 -3
  165. package/src/patterns/UiSidebar/UiSidebarSub.vue +4 -5
  166. package/src/patterns/UiSidebar/__tests__/UiSidebar.test.ts +21 -17
  167. package/src/patterns/UiSidebar/__tests__/UiSidebarMenuButton.test.ts +12 -10
  168. package/src/patterns/UiSidebar/types.ts +8 -8
  169. package/src/theme/Typography.stories.ts +3 -2
  170. package/dist/system/components/UiSelect/context.d.ts +0 -28
  171. package/src/components/UiSelect/context.ts +0 -42
@@ -0,0 +1,72 @@
1
+ {
2
+ "designNotes": {
3
+ "title": "Usage",
4
+ "summary": "The Field component establishes a consistent structure for collecting information from users. It creates a predictable relationship between inputs, labels, help text, and validation messages, making forms easier to scan, understand, and complete. The component should be used whenever a user is expected to provide, select, or modify information.",
5
+ "sections": [
6
+ {
7
+ "title": "Clarity first",
8
+ "content": "Users should immediately understand:",
9
+ "items": [
10
+ "What information is being requested",
11
+ "Whether the field is required or optional",
12
+ "How to successfully complete the field",
13
+ "What needs to be corrected when errors occur"
14
+ ]
15
+ },
16
+ {
17
+ "title": "Progressive guidance",
18
+ "content": "Provide information only when it helps the user complete a task:",
19
+ "items": [
20
+ "Label explains what is needed",
21
+ "Description provides additional guidance",
22
+ "Error message appears only when required"
23
+ ]
24
+ },
25
+ {
26
+ "title": "Consistency",
27
+ "content": "All form controls should follow the same structure regardless of input type:",
28
+ "items": [
29
+ "Text Input",
30
+ "Select",
31
+ "Checkbox",
32
+ "Switch",
33
+ "Radio Group",
34
+ "Text Area",
35
+ "Slider"
36
+ ]
37
+ }
38
+ ],
39
+ "do": [
40
+ "Use a clear label for every field",
41
+ "Provide helpful descriptions when needed",
42
+ "Group related information together",
43
+ "Write actionable error messages",
44
+ "Use vertical layouts for complex forms"
45
+ ],
46
+ "dont": [
47
+ "Use placeholders as labels",
48
+ "Display errors before interaction",
49
+ "Overload fields with excessive guidance",
50
+ "Create inconsistent field layouts across screens",
51
+ "Depend solely on color to indicate validation states"
52
+ ]
53
+ },
54
+ "accessibility": {
55
+ "title": "Accessibility",
56
+ "sections": [
57
+ {
58
+ "title": "Requirements",
59
+ "items": [
60
+ "Every field has a visible label",
61
+ "Error states are communicated through more than color alone",
62
+ "Descriptions remain readable and associated with the field",
63
+ "Form sections use meaningful group labels"
64
+ ]
65
+ },
66
+ {
67
+ "title": "Enable accessibility theme",
68
+ "content": "When accessibility is required, enable the accessibility theme. This increases contrast and ensures there are no color contrast issues."
69
+ }
70
+ ]
71
+ }
72
+ }
@@ -73,7 +73,7 @@ type Story = StoryObj<typeof UiFileItem>;
73
73
  const renderArgs = (args: Story['args']) => ({
74
74
  components: { UiFileItem },
75
75
  setup() {
76
- function onRemove() {}
76
+ const onRemove = () => undefined;
77
77
  const normalized = {
78
78
  ...args,
79
79
  mediaIcon: args?.mediaIcon || undefined,
@@ -87,7 +87,7 @@ const renderArgs = (args: Story['args']) => ({
87
87
  const defaultTemplateSource = `<script setup lang="ts">
88
88
  import { UiFileItem } from '@aleph-alpha/ui-library'
89
89
 
90
- function onRemove() {}
90
+ const onRemove = () => undefined;
91
91
  </script>
92
92
 
93
93
  <template>
@@ -110,7 +110,7 @@ export const Default: Story = {
110
110
  const defaultWithProgressTemplateSource = `<script setup lang="ts">
111
111
  import { UiFileItem } from '@aleph-alpha/ui-library'
112
112
 
113
- function onRemove() {}
113
+ const onRemove = () => undefined;
114
114
  </script>
115
115
 
116
116
  <template>
@@ -140,7 +140,7 @@ export const DefaultWithProgress: Story = {
140
140
  const defaultSuccessTemplateSource = `<script setup lang="ts">
141
141
  import { UiFileItem } from '@aleph-alpha/ui-library'
142
142
 
143
- function onRemove() {}
143
+ const onRemove = () => undefined;
144
144
  </script>
145
145
 
146
146
  <template>
@@ -174,7 +174,7 @@ export const DefaultSuccess: Story = {
174
174
  const defaultErrorTemplateSource = `<script setup lang="ts">
175
175
  import { UiFileItem } from '@aleph-alpha/ui-library'
176
176
 
177
- function onRemove() {}
177
+ const onRemove = () => undefined;
178
178
  </script>
179
179
 
180
180
  <template>
@@ -204,7 +204,7 @@ export const DefaultError: Story = {
204
204
  const smallWithProgressTemplateSource = `<script setup lang="ts">
205
205
  import { UiFileItem } from '@aleph-alpha/ui-library'
206
206
 
207
- function onRemove() {}
207
+ const onRemove = () => undefined;
208
208
  </script>
209
209
 
210
210
  <template>
@@ -235,7 +235,7 @@ export const SmallWithProgress: Story = {
235
235
  const smallSuccessTemplateSource = `<script setup lang="ts">
236
236
  import { UiFileItem } from '@aleph-alpha/ui-library'
237
237
 
238
- function onRemove() {}
238
+ const onRemove = () => undefined;
239
239
  </script>
240
240
 
241
241
  <template>
@@ -270,7 +270,7 @@ export const SmallSuccess: Story = {
270
270
  const smallErrorTemplateSource = `<script setup lang="ts">
271
271
  import { UiFileItem } from '@aleph-alpha/ui-library'
272
272
 
273
- function onRemove() {}
273
+ const onRemove = () => undefined;
274
274
  </script>
275
275
 
276
276
  <template>
@@ -331,7 +331,7 @@ export const NonRemovable: Story = {
331
331
  const disabledTemplateSource = `<script setup lang="ts">
332
332
  import { UiFileItem } from '@aleph-alpha/ui-library'
333
333
 
334
- function onRemove() {}
334
+ const onRemove = () => undefined;
335
335
  </script>
336
336
 
337
337
  <template>
@@ -363,7 +363,7 @@ export const Disabled: Story = {
363
363
  const allVariantsTemplateSource = `<script setup lang="ts">
364
364
  import { UiFileItem } from '@aleph-alpha/ui-library'
365
365
 
366
- function onRemove() {}
366
+ const onRemove = () => undefined;
367
367
  </script>
368
368
 
369
369
  <template>
@@ -408,7 +408,7 @@ export const AllVariants: Story = {
408
408
  render: () => ({
409
409
  components: { UiFileItem },
410
410
  setup() {
411
- function onRemove() {}
411
+ const onRemove = () => undefined;
412
412
  return { onRemove };
413
413
  },
414
414
  template: `
@@ -126,7 +126,7 @@ function processFileList(fileList: FileList) {
126
126
  // `multiple` on the hidden input only limits the OS picker; drag-and-drop can still
127
127
  // deliver many files — honor single-file mode here too (first valid file wins).
128
128
  if (!props.multiple) {
129
- if (valid.length > 0) emit('update:files', [valid[0]]);
129
+ if (valid[0]) emit('update:files', [valid[0]]);
130
130
  return;
131
131
  }
132
132
  if (valid.length) emit('update:files', valid);
@@ -44,7 +44,7 @@ const iconLookup = lucideIcons as unknown as Record<string, Component>;
44
44
  */
45
45
  function toPascalCase(str: string): string {
46
46
  // If already PascalCase (starts with uppercase, no hyphens), return as-is
47
- if (!str.includes('-') && str[0] === str[0].toUpperCase()) {
47
+ if (!str.includes('-') && str.charAt(0) === str.charAt(0).toUpperCase()) {
48
48
  return str;
49
49
  }
50
50
  return str
@@ -66,7 +66,8 @@ const computedRole = computed(() => {
66
66
 
67
67
  // Filter out role from attrs since we handle it explicitly
68
68
  const filteredAttrs = computed(() => {
69
- const { role, ...rest } = attrs;
69
+ const rest = { ...attrs };
70
+ delete rest.role;
70
71
  return rest;
71
72
  });
72
73
  </script>
@@ -2,11 +2,12 @@
2
2
  import { Input as ShadcnInput } from '@/components/core/input';
3
3
  import { UiButton } from '@/components/UiButton';
4
4
  import { UiIcon } from '@/components/UiIcon';
5
- import { computed, ref } from 'vue';
5
+ import { computed, ref, useAttrs } from 'vue';
6
6
  import type { UiInputProps } from './types';
7
7
 
8
8
  defineOptions({
9
9
  name: 'UiInput',
10
+ inheritAttrs: false,
10
11
  });
11
12
 
12
13
  const props = withDefaults(defineProps<UiInputProps>(), {
@@ -26,6 +27,7 @@ const emit = defineEmits<{
26
27
 
27
28
  const model = defineModel<string>();
28
29
 
30
+ const attrs = useAttrs();
29
31
  const isFile = computed(() => props.type === 'file');
30
32
 
31
33
  const selectedFiles = ref<File[]>([]);
@@ -34,7 +36,8 @@ const filePlaceholder = computed(() => props.placeholder ?? 'No file chosen');
34
36
 
35
37
  const fileDisplayValue = computed(() => {
36
38
  if (selectedFiles.value.length === 0) return '';
37
- if (selectedFiles.value.length === 1) return selectedFiles.value[0].name;
39
+ if (selectedFiles.value.length === 1)
40
+ return selectedFiles.value[0]?.name ?? '';
38
41
  return `${selectedFiles.value.length} files selected`;
39
42
  });
40
43
 
@@ -57,6 +60,7 @@ function handleFilesChange(e: Event) {
57
60
  -->
58
61
  <div
59
62
  v-if="isFile"
63
+ v-bind="attrs"
60
64
  class="flex h-9 w-full min-w-0 items-center gap-2 rounded-md border border-input bg-background-input-default px-1 transition-[color] outline-none focus-within:border-ring focus-within:ring-ring/50 focus-within:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive"
61
65
  :class="{
62
66
  'pointer-events-none cursor-not-allowed opacity-50': props.disabled,
@@ -87,5 +91,17 @@ function handleFilesChange(e: Event) {
87
91
  {{ fileDisplayValue || filePlaceholder }}
88
92
  </span>
89
93
  </div>
90
- <ShadcnInput v-else v-model="model" v-bind="props" />
94
+ <div v-else-if="$slots.end" class="relative">
95
+ <ShadcnInput
96
+ v-model="model"
97
+ v-bind="{ ...attrs, ...props }"
98
+ class="pr-14"
99
+ />
100
+ <div
101
+ class="pointer-events-none absolute inset-y-0 right-2 flex items-center"
102
+ >
103
+ <slot name="end" />
104
+ </div>
105
+ </div>
106
+ <ShadcnInput v-else v-model="model" v-bind="{ ...attrs, ...props }" />
91
107
  </template>
@@ -0,0 +1,51 @@
1
+ {
2
+ "designNotes": {
3
+ "title": "Usage",
4
+ "summary": "Use inputs for short, single-line values such as names, email addresses, search terms, and numeric values. Pair inputs with UiField when a label, description, validation message, or other form guidance is needed.",
5
+ "sections": [
6
+ {
7
+ "title": "Labels and placeholders",
8
+ "content": "Use a visible label to identify the requested value. Placeholder text can provide an example format, but it should not replace the label."
9
+ },
10
+ {
11
+ "title": "Supporting content",
12
+ "content": "Use descriptions to explain constraints, examples, or consequences. Use the end slot for compact, non-interactive hints such as keyboard shortcuts."
13
+ },
14
+ {
15
+ "title": "Input type",
16
+ "content": "Choose the native type that matches the expected value, such as email, search, number, password, or file."
17
+ }
18
+ ],
19
+ "do": [
20
+ "Use a clear visible label with every input",
21
+ "Use placeholder text only as an example or hint",
22
+ "Pair with UiField for descriptions and validation feedback",
23
+ "Use the end slot for compact supporting hints like keyboard shortcuts",
24
+ "Choose the correct native input type"
25
+ ],
26
+ "dont": [
27
+ "Use placeholders as labels",
28
+ "Put long instructions inside the input",
29
+ "Use an input when users need to enter multi-line content",
30
+ "Depend solely on color to communicate validation state"
31
+ ]
32
+ },
33
+ "accessibility": {
34
+ "title": "Accessibility",
35
+ "sections": [
36
+ {
37
+ "title": "Requirements",
38
+ "items": [
39
+ "Every input has a visible label",
40
+ "Descriptions remain readable and associated with the field",
41
+ "Validation states are communicated through more than color alone",
42
+ "Keyboard hints do not block typing or focus"
43
+ ]
44
+ },
45
+ {
46
+ "title": "Enable accessibility theme",
47
+ "content": "When accessibility is required, enable the accessibility theme. This increases contrast and ensures there are no color contrast issues."
48
+ }
49
+ ]
50
+ }
51
+ }
@@ -20,9 +20,11 @@ import {
20
20
  UiAvatarImage,
21
21
  } from '../UiAvatar';
22
22
 
23
+ const designStoryLink = '/?path=/docs/components-uiitem--design-notes';
24
+ const accessibilityStoryLink = '/?path=/docs/components-uiitem--accessibility';
25
+
23
26
  /**
24
- * UiItem is a composable list/row primitive with title, description, leading/trailing slots, and actions.
25
- * Use it as the building block for lists, settings rows, navigation entries, and option pickers — wherever you need a consistently styled item.
27
+ * A versatile component that you can use to display any content.
26
28
  */
27
29
  const meta: Meta<typeof UiItem> = {
28
30
  title: 'Components/UiItem',
@@ -82,6 +84,22 @@ const meta: Meta<typeof UiItem> = {
82
84
  asChild: false,
83
85
  withListSemantics: false,
84
86
  },
87
+ parameters: {
88
+ docs: {
89
+ links: [
90
+ {
91
+ label: 'Designer docs',
92
+ href: designStoryLink,
93
+ icon: 'palette',
94
+ },
95
+ {
96
+ label: 'Accessibility',
97
+ href: accessibilityStoryLink,
98
+ icon: 'accessibility',
99
+ },
100
+ ],
101
+ },
102
+ },
85
103
  };
86
104
 
87
105
  export default meta;
@@ -454,6 +472,104 @@ export const Basic: Story = {
454
472
  },
455
473
  };
456
474
 
475
+ /**
476
+ * Design guidance for choosing item variants, density, and composition.
477
+ */
478
+ export const DesignNotes: Story = {
479
+ render: () => ({
480
+ components: { UiButton },
481
+ template: `
482
+ <section class="flex flex-col gap-8 p-4 bg-surface-secondary">
483
+ <div>
484
+ <h2 class="heading-m font-bold text-content-on-surface-primary">Usage</h2>
485
+ <p class="body-16-regular mt-2 text-content-on-surface-primary">
486
+ The Item component can house nearly any type of content. Use it to display a title,
487
+ description, and actions. Group it with the ItemGroup component to create a list of items.
488
+ Please refer to the stories for examples of different configurations.
489
+ </p>
490
+ </div>
491
+ </section>
492
+ `,
493
+ }),
494
+ parameters: {
495
+ chromatic: {
496
+ disableSnapshot: true,
497
+ },
498
+ docs: {
499
+ canvas: {
500
+ sourceState: 'none',
501
+ },
502
+ },
503
+ },
504
+ };
505
+
506
+ /**
507
+ * Accessibility guidance for item contrast and accessible theme usage.
508
+ */
509
+ export const Accessibility: Story = {
510
+ render: () => ({
511
+ components: { UiItem, UiIcon },
512
+ template: `
513
+ <section class="flex flex-col gap-6 p-4">
514
+ <div>
515
+ <h2 class="heading-m font-bold text-content-on-surface-primary">
516
+ Accessibility
517
+ </h2>
518
+ </div>
519
+
520
+ <div class="flex flex-col gap-6">
521
+ <div class="flex flex-col gap-2">
522
+ <h3 class="body-16-medium text-content-on-surface-primary">
523
+ Enable accessibility theme
524
+ </h3>
525
+ <p class="body-16-regular text-content-on-surface-primary">
526
+ When accessibility is required, enable our accessibility theme. This increases contrast and makes sure there are no color contrast issues.
527
+ </p>
528
+ </div>
529
+ </div>
530
+
531
+ <div class="grid gap-4 md:grid-cols-2">
532
+ <div class="flex flex-col gap-3">
533
+ <h3 class="label-16-medium text-center text-content-on-surface-primary">
534
+ Default
535
+ </h3>
536
+ <div class="flex min-h-20 items-center justify-center border border-border-surface-default p-6">
537
+ <UiItem variant="outline" title="Item title" description="Item description goes here">
538
+ <template #icon>
539
+ <UiIcon name="folder-open" size="s" />
540
+ </template>
541
+ </UiItem>
542
+ </div>
543
+ </div>
544
+
545
+ <div class="accessible-theme flex flex-col gap-3">
546
+ <h3 class="label-16-medium text-center text-content-on-surface-primary">
547
+ Accessible
548
+ </h3>
549
+ <div class="flex min-h-20 items-center justify-center border border-border-surface-default p-6">
550
+ <UiItem variant="outline" title="Item title" description="Item description goes here">
551
+ <template #icon>
552
+ <UiIcon name="folder-open" size="s" />
553
+ </template>
554
+ </UiItem>
555
+ </div>
556
+ </div>
557
+ </div>
558
+ </section>
559
+ `,
560
+ }),
561
+ parameters: {
562
+ chromatic: {
563
+ disableSnapshot: true,
564
+ },
565
+ docs: {
566
+ canvas: {
567
+ sourceState: 'none',
568
+ },
569
+ },
570
+ },
571
+ };
572
+
457
573
  /**
458
574
  * Shows each visual variant and when to choose it. Use this to compare static,
459
575
  * current, outlined, row-hover, and separate action-hover rows.
@@ -91,10 +91,8 @@ describe('UiItem', () => {
91
91
  });
92
92
 
93
93
  const element = container.querySelector('[data-slot="item"]');
94
- expect(element).toHaveClass('ring-1');
95
- expect(element).toHaveClass('ring-inset');
96
- expect(element).toHaveClass('ring-border-surface-default');
97
- expect(element).not.toHaveClass('border');
94
+ expect(element).toHaveClass('border');
95
+ expect(element).toHaveClass('border-border-surface-default');
98
96
  });
99
97
 
100
98
  test('applies hover variant classes', () => {
@@ -389,7 +387,7 @@ describe('UiItem', () => {
389
387
  expect(element).toHaveClass('items-center');
390
388
  expect(element).toHaveClass('rounded-md');
391
389
  // Check variant classes are applied
392
- expect(element).toHaveClass('ring-border-surface-default');
390
+ expect(element).toHaveClass('border-border-surface-default');
393
391
  // Check size classes are applied
394
392
  expect(element).toHaveClass('p-2');
395
393
  });
@@ -0,0 +1,25 @@
1
+ {
2
+ "designNotes": {
3
+ "title": "Usage",
4
+ "summary": "The Item component can house nearly any type of content. Use it to display a title, description, and actions. Group it with the ItemGroup component to create a list of items. Please refer to the stories for examples of different configurations.",
5
+ "sections": [
6
+ {
7
+ "title": "Variant, density, and composition",
8
+ "content": "Choose item variants, density, and composition based on the role of the row and the surrounding layout."
9
+ }
10
+ ]
11
+ },
12
+ "accessibility": {
13
+ "title": "Accessibility",
14
+ "sections": [
15
+ {
16
+ "title": "Enable accessibility theme",
17
+ "content": "When accessibility is required, enable the accessibility theme. This increases contrast and makes sure there are no color contrast issues."
18
+ },
19
+ {
20
+ "title": "Preview guidance",
21
+ "content": "Use clear item titles, supporting descriptions, and recognizable leading icons or media where they help scanning. Make interactive item actions reachable by keyboard and provide accessible labels for icon-only actions."
22
+ }
23
+ ]
24
+ }
25
+ }
@@ -1,6 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import { Label as ShadcnLabel } from '@/components/core/label';
3
- import { UiLabelProps } from './types';
3
+ import { type UiLabelProps } from './types';
4
4
 
5
5
  defineOptions({
6
6
  name: 'UiLabel',
@@ -2,8 +2,8 @@
2
2
  import type { AcceptableValue } from 'reka-ui';
3
3
  import { computed, useAttrs } from 'vue';
4
4
  import { Listbox as ShadcnListbox } from '@/components/core/listbox';
5
- import { cn } from '@/lib/utils';
6
- import { UiListboxProps } from './types';
5
+ import { type UiListboxProps } from './types';
6
+ import { cn, omitClass } from '@/lib/utils';
7
7
 
8
8
  defineOptions({
9
9
  name: 'UiListbox',
@@ -19,10 +19,7 @@ const props = withDefaults(defineProps<UiListboxProps>(), {
19
19
  const model = defineModel<AcceptableValue | AcceptableValue[]>();
20
20
 
21
21
  const attrs = useAttrs();
22
- const forwardedAttrs = computed(() => {
23
- const { class: _class, ...rest } = attrs;
24
- return rest;
25
- });
22
+ const forwardedAttrs = computed(() => omitClass(attrs));
26
23
  </script>
27
24
 
28
25
  <template>
@@ -1,6 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import { ListboxFilter as ShadcnListboxFilter } from '@/components/core/listbox';
3
- import { UiListboxFilterProps } from './types';
3
+ import { type UiListboxFilterProps } from './types';
4
4
 
5
5
  defineOptions({
6
6
  name: 'UiListboxFilter',
@@ -1,6 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import { ListboxItem as ShadcnListboxItem } from '@/components/core/listbox';
3
- import { UiListboxItemProps } from './types';
3
+ import { type UiListboxItemProps } from './types';
4
4
 
5
5
  defineOptions({
6
6
  name: 'UiListboxItem',
@@ -1,7 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  import { computed } from 'vue';
3
3
  import { Progress as ShadcnProgress } from '@/components/core/progress';
4
- import { UiProgressProps } from './types';
4
+ import { type UiProgressProps } from './types';
5
5
 
6
6
  defineOptions({
7
7
  name: 'UiProgress',
@@ -2,7 +2,7 @@
2
2
  import { computed } from 'vue';
3
3
  import { cn } from '@/lib/utils';
4
4
  import { RadioGroup as ShadcnRadioGroup } from '@/components/core/radio-group';
5
- import { UiRadioGroupProps } from './types';
5
+ import { type UiRadioGroupProps } from './types';
6
6
 
7
7
  defineOptions({
8
8
  name: 'UiRadioGroup',
@@ -1,12 +1,12 @@
1
1
  <script setup lang="ts">
2
2
  import { RadioGroupItem as ShadcnRadioGroupItem } from '@/components/core/radio-group';
3
- import { UiRadioGroupItemProps } from './types';
3
+ import { type UiRadioGroupItemProps } from './types';
4
4
 
5
5
  defineOptions({
6
6
  name: 'UiRadioGroupItem',
7
7
  });
8
8
 
9
- const props = withDefaults(defineProps<UiRadioGroupItemProps>(), {
9
+ withDefaults(defineProps<UiRadioGroupItemProps>(), {
10
10
  asChild: false,
11
11
  disabled: false,
12
12
  required: false,
@@ -142,7 +142,7 @@ describe('UiRadioGroup', () => {
142
142
 
143
143
  describe('keyboard navigation', () => {
144
144
  test('arrow down moves focus to next item', async () => {
145
- const { getByRole, getByLabelText } = render(UiRadioGroup, {
145
+ const { getByLabelText } = render(UiRadioGroup, {
146
146
  props: {
147
147
  name: 'radio-group',
148
148
  modelValue: firstItemValue,
@@ -180,7 +180,7 @@ describe('UiRadioGroup', () => {
180
180
  });
181
181
 
182
182
  test('loops from last to first when loop is enabled (default)', async () => {
183
- const { getByRole, getByLabelText } = render(UiRadioGroup, {
183
+ const { getByLabelText } = render(UiRadioGroup, {
184
184
  props: {
185
185
  name: 'radio-group',
186
186
  modelValue: thirdItemValue,
@@ -1,7 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  import { computed, useAttrs } from 'vue';
3
3
  import { RangeCalendar as ShadcnRangeCalendar } from '@/components/core/range-calendar';
4
- import { cn } from '@/lib/utils';
4
+ import { cn, omitClass } from '@/lib/utils';
5
5
  import type { UiRangeCalendarProps } from './types';
6
6
 
7
7
  defineOptions({
@@ -27,10 +27,7 @@ const placeholder =
27
27
  defineModel<UiRangeCalendarProps['placeholder']>('placeholder');
28
28
 
29
29
  const attrs = useAttrs();
30
- const forwardedAttrs = computed(() => {
31
- const { class: _class, ...rest } = attrs;
32
- return rest;
33
- });
30
+ const forwardedAttrs = computed(() => omitClass(attrs));
34
31
  </script>
35
32
 
36
33
  <template>
@@ -19,16 +19,19 @@ describe('UiRangeCalendar', () => {
19
19
  const firstButton = clickableCells[0]?.querySelector('button');
20
20
  const secondButton = clickableCells[5]?.querySelector('button');
21
21
 
22
- expect(firstButton).toBeInTheDocument();
23
- expect(secondButton).toBeInTheDocument();
22
+ if (!firstButton || !secondButton) {
23
+ throw new Error('Expected two enabled date buttons');
24
+ }
24
25
 
25
- await userEvent.click(firstButton!);
26
- await userEvent.click(secondButton!);
26
+ await userEvent.click(firstButton);
27
+ await userEvent.click(secondButton);
27
28
 
28
29
  const emissions = emitted('update:modelValue');
29
- expect(emissions).toBeDefined();
30
+ if (!emissions) {
31
+ throw new Error('Expected update:modelValue to be emitted');
32
+ }
30
33
 
31
- const lastEmission = emissions![emissions!.length - 1][0];
34
+ const lastEmission = emissions[emissions.length - 1][0];
32
35
  expect(lastEmission).toHaveProperty('start');
33
36
  expect(lastEmission).toHaveProperty('end');
34
37
  });