@aleph-alpha/ui-library 5.4.0 → 5.6.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 (59) hide show
  1. package/config.d.ts +9 -0
  2. package/config.js +12 -3
  3. package/dist/system/components/UiAutocomplete/UiAutocomplete.vue.d.ts +2 -0
  4. package/dist/system/components/UiButtonGroup/UiButtonGroup.vue.d.ts +20 -0
  5. package/dist/system/components/UiButtonGroup/index.d.ts +2 -0
  6. package/dist/system/components/UiButtonGroup/types.d.ts +20 -0
  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 +8878 -8692
  13. package/dist/system/patterns/UiFloatActions/UiFloatActionItems.vue.d.ts +173 -2
  14. package/dist/system/patterns/UiFloatActions/floatActionItemContext.d.ts +15 -1
  15. package/dist/system/patterns/UiFloatActions/types.d.ts +25 -1
  16. package/dist/system/story-sidebar-icons.json +8 -1
  17. package/package.json +5 -3
  18. package/src/components/UiAutocomplete/UiAutocomplete.stories.ts +620 -0
  19. package/src/components/UiAutocomplete/UiAutocomplete.vue +28 -3
  20. package/src/components/UiAutocomplete/__tests__/UiAutocomplete.test.ts +14 -69
  21. package/src/components/UiButton/UiButton.stories.ts +9 -9
  22. package/src/components/UiButtonGroup/UiButtonGroup.stories.ts +690 -0
  23. package/src/components/UiButtonGroup/UiButtonGroup.vue +18 -0
  24. package/src/components/UiButtonGroup/__tests__/UiButtonGroup.test.ts +68 -0
  25. package/src/components/UiButtonGroup/index.ts +2 -0
  26. package/src/components/UiButtonGroup/types.ts +21 -0
  27. package/src/components/UiCheckbox/UiCheckbox.stories.ts +253 -0
  28. package/src/components/UiCheckbox/__tests__/UiCheckbox.test.ts +3 -18
  29. package/src/components/UiField/UiField.stories.ts +608 -1
  30. package/src/components/UiField/UiFieldDescription.vue +7 -2
  31. package/src/components/UiInput/UiInput.stories.ts +336 -2
  32. package/src/components/UiInput/__tests__/UiInput.test.ts +20 -28
  33. package/src/components/UiItem/UiItem.stories.ts +236 -1
  34. package/src/components/UiItem/__tests__/UiItem.test.ts +11 -72
  35. package/src/components/UiSelect/UiSelect.stories.ts +769 -0
  36. package/src/components/UiSelect/__tests__/UiSelect.test.ts +4 -73
  37. package/src/components/UiSelect/__tests__/UiSelectItem.test.ts +3 -31
  38. package/src/components/UiSelect/__tests__/UiSelectTrigger.test.ts +14 -5
  39. package/src/components/UiSnackbar/UiSnackbar.stories.ts +6 -6
  40. package/src/components/UiSnackbar/UiSnackbar.vue +4 -4
  41. package/src/components/UiSnackbar/UiSnackbarContent.vue +4 -4
  42. package/src/components/core/button-group/ButtonGroup.vue +24 -0
  43. package/src/components/core/button-group/ButtonGroupSeparator.vue +29 -0
  44. package/src/components/core/button-group/ButtonGroupText.vue +33 -0
  45. package/src/components/core/button-group/index.ts +25 -0
  46. package/src/components/core/checkbox/Checkbox.vue +0 -1
  47. package/src/components/core/select/SelectTrigger.vue +1 -1
  48. package/src/components/core/tabs/TabsTrigger.vue +1 -1
  49. package/src/components/index.ts +1 -0
  50. package/src/patterns/UiDataTable/UiDataTable.stories.ts +495 -8
  51. package/src/patterns/UiDataTable/UiDataTableFilterMenu.vue +1 -1
  52. package/src/patterns/UiDataTable/__tests__/UiDataTable.test.ts +7 -184
  53. package/src/patterns/UiFloatActions/UiFloatActionItems.vue +138 -11
  54. package/src/patterns/UiFloatActions/UiFloatActions.stories.ts +890 -3
  55. package/src/patterns/UiFloatActions/__tests__/UiFloatActionItems.test.ts +46 -24
  56. package/src/patterns/UiFloatActions/floatActionItemContext.ts +16 -1
  57. package/src/patterns/UiFloatActions/types.ts +28 -1
  58. package/src/components/UiField/__tests__/UiFieldError.test.ts +0 -39
  59. package/src/patterns/UiFloatActions/__tests__/UiFloatActions.a11y.test.ts +0 -152
