@aleph-alpha/ui-library 6.2.0 → 6.3.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/dist/system/components/UiButtonGroup/index.d.ts +1 -0
- package/dist/system/components/UiCodeBlock/types.d.ts +11 -0
- package/dist/system/components/UiInputGroup/UiInputGroup.vue.d.ts +20 -0
- package/dist/system/components/UiInputGroup/UiInputGroupAddon.vue.d.ts +20 -0
- package/dist/system/components/UiInputGroup/UiInputGroupButton.vue.d.ts +17 -0
- package/dist/system/components/UiInputGroup/UiInputGroupInput.vue.d.ts +11 -0
- package/dist/system/components/UiInputGroup/UiInputGroupTextarea.vue.d.ts +11 -0
- package/dist/system/components/UiInputGroup/index.d.ts +7 -0
- package/dist/system/components/UiInputGroup/types.d.ts +151 -0
- package/dist/system/components/UiLabel/UiLabel.vue.d.ts +3 -1
- package/dist/system/components/UiLabel/types.d.ts +7 -0
- package/dist/system/components/core/input-group/InputGroup.vue.d.ts +25 -0
- package/dist/system/components/core/input-group/InputGroupAddon.vue.d.ts +25 -0
- package/dist/system/components/core/input-group/InputGroupButton.vue.d.ts +28 -0
- package/dist/system/components/core/input-group/InputGroupInput.vue.d.ts +12 -0
- package/dist/system/components/core/input-group/InputGroupText.vue.d.ts +21 -0
- package/dist/system/components/core/input-group/InputGroupTextarea.vue.d.ts +12 -0
- package/dist/system/components/core/input-group/index.d.ts +18 -0
- package/dist/system/components/index.d.ts +1 -0
- package/dist/system/lib.js +14300 -13931
- package/package.json +1 -1
- package/src/components/UiButtonGroup/index.ts +4 -0
- package/src/components/UiCodeBlock/UiCodeBlock.stories.ts +83 -0
- package/src/components/UiCodeBlock/UiCodeBlock.vue +30 -2
- package/src/components/UiCodeBlock/__tests__/UiCodeBlock.test.ts +21 -0
- package/src/components/UiCodeBlock/types.ts +11 -0
- package/src/components/UiField/UiField.stories.ts +329 -52
- package/src/components/UiField/UiFieldLabelInfo.vue +1 -1
- package/src/components/UiInput/UiInput.stories.ts +3 -1
- package/src/components/UiInput/UiInput.vue +26 -5
- package/src/components/UiInputGroup/UiInputGroup.stories.ts +2083 -0
- package/src/components/UiInputGroup/UiInputGroup.vue +18 -0
- package/src/components/UiInputGroup/UiInputGroupAddon.vue +18 -0
- package/src/components/UiInputGroup/UiInputGroupButton.vue +30 -0
- package/src/components/UiInputGroup/UiInputGroupInput.vue +16 -0
- package/src/components/UiInputGroup/UiInputGroupTextarea.vue +16 -0
- package/src/components/UiInputGroup/__tests__/UiInputGroup.test.ts +195 -0
- package/src/components/UiInputGroup/index.ts +10 -0
- package/src/components/UiInputGroup/types.ts +171 -0
- package/src/components/UiLabel/UiLabel.vue +7 -2
- package/src/components/UiLabel/types.ts +8 -0
- package/src/components/core/button/index.ts +23 -13
- package/src/components/core/button-group/ButtonGroupText.vue +4 -0
- package/src/components/core/button-group/index.ts +6 -2
- package/src/components/core/field/FieldError.vue +1 -1
- package/src/components/core/field/FieldLabel.vue +1 -1
- package/src/components/core/field/index.ts +7 -1
- package/src/components/core/input/Input.vue +4 -1
- package/src/components/core/input-group/InputGroup.vue +27 -0
- package/src/components/core/input-group/InputGroupAddon.vue +53 -0
- package/src/components/core/input-group/InputGroupButton.vue +35 -0
- package/src/components/core/input-group/InputGroupInput.vue +65 -0
- package/src/components/core/input-group/InputGroupText.vue +26 -0
- package/src/components/core/input-group/InputGroupTextarea.vue +62 -0
- package/src/components/core/input-group/index.ts +103 -0
- package/src/components/core/label/Label.vue +1 -1
- package/src/components/index.ts +1 -0
- package/src/theme/Typography.stories.ts +144 -6
- package/src/theme/__tests__/typography.test.ts +136 -0
|
@@ -336,7 +336,9 @@ export const FileUpload: Story = {
|
|
|
336
336
|
await step(
|
|
337
337
|
'screen-reader: the upload control exposes an accessible name (WCAG 4.1.2)',
|
|
338
338
|
async () => {
|
|
339
|
-
|
|
339
|
+
// Both the external <label for> and the internal upload-button label
|
|
340
|
+
// are associated with the hidden file input and contribute to it.
|
|
341
|
+
await expect(fileInput).toHaveAccessibleName('Attachment Upload');
|
|
340
342
|
},
|
|
341
343
|
);
|
|
342
344
|
|
|
@@ -30,6 +30,25 @@ const model = defineModel<string>();
|
|
|
30
30
|
const attrs = useAttrs();
|
|
31
31
|
const isFile = computed(() => props.type === 'file');
|
|
32
32
|
|
|
33
|
+
// In file mode the consumer-provided `id` must land on the hidden file input
|
|
34
|
+
// (not the wrapper div) so an external `<label for="...">` opens the picker.
|
|
35
|
+
const fileInputId = computed(
|
|
36
|
+
() => (attrs.id as string | undefined) ?? `${props.name}-file-input`,
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
const fileWrapperAttrs = computed(() => {
|
|
40
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- rest-destructuring to drop `id`
|
|
41
|
+
const { id, ...rest } = attrs;
|
|
42
|
+
return rest;
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
// aria-invalid is forwarded through attrs onto the file-mode wrapper; mirror
|
|
46
|
+
// it on the placeholder text so "No file chosen" adopts the error color.
|
|
47
|
+
const isInvalid = computed(() => {
|
|
48
|
+
const value = attrs['aria-invalid'];
|
|
49
|
+
return value === true || value === 'true' || value === '';
|
|
50
|
+
});
|
|
51
|
+
|
|
33
52
|
const selectedFiles = ref<File[]>([]);
|
|
34
53
|
|
|
35
54
|
const filePlaceholder = computed(() => props.placeholder ?? 'No file chosen');
|
|
@@ -41,8 +60,6 @@ const fileDisplayValue = computed(() => {
|
|
|
41
60
|
return `${selectedFiles.value.length} files selected`;
|
|
42
61
|
});
|
|
43
62
|
|
|
44
|
-
const fileInputId = computed(() => `${props.name}-file-input`);
|
|
45
|
-
|
|
46
63
|
function handleFilesChange(e: Event) {
|
|
47
64
|
const target = e.target as HTMLInputElement;
|
|
48
65
|
const files = Array.from(target.files ?? []);
|
|
@@ -60,8 +77,8 @@ function handleFilesChange(e: Event) {
|
|
|
60
77
|
-->
|
|
61
78
|
<div
|
|
62
79
|
v-if="isFile"
|
|
63
|
-
v-bind="
|
|
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 ui-focus-ring-within aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-
|
|
80
|
+
v-bind="fileWrapperAttrs"
|
|
81
|
+
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 ui-focus-ring-within aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-border-input-error group-data-[invalid=true]/field:border-border-input-error"
|
|
65
82
|
:class="{
|
|
66
83
|
'pointer-events-none cursor-not-allowed opacity-50': props.disabled,
|
|
67
84
|
}"
|
|
@@ -85,7 +102,11 @@ function handleFilesChange(e: Event) {
|
|
|
85
102
|
</UiButton>
|
|
86
103
|
<span
|
|
87
104
|
class="placeholder:text-content-on-surface-muted flex-1 truncate pr-2 label-16-regular md:label-14-regular"
|
|
88
|
-
:class="{
|
|
105
|
+
:class="{
|
|
106
|
+
'text-content-on-surface-muted group-data-[invalid=true]/field:text-border-input-error':
|
|
107
|
+
fileDisplayValue === '' && !isInvalid,
|
|
108
|
+
'text-border-input-error': fileDisplayValue === '' && isInvalid,
|
|
109
|
+
}"
|
|
89
110
|
:aria-controls="fileInputId"
|
|
90
111
|
>
|
|
91
112
|
{{ fileDisplayValue || filePlaceholder }}
|