@aleph-alpha/ui-library 5.2.0 → 5.3.1
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/components/UiTooltip/UiTooltip.vue.d.ts +1 -0
- package/dist/system/components/UiTooltip/types.d.ts +8 -0
- package/dist/system/components/core/tooltip/TooltipContent.vue.d.ts +2 -0
- package/dist/system/index.d.ts +1 -0
- package/dist/system/lib/useAnchorFloat.d.ts +143 -0
- package/dist/system/lib.js +18787 -18280
- package/dist/system/patterns/UiFloatActions/UiFloatActionItems.vue.d.ts +35 -0
- package/dist/system/patterns/UiFloatActions/UiFloatActions.vue.d.ts +45 -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/docs/public-docs/quick-start.md +43 -0
- package/package.json +1 -1
- package/src/components/UiAccordion/UiAccordion.stories.ts +2 -2
- package/src/components/UiAutocomplete/UiAutocomplete.stories.ts +2 -2
- package/src/components/UiAutocomplete/UiAutocomplete.vue +3 -3
- package/src/components/UiBadge/UiBadge.stories.ts +9 -9
- package/src/components/UiDropdownMenu/UiDropdownMenu.stories.ts +4 -4
- package/src/components/UiField/UiField.stories.ts +6 -6
- package/src/components/UiInput/UiInput.vue +1 -1
- package/src/components/UiKbd/UiKbd.stories.ts +3 -3
- package/src/components/UiKbd/UiKbd.vue +1 -1
- package/src/components/UiNavigationMenu/UiNavigationMenu.stories.ts +28 -28
- package/src/components/UiPopover/UiPopover.stories.ts +20 -20
- package/src/components/UiRadioGroup/UiRadioGroup.stories.ts +24 -24
- package/src/components/UiResizable/UiResizable.stories.ts +14 -14
- package/src/components/UiSelect/UiSelect.stories.ts +1 -1
- package/src/components/UiSheet/UiSheet.stories.ts +14 -14
- package/src/components/UiSlider/UiSlider.stories.ts +8 -8
- package/src/components/UiSpinner/UiSpinner.stories.ts +8 -8
- package/src/components/UiSwitch/UiSwitch.stories.ts +4 -4
- package/src/components/UiTabs/UiTabs.stories.ts +46 -46
- package/src/components/UiToggleGroup/UiToggleGroup.stories.ts +14 -14
- package/src/components/UiTooltip/UiTooltip.vue +2 -0
- package/src/components/UiTooltip/types.ts +9 -0
- package/src/components/core/accordion/AccordionContent.vue +1 -1
- package/src/components/core/accordion/AccordionTrigger.vue +1 -1
- package/src/components/core/alert/AlertDescription.vue +1 -1
- package/src/components/core/alert/index.ts +1 -1
- package/src/components/core/calendar/Calendar.vue +4 -4
- package/src/components/core/calendar/CalendarCell.vue +1 -1
- package/src/components/core/drawer/DrawerDescription.vue +1 -1
- package/src/components/core/dropdown-menu/DropdownMenuCheckboxItem.vue +1 -1
- package/src/components/core/dropdown-menu/DropdownMenuItem.vue +1 -1
- package/src/components/core/dropdown-menu/DropdownMenuLabel.vue +1 -3
- package/src/components/core/dropdown-menu/DropdownMenuRadioItem.vue +1 -1
- package/src/components/core/dropdown-menu/DropdownMenuShortcut.vue +4 -1
- package/src/components/core/dropdown-menu/DropdownMenuSubTrigger.vue +1 -1
- package/src/components/core/field/FieldDescription.vue +1 -1
- package/src/components/core/field/FieldLegend.vue +2 -2
- package/src/components/core/field/FieldSeparator.vue +1 -1
- package/src/components/core/input/Input.vue +1 -1
- package/src/components/core/item/index.ts +1 -1
- package/src/components/core/label/Label.vue +1 -1
- package/src/components/core/listbox/ListboxFilter.vue +1 -1
- package/src/components/core/listbox/ListboxGroupLabel.vue +1 -1
- package/src/components/core/listbox/ListboxItem.vue +1 -1
- package/src/components/core/native-select/NativeSelect.vue +1 -1
- package/src/components/core/navigation-menu/NavigationMenuLink.vue +1 -1
- package/src/components/core/navigation-menu/index.ts +1 -1
- package/src/components/core/range-calendar/RangeCalendarCell.vue +1 -1
- package/src/components/core/select/SelectItem.vue +1 -1
- package/src/components/core/select/SelectLabel.vue +3 -1
- package/src/components/core/select/SelectTrigger.vue +1 -1
- package/src/components/core/sidebar/SidebarGroupContent.vue +1 -1
- package/src/components/core/sidebar/SidebarGroupLabel.vue +1 -1
- package/src/components/core/sidebar/SidebarMenuBadge.vue +1 -1
- package/src/components/core/sidebar/SidebarMenuSubButton.vue +2 -2
- package/src/components/core/sidebar/index.ts +4 -4
- package/src/components/core/slider/Slider.vue +3 -3
- package/src/components/core/stepper/StepperDescription.vue +1 -1
- package/src/components/core/table/Table.vue +1 -1
- package/src/components/core/table/TableEmpty.vue +1 -1
- package/src/components/core/tabs/TabsTrigger.vue +1 -1
- package/src/components/core/tags-input/TagsInput.vue +1 -1
- package/src/components/core/tags-input/TagsInputItem.vue +1 -1
- package/src/components/core/textarea/Textarea.vue +1 -1
- package/src/components/core/toggle/index.ts +1 -1
- package/src/components/core/toggle-group/index.ts +1 -1
- package/src/components/core/tooltip/TooltipContent.vue +10 -4
- package/src/index.ts +1 -0
- package/src/lib/useAnchorFloat.test.ts +166 -0
- package/src/lib/useAnchorFloat.ts +437 -0
- package/src/lib/useDrag.stories.ts +12 -12
- package/src/patterns/UiDatePicker/UiDatePicker.stories.ts +8 -8
- package/src/patterns/UiFloatActions/UiFloatActionItems.vue +327 -0
- package/src/patterns/UiFloatActions/UiFloatActions.stories.ts +900 -0
- package/src/patterns/UiFloatActions/UiFloatActions.vue +224 -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/UiSidebar/UiSidebarGroupLabel.stories.ts +2 -2
- package/src/patterns/UiSidebar/UiSidebarMenuButton.stories.ts +3 -3
- 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'];
|
|
@@ -112,7 +112,7 @@ const renderStory = (args: Story['args']) => ({
|
|
|
112
112
|
Projects
|
|
113
113
|
</UiSidebarGroupLabel>
|
|
114
114
|
<UiSidebarGroupContent v-if="open">
|
|
115
|
-
<div class="px-2 py-2
|
|
115
|
+
<div class="px-2 py-2 body-14-regular text-content-on-surface-muted">Group content</div>
|
|
116
116
|
</UiSidebarGroupContent>
|
|
117
117
|
</UiSidebarGroup>
|
|
118
118
|
</UiSidebarContent>
|
|
@@ -179,7 +179,7 @@ export const CustomIcons: Story = {
|
|
|
179
179
|
Projects
|
|
180
180
|
</UiSidebarGroupLabel>
|
|
181
181
|
<UiSidebarGroupContent v-if="open">
|
|
182
|
-
<div class="px-2 py-2
|
|
182
|
+
<div class="px-2 py-2 body-14-regular text-content-on-surface-muted">Group content</div>
|
|
183
183
|
</UiSidebarGroupContent>
|
|
184
184
|
</UiSidebarGroup>
|
|
185
185
|
</UiSidebarContent>
|
|
@@ -128,7 +128,7 @@ const renderMode = (mode: MenuButtonStoryConfig) => ({
|
|
|
128
128
|
<template v-if="mode.endIcon || mode.badge" #end-icon>
|
|
129
129
|
<span
|
|
130
130
|
v-if="mode.badge"
|
|
131
|
-
class="min-w-6 rounded-sm bg-background-surface-muted px-1.5 py-0.5 text-center
|
|
131
|
+
class="min-w-6 rounded-sm bg-background-surface-muted px-1.5 py-0.5 text-center label-12-regular text-content-on-surface-primary"
|
|
132
132
|
>
|
|
133
133
|
{{ mode.badge }}
|
|
134
134
|
</span>
|
|
@@ -166,7 +166,7 @@ const renderMode = (mode: MenuButtonStoryConfig) => ({
|
|
|
166
166
|
<template v-if="mode.endIcon || mode.badge" #end-icon>
|
|
167
167
|
<span
|
|
168
168
|
v-if="mode.badge"
|
|
169
|
-
class="min-w-6 rounded-sm bg-background-surface-muted px-1.5 py-0.5 text-center
|
|
169
|
+
class="min-w-6 rounded-sm bg-background-surface-muted px-1.5 py-0.5 text-center label-12-regular text-content-on-surface-primary"
|
|
170
170
|
>
|
|
171
171
|
{{ mode.badge }}
|
|
172
172
|
</span>
|
|
@@ -178,7 +178,7 @@ const renderMode = (mode: MenuButtonStoryConfig) => ({
|
|
|
178
178
|
</UiSidebarContent>
|
|
179
179
|
</UiSidebar>
|
|
180
180
|
</UiSidebarProvider>
|
|
181
|
-
<p v-if="mode.endIconClickable" class="mt-3
|
|
181
|
+
<p v-if="mode.endIconClickable" class="mt-3 label-12-regular text-content-on-surface-muted">
|
|
182
182
|
End icon clicks: {{ actionCount }}
|
|
183
183
|
</p>
|
|
184
184
|
</div>
|