@aleph-alpha/ui-library 2.5.1 → 2.6.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 (38) hide show
  1. package/config.d.ts +33 -2
  2. package/config.js +99 -70
  3. package/dist/system/components/UiFileItem/index.d.ts +1 -1
  4. package/dist/system/components/UiFileType/UiFileType.vue.d.ts +1 -0
  5. package/dist/system/components/UiFileType/types.d.ts +5 -0
  6. package/dist/system/components/core/calendar/Calendar.vue.d.ts +247 -3
  7. package/dist/system/components/core/popover/PopoverContent.vue.d.ts +1 -1
  8. package/dist/system/components/core/range-calendar/RangeCalendar.vue.d.ts +139 -2
  9. package/dist/system/lib.js +3166 -3129
  10. package/package.json +3 -3
  11. package/src/components/UiCodeBlock/UiCodeBlock.vue +6 -1
  12. package/src/components/UiField/UiField.stories.ts +15 -9
  13. package/src/components/UiFileItem/UiFileItem.stories.ts +21 -14
  14. package/src/components/UiFileItem/UiFileItem.vue +1 -0
  15. package/src/components/UiFileItem/index.ts +5 -1
  16. package/src/components/UiFileType/UiFileType.stories.ts +59 -0
  17. package/src/components/UiFileType/UiFileType.vue +3 -8
  18. package/src/components/UiFileType/__tests__/UiFileType.test.ts +9 -0
  19. package/src/components/UiFileType/types.ts +5 -0
  20. package/src/components/UiFileUploadBox/UiFileUploadBox.vue +58 -56
  21. package/src/components/UiListbox/UiListbox.stories.ts +1 -1
  22. package/src/components/UiSelect/UiSelectTrigger.vue +8 -2
  23. package/src/components/UiSnackbar/UiSnackbar.stories.ts +1 -0
  24. package/src/components/UiTable/UiTable.stories.ts +6 -2
  25. package/src/components/UiTabs/UiTabs.stories.ts +2 -2
  26. package/src/components/UiTagsInput/UiTagsInput.stories.ts +12 -2
  27. package/src/components/core/calendar/Calendar.vue +17 -1
  28. package/src/components/core/checkbox/Checkbox.vue +1 -0
  29. package/src/components/core/listbox/ListboxContent.vue +1 -0
  30. package/src/components/core/native-select/NativeSelect.vue +6 -0
  31. package/src/components/core/range-calendar/RangeCalendar.vue +19 -0
  32. package/src/components/core/slider/Slider.vue +1 -0
  33. package/src/directives/vHover.stories.ts +16 -12
  34. package/src/patterns/UiDataTable/UiDataTable.stories.ts +2 -2
  35. package/src/theme/Background.stories.ts +16 -0
  36. package/src/theme/Flex.stories.ts +1 -1
  37. package/src/theme/Theme.stories.ts +3 -3
  38. package/tokens.json +4273 -1152
@@ -2,6 +2,7 @@
2
2
  import type { AcceptableValue } from 'reka-ui';
3
3
  import type { HTMLAttributes } from 'vue';
4
4
  import { reactiveOmit, useVModel } from '@vueuse/core';
5
+ import { computed, useAttrs } from 'vue';
5
6
  import { UiIcon } from '@/components/UiIcon';
6
7
  import { cn } from '@/lib/utils';
7
8
 
@@ -22,6 +23,10 @@ const modelValue = useVModel(props, 'modelValue', emit, {
22
23
  passive: true,
23
24
  defaultValue: '',
24
25
  });
26
+ const attrs = useAttrs();
27
+ const ariaLabel = computed(
28
+ () => (attrs['aria-label'] as string | undefined) ?? 'Select value',
29
+ );
25
30
 
26
31
  const delegatedProps = reactiveOmit(props, 'class');
27
32
  </script>
@@ -34,6 +39,7 @@ const delegatedProps = reactiveOmit(props, 'class');
34
39
  <select
35
40
  v-bind="{ ...$attrs, ...delegatedProps }"
36
41
  v-model="modelValue"
42
+ :aria-label="ariaLabel"
37
43
  data-slot="native-select"
