@aleph-alpha/ui-library 6.0.0 → 6.2.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 +28 -4
- package/config.js +141 -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/sidebar/utils.d.ts +9 -0
- package/dist/system/components/core/tags-input/TagsInputItemDelete.vue.d.ts +5 -0
- package/dist/system/icons/story-sidebar-icons.json +8 -0
- package/dist/system/lib.js +6106 -5997
- package/dist/system/patterns/UiLayout/UiLayoutContent.vue.d.ts +39 -0
- package/dist/system/patterns/UiLayout/index.d.ts +2 -0
- package/dist/system/patterns/UiLayout/layout-shell.d.ts +944 -0
- package/dist/system/patterns/UiLayout/types.d.ts +43 -0
- package/dist/system/patterns/index.d.ts +1 -0
- package/dist/system/story-sidebar-icons.json +8 -0
- package/docs/public-docs/migration-guide.md +402 -0
- package/docs/public-docs/quick-start.md +19 -10
- package/package.json +7 -4
- 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/sidebar/Sidebar.vue +21 -5
- package/src/components/core/sidebar/utils.ts +10 -0
- 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/patterns/UiLayout/UiLayoutContent.stories.ts +1234 -0
- package/src/patterns/UiLayout/UiLayoutContent.vue +98 -0
- package/src/patterns/UiLayout/__tests__/UiLayoutContent.test.ts +97 -0
- package/src/patterns/UiLayout/index.ts +2 -0
- package/src/patterns/UiLayout/layout-shell.ts +64 -15
- package/src/patterns/UiLayout/types.ts +44 -0
- package/src/patterns/index.ts +1 -0
- 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
|
@@ -117,11 +117,12 @@ const removableChipClass = computed(() =>
|
|
|
117
117
|
:data-selected="isSelected"
|
|
118
118
|
:class="removableChipClass"
|
|
119
119
|
>
|
|
120
|
-
<
|
|
121
|
-
|
|
122
|
-
|
|
120
|
+
<component
|
|
121
|
+
:is="isSelectable ? 'button' : 'span'"
|
|
122
|
+
:type="isSelectable ? 'button' : undefined"
|
|
123
|
+
class="inline-flex min-w-0 items-center gap-1.5 self-stretch rounded-full outline-none"
|
|
123
124
|
:class="isSelectable ? 'cursor-pointer' : 'cursor-default'"
|
|
124
|
-
:disabled="props.disabled"
|
|
125
|
+
:disabled="isSelectable && props.disabled ? true : undefined"
|
|
125
126
|
:aria-pressed="isSelectable ? (isSelected ? 'true' : 'false') : undefined"
|
|
126
127
|
@click="handleRemovablePrimaryAction"
|
|
127
128
|
>
|
|
@@ -131,12 +132,12 @@ const removableChipClass = computed(() =>
|
|
|
131
132
|
class="size-3.5 shrink-0"
|
|
132
133
|
/>
|
|
133
134
|
<slot />
|
|
134
|
-
</
|
|
135
|
+
</component>
|
|
135
136
|
|
|
136
137
|
<button
|
|
137
138
|
data-slot="chip-remove"
|
|
138
139
|
type="button"
|
|
139
|
-
class="inline-flex size-
|
|
140
|
+
class="inline-flex size-6 items-center justify-center rounded-full outline-none hover-layer hover-layer-default ui-focus-ring disabled:pointer-events-none"
|
|
140
141
|
:aria-label="props.removeLabel"
|
|
141
142
|
:disabled="props.disabled"
|
|
142
143
|
@click="removeChip"
|
|
@@ -4,16 +4,12 @@ import { describe, expect, test } from 'vitest';
|
|
|
4
4
|
import { MockIcon } from '@/__tests__/test-utils';
|
|
5
5
|
import UiChip from '../UiChip.vue';
|
|
6
6
|
|
|
7
|
+
// Variant semantics (which chips are buttons, which are inert), selection,
|
|
8
|
+
// removal, focus order, and the remove control's accessible name are covered by
|
|
9
|
+
// the play functions in `UiChip.stories.ts`, which drive a real browser. What
|
|
10
|
+
// stays here is prop plumbing and the guards behind it — logic that has no
|
|
11
|
+
// visible surface to drive from a story.
|
|
7
12
|
describe('UiChip', () => {
|
|
8
|
-
test('renders static chip content', () => {
|
|
9
|
-
const { getByText } = render(UiChip, {
|
|
10
|
-
props: { variant: 'static' },
|
|
11
|
-
slots: { default: 'Data Analysis' },
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
expect(getByText('Data Analysis')).toBeInTheDocument();
|
|
15
|
-
});
|
|
16
|
-
|
|
17
13
|
test('renders start icon when provided', () => {
|
|
18
14
|
const { getByTestId } = render(UiChip, {
|
|
19
15
|
props: {
|
|
@@ -26,77 +22,58 @@ describe('UiChip', () => {
|
|
|
26
22
|
expect(getByTestId('mock-icon')).toBeInTheDocument();
|
|
27
23
|
});
|
|
28
24
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
25
|
+
// `selectable` only opts a *removable* chip into toggling. On the other two
|
|
26
|
+
// variants it must not turn the chip into something it isn't, so each test
|
|
27
|
+
// asserts the semantics that have to survive rather than the exact markup.
|
|
28
|
+
test('ignores the selectable prop on the static variant', () => {
|
|
29
|
+
const { getByText, queryByRole } = render(UiChip, {
|
|
30
|
+
props: { variant: 'static', selectable: true },
|
|
31
|
+
slots: { default: 'Chip' },
|
|
34
32
|
});
|
|
35
33
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
expect(
|
|
39
|
-
await user.click(chipButton);
|
|
40
|
-
expect(chipButton).toHaveAttribute('aria-pressed', 'true');
|
|
34
|
+
// Still a plain label: nothing to activate and nothing to tab to.
|
|
35
|
+
expect(queryByRole('button')).not.toBeInTheDocument();
|
|
36
|
+
expect(getByText('Chip')).not.toHaveAttribute('tabindex');
|
|
41
37
|
});
|
|
42
38
|
|
|
43
|
-
test('
|
|
44
|
-
const {
|
|
45
|
-
props: { variant: '
|
|
46
|
-
slots: { default: '
|
|
39
|
+
test('ignores the selectable prop on the selectable variant', () => {
|
|
40
|
+
const { getAllByRole, queryByRole } = render(UiChip, {
|
|
41
|
+
props: { variant: 'selectable', selectable: true },
|
|
42
|
+
slots: { default: 'Chip' },
|
|
47
43
|
});
|
|
48
44
|
|
|
49
|
-
|
|
50
|
-
|
|
45
|
+
// Still exactly one toggle button, and no remove control appears.
|
|
46
|
+
const buttons = getAllByRole('button');
|
|
47
|
+
expect(buttons).toHaveLength(1);
|
|
48
|
+
expect(buttons[0]).toHaveAccessibleName('Chip');
|
|
49
|
+
expect(buttons[0]).toHaveAttribute('aria-pressed', 'false');
|
|
50
|
+
expect(
|
|
51
|
+
queryByRole('button', { name: 'Remove chip' }),
|
|
52
|
+
).not.toBeInTheDocument();
|
|
51
53
|
});
|
|
52
54
|
|
|
53
|
-
test('
|
|
54
|
-
const user = userEvent.setup();
|
|
55
|
-
const { getByRole } = render(UiChip, {
|
|
56
|
-
props: { variant: 'removable' },
|
|
57
|
-
slots: { default: 'Removable chip' },
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
const chipBodyButton = getByRole('button', { name: 'Removable chip' });
|
|
61
|
-
const removeButton = getByRole('button', { name: 'Remove chip' });
|
|
62
|
-
|
|
63
|
-
await user.tab();
|
|
64
|
-
expect(chipBodyButton).toHaveFocus();
|
|
65
|
-
|
|
66
|
-
await user.tab();
|
|
67
|
-
expect(removeButton).toHaveFocus();
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
test('emits remove when remove button is clicked', async () => {
|
|
55
|
+
test('does not emit remove while disabled', async () => {
|
|
71
56
|
const user = userEvent.setup();
|
|
72
57
|
const { getByRole, emitted } = render(UiChip, {
|
|
73
|
-
props: { variant: 'removable' },
|
|
74
|
-
slots: { default: '
|
|
58
|
+
props: { variant: 'removable', disabled: true },
|
|
59
|
+
slots: { default: 'Disabled chip' },
|
|
75
60
|
});
|
|
76
61
|
|
|
77
|
-
|
|
62
|
+
const removeButton = getByRole('button', { name: 'Remove chip' });
|
|
63
|
+
expect(removeButton).toBeDisabled();
|
|
78
64
|
|
|
79
|
-
|
|
65
|
+
await user.click(removeButton);
|
|
66
|
+
expect(emitted('remove')).toBeUndefined();
|
|
80
67
|
});
|
|
81
68
|
|
|
82
|
-
test('
|
|
69
|
+
test('does not toggle selection while disabled', async () => {
|
|
83
70
|
const user = userEvent.setup();
|
|
84
71
|
const { getByRole, emitted } = render(UiChip, {
|
|
85
|
-
props: {
|
|
86
|
-
variant: 'removable',
|
|
87
|
-
selectable: true,
|
|
88
|
-
disabled: true,
|
|
89
|
-
},
|
|
72
|
+
props: { variant: 'selectable', disabled: true },
|
|
90
73
|
slots: { default: 'Disabled chip' },
|
|
91
74
|
});
|
|
92
75
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
expect(selectableButton).toBeDisabled();
|
|
97
|
-
expect(removeButton).toBeDisabled();
|
|
98
|
-
|
|
99
|
-
await user.click(removeButton);
|
|
100
|
-
expect(emitted('remove')).toBeUndefined();
|
|
76
|
+
await user.click(getByRole('button', { name: 'Disabled chip' }));
|
|
77
|
+
expect(emitted('update:modelValue')).toBeUndefined();
|
|
101
78
|
});
|
|
102
79
|
});
|