@aleph-alpha/ui-library 5.1.0 → 5.3.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 (29) hide show
  1. package/README.md +2 -0
  2. package/dist/system/components/core/sidebar/SidebarInset.vue.d.ts +14 -1
  3. package/dist/system/index.d.ts +1 -0
  4. package/dist/system/lib/useAnchorFloat.d.ts +143 -0
  5. package/dist/system/lib.js +19421 -18919
  6. package/dist/system/patterns/UiFloatActions/UiFloatActionItems.vue.d.ts +35 -0
  7. package/dist/system/patterns/UiFloatActions/UiFloatActions.vue.d.ts +43 -0
  8. package/dist/system/patterns/UiFloatActions/floatActionItemContext.d.ts +16 -0
  9. package/dist/system/patterns/UiFloatActions/index.d.ts +3 -0
  10. package/dist/system/patterns/UiFloatActions/types.d.ts +127 -0
  11. package/dist/system/patterns/index.d.ts +1 -0
  12. package/package.json +12 -3
  13. package/src/components/UiButton/UiButton.stories.ts +526 -38
  14. package/src/components/core/sidebar/SidebarInset.vue +19 -2
  15. package/src/index.ts +1 -0
  16. package/src/lib/useAnchorFloat.test.ts +166 -0
  17. package/src/lib/useAnchorFloat.ts +437 -0
  18. package/src/patterns/UiFloatActions/UiFloatActionItems.vue +321 -0
  19. package/src/patterns/UiFloatActions/UiFloatActions.stories.ts +767 -0
  20. package/src/patterns/UiFloatActions/UiFloatActions.vue +220 -0
  21. package/src/patterns/UiFloatActions/__tests__/UiFloatActionItems.test.ts +104 -0
  22. package/src/patterns/UiFloatActions/__tests__/UiFloatActions.a11y.test.ts +152 -0
  23. package/src/patterns/UiFloatActions/__tests__/UiFloatActions.test.ts +86 -0
  24. package/src/patterns/UiFloatActions/floatActionItemContext.ts +20 -0
  25. package/src/patterns/UiFloatActions/index.ts +3 -0
  26. package/src/patterns/UiFloatActions/types.ts +155 -0
  27. package/src/patterns/UiSidebar/UiSidebarInset.stories.ts +259 -0
  28. package/src/patterns/UiSidebar/__tests__/UiSidebarInset.test.ts +20 -0
  29. package/src/patterns/index.ts +1 -0
