@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.
Files changed (55) hide show
  1. package/config.d.ts +28 -4
  2. package/config.js +141 -23
  3. package/dist/system/components/UiTagsInput/UiTagsInput.vue.d.ts +2 -0
  4. package/dist/system/components/UiTagsInput/UiTagsInputItemDelete.vue.d.ts +2 -1
  5. package/dist/system/components/UiTagsInput/types.d.ts +21 -2
  6. package/dist/system/components/core/sidebar/utils.d.ts +9 -0
  7. package/dist/system/components/core/tags-input/TagsInputItemDelete.vue.d.ts +5 -0
  8. package/dist/system/icons/story-sidebar-icons.json +8 -0
  9. package/dist/system/lib.js +6106 -5997
  10. package/dist/system/patterns/UiLayout/UiLayoutContent.vue.d.ts +39 -0
  11. package/dist/system/patterns/UiLayout/index.d.ts +2 -0
  12. package/dist/system/patterns/UiLayout/layout-shell.d.ts +944 -0
  13. package/dist/system/patterns/UiLayout/types.d.ts +43 -0
  14. package/dist/system/patterns/index.d.ts +1 -0
  15. package/dist/system/story-sidebar-icons.json +8 -0
  16. package/docs/public-docs/migration-guide.md +402 -0
  17. package/docs/public-docs/quick-start.md +19 -10
  18. package/package.json +7 -4
  19. package/src/components/UiAlert/UiAlert.stories.ts +732 -0
  20. package/src/components/UiAlert/__tests__/UiAlert.test.ts +57 -11
  21. package/src/components/UiChip/UiChip.stories.ts +756 -2
  22. package/src/components/UiChip/UiChip.vue +7 -6
  23. package/src/components/UiChip/__tests__/UiChip.test.ts +38 -61
  24. package/src/components/UiDrawer/UiDrawer.stories.ts +665 -0
  25. package/src/components/UiDrawer/__tests__/UiDrawer.test.ts +6 -190
  26. package/src/components/UiLabel/UiLabel.stories.ts +691 -16
  27. package/src/components/UiLabel/__tests__/UiLabel.test.ts +18 -26
  28. package/src/components/UiSheet/UiSheet.stories.ts +751 -0
  29. package/src/components/UiSheet/__tests__/UiSheet.test.ts +6 -190
  30. package/src/components/UiSlider/UiSlider.stories.ts +716 -0
  31. package/src/components/UiSlider/__tests__/UiSlider.test.ts +8 -45
  32. package/src/components/UiSwitch/UiSwitch.stories.ts +11 -5
  33. package/src/components/UiTagsInput/UiTagsInput.stories.ts +850 -4
  34. package/src/components/UiTagsInput/UiTagsInput.vue +34 -0
  35. package/src/components/UiTagsInput/UiTagsInputItemDelete.vue +4 -1
  36. package/src/components/UiTagsInput/__tests__/UiTagsInput.test.ts +113 -29
  37. package/src/components/UiTagsInput/types.ts +24 -2
  38. package/src/components/core/sheet/SheetContent.vue +6 -1
  39. package/src/components/core/sidebar/Sidebar.vue +21 -5
  40. package/src/components/core/sidebar/utils.ts +10 -0
  41. package/src/components/core/switch/index.ts +8 -7
  42. package/src/components/core/tags-input/TagsInput.vue +4 -1
  43. package/src/components/core/tags-input/TagsInputItem.vue +13 -1
  44. package/src/components/core/tags-input/TagsInputItemDelete.vue +40 -7
  45. package/src/patterns/UiLayout/UiLayoutContent.stories.ts +1234 -0
  46. package/src/patterns/UiLayout/UiLayoutContent.vue +98 -0
  47. package/src/patterns/UiLayout/__tests__/UiLayoutContent.test.ts +97 -0
  48. package/src/patterns/UiLayout/index.ts +2 -0
  49. package/src/patterns/UiLayout/layout-shell.ts +64 -15
  50. package/src/patterns/UiLayout/types.ts +44 -0
  51. package/src/patterns/index.ts +1 -0
  52. package/src/theme/Typography.stories.ts +125 -133
  53. package/tokens.json +8132 -2475
  54. package/dist/system/icons/mobile-device-frame.png +0 -0
  55. package/dist/system/mobile-device-frame.png +0 -0
