@jobber/components 7.10.0 → 7.11.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/Autocomplete/index.cjs +1 -0
- package/dist/Autocomplete/index.mjs +1 -0
- package/dist/Card/index.cjs +3 -0
- package/dist/Card/index.mjs +3 -0
- package/dist/Chip/index.cjs +1 -0
- package/dist/Chip/index.mjs +1 -0
- package/dist/Chips/InternalChipDismissible/hooks/index.cjs +1 -0
- package/dist/Chips/InternalChipDismissible/hooks/index.mjs +1 -0
- package/dist/Chips/InternalChipDismissible/index.cjs +1 -0
- package/dist/Chips/InternalChipDismissible/index.mjs +1 -0
- package/dist/Chips/index.cjs +1 -0
- package/dist/Chips/index.mjs +1 -0
- package/dist/Combobox/components/ComboboxActivator/index.cjs +1 -0
- package/dist/Combobox/components/ComboboxActivator/index.mjs +1 -0
- package/dist/Combobox/components/ComboboxContent/index.cjs +1 -0
- package/dist/Combobox/components/ComboboxContent/index.mjs +1 -0
- package/dist/Combobox/components/ComboboxTrigger/index.cjs +1 -0
- package/dist/Combobox/components/ComboboxTrigger/index.mjs +1 -0
- package/dist/Combobox/index.cjs +1 -0
- package/dist/Combobox/index.mjs +1 -0
- package/dist/ConfirmationModal/index.cjs +1 -0
- package/dist/ConfirmationModal/index.mjs +1 -0
- package/dist/DataDump/index.cjs +3 -0
- package/dist/DataDump/index.mjs +3 -0
- package/dist/DataList/components/DataListActions/index.cjs +1 -0
- package/dist/DataList/components/DataListActions/index.mjs +1 -0
- package/dist/DataList/components/DataListBulkActions/index.cjs +1 -0
- package/dist/DataList/components/DataListBulkActions/index.mjs +1 -0
- package/dist/DataList/components/DataListFilters/components/DataListSort/index.cjs +1 -0
- package/dist/DataList/components/DataListFilters/components/DataListSort/index.mjs +1 -0
- package/dist/DataList/components/DataListFilters/index.cjs +1 -0
- package/dist/DataList/components/DataListFilters/index.mjs +1 -0
- package/dist/DataList/components/DataListHeader/index.cjs +1 -0
- package/dist/DataList/components/DataListHeader/index.mjs +1 -0
- package/dist/DataList/components/DataListItem/index.cjs +1 -0
- package/dist/DataList/components/DataListItem/index.mjs +1 -0
- package/dist/DataList/components/DataListItemActions/index.cjs +1 -0
- package/dist/DataList/components/DataListItemActions/index.mjs +1 -0
- package/dist/DataList/components/DataListItemActionsOverflow/index.cjs +1 -0
- package/dist/DataList/components/DataListItemActionsOverflow/index.mjs +1 -0
- package/dist/DataList/components/DataListItems/index.cjs +1 -0
- package/dist/DataList/components/DataListItems/index.mjs +1 -0
- package/dist/DataList/components/DataListLayout/index.cjs +1 -0
- package/dist/DataList/components/DataListLayout/index.mjs +1 -0
- package/dist/DataList/components/DataListLayoutActions/index.cjs +1 -0
- package/dist/DataList/components/DataListLayoutActions/index.mjs +1 -0
- package/dist/DataList/index.cjs +1 -0
- package/dist/DataList/index.mjs +1 -0
- package/dist/DatePicker/index.cjs +1 -0
- package/dist/DatePicker/index.mjs +1 -0
- package/dist/DrawerRoot-cjs.js +181 -968
- package/dist/DrawerRoot-es.js +5 -734
- package/dist/FormatFile/index.cjs +1 -0
- package/dist/FormatFile/index.mjs +1 -0
- package/dist/Gallery/index.cjs +1 -0
- package/dist/Gallery/index.mjs +1 -0
- package/dist/InputDate/index.cjs +1 -0
- package/dist/InputDate/index.mjs +1 -0
- package/dist/InputNumberExperimental-cjs.js +783 -0
- package/dist/InputNumberExperimental-es.js +763 -0
- package/dist/LightBox/index.cjs +1 -0
- package/dist/LightBox/index.mjs +1 -0
- package/dist/Menu/index.cjs +3 -0
- package/dist/Menu/index.mjs +3 -0
- package/dist/MenuSubmenuTrigger-cjs.js +202 -447
- package/dist/MenuSubmenuTrigger-es.js +7 -249
- package/dist/Modal/index.cjs +1 -0
- package/dist/Modal/index.mjs +1 -0
- package/dist/NumberFieldInput-cjs.js +1828 -0
- package/dist/NumberFieldInput-es.js +1788 -0
- package/dist/Page/index.cjs +3 -0
- package/dist/Page/index.mjs +3 -0
- package/dist/Popover/index.cjs +1 -0
- package/dist/Popover/index.mjs +1 -0
- package/dist/Tooltip/index.cjs +1 -0
- package/dist/Tooltip/index.mjs +1 -0
- package/dist/docs/Menu/Menu.md +197 -37
- package/dist/floating-ui.react-cjs.js +35 -34
- package/dist/floating-ui.react-dom-cjs.js +65 -64
- package/dist/floating-ui.react-dom-es.js +2 -1
- package/dist/floating-ui.react-es.js +2 -1
- package/dist/floating-ui.utils.dom-cjs.js +185 -0
- package/dist/floating-ui.utils.dom-es.js +165 -0
- package/dist/index.cjs +3 -0
- package/dist/index.esm-cjs.js +0 -183
- package/dist/index.esm-es.js +1 -165
- package/dist/index.mjs +3 -0
- package/dist/primitives/BottomSheet/index.cjs +3 -1
- package/dist/primitives/BottomSheet/index.mjs +3 -1
- package/dist/primitives/InputNumberExperimental/InputNumberExperimental.d.ts +20 -0
- package/dist/primitives/InputNumberExperimental/index.cjs +22 -0
- package/dist/primitives/InputNumberExperimental/index.d.ts +2 -0
- package/dist/primitives/InputNumberExperimental/index.mjs +16 -0
- package/dist/primitives/InputNumberExperimental/types.d.ts +147 -0
- package/dist/primitives/index.cjs +9 -1
- package/dist/primitives/index.d.ts +2 -0
- package/dist/primitives/index.mjs +8 -1
- package/dist/styles.css +499 -0
- package/dist/unstyledPrimitives/index.cjs +264 -2039
- package/dist/unstyledPrimitives/index.mjs +72 -1847
- package/dist/useBaseUiId-cjs.js +275 -0
- package/dist/useBaseUiId-es.js +251 -0
- package/dist/useValueChanged-cjs.js +820 -0
- package/dist/useValueChanged-es.js +736 -0
- package/package.json +2 -2
- package/rollup.config.mjs +13 -2
package/dist/Page/index.cjs
CHANGED
|
@@ -20,6 +20,7 @@ require('@jobber/design');
|
|
|
20
20
|
require('../Menu-cjs.js');
|
|
21
21
|
require('framer-motion');
|
|
22
22
|
require('../floating-ui.react-cjs.js');
|
|
23
|
+
require('../floating-ui.utils.dom-cjs.js');
|
|
23
24
|
require('../index.esm-cjs.js');
|
|
24
25
|
require('react-dom');
|
|
25
26
|
require('../floating-ui.react-dom-cjs.js');
|
|
@@ -28,9 +29,11 @@ require('../maxHeight-cjs.js');
|
|
|
28
29
|
require('../useRenderElement-cjs.js');
|
|
29
30
|
require('../BottomSheet-cjs.js');
|
|
30
31
|
require('../DrawerRoot-cjs.js');
|
|
32
|
+
require('../useValueChanged-cjs.js');
|
|
31
33
|
require('../OverlaySeparator-cjs.js');
|
|
32
34
|
require('../Separator-cjs.js');
|
|
33
35
|
require('../MenuSubmenuTrigger-cjs.js');
|
|
36
|
+
require('../useBaseUiId-cjs.js');
|
|
34
37
|
require('../filterDataAttributes-cjs.js');
|
|
35
38
|
|
|
36
39
|
|
package/dist/Page/index.mjs
CHANGED
|
@@ -18,6 +18,7 @@ import '@jobber/design';
|
|
|
18
18
|
import '../Menu-es.js';
|
|
19
19
|
import 'framer-motion';
|
|
20
20
|
import '../floating-ui.react-es.js';
|
|
21
|
+
import '../floating-ui.utils.dom-es.js';
|
|
21
22
|
import '../index.esm-es.js';
|
|
22
23
|
import 'react-dom';
|
|
23
24
|
import '../floating-ui.react-dom-es.js';
|
|
@@ -26,7 +27,9 @@ import '../maxHeight-es.js';
|
|
|
26
27
|
import '../useRenderElement-es.js';
|
|
27
28
|
import '../BottomSheet-es.js';
|
|
28
29
|
import '../DrawerRoot-es.js';
|
|
30
|
+
import '../useValueChanged-es.js';
|
|
29
31
|
import '../OverlaySeparator-es.js';
|
|
30
32
|
import '../Separator-es.js';
|
|
31
33
|
import '../MenuSubmenuTrigger-es.js';
|
|
34
|
+
import '../useBaseUiId-es.js';
|
|
32
35
|
import '../filterDataAttributes-es.js';
|
package/dist/Popover/index.cjs
CHANGED
package/dist/Popover/index.mjs
CHANGED
package/dist/Tooltip/index.cjs
CHANGED
package/dist/Tooltip/index.mjs
CHANGED
package/dist/docs/Menu/Menu.md
CHANGED
|
@@ -1,55 +1,215 @@
|
|
|
1
1
|
# Menu
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
Menu container.
|
|
3
|
+
## Summary
|
|
5
4
|
|
|
6
|
-
The
|
|
7
|
-
|
|
5
|
+
The menu displays a list of options for a user to choose from. It is activated
|
|
6
|
+
by an interactive element such as a button or icon button.
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
only one may be used at a time. The Menu will close after an action is invoked,
|
|
11
|
-
the ESC key is pressed, or a click outside the Menu is registered.
|
|
8
|
+
## Anatomy
|
|
12
9
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
| Part | Description |
|
|
11
|
+
| ---------- | ----------------------------------------------------------- |
|
|
12
|
+
| Trigger | An interactive element that opens the menu |
|
|
13
|
+
| Container | The floating panel or sheet that contains the list of items |
|
|
14
|
+
| Label | Primary text of an item |
|
|
15
|
+
| Prefix | Optional leading slot |
|
|
16
|
+
| Suffix | Optional trailing slot |
|
|
17
|
+
| GroupLabel | Optional subdued heading used to group related items |
|
|
18
|
+
| Separator | Optional horizontal divider used to separate group of items |
|
|
16
19
|
|
|
17
|
-
|
|
18
|
-
may occur per row. Nesting additional interactive elements within a single Menu
|
|
19
|
-
action prevents keyboard access. When the Trigger is activated by keyboard, we
|
|
20
|
-
move focus to the first item in the Menu upon opening.
|
|
20
|
+
## Behavior
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
These elements are non interactive, nor focusable.
|
|
22
|
+
#### Opening and closing the menu
|
|
24
23
|
|
|
25
|
-
|
|
26
|
-
> leading icon, a label, and one simple trailing element (e.g., a
|
|
27
|
-
> `StatusIndicator`). More complex layouts increase cognitive load and can
|
|
28
|
-
> introduce complexity with the Menu's built in alignment features.
|
|
24
|
+
The menu opens when:
|
|
29
25
|
|
|
30
|
-
|
|
26
|
+
* The trigger is clicked or tapped
|
|
27
|
+
* The trigger is triggered by keyboard E.g. Via Enter or Space keys
|
|
31
28
|
|
|
32
|
-
|
|
33
|
-
will display as a tray or bottom-sheet like interface, opening upward from the
|
|
34
|
-
bottom of the screen.
|
|
29
|
+
The menu closes when:
|
|
35
30
|
|
|
36
|
-
|
|
37
|
-
|
|
31
|
+
* A action menu item is selected
|
|
32
|
+
* A click or tap occurs outside the menu
|
|
33
|
+
* The ESC key is pressed
|
|
38
34
|
|
|
39
|
-
|
|
35
|
+
Radio menu items remain open by default, but can be configured to close on
|
|
36
|
+
selection.
|
|
40
37
|
|
|
41
|
-
|
|
42
|
-
only the first letter of the label unless there is a proper noun (such as a
|
|
43
|
-
person's name) in the label.
|
|
38
|
+
#### Width
|
|
44
39
|
|
|
45
|
-
|
|
46
|
-
|
|
40
|
+
Menu width should by default match the trigger's width **or** hug the width of
|
|
41
|
+
the menu items so that the label doesn't wrap. The menu's width can by adjusted
|
|
42
|
+
manually however.
|
|
47
43
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
44
|
+
#### Positioning
|
|
45
|
+
|
|
46
|
+
Menu is positioned below the element that triggered it by default. It should
|
|
47
|
+
automatically reposition to appear on the left, right, above, or bottom of the
|
|
48
|
+
element that triggers it if the menu is cut off.
|
|
49
|
+
|
|
50
|
+
#### Submenus
|
|
51
|
+
|
|
52
|
+
Submenu opens next to the main menu item. On small screens, tapping a submenu
|
|
53
|
+
opens up a second sheet that displays the nested menu items.
|
|
54
|
+
|
|
55
|
+
#### Small screens
|
|
56
|
+
|
|
57
|
+
When a user is on a small screen such as a mobile device, the menu opens up as a
|
|
58
|
+
sheet anchored to the bottom of the screen.
|
|
59
|
+
|
|
60
|
+
## Variants
|
|
61
|
+
|
|
62
|
+
#### Menu Items
|
|
63
|
+
|
|
64
|
+
**1. Action:** Standard one-time actions such as navigating or triggering a
|
|
65
|
+
modal
|
|
66
|
+
|
|
67
|
+
**2. Radio:** Persistent choices like a filter of a view preference. Use when
|
|
68
|
+
choice persists and the user needs to see which option is active.
|
|
69
|
+
|
|
70
|
+
**3. Submenu:** Opens a nested menu of options on click and on hover. Use when
|
|
71
|
+
related actions are better surfaced one level deeper.
|
|
72
|
+
|
|
73
|
+
#### Menu Items: States
|
|
74
|
+
|
|
75
|
+
* Default
|
|
76
|
+
* Highlighted
|
|
77
|
+
* Selected (radio items only)
|
|
78
|
+
|
|
79
|
+
#### Group Label and Separator
|
|
80
|
+
|
|
81
|
+
Group labels and separators can be used to separate and group menu items into
|
|
82
|
+
scannable sections.
|
|
83
|
+
|
|
84
|
+
#### Custom Content
|
|
85
|
+
|
|
86
|
+
* Menus have custom slots that support more flexible item layouts
|
|
87
|
+
* Custom menu items can appear anywhere in a menu
|
|
88
|
+
* The padding of the menu container should not be altered
|
|
89
|
+
* Menu items must represent a single action. Avoid nesting interactive elements
|
|
90
|
+
inside a menu item
|
|
91
|
+
|
|
92
|
+
## Content Guidelines
|
|
93
|
+
|
|
94
|
+
#### Sentence case
|
|
95
|
+
|
|
96
|
+
Menu action labels should be sentence-cased. Capitalize only the first letter of
|
|
97
|
+
the label unless there is a proper noun (such as a person's name). Jobber
|
|
98
|
+
features like jobs, quotes, and invoices are not proper nouns and should not be
|
|
99
|
+
capitalized.
|
|
100
|
+
|
|
101
|
+
| ✅ Do | ❌ Don't |
|
|
102
|
+
| ----------------------- | ----------------------- |
|
|
103
|
+
| Send text message | Send Text Message |
|
|
104
|
+
| Collect signature | COLLECT SIGNATURE |
|
|
105
|
+
| Assign Jasmine Williams | Assign jasmine williams |
|
|
106
|
+
|
|
107
|
+
#### Verb-first labels
|
|
108
|
+
|
|
109
|
+
Menu items represent actions. Lead with the verb so the SP can scan quickly.
|
|
110
|
+
|
|
111
|
+
| ✅ Do | ❌ Don't |
|
|
112
|
+
| -------------------- | -------------------- |
|
|
113
|
+
| Edit client | Client editing |
|
|
114
|
+
| Send as text message | Text message options |
|
|
115
|
+
| Archive quote | Quote archiving |
|
|
116
|
+
|
|
117
|
+
#### Keep labels concise
|
|
118
|
+
|
|
119
|
+
Aim for 2-4 words. Menu items are scanned, not read carefully.
|
|
120
|
+
|
|
121
|
+
| ✅ Do | ❌ Don't |
|
|
122
|
+
| ----------------- | ----------------------------------- |
|
|
123
|
+
| Delete job | Delete this job permanently |
|
|
124
|
+
| Collect signature | Collect a signature from the client |
|
|
125
|
+
| Mark as complete | Mark this visit as complete |
|
|
126
|
+
|
|
127
|
+
#### Don't repeat the trigger context
|
|
128
|
+
|
|
129
|
+
If the menu is triggered from a button on a job card, the items don't need to
|
|
130
|
+
say "job" in every label.
|
|
131
|
+
|
|
132
|
+
| ✅ Do | ❌ Don't |
|
|
133
|
+
| ------- | ----------- |
|
|
134
|
+
| Edit | Edit job |
|
|
135
|
+
| Archive | Archive job |
|
|
136
|
+
| Delete | Delete job |
|
|
137
|
+
|
|
138
|
+
#### Use consistent verb tense
|
|
139
|
+
|
|
140
|
+
All items in a single menu should use the same grammatical form.
|
|
141
|
+
|
|
142
|
+
| ✅ Do | ❌ Don't |
|
|
143
|
+
| --------------------------------------- | ---------------------------------------- |
|
|
144
|
+
| Edit client / Send invoice / Delete job | Edit client / Sending invoice / Archived |
|
|
145
|
+
| Mark as complete / Assign to team | Completed / Assign to team |
|
|
146
|
+
|
|
147
|
+
#### Group labels should describe, not instruct
|
|
148
|
+
|
|
149
|
+
Keep group labels to 1-2 words that name the category.
|
|
150
|
+
|
|
151
|
+
| ✅ Do | ❌ Don't |
|
|
152
|
+
| ------------- | ------------------------------- |
|
|
153
|
+
| Communication | Choose how to communicate |
|
|
154
|
+
| Actions | Things you can do |
|
|
155
|
+
| Scheduling | Schedule options for this visit |
|
|
156
|
+
|
|
157
|
+
#### Destructive items should be explicit
|
|
158
|
+
|
|
159
|
+
Name what's being removed so the SP isn't guessing, especially when the menu
|
|
160
|
+
acts on multiple object types.
|
|
161
|
+
|
|
162
|
+
| ✅ Do | ❌ Don't |
|
|
163
|
+
| ---------------- | ------- |
|
|
164
|
+
| Delete job | Delete |
|
|
165
|
+
| Remove line item | Remove |
|
|
166
|
+
| Cancel visit | Cancel |
|
|
167
|
+
|
|
168
|
+
## Do's and Don'ts
|
|
169
|
+
|
|
170
|
+
#### Do
|
|
171
|
+
|
|
172
|
+
* ✅ Sentence case for menu item labels and group labels
|
|
173
|
+
* ✅ Labels should be short and action oriented
|
|
174
|
+
* ✅ Keep menu items simple
|
|
175
|
+
* ✅ Use icons only when they add clarity
|
|
176
|
+
* ✅ Cluster similar menu items together
|
|
177
|
+
|
|
178
|
+
#### Don't
|
|
179
|
+
|
|
180
|
+
* ❌ Avoid adding too many items in a menu
|
|
181
|
+
* ❌ Don't mix unrelated actions in the same menu, or use grouping when needed
|
|
182
|
+
|
|
183
|
+
## Accessibility
|
|
184
|
+
|
|
185
|
+
Users need to be able to navigate to, open, select menu items, and close a menu
|
|
186
|
+
with assistive technology.
|
|
187
|
+
|
|
188
|
+
#### Keyboard navigation
|
|
189
|
+
|
|
190
|
+
| Key | Behavior |
|
|
191
|
+
| --------------------- | ------------------------------------------------------------------ |
|
|
192
|
+
| Tab | Moves focus to the trigger |
|
|
193
|
+
| Up and Down arrows | Closed menus: Opens menu. Opened menus: Moves up and down the list |
|
|
194
|
+
| Left and Right arrows | Opens and closes a submenu |
|
|
195
|
+
| Enter or Space | Closed menus: Opens menu. Opened menus: Selects menu item |
|
|
196
|
+
| Esc | Closes the menu |
|
|
197
|
+
|
|
198
|
+
#### Touch target
|
|
199
|
+
|
|
200
|
+
Minimum menu item height:
|
|
201
|
+
|
|
202
|
+
* **Large screens:** 40px
|
|
203
|
+
* **Small screens:** 48px
|
|
204
|
+
|
|
205
|
+
## Related components
|
|
206
|
+
|
|
207
|
+
* To trigger a single action rather than presenting a list of options, use a
|
|
208
|
+
[Button](../Button/Button.md) or [IconButton](/components/IconButton)
|
|
209
|
+
* To allow the user to choose a value from a predefined list within a form, use
|
|
210
|
+
a [Select](../Select/Select.md)
|
|
211
|
+
* To allow the user to search and filter through a list of options, use a
|
|
212
|
+
[Combobox](../Combobox/Combobox.md)
|
|
53
213
|
|
|
54
214
|
|
|
55
215
|
## Composable Version (Web Only)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
|
+
var floatingUi_utils_dom = require('./floating-ui.utils.dom-cjs.js');
|
|
4
5
|
var index_esm = require('./index.esm-cjs.js');
|
|
5
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
7
|
var ReactDOM = require('react-dom');
|
|
@@ -86,7 +87,7 @@ function contains(parent, child) {
|
|
|
86
87
|
}
|
|
87
88
|
|
|
88
89
|
// then fallback to custom implementation with Shadow DOM support
|
|
89
|
-
if (rootNode &&
|
|
90
|
+
if (rootNode && floatingUi_utils_dom.isShadowRoot(rootNode)) {
|
|
90
91
|
let next = child;
|
|
91
92
|
while (next) {
|
|
92
93
|
if (parent === next) {
|
|
@@ -128,7 +129,7 @@ function getDocument$1(node) {
|
|
|
128
129
|
return (node == null ? void 0 : node.ownerDocument) || document;
|
|
129
130
|
}
|
|
130
131
|
function isTypeableElement(element) {
|
|
131
|
-
return
|
|
132
|
+
return floatingUi_utils_dom.isHTMLElement(element) && element.matches(TYPEABLE_SELECTOR);
|
|
132
133
|
}
|
|
133
134
|
function isTypeableCombobox(element) {
|
|
134
135
|
if (!element) return false;
|
|
@@ -650,7 +651,7 @@ const FloatingArrow = /*#__PURE__*/React__namespace.forwardRef(function Floating
|
|
|
650
651
|
// https://github.com/floating-ui/floating-ui/issues/2932
|
|
651
652
|
index(() => {
|
|
652
653
|
if (!floating) return;
|
|
653
|
-
const isRTL =
|
|
654
|
+
const isRTL = floatingUi_utils_dom.getComputedStyle(floating).direction === 'rtl';
|
|
654
655
|
if (isRTL) {
|
|
655
656
|
setIsRTL(true);
|
|
656
657
|
}
|
|
@@ -923,7 +924,7 @@ function applyAttributeToOthers(uncorrectedAvoidElements, body, ariaHidden, iner
|
|
|
923
924
|
return;
|
|
924
925
|
}
|
|
925
926
|
[].forEach.call(parent.children, node => {
|
|
926
|
-
if (
|
|
927
|
+
if (floatingUi_utils_dom.getNodeName(node) === 'script') return;
|
|
927
928
|
if (elementsToKeep.has(node)) {
|
|
928
929
|
deep(node);
|
|
929
930
|
} else {
|
|
@@ -1077,7 +1078,7 @@ function useFloatingPortalNode(props) {
|
|
|
1077
1078
|
if (!uniqueId) return;
|
|
1078
1079
|
if (portalNodeRef.current) return;
|
|
1079
1080
|
let container = root || (portalContext == null ? void 0 : portalContext.portalNode);
|
|
1080
|
-
if (container && !
|
|
1081
|
+
if (container && !floatingUi_utils_dom.isNode(container)) container = container.current;
|
|
1081
1082
|
container = container || document.body;
|
|
1082
1083
|
let idWrapper = null;
|
|
1083
1084
|
if (id) {
|
|
@@ -1225,7 +1226,7 @@ function clearDisconnectedPreviouslyFocusedElements() {
|
|
|
1225
1226
|
}
|
|
1226
1227
|
function addPreviouslyFocusedElement(element) {
|
|
1227
1228
|
clearDisconnectedPreviouslyFocusedElements();
|
|
1228
|
-
if (element &&
|
|
1229
|
+
if (element && floatingUi_utils_dom.getNodeName(element) !== 'body') {
|
|
1229
1230
|
previouslyFocusedElements.push(element);
|
|
1230
1231
|
if (previouslyFocusedElements.length > LIST_LIMIT) {
|
|
1231
1232
|
previouslyFocusedElements = previouslyFocusedElements.slice(-20);
|
|
@@ -1431,13 +1432,13 @@ function FloatingFocusManager(props) {
|
|
|
1431
1432
|
if (restoreFocus && currentTarget !== domReference && !(target != null && target.isConnected) && activeElement(getDocument$1(floatingFocusElement)) === getDocument$1(floatingFocusElement).body) {
|
|
1432
1433
|
// Let `FloatingPortal` effect knows that focus is still inside the
|
|
1433
1434
|
// floating tree.
|
|
1434
|
-
if (
|
|
1435
|
+
if (floatingUi_utils_dom.isHTMLElement(floatingFocusElement)) {
|
|
1435
1436
|
floatingFocusElement.focus();
|
|
1436
1437
|
}
|
|
1437
1438
|
const prevTabbableIndex = tabbableIndexRef.current;
|
|
1438
1439
|
const tabbableContent = getTabbableContent();
|
|
1439
1440
|
const nodeToFocus = tabbableContent[prevTabbableIndex] || tabbableContent[tabbableContent.length - 1] || floatingFocusElement;
|
|
1440
|
-
if (
|
|
1441
|
+
if (floatingUi_utils_dom.isHTMLElement(nodeToFocus)) {
|
|
1441
1442
|
nodeToFocus.focus();
|
|
1442
1443
|
}
|
|
1443
1444
|
}
|
|
@@ -1466,7 +1467,7 @@ function FloatingFocusManager(props) {
|
|
|
1466
1467
|
dataRef.current.insideReactTree = false;
|
|
1467
1468
|
});
|
|
1468
1469
|
}
|
|
1469
|
-
if (floating &&
|
|
1470
|
+
if (floating && floatingUi_utils_dom.isHTMLElement(domReference)) {
|
|
1470
1471
|
domReference.addEventListener('focusout', handleFocusOutside);
|
|
1471
1472
|
domReference.addEventListener('pointerdown', handlePointerDown);
|
|
1472
1473
|
floating.addEventListener('focusout', handleFocusOutside);
|
|
@@ -1506,7 +1507,7 @@ function FloatingFocusManager(props) {
|
|
|
1506
1507
|
};
|
|
1507
1508
|
}, [disabled, domReference, floating, modal, orderRef, portalContext, isUntrappedTypeableCombobox, guards, useInert, tree, getNodeId, getInsideElements]);
|
|
1508
1509
|
index(() => {
|
|
1509
|
-
if (disabled || !
|
|
1510
|
+
if (disabled || !floatingUi_utils_dom.isHTMLElement(floatingFocusElement)) return;
|
|
1510
1511
|
const doc = getDocument$1(floatingFocusElement);
|
|
1511
1512
|
const previouslyFocusedElement = activeElement(doc);
|
|
1512
1513
|
|
|
@@ -1588,7 +1589,7 @@ function FloatingFocusManager(props) {
|
|
|
1588
1589
|
const tabbableReturnElement = getFirstTabbableElement(returnElement);
|
|
1589
1590
|
if (
|
|
1590
1591
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1591
|
-
returnFocusRef.current && !preventReturnFocusRef.current &&
|
|
1592
|
+
returnFocusRef.current && !preventReturnFocusRef.current && floatingUi_utils_dom.isHTMLElement(tabbableReturnElement) && (
|
|
1592
1593
|
// If the focus moved somewhere else after mount, avoid returning focus
|
|
1593
1594
|
// since it likely entered a different element which should be
|
|
1594
1595
|
// respected: https://github.com/floating-ui/floating-ui/issues/2607
|
|
@@ -1779,10 +1780,10 @@ const FloatingOverlay = /*#__PURE__*/React__namespace.forwardRef(function Floati
|
|
|
1779
1780
|
});
|
|
1780
1781
|
|
|
1781
1782
|
function isButtonTarget(event) {
|
|
1782
|
-
return
|
|
1783
|
+
return floatingUi_utils_dom.isHTMLElement(event.target) && event.target.tagName === 'BUTTON';
|
|
1783
1784
|
}
|
|
1784
1785
|
function isAnchorTarget(event) {
|
|
1785
|
-
return
|
|
1786
|
+
return floatingUi_utils_dom.isHTMLElement(event.target) && event.target.tagName === 'A';
|
|
1786
1787
|
}
|
|
1787
1788
|
function isSpaceIgnored(element) {
|
|
1788
1789
|
return isTypeableElement(element);
|
|
@@ -2007,10 +2008,10 @@ function useDismiss(context, props) {
|
|
|
2007
2008
|
const target = getTarget(event);
|
|
2008
2009
|
const inertSelector = "[" + createAttribute('inert') + "]";
|
|
2009
2010
|
const markers = getDocument$1(elements.floating).querySelectorAll(inertSelector);
|
|
2010
|
-
let targetRootAncestor =
|
|
2011
|
-
while (targetRootAncestor && !
|
|
2012
|
-
const nextParent =
|
|
2013
|
-
if (
|
|
2011
|
+
let targetRootAncestor = floatingUi_utils_dom.isElement(target) ? target : null;
|
|
2012
|
+
while (targetRootAncestor && !floatingUi_utils_dom.isLastTraversableNode(targetRootAncestor)) {
|
|
2013
|
+
const nextParent = floatingUi_utils_dom.getParentNode(targetRootAncestor);
|
|
2014
|
+
if (floatingUi_utils_dom.isLastTraversableNode(nextParent) || !floatingUi_utils_dom.isElement(nextParent)) {
|
|
2014
2015
|
break;
|
|
2015
2016
|
}
|
|
2016
2017
|
targetRootAncestor = nextParent;
|
|
@@ -2018,7 +2019,7 @@ function useDismiss(context, props) {
|
|
|
2018
2019
|
|
|
2019
2020
|
// Check if the click occurred on a third-party element injected after the
|
|
2020
2021
|
// floating element rendered.
|
|
2021
|
-
if (markers.length &&
|
|
2022
|
+
if (markers.length && floatingUi_utils_dom.isElement(target) && !isRootElement(target) &&
|
|
2022
2023
|
// Clicked on a direct ancestor (e.g. FloatingOverlay).
|
|
2023
2024
|
!contains(target, elements.floating) &&
|
|
2024
2025
|
// If the target root element contains none of the markers, then the
|
|
@@ -2028,9 +2029,9 @@ function useDismiss(context, props) {
|
|
|
2028
2029
|
}
|
|
2029
2030
|
|
|
2030
2031
|
// Check if the click occurred on the scrollbar
|
|
2031
|
-
if (
|
|
2032
|
-
const lastTraversableNode =
|
|
2033
|
-
const style =
|
|
2032
|
+
if (floatingUi_utils_dom.isHTMLElement(target) && floating) {
|
|
2033
|
+
const lastTraversableNode = floatingUi_utils_dom.isLastTraversableNode(target);
|
|
2034
|
+
const style = floatingUi_utils_dom.getComputedStyle(target);
|
|
2034
2035
|
const scrollRe = /auto|scroll/;
|
|
2035
2036
|
const isScrollableX = lastTraversableNode || scrollRe.test(style.overflowX);
|
|
2036
2037
|
const isScrollableY = lastTraversableNode || scrollRe.test(style.overflowY);
|
|
@@ -2105,7 +2106,7 @@ function useDismiss(context, props) {
|
|
|
2105
2106
|
},
|
|
2106
2107
|
// 0ms or 1ms don't work in Safari. 5ms appears to consistently work.
|
|
2107
2108
|
// Only apply to WebKit for the test to remain 0ms.
|
|
2108
|
-
|
|
2109
|
+
floatingUi_utils_dom.isWebKit() ? 5 : 0);
|
|
2109
2110
|
}
|
|
2110
2111
|
const doc = getDocument$1(elements.floating);
|
|
2111
2112
|
if (escapeKey) {
|
|
@@ -2116,14 +2117,14 @@ function useDismiss(context, props) {
|
|
|
2116
2117
|
outsidePress && doc.addEventListener(outsidePressEvent, outsidePressCapture ? closeOnPressOutsideCapture : closeOnPressOutside, outsidePressCapture);
|
|
2117
2118
|
let ancestors = [];
|
|
2118
2119
|
if (ancestorScroll) {
|
|
2119
|
-
if (
|
|
2120
|
-
ancestors =
|
|
2120
|
+
if (floatingUi_utils_dom.isElement(elements.domReference)) {
|
|
2121
|
+
ancestors = floatingUi_utils_dom.getOverflowAncestors(elements.domReference);
|
|
2121
2122
|
}
|
|
2122
|
-
if (
|
|
2123
|
-
ancestors = ancestors.concat(
|
|
2123
|
+
if (floatingUi_utils_dom.isElement(elements.floating)) {
|
|
2124
|
+
ancestors = ancestors.concat(floatingUi_utils_dom.getOverflowAncestors(elements.floating));
|
|
2124
2125
|
}
|
|
2125
|
-
if (!
|
|
2126
|
-
ancestors = ancestors.concat(
|
|
2126
|
+
if (!floatingUi_utils_dom.isElement(elements.reference) && elements.reference && elements.reference.contextElement) {
|
|
2127
|
+
ancestors = ancestors.concat(floatingUi_utils_dom.getOverflowAncestors(elements.reference.contextElement));
|
|
2127
2128
|
}
|
|
2128
2129
|
}
|
|
2129
2130
|
|
|
@@ -2196,7 +2197,7 @@ function useFloatingRootContext(options) {
|
|
|
2196
2197
|
const nested = useFloatingParentNodeId() != null;
|
|
2197
2198
|
if (process.env.NODE_ENV !== "production") {
|
|
2198
2199
|
const optionDomReference = elementsProp.reference;
|
|
2199
|
-
if (optionDomReference && !
|
|
2200
|
+
if (optionDomReference && !floatingUi_utils_dom.isElement(optionDomReference)) {
|
|
2200
2201
|
error('Cannot pass a virtual element to the `elements.reference` option,', 'as it must be a real DOM element. Use `refs.setPositionReference()`', 'instead.');
|
|
2201
2202
|
}
|
|
2202
2203
|
}
|
|
@@ -2272,7 +2273,7 @@ function useFloating(options) {
|
|
|
2272
2273
|
}
|
|
2273
2274
|
});
|
|
2274
2275
|
const setPositionReference = React__namespace.useCallback(node => {
|
|
2275
|
-
const computedPositionReference =
|
|
2276
|
+
const computedPositionReference = floatingUi_utils_dom.isElement(node) ? {
|
|
2276
2277
|
getBoundingClientRect: () => node.getBoundingClientRect(),
|
|
2277
2278
|
getClientRects: () => node.getClientRects(),
|
|
2278
2279
|
contextElement: node
|
|
@@ -2283,18 +2284,18 @@ function useFloating(options) {
|
|
|
2283
2284
|
position.refs.setReference(computedPositionReference);
|
|
2284
2285
|
}, [position.refs]);
|
|
2285
2286
|
const setReference = React__namespace.useCallback(node => {
|
|
2286
|
-
if (
|
|
2287
|
+
if (floatingUi_utils_dom.isElement(node) || node === null) {
|
|
2287
2288
|
domReferenceRef.current = node;
|
|
2288
2289
|
setDomReference(node);
|
|
2289
2290
|
}
|
|
2290
2291
|
|
|
2291
2292
|
// Backwards-compatibility for passing a virtual element to `reference`
|
|
2292
2293
|
// after it has set the DOM reference.
|
|
2293
|
-
if (
|
|
2294
|
+
if (floatingUi_utils_dom.isElement(position.refs.reference.current) || position.refs.reference.current === null ||
|
|
2294
2295
|
// Don't allow setting virtual elements using the old technique back to
|
|
2295
2296
|
// `null` to support `positionReference` + an unstable `reference`
|
|
2296
2297
|
// callback ref.
|
|
2297
|
-
node !== null && !
|
|
2298
|
+
node !== null && !floatingUi_utils_dom.isElement(node)) {
|
|
2298
2299
|
position.refs.setReference(node);
|
|
2299
2300
|
}
|
|
2300
2301
|
}, [position.refs]);
|
|
@@ -2767,7 +2768,7 @@ function useListNavigation(context, props) {
|
|
|
2767
2768
|
stopEvent(event);
|
|
2768
2769
|
}
|
|
2769
2770
|
onOpenChange(false, event.nativeEvent, 'list-navigation');
|
|
2770
|
-
if (
|
|
2771
|
+
if (floatingUi_utils_dom.isHTMLElement(elements.domReference)) {
|
|
2771
2772
|
if (virtual) {
|
|
2772
2773
|
tree == null || tree.events.emit('virtualfocus', elements.domReference);
|
|
2773
2774
|
} else {
|