@aleph-alpha/ui-library 5.2.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.
- package/dist/system/index.d.ts +1 -0
- package/dist/system/lib/useAnchorFloat.d.ts +143 -0
- package/dist/system/lib.js +19412 -18916
- package/dist/system/patterns/UiFloatActions/UiFloatActionItems.vue.d.ts +35 -0
- package/dist/system/patterns/UiFloatActions/UiFloatActions.vue.d.ts +43 -0
- package/dist/system/patterns/UiFloatActions/floatActionItemContext.d.ts +16 -0
- package/dist/system/patterns/UiFloatActions/index.d.ts +3 -0
- package/dist/system/patterns/UiFloatActions/types.d.ts +127 -0
- package/dist/system/patterns/index.d.ts +1 -0
- package/package.json +1 -1
- package/src/index.ts +1 -0
- package/src/lib/useAnchorFloat.test.ts +166 -0
- package/src/lib/useAnchorFloat.ts +437 -0
- package/src/patterns/UiFloatActions/UiFloatActionItems.vue +321 -0
- package/src/patterns/UiFloatActions/UiFloatActions.stories.ts +767 -0
- package/src/patterns/UiFloatActions/UiFloatActions.vue +220 -0
- package/src/patterns/UiFloatActions/__tests__/UiFloatActionItems.test.ts +104 -0
- package/src/patterns/UiFloatActions/__tests__/UiFloatActions.a11y.test.ts +152 -0
- package/src/patterns/UiFloatActions/__tests__/UiFloatActions.test.ts +86 -0
- package/src/patterns/UiFloatActions/floatActionItemContext.ts +20 -0
- package/src/patterns/UiFloatActions/index.ts +3 -0
- package/src/patterns/UiFloatActions/types.ts +155 -0
- package/src/patterns/index.ts +1 -0
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import type { Placement } from '@floating-ui/vue';
|
|
2
|
+
import type { HTMLAttributes } from 'vue';
|
|
3
|
+
import type {
|
|
4
|
+
AnchorFloatOffset,
|
|
5
|
+
AnchorFloatTrigger,
|
|
6
|
+
} from '@/lib/useAnchorFloat';
|
|
7
|
+
|
|
8
|
+
export type UiFloatActionsTrigger = AnchorFloatTrigger;
|
|
9
|
+
export type UiFloatActionsPlacement = Placement;
|
|
10
|
+
export type UiFloatActionsOffset = number | AnchorFloatOffset;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Anchors floating action content to a trigger element on hover, focus, or click.
|
|
14
|
+
* Use for contextual toolbars, quick actions, and inline controls.
|
|
15
|
+
* For rich panels or forms, prefer `UiPopover`.
|
|
16
|
+
*
|
|
17
|
+
* This component is currently experimental. Its API and behavior may still change
|
|
18
|
+
* before it is considered stable.
|
|
19
|
+
* @category Overlays
|
|
20
|
+
* @useCases contextual toolbar, inline actions, hover controls, keyboard toolbar
|
|
21
|
+
* @keywords float, anchor, floating, toolbar, hover, focus, contextual, experimental
|
|
22
|
+
* @related UiFloatActionItems, UiPopover, UiTooltip, useAnchorFloat
|
|
23
|
+
*/
|
|
24
|
+
export interface UiFloatActionsProps {
|
|
25
|
+
/**
|
|
26
|
+
* How the floating panel opens.
|
|
27
|
+
* - `hover` — pointer hover and keyboard focus on a focusable `button` anchor
|
|
28
|
+
* - `focus` — keyboard focus on the `button` anchor
|
|
29
|
+
* - `click` — click or Enter/Space on the `button` anchor
|
|
30
|
+
* - `manual` — controlled via `v-model:open`
|
|
31
|
+
* @default 'hover'
|
|
32
|
+
*/
|
|
33
|
+
trigger?: UiFloatActionsTrigger;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Preferred placement relative to the anchor element.
|
|
37
|
+
* Auto-flips when there is not enough room.
|
|
38
|
+
* @default 'top'
|
|
39
|
+
*/
|
|
40
|
+
placement?: UiFloatActionsPlacement;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Distance from the anchor element, in pixels.
|
|
44
|
+
* Pass an object to set main-axis and cross-axis offsets independently.
|
|
45
|
+
* @default 8
|
|
46
|
+
*/
|
|
47
|
+
offset?: UiFloatActionsOffset;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* The controlled open state of the floating panel.
|
|
51
|
+
* - Omit for uncontrolled mode (component manages state internally)
|
|
52
|
+
* - Use `v-model:open` for controlled mode
|
|
53
|
+
* @example
|
|
54
|
+
* ```vue
|
|
55
|
+
* <UiFloatActions v-model:open="isOpen">…</UiFloatActions>
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
open?: boolean;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Delay in ms before opening on pointer hover.
|
|
62
|
+
* Keyboard focus opens immediately regardless of this value.
|
|
63
|
+
* @default 150
|
|
64
|
+
*/
|
|
65
|
+
openDelay?: number;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Delay in ms before closing on pointer leave.
|
|
69
|
+
* @default 150
|
|
70
|
+
*/
|
|
71
|
+
closeDelay?: number;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Close when clicking outside the anchor and floating panel.
|
|
75
|
+
* @default true
|
|
76
|
+
*/
|
|
77
|
+
dismissOnOutsideClick?: boolean;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Close when Escape is pressed and restore focus to the anchor.
|
|
81
|
+
* @default true
|
|
82
|
+
*/
|
|
83
|
+
dismissOnEscape?: boolean;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Accessible label for the anchor when it has no visible text.
|
|
87
|
+
* **Required** for triggers without readable anchor content when keyboard
|
|
88
|
+
* users need a concise name (e.g. icon-only or non-descriptive anchors).
|
|
89
|
+
*/
|
|
90
|
+
ariaLabel?: string;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** Item role within a {@link UiFloatActionItems} toolbar. */
|
|
94
|
+
export type UiFloatActionItemsType =
|
|
95
|
+
| 'toolbar'
|
|
96
|
+
| 'button'
|
|
97
|
+
| 'input'
|
|
98
|
+
| 'text'
|
|
99
|
+
| 'group'
|
|
100
|
+
| 'separator';
|
|
101
|
+
|
|
102
|
+
/** Arrow-key navigation direction for toolbar roving focus. */
|
|
103
|
+
export type UiFloatActionItemsOrientation = 'horizontal' | 'vertical';
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Pill-shaped floating toolbar and its action items.
|
|
107
|
+
*
|
|
108
|
+
* Use the root item (`type="toolbar"`) as the container and nest child items
|
|
109
|
+
* for buttons, inputs, text labels, groups, and separators. Implements the
|
|
110
|
+
* WAI-ARIA APG toolbar pattern with roving tabindex.
|
|
111
|
+
*
|
|
112
|
+
* @category Overlays
|
|
113
|
+
* @useCases contextual toolbar, inline actions, pagination controls, filter bar
|
|
114
|
+
* @keywords float, toolbar, pill, actions, keyboard, roving focus
|
|
115
|
+
* @related UiFloatActions, useAnchorFloat
|
|
116
|
+
*/
|
|
117
|
+
export interface UiFloatActionItemsProps {
|
|
118
|
+
/**
|
|
119
|
+
* Item role within the floating toolbar.
|
|
120
|
+
* Omit or use `toolbar` for the root pill container.
|
|
121
|
+
* @default 'toolbar'
|
|
122
|
+
*/
|
|
123
|
+
type?: UiFloatActionItemsType;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Disables interaction for `button` and `input` items.
|
|
127
|
+
* @default false
|
|
128
|
+
*/
|
|
129
|
+
disabled?: boolean;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Accessible label for `toolbar`, `button`, and `input` items.
|
|
133
|
+
* **Required** for those types — icon-only buttons have no visible text.
|
|
134
|
+
*/
|
|
135
|
+
ariaLabel?: string;
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Keyboard navigation direction for toolbar items (ArrowLeft/Right or Up/Down).
|
|
139
|
+
* @default 'horizontal'
|
|
140
|
+
*/
|
|
141
|
+
orientation?: UiFloatActionItemsOrientation;
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Placeholder text for `input` items.
|
|
145
|
+
*/
|
|
146
|
+
placeholder?: string;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/** Events emitted by {@link UiFloatActionItems} button items. */
|
|
150
|
+
export interface UiFloatActionItemsEmits {
|
|
151
|
+
/** Emitted when a `button` item is activated. */
|
|
152
|
+
click: [event: MouseEvent];
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export type UiFloatActionItemsClass = HTMLAttributes['class'];
|