@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.
- package/config.d.ts +33 -2
- package/config.js +99 -70
- package/dist/system/components/UiFileItem/index.d.ts +1 -1
- package/dist/system/components/UiFileType/UiFileType.vue.d.ts +1 -0
- package/dist/system/components/UiFileType/types.d.ts +5 -0
- package/dist/system/components/core/calendar/Calendar.vue.d.ts +247 -3
- package/dist/system/components/core/popover/PopoverContent.vue.d.ts +1 -1
- package/dist/system/components/core/range-calendar/RangeCalendar.vue.d.ts +139 -2
- package/dist/system/lib.js +3166 -3129
- package/package.json +3 -3
- package/src/components/UiCodeBlock/UiCodeBlock.vue +6 -1
- package/src/components/UiField/UiField.stories.ts +15 -9
- package/src/components/UiFileItem/UiFileItem.stories.ts +21 -14
- package/src/components/UiFileItem/UiFileItem.vue +1 -0
- package/src/components/UiFileItem/index.ts +5 -1
- package/src/components/UiFileType/UiFileType.stories.ts +59 -0
- package/src/components/UiFileType/UiFileType.vue +3 -8
- package/src/components/UiFileType/__tests__/UiFileType.test.ts +9 -0
- package/src/components/UiFileType/types.ts +5 -0
- package/src/components/UiFileUploadBox/UiFileUploadBox.vue +58 -56
- package/src/components/UiListbox/UiListbox.stories.ts +1 -1
- package/src/components/UiSelect/UiSelectTrigger.vue +8 -2
- package/src/components/UiSnackbar/UiSnackbar.stories.ts +1 -0
- package/src/components/UiTable/UiTable.stories.ts +6 -2
- package/src/components/UiTabs/UiTabs.stories.ts +2 -2
- package/src/components/UiTagsInput/UiTagsInput.stories.ts +12 -2
- package/src/components/core/calendar/Calendar.vue +17 -1
- package/src/components/core/checkbox/Checkbox.vue +1 -0
- package/src/components/core/listbox/ListboxContent.vue +1 -0
- package/src/components/core/native-select/NativeSelect.vue +6 -0
- package/src/components/core/range-calendar/RangeCalendar.vue +19 -0
- package/src/components/core/slider/Slider.vue +1 -0
- package/src/directives/vHover.stories.ts +16 -12
- package/src/patterns/UiDataTable/UiDataTable.stories.ts +2 -2
- package/src/theme/Background.stories.ts +16 -0
- package/src/theme/Flex.stories.ts +1 -1
- package/src/theme/Theme.stories.ts +3 -3
- package/tokens.json +4273 -1152
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aleph-alpha/ui-library",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/system/lib.js",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"vue-router": "4.6.4",
|
|
79
79
|
"vue-tsc": "^2.2.12",
|
|
80
80
|
"wait-on": "9.0.3",
|
|
81
|
-
"@aleph-alpha/eslint-config-frontend": "0.
|
|
81
|
+
"@aleph-alpha/eslint-config-frontend": "0.6.0",
|
|
82
82
|
"@aleph-alpha/prettier-config-frontend": "2.1.0",
|
|
83
83
|
"@aleph-alpha/tsconfig-frontend": "0.6.0"
|
|
84
84
|
},
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
"shiki": "^3.0.0",
|
|
114
114
|
"tailwind-merge": "^3.4.0",
|
|
115
115
|
"vue-sonner": "^2.0.9",
|
|
116
|
-
"@aleph-alpha/config-css": "1.
|
|
116
|
+
"@aleph-alpha/config-css": "1.2.0"
|
|
117
117
|
},
|
|
118
118
|
"scripts": {
|
|
119
119
|
"build": "node scripts/prepare-build.cjs && vite build",
|
|
@@ -121,7 +121,12 @@ onUnmounted(() => {
|
|
|
121
121
|
</UiButton>
|
|
122
122
|
</div>
|
|
123
123
|
|
|
124
|
-
<div
|
|
124
|
+
<div
|
|
125
|
+
class="overflow-auto"
|
|
126
|
+
:style="maxHeight ? { maxHeight } : undefined"
|
|
127
|
+
:tabindex="maxHeight ? 0 : undefined"
|
|
128
|
+
:aria-label="maxHeight ? 'Scrollable code block' : undefined"
|
|
129
|
+
>
|
|
125
130
|
<!--
|
|
126
131
|
`highlightedHtml` is produced by Shiki, which emits a sanitized
|
|
127
132
|
`<pre><code>` tree from the raw `code` string. No user HTML is ever
|
|
@@ -1634,7 +1634,7 @@ export const PaymentMethodForm: Story = {
|
|
|
1634
1634
|
<UiFieldDescription>The billing address associated with your payment method.</UiFieldDescription>
|
|
1635
1635
|
<UiFieldGroup>
|
|
1636
1636
|
<UiField orientation="responsive">
|
|
1637
|
-
<UiCheckbox id="same-as-shipping" v-model="sameAsShipping"
|
|
1637
|
+
<UiCheckbox id="same-as-shipping" v-model="sameAsShipping" />
|
|
1638
1638
|
<UiFieldLabel for="same-as-shipping" class="font-normal">Same as shipping address</UiFieldLabel>
|
|
1639
1639
|
</UiField>
|
|
1640
1640
|
</UiFieldGroup>
|
|
@@ -1654,7 +1654,9 @@ export const PaymentMethodForm: Story = {
|
|
|
1654
1654
|
</div>
|
|
1655
1655
|
`,
|
|
1656
1656
|
}),
|
|
1657
|
-
parameters: {
|
|
1657
|
+
parameters: {
|
|
1658
|
+
controls: { disable: true },
|
|
1659
|
+
},
|
|
1658
1660
|
};
|
|
1659
1661
|
|
|
1660
1662
|
/**
|
|
@@ -1747,17 +1749,17 @@ export const ProfileSettingsForm: Story = {
|
|
|
1747
1749
|
<UiField orientation="responsive" description-placement="under-label">
|
|
1748
1750
|
<UiFieldLabel for="email-notif">Email notifications</UiFieldLabel>
|
|
1749
1751
|
<UiFieldDescription>Receive emails about new products, features, and more. If you don't want to receive these emails, you can turn them off.</UiFieldDescription>
|
|
1750
|
-
<UiSwitch id="email-notif" v-model="emailNotifications"
|
|
1752
|
+
<UiSwitch id="email-notif" v-model="emailNotifications" />
|
|
1751
1753
|
</UiField>
|
|
1752
1754
|
|
|
1753
1755
|
<UiField orientation="responsive">
|
|
1754
1756
|
<UiFieldLabel for="push-notif">Push notifications</UiFieldLabel>
|
|
1755
|
-
<UiSwitch id="push-notif" v-model="pushNotifications"
|
|
1757
|
+
<UiSwitch id="push-notif" v-model="pushNotifications" />
|
|
1756
1758
|
</UiField>
|
|
1757
1759
|
|
|
1758
1760
|
<UiField orientation="responsive">
|
|
1759
1761
|
<UiFieldLabel for="marketing">Marketing emails</UiFieldLabel>
|
|
1760
|
-
<UiSwitch id="marketing" v-model="marketingEmails"
|
|
1762
|
+
<UiSwitch id="marketing" v-model="marketingEmails" />
|
|
1761
1763
|
</UiField>
|
|
1762
1764
|
</UiFieldGroup>
|
|
1763
1765
|
</UiFieldSet>
|
|
@@ -1768,7 +1770,7 @@ export const ProfileSettingsForm: Story = {
|
|
|
1768
1770
|
<UiFieldLegend>Privacy Settings</UiFieldLegend>
|
|
1769
1771
|
<UiFieldDescription>Choose who can see your profile and what they can see.</UiFieldDescription>
|
|
1770
1772
|
|
|
1771
|
-
<UiRadioGroup v-model="privacy"
|
|
1773
|
+
<UiRadioGroup v-model="privacy">
|
|
1772
1774
|
<UiField orientation="responsive">
|
|
1773
1775
|
<UiRadioGroupItem id="privacy-everyone" value="everyone" />
|
|
1774
1776
|
<UiFieldContent>
|
|
@@ -1802,7 +1804,9 @@ export const ProfileSettingsForm: Story = {
|
|
|
1802
1804
|
</div>
|
|
1803
1805
|
`,
|
|
1804
1806
|
}),
|
|
1805
|
-
parameters: {
|
|
1807
|
+
parameters: {
|
|
1808
|
+
controls: { disable: true },
|
|
1809
|
+
},
|
|
1806
1810
|
};
|
|
1807
1811
|
|
|
1808
1812
|
/**
|
|
@@ -1856,7 +1860,7 @@ export const PersonalInformationForm: Story = {
|
|
|
1856
1860
|
</UiFieldSet>
|
|
1857
1861
|
|
|
1858
1862
|
<UiField orientation="responsive" data-invalid="true">
|
|
1859
|
-
<UiCheckbox id="agree-terms" v-model="agreeTerms"
|
|
1863
|
+
<UiCheckbox id="agree-terms" v-model="agreeTerms" />
|
|
1860
1864
|
<UiFieldContent>
|
|
1861
1865
|
<UiFieldLabel for="agree-terms" class="font-normal">I agree to the terms and conditions</UiFieldLabel>
|
|
1862
1866
|
</UiFieldContent>
|
|
@@ -1871,5 +1875,7 @@ export const PersonalInformationForm: Story = {
|
|
|
1871
1875
|
</div>
|
|
1872
1876
|
`,
|
|
1873
1877
|
}),
|
|
1874
|
-
parameters: {
|
|
1878
|
+
parameters: {
|
|
1879
|
+
controls: { disable: true },
|
|
1880
|
+
},
|
|
1875
1881
|
};
|
|
@@ -5,11 +5,15 @@ import UiFileItem from './UiFileItem.vue';
|
|
|
5
5
|
* `UiFileItem` is a single-row primitive that represents a file with
|
|
6
6
|
* optional progress, error, and a remove control. Use it inside file-upload
|
|
7
7
|
* flows or attachment lists; for the full uploader, see `UiFileUpload` pattern.
|
|
8
|
+
*
|
|
9
|
+
* Beta until the `background/accent/{pink,yellow}` design tokens are synced
|
|
10
|
+
* from Figma into `tokens.json` — the file-type badge currently sources them
|
|
11
|
+
* from static fallbacks in `config.js` (see `getStaticTokenVars`).
|
|
8
12
|
*/
|
|
9
13
|
const meta: Meta<typeof UiFileItem> = {
|
|
10
14
|
title: 'Components/UiFileItem',
|
|
11
15
|
component: UiFileItem,
|
|
12
|
-
tags: ['autodocs'],
|
|
16
|
+
tags: ['autodocs', 'beta'],
|
|
13
17
|
args: {
|
|
14
18
|
filename: 'document.pdf',
|
|
15
19
|
typeLabel: 'PDF',
|
|
@@ -241,19 +245,22 @@ function onRemove() {}
|
|
|
241
245
|
<template>
|
|
242
246
|
<UiFileItem
|
|
243
247
|
size="small"
|
|
244
|
-
filename="
|
|
245
|
-
type-label="
|
|
246
|
-
size-label="
|
|
248
|
+
filename="quarterly-report.csv"
|
|
249
|
+
type-label="CSV"
|
|
250
|
+
size-label="320 KB"
|
|
247
251
|
@remove="onRemove"
|
|
248
252
|
/>
|
|
249
253
|
</template>`;
|
|
250
254
|
|
|
251
|
-
/**
|
|
255
|
+
/**
|
|
256
|
+
* Small size · success. Yellow media + `table-2` icon are derived from the
|
|
257
|
+
* `.csv` filename
|
|
258
|
+
*/
|
|
252
259
|
export const SmallSuccess: Story = {
|
|
253
260
|
args: {
|
|
254
|
-
filename: '
|
|
255
|
-
typeLabel: '
|
|
256
|
-
sizeLabel: '
|
|
261
|
+
filename: 'quarterly-report.csv',
|
|
262
|
+
typeLabel: 'CSV',
|
|
263
|
+
sizeLabel: '320 KB',
|
|
257
264
|
progress: null,
|
|
258
265
|
error: '',
|
|
259
266
|
size: 'small',
|
|
@@ -301,9 +308,9 @@ import { UiFileItem } from '@aleph-alpha/ui-library'
|
|
|
301
308
|
|
|
302
309
|
<template>
|
|
303
310
|
<UiFileItem
|
|
304
|
-
filename="
|
|
305
|
-
type-label="
|
|
306
|
-
size-label="
|
|
311
|
+
filename="release-notes.md"
|
|
312
|
+
type-label="MD"
|
|
313
|
+
size-label="14 KB"
|
|
307
314
|
:removable="false"
|
|
308
315
|
/>
|
|
309
316
|
</template>`;
|
|
@@ -311,9 +318,9 @@ import { UiFileItem } from '@aleph-alpha/ui-library'
|
|
|
311
318
|
/** Read-only preview: no close icon. */
|
|
312
319
|
export const NonRemovable: Story = {
|
|
313
320
|
args: {
|
|
314
|
-
filename: '
|
|
315
|
-
typeLabel: '
|
|
316
|
-
sizeLabel: '
|
|
321
|
+
filename: 'release-notes.md',
|
|
322
|
+
typeLabel: 'MD',
|
|
323
|
+
sizeLabel: '14 KB',
|
|
317
324
|
progress: null,
|
|
318
325
|
error: '',
|
|
319
326
|
disabled: false,
|
|
@@ -132,3 +132,62 @@ export const AllTypes: Story = {
|
|
|
132
132
|
`,
|
|
133
133
|
}),
|
|
134
134
|
};
|
|
135
|
+
|
|
136
|
+
const toneOverridesTemplateSource = `<script setup lang="ts">
|
|
137
|
+
import { UiFileType } from '@aleph-alpha/ui-library'
|
|
138
|
+
</script>
|
|
139
|
+
|
|
140
|
+
<template>
|
|
141
|
+
<div class="grid gap-3">
|
|
142
|
+
<div class="flex items-center gap-3">
|
|
143
|
+
<UiFileType tone="default" icon="file" />
|
|
144
|
+
<span class="body-14-regular text-content-on-surface-secondary">default</span>
|
|
145
|
+
</div>
|
|
146
|
+
<div class="flex items-center gap-3">
|
|
147
|
+
<UiFileType tone="accent-pink" icon="file" />
|
|
148
|
+
<span class="body-14-regular text-content-on-surface-secondary">accent-pink</span>
|
|
149
|
+
</div>
|
|
150
|
+
<div class="flex items-center gap-3">
|
|
151
|
+
<UiFileType tone="accent-soft" icon="code-xml" />
|
|
152
|
+
<span class="body-14-regular text-content-on-surface-secondary">accent-soft</span>
|
|
153
|
+
</div>
|
|
154
|
+
<div class="flex items-center gap-3">
|
|
155
|
+
<UiFileType tone="accent-yellow" icon="table-2" />
|
|
156
|
+
<span class="body-14-regular text-content-on-surface-secondary">accent-yellow</span>
|
|
157
|
+
</div>
|
|
158
|
+
</div>
|
|
159
|
+
</template>`;
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Explicit tone overrides for checking the token-backed badge colors,
|
|
163
|
+
* including the pink and yellow accent tokens.
|
|
164
|
+
*/
|
|
165
|
+
export const ToneOverrides: Story = {
|
|
166
|
+
parameters: {
|
|
167
|
+
controls: { disable: true },
|
|
168
|
+
docs: { source: { code: toneOverridesTemplateSource } },
|
|
169
|
+
},
|
|
170
|
+
render: () => ({
|
|
171
|
+
components: { UiFileType },
|
|
172
|
+
template: `
|
|
173
|
+
<div class="grid gap-3">
|
|
174
|
+
<div class="flex items-center gap-3">
|
|
175
|
+
<UiFileType tone="default" icon="file" />
|
|
176
|
+
<span class="body-14-regular text-content-on-surface-secondary">default</span>
|
|
177
|
+
</div>
|
|
178
|
+
<div class="flex items-center gap-3">
|
|
179
|
+
<UiFileType tone="accent-pink" icon="file" />
|
|
180
|
+
<span class="body-14-regular text-content-on-surface-secondary">accent-pink</span>
|
|
181
|
+
</div>
|
|
182
|
+
<div class="flex items-center gap-3">
|
|
183
|
+
<UiFileType tone="accent-soft" icon="code-xml" />
|
|
184
|
+
<span class="body-14-regular text-content-on-surface-secondary">accent-soft</span>
|
|
185
|
+
</div>
|
|
186
|
+
<div class="flex items-center gap-3">
|
|
187
|
+
<UiFileType tone="accent-yellow" icon="table-2" />
|
|
188
|
+
<span class="body-14-regular text-content-on-surface-secondary">accent-yellow</span>
|
|
189
|
+
</div>
|
|
190
|
+
</div>
|
|
191
|
+
`,
|
|
192
|
+
}),
|
|
193
|
+
};
|
|
@@ -14,6 +14,7 @@ const props = withDefaults(defineProps<UiFileTypeProps>(), {
|
|
|
14
14
|
tone: undefined,
|
|
15
15
|
icon: undefined,
|
|
16
16
|
error: false,
|
|
17
|
+
loading: false,
|
|
17
18
|
});
|
|
18
19
|
|
|
19
20
|
/** Visual preset (tone + icon) for a known file extension. */
|
|
@@ -68,12 +69,8 @@ const filePreset = computed<FileTypePreset>(() => {
|
|
|
68
69
|
return FILE_TYPE_PRESETS[ext] ?? DEFAULT_PRESET;
|
|
69
70
|
});
|
|
70
71
|
|
|
71
|
-
// Resolved tone/icon: `error` short-circuits to the neutral preset; an
|
|
72
|
-
// explicit prop wins over the filename-derived preset. Truthy checks (`||`)
|
|
73
|
-
// rather than nullish (`??`) so empty strings from text-based controls
|
|
74
|
-
// (Storybook, form inputs) fall back to the auto-derived value.
|
|
75
72
|
const resolvedTone = computed<UiFileTypeTone>(() => {
|
|
76
|
-
if (props.error) return 'default';
|
|
73
|
+
if (props.error || props.loading) return 'default';
|
|
77
74
|
return props.tone || filePreset.value.tone;
|
|
78
75
|
});
|
|
79
76
|
|
|
@@ -82,9 +79,7 @@ const resolvedIcon = computed<string>(() => {
|
|
|
82
79
|
return props.icon || filePreset.value.icon;
|
|
83
80
|
});
|
|
84
81
|
|
|
85
|
-
//
|
|
86
|
-
// in `config.js` (see `getStaticTokenVars`) until they're synced from Figma
|
|
87
|
-
// into `tokens.json`.
|
|
82
|
+
// Tone names map to token-backed background utilities from `tokens.json`.
|
|
88
83
|
const TONE_FILL: Record<UiFileTypeTone, string> = {
|
|
89
84
|
default: 'bg-background-surface-muted-subtle',
|
|
90
85
|
'accent-pink': 'bg-background-accent-pink',
|
|
@@ -30,6 +30,15 @@ describe('UiFileType', () => {
|
|
|
30
30
|
expect(badge?.querySelector('svg.lucide-circle-alert')).not.toBeNull();
|
|
31
31
|
});
|
|
32
32
|
|
|
33
|
+
test('loading forces the neutral badge but keeps the filename icon', () => {
|
|
34
|
+
const { container } = render(UiFileType, {
|
|
35
|
+
props: { filename: 'data.csv', loading: true },
|
|
36
|
+
});
|
|
37
|
+
const badge = container.querySelector('[data-slot="file-type"]');
|
|
38
|
+
expect(badge?.getAttribute('data-tone')).toBe('default');
|
|
39
|
+
expect(badge?.querySelector('svg.lucide-table-2')).not.toBeNull();
|
|
40
|
+
});
|
|
41
|
+
|
|
33
42
|
test('explicit tone and icon props override the auto-derived values', () => {
|
|
34
43
|
const { container } = render(UiFileType, {
|
|
35
44
|
props: { filename: 'archive.zip', tone: 'accent-pink', icon: 'star' },
|
|
@@ -35,4 +35,9 @@ export interface UiFileTypeProps {
|
|
|
35
35
|
* other prop. Use to indicate an upload/validation failure.
|
|
36
36
|
*/
|
|
37
37
|
error?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Use during upload/processing — the colored tone signals "success",
|
|
40
|
+
* so it shouldn't appear until the file is fully accepted.
|
|
41
|
+
*/
|
|
42
|
+
loading?: boolean;
|
|
38
43
|
}
|
|
@@ -135,11 +135,19 @@ function processFileList(fileList: FileList) {
|
|
|
135
135
|
|
|
136
136
|
<template>
|
|
137
137
|
<div class="flex flex-col gap-3">
|
|
138
|
-
|
|
139
|
-
|
|
138
|
+
<input
|
|
139
|
+
ref="inputRef"
|
|
140
|
+
type="file"
|
|
141
|
+
class="sr-only"
|
|
142
|
+
:accept="accept"
|
|
143
|
+
:multiple="multiple"
|
|
144
|
+
:disabled="disabled"
|
|
145
|
+
:aria-hidden="true"
|
|
146
|
+
tabindex="-1"
|
|
147
|
+
@change="onInputChange"
|
|
148
|
+
/>
|
|
149
|
+
|
|
140
150
|
<div
|
|
141
|
-
role="button"
|
|
142
|
-
:tabindex="disabled ? -1 : 0"
|
|
143
151
|
:class="
|
|
144
152
|
cn(
|
|
145
153
|
'border-border-surface-default bg-background-surface-modal focus-visible:ring-ring relative flex cursor-pointer flex-col items-center justify-center gap-4 rounded-lg border border-dashed p-8 text-center transition-colors outline-none focus-visible:ring-2 focus-visible:ring-offset-2',
|
|
@@ -147,69 +155,63 @@ function processFileList(fileList: FileList) {
|
|
|
147
155
|
disabled && 'cursor-not-allowed opacity-50',
|
|
148
156
|
)
|
|
149
157
|
"
|
|
150
|
-
:aria-disabled="disabled ? true : undefined"
|
|
151
|
-
:aria-label="ariaLabel"
|
|
152
|
-
@click="onZoneClick"
|
|
153
|
-
@keydown="onZoneKeydown"
|
|
154
|
-
@focus="emit('focus', $event)"
|
|
155
|
-
@blur="emit('blur', $event)"
|
|
156
|
-
@dragenter="onDragEnter"
|
|
157
|
-
@dragleave="onDragLeave"
|
|
158
|
-
@dragover="onDragOver"
|
|
159
|
-
@drop="onDrop"
|
|
160
158
|
>
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
type="file"
|
|
164
|
-
class="sr-only"
|
|
165
|
-
:accept="accept"
|
|
166
|
-
:multiple="multiple"
|
|
167
|
-
:disabled="disabled"
|
|
168
|
-
:aria-hidden="true"
|
|
169
|
-
tabindex="-1"
|
|
170
|
-
@change="onInputChange"
|
|
171
|
-
/>
|
|
172
|
-
|
|
159
|
+
<!-- Drop zone: tabindex -1 when disabled removes it from tab order (aria-disabled). -->
|
|
160
|
+
<!-- eslint-disable-next-line vuejs-accessibility/interactive-supports-focus -- intentional: disabled state is not keyboard-focusable -->
|
|
173
161
|
<div
|
|
162
|
+
role="button"
|
|
163
|
+
:tabindex="disabled ? -1 : 0"
|
|
174
164
|
:class="
|
|
175
165
|
cn(
|
|
176
|
-
'text-content-on-surface-primary',
|
|
166
|
+
'text-content-on-surface-primary flex flex-col items-center justify-center gap-4 outline-none',
|
|
177
167
|
isDragging ? 'body-16-bold' : 'body-16-medium',
|
|
178
168
|
)
|
|
179
169
|
"
|
|
170
|
+
:aria-disabled="disabled ? true : undefined"
|
|
171
|
+
:aria-label="ariaLabel"
|
|
172
|
+
@click="onZoneClick"
|
|
173
|
+
@keydown="onZoneKeydown"
|
|
174
|
+
@focus="emit('focus', $event)"
|
|
175
|
+
@blur="emit('blur', $event)"
|
|
176
|
+
@dragenter="onDragEnter"
|
|
177
|
+
@dragleave="onDragLeave"
|
|
178
|
+
@dragover="onDragOver"
|
|
179
|
+
@drop="onDrop"
|
|
180
180
|
>
|
|
181
|
-
<
|
|
182
|
-
|
|
181
|
+
<div>
|
|
182
|
+
<slot name="title">{{ dropLabel }}</slot>
|
|
183
|
+
</div>
|
|
183
184
|
|
|
184
|
-
|
|
185
|
-
<div
|
|
186
|
-
class="flex size-20 shrink-0 items-center justify-center"
|
|
187
|
-
aria-hidden="true"
|
|
188
|
-
>
|
|
185
|
+
<!-- Fixed 80×80 slot so inner circle can go 72 → 80 on drag without shifting the drop zone. -->
|
|
189
186
|
<div
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
'flex items-center justify-center rounded-full transition-all duration-50 ease-out',
|
|
193
|
-
isDragging
|
|
194
|
-
? 'size-20 bg-background-accent-soft'
|
|
195
|
-
: 'size-18 bg-background-surface-muted',
|
|
196
|
-
)
|
|
197
|
-
"
|
|
187
|
+
class="flex size-20 shrink-0 items-center justify-center"
|
|
188
|
+
aria-hidden="true"
|
|
198
189
|
>
|
|
199
|
-
<
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
190
|
+
<div
|
|
191
|
+
:class="
|
|
192
|
+
cn(
|
|
193
|
+
'flex items-center justify-center rounded-full transition-all duration-50 ease-out',
|
|
194
|
+
isDragging
|
|
195
|
+
? 'size-20 bg-background-accent-soft'
|
|
196
|
+
: 'size-18 bg-background-surface-muted',
|
|
197
|
+
)
|
|
198
|
+
"
|
|
199
|
+
>
|
|
200
|
+
<slot name="icon">
|
|
201
|
+
<UiIcon
|
|
202
|
+
name="cloud-upload"
|
|
203
|
+
:size="32"
|
|
204
|
+
:class="
|
|
205
|
+
cn(
|
|
206
|
+
isDragging
|
|
207
|
+
? 'text-content-on-surface-link'
|
|
208
|
+
: 'text-content-on-surface-muted',
|
|
209
|
+
)
|
|
210
|
+
"
|
|
211
|
+
aria-hidden="true"
|
|
212
|
+
/>
|
|
213
|
+
</slot>
|
|
214
|
+
</div>
|
|
213
215
|
</div>
|
|
214
216
|
</div>
|
|
215
217
|
|
|
@@ -440,7 +440,7 @@ export const Disabled: Story = {
|
|
|
440
440
|
return { selected, fruits };
|
|
441
441
|
},
|
|
442
442
|
template: `
|
|
443
|
-
<UiListbox v-model="selected" disabled class="w-[200px] p-1
|
|
443
|
+
<UiListbox v-model="selected" disabled class="w-[200px] p-1">
|
|
444
444
|
<UiListboxContent>
|
|
445
445
|
<UiListboxItem
|
|
446
446
|
v-for="fruit in fruits"
|
|
@@ -30,6 +30,12 @@ const isMultiPlaceholder = computed(
|
|
|
30
30
|
ctx.mode === 'multiple' &&
|
|
31
31
|
(ctx.multiple?.selectedValues.value.length ?? 0) === 0,
|
|
32
32
|
);
|
|
33
|
+
const singleAriaLabel = computed(() => props.ariaLabel);
|
|
34
|
+
const multiAriaLabel = computed(
|
|
35
|
+
() =>
|
|
36
|
+
props.ariaLabel ??
|
|
37
|
+
(isMultiPlaceholder.value ? 'Select options' : undefined),
|
|
38
|
+
);
|
|
33
39
|
|
|
34
40
|
// shadcn trigger styles target only SVG icons (`[&_svg]...`) but our icons are spans (`data-slot="icon"`).
|
|
35
41
|
// Add equivalent sizing/behavior + rotate-on-open for the chevron.
|
|
@@ -62,7 +68,7 @@ const multiTriggerClasses = computed(() =>
|
|
|
62
68
|
v-if="ctx.mode === 'single'"
|
|
63
69
|
:disabled="props.disabled"
|
|
64
70
|
:size="props.size"
|
|
65
|
-
:aria-label="
|
|
71
|
+
:aria-label="singleAriaLabel"
|
|
66
72
|
:class="uiIconTriggerClasses"
|
|
67
73
|
>
|
|
68
74
|
<slot />
|
|
@@ -74,7 +80,7 @@ const multiTriggerClasses = computed(() =>
|
|
|
74
80
|
:data-size="props.size"
|
|
75
81
|
:data-placeholder="isMultiPlaceholder ? '' : undefined"
|
|
76
82
|
:disabled="props.disabled"
|
|
77
|
-
:aria-label="
|
|
83
|
+
:aria-label="multiAriaLabel"
|
|
78
84
|
:class="multiTriggerClasses"
|
|
79
85
|
>
|
|
80
86
|
<slot />
|
|
@@ -230,7 +230,9 @@ const invoices = [
|
|
|
230
230
|
<UiTableHead>Status</UiTableHead>
|
|
231
231
|
<UiTableHead>Method</UiTableHead>
|
|
232
232
|
<UiTableHead class="text-right">Amount</UiTableHead>
|
|
233
|
-
<UiTableHead class="w-[50px]"
|
|
233
|
+
<UiTableHead class="w-[50px]">
|
|
234
|
+
<span class="sr-only">Actions</span>
|
|
235
|
+
</UiTableHead>
|
|
234
236
|
</UiTableRow>
|
|
235
237
|
</UiTableHeader>
|
|
236
238
|
<UiTableBody>
|
|
@@ -269,7 +271,9 @@ const withRowActionsTemplate = `
|
|
|
269
271
|
<UiTableHead>Status</UiTableHead>
|
|
270
272
|
<UiTableHead>Method</UiTableHead>
|
|
271
273
|
<UiTableHead class="text-right">Amount</UiTableHead>
|
|
272
|
-
<UiTableHead class="w-[50px]"
|
|
274
|
+
<UiTableHead class="w-[50px]">
|
|
275
|
+
<span class="sr-only">Actions</span>
|
|
276
|
+
</UiTableHead>
|
|
273
277
|
</UiTableRow>
|
|
274
278
|
</UiTableHeader>
|
|
275
279
|
<UiTableBody>
|
|
@@ -386,7 +386,7 @@ function goToDetails() {
|
|
|
386
386
|
<div class="flex items-center gap-4">
|
|
387
387
|
<p class="text-sm">Current tab: <strong>{{ activeTab }}</strong></p>
|
|
388
388
|
<button
|
|
389
|
-
class="px-3 py-1 text-sm bg-primary rounded-md"
|
|
389
|
+
class="px-3 py-1 text-sm bg-primary text-primary-foreground rounded-md"
|
|
390
390
|
@click="goToDetails"
|
|
391
391
|
>
|
|
392
392
|
Go to Details
|
|
@@ -437,7 +437,7 @@ export const Controlled: Story = {
|
|
|
437
437
|
<div class="flex items-center gap-4">
|
|
438
438
|
<p class="text-sm">Current tab: <strong>{{ activeTab }}</strong></p>
|
|
439
439
|
<button
|
|
440
|
-
class="px-3 py-1 text-sm bg-primary rounded-md"
|
|
440
|
+
class="px-3 py-1 text-sm bg-primary text-primary-foreground rounded-md"
|
|
441
441
|
@click="goToDetails"
|
|
442
442
|
>
|
|
443
443
|
Go to Details
|
|
@@ -208,7 +208,7 @@ export const Disabled: Story = {
|
|
|
208
208
|
return { modelValue };
|
|
209
209
|
},
|
|
210
210
|
template: `
|
|
211
|
-
<UiTagsInput v-model="modelValue" class="w-[300px]" disabled>
|
|
211
|
+
<UiTagsInput v-model="modelValue" class="w-[300px] !opacity-100" disabled>
|
|
212
212
|
<UiTagsInputItem v-for="item in modelValue" :key="item" :value="item">
|
|
213
213
|
<UiTagsInputItemText />
|
|
214
214
|
<UiTagsInputItemDelete />
|
|
@@ -219,6 +219,11 @@ export const Disabled: Story = {
|
|
|
219
219
|
`,
|
|
220
220
|
}),
|
|
221
221
|
parameters: {
|
|
222
|
+
a11y: {
|
|
223
|
+
config: {
|
|
224
|
+
rules: [{ id: 'color-contrast', enabled: false }],
|
|
225
|
+
},
|
|
226
|
+
},
|
|
222
227
|
docs: {
|
|
223
228
|
source: {
|
|
224
229
|
code: disabledTemplateSource,
|
|
@@ -521,7 +526,12 @@ export const WithListbox: Story = {
|
|
|
521
526
|
</UiListboxFilter>
|
|
522
527
|
|
|
523
528
|
<UiPopoverTrigger as-child>
|
|
524
|
-
<UiButton
|
|
529
|
+
<UiButton
|
|
530
|
+
size="icon-sm"
|
|
531
|
+
variant="ghost"
|
|
532
|
+
class="order-last self-start ml-auto"
|
|
533
|
+
aria-label="Open framework suggestions"
|
|
534
|
+
>
|
|
525
535
|
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
526
536
|
<path d="m6 9 6 6 6-6"/>
|
|
527
537
|
</svg>
|
|
@@ -6,7 +6,7 @@ import { getLocalTimeZone, today } from '@internationalized/date';
|
|
|
6
6
|
import { createReusableTemplate, reactiveOmit, useVModel } from '@vueuse/core';
|
|
7
7
|
import { CalendarRoot, useDateFormatter, useForwardPropsEmits } from 'reka-ui';
|
|
8
8
|
import { createYear, createYearRange, toDate } from 'reka-ui/date';
|
|
9
|
-
import { computed, toRaw } from 'vue';
|
|
9
|
+
import { computed, nextTick, onMounted, ref, toRaw, watch } from 'vue';
|
|
10
10
|
import { cn } from '@/lib/utils';
|
|
11
11
|
import {
|
|
12
12
|
NativeSelect,
|
|
@@ -81,6 +81,21 @@ const [DefineYearTemplate, ReuseYearTemplate] = createReusableTemplate<{
|
|
|
81
81
|
}>();
|
|
82
82
|
|
|
83
83
|
const forwarded = useForwardPropsEmits(delegatedProps, emits);
|
|
84
|
+
const calendarRootRef = ref<InstanceType<typeof CalendarRoot> | null>(null);
|
|
85
|
+
|
|
86
|
+
function removeUnsupportedReadonlyAttributes() {
|
|
87
|
+
nextTick(() => {
|
|
88
|
+
const root = calendarRootRef.value?.$el as HTMLElement | undefined;
|
|
89
|
+
root
|
|
90
|
+
?.querySelectorAll('[role="application"][aria-readonly]')
|
|
91
|
+
.forEach((el) => {
|
|
92
|
+
el.removeAttribute('aria-readonly');
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
onMounted(removeUnsupportedReadonlyAttributes);
|
|
98
|
+
watch(() => props.readonly, removeUnsupportedReadonlyAttributes);
|
|
84
99
|
</script>
|
|
85
100
|
|
|
86
101
|
<template>
|
|
@@ -147,6 +162,7 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits);
|
|
|
147
162
|
</DefineYearTemplate>
|
|
148
163
|
|
|
149
164
|
<CalendarRoot
|
|
165
|
+
ref="calendarRootRef"
|
|
150
166
|
#default="{ grid, weekDays, date }"
|
|
151
167
|
v-bind="forwarded"
|
|
152
168
|
v-model:placeholder="placeholder"
|