@@ -0,0 +1,35 @@
1
+ import { UiFloatActionItemsProps } from './types';
2
+ declare function __VLS_template(): {
3
+ attrs: Partial<{}>;
4
+ slots: {
5
+ default?(_: {}): any;
6
+ default?(_: {}): any;
7
+ default?(_: {}): any;
8
+ default?(_: {}): any;
9
+ };
10
+ refs: {
11
+ itemRef: HTMLInputElement;
12
+ };
13
+ rootEl: any;
14
+ };
15
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
16
+ declare const __VLS_component: import('vue').DefineComponent<UiFloatActionItemsProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
17
+ click: (event: MouseEvent) => any;
18
+ }, string, import('vue').PublicProps, Readonly<UiFloatActionItemsProps> & Readonly<{
19
+ onClick?: ((event: MouseEvent) => any) | undefined;
20
+ }>, {
21
+ disabled: boolean;
22
+ orientation: import('./types').UiFloatActionItemsOrientation;
23
+ type: import('./types').UiFloatActionItemsType;
24
+ placeholder: string;
25
+ ariaLabel: string;
26
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
27
+ itemRef: HTMLInputElement;
28
+ }, any>;
29
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
30
+ export default _default;
31
+ type __VLS_WithTemplateSlots<T, S> = T & {
32
+ new (): {
33
+ $slots: S;
34
+ };
35
+ };
@@ -0,0 +1,43 @@
1
+ import { UiFloatActionsProps } from './types';
2
+ type __VLS_Props = UiFloatActionsProps;
3
+ type __VLS_PublicProps = {
4
+ 'open'?: boolean;
5
+ } & __VLS_Props;
6
+ declare function __VLS_template(): {
7
+ attrs: Partial<{}>;
8
+ slots: {
9
+ container?(_: {}): any;
10
+ container?(_: {}): any;
11
+ action?(_: {}): any;
12
+ };
13
+ refs: {
14
+ referenceRef: HTMLSpanElement;
15
+ floatingRef: HTMLDivElement;
16
+ };
17
+ rootEl: any;
18
+ };
19
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
20
+ declare const __VLS_component: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
21
+ "update:open": (value: boolean) => any;
22
+ }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
23
+ "onUpdate:open"?: ((value: boolean) => any) | undefined;
24
+ }>, {
25
+ ariaLabel: string;
26
+ offset: import('./types').UiFloatActionsOffset;
27
+ placement: import('./types').UiFloatActionsPlacement;
28
+ trigger: import('./types').UiFloatActionsTrigger;
29
+ openDelay: number;
30
+ closeDelay: number;
31
+ dismissOnOutsideClick: boolean;
32
+ dismissOnEscape: boolean;
33
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
34
+ referenceRef: HTMLSpanElement;
35
+ floatingRef: HTMLDivElement;
36
+ }, any>;
37
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
38
+ export default _default;
39
+ type __VLS_WithTemplateSlots<T, S> = T & {
40
+ new (): {
41
+ $slots: S;
42
+ };
43
+ };
@@ -0,0 +1,16 @@
1
+ import { InjectionKey, Ref } from 'vue';
2
+ /** Shared toolbar state used to coordinate roving-tabindex focus across items. */
3
+ export interface FloatActionItemContext {
4
+ /** Registers a focusable item so the toolbar can manage roving tabindex. */
5
+ registerItem: (id: symbol) => void;
6
+ /** Removes an item from roving-tabindex tracking. */
7
+ unregisterItem: (id: symbol) => void;
8
+ /** Marks an item as the active (tabbable) one when it receives focus. */
9
+ onItemFocus: (id: symbol) => void;
10
+ /** Resolves the roving tabindex (0 for active item, -1 otherwise). */
11
+ getTabIndex: (id: symbol) => number;
12
+ /** Keyboard navigation direction for the toolbar. */
13
+ orientation: Ref<'horizontal' | 'vertical'>;
14
+ }
15
+ export declare const FLOAT_ACTION_ITEM_CONTEXT: InjectionKey<FloatActionItemContext>;
16
+ export declare const FLOAT_ACTION_ITEM_SELECTOR = "[data-slot=\"float-item-action\"]";
@@ -0,0 +1,3 @@
1
+ export { default as UiFloatActions } from './UiFloatActions.vue';
2
+ export { default as UiFloatActionItems } from './UiFloatActionItems.vue';
3
+ export * from './types';
@@ -0,0 +1,127 @@
1
+ import { Placement } from '@floating-ui/vue';
2
+ import { HTMLAttributes } from 'vue';
3
+ import { AnchorFloatOffset, AnchorFloatTrigger } from '../../lib/useAnchorFloat';
4
+ export type UiFloatActionsTrigger = AnchorFloatTrigger;
5
+ export type UiFloatActionsPlacement = Placement;
6
+ export type UiFloatActionsOffset = number | AnchorFloatOffset;
7
+ /**
8
+ * Anchors floating action content to a trigger element on hover, focus, or click.
9
+ * Use for contextual toolbars, quick actions, and inline controls.
10
+ * For rich panels or forms, prefer `UiPopover`.
11
+ *
12
+ * This component is currently experimental. Its API and behavior may still change
13
+ * before it is considered stable.
14
+ * @category Overlays
15
+ * @useCases contextual toolbar, inline actions, hover controls, keyboard toolbar
16
+ * @keywords float, anchor, floating, toolbar, hover, focus, contextual, experimental
17
+ * @related UiFloatActionItems, UiPopover, UiTooltip, useAnchorFloat
18
+ */
19
+ export interface UiFloatActionsProps {
20
+ /**
21
+ * How the floating panel opens.
22
+ * - `hover` — pointer hover and keyboard focus on a focusable `button` anchor
23
+ * - `focus` — keyboard focus on the `button` anchor
24
+ * - `click` — click or Enter/Space on the `button` anchor
25
+ * - `manual` — controlled via `v-model:open`
26
+ * @default 'hover'
27
+ */
28
+ trigger?: UiFloatActionsTrigger;
29
+ /**
30
+ * Preferred placement relative to the anchor element.
31
+ * Auto-flips when there is not enough room.
32
+ * @default 'top'
33
+ */
34
+ placement?: UiFloatActionsPlacement;
35
+ /**
36
+ * Distance from the anchor element, in pixels.
37
+ * Pass an object to set main-axis and cross-axis offsets independently.
38
+ * @default 8
39
+ */
40
+ offset?: UiFloatActionsOffset;
41
+ /**
42
+ * The controlled open state of the floating panel.
43
+ * - Omit for uncontrolled mode (component manages state internally)
44
+ * - Use `v-model:open` for controlled mode
45
+ * @example
46
+ * ```vue
47
+ * <UiFloatActions v-model:open="isOpen">…</UiFloatActions>
48
+ * ```
49
+ */
50
+ open?: boolean;
51
+ /**
52
+ * Delay in ms before opening on pointer hover.
53
+ * Keyboard focus opens immediately regardless of this value.
54
+ * @default 150
55
+ */
56
+ openDelay?: number;
57
+ /**
58
+ * Delay in ms before closing on pointer leave.
59
+ * @default 150
60
+ */
61
+ closeDelay?: number;
62
+ /**
63
+ * Close when clicking outside the anchor and floating panel.
64
+ * @default true
65
+ */
66
+ dismissOnOutsideClick?: boolean;
67
+ /**
68
+ * Close when Escape is pressed and restore focus to the anchor.
69
+ * @default true
70
+ */
71
+ dismissOnEscape?: boolean;
72
+ /**
73
+ * Accessible label for the anchor when it has no visible text.
74
+ * **Required** for triggers without readable anchor content when keyboard
75
+ * users need a concise name (e.g. icon-only or non-descriptive anchors).
76
+ */
77
+ ariaLabel?: string;
78
+ }
79
+ /** Item role within a {@link UiFloatActionItems} toolbar. */
80
+ export type UiFloatActionItemsType = 'toolbar' | 'button' | 'input' | 'text' | 'group' | 'separator';
81
+ /** Arrow-key navigation direction for toolbar roving focus. */
82
+ export type UiFloatActionItemsOrientation = 'horizontal' | 'vertical';
83
+ /**
84
+ * Pill-shaped floating toolbar and its action items.
85
+ *
86
+ * Use the root item (`type="toolbar"`) as the container and nest child items
87
+ * for buttons, inputs, text labels, groups, and separators. Implements the
88
+ * WAI-ARIA APG toolbar pattern with roving tabindex.
89
+ *
90
+ * @category Overlays
91
+ * @useCases contextual toolbar, inline actions, pagination controls, filter bar
92
+ * @keywords float, toolbar, pill, actions, keyboard, roving focus
93
+ * @related UiFloatActions, useAnchorFloat
94
+ */
95
+ export interface UiFloatActionItemsProps {
96
+ /**
97
+ * Item role within the floating toolbar.
98
+ * Omit or use `toolbar` for the root pill container.
99
+ * @default 'toolbar'
100
+ */
101
+ type?: UiFloatActionItemsType;
102
+ /**
103
+ * Disables interaction for `button` and `input` items.
104
+ * @default false
105
+ */
106
+ disabled?: boolean;
107
+ /**
108
+ * Accessible label for `toolbar`, `button`, and `input` items.
109
+ * **Required** for those types — icon-only buttons have no visible text.
110
+ */
111
+ ariaLabel?: string;
112
+ /**
113
+ * Keyboard navigation direction for toolbar items (ArrowLeft/Right or Up/Down).
114
+ * @default 'horizontal'
115
+ */
116
+ orientation?: UiFloatActionItemsOrientation;
117
+ /**
118
+ * Placeholder text for `input` items.
119
+ */
120
+ placeholder?: string;
121
+ }
122
+ /** Events emitted by {@link UiFloatActionItems} button items. */
123
+ export interface UiFloatActionItemsEmits {
124
+ /** Emitted when a `button` item is activated. */
125
+ click: [event: MouseEvent];
126
+ }
127
+ export type UiFloatActionItemsClass = HTMLAttributes['class'];
@@ -5,5 +5,6 @@
5
5
  export * from './UiDataTable';
