@aleph-alpha/ui-library 5.3.1 → 5.4.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 (90) hide show
  1. package/config.d.ts +29 -3
  2. package/config.js +91 -3
  3. package/dist/system/lib.js +5246 -5152
  4. package/dist/system/patterns/UiDataTable/UiDataTableFilterMenu.vue.d.ts +24 -0
  5. package/dist/system/patterns/UiDataTable/constants.d.ts +10 -0
  6. package/dist/system/patterns/UiDataTable/index.d.ts +1 -0
  7. package/dist/system/patterns/UiDataTable/types.d.ts +23 -1
  8. package/docs/public-docs/getting-started-designers.md +3 -1
  9. package/package.json +1 -1
  10. package/src/components/UiAutocomplete/UiAutocomplete.stories.ts +1 -1
  11. package/src/components/UiAutocomplete/UiAutocomplete.vue +5 -5
  12. package/src/components/UiButton/UiButton.stories.ts +5 -5
  13. package/src/components/UiCheckbox/UiCheckbox.stories.ts +7 -9
  14. package/src/components/UiChip/UiChip.vue +1 -1
  15. package/src/components/UiDrawer/UiDrawer.stories.ts +2 -2
  16. package/src/components/UiDropdownMenu/UiDropdownMenu.stories.ts +4 -4
  17. package/src/components/UiEmpty/UiEmpty.vue +2 -2
  18. package/src/components/UiField/UiField.stories.ts +2 -2
  19. package/src/components/UiField/UiFieldLabelInfo.vue +1 -1
  20. package/src/components/UiFileUploadBox/UiFileUploadBox.stories.ts +2 -2
  21. package/src/components/UiFileUploadBox/UiFileUploadBox.vue +2 -2
  22. package/src/components/UiInput/UiInput.vue +3 -3
  23. package/src/components/UiKbd/UiKbd.stories.ts +14 -14
  24. package/src/components/UiNavigationMenu/UiNavigationMenu.stories.ts +42 -42
  25. package/src/components/UiPopover/UiPopover.stories.ts +6 -6
  26. package/src/components/UiRadioGroup/UiRadioGroup.stories.ts +2 -2
  27. package/src/components/UiResizable/UiResizable.stories.ts +6 -5
  28. package/src/components/UiSeparator/UiSeparator.stories.ts +6 -6
  29. package/src/components/UiSheet/UiSheet.stories.ts +2 -2
  30. package/src/components/UiSlider/UiSlider.stories.ts +8 -8
  31. package/src/components/UiSpinner/UiSpinner.stories.ts +8 -8
  32. package/src/components/UiSwitch/UiSwitch.stories.ts +2 -2
  33. package/src/components/UiTabs/UiTabs.stories.ts +30 -30
  34. package/src/components/UiToggle/__tests__/UiToggle.test.ts +5 -3
  35. package/src/components/UiToggleGroup/UiToggleGroup.stories.ts +9 -9
  36. package/src/components/UiTooltip/UiTooltip.stories.ts +3 -3
  37. package/src/components/core/accordion/AccordionTrigger.vue +2 -2
  38. package/src/components/core/alert/AlertDescription.vue +1 -1
  39. package/src/components/core/badge/index.ts +1 -1
  40. package/src/components/core/button/index.ts +2 -2
  41. package/src/components/core/calendar/CalendarCellTrigger.vue +2 -2
  42. package/src/components/core/calendar/CalendarHeadCell.vue +1 -1
  43. package/src/components/core/card/CardDescription.vue +1 -1
  44. package/src/components/core/checkbox/Checkbox.vue +1 -1
  45. package/src/components/core/drawer/DrawerDescription.vue +1 -1
  46. package/src/components/core/dropdown-menu/DropdownMenuItem.vue +1 -1
  47. package/src/components/core/dropdown-menu/DropdownMenuShortcut.vue +1 -1
  48. package/src/components/core/field/FieldDescription.vue +1 -1
  49. package/src/components/core/field/FieldLabel.vue +1 -1
  50. package/src/components/core/field/FieldSeparator.vue +1 -1
  51. package/src/components/core/input/Input.vue +2 -2
  52. package/src/components/core/item/index.ts +1 -1
  53. package/src/components/core/kbd/Kbd.vue +1 -1
  54. package/src/components/core/listbox/ListboxFilter.vue +1 -1
  55. package/src/components/core/listbox/ListboxGroupLabel.vue +4 -1
  56. package/src/components/core/listbox/ListboxItem.vue +1 -1
  57. package/src/components/core/native-select/NativeSelect.vue +3 -3
  58. package/src/components/core/navigation-menu/NavigationMenuLink.vue +1 -1
  59. package/src/components/core/navigation-menu/index.ts +1 -1
  60. package/src/components/core/radio-group/RadioGroupItem.vue +1 -1
  61. package/src/components/core/range-calendar/RangeCalendarCellTrigger.vue +2 -2
  62. package/src/components/core/range-calendar/RangeCalendarHeadCell.vue +1 -1
  63. package/src/components/core/select/SelectItem.vue +1 -1
  64. package/src/components/core/select/SelectLabel.vue +4 -1
  65. package/src/components/core/select/SelectTrigger.vue +1 -1
  66. package/src/components/core/sheet/SheetDescription.vue +3 -1
  67. package/src/components/core/switch/Switch.vue +1 -1
  68. package/src/components/core/table/TableCaption.vue +3 -1
  69. package/src/components/core/tabs/TabsList.vue +1 -1
  70. package/src/components/core/tabs/TabsTrigger.vue +1 -1
  71. package/src/components/core/tags-input/TagsInput.vue +1 -1
  72. package/src/components/core/tags-input/TagsInputInput.vue +1 -1
  73. package/src/components/core/tags-input/TagsInputItemDelete.vue +1 -1
  74. package/src/components/core/textarea/Textarea.vue +1 -1
  75. package/src/components/core/toggle/index.ts +3 -3
  76. package/src/components/core/toggle-group/index.ts +2 -2
  77. package/src/lib/useDrag.stories.ts +8 -8
  78. package/src/patterns/UiDataTable/UiDataTable.stories.ts +420 -10
  79. package/src/patterns/UiDataTable/UiDataTableColumnFilter.vue +1 -1
  80. package/src/patterns/UiDataTable/UiDataTableFilterMenu.vue +91 -0
  81. package/src/patterns/UiDataTable/UiDataTablePagination.vue +1 -1
  82. package/src/patterns/UiDataTable/constants.ts +12 -0
  83. package/src/patterns/UiDataTable/index.ts +1 -0
  84. package/src/patterns/UiDataTable/types.ts +24 -0
  85. package/src/patterns/UiDatePicker/UiDatePicker.stories.ts +4 -4
  86. package/src/patterns/UiDatePicker/UiDatePicker.vue +1 -1
  87. package/src/patterns/UiFloatActions/UiFloatActionItems.vue +4 -3
  88. package/src/patterns/UiFloatActions/UiFloatActions.stories.ts +353 -447
  89. package/src/patterns/UiFloatActions/UiFloatActions.vue +1 -1
  90. package/src/patterns/UiSidebar/UiSidebarMenuButton.stories.ts +2 -2
@@ -1,9 +1,10 @@
1
1
  import type { Meta, StoryObj } from '@storybook/vue3-vite';
2
- import { ref, useId, watch } from 'vue';
2
+ import { ref, useId } from 'vue';
3
3
  import UiFloatActions from './UiFloatActions.vue';
4
4
  import { UiFloatActionItems } from './index';
