@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
|
@@ -2,42 +2,34 @@ import { render } from '@testing-library/vue';
|
|
|
2
2
|
import { describe, expect, test } from 'vitest';
|
|
3
3
|
import UiLabel from '../UiLabel.vue';
|
|
4
4
|
|
|
5
|
+
// The label/control association — accessible names, click-to-focus, tab order,
|
|
6
|
+
// and required state — is covered by the play functions in
|
|
7
|
+
// `UiLabel.stories.ts`, which pair the label with real controls in a browser.
|
|
8
|
+
// None of that can be asserted meaningfully against a label rendered on its
|
|
9
|
+
// own, so what stays here is the prop plumbing through the two wrapper layers.
|
|
5
10
|
describe('UiLabel', () => {
|
|
6
|
-
test('
|
|
7
|
-
const labelText = 'Email';
|
|
8
|
-
const { getByText } = render(UiLabel, {
|
|
9
|
-
slots: { default: labelText },
|
|
10
|
-
});
|
|
11
|
-
expect(getByText(labelText)).toBeInTheDocument();
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
test('renders label with for attribute', () => {
|
|
15
|
-
const forValue = 'email-input';
|
|
11
|
+
test('forwards for to the rendered label element', () => {
|
|
16
12
|
const { container } = render(UiLabel, {
|
|
17
|
-
props: { for:
|
|
13
|
+
props: { for: 'email-input' },
|
|
18
14
|
slots: { default: 'Email' },
|
|
19
15
|
});
|
|
16
|
+
|
|
17
|
+
// `for` travels UiLabel -> core Label -> reka Label before reaching the
|
|
18
|
+
// DOM, and the association is worthless if it is dropped on the way.
|
|
20
19
|
const label = container.querySelector('label');
|
|
21
|
-
expect(label).toHaveAttribute('for',
|
|
20
|
+
expect(label).toHaveAttribute('for', 'email-input');
|
|
22
21
|
});
|
|
23
22
|
|
|
24
|
-
test('
|
|
25
|
-
const customClass = 'custom-label-class';
|
|
23
|
+
test('merges a custom class with the base styling', () => {
|
|
26
24
|
const { container } = render(UiLabel, {
|
|
27
|
-
props: { class:
|
|
25
|
+
props: { for: 'email-input', class: 'custom-label-class' },
|
|
28
26
|
slots: { default: 'Email' },
|
|
29
27
|
});
|
|
30
|
-
const label = container.querySelector('label');
|
|
31
|
-
expect(label).toHaveClass(customClass);
|
|
32
|
-
});
|
|
33
28
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
});
|
|
40
|
-
expect(getByTestId('slot-content')).toBeInTheDocument();
|
|
41
|
-
expect(getByText('Custom Content')).toBeInTheDocument();
|
|
29
|
+
// `cn` has to merge rather than replace, or a consumer adding one utility
|
|
30
|
+
// would silently strip the label's typography and layout.
|
|
31
|
+
const label = container.querySelector('label');
|
|
32
|
+
expect(label).toHaveClass('custom-label-class');
|
|
33
|
+
expect(label).toHaveClass('label-14-medium');
|
|
42
34
|
});
|
|
43
35
|
});
|