@aleph-alpha/ui-library 2.5.1 → 2.5.2
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/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 +3160 -3125
- package/package.json +1 -1
- package/src/components/UiCodeBlock/UiCodeBlock.vue +6 -1
- package/src/components/UiField/UiField.stories.ts +15 -9
- package/src/components/UiFileType/UiFileType.stories.ts +59 -0
- package/src/components/UiFileType/UiFileType.vue +1 -3
- 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
|
@@ -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
|
};
|
|
@@ -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
|
+
};
|
|
@@ -82,9 +82,7 @@ const resolvedIcon = computed<string>(() => {
|
|
|
82
82
|
return props.icon || filePreset.value.icon;
|
|
83
83
|
});
|
|
84
84
|
|
|
85
|
-
//
|
|
86
|
-
// in `config.js` (see `getStaticTokenVars`) until they're synced from Figma
|
|
87
|
-
// into `tokens.json`.
|
|
85
|
+
// Tone names map to token-backed background utilities from `tokens.json`.
|
|
88
86
|
const TONE_FILL: Record<UiFileTypeTone, string> = {
|
|
89
87
|
default: 'bg-background-surface-muted-subtle',
|
|
90
88
|
'accent-pink': 'bg-background-accent-pink',
|
|
@@ -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"
|
|
@@ -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-
|
|
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
|
-
<
|
|
59
|
-
|
|
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-
|
|
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
|
-
<
|
|
76
|
-
|
|
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-
|
|
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
|
-
<
|
|
93
|
-
|
|
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>
|