38
44
  :class="
39
45
  cn(
@@ -3,6 +3,7 @@ import type { RangeCalendarRootEmits, RangeCalendarRootProps } from 'reka-ui';
3
3
  import type { HTMLAttributes } from 'vue';
4
4
  import { reactiveOmit } from '@vueuse/core';
5
5
  import { RangeCalendarRoot, useForwardPropsEmits } from 'reka-ui';
6
+ import { nextTick, onMounted, ref, watch } from 'vue';
6
7
  import { cn } from '@/lib/utils';
7
8
  import {
8
9
  RangeCalendarCell,
@@ -27,10 +28,28 @@ const emits = defineEmits<RangeCalendarRootEmits>();
27
28
  const delegatedProps = reactiveOmit(props, 'class');
28
29
 
29
30
  const forwarded = useForwardPropsEmits(delegatedProps, emits);
31
+ const rangeCalendarRootRef = ref<InstanceType<typeof RangeCalendarRoot> | null>(
32
+ null,
33
+ );
34
+
35
+ function removeUnsupportedReadonlyAttributes() {
36
+ nextTick(() => {
37
+ const root = rangeCalendarRootRef.value?.$el as HTMLElement | undefined;
38
+ root
39
+ ?.querySelectorAll('[role="application"][aria-readonly]')
40
+ .forEach((el) => {
41
+ el.removeAttribute('aria-readonly');
42
+ });
43
+ });
44
+ }
45
+
46
+ onMounted(removeUnsupportedReadonlyAttributes);
47
+ watch(() => props.readonly, removeUnsupportedReadonlyAttributes);
30
48
  </script>
31
49
 
32
50
  <template>
33
51
  <RangeCalendarRoot
52
+ ref="rangeCalendarRootRef"
34
53
  #default="{ grid, weekDays }"
35
54
  data-slot="range-calendar"
36
55
  :class="cn('p-3', props.class)"
@@ -47,6 +47,7 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits);
47
47
  v-for="(_, key) in modelValue"
48
48
  :key="key"
49
49
  data-slot="slider-thumb"
50
+ :aria-label="(modelValue?.length ?? 0) > 1 ? `Value ${key + 1}` : 'Value'"
50
51
  class="bg-white border-primary ring-ring/50 block size-4 shrink-0 rounded-full border shadow-sm transition-[color,box-shadow] hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50"
51
52
  />
52
53
  </SliderRoot>
@@ -24,6 +24,7 @@ const VHoverDemo = defineComponent({
24
24
  <div class="p-8 bg-white dark:bg-background">
25
25
  <style>
26
26
  .copy-btn { cursor: pointer; transition: all 0.15s; }
27
+ .copy-btn:focus-visible { outline: 2px solid oklch(var(--border-surface-focus-ring)); outline-offset: 2px; }
27
28
  .copy-btn:hover { background: rgba(0,0,0,0.05); }
28
29
  .copy-btn.copied { background: #22c55e22; }
29
30
  .copy-btn.copied::after { content: ' ✓'; color: #22c55e; }
@@ -49,16 +50,17 @@ const VHoverDemo = defineComponent({
49
50
  <button
50
51
  type="button"
51
52
  v-hover="'subtle'"
52
- class="h-24 w-40 rounded-md bg-background-button-primary-button body-14-medium text-content-on-button-primary-button flex items-center justify-center border border-border-surface-default shadow-xs"
53
+ class="h-24 w-40 rounded-md bg-background-surface-secondary body-14-medium text-content-on-surface-primary flex items-center justify-center border border-border-surface-default shadow-xs"
53
54
  >
54
55
  subtle
55
56
  </button>
56
57
  <div class="text-center">
57
58
  <span class="label-12-medium text-content-on-surface-primary block">subtle</span>
58
- <code
59
- class="copy-btn label-12-regular text-content-on-surface-muted block mt-0.5 px-1 py-0.5 rounded"
59
+ <button
60
+ type="button"
61
+ class="copy-btn label-12-regular text-content-on-surface-muted block mt-0.5 px-1 py-0.5 rounded border-0 bg-transparent"
60
62
  @click="copyVHover('subtle', $event)"
61
- >v-hover="'subtle'"</code>
63
+ ><code>v-hover="'subtle'"</code></button>
62
64
  </div>
63
65
  </div>
64
66
 
@@ -66,16 +68,17 @@ const VHoverDemo = defineComponent({
66
68
  <button
67
69
  type="button"
68
70
  v-hover="'default'"
69
- class="h-24 w-40 rounded-md bg-background-button-primary-button body-14-medium text-content-on-button-primary-button flex items-center justify-center border border-border-surface-default shadow-xs"
71
+ class="h-24 w-40 rounded-md bg-background-surface-secondary body-14-medium text-content-on-surface-primary flex items-center justify-center border border-border-surface-default shadow-xs"
70
72
  >
71
73
  default
72
74
  </button>
73
75
  <div class="text-center">
74
76
  <span class="label-12-medium text-content-on-surface-primary block">default</span>
75
- <code
76
- class="copy-btn label-12-regular text-content-on-surface-muted block mt-0.5 px-1 py-0.5 rounded"
77
+ <button
78
+ type="button"
79
+ class="copy-btn label-12-regular text-content-on-surface-muted block mt-0.5 px-1 py-0.5 rounded border-0 bg-transparent"
77
80
  @click="copyVHover('default', $event)"
78
- >v-hover="'default'"</code>
81
+ ><code>v-hover="'default'"</code></button>
79
82
  </div>
80
83
  </div>
81
84
 
@@ -83,16 +86,17 @@ const VHoverDemo = defineComponent({
83
86
  <button
84
87
  type="button"
85
88
  v-hover="'strong'"
86
- class="h-24 w-40 rounded-md bg-background-button-primary-button body-14-medium text-content-on-button-primary-button flex items-center justify-center border border-border-surface-default shadow-xs"
89
+ class="h-24 w-40 rounded-md bg-background-surface-secondary body-14-medium text-content-on-surface-primary flex items-center justify-center border border-border-surface-default shadow-xs"
87
90
  >
88
91
  strong
89
92
  </button>
90
93
  <div class="text-center">
91
94
  <span class="label-12-medium text-content-on-surface-primary block">strong</span>
92
- <code
93
- class="copy-btn label-12-regular text-content-on-surface-muted block mt-0.5 px-1 py-0.5 rounded"
95
+ <button
96
+ type="button"
97
+ class="copy-btn label-12-regular text-content-on-surface-muted block mt-0.5 px-1 py-0.5 rounded border-0 bg-transparent"
94
98
  @click="copyVHover('strong', $event)"
95
- >v-hover="'strong'"</code>
99
+ ><code>v-hover="'strong'"</code></button>
96
100
  </div>
97
101
  </div>
98
102
  </div>
@@ -1861,7 +1861,7 @@ const cellFormattingColumns: ColumnDef<Payment>[] = [
1861
1861
  return h(
1862
1862
  'div',
1863
1863
  {
1864
- class: `text-right font-medium ${amount > 500 ? 'text-green-600' : 'text-muted-foreground'}`,
1864
+ class: `text-right font-medium ${amount > 500 ? 'text-green-800' : 'text-muted-foreground'}`,
1865
1865
  },
1866
1866
  formatted,
1867
1867
  );
@@ -1927,7 +1927,7 @@ const columns: ColumnDef<Payment>[] = [
1927
1927
  currency: 'EUR',
1928
1928
  }).format(amount);
1929
1929
  return h('div', {
1930
- class: \`text-right font-medium \${amount > 500 ? 'text-green-600' : 'text-muted-foreground'}\`,
1930
+ class: \`text-right font-medium \${amount > 500 ? 'text-green-800' : 'text-muted-foreground'}\`,
1931
1931
  }, formatted);
1932
1932
  },
1933
1933
  },
@@ -267,6 +267,22 @@ export const Accent: Story = {
267
267
  <code class="copy-btn label-12-regular text-content-on-surface-muted block mt-0.5 px-1 py-0.5 rounded" onclick="copyToClipboard('bg-background-accent-soft', this)">bg-background-accent-soft</code>
268
268
  </div>
269
269
  </div>
270
+
271
+ <div class="flex flex-col items-center gap-1.5">
272
+ <div class="w-16 h-16 rounded-md bg-background-accent-pink border border-border-surface-default"></div>
273
+ <div class="text-center">
274
+ <span class="label-12-medium text-content-on-surface-primary block">pink</span>
275
+ <code class="copy-btn label-12-regular text-content-on-surface-muted block mt-0.5 px-1 py-0.5 rounded" onclick="copyToClipboard('bg-background-accent-pink', this)">bg-background-accent-pink</code>
276
+ </div>
277
+ </div>
278
+
279
+ <div class="flex flex-col items-center gap-1.5">
280
+ <div class="w-16 h-16 rounded-md bg-background-accent-yellow border border-border-surface-default"></div>
281
+ <div class="text-center">
282
+ <span class="label-12-medium text-content-on-surface-primary block">yellow</span>
283
+ <code class="copy-btn label-12-regular text-content-on-surface-muted block mt-0.5 px-1 py-0.5 rounded" onclick="copyToClipboard('bg-background-accent-yellow', this)">bg-background-accent-yellow</code>
284
+ </div>
285
+ </div>
270
286
  </div>
271
287
  </div>
272
288
  `,
@@ -287,7 +287,7 @@ export const Wrap: Story = {
287
287
  <div class="gap-y-8">
288
288
  <div>
289
289
  <code class="copy-btn label-12-regular text-content-on-surface-muted block mb-2 px-1 py-0.5 rounded w-fit" onclick="copyToClipboard('flex flex-nowrap', this)">flex flex-nowrap</code>
290
- <div class="flex flex-nowrap gap-2 p-4 bg-background-surface-muted rounded-md overflow-x-auto max-w-md">
290
+ <div class="flex flex-nowrap gap-2 p-4 bg-background-surface-muted rounded-md overflow-x-auto max-w-md" tabindex="0" aria-label="No-wrap flex example">
291
291
  <div class="w-24 h-16 flex-shrink-0 bg-background-accent-default rounded flex items-center justify-center text-content-on-accent-default">1</div>
292
292
  <div class="w-24 h-16 flex-shrink-0 bg-background-accent-default rounded flex items-center justify-center text-content-on-accent-default">2</div>
293
293
  <div class="w-24 h-16 flex-shrink-0 bg-background-accent-default rounded flex items-center justify-center text-content-on-accent-default">3</div>
@@ -254,7 +254,7 @@ export const OnStatus: Story = {
254
254
 
255
255
  <div class="flex flex-wrap gap-6">
256
256
  <div class="flex flex-col items-center gap-1.5">
257
- <div class="w-16 h-16 rounded-md bg-background-surface-secondary border border-border-surface-default flex items-center justify-center">
257
+ <div class="w-16 h-16 rounded-md bg-background-status-success border border-border-surface-default flex items-center justify-center">
258
258
  <span class="text-content-on-status-success heading-m">Aa</span>
259
259
  </div>
260
260
  <div class="text-center">
@@ -264,7 +264,7 @@ export const OnStatus: Story = {
264
264
  </div>
265
265
 
266
266
  <div class="flex flex-col items-center gap-1.5">
267
- <div class="w-16 h-16 rounded-md bg-background-surface-secondary border border-border-surface-default flex items-center justify-center">
267
+ <div class="w-16 h-16 rounded-md bg-background-status-warning border border-border-surface-default flex items-center justify-center">
268
268
  <span class="text-content-on-status-warning heading-m">Aa</span>
269
269
  </div>
270
270
  <div class="text-center">
@@ -274,7 +274,7 @@ export const OnStatus: Story = {
274
274
  </div>
275
275
 
276
276
  <div class="flex flex-col items-center gap-1.5">
277
- <div class="w-16 h-16 rounded-md bg-background-surface-secondary border border-border-surface-default flex items-center justify-center">
277
+ <div class="w-16 h-16 rounded-md bg-background-status-error border border-border-surface-default flex items-center justify-center">
278
278
  <span class="text-content-on-status-error heading-m">Aa</span>
279
279
  </div>
280
280
  <div class="text-center">