@aleph-alpha/ui-library 5.11.0 → 6.1.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/README.md +2 -2
- package/config.d.ts +28 -4
- package/config.js +99 -23
- package/dist/system/components/UiTagsInput/UiTagsInput.vue.d.ts +2 -0
- package/dist/system/components/UiTagsInput/UiTagsInputItemDelete.vue.d.ts +2 -1
- package/dist/system/components/UiTagsInput/types.d.ts +21 -2
- package/dist/system/components/core/tags-input/TagsInputItemDelete.vue.d.ts +5 -0
- package/dist/system/icons/story-sidebar-icons.json +7 -0
- package/dist/system/lib.js +1752 -1708
- package/dist/system/story-sidebar-icons.json +7 -0
- package/docs/public-docs/migration-guide.md +402 -0
- package/docs/public-docs/quick-start.md +20 -11
- package/package.json +5 -2
- package/src/components/UiAlert/UiAlert.stories.ts +732 -0
- package/src/components/UiAlert/__tests__/UiAlert.test.ts +57 -11
- package/src/components/UiChip/UiChip.stories.ts +756 -2
- package/src/components/UiChip/UiChip.vue +7 -6
- package/src/components/UiChip/__tests__/UiChip.test.ts +38 -61
- package/src/components/UiDrawer/UiDrawer.stories.ts +665 -0
- package/src/components/UiDrawer/__tests__/UiDrawer.test.ts +6 -190
- package/src/components/UiLabel/UiLabel.stories.ts +691 -16
- package/src/components/UiLabel/__tests__/UiLabel.test.ts +18 -26
- package/src/components/UiSheet/UiSheet.stories.ts +751 -0
- package/src/components/UiSheet/__tests__/UiSheet.test.ts +6 -190
- package/src/components/UiSlider/UiSlider.stories.ts +716 -0
- package/src/components/UiSlider/__tests__/UiSlider.test.ts +8 -45
- package/src/components/UiSwitch/UiSwitch.stories.ts +11 -5
- package/src/components/UiTagsInput/UiTagsInput.stories.ts +850 -4
- package/src/components/UiTagsInput/UiTagsInput.vue +34 -0
- package/src/components/UiTagsInput/UiTagsInputItemDelete.vue +4 -1
- package/src/components/UiTagsInput/__tests__/UiTagsInput.test.ts +113 -29
- package/src/components/UiTagsInput/types.ts +24 -2
- package/src/components/core/sheet/SheetContent.vue +6 -1
- package/src/components/core/switch/index.ts +8 -7
- package/src/components/core/tags-input/TagsInput.vue +4 -1
- package/src/components/core/tags-input/TagsInputItem.vue +13 -1
- package/src/components/core/tags-input/TagsInputItemDelete.vue +40 -7
- package/src/theme/Typography.stories.ts +125 -133
- package/tokens.json +8132 -2475
- package/dist/system/icons/mobile-device-frame.png +0 -0
- package/dist/system/mobile-device-frame.png +0 -0
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { render } from '@testing-library/vue';
|
|
2
2
|
import { describe, expect, test, vi } from 'vitest';
|
|
3
|
-
import { defineComponent, h
|
|
3
|
+
import { defineComponent, h } from 'vue';
|
|
4
4
|
import { UiSlider } from '../index';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
// Re-emitting `update:modelValue` / `valueCommit`, the controlled round-trip,
|
|
7
|
+
// range/step clamping, and keyboard operability are covered by the play
|
|
8
|
+
// functions in `UiSlider.stories.ts`, which run against the real vendor slider
|
|
9
|
+
// in a browser. What stays here is the payload guard, which is easiest to
|
|
10
|
+
// exercise by stubbing the vendor slider to emit an invalid payload
|
|
8
11
|
vi.mock('@/components/core/slider', () => {
|
|
9
12
|
return {
|
|
10
13
|
Slider: defineComponent({
|
|
@@ -15,11 +18,8 @@ vi.mock('@/components/core/slider', () => {
|
|
|
15
18
|
h('button', {
|
|
16
19
|
type: 'button',
|
|
17
20
|
onClick: () => {
|
|
18
|
-
|
|
19
|
-
emit('
|
|
20
|
-
if (!emitUndefinedPayload) {
|
|
21
|
-
emit('valueCommit', [51]);
|
|
22
|
-
}
|
|
21
|
+
emit('update:modelValue', undefined);
|
|
22
|
+
emit('valueCommit', undefined);
|
|
23
23
|
},
|
|
24
24
|
});
|
|
25
25
|
},
|
|
@@ -28,49 +28,12 @@ vi.mock('@/components/core/slider', () => {
|
|
|
28
28
|
});
|
|
29
29
|
|
|
30
30
|
describe('UiSlider', () => {
|
|
31
|
-
test('re-emits update:modelValue and valueCommit from the vendor slider', async () => {
|
|
32
|
-
const { container, emitted } = render(UiSlider, {
|
|
33
|
-
props: { modelValue: [50] },
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
const button = container.querySelector('button');
|
|
37
|
-
expect(button).toBeInTheDocument();
|
|
38
|
-
await (button as HTMLButtonElement).click();
|
|
39
|
-
|
|
40
|
-
expect(emitted('update:modelValue')?.[0]).toEqual([[51]]);
|
|
41
|
-
expect(emitted('valueCommit')?.[0]).toEqual([[51]]);
|
|
42
|
-
});
|
|
43
|
-
|
|
44
31
|
test('normalizes invalid update:modelValue payloads to an empty array', async () => {
|
|
45
|
-
emitUndefinedPayload = true;
|
|
46
32
|
const { container, emitted } = render(UiSlider);
|
|
47
33
|
const button = container.querySelector('button');
|
|
48
34
|
expect(button).toBeInTheDocument();
|
|
49
35
|
await (button as HTMLButtonElement).click();
|
|
50
36
|
|
|
51
37
|
expect(emitted('update:modelValue')?.[0]).toEqual([[]]);
|
|
52
|
-
emitUndefinedPayload = false;
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
test('supports controlled mode via v-model:modelValue', async () => {
|
|
56
|
-
const { container, getByText } = render({
|
|
57
|
-
components: { UiSlider },
|
|
58
|
-
setup() {
|
|
59
|
-
const value = ref([50]);
|
|
60
|
-
return { value };
|
|
61
|
-
},
|
|
62
|
-
template: `
|
|
63
|
-
<div>
|
|
64
|
-
<div>Value: {{ value[0] }}</div>
|
|
65
|
-
<UiSlider v-model:modelValue="value" />
|
|
66
|
-
</div>
|
|
67
|
-
`,
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
const button = container.querySelector('button');
|
|
71
|
-
expect(button).toBeInTheDocument();
|
|
72
|
-
await (button as HTMLButtonElement).click();
|
|
73
|
-
|
|
74
|
-
expect(getByText('Value: 51')).toBeInTheDocument();
|
|
75
38
|
});
|
|
76
39
|
});
|
|
@@ -1193,9 +1193,13 @@ export const KeyboardNavigation: Story = {
|
|
|
1193
1193
|
await step(
|
|
1194
1194
|
'keyboard: the focused switch shows a visible focus indicator (WCAG 2.4.7)',
|
|
1195
1195
|
async () => {
|
|
1196
|
-
// `ui-focus-ring` replaces the browser default with the library
|
|
1197
|
-
|
|
1198
|
-
|
|
1196
|
+
// `ui-focus-ring-outline` replaces the browser default with the library
|
|
1197
|
+
// ring: the same line and glow as everywhere else, but the line is an
|
|
1198
|
+
// outline so it cannot shrink the track.
|
|
1199
|
+
const { boxShadow, outlineColor, outlineWidth } =
|
|
1200
|
+
getComputedStyle(airplane);
|
|
1201
|
+
await expect(outlineWidth).toBe('1px');
|
|
1202
|
+
await expect(outlineColor).not.toBe('rgba(0, 0, 0, 0)');
|
|
1199
1203
|
await expect(boxShadow).not.toBe('none');
|
|
1200
1204
|
},
|
|
1201
1205
|
);
|
|
@@ -1236,8 +1240,10 @@ export const KeyboardNavigation: Story = {
|
|
|
1236
1240
|
await step(
|
|
1237
1241
|
'keyboard: the small switch shows the same visible focus indicator (WCAG 2.4.7)',
|
|
1238
1242
|
async () => {
|
|
1239
|
-
const { boxShadow,
|
|
1240
|
-
|
|
1243
|
+
const { boxShadow, outlineColor, outlineWidth } =
|
|
1244
|
+
getComputedStyle(location);
|
|
1245
|
+
await expect(outlineWidth).toBe('1px');
|
|
1246
|
+
await expect(outlineColor).not.toBe('rgba(0, 0, 0, 0)');
|
|
1241
1247
|
await expect(boxShadow).not.toBe('none');
|
|
1242
1248
|
},
|
|
1243
1249
|
);
|