@@ -1,20 +1,66 @@
1
1
  import { render } from '@testing-library/vue';
2
2
  import { describe, expect, test } from 'vitest';
3
+ import { defineComponent } from 'vue';
3
4
  import UiAlert from '../UiAlert.vue';
5
+ import { AlertVariantIconNames, AlertVariants } from '../constants';
6
+
7
+ // The alert role, the assertive live-region semantics, the announcement fired
8
+ // by mounting, and the composed dismiss flow are covered by the play functions
9
+ // in `UiAlert.stories.ts`, which drive a real browser. What stays here is the
10
+ // variant-to-icon mapping and the `icon` slot override — prop plumbing that
11
+ // needs no browser, and that would otherwise be asserted against Lucide's
12
+ // internal markup.
13
+ const UiIconStub = defineComponent({
14
+ name: 'UiIcon',
15
+ props: {
16
+ name: { type: String, default: '' },
17
+ },
18
+ template: '<i data-testid="alert-icon" :data-icon-name="name" />',
19
+ });
20
+
21
+ /**
22
+ * Renders `UiAlert` with the icon replaced by a stub that records the icon
23
+ * name it was asked for.
24
+ * @param props Props forwarded to `UiAlert`.
25
+ * @param slots Slots forwarded to `UiAlert`.
26
+ * @returns The testing-library render result.
27
+ */
28
+ function renderAlert(props: Record<string, unknown> = {}, slots = {}) {
29
+ return render(UiAlert, {
30
+ props,
31
+ slots: { default: 'Message', ...slots },
32
+ global: { stubs: { UiIcon: UiIconStub } },
33
+ });
34
+ }
4
35
 
5
36
  describe('UiAlert', () => {
6
- test('has alert role for screen readers', () => {
7
- const { getByRole } = render(UiAlert, {
8
- slots: { default: 'Message' },
9
- });
10
- expect(getByRole('alert')).toBeInTheDocument();
37
+ test.each(AlertVariants)('maps the %s variant to its icon', (variant) => {
38
+ const { getByTestId } = renderAlert({ variant });
39
+
40
+ expect(getByTestId('alert-icon')).toHaveAttribute(
41
+ 'data-icon-name',
42
+ AlertVariantIconNames[variant],
43
+ );
11
44
  });
12
45
 
13
- test('accepts destructive variant', () => {
14
- const { getByRole } = render(UiAlert, {
15
- props: { variant: 'destructive' },
16
- slots: { default: 'Message' },
17
- });
18
- expect(getByRole('alert')).toBeInTheDocument();
46
+ test('falls back to the default icon for an unknown variant', () => {
47
+ // The variant is typed, so only a miswired consumer can reach this — the
48
+ // component still resolves an icon rather than rendering none.
49
+ const { getByTestId } = renderAlert({ variant: 'nope' });
50
+
51
+ expect(getByTestId('alert-icon')).toHaveAttribute(
52
+ 'data-icon-name',
53
+ AlertVariantIconNames.default,
54
+ );
55
+ });
56
+
57
+ test('lets the icon slot replace the variant icon', () => {
58
+ const { getByTestId, queryByTestId } = renderAlert(
59
+ {},
60
+ { icon: '<span data-testid="custom-icon">!</span>' },
61
+ );
62
+
63
+ expect(getByTestId('custom-icon')).toBeInTheDocument();
64
+ expect(queryByTestId('alert-icon')).not.toBeInTheDocument();
19
65
  });
20
66
  });