6
6
  export * from './UiDatePicker';
7
7
  export * from './UiFileUpload';
8
+ export * from './UiFloatActions';
8
9
  export * from './UiPlaceholder';
9
10
  export * from './UiSidebar';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aleph-alpha/ui-library",
3
- "version": "5.1.0",
3
+ "version": "5.3.0",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "main": "dist/system/lib.js",
@@ -118,6 +118,15 @@
118
118
  "vue-sonner": "^2.0.9",
119
119
  "@aleph-alpha/config-unocss": "0.2.0"
120
120
  },
121
+ "jest-junit": {
122
+ "outputDirectory": "reports/storybook",
123
+ "outputName": "junit.xml",
124
+ "ancestorSeparator": " › ",
125
+ "uniqueOutputName": "false",
126
+ "suiteNameTemplate": "{filepath}",
127
+ "classNameTemplate": "{classname}",
128
+ "titleTemplate": "{title}"
129
+ },
121
130
  "scripts": {
122
131
  "build": "node scripts/prepare-build.cjs && vite build",
123
132
  "ci": "pnpm install --immutable --immutable-cache --check-cache",
@@ -128,8 +137,8 @@
128
137
  "lint": "eslint 'src/**/*.{js,vue,ts}' --cache",
129
138
  "test": "vitest --run --project=unit",
130
139
  "test:watch": "vitest --project=unit",
131
- "test:storybook": "pnpm concurrently -k --ks SIGKILL -s command-test -n \"storybook,test\" \"pnpm http-server ../../dist/storybook/ui-library --port 4400 --silent\" \"wait-on tcp:4400 && test-storybook --url http://127.0.0.1:4400\"",
132
- "test:storybook:local": "pnpm build-storybook && pnpm concurrently -k --ks SIGKILL -s command-test -n \"storybook,test\" \"pnpm http-server storybook-static --port 4400 --silent\" \"wait-on tcp:4400 && test-storybook --url http://127.0.0.1:4400\"",
140
+ "test:storybook": "pnpm concurrently -k --ks SIGKILL -s command-test -n \"storybook,test\" \"pnpm http-server ../../dist/storybook/ui-library --port 4400 --silent\" \"wait-on tcp:4400 && test-storybook --url http://127.0.0.1:4400 --junit\"",
141
+ "test:storybook:local": "pnpm build-storybook && pnpm concurrently -k --ks SIGKILL -s command-test -n \"storybook,test\" \"pnpm http-server storybook-static --port 4400 --silent\" \"wait-on tcp:4400 && test-storybook --url http://127.0.0.1:4400 --junit\"",
133
142
  "test:all": "vitest --run",
134
143
  "storybook": "storybook dev -p 6006",
135
144
  "build-storybook": "storybook build",