@@ -1,3 +1,4 @@
1
+ import { nextTick } from 'vue';
1
2
  import { UiFloatActionItemsProps } from './types';
2
3
  declare function __VLS_template(): {
3
4
  attrs: Partial<{}>;
@@ -8,23 +9,193 @@ declare function __VLS_template(): {
8
9
  default?(_: {}): any;
9
10
  };
10
11
  refs: {
11
- itemRef: HTMLInputElement;
12
+ itemRef: ({
13
+ $: import('vue').ComponentInternalInstance;
14
+ $data: {};
15
+ $props: {
16
+ readonly modelValue?: string | undefined;
17
+ readonly name: string;
18
+ readonly type?: import('../..').UiInputType | undefined;
19
+ readonly disabled?: boolean | undefined;
20
+ readonly placeholder?: string | undefined;
21
+ readonly required?: boolean | undefined;
22
+ readonly accept?: string | undefined;
23
+ readonly multiple?: boolean | undefined;
24
+ readonly uploadButtonLabel?: string | undefined;
25
+ readonly "onUpdate:modelValue"?: ((value: string) => any) | undefined;
26
+ readonly "onUpdate:files"?: ((files: File[]) => any) | undefined;
27
+ } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps;
28
+ $attrs: {
29
+ [x: string]: unknown;
30
+ };
31
+ $refs: {
32
+ [x: string]: unknown;
33
+ };
34
+ $slots: Readonly<{
35
+ [name: string]: import('vue').Slot<any> | undefined;
36
+ }>;
37
+ $root: import('vue').ComponentPublicInstance | null;
38
+ $parent: import('vue').ComponentPublicInstance | null;
39
+ $host: Element | null;
40
+ $emit: ((event: "update:modelValue", value: string) => void) & ((event: "update:files", files: File[]) => void);
41
+ $el: any;
42
+ $options: import('vue').ComponentOptionsBase<Readonly<{
43
+ modelValue?: string;
44
+ } & import('../..').UiInputProps> & Readonly<{
45
+ "onUpdate:modelValue"?: ((value: string) => any) | undefined;
46
+ "onUpdate:files"?: ((files: File[]) => any) | undefined;
47
+ }>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
48
+ "update:modelValue": (value: string) => any;
49
+ "update:files": (files: File[]) => any;
50
+ }, string, {
51
+ disabled: boolean;
52
+ type: import('../..').UiInputType;
53
+ multiple: boolean;
54
+ placeholder: string;
55
+ required: boolean;
56
+ accept: string;
57
+ uploadButtonLabel: string;
58
+ }, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & {
59
+ beforeCreate?: (() => void) | (() => void)[];
60
+ created?: (() => void) | (() => void)[];
61
+ beforeMount?: (() => void) | (() => void)[];
62
+ mounted?: (() => void) | (() => void)[];
63
+ beforeUpdate?: (() => void) | (() => void)[];
64
+ updated?: (() => void) | (() => void)[];
65
+ activated?: (() => void) | (() => void)[];
66
+ deactivated?: (() => void) | (() => void)[];
67
+ beforeDestroy?: (() => void) | (() => void)[];
68
+ beforeUnmount?: (() => void) | (() => void)[];
69
+ destroyed?: (() => void) | (() => void)[];
70
+ unmounted?: (() => void) | (() => void)[];
71
+ renderTracked?: ((e: import('vue').DebuggerEvent) => void) | ((e: import('vue').DebuggerEvent) => void)[];
72
+ renderTriggered?: ((e: import('vue').DebuggerEvent) => void) | ((e: import('vue').DebuggerEvent) => void)[];
73
+ errorCaptured?: ((err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void) | ((err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void)[];
74
+ };
75
+ $forceUpdate: () => void;
76
+ $nextTick: typeof nextTick;
77
+ $watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R, import('@vue/reactivity').OnCleanup]) => any : (...args: [any, any, import('@vue/reactivity').OnCleanup]) => any, options?: import('vue').WatchOptions): import('vue').WatchStopHandle;
78
+ } & Readonly<{
79
+ disabled: boolean;
80
+ type: import('../..').UiInputType;
81
+ multiple: boolean;
82
+ placeholder: string;
83
+ required: boolean;
84
+ accept: string;
85
+ uploadButtonLabel: string;
86
+ }> & Omit<Readonly<{
87
+ modelValue?: string;
88
+ } & import('../..').UiInputProps> & Readonly<{
89
+ "onUpdate:modelValue"?: ((value: string) => any) | undefined;
90
+ "onUpdate:files"?: ((files: File[]) => any) | undefined;
91
+ }>, "disabled" | "type" | "multiple" | "placeholder" | "required" | "accept" | "uploadButtonLabel"> & import('vue').ShallowUnwrapRef<{}> & {} & import('vue').ComponentCustomProperties & {} & {
92
+ $slots: {
93
+ end?(_: {}): any;
94
+ };
95
+ }) | null;
12
96
  };
