@aleph-alpha/ui-library 5.5.0 → 5.7.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 (41) hide show
  1. package/config.js +5 -0
  2. package/dist/system/components/UiAutocomplete/UiAutocomplete.vue.d.ts +2 -0
  3. package/dist/system/components/UiButtonGroup/UiButtonGroup.vue.d.ts +20 -0
  4. package/dist/system/components/UiButtonGroup/index.d.ts +2 -0
  5. package/dist/system/components/UiButtonGroup/types.d.ts +20 -0
  6. package/dist/system/components/UiField/types.d.ts +2 -1
  7. package/dist/system/components/core/button-group/ButtonGroup.vue.d.ts +23 -0
  8. package/dist/system/components/core/button-group/ButtonGroupSeparator.vue.d.ts +9 -0
  9. package/dist/system/components/core/button-group/ButtonGroupText.vue.d.ts +26 -0
  10. package/dist/system/components/core/button-group/index.d.ts +8 -0
  11. package/dist/system/components/index.d.ts +1 -0
  12. package/dist/system/lib.js +7855 -7732
  13. package/dist/system/story-sidebar-icons.json +3 -0
  14. package/package.json +5 -5
  15. package/src/components/UiAutocomplete/UiAutocomplete.stories.ts +619 -0
  16. package/src/components/UiAutocomplete/UiAutocomplete.vue +28 -3
  17. package/src/components/UiAutocomplete/__tests__/UiAutocomplete.test.ts +14 -69
  18. package/src/components/UiButtonGroup/UiButtonGroup.stories.ts +690 -0
  19. package/src/components/UiButtonGroup/UiButtonGroup.vue +18 -0
  20. package/src/components/UiButtonGroup/__tests__/UiButtonGroup.test.ts +68 -0
  21. package/src/components/UiButtonGroup/index.ts +2 -0
  22. package/src/components/UiButtonGroup/types.ts +21 -0
  23. package/src/components/UiCheckbox/UiCheckbox.stories.ts +625 -74
  24. package/src/components/UiField/UiField.stories.ts +1 -1
  25. package/src/components/UiField/types.ts +2 -1
  26. package/src/components/UiRadioGroup/UiRadioGroup.stories.ts +995 -0
  27. package/src/components/UiSelect/UiSelect.stories.ts +769 -0
  28. package/src/components/UiSelect/__tests__/UiSelect.test.ts +4 -73
  29. package/src/components/UiSelect/__tests__/UiSelectItem.test.ts +3 -31
  30. package/src/components/UiSelect/__tests__/UiSelectTrigger.test.ts +14 -5
  31. package/src/components/core/button-group/ButtonGroup.vue +24 -0
  32. package/src/components/core/button-group/ButtonGroupSeparator.vue +29 -0
  33. package/src/components/core/button-group/ButtonGroupText.vue +33 -0
  34. package/src/components/core/button-group/index.ts +25 -0
  35. package/src/components/core/field/FieldDescription.vue +1 -1
  36. package/src/components/core/field/FieldLabel.vue +3 -2
  37. package/src/components/core/field/FieldTitle.vue +1 -1
  38. package/src/components/core/select/SelectTrigger.vue +1 -1
  39. package/src/components/index.ts +1 -0
  40. package/src/components/UiCheckbox/__tests__/UiCheckbox.test.ts +0 -14
  41. package/src/components/UiRadioGroup/__tests__/UiRadioGroup.test.ts +0 -412
@@ -0,0 +1,68 @@
1
+ import { render } from '@testing-library/vue';
2
+ import { describe, expect, test } from 'vitest';
3
+ import UiButtonGroup from '../UiButtonGroup.vue';
4
+
5
+ describe('UiButtonGroup', () => {
6
+ test('renders as a group with slot content', () => {
7
+ const { getByRole } = render(UiButtonGroup, {
8
+ slots: { default: '<button type="button">Click me</button>' },
9
+ });
10
+ const group = getByRole('group');
11
+ expect(group).toBeInTheDocument();
12
+ expect(group).toHaveTextContent('Click me');
13
+ });
14
+
15
+ test('defaults to horizontal orientation', () => {
16
+ const { getByRole } = render(UiButtonGroup, {
17
+ slots: { default: '<button type="button">Button</button>' },
18
+ });
19
+ expect(getByRole('group')).toHaveAttribute(
20
+ 'data-orientation',
21
+ 'horizontal',
22
+ );
23
+ });
24
+
25
+ describe('Orientation (contract test)', () => {
26
+ const orientations = ['horizontal', 'vertical'] as const;
27
+
28
+ test.each(orientations)('accepts orientation="%s"', (orientation) => {
29
+ const { getByRole } = render(UiButtonGroup, {
30
+ props: { orientation },
31
+ slots: { default: '<button type="button">Button</button>' },
32
+ });
33
+ expect(getByRole('group')).toHaveAttribute(
34
+ 'data-orientation',
35
+ orientation,
36
+ );
37
+ });
38
+ });
39
+
40
+ test('renders multiple children', () => {
41
+ const { getAllByRole } = render(UiButtonGroup, {
42
+ slots: {
43
+ default: `
44
+ <button type="button">One</button>
45
+ <button type="button">Two</button>
46
+ <button type="button">Three</button>
47
+ `,
48
+ },
49
+ });
50
+ expect(getAllByRole('button')).toHaveLength(3);
51
+ });
52
+
53
+ test('forwards a custom class to the group container', () => {
54
+ const { getByRole } = render(UiButtonGroup, {
55
+ attrs: { class: 'custom-class' },
56
+ slots: { default: '<button type="button">Button</button>' },
57
+ });
58
+ expect(getByRole('group')).toHaveClass('custom-class');
59
+ });
60
+
61
+ test('forwards aria-label to the group container for an accessible name', () => {
62
+ const { getByRole } = render(UiButtonGroup, {
63
+ attrs: { 'aria-label': 'Text alignment' },
64
+ slots: { default: '<button type="button">Left</button>' },
65
+ });
66
+ expect(getByRole('group')).toHaveAccessibleName('Text alignment');
67
+ });
68
+ });
@@ -0,0 +1,2 @@
1
+ export { default as UiButtonGroup } from './UiButtonGroup.vue';
2
+ export type { UiButtonGroupProps, UiButtonGroupOrientation } from './types';
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Layout direction for the buttons inside a `UiButtonGroup`.
3
+ */
4
+ export type UiButtonGroupOrientation = 'horizontal' | 'vertical';
5
+
6
+ /**
7
+ * Visually joins a set of related actions (and inputs) into a single, connected
8
+ * control. Renders a `role="group"` container and merges the borders and radii
9
+ * of its children so they read as one unit.
10
+ * @category Actions
11
+ * @useCases toolbar, segmented actions, split button, input with buttons, pagination controls
12
+ * @keywords button group, group, toolbar, segmented, joined, split button
13
+ * @related UiButton, UiInput
14
+ */
15
+ export interface UiButtonGroupProps {
16
+ /**
17
+ * The layout direction of the grouped buttons.
18
+ * @default 'horizontal'
19
+ */
20
+ orientation?: UiButtonGroupOrientation;
21
+ }