5
5
  import { UiIcon } from '../../components/UiIcon';
6
6
  import { UiTooltip } from '../../components/UiTooltip';
7
+ import { UiSwitch } from '../../components/UiSwitch';
7
8
  import { useAnchorFloat } from '../../lib/useAnchorFloat';
8
9
  import type { UiFloatActionsPlacement, UiFloatActionsTrigger } from './types';
9
10
 
@@ -89,213 +90,181 @@ const meta = {
89
90
  export default meta;
90
91
  type Story = StoryObj<typeof meta>;
91
92
 
92
- type FloatRenderConfig = {
93
- helperText?: string;
94
- anchorText?: string;
95
- anchorClass?: string;
96
- useCardAnchor?: boolean;
97
- showPagination?: boolean;
98
- };
99
-
100
- function createFloatRender(config: FloatRenderConfig = {}) {
101
- const {
102
- helperText,
103
- anchorText = 'Hover or Tab to this paragraph to reveal contextual actions.',
104
- anchorClass = 'max-w-sm rounded-md border border-border-surface-default bg-background-surface-primary px-4 py-6 body-14-regular leading-6',
105
- useCardAnchor = false,
106
- showPagination = false,
107
- } = config;
108
-
109
- return (args: Story['args']) => ({
110
- components: { UiFloatActions, UiFloatActionItems, UiIcon },
93
+ /**
94
+ * Trigger modes: `hover`, `click`, `focus`, and `manual`.
95
+ * Each anchor renders as a focusable button, so keyboard users get the same
96
+ * `ui-focus-ring` treatment (matching UiButton: focus-ring border + 3px ring) as
97
+ * the rest of the library. Tab to any anchor to see the shared focus style.
98
+ */
99
+ export const ShowModes: Story = {
100
+ name: 'Show modes',
101
+ render: () => ({
102
+ components: { UiFloatActions, UiFloatActionItems, UiIcon, UiSwitch },
111
103
  setup() {
112
- const open = ref(args?.open ?? false);
113
- const page = ref(2);
114
- const total = ref(2);
115
-
116
- watch(
117
- () => args?.open,
118
- (value) => {
119
- if (value !== undefined) open.value = value;
104
+ const manualOpen = ref(false);
105
+ const modes = [
106
+ {
107
+ trigger: 'hover' as const,
108
+ label: 'Hover',
109
+ hint: 'Point at or Tab to the anchor',
110
+ icon: 'edit',
120
111
  },
121
- );
122
-
123
- function previousPage() {
124
- page.value = Math.max(1, page.value - 1);
125
- }
126
-
127
- function nextPage() {
128
- page.value = Math.min(total.value, page.value + 1);
129
- }
130
-
131
- return {
132
- args,
133
- open,
134
- page,
135
- total,
136
- previousPage,
137
- nextPage,
138
- helperText,
139
- anchorText,
140
- anchorClass,
141
- useCardAnchor,
142
- showPagination,
143
- };
112
+ {
113
+ trigger: 'click' as const,
114
+ label: 'Click',
115
+ hint: 'Click or press Enter / Space',
116
+ icon: 'copy',
117
+ },
118
+ {
119
+ trigger: 'focus' as const,
120
+ label: 'Focus',
121
+ hint: 'Tab to the anchor to reveal',
122
+ icon: 'message-circle',
123
+ },
124
+ {
125
+ trigger: 'manual' as const,
126
+ label: 'Manual',
127
+ hint: 'Controlled via v-model:open',
128
+ icon: 'star',
129
+ },
130
+ ];
131
+ return { modes, manualOpen };
144
132
  },
145
133
  template: `
146
- <div :class="showPagination ? 'mx-auto max-w-2xl space-y-4 p-8' : 'flex min-h-64 flex-col items-center justify-center gap-3 p-8'">
147
- <p v-if="helperText" class="text-muted-foreground max-w-sm body-14-regular">
148
- {{ helperText }}
149
- </p>
150
- <UiFloatActions
151
- v-model:open="open"
152
- :trigger="args.trigger"
153
- :placement="args.placement"
154
- :offset="args.offset"
155
- :open-delay="args.openDelay"
156
- :close-delay="args.closeDelay"
157
- :dismiss-on-outside-click="args.dismissOnOutsideClick"
158
- :dismiss-on-escape="args.dismissOnEscape"
159
- :aria-label="args.ariaLabel"
134
+ <div class="grid min-h-96 grid-cols-1 place-items-center gap-10 p-8 md:grid-cols-2">
135
+ <div
136
+ v-for="mode in modes"
137
+ :key="mode.trigger"
138
+ class="flex flex-col items-center gap-3"
160
139
  >
161
- <template #container>
162
- <article
163
- v-if="useCardAnchor"
164
- class="rounded-lg border border-border-surface-default bg-background-surface-secondary p-4 shadow-lg"
165
- >
166
- <h3 class="label-14-medium">Floating card</h3>
167
- <p class="text-muted-foreground mt-2 body-14-regular">{{ anchorText }}</p>
168
- </article>
169
- <p v-else :class="anchorClass">{{ anchorText }}</p>
170
- </template>
171
- <template #action>
172
- <UiFloatActionItems aria-label="Text actions">
173
- <UiFloatActionItems type="button" aria-label="Edit">
174
- <UiIcon name="edit" size="s" />
175
- </UiFloatActionItems>
176
- <UiFloatActionItems type="button" aria-label="Copy">
177
- <UiIcon name="copy" size="s" />
178
- </UiFloatActionItems>
179
- <UiFloatActionItems v-if="showPagination" type="separator" />
180
- <UiFloatActionItems v-if="showPagination" type="group">
181
- <UiFloatActionItems
182
- type="button"
183
- aria-label="Previous match"
184
- :disabled="page <= 1"
185
- @click="previousPage"
186
- >
187
- <UiIcon name="chevron-left" size="s" />
140
+ <span class="label-14-medium text-content-on-surface-secondary">{{ mode.label }}</span>
141
+ <UiFloatActions
142
+ :trigger="mode.trigger"
143
+ :open="mode.trigger === 'manual' ? manualOpen : undefined"
144
+ placement="top"
145
+ :offset="10"
146
+ :aria-label="mode.label + ' actions'"
147
+ >
148
+ <template #container>
149
+ <span class="rounded-md border border-border-surface-default bg-background-surface-primary px-4 py-2 body-14-regular">
150
+ {{ mode.hint }}
151
+ </span>
152
+ </template>
153
+ <template #action>
154
+ <UiFloatActionItems :aria-label="mode.label + ' actions'">
155
+ <UiFloatActionItems type="button" :aria-label="mode.label">
156
+ <UiIcon :name="mode.icon" size="s" />
188
157
  </UiFloatActionItems>
189
- <UiFloatActionItems type="text">{{ page }}/{{ total }}</UiFloatActionItems>
190
- <UiFloatActionItems
191
- type="button"
192
- aria-label="Next match"
193
- :disabled="page >= total"
194
- @click="nextPage"
195
- >
196
- <UiIcon name="chevron-right" size="s" />
158
+ <UiFloatActionItems type="button" aria-label="More">
159
+ <UiIcon name="more-vertical" size="s" />
197
160
  </UiFloatActionItems>
198
161
  </UiFloatActionItems>
199
- <template v-if="!showPagination">
200
- <UiFloatActionItems type="button" aria-label="Comment">
201
- <UiIcon name="message-circle" size="s" />
202
- </UiFloatActionItems>
203
- <UiFloatActionItems type="button" aria-label="Delete">
204
- <UiIcon name="trash" size="s" />
205
- </UiFloatActionItems>
206
- </template>
207
- </UiFloatActionItems>
208
- </template>
209
- </UiFloatActions>
162
+ </template>
163
+ </UiFloatActions>
164
+ <label
165
+ v-if="mode.trigger === 'manual'"
166
+ class="flex items-center gap-2 label-14-regular text-content-on-surface-secondary"
167
+ >
168
+ <UiSwitch v-model="manualOpen" name="manual-open" />
169
+ {{ manualOpen ? 'Open' : 'Closed' }}
170
+ </label>
171
+ </div>
210
172
  </div>
211
173
  `,
212
- });
213
- }
174
+ }),
175
+ parameters: {
176
+ controls: { disable: true },
177
+ docs: { canvas: { sourceState: 'none' } },
178
+ },
179
+ };
214
180
 
215
- const flatActionsSource = `<script setup lang="ts">
181
+ const iconOnlyWithTooltipSource = `<script setup lang="ts">
216
182
  import { UiFloatActions, UiFloatActionItems, UiIcon, UiTooltip } from '@aleph-alpha/ui-library';
217
183
  </script>
218
184
 
219
185
  <template>
220
- <UiFloatActions trigger="hover" placement="top" :offset="10">
186
+ <UiFloatActions trigger="hover" placement="top" :offset="10" :open="true">
221
187
  <template #container>
222
- <p>Hover or Tab to this paragraph to reveal contextual actions.</p>
188
+ <p>Hover an icon to reveal its tooltip.</p>
223
189
  </template>
190
+ <!-- Teleport each tooltip into the top-layer panel (:to="panelEl") so it is
191
+ not painted underneath it. Use the tooltip's \`side\` to place it. -->
224
192
  <template #action="{ panelEl }">
225
- <UiFloatActionItems aria-label="Text actions">
226
- <!-- Icon-only buttons: wrap each in a tooltip to name the action.
227
- Teleport the tooltip into the top-layer panel (:to="panelEl") so it
228
- is not painted underneath it. -->
229
- <UiTooltip content="Edit" :to="panelEl">
193
+ <UiFloatActionItems aria-label="Icon actions">
194
+ <UiTooltip content="Top" side="top" :to="panelEl" delayDuration={0}>
230
195
  <UiFloatActionItems type="button" aria-label="Edit">
231
196
  <UiIcon name="edit" size="s" />
232
197
  </UiFloatActionItems>
233
198
  </UiTooltip>
234
- <UiTooltip content="Copy" :to="panelEl">
199
+ <UiTooltip content="Right" side="right" :to="panelEl" delayDuration={0}>
235
200
  <UiFloatActionItems type="button" aria-label="Copy">
236
201
  <UiIcon name="copy" size="s" />
237
202
  </UiFloatActionItems>
238
203
  </UiTooltip>
204
+ <UiTooltip content="Bottom" side="bottom" :to="panelEl" delayDuration={0}>
205
+ <UiFloatActionItems type="button" aria-label="Comment">
206
+ <UiIcon name="message-circle" size="s" />
207
+ </UiFloatActionItems>
208
+ </UiTooltip>
209
+ <UiTooltip content="Left" side="left" :to="panelEl" delayDuration={0}>
210
+ <UiFloatActionItems type="button" aria-label="Delete">
211
+ <UiIcon name="trash" size="s" />
212
+ </UiFloatActionItems>
213
+ </UiTooltip>
239
214
  </UiFloatActionItems>
240
215
  </template>
241
216
  </UiFloatActions>
242
217
  </template>`;
243
218
 
244
219
  /**
245
- * Flat row of icon-only actions revealed on pointer hover or keyboard focus.
246
- * Each icon button is wrapped in a `UiTooltip` so its purpose is discoverable —
247
- * a `button` item forwards attributes, so it can be dropped inside any wrapper.
248
- * Use the controls panel to try triggers, placement, offset, and dismiss behaviour.
220
+ * Icon-only actions where each button is named by a `UiTooltip`.
221
+ * Tooltips are placed on all four sides — `right`, `top`, `bottom`, `left` — via
222
+ * the tooltip `side` prop. Teleport each tooltip into the panel (`:to="panelEl"`)
223
+ * so it shares the panel's top layer instead of rendering beneath it.
249
224
  */
250
- export const FlatActions: Story = {
251
- render: (args) => ({
225
+ export const IconOnlyWithTooltip: Story = {
226
+ name: 'Icon only with tooltip',
227
+ render: () => ({
252
228
  components: { UiFloatActions, UiFloatActionItems, UiIcon, UiTooltip },
253
229
  setup() {
254
- const open = ref(args?.open ?? false);
255
- watch(
256
- () => args?.open,
257
- (value) => {
258
- if (value !== undefined) open.value = value;
259
- },
260
- );
261
- return { args, open };
230
+ const open = ref(false);
231
+ return { open };
262
232
  },
263
233
  template: `
264
- <div class="flex min-h-64 flex-col items-center justify-center gap-3 p-8">
234
+ <div class="flex min-h-64 flex-col items-center justify-center gap-4 p-8">
235
+ <p class="max-w-sm text-center body-14-regular text-content-on-surface-secondary">
236
+ Hover or focus each icon to reveal its tooltip on a different side.
237
+ </p>
265
238
  <UiFloatActions
266
239
  v-model:open="open"
267
- :trigger="args.trigger"
268
- :placement="args.placement"
269
- :offset="args.offset"
270
- :open-delay="args.openDelay"
271
- :close-delay="args.closeDelay"
272
- :dismiss-on-outside-click="args.dismissOnOutsideClick"
273
- :dismiss-on-escape="args.dismissOnEscape"
274
- :aria-label="args.ariaLabel"
240
+ trigger="hover"
241
+ placement="top"
242
+ :offset="10"
243
+ aria-label="Icon actions"
275
244
  >
276
245
  <template #container>
277
- <p class="max-w-sm rounded-md border border-border-surface-default bg-background-surface-primary px-4 py-6 body-14-regular leading-6">
278
- Hover or Tab to this paragraph to reveal contextual actions.
279
- </p>
246
+ <span class="rounded-md border border-border-surface-default bg-background-surface-primary px-4 py-2 body-14-regular">
247
+ Icon toolbar
248
+ </span>
280
249
  </template>
281
250
  <template #action="{ panelEl }">
282
- <UiFloatActionItems aria-label="Text actions">
283
- <UiTooltip content="Edit" :to="panelEl">
251
+ <UiFloatActionItems aria-label="Icon actions">
252
+ <UiTooltip content="Right" side="right" :to="panelEl" delayDuration={0}>
284
253
  <UiFloatActionItems type="button" aria-label="Edit">
285
254
  <UiIcon name="edit" size="s" />
286
255
  </UiFloatActionItems>
287
256
  </UiTooltip>
288
- <UiTooltip content="Copy" :to="panelEl">
257
+ <UiTooltip content="Top" side="top" :to="panelEl" delayDuration={0}>
289
258
  <UiFloatActionItems type="button" aria-label="Copy">
290
259
  <UiIcon name="copy" size="s" />
291
260
  </UiFloatActionItems>
292
261
  </UiTooltip>
293
- <UiTooltip content="Comment" :to="panelEl">
262
+ <UiTooltip content="Bottom" side="bottom" :to="panelEl" delayDuration={0}>
294
263
  <UiFloatActionItems type="button" aria-label="Comment">
295
264
  <UiIcon name="message-circle" size="s" />
296
265
  </UiFloatActionItems>
297
266
  </UiTooltip>
298
- <UiTooltip content="Delete" :to="panelEl">
267
+ <UiTooltip content="Left" side="left" :to="panelEl" delayDuration={0}>
299
268
  <UiFloatActionItems type="button" aria-label="Delete">
300
269
  <UiIcon name="trash" size="s" />
301
270
  </UiFloatActionItems>
@@ -307,18 +276,19 @@ export const FlatActions: Story = {
307
276
  `,
308
277
  }),
309
278
  parameters: {
310
- docs: { source: { code: flatActionsSource } },
279
+ controls: { disable: true },
280
+ docs: { source: { code: iconOnlyWithTooltipSource } },
311
281
  },
312
282
  };
313
283
 
314
- const clickTriggerSource = `<script setup lang="ts">
284
+ const buttonWithTextSource = `<script setup lang="ts">
315
285
  import { UiFloatActions, UiFloatActionItems, UiIcon } from '@aleph-alpha/ui-library';
316
286
  </script>
317
287
 
318
288
  <template>
319
- <UiFloatActions trigger="click" placement="bottom" :offset="10" aria-label="Open text actions">
289
+ <UiFloatActions trigger="click" placement="bottom" :offset="10" aria-label="Text actions">
320
290
  <template #container>
321
- <p>Click this paragraph to toggle the floating toolbar.</p>
291
+ <p>Click to toggle a labelled toolbar.</p>
322
292
  </template>
323
293
  <template #action>
324
294
  <UiFloatActionItems aria-label="Text actions">
@@ -329,52 +299,40 @@ import { UiFloatActions, UiFloatActionItems, UiIcon } from '@aleph-alpha/ui-libr
329
299
  <UiFloatActionItems type="button" aria-label="Copy" class="w-auto gap-1.5 px-3 label-14-medium">
330
300
  <UiIcon name="copy" size="s" />Copy
331
301
  </UiFloatActionItems>
302
+ <UiFloatActionItems type="button" aria-label="Delete" class="w-auto gap-1.5 px-3 label-14-medium">
303
+ <UiIcon name="trash" size="s" />Delete
304
+ </UiFloatActionItems>
332
305
  </UiFloatActionItems>
333
306
  </template>
334
307
  </UiFloatActions>
335
308
  </template>`;
336
309
 
337
310
  /**
338
- * Click trigger for toggling a floating toolbar with pointer or keyboard.
339
- * Actions pair an icon with a visible text label, so no tooltip is required.
340
- * The anchor exposes `aria-expanded`, `aria-haspopup`, and `aria-controls`
341
- * for screen readers. Enter and Space also toggle the panel.
311
+ * Actions that pair an icon with a visible text label.
312
+ * A readable label makes the action self-describing, so no tooltip is required.
313
+ * Widen the button (`w-auto`) and add horizontal padding to fit the text.
342
314
  */
343
- export const ClickTrigger: Story = {
344
- args: {
345
- trigger: 'click',
346
- placement: 'bottom',
347
- ariaLabel: 'Open text actions',
348
- },
349
- render: (args) => ({
315
+ export const ButtonWithText: Story = {
316
+ name: 'Button with text (no tooltip)',
317
+ render: () => ({
350
318
  components: { UiFloatActions, UiFloatActionItems, UiIcon },
351
319
  setup() {
352
- const open = ref(args?.open ?? false);
353
- watch(
354
- () => args?.open,
355
- (value) => {
356
- if (value !== undefined) open.value = value;
357
- },
358
- );
359
- return { args, open };
320
+ const open = ref(false);
321
+ return { open };
360
322
  },
361
323
  template: `
362
324
  <div class="flex min-h-64 flex-col items-center justify-center gap-3 p-8">
363
325
  <UiFloatActions
364
326
  v-model:open="open"
365
- :trigger="args.trigger"
366
- :placement="args.placement"
367
- :offset="args.offset"
368
- :open-delay="args.openDelay"
369
- :close-delay="args.closeDelay"
370
- :dismiss-on-outside-click="args.dismissOnOutsideClick"
371
- :dismiss-on-escape="args.dismissOnEscape"
372
- :aria-label="args.ariaLabel"
327
+ trigger="hover"
328
+ placement="top"
329
+ :offset="10"
330
+ aria-label="Text actions"
373
331
  >
374
332
  <template #container>
375
- <p class="max-w-sm rounded-md border border-border-surface-default bg-background-surface-primary px-4 py-6 body-14-regular">
376
- Click this paragraph to toggle the floating toolbar.
377
- </p>
333
+ <span class="rounded-md border border-border-surface-default bg-background-surface-primary px-4 py-2 body-14-regular">
334
+ Labelled toolbar
335
+ </span>
378
336
  </template>
379
337
  <template #action>
380
338
  <UiFloatActionItems aria-label="Text actions">
@@ -384,6 +342,9 @@ export const ClickTrigger: Story = {
384
342
  <UiFloatActionItems type="button" aria-label="Copy" class="w-auto gap-1.5 px-3 label-14-medium">
385
343
  <UiIcon name="copy" size="s" />Copy
386
344
  </UiFloatActionItems>
345
+ <UiFloatActionItems type="button" aria-label="Delete" class="w-auto gap-1.5 px-3 label-14-medium">
346
+ <UiIcon name="trash" size="s" />Delete
347
+ </UiFloatActionItems>
387
348
  </UiFloatActionItems>
388
349
  </template>
389
350
  </UiFloatActions>
@@ -391,203 +352,162 @@ export const ClickTrigger: Story = {
391
352
  `,
392
353
  }),
393
354
  parameters: {
394
- docs: { source: { code: clickTriggerSource } },
355
+ controls: { disable: true },
356
+ docs: { source: { code: buttonWithTextSource } },
395
357
  },
396
358
  };
397
359
 
398
- /**
399
- * Focus-only trigger for keyboard-first workflows.
400
- * The panel opens when the anchor receives focus and closes on blur or Escape.
401
- * Focus stays on the anchor; Tab into toolbar items to use arrow-key navigation.
402
- */
403
- export const FocusTrigger: Story = {
404
- args: {
405
- trigger: 'focus',
406
- placement: 'top',
407
- offset: 10,
408
- ariaLabel: 'Paragraph actions',
409
- },
410
- render: createFloatRender({
411
- helperText:
412
- 'Tab to the paragraph below. The toolbar opens on focus. Tab again to reach toolbar actions, then use arrow keys to move between them.',
413
- anchorText: 'Tab here to reveal focus-triggered actions.',
414
- }),
415
- };
360
+ const orientationSource = `<script setup lang="ts">
361
+ import { UiFloatActionItems, UiIcon } from '@aleph-alpha/ui-library';
362
+ </script>
363
+
364
+ <template>
365
+ <!-- Horizontal (default): ArrowLeft / ArrowRight move between items. -->
366
+ <UiFloatActionItems aria-label="Horizontal actions" orientation="horizontal">
367
+ <UiFloatActionItems type="button" aria-label="Edit"><UiIcon name="edit" size="s" /></UiFloatActionItems>
368
+ <UiFloatActionItems type="button" aria-label="Copy"><UiIcon name="copy" size="s" /></UiFloatActionItems>
369
+ <UiFloatActionItems type="button" aria-label="Delete"><UiIcon name="trash" size="s" /></UiFloatActionItems>
370
+ </UiFloatActionItems>
371
+
372
+ <!-- Vertical: ArrowUp / ArrowDown move between items; the pill stacks. -->
373
+ <UiFloatActionItems aria-label="Vertical actions" orientation="vertical">
374
+ <UiFloatActionItems type="button" aria-label="Edit"><UiIcon name="edit" size="s" /></UiFloatActionItems>
375
+ <UiFloatActionItems type="button" aria-label="Copy"><UiIcon name="copy" size="s" /></UiFloatActionItems>
376
+ <UiFloatActionItems type="button" aria-label="Delete"><UiIcon name="trash" size="s" /></UiFloatActionItems>
377
+ </UiFloatActionItems>
378
+ </template>`;
416
379
 
417
380
  /**
418
- * Placement and offset configuration.
419
- * The panel auto-flips via floating-ui when there is not enough viewport space.
381
+ * Toolbar orientation controls both layout and roving arrow-key navigation.
382
+ * `horizontal` (default) stacks items in a row and maps ArrowLeft / ArrowRight;
383
+ * `vertical` stacks items in a column and maps ArrowUp / ArrowDown.
420
384
  */
421
- export const Placements: Story = {
422
- render: (args) => ({
423
- components: { UiFloatActions, UiFloatActionItems, UiIcon },
424
- setup() {
425
- return { args };
426
- },
385
+ export const Orientation: Story = {
386
+ name: 'Action items orientation',
387
+ render: () => ({
388
+ components: { UiFloatActionItems, UiIcon },
427
389
  template: `
428
- <div class="grid min-h-96 grid-cols-2 place-items-center gap-8 p-8">
429
- <UiFloatActions
430
- v-for="placement in ['top', 'bottom', 'left', 'right']"
431
- :key="placement"
432
- :trigger="args.trigger"
433
- :placement="placement"
434
- :offset="args.offset"
435
- :open-delay="args.openDelay"
436
- :close-delay="args.closeDelay"
437
- :aria-label="placement + ' placement demo'"
438
- >
439
- <template #container>
440
- <span class="rounded-md border border-border-surface-default px-4 py-2 body-14-regular capitalize">
441
- {{ placement }}
442
- </span>
443
- </template>
444
- <template #action>
445
- <UiFloatActionItems :aria-label="placement + ' actions'">
446
- <UiFloatActionItems type="button" aria-label="Action">
447
- <UiIcon name="more-vertical" size="s" />
448
- </UiFloatActionItems>
390
+ <div class="flex min-h-64 flex-wrap items-start justify-center gap-12 p-8">
391
+ <div class="flex flex-col items-center gap-3">
392
+ <span class="label-14-medium text-content-on-surface-secondary">Horizontal</span>
393
+ <UiFloatActionItems aria-label="Horizontal actions" orientation="horizontal">
394
+ <UiFloatActionItems type="button" aria-label="Edit">
395
+ <UiIcon name="edit" size="s" />
449
396
  </UiFloatActionItems>
450
- </template>
451
- </UiFloatActions>
397
+ <UiFloatActionItems type="button" aria-label="Copy">
398
+ <UiIcon name="copy" size="s" />
399
+ </UiFloatActionItems>
400
+ <UiFloatActionItems type="button" aria-label="Delete">
401
+ <UiIcon name="trash" size="s" />
402
+ </UiFloatActionItems>
403
+ </UiFloatActionItems>
404
+ </div>
405
+ <div class="flex flex-col items-center gap-3">
406
+ <span class="label-14-medium text-content-on-surface-secondary">Vertical</span>
407
+ <UiFloatActionItems aria-label="Vertical actions" orientation="vertical">
408
+ <UiFloatActionItems type="button" aria-label="Edit">
409
+ <UiIcon name="edit" size="s" />
410
+ </UiFloatActionItems>
411
+ <UiFloatActionItems type="button" aria-label="Copy">
412
+ <UiIcon name="copy" size="s" />
413
+ </UiFloatActionItems>
414
+ <UiFloatActionItems type="button" aria-label="Delete">
415
+ <UiIcon name="trash" size="s" />
416
+ </UiFloatActionItems>
417
+ </UiFloatActionItems>
418
+ </div>
452
419
  </div>
453
420
  `,
454
421
  }),
455
- argTypes: {
456
- placement: { control: false },
457
- open: { control: false },
458
- ariaLabel: { control: false },
422
+ parameters: {
423
+ controls: { disable: true },
424
+ docs: { source: { code: orientationSource } },
459
425
  },
460
426
  };
461
427
 
462
- /**
463
- * UiFloatActionItems item types: `button`, `input`, `text`, `group`, and `separator`.
464
- * Nest items inside a root `toolbar` container. Each icon button requires an
465
- * `aria-label` because it renders without visible text.
466
- */
467
- const toolbarItemTypesTemplateSource = `<script setup lang="ts">
468
- import { UiFloatActions, UiFloatActionItems, UiIcon } from '@aleph-alpha/ui-library';
428
+ const itemTypesSource = `<script setup lang="ts">
429
+ import { UiFloatActionItems, UiIcon } from '@aleph-alpha/ui-library';
469
430
  </script>
470
431
 
471
432
  <template>
472
- <UiFloatActions trigger="hover" placement="top" :offset="10">
473
- <template #container>
474
- <p>Hover or Tab to explore toolbar item types.</p>
475
- </template>
476
- <template #action>
477
- <UiFloatActionItems aria-label="Mixed actions">
478
- <UiFloatActionItems type="button" aria-label="Edit">
479
- <UiIcon name="edit" size="s" />
480
- </UiFloatActionItems>
481
- <UiFloatActionItems type="button" aria-label="Copy">
482
- <UiIcon name="copy" size="s" />
483
- </UiFloatActionItems>
484
- <UiFloatActionItems type="separator" />
485
- <UiFloatActionItems type="group">
486
- <UiFloatActionItems type="button" aria-label="Previous page">
487
- <UiIcon name="chevron-left" size="s" />
488
- </UiFloatActionItems>
489
- <UiFloatActionItems type="text">2/2</UiFloatActionItems>
490
- <UiFloatActionItems type="button" aria-label="Next page">
491
- <UiIcon name="chevron-right" size="s" />
492
- </UiFloatActionItems>
493
- </UiFloatActionItems>
433
+ <UiFloatActionItems aria-label="All item types">
434
+ <!-- button -->
435
+ <UiFloatActionItems type="button" aria-label="Edit">
436
+ <UiIcon name="edit" size="s" />
437
+ </UiFloatActionItems>
438
+ <!-- separator -->
439
+ <UiFloatActionItems type="separator" />
440
+ <!-- group + text -->
441
+ <UiFloatActionItems type="group">
442
+ <UiFloatActionItems type="button" aria-label="Previous page">
443
+ <UiIcon name="chevron-left" size="s" />
494
444
  </UiFloatActionItems>
495
- </template>
496
- </UiFloatActions>
445
+ <UiFloatActionItems type="text">2/2</UiFloatActionItems>
446
+ <UiFloatActionItems type="button" aria-label="Next page">
447
+ <UiIcon name="chevron-right" size="s" />
448
+ </UiFloatActionItems>
449
+ </UiFloatActionItems>
450
+ <UiFloatActionItems type="separator" />
451
+ <!-- input -->
452
+ <UiFloatActionItems type="input" aria-label="Filter value" placeholder="Filter..." />
453
+ </UiFloatActionItems>
497
454
  </template>`;
498
455
 
499
- export const ToolbarItemTypes: Story = {
456
+ /**
457
+ * All item types nested inside a root `toolbar` container:
458
+ * `button`, `input`, `text`, `group`, and `separator`.
459
+ * Icon-only `button` items require an `aria-label` because they have no visible text.
460
+ */
461
+ export const ItemTypes: Story = {
462
+ name: 'Action items types',
500
463
  render: () => ({
501
- components: { UiFloatActions, UiFloatActionItems, UiIcon },
464
+ components: { UiFloatActionItems, UiIcon },
502
465
  template: `
503
- <div class="flex min-h-48 flex-col items-center justify-center gap-6 p-8">
504
- <UiFloatActions trigger="hover" placement="top" :offset="10">
505
- <template #container>
506
- <p class="max-w-sm rounded-md border border-border-surface-default bg-background-surface-primary px-4 py-6 body-14-regular">
507
- Hover or Tab to explore toolbar item types.
508
- </p>
509
- </template>
510
- <template #action>
511
- <UiFloatActionItems aria-label="Mixed actions">
512
- <UiFloatActionItems type="button" aria-label="Edit">
513
- <UiIcon name="edit" size="s" />
514
- </UiFloatActionItems>
515
- <UiFloatActionItems type="button" aria-label="Copy">
516
- <UiIcon name="copy" size="s" />
517
- </UiFloatActionItems>
518
- <UiFloatActionItems type="separator" />
519
- <UiFloatActionItems type="group">
520
- <UiFloatActionItems type="button" aria-label="Previous page">
521
- <UiIcon name="chevron-left" size="s" />
522
- </UiFloatActionItems>
523
- <UiFloatActionItems type="text">2/2</UiFloatActionItems>
524
- <UiFloatActionItems type="button" aria-label="Next page">
525
- <UiIcon name="chevron-right" size="s" />
526
- </UiFloatActionItems>
527
- </UiFloatActionItems>
466
+ <div class="flex min-h-64 flex-col items-center justify-center gap-6 p-8">
467
+ <UiFloatActionItems aria-label="All item types">
468
+ <UiFloatActionItems type="button" aria-label="Edit">
469
+ <UiIcon name="edit" size="s" />
470
+ </UiFloatActionItems>
471
+ <UiFloatActionItems type="button" aria-label="Copy">
472
+ <UiIcon name="copy" size="s" />
473
+ </UiFloatActionItems>
474
+ <UiFloatActionItems type="separator" />
475
+ <UiFloatActionItems type="group">
476
+ <UiFloatActionItems type="button" aria-label="Previous page">
477
+ <UiIcon name="chevron-left" size="s" />
478
+ </UiFloatActionItems>
479
+ <UiFloatActionItems type="text">2/2</UiFloatActionItems>
480
+ <UiFloatActionItems type="button" aria-label="Next page">
481
+ <UiIcon name="chevron-right" size="s" />
528
482
  </UiFloatActionItems>
529
- </template>
530
- </UiFloatActions>
531
-
532
- <UiFloatActionItems aria-label="Filter actions">
533
- <UiFloatActionItems
534
- type="input"
535
- aria-label="Filter value"
536
- placeholder="Filter..."
537
- />
538
- <UiFloatActionItems type="button" aria-label="Apply filter">
539
- <UiIcon name="check" size="s" />
540
483
  </UiFloatActionItems>
484
+ <UiFloatActionItems type="separator" />
485
+ <UiFloatActionItems type="input" aria-label="Filter value" placeholder="Filter..." />
541
486
  </UiFloatActionItems>
487
+
488
+ <dl class="grid grid-cols-[auto_1fr] gap-x-4 gap-y-1 body-14-regular text-content-on-surface-secondary">
489
+ <dt class="label-14-medium text-content-on-surface-primary">button</dt><dd>Icon or labelled action</dd>
490
+ <dt class="label-14-medium text-content-on-surface-primary">separator</dt><dd>Vertical divider</dd>
491
+ <dt class="label-14-medium text-content-on-surface-primary">group</dt><dd>Groups related items</dd>
492
+ <dt class="label-14-medium text-content-on-surface-primary">text</dt><dd>Non-interactive label</dd>
493
+ <dt class="label-14-medium text-content-on-surface-primary">input</dt><dd>Inline text field</dd>
494
+ </dl>
542
495
  </div>
543
496
  `,
544
497
  }),
545
498
  parameters: {
546
499
  controls: { disable: true },
547
- docs: { source: { code: toolbarItemTypesTemplateSource } },
548
- },
549
- };
550
-
551
- /**
552
- * Text-selection toolbar with pagination controls.
553
- * Demonstrates a decoupled pattern: the float anchors to any element without
554
- * coupling toolbar items to a specific domain model. Arrow keys navigate items.
555
- */
556
- export const TextSelectionToolbar: Story = {
557
- args: {
558
- trigger: 'hover',
559
- placement: 'top',
560
- offset: 10,
500
+ docs: { source: { code: itemTypesSource } },
561
501
  },
562
- render: createFloatRender({
563
- showPagination: true,
564
- helperText:
565
- 'Hover or Tab to the highlighted paragraph to reveal the floating action bar. Tab into toolbar actions, then use arrow keys to move between them.',
566
- anchorText:
567
- 'Design systems thrive when primitives stay decoupled. This pattern anchors a pill toolbar to any element without coupling the toolbar items to a specific domain model.',
568
- }),
569
502
  };
570
503
 
571
504
  /**
572
- * Click-bound card actions anchored below the card.
573
- * Use `placement="bottom-start"` to align the toolbar with the card's leading edge.
574
- */
575
- export const ClickBoundCardActions: Story = {
576
- args: {
577
- trigger: 'click',
578
- placement: 'bottom-start',
579
- ariaLabel: 'Open card actions',
580
- },
581
- render: createFloatRender({
582
- useCardAnchor: true,
583
- anchorText: 'Click anywhere on this card to reveal inline actions.',
584
- }),
585
- };
586
-
587
- /**
588
- * All float states and variations in a single view for visual QA and reference.
505
+ * All button states side by side for visual QA: default, hover, focus (shared
506
+ * `ui-focus-ring`), disabled, plus toolbar-level triggers and open / closed panels.
507
+ * Tab through the buttons to see the focus ring; hover to see the hover surface.
589
508
  */
590
509
  export const AllStates: Story = {
510
+ name: 'All states with button',
591
511
  render: () => ({
592
512
  components: { UiFloatActions, UiFloatActionItems, UiIcon },
593
513
  setup() {
@@ -596,17 +516,62 @@ export const AllStates: Story = {
596
516
  return { openPanel, closedPanel };
597
517
  },
598
518
  template: `
599
- <div class="flex flex-col gap-10 p-8">
600
- <section class="flex flex-col gap-4">
601
- <h3 class="body-16-medium text-content-on-surface-primary">Triggers</h3>
602
- <div class="grid gap-6 md:grid-cols-3">
603
- <div class="flex flex-col items-center gap-2">
604
- <span class="label-14-medium text-content-on-surface-secondary">Hover</span>
605
- <UiFloatActions trigger="hover" placement="top" :offset="10">
519
+ <div class="mx-auto flex max-w-4xl flex-col gap-12 p-8">
520
+ <section class="flex flex-col gap-5">
521
+ <div class="flex flex-col gap-1">
522
+ <h3 class="body-16-medium text-content-on-surface-primary">Button states</h3>
523
+ <p class="body-14-regular text-content-on-surface-secondary">
524
+ Tab to a button to reveal the focus ring; hover to see the hover surface.
525
+ </p>
526
+ </div>
527
+ <div class="grid grid-cols-2 gap-4 sm:grid-cols-4">
528
+ <div class="flex flex-col items-center justify-center gap-4 rounded-lg border border-border-surface-default bg-background-surface-primary p-6">
529
+ <UiFloatActionItems aria-label="Default state">
530
+ <UiFloatActionItems type="button" aria-label="Edit">
531
+ <UiIcon name="edit" size="s" />
532
+ </UiFloatActionItems>
533
+ </UiFloatActionItems>
534
+ <span class="label-12-medium text-content-on-surface-secondary">Default</span>
535
+ </div>
536
+ <div class="flex flex-col items-center justify-center gap-4 rounded-lg border border-border-surface-default bg-background-surface-primary p-6">
537
+ <UiFloatActionItems aria-label="Hover state">
538
+ <UiFloatActionItems type="button" aria-label="Edit" >
539
+ <UiIcon name="edit" size="s" />
540
+ </UiFloatActionItems>
541
+ </UiFloatActionItems>
542
+ <span class="label-12-medium text-content-on-surface-secondary">Hover</span>
543
+ </div>
544
+ <div class="flex flex-col items-center justify-center gap-4 rounded-lg border border-border-surface-default bg-background-surface-primary p-6">
545
+ <UiFloatActionItems aria-label="Focus state">
546
+ <UiFloatActionItems type="button" aria-label="Edit">
547
+ <UiIcon name="edit" size="s" />
548
+ </UiFloatActionItems>
549
+ </UiFloatActionItems>
550
+ <span class="label-12-medium text-content-on-surface-secondary">Focus (Tab)</span>
551
+ </div>
552
+ <div class="flex flex-col items-center justify-center gap-4 rounded-lg border border-border-surface-default bg-background-surface-primary p-6">
553
+ <UiFloatActionItems aria-label="Disabled state">
554
+ <UiFloatActionItems type="button" aria-label="Edit" disabled>
555
+ <UiIcon name="edit" size="s" />
556
+ </UiFloatActionItems>
557
+ </UiFloatActionItems>
558
+ <span class="label-12-medium text-content-on-surface-secondary">Disabled</span>
559
+ </div>
560
+ </div>
561
+ </section>
562
+
563
+ <section class="flex flex-col gap-5">
564
+ <div class="flex flex-col gap-1">
565
+ <h3 class="body-16-medium text-content-on-surface-primary">Triggers</h3>
566
+ <p class="body-14-regular text-content-on-surface-secondary">
567
+ How the floating panel opens for each interaction mode.
568
+ </p>
569
+ </div>
570
+ <div class="grid gap-4 sm:grid-cols-3">
571
+ <div class="flex min-h-44 flex-col items-center justify-end gap-4 rounded-lg border border-border-surface-default bg-background-surface-primary p-6">
572
+ <UiFloatActions trigger="hover" placement="top" :offset="10" aria-label="Hover actions">
606
573
  <template #container>
607
- <span class="rounded-md border border-border-surface-default px-4 py-2 body-14-regular">
608
- Hover or Tab
609
- </span>
574
+ <span class="rounded-md border border-border-surface-default px-4 py-2 body-14-regular">Hover or Tab</span>
610
575
  </template>
611
576
  <template #action>
612
577
  <UiFloatActionItems aria-label="Hover actions">
@@ -616,14 +581,12 @@ export const AllStates: Story = {
616
581
  </UiFloatActionItems>
617
582
  </template>
618
583
  </UiFloatActions>
584
+ <span class="label-12-medium text-content-on-surface-secondary">Hover</span>
619
585
  </div>
620
- <div class="flex flex-col items-center gap-2">
621
- <span class="label-14-medium text-content-on-surface-secondary">Click</span>
586
+ <div class="flex min-h-44 flex-col items-center justify-end gap-4 rounded-lg border border-border-surface-default bg-background-surface-primary p-6">
622
587
  <UiFloatActions trigger="click" placement="top" :offset="10" aria-label="Click actions">
623
588
  <template #container>
624
- <span class="rounded-md border border-border-surface-default px-4 py-2 body-14-regular">
625
- Click or Enter
626
- </span>
589
+ <span class="rounded-md border border-border-surface-default px-4 py-2 body-14-regular">Click or Enter</span>
627
590
  </template>
628
591
  <template #action>
629
592
  <UiFloatActionItems aria-label="Click actions">
@@ -633,14 +596,12 @@ export const AllStates: Story = {
633
596
  </UiFloatActionItems>
634
597
  </template>
635
598
  </UiFloatActions>
599
+ <span class="label-12-medium text-content-on-surface-secondary">Click</span>
636
600
  </div>
637
- <div class="flex flex-col items-center gap-2">
638
- <span class="label-14-medium text-content-on-surface-secondary">Focus</span>
601
+ <div class="flex min-h-44 flex-col items-center justify-end gap-4 rounded-lg border border-border-surface-default bg-background-surface-primary p-6">
639
602
  <UiFloatActions trigger="focus" placement="top" :offset="10" aria-label="Focus actions">
640
603
  <template #container>
641
- <span class="rounded-md border border-border-surface-default px-4 py-2 body-14-regular">
642
- Tab to focus
643
- </span>
604
+ <span class="rounded-md border border-border-surface-default px-4 py-2 body-14-regular">Tab to focus</span>
644
605
  </template>
645
606
  <template #action>
646
607
  <UiFloatActionItems aria-label="Focus actions">
@@ -650,48 +611,23 @@ export const AllStates: Story = {
650
611
  </UiFloatActionItems>
651
612
  </template>
652
613
  </UiFloatActions>
614
+ <span class="label-12-medium text-content-on-surface-secondary">Focus</span>
653
615
  </div>
654
616
  </div>
655
617
  </section>
656
618
 
657
- <section class="flex flex-col gap-4">
658
- <h3 class="body-16-medium text-content-on-surface-primary">Placements</h3>
659
- <div class="grid min-h-80 grid-cols-2 place-items-center gap-8">
660
- <UiFloatActions
661
- v-for="placement in ['top', 'bottom', 'left', 'right']"
662
- :key="'placement-' + placement"
663
- trigger="manual"
664
- v-model:open="openPanel"
665
- :placement="placement"
666
- :offset="12"
667
- :aria-label="placement + ' placement'"
668
- >
669
- <template #container>
670
- <span class="rounded-md border border-border-surface-default px-4 py-2 body-14-regular capitalize">
671
- {{ placement }}
672
- </span>
673
- </template>
674
- <template #action>
675
- <UiFloatActionItems :aria-label="placement + ' actions'">
676
- <UiFloatActionItems type="button" aria-label="Action">
677
- <UiIcon name="more-vertical" size="s" />
678
- </UiFloatActionItems>
679
- </UiFloatActionItems>
680
- </template>
681
- </UiFloatActions>
619
+ <section class="flex flex-col gap-5">
620
+ <div class="flex flex-col gap-1">
621
+ <h3 class="body-16-medium text-content-on-surface-primary">Open vs closed</h3>
622
+ <p class="body-14-regular text-content-on-surface-secondary">
623
+ Controlled panels via <code class="label-14-regular">v-model:open</code>.
624
+ </p>
682
625
  </div>
683
- </section>
684
-
685
- <section class="flex flex-col gap-4">
686
- <h3 class="body-16-medium text-content-on-surface-primary">Open vs closed</h3>
687
- <div class="grid gap-8 md:grid-cols-2">
688
- <div class="flex flex-col items-center gap-2">
689
- <span class="label-14-medium text-content-on-surface-secondary">Open</span>
626
+ <div class="grid gap-4 sm:grid-cols-2">
627
+ <div class="flex min-h-44 flex-col items-center justify-end gap-4 rounded-lg border border-border-surface-default bg-background-surface-primary p-6">
690
628
  <UiFloatActions trigger="manual" v-model:open="openPanel" placement="top" :offset="10" aria-label="Open panel">
691
629
  <template #container>
692
- <span class="rounded-md border border-border-surface-default px-4 py-2 body-14-regular">
693
- Panel open
694
- </span>
630
+ <span class="rounded-md border border-border-surface-default px-4 py-2 body-14-regular">Panel open</span>
695
631
  </template>
696
632
  <template #action>
697
633
  <UiFloatActionItems aria-label="Open panel actions">
@@ -704,14 +640,12 @@ export const AllStates: Story = {
704
640
  </UiFloatActionItems>
705
641
  </template>
706
642
  </UiFloatActions>
643
+ <span class="label-12-medium text-content-on-surface-secondary">Open</span>
707
644
  </div>
708
- <div class="flex flex-col items-center gap-2">
709
- <span class="label-14-medium text-content-on-surface-secondary">Closed</span>
645
+ <div class="flex min-h-44 flex-col items-center justify-end gap-4 rounded-lg border border-border-surface-default bg-background-surface-primary p-6">
710
646
  <UiFloatActions trigger="manual" v-model:open="closedPanel" placement="top" :offset="10" aria-label="Closed panel">
711
647
  <template #container>
712
- <span class="rounded-md border border-border-surface-default px-4 py-2 body-14-regular">
713
- Panel closed
714
- </span>
648
+ <span class="rounded-md border border-border-surface-default px-4 py-2 body-14-regular">Panel closed</span>
715
649
  </template>
716
650
  <template #action>
717
651
  <UiFloatActionItems aria-label="Closed panel actions">
@@ -721,39 +655,10 @@ export const AllStates: Story = {
721
655
  </UiFloatActionItems>
722
656
  </template>
723
657
  </UiFloatActions>
658
+ <span class="label-12-medium text-content-on-surface-secondary">Closed</span>
724
659
  </div>
725
660
  </div>
726
661
  </section>
727
-
728
- <section class="flex flex-col gap-4">
729
- <h3 class="body-16-medium text-content-on-surface-primary">Toolbar item types</h3>
730
- <div class="flex flex-col items-center gap-6">
731
- <UiFloatActionItems aria-label="Mixed actions">
732
- <UiFloatActionItems type="button" aria-label="Edit">
733
- <UiIcon name="edit" size="s" />
734
- </UiFloatActionItems>
735
- <UiFloatActionItems type="button" aria-label="Copy">
736
- <UiIcon name="copy" size="s" />
737
- </UiFloatActionItems>
738
- <UiFloatActionItems type="separator" />
739
- <UiFloatActionItems type="group">
740
- <UiFloatActionItems type="button" aria-label="Previous page">
741
- <UiIcon name="chevron-left" size="s" />
742
- </UiFloatActionItems>
743
- <UiFloatActionItems type="text">2/2</UiFloatActionItems>
744
- <UiFloatActionItems type="button" aria-label="Next page">
745
- <UiIcon name="chevron-right" size="s" />
746
- </UiFloatActionItems>
747
- </UiFloatActionItems>
748
- </UiFloatActionItems>
749
- <UiFloatActionItems aria-label="Filter actions">
750
- <UiFloatActionItems type="input" aria-label="Filter value" placeholder="Filter..." />
751
- <UiFloatActionItems type="button" aria-label="Apply filter">
752
- <UiIcon name="check" size="s" />
753
- </UiFloatActionItems>
754
- </UiFloatActionItems>
755
- </div>
756
- </section>
757
662
  </div>
758
663
  `,
759
664
  }),
@@ -765,9 +670,9 @@ export const AllStates: Story = {
765
670
  },
766
671
  };
767
672
 
768
- const composableUsageTemplateSource = `<script setup lang="ts">
673
+ const composableUsageSource = `<script setup lang="ts">
769
674
  import { useId } from 'vue';
770
- import { useAnchorFloat, UiFloatActions, UiFloatActionItems, UiIcon } from '@aleph-alpha/ui-library';
675
+ import { useAnchorFloat, UiFloatActionItems, UiIcon } from '@aleph-alpha/ui-library';
771
676
 
772
677
  // Prefer UiFloatActions for the standard component API. Use useAnchorFloat when
773
678
  // you need full control over markup, animation, or teleport targets.
@@ -792,6 +697,7 @@ const {
792
697
  </script>
793
698
 
794
699
  <template>
700
+ <!-- Add the shared \`ui-focus-ring\` utility to any focusable element. -->
795
701
  <button
796
702
  ref="referenceRef"
797
703
  type="button"
@@ -799,6 +705,7 @@ const {
799
705
  :aria-expanded="open"
800
706
  aria-haspopup="true"
801
707
  :aria-controls="open ? contentId : undefined"
708
+ class="ui-focus-ring rounded-md border border-transparent"
802
709
  @mouseenter="onReferenceMouseEnter"
803
710
  @mouseleave="onReferenceMouseLeave"
804
711
  @focus="onReferenceFocus"
@@ -806,8 +713,6 @@ const {
806
713
  >
807
714
  Hover or Tab to reveal actions
808
715
  </button>
809
- <!-- popover="manual" promotes the panel to the top layer and, when shown via
810
- showPopover({ source }), wires the anchor → panel keyboard focus order. -->
811
716
  <Teleport to="body">
812
717
  <div
813
718
  v-if="open"
@@ -832,10 +737,11 @@ const {
832
737
  /**
833
738
  * Headless usage with the `useAnchorFloat` composable.
834
739
  * Use when you need full control over markup, animation, or teleport targets
835
- * beyond what {@link UiFloatActions} provides. Wire focus handlers and popup ARIA on
836
- * the anchor yourself when using `hover` or `focus` triggers.
740
+ * beyond what `UiFloatActions` provides. Wire focus handlers and popup ARIA on
741
+ * the anchor yourself, and add the shared `ui-focus-ring` utility for a consistent
742
+ * keyboard focus style.
837
743
  */
838
- export const ComposableUsage: Story = {
744
+ export const Composable: Story = {
839
745
  render: () => ({
840
746
  components: { UiFloatActionItems, UiIcon },
841
747
  setup() {
@@ -856,7 +762,7 @@ export const ComposableUsage: Story = {
856
762
  :aria-expanded="open"
857
763
  aria-haspopup="true"
858
764
  :aria-controls="open ? contentId : undefined"
859
- class="rounded-md border border-border-surface-default bg-background-surface-primary px-6 py-10 body-14-regular outline-none transition-[color,box-shadow,background-color,border-color] focus-visible:border-border-surface-focus-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]"
765
+ class="ui-focus-ring rounded-md border border-transparent bg-background-surface-primary px-6 py-10 body-14-regular"
860
766
  @mouseenter="onReferenceMouseEnter"
861
767
  @mouseleave="onReferenceMouseLeave"
862
768
  @focus="onReferenceFocus"
@@ -895,6 +801,6 @@ export const ComposableUsage: Story = {
895
801
  }),
896
802
  parameters: {
897
803
  controls: { disable: true },
898
- docs: { source: { code: composableUsageTemplateSource } },
804
+ docs: { source: { code: composableUsageSource } },
899
805
  },
900
806
  };