13
97
  rootEl: any;
14
98
  };
15
99
  type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
16
100
  declare const __VLS_component: import('vue').DefineComponent<UiFloatActionItemsProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
101
+ "update:modelValue": (value: import('./types').UiFloatActionItemsValue) => any;
17
102
  click: (event: MouseEvent) => any;
18
103
  }, string, import('vue').PublicProps, Readonly<UiFloatActionItemsProps> & Readonly<{
104
+ "onUpdate:modelValue"?: ((value: import('./types').UiFloatActionItemsValue) => any) | undefined;
19
105
  onClick?: ((event: MouseEvent) => any) | undefined;
20
106
  }>, {
21
107
  disabled: boolean;
22
108
  orientation: import('./types').UiFloatActionItemsOrientation;
23
109
  type: import('./types').UiFloatActionItemsType;
110
+ modelValue: import('./types').UiFloatActionItemsValue;
24
111
  placeholder: string;
112
+ value: import('./types').UiFloatActionItemsValue;
25
113
  ariaLabel: string;
26
114
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
27
- itemRef: HTMLInputElement;
115
+ itemRef: ({
116
+ $: import('vue').ComponentInternalInstance;
117
+ $data: {};
118
+ $props: {
119
+ readonly modelValue?: string | undefined;
120
+ readonly name: string;
121
+ readonly type?: import('../..').UiInputType | undefined;
122
+ readonly disabled?: boolean | undefined;
123
+ readonly placeholder?: string | undefined;
124
+ readonly required?: boolean | undefined;
125
+ readonly accept?: string | undefined;
126
+ readonly multiple?: boolean | undefined;
127
+ readonly uploadButtonLabel?: string | undefined;
128
+ readonly "onUpdate:modelValue"?: ((value: string) => any) | undefined;
129
+ readonly "onUpdate:files"?: ((files: File[]) => any) | undefined;
130
+ } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps;
131
+ $attrs: {
132
+ [x: string]: unknown;
133
+ };
134
+ $refs: {
135
+ [x: string]: unknown;
136
+ };
137
+ $slots: Readonly<{
138
+ [name: string]: import('vue').Slot<any> | undefined;
139
+ }>;
140
+ $root: import('vue').ComponentPublicInstance | null;
141
+ $parent: import('vue').ComponentPublicInstance | null;
142
+ $host: Element | null;
143
+ $emit: ((event: "update:modelValue", value: string) => void) & ((event: "update:files", files: File[]) => void);
144
+ $el: any;
145
+ $options: import('vue').ComponentOptionsBase<Readonly<{
146
+ modelValue?: string;
147
+ } & import('../..').UiInputProps> & Readonly<{
148
+ "onUpdate:modelValue"?: ((value: string) => any) | undefined;
149
+ "onUpdate:files"?: ((files: File[]) => any) | undefined;
150
+ }>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
151
+ "update:modelValue": (value: string) => any;
152
+ "update:files": (files: File[]) => any;
153
+ }, string, {
154
+ disabled: boolean;
155
+ type: import('../..').UiInputType;
156
+ multiple: boolean;
157
+ placeholder: string;
158
+ required: boolean;
159
+ accept: string;
160
+ uploadButtonLabel: string;
161
+ }, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & {
162
+ beforeCreate?: (() => void) | (() => void)[];
163
+ created?: (() => void) | (() => void)[];
164
+ beforeMount?: (() => void) | (() => void)[];
165
+ mounted?: (() => void) | (() => void)[];
166
+ beforeUpdate?: (() => void) | (() => void)[];
167
+ updated?: (() => void) | (() => void)[];
168
+ activated?: (() => void) | (() => void)[];
169
+ deactivated?: (() => void) | (() => void)[];
170
+ beforeDestroy?: (() => void) | (() => void)[];
171
+ beforeUnmount?: (() => void) | (() => void)[];
172
+ destroyed?: (() => void) | (() => void)[];
173
+ unmounted?: (() => void) | (() => void)[];
174
+ renderTracked?: ((e: import('vue').DebuggerEvent) => void) | ((e: import('vue').DebuggerEvent) => void)[];
175
+ renderTriggered?: ((e: import('vue').DebuggerEvent) => void) | ((e: import('vue').DebuggerEvent) => void)[];
176
+ errorCaptured?: ((err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void) | ((err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void)[];
177
+ };
178
+ $forceUpdate: () => void;
179
+ $nextTick: typeof nextTick;
180
+ $watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R, import('@vue/reactivity').OnCleanup]) => any : (...args: [any, any, import('@vue/reactivity').OnCleanup]) => any, options?: import('vue').WatchOptions): import('vue').WatchStopHandle;
181
+ } & Readonly<{
182
+ disabled: boolean;
183
+ type: import('../..').UiInputType;
184
+ multiple: boolean;
185
+ placeholder: string;
186
+ required: boolean;
187
+ accept: string;
188
+ uploadButtonLabel: string;
189
+ }> & Omit<Readonly<{
190
+ modelValue?: string;
191
+ } & import('../..').UiInputProps> & Readonly<{
192
+ "onUpdate:modelValue"?: ((value: string) => any) | undefined;
193
+ "onUpdate:files"?: ((files: File[]) => any) | undefined;
194
+ }>, "disabled" | "type" | "multiple" | "placeholder" | "required" | "accept" | "uploadButtonLabel"> & import('vue').ShallowUnwrapRef<{}> & {} & import('vue').ComponentCustomProperties & {} & {
195
+ $slots: {
196
+ end?(_: {}): any;
197
+ };
198
+ }) | null;
28
199
  }, any>;
