sb-floating-panel-vue 5.2.1 → 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/README.md +14 -29
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -17,10 +17,12 @@ Headless Vue 3 components for floating panels (dropdowns, menus, listboxes, popo
|
|
|
17
17
|
## 📦 Installation
|
|
18
18
|
|
|
19
19
|
```bash
|
|
20
|
-
npm install sb-floating-panel-vue
|
|
20
|
+
npm install sb-floating-panel-vue
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
`vue` (`^3.5.13`) and `@floating-ui/vue` (`^2.0.1`) are peer dependencies
|
|
23
|
+
`vue` (`^3.5.13`) and `@floating-ui/vue` (`^2.0.1`) are peer dependencies, so only one copy of each ends up in the bundle. Vue is already in your app. You don't need to install `@floating-ui/vue` yourself: npm 7+ and pnpm 8+ add missing peers automatically. Yarn doesn't, so add it there: `yarn add sb-floating-panel-vue @floating-ui/vue`.
|
|
24
|
+
|
|
25
|
+
If your app already depends on `@floating-ui/vue`, it must be a 2.x version (npm stops with `ERESOLVE` otherwise), and the library uses that same copy. If you only used it to position dropdowns, menus, popovers or tooltips, the library already does that for you: move those panels to its components and remove `@floating-ui/vue` from your `package.json`. Keep it only if your own code still imports it.
|
|
24
26
|
|
|
25
27
|
There is no CSS file to import.
|
|
26
28
|
|
|
@@ -123,34 +125,17 @@ Holds the state and the positioning. Renders no element of its own, only its slo
|
|
|
123
125
|
| `closeOnClickOutside` | `boolean` | `true` | Closes on a pointer press outside the reference and the panel (on touch, on the tap's click) |
|
|
124
126
|
| `closeOnFocusOut` | `boolean` | `true` | Closes when keyboard focus moves outside the reference and the panel |
|
|
125
127
|
|
|
126
|
-
| Event | Payload
|
|
127
|
-
| ------------- |
|
|
128
|
-
| `update:open` | `boolean`
|
|
129
|
-
| `open` | `SbOpenReason` | The panel has opened
|
|
130
|
-
| `close` | `SbCloseReason` | The panel has closed
|
|
131
|
-
|
|
132
|
-
The reason tells what opened or closed the panel, e.g. for analytics or to react only to a dismissal:
|
|
133
|
-
|
|
134
|
-
| Reason | `open` | `close` |
|
|
135
|
-
| --- | --- | --- |
|
|
136
|
-
| `trigger` | Click on the reference, Enter, Space or an arrow key on it | Click on the reference, Enter or Space on it |
|
|
137
|
-
| `hover` | Pointer over the reference (`hover` trigger) | Pointer left the reference and the panel (`hover` trigger) |
|
|
138
|
-
| `focus` | Focus on the reference (`hover` and `focus` triggers) | — |
|
|
139
|
-
| `focus-out` | — | Focus moved outside, e.g. Tab out of a menu |
|
|
140
|
-
| `escape` | — | Escape, or the arrow key that closes a submenu |
|
|
141
|
-
| `outside` | — | Press outside the reference and the panel |
|
|
142
|
-
| `select` | — | Item activated with `closeOnSelect` |
|
|
143
|
-
| `detached` | — | Reference scrolled out of view, with `hideWhenDetached: 'close'` |
|
|
144
|
-
| `disabled` | — | The container was disabled |
|
|
145
|
-
| `api` | `v-model:open`, slot props, exposed methods, `useSbFloating()` | Same, or the reference unmounting |
|
|
128
|
+
| Event | Payload | Description |
|
|
129
|
+
| ------------- | ---------------------------- | ---------------------- |
|
|
130
|
+
| `update:open` | `boolean` | Used by `v-model:open` |
|
|
131
|
+
| `open` | `SbOpenReason` (deprecated) | The panel has opened |
|
|
132
|
+
| `close` | `SbCloseReason` (deprecated) | The panel has closed |
|
|
146
133
|
|
|
147
|
-
|
|
148
|
-
<SbContainer @close="(reason) => reason === 'select' && track('menu-pick')">
|
|
149
|
-
```
|
|
134
|
+
The reason passed to `open` and `close` (what opened or closed the panel) is deprecated and removed in v6; the events stay. Its values are described on the `SbOpenReason` and `SbCloseReason` types.
|
|
150
135
|
|
|
151
|
-
**Slot props**: `isOpen`, `open()`, `close()`, `toggle()`, `placement` (resolved after flip)
|
|
136
|
+
**Slot props**: `isOpen`, `open()`, `close()`, `toggle()`, `placement` (resolved after flip) and `floatingId` (the `id` of the panel, for ARIA attributes of your own). `side`, `align` and `referenceId` are deprecated: read the side and alignment from `placement`, and pass your own `id` to `SbReference`.
|
|
152
137
|
|
|
153
|
-
**Exposed** (template ref): `isOpen`, `open()`, `close()
|
|
138
|
+
**Exposed** (template ref): `update()` (recomputes the position). `isOpen`, `open()`, `close()` and `toggle()` are deprecated: use `v-model:open`.
|
|
154
139
|
|
|
155
140
|
### `<SbReference>`
|
|
156
141
|
|
|
@@ -234,10 +219,10 @@ Every prop, slot prop, event and option type is exported (`SbContainerProps`, `S
|
|
|
234
219
|
|
|
235
220
|
- <a id="tooltip-1"></a>**Tooltip.** With `role="tooltip"` the panel follows the WAI-ARIA [tooltip](https://www.w3.org/WAI/ARIA/apg/patterns/tooltip/) pattern: the reference gets no `aria-expanded` nor `aria-controls`, and while open `aria-describedby` points to the panel (pass your own `aria-describedby` on `SbReference` to replace it). Focus stays on the reference and no focus guards are rendered. Use it with `trigger="hover"`, which meets WCAG [1.4.13](https://www.w3.org/WAI/WCAG22/Understanding/content-on-hover-or-focus): it opens on keyboard focus too, the pointer can move onto the tooltip within `delay.close`, and Escape dismisses it.
|
|
236
221
|
- **Dismissal.**
|
|
237
|
-
- Escape closes the open panel that has focus, else the most recently opened one
|
|
222
|
+
- Escape closes the open panel that has focus, else the most recently opened one, skipping panels with `closeOnEscape` set to `false`. It is ignored when a widget inside has already handled it (`event.preventDefault()`) and while an IME composition is in progress.
|
|
238
223
|
- A press outside closes the panel; on touch, only a tap does, so starting a scroll keeps it open.
|
|
239
224
|
- Moving focus outside (e.g. tabbing past the last element) closes it.
|
|
240
|
-
- A container nested inside a panel counts as part of it.
|
|
225
|
+
- A container nested inside a panel counts as part of it. Anything else outside the reference and the panel does not: a datepicker, select or other popup of another library, teleported out of the panel, closes it when pressed or focused. Set `:close-on-click-outside="false"` and `:close-on-focus-out="false"` on that container and close it yourself.
|
|
241
226
|
- **What is up to you.** The library does not implement the keyboard model of `tree` and `grid` panels, nor selection: a listbox option or a menu item does what its `click` handler does (e.g. set `aria-selected`); add `closeOnSelect` to close the panel after it. Use valid structure: items directly inside the `menu` / `listbox`, or inside `ul` / `li` with `role="none"`.
|
|
242
227
|
- <a id="text-field-references"></a>**Text field references.** `<SbReference as="input">` (or `textarea`) stays a text field: no `role="button"`, Enter and Space type as usual, a click opens the panel without closing it, and focus stays in the field when the panel opens. The [combobox pattern](https://www.w3.org/WAI/ARIA/apg/patterns/combobox/) (autocomplete with focus kept in the field and `aria-activedescendant`) is not supported: with a `menu` or `listbox` panel the arrow keys move focus into the panel, and the console warns about it in development.
|
|
243
228
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sb-floating-panel-vue",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.3.1",
|
|
4
4
|
"description": "Headless Vue 3 floating panel components (dropdowns, popovers, menus) powered by @floating-ui/vue: positioning, accessibility and open state handled, zero CSS shipped.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vue",
|