29
200
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
30
201
  export default _default;
@@ -1,8 +1,16 @@
1
1
  import { InjectionKey, Ref } from 'vue';
2
+ import { UiFloatActionItemsValue } from './types';
3
+ /** Metadata a child item shares with the toolbar when it registers. */
4
+ export interface FloatActionItemRegistration {
5
+ /** Live getter for the item's root element (used to position the indicator). */
6
+ el: () => HTMLElement | null;
7
+ /** Live getter for the item's `value`, if it is a selectable item. */
8
+ value: () => UiFloatActionItemsValue | undefined;
9
+ }
2
10
  /** Shared toolbar state used to coordinate roving-tabindex focus across items. */
3
11
  export interface FloatActionItemContext {
4
12
  /** Registers a focusable item so the toolbar can manage roving tabindex. */
5
- registerItem: (id: symbol) => void;
13
+ registerItem: (id: symbol, registration: FloatActionItemRegistration) => void;
6
14
  /** Removes an item from roving-tabindex tracking. */
7
15
  unregisterItem: (id: symbol) => void;
8
16
  /** Marks an item as the active (tabbable) one when it receives focus. */
@@ -11,6 +19,12 @@ export interface FloatActionItemContext {
11
19
  getTabIndex: (id: symbol) => number;
12
20
  /** Keyboard navigation direction for the toolbar. */
13
21
  orientation: Ref<'horizontal' | 'vertical'>;
22
+ /** Whether the toolbar is a `v-model`-driven single-select control. */
23
+ hasModel: Ref<boolean>;
24
+ /** Currently selected value when the toolbar is `v-model`-driven. */
25
+ modelValue: Ref<UiFloatActionItemsValue | undefined>;
26
+ /** Selects a value, emitting `update:modelValue` from the toolbar. */
27
+ select: (value: UiFloatActionItemsValue) => void;
14
28
  }
15
29
  export declare const FLOAT_ACTION_ITEM_CONTEXT: InjectionKey<FloatActionItemContext>;
16
30
  export declare const FLOAT_ACTION_ITEM_SELECTOR = "[data-slot=\"float-item-action\"]";
@@ -80,6 +80,8 @@ export interface UiFloatActionsProps {
80
80
  export type UiFloatActionItemsType = 'toolbar' | 'button' | 'input' | 'text' | 'group' | 'separator';
81
81
  /** Arrow-key navigation direction for toolbar roving focus. */
82
82
  export type UiFloatActionItemsOrientation = 'horizontal' | 'vertical';
83
+ /** Value identifying a selectable `button` item within a toolbar. */
84
+ export type UiFloatActionItemsValue = string | number;
83
85
  /**
84
86
  * Pill-shaped floating toolbar and its action items.
85
87
  *
@@ -118,10 +120,32 @@ export interface UiFloatActionItemsProps {
118
120
  * Placeholder text for `input` items.
119
121
  */
120
122
  placeholder?: string;
123
+ /**
124
+ * Selected item value for the `toolbar` container.
125
+ * Use `v-model` to turn the toolbar into a single-select control: the active
126
+ * `button` item (the one whose `value` matches) gets a sliding background
127
+ * indicator. Omit for a plain, stateless action bar.
128
+ * @example
129
+ * ```vue
130
+ * <UiFloatActionItems v-model="view" aria-label="View">
131
+ * <UiFloatActionItems type="button" value="grid" aria-label="Grid" />
132
+ * <UiFloatActionItems type="button" value="list" aria-label="List" />
133
+ * </UiFloatActionItems>
134
+ * ```
135
+ */
136
+ modelValue?: UiFloatActionItemsValue;
137
+ /**
138
+ * Value of a selectable `button` item.
139
+ * When the parent toolbar uses `v-model`, clicking this item selects its
140
+ * `value` and moves the active indicator onto it.
141
+ */
142
+ value?: UiFloatActionItemsValue;
121
143
  }
122
- /** Events emitted by {@link UiFloatActionItems} button items. */
144
+ /** Events emitted by {@link UiFloatActionItems}. */
123
145
  export interface UiFloatActionItemsEmits {
124
146
  /** Emitted when a `button` item is activated. */
125
147
  click: [event: MouseEvent];
148
+ /** Emitted by a `toolbar` with `v-model` when the selected value changes. */
149
+ 'update:modelValue': [value: UiFloatActionItemsValue];
126
150
  }
127
151
  export type UiFloatActionItemsClass = HTMLAttributes['class'];
@@ -1,10 +1,17 @@
1
1
  {
2
2
  "components-uibutton--design-notes": "palette",
3
3
  "components-uibutton--accessibility": "accessibility",
4
+ "components-uibuttongroup--accessibility": "accessibility",
4
5
  "components-uicheckbox--design-notes": "palette",
5
6
  "components-uicheckbox--accessibility": "accessibility",
6
7
  "components-uifield--design-notes": "palette",
7
8
  "components-uifield--accessibility": "accessibility",
8
9
  "components-uiitem--design-notes": "palette",
9
- "components-uiitem--accessibility": "accessibility"
10
+ "components-uiitem--accessibility": "accessibility",
11
+ "components-uiinput--design-notes": "palette",
12
+ "components-uiinput--accessibility": "accessibility",
13
+ "components-uiselect--accessibility": "accessibility",
14
+ "components-uiautocomplete--accessibility": "accessibility",
15
+ "patterns-uifloatactions--accessibility": "accessibility",
16
+ "patterns-uidatatable--accessibility": "accessibility"
10
17
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aleph-alpha/ui-library",
3
- "version": "5.4.0",
3
+ "version": "5.6.0",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "main": "dist/system/lib.js",
@@ -41,7 +41,8 @@
41
41
  "storybook": "Starts interactive Storybook development server on port 6006 for local component development",
42
42
  "chromatic": "Runs Chromatic visual regression against the Storybook build (requires CHROMATIC_PROJECT_TOKEN)",
43
43
  "test:e2e": "Runs end-to-end integration tests with Playwright",
44
- "tag-component": "Adds experimental/beta/deprecated lifecycle tags or removes them with stable for a component story and props JSDoc"
44
+ "tag-component": "Adds experimental/beta/deprecated lifecycle tags or removes them with stable for a component story and props JSDoc",
45
+ "report:scenarios-pdf": "Generates a PDF catalogue of the labelled step() test scenarios in every story, as a source of truth for ui-library"
45
46
  },
46
47
  "homepage": "https://docs.aleph-alpha.com",
47
48
  "devDependencies": {
@@ -83,7 +84,7 @@
83
84
  "wait-on": "9.0.3",
84
85
  "@aleph-alpha/eslint-config-frontend": "0.7.0",
85
86
  "@aleph-alpha/prettier-config-frontend": "2.1.0",
86
- "@aleph-alpha/tsconfig-frontend": "0.7.0"
87
+ "@aleph-alpha/tsconfig-frontend": "0.7.1"
87
88
  },
88
89
  "peerDependencies": {
89
90
  "@unocss/preset-wind4": ">=66.0.0",
@@ -145,6 +146,7 @@
145
146
  "chromatic": "npx chromatic --build-script-name=build-storybook --exit-zero-on-changes",
146
147
  "test:e2e": "playwright test",
147
148
  "tag-component": "node scripts/tag-component.mjs",
149
+ "report:scenarios-pdf": "node scripts/storybook-scenarios-pdf.mjs",
148
150
  "publish:local": "yalc publish && yalc push --sig"
149
151
  }
150
152
  }