@jobber/components 7.1.2-MIKElock--7916eb4.2 → 7.2.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/AtlantisThemeContext-cjs.js +1 -1
- package/dist/AtlantisThemeContext-es.js +9 -9
- package/dist/Autocomplete/index.cjs +2 -2
- package/dist/Autocomplete/index.mjs +5 -5
- package/dist/Body-cjs.js +1 -1
- package/dist/Body-es.js +2 -2
- package/dist/BottomSheet-cjs.js +1 -1
- package/dist/BottomSheet-es.js +1 -1
- package/dist/Box-cjs.js +2 -2
- package/dist/Box-es.js +2 -2
- package/dist/Button/index.mjs +1 -1
- package/dist/Button-es.js +1 -1
- package/dist/Card-cjs.js +1 -1
- package/dist/Card-es.js +1 -1
- package/dist/Checkbox/index.cjs +1 -1
- package/dist/Checkbox/index.mjs +1 -1
- package/dist/Chip/Chip.d.ts +7 -1
- package/dist/Chip/Chip.types.d.ts +7 -2
- package/dist/Chip/index.cjs +1 -1
- package/dist/Chip/index.mjs +2 -2
- package/dist/Chip-cjs.js +42 -27
- package/dist/Chip-es.js +42 -27
- package/dist/ChipDismissible-es.js +1 -1
- package/dist/Chips/InternalChipDismissible/hooks/index.mjs +1 -1
- package/dist/Combobox/components/ComboboxTrigger/index.cjs +1 -1
- package/dist/Combobox/components/ComboboxTrigger/index.mjs +1 -1
- package/dist/Combobox-cjs.js +1 -1
- package/dist/Combobox-es.js +1 -1
- package/dist/ComboboxAction-cjs.js +1 -1
- package/dist/ComboboxAction-es.js +1 -1
- package/dist/ComboboxContent-cjs.js +1 -1
- package/dist/ComboboxContent-es.js +2 -2
- package/dist/ComboboxContentHeader-cjs.js +1 -1
- package/dist/ComboboxContentHeader-es.js +1 -1
- package/dist/ComboboxContentList-es.js +1 -1
- package/dist/ComboboxContentSearch-cjs.js +1 -1
- package/dist/ComboboxContentSearch-es.js +1 -1
- package/dist/ComboboxLoadMore-cjs.js +1 -1
- package/dist/ComboboxLoadMore-es.js +1 -1
- package/dist/ComboboxOption-cjs.js +1 -1
- package/dist/ComboboxOption-es.js +1 -1
- package/dist/Container-cjs.js +1 -1
- package/dist/Container-es.js +1 -1
- package/dist/Content-cjs.js +1 -1
- package/dist/Content-es.js +1 -1
- package/dist/ContentBlock-cjs.js +1 -1
- package/dist/ContentBlock-es.js +1 -1
- package/dist/Countdown-cjs.js +3 -7
- package/dist/Countdown-es.js +4 -8
- package/dist/Cover-cjs.js +1 -1
- package/dist/Cover-es.js +1 -1
- package/dist/DataList-es.js +3 -3
- package/dist/DataList.const-cjs.js +1 -0
- package/dist/DataList.const-es.js +2 -1
- package/dist/DataList.module-cjs.js +1 -1
- package/dist/DataList.module-es.js +1 -1
- package/dist/DataList.utils-es.js +6 -6
- package/dist/DataListAction-cjs.js +1 -1
- package/dist/DataListAction-es.js +1 -1
- package/dist/DataListActionsMenu-cjs.js +1 -1
- package/dist/DataListActionsMenu-es.js +2 -2
- package/dist/DataListBulkActions-cjs.js +1 -1
- package/dist/DataListBulkActions-es.js +1 -1
- package/dist/DataListEmptyState-cjs.js +1 -1
- package/dist/DataListEmptyState-es.js +1 -1
- package/dist/DataListHeaderTile-cjs.js +2 -2
- package/dist/DataListHeaderTile-es.js +2 -2
- package/dist/DataListItemActions-cjs.js +1 -1
- package/dist/DataListItemActions-es.js +2 -2
- package/dist/DataListLayoutActions-cjs.js +1 -1
- package/dist/DataListLayoutActions-es.js +2 -2
- package/dist/DataListLoadMore-cjs.js +1 -1
- package/dist/DataListLoadMore-es.js +1 -1
- package/dist/DataListLoadingState-cjs.js +1 -1
- package/dist/DataListLoadingState-es.js +2 -2
- package/dist/DataListOverflowFade-cjs.js +1 -1
- package/dist/DataListOverflowFade-es.js +1 -1
- package/dist/DataListSearch-cjs.js +1 -1
- package/dist/DataListSearch-es.js +1 -1
- package/dist/DataListSortingOptions-cjs.js +1 -1
- package/dist/DataListSortingOptions-es.js +1 -1
- package/dist/DataListStickyHeader-cjs.js +1 -1
- package/dist/DataListStickyHeader-es.js +1 -1
- package/dist/DataListTags-cjs.js +1 -1
- package/dist/DataListTags-es.js +1 -1
- package/dist/DataListTotalCount-cjs.js +1 -1
- package/dist/DataListTotalCount-es.js +2 -2
- package/dist/DataTable/index.mjs +1 -1
- package/dist/DataTable-cjs.js +3 -3
- package/dist/DataTable-es.js +5 -5
- package/dist/DataTableTable-cjs.js +2 -2
- package/dist/DataTableTable-es.js +3 -3
- package/dist/DatePicker-cjs.js +81 -266
- package/dist/DatePicker-es.js +83 -268
- package/dist/DayOfMonthSelect-cjs.js +5 -5
- package/dist/DayOfMonthSelect-es.js +6 -6
- package/dist/DescriptionList-cjs.js +1 -1
- package/dist/DescriptionList-es.js +1 -1
- package/dist/Disclosure-cjs.js +1 -1
- package/dist/Disclosure-es.js +1 -1
- package/dist/Divider-cjs.js +1 -1
- package/dist/Divider-es.js +1 -1
- package/dist/DrawerGrid-cjs.js +2 -2
- package/dist/DrawerGrid-es.js +2 -2
- package/dist/DrawerRoot-cjs.js +48 -10
- package/dist/DrawerRoot-es.js +50 -12
- package/dist/FeatureSwitch-cjs.js +1 -1
- package/dist/FeatureSwitch-es.js +1 -1
- package/dist/FormField/index.mjs +1 -1
- package/dist/FormField-cjs.js +1 -1
- package/dist/FormField-es.js +2 -2
- package/dist/FormatEmail-cjs.js +1 -1
- package/dist/FormatEmail-es.js +1 -1
- package/dist/FormatFile-cjs.js +6 -1
- package/dist/FormatFile-es.js +6 -1
- package/dist/Frame-cjs.js +1 -1
- package/dist/Frame-es.js +1 -1
- package/dist/Glimmer/index.mjs +1 -1
- package/dist/Glimmer-cjs.js +1 -1
- package/dist/Glimmer-es.js +2 -2
- package/dist/Grid-cjs.js +1 -1
- package/dist/Grid-es.js +1 -1
- package/dist/GridCell-cjs.js +1 -1
- package/dist/GridCell-es.js +1 -1
- package/dist/InputAvatar-cjs.js +1 -1
- package/dist/InputAvatar-es.js +1 -1
- package/dist/InputDate/index.mjs +1 -1
- package/dist/InputEmail/index.mjs +1 -1
- package/dist/InputFile-cjs.js +3 -8
- package/dist/InputFile-es.js +3 -8
- package/dist/InputNumber/index.cjs +59 -165
- package/dist/InputNumber/index.mjs +62 -168
- package/dist/InputPassword-es.js +1 -1
- package/dist/InputPhoneNumber/index.cjs +1 -1
- package/dist/InputPhoneNumber/index.mjs +2 -2
- package/dist/InputText/InputText.d.ts +70 -2
- package/dist/InputText/index.mjs +1 -1
- package/dist/InputTime/index.cjs +1 -0
- package/dist/InputTime/index.mjs +2 -1
- package/dist/InputValidation-cjs.js +1 -1
- package/dist/InputValidation-es.js +1 -1
- package/dist/InternalChipDismissible-cjs.js +2 -2
- package/dist/InternalChipDismissible-es.js +3 -3
- package/dist/LightBox-cjs.js +1 -1
- package/dist/LightBox-es.js +1 -1
- package/dist/Link-cjs.js +1 -1
- package/dist/Link-es.js +1 -1
- package/dist/List-cjs.js +3 -3
- package/dist/List-es.js +7 -7
- package/dist/Markdown-cjs.js +392 -466
- package/dist/Markdown-es.js +398 -472
- package/dist/Menu-cjs.js +577 -739
- package/dist/Menu-es.js +573 -735
- package/dist/Modal/index.cjs +2 -2
- package/dist/Modal/index.mjs +2 -2
- package/dist/MultiSelect-cjs.js +2 -2
- package/dist/MultiSelect-es.js +2 -2
- package/dist/OverlaySeparator-cjs.js +1 -1
- package/dist/OverlaySeparator-es.js +1 -1
- package/dist/Popover-cjs.js +1 -1
- package/dist/Popover-es.js +2 -2
- package/dist/ProgressBar-cjs.js +1 -1
- package/dist/ProgressBar-es.js +1 -1
- package/dist/RadioGroup-cjs.js +1 -1
- package/dist/RadioGroup-es.js +1 -1
- package/dist/RecurringSelect/components/index.mjs +1 -1
- package/dist/RecurringSelect/index.cjs +0 -1
- package/dist/RecurringSelect/index.mjs +0 -1
- package/dist/RecurringSelect-cjs.js +1 -1
- package/dist/RecurringSelect-es.js +2 -2
- package/dist/SegmentedControl-cjs.js +1 -1
- package/dist/SegmentedControl-es.js +2 -2
- package/dist/Select/index.cjs +1 -1
- package/dist/Select/index.mjs +2 -2
- package/dist/SideDrawer-cjs.js +1 -1
- package/dist/SideDrawer-es.js +1 -1
- package/dist/Spinner-cjs.js +1 -1
- package/dist/Spinner-es.js +1 -1
- package/dist/StatusIndicator-cjs.js +1 -1
- package/dist/StatusIndicator-es.js +1 -1
- package/dist/Switch-cjs.js +1 -1
- package/dist/Switch-es.js +1 -1
- package/dist/Table/index.mjs +1 -1
- package/dist/Tabs/index.mjs +1 -1
- package/dist/Tabs-cjs.js +1 -1
- package/dist/Tabs-es.js +6 -6
- package/dist/Text-cjs2.js +164 -298
- package/dist/Text-es2.js +164 -295
- package/dist/Thumbnail-cjs.js +1 -1
- package/dist/Thumbnail-es.js +2 -2
- package/dist/Tiles-cjs.js +1 -1
- package/dist/Tiles-es.js +1 -1
- package/dist/Tooltip-cjs.js +1 -1
- package/dist/Tooltip-es.js +2 -2
- package/dist/Typography-cjs.js +3 -3
- package/dist/Typography-es.js +3 -3
- package/dist/_baseEach-cjs.js +1 -1
- package/dist/_baseEach-es.js +7 -7
- package/dist/_baseFlatten-es.js +1 -1
- package/dist/_getAllKeys-cjs.js +8 -2
- package/dist/_getAllKeys-es.js +10 -4
- package/dist/_getTag-es.js +1 -1
- package/dist/_isIterateeCall-es.js +3 -3
- package/dist/_setToString-es.js +2 -2
- package/dist/debounce-es.js +4 -4
- package/dist/docs/Autocomplete/AutocompleteV1.md +1 -1
- package/dist/docs/Autocomplete/AutocompleteV2.md +1 -1
- package/dist/docs/Banner/Banner.md +1 -1
- package/dist/docs/Chip/Chip.md +4 -2
- package/dist/docs/DataList/DataList.md +1 -1
- package/dist/docs/FormField/FormField.md +2 -2
- package/dist/docs/InputEmail/InputEmail.md +1 -1
- package/dist/docs/InputNumber/InputNumber.md +2 -2
- package/dist/docs/InputPhoneNumber/InputPhoneNumber.md +1 -1
- package/dist/docs/InputText/InputText.md +2 -2
- package/dist/docs/Modal/Modal.md +3 -3
- package/dist/docs/Select/Select.md +2 -2
- package/dist/floating-ui.react-cjs.js +16 -35
- package/dist/floating-ui.react-dom-es.js +2 -2
- package/dist/floating-ui.react-es.js +18 -37
- package/dist/identity-es.js +5 -5
- package/dist/index-cjs.js +6 -6
- package/dist/index-es.js +6 -6
- package/dist/index.esm-es.js +1 -1
- package/dist/index.mjs +6 -6
- package/dist/isSymbol-es.js +1 -1
- package/dist/isTypedArray-cjs.js +4 -4
- package/dist/isTypedArray-es.js +6 -6
- package/dist/keysIn-cjs.js +2 -2
- package/dist/keysIn-es.js +5 -5
- package/dist/noop-es.js +4 -4
- package/dist/omit-cjs.js +5 -37
- package/dist/omit-es.js +14 -46
- package/dist/showToast-cjs.js +1 -1
- package/dist/showToast-es.js +1 -1
- package/dist/styles.css +117 -54
- package/dist/unstyledPrimitives/index.mjs +3 -3
- package/dist/useScrollToActive-cjs.js +1 -1
- package/dist/useScrollToActive-es.js +8 -8
- package/package.json +3 -4
package/dist/Menu-cjs.js
CHANGED
|
@@ -217,6 +217,109 @@ function $dfc540311bf7f109$export$4d0f8be8b12a7ef6(doc, root, whatToShow, filter
|
|
|
217
217
|
return doc.createTreeWalker(root, whatToShow, filter);
|
|
218
218
|
}
|
|
219
219
|
|
|
220
|
+
/*
|
|
221
|
+
* Copyright 2023 Adobe. All rights reserved.
|
|
222
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
223
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
224
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
225
|
+
*
|
|
226
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
227
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
228
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
229
|
+
* governing permissions and limitations under the License.
|
|
230
|
+
*/
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
const $ea8dcbcb9ea1b556$var$RouterContext = /*#__PURE__*/ (React.createContext)({
|
|
234
|
+
isNative: true,
|
|
235
|
+
open: $ea8dcbcb9ea1b556$var$openSyntheticLink,
|
|
236
|
+
useHref: (href)=>href
|
|
237
|
+
});
|
|
238
|
+
function $ea8dcbcb9ea1b556$export$9a302a45f65d0572() {
|
|
239
|
+
return (React.useContext)($ea8dcbcb9ea1b556$var$RouterContext);
|
|
240
|
+
}
|
|
241
|
+
function $ea8dcbcb9ea1b556$export$efa8c9099e530235(link, modifiers) {
|
|
242
|
+
// Use getAttribute here instead of link.target. Firefox will default link.target to "_parent" when inside an iframe.
|
|
243
|
+
let target = link.getAttribute('target');
|
|
244
|
+
return (!target || target === '_self') && link.origin === location.origin && !link.hasAttribute('download') && !modifiers.metaKey && // open in new tab (mac)
|
|
245
|
+
!modifiers.ctrlKey && // open in new tab (windows)
|
|
246
|
+
!modifiers.altKey && // download
|
|
247
|
+
!modifiers.shiftKey;
|
|
248
|
+
}
|
|
249
|
+
function $ea8dcbcb9ea1b556$export$95185d699e05d4d7(target, modifiers, setOpening = true) {
|
|
250
|
+
var _window_event_type, _window_event;
|
|
251
|
+
let { metaKey: metaKey, ctrlKey: ctrlKey, altKey: altKey, shiftKey: shiftKey } = modifiers;
|
|
252
|
+
// Firefox does not recognize keyboard events as a user action by default, and the popup blocker
|
|
253
|
+
// will prevent links with target="_blank" from opening. However, it does allow the event if the
|
|
254
|
+
// Command/Control key is held, which opens the link in a background tab. This seems like the best we can do.
|
|
255
|
+
// See https://bugzilla.mozilla.org/show_bug.cgi?id=257870 and https://bugzilla.mozilla.org/show_bug.cgi?id=746640.
|
|
256
|
+
if ((Text.$c87311424ea30a05$export$b7d78993b74f766d)() && ((_window_event = window.event) === null || _window_event === void 0 ? void 0 : (_window_event_type = _window_event.type) === null || _window_event_type === void 0 ? void 0 : _window_event_type.startsWith('key')) && target.target === '_blank') {
|
|
257
|
+
if ((Text.$c87311424ea30a05$export$9ac100e40613ea10)()) metaKey = true;
|
|
258
|
+
else ctrlKey = true;
|
|
259
|
+
}
|
|
260
|
+
// WebKit does not support firing click events with modifier keys, but does support keyboard events.
|
|
261
|
+
// https://github.com/WebKit/WebKit/blob/c03d0ac6e6db178f90923a0a63080b5ca210d25f/Source/WebCore/html/HTMLAnchorElement.cpp#L184
|
|
262
|
+
let event = (Text.$c87311424ea30a05$export$78551043582a6a98)() && (Text.$c87311424ea30a05$export$9ac100e40613ea10)() && !(Text.$c87311424ea30a05$export$7bef049ce92e4224)() && process.env.NODE_ENV !== 'test' ? new KeyboardEvent('keydown', {
|
|
263
|
+
keyIdentifier: 'Enter',
|
|
264
|
+
metaKey: metaKey,
|
|
265
|
+
ctrlKey: ctrlKey,
|
|
266
|
+
altKey: altKey,
|
|
267
|
+
shiftKey: shiftKey
|
|
268
|
+
}) : new MouseEvent('click', {
|
|
269
|
+
metaKey: metaKey,
|
|
270
|
+
ctrlKey: ctrlKey,
|
|
271
|
+
altKey: altKey,
|
|
272
|
+
shiftKey: shiftKey,
|
|
273
|
+
bubbles: true,
|
|
274
|
+
cancelable: true
|
|
275
|
+
});
|
|
276
|
+
$ea8dcbcb9ea1b556$export$95185d699e05d4d7.isOpening = setOpening;
|
|
277
|
+
(Text.$7215afc6de606d6b$export$de79e2c695e052f3)(target);
|
|
278
|
+
target.dispatchEvent(event);
|
|
279
|
+
$ea8dcbcb9ea1b556$export$95185d699e05d4d7.isOpening = false;
|
|
280
|
+
}
|
|
281
|
+
// https://github.com/parcel-bundler/parcel/issues/8724
|
|
282
|
+
$ea8dcbcb9ea1b556$export$95185d699e05d4d7.isOpening = false;
|
|
283
|
+
function $ea8dcbcb9ea1b556$var$getSyntheticLink(target, open) {
|
|
284
|
+
if (target instanceof HTMLAnchorElement) open(target);
|
|
285
|
+
else if (target.hasAttribute('data-href')) {
|
|
286
|
+
let link = document.createElement('a');
|
|
287
|
+
link.href = target.getAttribute('data-href');
|
|
288
|
+
if (target.hasAttribute('data-target')) link.target = target.getAttribute('data-target');
|
|
289
|
+
if (target.hasAttribute('data-rel')) link.rel = target.getAttribute('data-rel');
|
|
290
|
+
if (target.hasAttribute('data-download')) link.download = target.getAttribute('data-download');
|
|
291
|
+
if (target.hasAttribute('data-ping')) link.ping = target.getAttribute('data-ping');
|
|
292
|
+
if (target.hasAttribute('data-referrer-policy')) link.referrerPolicy = target.getAttribute('data-referrer-policy');
|
|
293
|
+
target.appendChild(link);
|
|
294
|
+
open(link);
|
|
295
|
+
target.removeChild(link);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
function $ea8dcbcb9ea1b556$var$openSyntheticLink(target, modifiers) {
|
|
299
|
+
$ea8dcbcb9ea1b556$var$getSyntheticLink(target, (link)=>$ea8dcbcb9ea1b556$export$95185d699e05d4d7(link, modifiers));
|
|
300
|
+
}
|
|
301
|
+
function $ea8dcbcb9ea1b556$export$7e924b3091a3bd18(props) {
|
|
302
|
+
let router = $ea8dcbcb9ea1b556$export$9a302a45f65d0572();
|
|
303
|
+
var _props_href;
|
|
304
|
+
const href = router.useHref((_props_href = props === null || props === void 0 ? void 0 : props.href) !== null && _props_href !== void 0 ? _props_href : '');
|
|
305
|
+
return {
|
|
306
|
+
href: (props === null || props === void 0 ? void 0 : props.href) ? href : undefined,
|
|
307
|
+
target: props === null || props === void 0 ? void 0 : props.target,
|
|
308
|
+
rel: props === null || props === void 0 ? void 0 : props.rel,
|
|
309
|
+
download: props === null || props === void 0 ? void 0 : props.download,
|
|
310
|
+
ping: props === null || props === void 0 ? void 0 : props.ping,
|
|
311
|
+
referrerPolicy: props === null || props === void 0 ? void 0 : props.referrerPolicy
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
function $ea8dcbcb9ea1b556$export$13aea1a3cb5e3f1f(e, router, href, routerOptions) {
|
|
315
|
+
// If a custom router is provided, prevent default and forward if this link should client navigate.
|
|
316
|
+
if (!router.isNative && e.currentTarget instanceof HTMLAnchorElement && e.currentTarget.href && // If props are applied to a router Link component, it may have already prevented default.
|
|
317
|
+
!e.isDefaultPrevented() && $ea8dcbcb9ea1b556$export$efa8c9099e530235(e.currentTarget, e) && href) {
|
|
318
|
+
e.preventDefault();
|
|
319
|
+
router.open(e.currentTarget, e, href, routerOptions);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
|
|
220
323
|
/*
|
|
221
324
|
* Copyright 2024 Adobe. All rights reserved.
|
|
222
325
|
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
@@ -250,22 +353,19 @@ function $9daab02d461809db$var$hasResizeObserver() {
|
|
|
250
353
|
return typeof window.ResizeObserver !== 'undefined';
|
|
251
354
|
}
|
|
252
355
|
function $9daab02d461809db$export$683480f191c0e3ea(options) {
|
|
253
|
-
// Only call onResize from inside the effect, otherwise we'll void our assumption that
|
|
254
|
-
// useEffectEvents are safe to pass in.
|
|
255
356
|
const { ref: ref, box: box, onResize: onResize } = options;
|
|
256
|
-
let onResizeEvent = (Text.$8ae05eaa5c114e9c$export$7f54fc3180508a52)(onResize);
|
|
257
357
|
(React.useEffect)(()=>{
|
|
258
358
|
let element = ref === null || ref === void 0 ? void 0 : ref.current;
|
|
259
359
|
if (!element) return;
|
|
260
360
|
if (!$9daab02d461809db$var$hasResizeObserver()) {
|
|
261
|
-
window.addEventListener('resize',
|
|
361
|
+
window.addEventListener('resize', onResize, false);
|
|
262
362
|
return ()=>{
|
|
263
|
-
window.removeEventListener('resize',
|
|
363
|
+
window.removeEventListener('resize', onResize, false);
|
|
264
364
|
};
|
|
265
365
|
} else {
|
|
266
366
|
const resizeObserverInstance = new window.ResizeObserver((entries)=>{
|
|
267
367
|
if (!entries.length) return;
|
|
268
|
-
|
|
368
|
+
onResize();
|
|
269
369
|
});
|
|
270
370
|
resizeObserverInstance.observe(element, {
|
|
271
371
|
box: box
|
|
@@ -275,6 +375,7 @@ function $9daab02d461809db$export$683480f191c0e3ea(options) {
|
|
|
275
375
|
};
|
|
276
376
|
}
|
|
277
377
|
}, [
|
|
378
|
+
onResize,
|
|
278
379
|
ref,
|
|
279
380
|
box
|
|
280
381
|
]);
|
|
@@ -293,10 +394,7 @@ function $9daab02d461809db$export$683480f191c0e3ea(options) {
|
|
|
293
394
|
*/ function $cc38e7bd3fc7b213$export$2bb74740c4e19def(node, checkForOverflow) {
|
|
294
395
|
if (!node) return false;
|
|
295
396
|
let style = window.getComputedStyle(node);
|
|
296
|
-
let root = document.scrollingElement || document.documentElement;
|
|
297
397
|
let isScrollable = /(auto|scroll)/.test(style.overflow + style.overflowX + style.overflowY);
|
|
298
|
-
// Root element has `visible` overflow by default, but is scrollable nonetheless.
|
|
299
|
-
if (node === root && style.overflow !== 'hidden') isScrollable = true;
|
|
300
398
|
if (isScrollable && checkForOverflow) isScrollable = node.scrollHeight !== node.clientHeight || node.scrollWidth !== node.clientWidth;
|
|
301
399
|
return isScrollable;
|
|
302
400
|
}
|
|
@@ -331,44 +429,12 @@ function $62d8ded9296f3872$export$cfa2225e87938781(node, checkForOverflow) {
|
|
|
331
429
|
* governing permissions and limitations under the License.
|
|
332
430
|
*/
|
|
333
431
|
function $a40c673dc9f6d9c7$export$94ed1c92c7beeb22(node, checkForOverflow) {
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
if (($cc38e7bd3fc7b213$export$2bb74740c4e19def)(node, checkForOverflow)) parentElements.push(node);
|
|
432
|
+
const scrollParents = [];
|
|
433
|
+
while(node && node !== document.documentElement){
|
|
434
|
+
if (($cc38e7bd3fc7b213$export$2bb74740c4e19def)(node, checkForOverflow)) scrollParents.push(node);
|
|
338
435
|
node = node.parentElement;
|
|
339
|
-
}
|
|
340
|
-
return
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
/*
|
|
344
|
-
* Copyright 2024 Adobe. All rights reserved.
|
|
345
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
346
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
347
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
348
|
-
*
|
|
349
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
350
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
351
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
352
|
-
* governing permissions and limitations under the License.
|
|
353
|
-
*/
|
|
354
|
-
function $21f1aa98acb08317$export$16792effe837dba3(e) {
|
|
355
|
-
if ((Text.$c87311424ea30a05$export$9ac100e40613ea10)()) return e.metaKey;
|
|
356
|
-
return e.ctrlKey;
|
|
357
|
-
}
|
|
358
|
-
// HTML input types that do not cause the software keyboard to appear.
|
|
359
|
-
const $21f1aa98acb08317$var$nonTextInputTypes = new Set([
|
|
360
|
-
'checkbox',
|
|
361
|
-
'radio',
|
|
362
|
-
'range',
|
|
363
|
-
'color',
|
|
364
|
-
'file',
|
|
365
|
-
'image',
|
|
366
|
-
'button',
|
|
367
|
-
'submit',
|
|
368
|
-
'reset'
|
|
369
|
-
]);
|
|
370
|
-
function $21f1aa98acb08317$export$c57958e35f31ed73(target) {
|
|
371
|
-
return target instanceof HTMLInputElement && !$21f1aa98acb08317$var$nonTextInputTypes.has(target.type) || target instanceof HTMLTextAreaElement || target instanceof HTMLElement && target.isContentEditable;
|
|
436
|
+
}
|
|
437
|
+
return scrollParents;
|
|
372
438
|
}
|
|
373
439
|
|
|
374
440
|
/*
|
|
@@ -430,84 +496,59 @@ function $ef06256079686ba0$export$f8aeda7b10753fa1(description) {
|
|
|
430
496
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
431
497
|
* governing permissions and limitations under the License.
|
|
432
498
|
*/
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
let
|
|
436
|
-
|
|
437
|
-
let
|
|
499
|
+
function $2f04cbc44ee30ce0$export$53a0910f038337bd(scrollView, element) {
|
|
500
|
+
let offsetX = $2f04cbc44ee30ce0$var$relativeOffset(scrollView, element, 'left');
|
|
501
|
+
let offsetY = $2f04cbc44ee30ce0$var$relativeOffset(scrollView, element, 'top');
|
|
502
|
+
let width = element.offsetWidth;
|
|
503
|
+
let height = element.offsetHeight;
|
|
438
504
|
let x = scrollView.scrollLeft;
|
|
439
|
-
let
|
|
440
|
-
|
|
441
|
-
let
|
|
442
|
-
let
|
|
443
|
-
let
|
|
444
|
-
|
|
445
|
-
let
|
|
446
|
-
let
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
let
|
|
450
|
-
let
|
|
451
|
-
let
|
|
452
|
-
let
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
let borderRightWidth = parseInt(viewStyle.borderRightWidth, 10) || 0;
|
|
460
|
-
let scrollAreaTop = target.top - scrollMarginTop;
|
|
461
|
-
let scrollAreaBottom = target.bottom + scrollMarginBottom;
|
|
462
|
-
let scrollAreaLeft = target.left - scrollMarginLeft;
|
|
463
|
-
let scrollAreaRight = target.right + scrollMarginRight;
|
|
464
|
-
let scrollBarOffsetX = scrollView === root ? 0 : borderLeftWidth + borderRightWidth;
|
|
465
|
-
let scrollBarOffsetY = scrollView === root ? 0 : borderTopWidth + borderBottomWidth;
|
|
466
|
-
let scrollBarWidth = scrollView.offsetWidth - scrollView.clientWidth - scrollBarOffsetX;
|
|
467
|
-
let scrollBarHeight = scrollView.offsetHeight - scrollView.clientHeight - scrollBarOffsetY;
|
|
468
|
-
let scrollPortTop = viewTop + borderTopWidth + scrollPaddingTop;
|
|
469
|
-
let scrollPortBottom = viewBottom - borderBottomWidth - scrollPaddingBottom - scrollBarHeight;
|
|
470
|
-
let scrollPortLeft = viewLeft + borderLeftWidth + scrollPaddingLeft;
|
|
471
|
-
let scrollPortRight = viewRight - borderRightWidth - scrollPaddingRight;
|
|
472
|
-
// IOS always positions the scrollbar on the right ¯\_(ツ)_/¯
|
|
473
|
-
if (viewStyle.direction === 'rtl' && !(Text.$c87311424ea30a05$export$fedb369cb70207f1)()) scrollPortLeft += scrollBarWidth;
|
|
474
|
-
else scrollPortRight -= scrollBarWidth;
|
|
475
|
-
let shouldScrollBlock = scrollAreaTop < scrollPortTop || scrollAreaBottom > scrollPortBottom;
|
|
476
|
-
let shouldScrollInline = scrollAreaLeft < scrollPortLeft || scrollAreaRight > scrollPortRight;
|
|
477
|
-
if (shouldScrollBlock && block === 'start') y += scrollAreaTop - scrollPortTop;
|
|
478
|
-
else if (shouldScrollBlock && block === 'center') y += (scrollAreaTop + scrollAreaBottom) / 2 - (scrollPortTop + scrollPortBottom) / 2;
|
|
479
|
-
else if (shouldScrollBlock && block === 'end') y += scrollAreaBottom - scrollPortBottom;
|
|
480
|
-
else if (shouldScrollBlock && block === 'nearest') {
|
|
481
|
-
let start = scrollAreaTop - scrollPortTop;
|
|
482
|
-
let end = scrollAreaBottom - scrollPortBottom;
|
|
483
|
-
y += Math.abs(start) <= Math.abs(end) ? start : end;
|
|
484
|
-
}
|
|
485
|
-
if (shouldScrollInline && inline === 'start') x += scrollAreaLeft - scrollPortLeft;
|
|
486
|
-
else if (shouldScrollInline && inline === 'center') x += (scrollAreaLeft + scrollAreaRight) / 2 - (scrollPortLeft + scrollPortRight) / 2;
|
|
487
|
-
else if (shouldScrollInline && inline === 'end') x += scrollAreaRight - scrollPortRight;
|
|
488
|
-
else if (shouldScrollInline && inline === 'nearest') {
|
|
489
|
-
let start = scrollAreaLeft - scrollPortLeft;
|
|
490
|
-
let end = scrollAreaRight - scrollPortRight;
|
|
491
|
-
x += Math.abs(start) <= Math.abs(end) ? start : end;
|
|
492
|
-
}
|
|
493
|
-
if (process.env.NODE_ENV === 'test') {
|
|
494
|
-
scrollView.scrollLeft = x;
|
|
495
|
-
scrollView.scrollTop = y;
|
|
496
|
-
return;
|
|
497
|
-
}
|
|
498
|
-
scrollView.scrollTo({
|
|
499
|
-
left: x,
|
|
500
|
-
top: y
|
|
501
|
-
});
|
|
505
|
+
let y = scrollView.scrollTop;
|
|
506
|
+
// Account for top/left border offsetting the scroll top/Left + scroll padding
|
|
507
|
+
let { borderTopWidth: borderTopWidth, borderLeftWidth: borderLeftWidth, scrollPaddingTop: scrollPaddingTop, scrollPaddingRight: scrollPaddingRight, scrollPaddingBottom: scrollPaddingBottom, scrollPaddingLeft: scrollPaddingLeft } = getComputedStyle(scrollView);
|
|
508
|
+
let borderAdjustedX = x + parseInt(borderLeftWidth, 10);
|
|
509
|
+
let borderAdjustedY = y + parseInt(borderTopWidth, 10);
|
|
510
|
+
// Ignore end/bottom border via clientHeight/Width instead of offsetHeight/Width
|
|
511
|
+
let maxX = borderAdjustedX + scrollView.clientWidth;
|
|
512
|
+
let maxY = borderAdjustedY + scrollView.clientHeight;
|
|
513
|
+
// Get scroll padding values as pixels - defaults to 0 if no scroll padding
|
|
514
|
+
// is used.
|
|
515
|
+
let scrollPaddingTopNumber = parseInt(scrollPaddingTop, 10) || 0;
|
|
516
|
+
let scrollPaddingBottomNumber = parseInt(scrollPaddingBottom, 10) || 0;
|
|
517
|
+
let scrollPaddingRightNumber = parseInt(scrollPaddingRight, 10) || 0;
|
|
518
|
+
let scrollPaddingLeftNumber = parseInt(scrollPaddingLeft, 10) || 0;
|
|
519
|
+
if (offsetX <= x + scrollPaddingLeftNumber) x = offsetX - parseInt(borderLeftWidth, 10) - scrollPaddingLeftNumber;
|
|
520
|
+
else if (offsetX + width > maxX - scrollPaddingRightNumber) x += offsetX + width - maxX + scrollPaddingRightNumber;
|
|
521
|
+
if (offsetY <= borderAdjustedY + scrollPaddingTopNumber) y = offsetY - parseInt(borderTopWidth, 10) - scrollPaddingTopNumber;
|
|
522
|
+
else if (offsetY + height > maxY - scrollPaddingBottomNumber) y += offsetY + height - maxY + scrollPaddingBottomNumber;
|
|
523
|
+
scrollView.scrollLeft = x;
|
|
524
|
+
scrollView.scrollTop = y;
|
|
502
525
|
}
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
526
|
+
/**
|
|
527
|
+
* Computes the offset left or top from child to ancestor by accumulating
|
|
528
|
+
* offsetLeft or offsetTop through intervening offsetParents.
|
|
529
|
+
*/ function $2f04cbc44ee30ce0$var$relativeOffset(ancestor, child, axis) {
|
|
530
|
+
const prop = axis === 'left' ? 'offsetLeft' : 'offsetTop';
|
|
531
|
+
let sum = 0;
|
|
532
|
+
while(child.offsetParent){
|
|
533
|
+
sum += child[prop];
|
|
534
|
+
if (child.offsetParent === ancestor) break;
|
|
535
|
+
else if (child.offsetParent.contains(ancestor)) {
|
|
536
|
+
// If the ancestor is not `position:relative`, then we stop at
|
|
537
|
+
// _its_ offset parent, and we subtract off _its_ offset, so that
|
|
538
|
+
// we end up with the proper offset from child to ancestor.
|
|
539
|
+
sum -= ancestor[prop];
|
|
540
|
+
break;
|
|
541
|
+
}
|
|
542
|
+
child = child.offsetParent;
|
|
543
|
+
}
|
|
544
|
+
return sum;
|
|
545
|
+
}
|
|
546
|
+
function $2f04cbc44ee30ce0$export$c826860796309d1b(targetElement, opts) {
|
|
547
|
+
if (targetElement && document.contains(targetElement)) {
|
|
506
548
|
let root = document.scrollingElement || document.documentElement;
|
|
507
549
|
let isScrollPrevented = window.getComputedStyle(root).overflow === 'hidden';
|
|
508
|
-
// If scrolling is not currently prevented then we aren
|
|
509
|
-
|
|
510
|
-
if (!isScrollPrevented && !(Text.$c87311424ea30a05$export$6446a186d09e379e)()) {
|
|
550
|
+
// If scrolling is not currently prevented then we aren’t in a overlay nor is a overlay open, just use element.scrollIntoView to bring the element into view
|
|
551
|
+
if (!isScrollPrevented) {
|
|
511
552
|
var // use scrollIntoView({block: 'nearest'}) instead of .focus to check if the element is fully in view or not since .focus()
|
|
512
553
|
// won't cause a scroll if the element is already focused and doesn't behave consistently when an element is partially out of view horizontally vs vertically
|
|
513
554
|
_targetElement_scrollIntoView;
|
|
@@ -518,8 +559,8 @@ function $2f04cbc44ee30ce0$export$c826860796309d1b(targetElement, opts = {}) {
|
|
|
518
559
|
let { left: newLeft, top: newTop } = targetElement.getBoundingClientRect();
|
|
519
560
|
// Account for sub pixel differences from rounding
|
|
520
561
|
if (Math.abs(originalLeft - newLeft) > 1 || Math.abs(originalTop - newTop) > 1) {
|
|
521
|
-
var
|
|
522
|
-
|
|
562
|
+
var _opts_containingElement_scrollIntoView, _opts_containingElement, _targetElement_scrollIntoView1;
|
|
563
|
+
opts === null || opts === void 0 ? void 0 : (_opts_containingElement = opts.containingElement) === null || _opts_containingElement === void 0 ? void 0 : (_opts_containingElement_scrollIntoView = _opts_containingElement.scrollIntoView) === null || _opts_containingElement_scrollIntoView === void 0 ? void 0 : _opts_containingElement_scrollIntoView.call(_opts_containingElement, {
|
|
523
564
|
block: 'center',
|
|
524
565
|
inline: 'center'
|
|
525
566
|
});
|
|
@@ -528,19 +569,9 @@ function $2f04cbc44ee30ce0$export$c826860796309d1b(targetElement, opts = {}) {
|
|
|
528
569
|
});
|
|
529
570
|
}
|
|
530
571
|
} else {
|
|
531
|
-
let
|
|
572
|
+
let scrollParents = ($a40c673dc9f6d9c7$export$94ed1c92c7beeb22)(targetElement);
|
|
532
573
|
// If scrolling is prevented, we don't want to scroll the body since it might move the overlay partially offscreen and the user can't scroll it back into view.
|
|
533
|
-
let scrollParents = ($a40c673dc9f6d9c7$export$94ed1c92c7beeb22)(targetElement, true);
|
|
534
574
|
for (let scrollParent of scrollParents)$2f04cbc44ee30ce0$export$53a0910f038337bd(scrollParent, targetElement);
|
|
535
|
-
let { left: newLeft, top: newTop } = targetElement.getBoundingClientRect();
|
|
536
|
-
// Account for sub pixel differences from rounding
|
|
537
|
-
if (Math.abs(originalLeft - newLeft) > 1 || Math.abs(originalTop - newTop) > 1) {
|
|
538
|
-
scrollParents = containingElement ? ($a40c673dc9f6d9c7$export$94ed1c92c7beeb22)(containingElement, true) : [];
|
|
539
|
-
for (let scrollParent of scrollParents)$2f04cbc44ee30ce0$export$53a0910f038337bd(scrollParent, containingElement, {
|
|
540
|
-
block: 'center',
|
|
541
|
-
inline: 'center'
|
|
542
|
-
});
|
|
543
|
-
}
|
|
544
575
|
}
|
|
545
576
|
}
|
|
546
577
|
}
|
|
@@ -559,6 +590,22 @@ function $2f04cbc44ee30ce0$export$c826860796309d1b(targetElement, opts = {}) {
|
|
|
559
590
|
const $5671b20cf9b562b2$export$447a38995de2c711 = 'react-aria-clear-focus';
|
|
560
591
|
const $5671b20cf9b562b2$export$831c820ad60f9d12 = 'react-aria-focus';
|
|
561
592
|
|
|
593
|
+
/*
|
|
594
|
+
* Copyright 2024 Adobe. All rights reserved.
|
|
595
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
596
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
597
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
598
|
+
*
|
|
599
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
600
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
601
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
602
|
+
* governing permissions and limitations under the License.
|
|
603
|
+
*/
|
|
604
|
+
function $21f1aa98acb08317$export$16792effe837dba3(e) {
|
|
605
|
+
if ((Text.$c87311424ea30a05$export$9ac100e40613ea10)()) return e.metaKey;
|
|
606
|
+
return e.ctrlKey;
|
|
607
|
+
}
|
|
608
|
+
|
|
562
609
|
/*
|
|
563
610
|
* Copyright 2020 Adobe. All rights reserved.
|
|
564
611
|
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
@@ -679,31 +726,28 @@ const $edcf132a9284368a$var$TOTAL_SIZE = {
|
|
|
679
726
|
height: 'totalHeight'
|
|
680
727
|
};
|
|
681
728
|
const $edcf132a9284368a$var$PARSED_PLACEMENT_CACHE = {};
|
|
682
|
-
let $edcf132a9284368a$var$
|
|
683
|
-
function $edcf132a9284368a$var$getContainerDimensions(containerNode
|
|
729
|
+
let $edcf132a9284368a$var$visualViewport = typeof document !== 'undefined' ? window.visualViewport : null;
|
|
730
|
+
function $edcf132a9284368a$var$getContainerDimensions(containerNode) {
|
|
684
731
|
let width = 0, height = 0, totalWidth = 0, totalHeight = 0, top = 0, left = 0;
|
|
685
732
|
let scroll = {};
|
|
686
733
|
var _visualViewport_scale;
|
|
687
|
-
let isPinchZoomedIn = ((_visualViewport_scale = visualViewport === null || visualViewport === void 0 ? void 0 : visualViewport.scale) !== null && _visualViewport_scale !== void 0 ? _visualViewport_scale : 1) > 1;
|
|
688
|
-
|
|
689
|
-
// then position absolute will be positioned relative to the viewport, also known as the `initial containing block`.
|
|
690
|
-
// That's why we use the visual viewport instead.
|
|
691
|
-
if (containerNode.tagName === 'BODY' || containerNode.tagName === 'HTML') {
|
|
734
|
+
let isPinchZoomedIn = ((_visualViewport_scale = $edcf132a9284368a$var$visualViewport === null || $edcf132a9284368a$var$visualViewport === void 0 ? void 0 : $edcf132a9284368a$var$visualViewport.scale) !== null && _visualViewport_scale !== void 0 ? _visualViewport_scale : 1) > 1;
|
|
735
|
+
if (containerNode.tagName === 'BODY') {
|
|
692
736
|
let documentElement = document.documentElement;
|
|
693
737
|
totalWidth = documentElement.clientWidth;
|
|
694
738
|
totalHeight = documentElement.clientHeight;
|
|
695
739
|
var _visualViewport_width;
|
|
696
|
-
width = (_visualViewport_width = visualViewport === null || visualViewport === void 0 ? void 0 : visualViewport.width) !== null && _visualViewport_width !== void 0 ? _visualViewport_width : totalWidth;
|
|
740
|
+
width = (_visualViewport_width = $edcf132a9284368a$var$visualViewport === null || $edcf132a9284368a$var$visualViewport === void 0 ? void 0 : $edcf132a9284368a$var$visualViewport.width) !== null && _visualViewport_width !== void 0 ? _visualViewport_width : totalWidth;
|
|
697
741
|
var _visualViewport_height;
|
|
698
|
-
height = (_visualViewport_height = visualViewport === null || visualViewport === void 0 ? void 0 : visualViewport.height) !== null && _visualViewport_height !== void 0 ? _visualViewport_height : totalHeight;
|
|
742
|
+
height = (_visualViewport_height = $edcf132a9284368a$var$visualViewport === null || $edcf132a9284368a$var$visualViewport === void 0 ? void 0 : $edcf132a9284368a$var$visualViewport.height) !== null && _visualViewport_height !== void 0 ? _visualViewport_height : totalHeight;
|
|
699
743
|
scroll.top = documentElement.scrollTop || containerNode.scrollTop;
|
|
700
744
|
scroll.left = documentElement.scrollLeft || containerNode.scrollLeft;
|
|
701
745
|
// The goal of the below is to get a top/left value that represents the top/left of the visual viewport with
|
|
702
746
|
// respect to the layout viewport origin. This combined with the scrollTop/scrollLeft will allow us to calculate
|
|
703
747
|
// coordinates/values with respect to the visual viewport or with respect to the layout viewport.
|
|
704
|
-
if (visualViewport) {
|
|
705
|
-
top = visualViewport.offsetTop;
|
|
706
|
-
left = visualViewport.offsetLeft;
|
|
748
|
+
if ($edcf132a9284368a$var$visualViewport) {
|
|
749
|
+
top = $edcf132a9284368a$var$visualViewport.offsetTop;
|
|
750
|
+
left = $edcf132a9284368a$var$visualViewport.offsetLeft;
|
|
707
751
|
}
|
|
708
752
|
} else {
|
|
709
753
|
({ width: width, height: height, top: top, left: left } = $edcf132a9284368a$var$getOffset(containerNode, false));
|
|
@@ -720,9 +764,9 @@ function $edcf132a9284368a$var$getContainerDimensions(containerNode, visualViewp
|
|
|
720
764
|
scroll.top = 0;
|
|
721
765
|
scroll.left = 0;
|
|
722
766
|
var _visualViewport_pageTop;
|
|
723
|
-
top = (_visualViewport_pageTop = visualViewport === null || visualViewport === void 0 ? void 0 : visualViewport.pageTop) !== null && _visualViewport_pageTop !== void 0 ? _visualViewport_pageTop : 0;
|
|
767
|
+
top = (_visualViewport_pageTop = $edcf132a9284368a$var$visualViewport === null || $edcf132a9284368a$var$visualViewport === void 0 ? void 0 : $edcf132a9284368a$var$visualViewport.pageTop) !== null && _visualViewport_pageTop !== void 0 ? _visualViewport_pageTop : 0;
|
|
724
768
|
var _visualViewport_pageLeft;
|
|
725
|
-
left = (_visualViewport_pageLeft = visualViewport === null || visualViewport === void 0 ? void 0 : visualViewport.pageLeft) !== null && _visualViewport_pageLeft !== void 0 ? _visualViewport_pageLeft : 0;
|
|
769
|
+
left = (_visualViewport_pageLeft = $edcf132a9284368a$var$visualViewport === null || $edcf132a9284368a$var$visualViewport === void 0 ? void 0 : $edcf132a9284368a$var$visualViewport.pageLeft) !== null && _visualViewport_pageLeft !== void 0 ? _visualViewport_pageLeft : 0;
|
|
726
770
|
}
|
|
727
771
|
return {
|
|
728
772
|
width: width,
|
|
@@ -757,12 +801,10 @@ containerDimensions, padding, containerOffsetWithBoundary) {
|
|
|
757
801
|
let boundarySize = boundaryDimensions[$edcf132a9284368a$var$AXIS_SIZE[axis]];
|
|
758
802
|
// Calculate the edges of the boundary (accomodating for the boundary padding) and the edges of the overlay.
|
|
759
803
|
// Note that these values are with respect to the visual viewport (aka 0,0 is the top left of the viewport)
|
|
760
|
-
let boundaryStartEdge =
|
|
761
|
-
let boundaryEndEdge =
|
|
762
|
-
|
|
763
|
-
let
|
|
764
|
-
// transformed value of the right edge of the overlay
|
|
765
|
-
let endEdgeOffset = offset - containerScroll + size + boundaryDimensions.scroll[$edcf132a9284368a$var$AXIS[axis]] + containerOffsetWithBoundary[axis] - boundaryDimensions[$edcf132a9284368a$var$AXIS[axis]];
|
|
804
|
+
let boundaryStartEdge = boundaryDimensions.scroll[$edcf132a9284368a$var$AXIS[axis]] + padding;
|
|
805
|
+
let boundaryEndEdge = boundarySize + boundaryDimensions.scroll[$edcf132a9284368a$var$AXIS[axis]] - padding;
|
|
806
|
+
let startEdgeOffset = offset - containerScroll + containerOffsetWithBoundary[axis] - boundaryDimensions[$edcf132a9284368a$var$AXIS[axis]];
|
|
807
|
+
let endEdgeOffset = offset - containerScroll + size + containerOffsetWithBoundary[axis] - boundaryDimensions[$edcf132a9284368a$var$AXIS[axis]];
|
|
766
808
|
// If any of the overlay edges falls outside of the boundary, shift the overlay the required amount to align one of the overlay's
|
|
767
809
|
// edges with the closest boundary edge.
|
|
768
810
|
if (startEdgeOffset < boundaryStartEdge) return boundaryStartEdge - startEdgeOffset;
|
|
@@ -796,7 +838,7 @@ function $edcf132a9284368a$var$parsePlacement(input) {
|
|
|
796
838
|
};
|
|
797
839
|
return $edcf132a9284368a$var$PARSED_PLACEMENT_CACHE[input];
|
|
798
840
|
}
|
|
799
|
-
function $edcf132a9284368a$var$computePosition(childOffset, boundaryDimensions, overlaySize, placementInfo, offset, crossOffset, containerOffsetWithBoundary, isContainerPositioned, arrowSize, arrowBoundaryOffset
|
|
841
|
+
function $edcf132a9284368a$var$computePosition(childOffset, boundaryDimensions, overlaySize, placementInfo, offset, crossOffset, containerOffsetWithBoundary, isContainerPositioned, arrowSize, arrowBoundaryOffset) {
|
|
800
842
|
let { placement: placement, crossPlacement: crossPlacement, axis: axis, crossAxis: crossAxis, size: size, crossSize: crossSize } = placementInfo;
|
|
801
843
|
let position = {};
|
|
802
844
|
var _childOffset_crossAxis;
|
|
@@ -813,9 +855,9 @@ function $edcf132a9284368a$var$computePosition(childOffset, boundaryDimensions,
|
|
|
813
855
|
the overlay top should match the button top
|
|
814
856
|
} */
|
|
815
857
|
position[crossAxis] += crossOffset;
|
|
816
|
-
// overlay top
|
|
858
|
+
// overlay top overlapping arrow with button bottom
|
|
817
859
|
const minPosition = childOffset[crossAxis] - overlaySize[crossSize] + arrowSize + arrowBoundaryOffset;
|
|
818
|
-
// overlay bottom
|
|
860
|
+
// overlay bottom overlapping arrow with button top
|
|
819
861
|
const maxPosition = childOffset[crossAxis] + childOffset[crossSize] - arrowSize - arrowBoundaryOffset;
|
|
820
862
|
position[crossAxis] = (Text.$9446cca9a3875146$export$7d15b64cf5a3a4c4)(position[crossAxis], minPosition, maxPosition);
|
|
821
863
|
// Floor these so the position isn't placed on a partial pixel, only whole pixels. Shouldn't matter if it was floored or ceiled, so chose one.
|
|
@@ -823,61 +865,46 @@ function $edcf132a9284368a$var$computePosition(childOffset, boundaryDimensions,
|
|
|
823
865
|
// If the container is positioned (non-static), then we use the container's actual
|
|
824
866
|
// height, as `bottom` will be relative to this height. But if the container is static,
|
|
825
867
|
// then it can only be the `document.body`, and `bottom` will be relative to _its_
|
|
826
|
-
// container.
|
|
827
|
-
|
|
868
|
+
// container, which should be as large as boundaryDimensions.
|
|
869
|
+
const containerHeight = isContainerPositioned ? containerOffsetWithBoundary[size] : boundaryDimensions[$edcf132a9284368a$var$TOTAL_SIZE[size]];
|
|
828
870
|
position[$edcf132a9284368a$var$FLIPPED_DIRECTION[axis]] = Math.floor(containerHeight - childOffset[axis] + offset);
|
|
829
871
|
} else position[axis] = Math.floor(childOffset[axis] + childOffset[size] + offset);
|
|
830
872
|
return position;
|
|
831
873
|
}
|
|
832
|
-
function $edcf132a9284368a$var$getMaxHeight(position, boundaryDimensions, containerOffsetWithBoundary, isContainerPositioned, margins, padding, overlayHeight, heightGrowthDirection
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
// with respect to the
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
var _visualViewport_offsetTop, _visualViewport_offsetTop1, _visualViewport_height;
|
|
840
|
-
let boundingRect = {
|
|
841
|
-
// This should be boundary top in container coord system vs viewport top in container coord system
|
|
842
|
-
// For the viewport top, there are several cases
|
|
843
|
-
// 1. pinchzoom case where we want the viewports offset top as top here
|
|
844
|
-
// 2. case where container is offset from the boundary and is contained by the boundary. In this case the top we want here is NOT 0, we want to take boundary's top even though is is a negative number OR the visual viewport, whichever is more restrictive
|
|
845
|
-
top: Math.max(boundaryDimensions.top + boundaryToContainerTransformOffset, ((_visualViewport_offsetTop = visualViewport === null || visualViewport === void 0 ? void 0 : visualViewport.offsetTop) !== null && _visualViewport_offsetTop !== void 0 ? _visualViewport_offsetTop : boundaryDimensions.top) + boundaryToContainerTransformOffset),
|
|
846
|
-
bottom: Math.min(boundaryDimensions.top + boundaryDimensions.height + boundaryToContainerTransformOffset, ((_visualViewport_offsetTop1 = visualViewport === null || visualViewport === void 0 ? void 0 : visualViewport.offsetTop) !== null && _visualViewport_offsetTop1 !== void 0 ? _visualViewport_offsetTop1 : 0) + ((_visualViewport_height = visualViewport === null || visualViewport === void 0 ? void 0 : visualViewport.height) !== null && _visualViewport_height !== void 0 ? _visualViewport_height : 0))
|
|
847
|
-
};
|
|
848
|
-
var _margins_top, _margins_bottom, _margins_top1, _margins_bottom1;
|
|
874
|
+
function $edcf132a9284368a$var$getMaxHeight(position, boundaryDimensions, containerOffsetWithBoundary, isContainerPositioned, margins, padding, overlayHeight, heightGrowthDirection) {
|
|
875
|
+
const containerHeight = isContainerPositioned ? containerOffsetWithBoundary.height : boundaryDimensions[$edcf132a9284368a$var$TOTAL_SIZE.height];
|
|
876
|
+
var _position_bottom;
|
|
877
|
+
// For cases where position is set via "bottom" instead of "top", we need to calculate the true overlay top with respect to the boundary. Reverse calculate this with the same method
|
|
878
|
+
// used in computePosition.
|
|
879
|
+
let overlayTop = position.top != null ? containerOffsetWithBoundary.top + position.top : containerOffsetWithBoundary.top + (containerHeight - ((_position_bottom = position.bottom) !== null && _position_bottom !== void 0 ? _position_bottom : 0) - overlayHeight);
|
|
880
|
+
var _boundaryDimensions_scroll_top, _margins_top, _margins_bottom, _boundaryDimensions_scroll_top1, _margins_top1, _margins_bottom1;
|
|
849
881
|
let maxHeight = heightGrowthDirection !== 'top' ? // We want the distance between the top of the overlay to the bottom of the boundary
|
|
850
|
-
Math.max(0,
|
|
851
|
-
- overlayTop // this is the top of the overlay
|
|
882
|
+
Math.max(0, boundaryDimensions.height + boundaryDimensions.top + ((_boundaryDimensions_scroll_top = boundaryDimensions.scroll.top) !== null && _boundaryDimensions_scroll_top !== void 0 ? _boundaryDimensions_scroll_top : 0) - overlayTop // this is the top of the overlay
|
|
852
883
|
- (((_margins_top = margins.top) !== null && _margins_top !== void 0 ? _margins_top : 0) + ((_margins_bottom = margins.bottom) !== null && _margins_bottom !== void 0 ? _margins_bottom : 0) + padding // save additional space for margin and padding
|
|
853
884
|
)) : Math.max(0, overlayTop + overlayHeight // this is the bottom of the overlay
|
|
854
|
-
-
|
|
855
|
-
|
|
885
|
+
- (boundaryDimensions.top + ((_boundaryDimensions_scroll_top1 = boundaryDimensions.scroll.top) !== null && _boundaryDimensions_scroll_top1 !== void 0 ? _boundaryDimensions_scroll_top1 : 0) // this is the top of the boundary
|
|
886
|
+
) - (((_margins_top1 = margins.top) !== null && _margins_top1 !== void 0 ? _margins_top1 : 0) + ((_margins_bottom1 = margins.bottom) !== null && _margins_bottom1 !== void 0 ? _margins_bottom1 : 0) + padding // save additional space for margin and padding
|
|
856
887
|
));
|
|
857
|
-
return maxHeight;
|
|
888
|
+
return Math.min(boundaryDimensions.height - padding * 2, maxHeight);
|
|
858
889
|
}
|
|
859
|
-
function $edcf132a9284368a$var$getAvailableSpace(boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding, placementInfo
|
|
890
|
+
function $edcf132a9284368a$var$getAvailableSpace(boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding, placementInfo) {
|
|
860
891
|
let { placement: placement, axis: axis, size: size } = placementInfo;
|
|
861
|
-
var
|
|
862
|
-
if (placement === axis) return Math.max(0, childOffset[axis]
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
var _containerDimensions_scroll_axis1, _margins_axis1;
|
|
868
|
-
return Math.max(0, boundaryDimensions[size] + boundaryDimensions[axis] + (isContainerDescendentOfBoundary ? containerOffsetWithBoundary[axis] : 0) - childOffset[axis] - childOffset[size] + ((_containerDimensions_scroll_axis1 = containerDimensions.scroll[axis]) !== null && _containerDimensions_scroll_axis1 !== void 0 ? _containerDimensions_scroll_axis1 : 0) - ((_margins_axis1 = margins[axis]) !== null && _margins_axis1 !== void 0 ? _margins_axis1 : 0) - margins[$edcf132a9284368a$var$FLIPPED_DIRECTION[axis]] - padding);
|
|
869
|
-
}
|
|
870
|
-
function $edcf132a9284368a$export$6839422d1f33cee9(placementInput, childOffset, overlaySize, scrollSize, margins, padding, flip, boundaryDimensions, containerDimensions, containerOffsetWithBoundary, offset, crossOffset, isContainerPositioned, userSetMaxHeight, arrowSize, arrowBoundaryOffset, isContainerDescendentOfBoundary, visualViewport) {
|
|
892
|
+
var _boundaryDimensions_scroll_axis, _margins_axis;
|
|
893
|
+
if (placement === axis) return Math.max(0, childOffset[axis] - boundaryDimensions[axis] - ((_boundaryDimensions_scroll_axis = boundaryDimensions.scroll[axis]) !== null && _boundaryDimensions_scroll_axis !== void 0 ? _boundaryDimensions_scroll_axis : 0) + containerOffsetWithBoundary[axis] - ((_margins_axis = margins[axis]) !== null && _margins_axis !== void 0 ? _margins_axis : 0) - margins[$edcf132a9284368a$var$FLIPPED_DIRECTION[axis]] - padding);
|
|
894
|
+
var _margins_axis1;
|
|
895
|
+
return Math.max(0, boundaryDimensions[size] + boundaryDimensions[axis] + boundaryDimensions.scroll[axis] - containerOffsetWithBoundary[axis] - childOffset[axis] - childOffset[size] - ((_margins_axis1 = margins[axis]) !== null && _margins_axis1 !== void 0 ? _margins_axis1 : 0) - margins[$edcf132a9284368a$var$FLIPPED_DIRECTION[axis]] - padding);
|
|
896
|
+
}
|
|
897
|
+
function $edcf132a9284368a$export$6839422d1f33cee9(placementInput, childOffset, overlaySize, scrollSize, margins, padding, flip, boundaryDimensions, containerDimensions, containerOffsetWithBoundary, offset, crossOffset, isContainerPositioned, userSetMaxHeight, arrowSize, arrowBoundaryOffset) {
|
|
871
898
|
let placementInfo = $edcf132a9284368a$var$parsePlacement(placementInput);
|
|
872
899
|
let { size: size, crossAxis: crossAxis, crossSize: crossSize, placement: placement, crossPlacement: crossPlacement } = placementInfo;
|
|
873
|
-
let position = $edcf132a9284368a$var$computePosition(childOffset, boundaryDimensions, overlaySize, placementInfo, offset, crossOffset, containerOffsetWithBoundary, isContainerPositioned, arrowSize, arrowBoundaryOffset
|
|
900
|
+
let position = $edcf132a9284368a$var$computePosition(childOffset, boundaryDimensions, overlaySize, placementInfo, offset, crossOffset, containerOffsetWithBoundary, isContainerPositioned, arrowSize, arrowBoundaryOffset);
|
|
874
901
|
let normalizedOffset = offset;
|
|
875
|
-
let space = $edcf132a9284368a$var$getAvailableSpace(boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding + offset, placementInfo
|
|
902
|
+
let space = $edcf132a9284368a$var$getAvailableSpace(boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding + offset, placementInfo);
|
|
876
903
|
// Check if the scroll size of the overlay is greater than the available space to determine if we need to flip
|
|
877
|
-
if (flip &&
|
|
904
|
+
if (flip && scrollSize[size] > space) {
|
|
878
905
|
let flippedPlacementInfo = $edcf132a9284368a$var$parsePlacement(`${$edcf132a9284368a$var$FLIPPED_DIRECTION[placement]} ${crossPlacement}`);
|
|
879
|
-
let flippedPosition = $edcf132a9284368a$var$computePosition(childOffset, boundaryDimensions, overlaySize, flippedPlacementInfo, offset, crossOffset, containerOffsetWithBoundary, isContainerPositioned, arrowSize, arrowBoundaryOffset
|
|
880
|
-
let flippedSpace = $edcf132a9284368a$var$getAvailableSpace(boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding + offset, flippedPlacementInfo
|
|
906
|
+
let flippedPosition = $edcf132a9284368a$var$computePosition(childOffset, boundaryDimensions, overlaySize, flippedPlacementInfo, offset, crossOffset, containerOffsetWithBoundary, isContainerPositioned, arrowSize, arrowBoundaryOffset);
|
|
907
|
+
let flippedSpace = $edcf132a9284368a$var$getAvailableSpace(boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding + offset, flippedPlacementInfo);
|
|
881
908
|
// If the available space for the flipped position is greater than the original available space, flip.
|
|
882
909
|
if (flippedSpace > space) {
|
|
883
910
|
placementInfo = flippedPlacementInfo;
|
|
@@ -896,10 +923,10 @@ function $edcf132a9284368a$export$6839422d1f33cee9(placementInput, childOffset,
|
|
|
896
923
|
}
|
|
897
924
|
let delta = $edcf132a9284368a$var$getDelta(crossAxis, position[crossAxis], overlaySize[crossSize], boundaryDimensions, containerDimensions, padding, containerOffsetWithBoundary);
|
|
898
925
|
position[crossAxis] += delta;
|
|
899
|
-
let maxHeight = $edcf132a9284368a$var$getMaxHeight(position, boundaryDimensions, containerOffsetWithBoundary, isContainerPositioned, margins, padding, overlaySize.height, heightGrowthDirection
|
|
926
|
+
let maxHeight = $edcf132a9284368a$var$getMaxHeight(position, boundaryDimensions, containerOffsetWithBoundary, isContainerPositioned, margins, padding, overlaySize.height, heightGrowthDirection);
|
|
900
927
|
if (userSetMaxHeight && userSetMaxHeight < maxHeight) maxHeight = userSetMaxHeight;
|
|
901
928
|
overlaySize.height = Math.min(overlaySize.height, maxHeight);
|
|
902
|
-
position = $edcf132a9284368a$var$computePosition(childOffset, boundaryDimensions, overlaySize, placementInfo, normalizedOffset, crossOffset, containerOffsetWithBoundary, isContainerPositioned, arrowSize, arrowBoundaryOffset
|
|
929
|
+
position = $edcf132a9284368a$var$computePosition(childOffset, boundaryDimensions, overlaySize, placementInfo, normalizedOffset, crossOffset, containerOffsetWithBoundary, isContainerPositioned, arrowSize, arrowBoundaryOffset);
|
|
903
930
|
delta = $edcf132a9284368a$var$getDelta(crossAxis, position[crossAxis], overlaySize[crossSize], boundaryDimensions, containerDimensions, padding, containerOffsetWithBoundary);
|
|
904
931
|
position[crossAxis] += delta;
|
|
905
932
|
let arrowPosition = {};
|
|
@@ -945,7 +972,6 @@ function $edcf132a9284368a$export$6839422d1f33cee9(placementInput, childOffset,
|
|
|
945
972
|
}
|
|
946
973
|
function $edcf132a9284368a$export$b3ceb0cbf1056d98(opts) {
|
|
947
974
|
let { placement: placement, targetNode: targetNode, overlayNode: overlayNode, scrollNode: scrollNode, padding: padding, shouldFlip: shouldFlip, boundaryElement: boundaryElement, offset: offset, crossOffset: crossOffset, maxHeight: maxHeight, arrowSize: arrowSize = 0, arrowBoundaryOffset: arrowBoundaryOffset = 0 } = opts;
|
|
948
|
-
let visualViewport = $edcf132a9284368a$var$getVisualViewport();
|
|
949
975
|
let container = overlayNode instanceof HTMLElement ? $edcf132a9284368a$var$getContainingBlock(overlayNode) : document.documentElement;
|
|
950
976
|
let isViewportContainer = container === document.documentElement;
|
|
951
977
|
const containerPositionStyle = window.getComputedStyle(container).position;
|
|
@@ -963,46 +989,21 @@ function $edcf132a9284368a$export$b3ceb0cbf1056d98(opts) {
|
|
|
963
989
|
var _margins_top, _margins_bottom;
|
|
964
990
|
overlaySize.height += ((_margins_top = margins.top) !== null && _margins_top !== void 0 ? _margins_top : 0) + ((_margins_bottom = margins.bottom) !== null && _margins_bottom !== void 0 ? _margins_bottom : 0);
|
|
965
991
|
let scrollSize = $edcf132a9284368a$var$getScroll(scrollNode);
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
//
|
|
969
|
-
//
|
|
970
|
-
|
|
971
|
-
let
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
let containerOffsetWithBoundary;
|
|
978
|
-
if ((boundaryElement.tagName === 'BODY' || boundaryElement.tagName === 'HTML') && !isViewportContainer) {
|
|
979
|
-
// Use getRect instead of getOffset because boundaryDimensions for BODY/HTML is in viewport coordinate space,
|
|
980
|
-
// not document coordinate space
|
|
981
|
-
let containerRect = $edcf132a9284368a$export$4b834cebd9e5cebe(container, false);
|
|
982
|
-
// the offset should be negative because if container is at viewport position x,y, then viewport top (aka 0)
|
|
983
|
-
// is at position -x,y in container-relative coordinates
|
|
984
|
-
containerOffsetWithBoundary = {
|
|
985
|
-
top: -(containerRect.top - boundaryDimensions.top),
|
|
986
|
-
left: -(containerRect.left - boundaryDimensions.left),
|
|
987
|
-
width: 0,
|
|
988
|
-
height: 0
|
|
989
|
-
};
|
|
990
|
-
} else if ((boundaryElement.tagName === 'BODY' || boundaryElement.tagName === 'HTML') && isViewportContainer) // both are the same viewport container, no offset needed
|
|
991
|
-
containerOffsetWithBoundary = {
|
|
992
|
-
top: 0,
|
|
993
|
-
left: 0,
|
|
994
|
-
width: 0,
|
|
995
|
-
height: 0
|
|
996
|
-
};
|
|
997
|
-
else // This returns the boundary's coordinate with respect to the container. This case captures cases such as when you provide a custom boundary
|
|
998
|
-
// like in ScrollingBoundaryContainerExample in Popover.stories.
|
|
999
|
-
containerOffsetWithBoundary = $edcf132a9284368a$var$getPosition(boundaryElement, container, false);
|
|
1000
|
-
let isContainerDescendentOfBoundary = (Text.$d4ee10de306f2510$export$4282f70798064fe0)(boundaryElement, container);
|
|
1001
|
-
return $edcf132a9284368a$export$6839422d1f33cee9(placement, childOffset, overlaySize, scrollSize, margins, padding, shouldFlip, boundaryDimensions, containerDimensions, containerOffsetWithBoundary, offset, crossOffset, isContainerPositioned, maxHeight, arrowSize, arrowBoundaryOffset, isContainerDescendentOfBoundary, visualViewport);
|
|
992
|
+
let boundaryDimensions = $edcf132a9284368a$var$getContainerDimensions(boundaryElement);
|
|
993
|
+
let containerDimensions = $edcf132a9284368a$var$getContainerDimensions(container);
|
|
994
|
+
// If the container is the HTML element wrapping the body element, the retrieved scrollTop/scrollLeft will be equal to the
|
|
995
|
+
// body element's scroll. Set the container's scroll values to 0 since the overlay's edge position value in getDelta don't then need to be further offset
|
|
996
|
+
// by the container scroll since they are essentially the same containing element and thus in the same coordinate system
|
|
997
|
+
let containerOffsetWithBoundary = boundaryElement.tagName === 'BODY' ? $edcf132a9284368a$var$getOffset(container, false) : $edcf132a9284368a$var$getPosition(container, boundaryElement, false);
|
|
998
|
+
if (container.tagName === 'HTML' && boundaryElement.tagName === 'BODY') {
|
|
999
|
+
containerDimensions.scroll.top = 0;
|
|
1000
|
+
containerDimensions.scroll.left = 0;
|
|
1001
|
+
}
|
|
1002
|
+
return $edcf132a9284368a$export$6839422d1f33cee9(placement, childOffset, overlaySize, scrollSize, margins, padding, shouldFlip, boundaryDimensions, containerDimensions, containerOffsetWithBoundary, offset, crossOffset, isContainerPositioned, maxHeight, arrowSize, arrowBoundaryOffset);
|
|
1002
1003
|
}
|
|
1003
1004
|
function $edcf132a9284368a$export$4b834cebd9e5cebe(node, ignoreScale) {
|
|
1004
1005
|
let { top: top, left: left, width: width, height: height } = node.getBoundingClientRect();
|
|
1005
|
-
// Use offsetWidth and offsetHeight if this is an HTML element, so that
|
|
1006
|
+
// Use offsetWidth and offsetHeight if this is an HTML element, so that
|
|
1006
1007
|
// the size is not affected by scale transforms.
|
|
1007
1008
|
if (ignoreScale && node instanceof node.ownerDocument.defaultView.HTMLElement) {
|
|
1008
1009
|
width = node.offsetWidth;
|
|
@@ -1081,7 +1082,6 @@ function $edcf132a9284368a$var$isContainingBlock(node) {
|
|
|
1081
1082
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
1082
1083
|
* governing permissions and limitations under the License.
|
|
1083
1084
|
*/
|
|
1084
|
-
|
|
1085
1085
|
const $dd149f63282afbbf$export$f6211563215e3b37 = new WeakMap();
|
|
1086
1086
|
function $dd149f63282afbbf$export$18fc8428861184da(opts) {
|
|
1087
1087
|
let { triggerRef: triggerRef, isOpen: isOpen, onClose: onClose } = opts;
|
|
@@ -1089,13 +1089,13 @@ function $dd149f63282afbbf$export$18fc8428861184da(opts) {
|
|
|
1089
1089
|
if (!isOpen || onClose === null) return;
|
|
1090
1090
|
let onScroll = (e)=>{
|
|
1091
1091
|
// Ignore if scrolling an scrollable region outside the trigger's tree.
|
|
1092
|
-
let target =
|
|
1092
|
+
let target = e.target;
|
|
1093
1093
|
// window is not a Node and doesn't have contain, but window contains everything
|
|
1094
|
-
if (!triggerRef.current || target instanceof Node && !(
|
|
1094
|
+
if (!triggerRef.current || target instanceof Node && !target.contains(triggerRef.current)) return;
|
|
1095
1095
|
// Ignore scroll events on any input or textarea as the cursor position can cause it to scroll
|
|
1096
1096
|
// such as in a combobox. Clicking the dropdown button places focus on the input, and if the
|
|
1097
1097
|
// text inside the input extends beyond the 'end', then it will scroll so the cursor is visible at the end.
|
|
1098
|
-
if (target instanceof HTMLInputElement || target instanceof HTMLTextAreaElement) return;
|
|
1098
|
+
if (e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement) return;
|
|
1099
1099
|
let onCloseHandler = onClose || $dd149f63282afbbf$export$f6211563215e3b37.get(triggerRef.current);
|
|
1100
1100
|
if (onCloseHandler) onCloseHandler();
|
|
1101
1101
|
};
|
|
@@ -1197,9 +1197,9 @@ function $2a41e45df1593e64$export$d39e1813b3bdd0e1(props) {
|
|
|
1197
1197
|
// so it can be restored after repositioning. This way if the overlay height
|
|
1198
1198
|
// changes, the focused element appears to stay in the same position.
|
|
1199
1199
|
let anchor = null;
|
|
1200
|
-
if (scrollRef.current &&
|
|
1201
|
-
var
|
|
1202
|
-
let anchorRect = (
|
|
1200
|
+
if (scrollRef.current && scrollRef.current.contains(document.activeElement)) {
|
|
1201
|
+
var _document_activeElement;
|
|
1202
|
+
let anchorRect = (_document_activeElement = document.activeElement) === null || _document_activeElement === void 0 ? void 0 : _document_activeElement.getBoundingClientRect();
|
|
1203
1203
|
let scrollRect = scrollRef.current.getBoundingClientRect();
|
|
1204
1204
|
var _anchorRect_top;
|
|
1205
1205
|
// Anchor from the top if the offset is in the top half of the scrollable element,
|
|
@@ -1248,9 +1248,8 @@ function $2a41e45df1593e64$export$d39e1813b3bdd0e1(props) {
|
|
|
1248
1248
|
Object.keys(position.position).forEach((key)=>overlay.style[key] = position.position[key] + 'px');
|
|
1249
1249
|
overlay.style.maxHeight = position.maxHeight != null ? position.maxHeight + 'px' : '';
|
|
1250
1250
|
// Restore scroll position relative to anchor element.
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
let anchorRect = activeElement.getBoundingClientRect();
|
|
1251
|
+
if (anchor && document.activeElement && scrollRef.current) {
|
|
1252
|
+
let anchorRect = document.activeElement.getBoundingClientRect();
|
|
1254
1253
|
let scrollRect = scrollRef.current.getBoundingClientRect();
|
|
1255
1254
|
let newOffset = anchorRect[anchor.type] - scrollRect[anchor.type];
|
|
1256
1255
|
scrollRef.current.scrollTop += newOffset - anchor.offset;
|
|
@@ -1499,9 +1498,7 @@ function $f6c31cce2adf654f$var$usePressResponderContext(props) {
|
|
|
1499
1498
|
// Consume context from <PressResponder> and merge with props.
|
|
1500
1499
|
let context = (React.useContext)(($ae1eeba8b9eafd08$export$5165eccb35aaadb5));
|
|
1501
1500
|
if (context) {
|
|
1502
|
-
|
|
1503
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1504
|
-
let { register: register, ref: ref, ...contextProps } = context;
|
|
1501
|
+
let { register: register, ...contextProps } = context;
|
|
1505
1502
|
props = (Text.$3ef42575df84b30b$export$9d1611c77c2fe928)(contextProps, props);
|
|
1506
1503
|
register();
|
|
1507
1504
|
}
|
|
@@ -1549,7 +1546,6 @@ class $f6c31cce2adf654f$var$PressEvent {
|
|
|
1549
1546
|
this.altKey = originalEvent.altKey;
|
|
1550
1547
|
this.x = x;
|
|
1551
1548
|
this.y = y;
|
|
1552
|
-
this.key = originalEvent.key;
|
|
1553
1549
|
}
|
|
1554
1550
|
}
|
|
1555
1551
|
const $f6c31cce2adf654f$var$LINK_CLICKED = Symbol('linkClicked');
|
|
@@ -1569,8 +1565,8 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
1569
1565
|
pointerType: null,
|
|
1570
1566
|
disposables: []
|
|
1571
1567
|
});
|
|
1572
|
-
let { addGlobalListener: addGlobalListener, removeAllGlobalListeners: removeAllGlobalListeners
|
|
1573
|
-
let triggerPressStart = (
|
|
1568
|
+
let { addGlobalListener: addGlobalListener, removeAllGlobalListeners: removeAllGlobalListeners } = (Text.$03deb23ff14920c4$export$4eaf04e54aa8eed6)();
|
|
1569
|
+
let triggerPressStart = (Text.$8ae05eaa5c114e9c$export$7f54fc3180508a52)((originalEvent, pointerType)=>{
|
|
1574
1570
|
let state = ref.current;
|
|
1575
1571
|
if (isDisabled || state.didFirePressStart) return false;
|
|
1576
1572
|
let shouldStopPropagation = true;
|
|
@@ -1585,12 +1581,8 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
1585
1581
|
state.didFirePressStart = true;
|
|
1586
1582
|
setPressed(true);
|
|
1587
1583
|
return shouldStopPropagation;
|
|
1588
|
-
}
|
|
1589
|
-
|
|
1590
|
-
onPressStart,
|
|
1591
|
-
onPressChange
|
|
1592
|
-
]);
|
|
1593
|
-
let triggerPressEnd = (React.useCallback)((originalEvent, pointerType, wasPressed = true)=>{
|
|
1584
|
+
});
|
|
1585
|
+
let triggerPressEnd = (Text.$8ae05eaa5c114e9c$export$7f54fc3180508a52)((originalEvent, pointerType, wasPressed = true)=>{
|
|
1594
1586
|
let state = ref.current;
|
|
1595
1587
|
if (!state.didFirePressStart) return false;
|
|
1596
1588
|
state.didFirePressStart = false;
|
|
@@ -1610,14 +1602,8 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
1610
1602
|
}
|
|
1611
1603
|
state.isTriggeringEvent = false;
|
|
1612
1604
|
return shouldStopPropagation;
|
|
1613
|
-
}
|
|
1614
|
-
|
|
1615
|
-
onPressEnd,
|
|
1616
|
-
onPressChange,
|
|
1617
|
-
onPress
|
|
1618
|
-
]);
|
|
1619
|
-
let triggerPressEndEvent = (Text.$8ae05eaa5c114e9c$export$7f54fc3180508a52)(triggerPressEnd);
|
|
1620
|
-
let triggerPressUp = (React.useCallback)((originalEvent, pointerType)=>{
|
|
1605
|
+
});
|
|
1606
|
+
let triggerPressUp = (Text.$8ae05eaa5c114e9c$export$7f54fc3180508a52)((originalEvent, pointerType)=>{
|
|
1621
1607
|
let state = ref.current;
|
|
1622
1608
|
if (isDisabled) return false;
|
|
1623
1609
|
if (onPressUp) {
|
|
@@ -1628,17 +1614,12 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
1628
1614
|
return event.shouldStopPropagation;
|
|
1629
1615
|
}
|
|
1630
1616
|
return true;
|
|
1631
|
-
}
|
|
1632
|
-
|
|
1633
|
-
onPressUp
|
|
1634
|
-
]);
|
|
1635
|
-
let triggerPressUpEvent = (Text.$8ae05eaa5c114e9c$export$7f54fc3180508a52)(triggerPressUp);
|
|
1636
|
-
let cancel = (React.useCallback)((e)=>{
|
|
1617
|
+
});
|
|
1618
|
+
let cancel = (Text.$8ae05eaa5c114e9c$export$7f54fc3180508a52)((e)=>{
|
|
1637
1619
|
let state = ref.current;
|
|
1638
1620
|
if (state.isPressed && state.target) {
|
|
1639
1621
|
if (state.didFirePressStart && state.pointerType != null) triggerPressEnd($f6c31cce2adf654f$var$createEvent(state.target, e), state.pointerType, false);
|
|
1640
1622
|
state.isPressed = false;
|
|
1641
|
-
setIsPointerPressed(null);
|
|
1642
1623
|
state.isOverTarget = false;
|
|
1643
1624
|
state.activePointerId = null;
|
|
1644
1625
|
state.pointerType = null;
|
|
@@ -1647,27 +1628,14 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
1647
1628
|
for (let dispose of state.disposables)dispose();
|
|
1648
1629
|
state.disposables = [];
|
|
1649
1630
|
}
|
|
1650
|
-
}
|
|
1651
|
-
|
|
1652
|
-
removeAllGlobalListeners,
|
|
1653
|
-
triggerPressEnd
|
|
1654
|
-
]);
|
|
1655
|
-
let cancelEvent = (Text.$8ae05eaa5c114e9c$export$7f54fc3180508a52)(cancel);
|
|
1656
|
-
let cancelOnPointerExit = (React.useCallback)((e)=>{
|
|
1631
|
+
});
|
|
1632
|
+
let cancelOnPointerExit = (Text.$8ae05eaa5c114e9c$export$7f54fc3180508a52)((e)=>{
|
|
1657
1633
|
if (shouldCancelOnPointerExit) cancel(e);
|
|
1658
|
-
}
|
|
1659
|
-
|
|
1660
|
-
cancel
|
|
1661
|
-
]);
|
|
1662
|
-
let triggerClick = (React.useCallback)((e)=>{
|
|
1663
|
-
if (isDisabled) return;
|
|
1634
|
+
});
|
|
1635
|
+
let triggerClick = (Text.$8ae05eaa5c114e9c$export$7f54fc3180508a52)((e)=>{
|
|
1664
1636
|
onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
1665
|
-
}
|
|
1666
|
-
|
|
1667
|
-
onClick
|
|
1668
|
-
]);
|
|
1669
|
-
let triggerSyntheticClick = (React.useCallback)((e, target)=>{
|
|
1670
|
-
if (isDisabled) return;
|
|
1637
|
+
});
|
|
1638
|
+
let triggerSyntheticClick = (Text.$8ae05eaa5c114e9c$export$7f54fc3180508a52)((e, target)=>{
|
|
1671
1639
|
// Some third-party libraries pass in onClick instead of onPress.
|
|
1672
1640
|
// Create a fake mouse event and trigger onClick as well.
|
|
1673
1641
|
// This matches the browser's native activation behavior for certain elements (e.g. button).
|
|
@@ -1678,154 +1646,14 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
1678
1646
|
(Text.$8a9cb279dc87e130$export$c2b7abe5d61ec696)(event, target);
|
|
1679
1647
|
onClick((Text.$8a9cb279dc87e130$export$525bc4921d56d4a)(event));
|
|
1680
1648
|
}
|
|
1681
|
-
}
|
|
1682
|
-
isDisabled,
|
|
1683
|
-
onClick
|
|
1684
|
-
]);
|
|
1685
|
-
let triggerSyntheticClickEvent = (Text.$8ae05eaa5c114e9c$export$7f54fc3180508a52)(triggerSyntheticClick);
|
|
1686
|
-
let [isElemKeyPressed, setIsElemKeyPressed] = (React.useState)(false);
|
|
1687
|
-
(Text.$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c)(()=>{
|
|
1688
|
-
let state = ref.current;
|
|
1689
|
-
if (isElemKeyPressed) {
|
|
1690
|
-
let onKeyUp = (e)=>{
|
|
1691
|
-
var _state_metaKeyEvents;
|
|
1692
|
-
if (state.isPressed && state.target && $f6c31cce2adf654f$var$isValidKeyboardEvent(e, state.target)) {
|
|
1693
|
-
var _state_metaKeyEvents1;
|
|
1694
|
-
if ($f6c31cce2adf654f$var$shouldPreventDefaultKeyboard((Text.$d4ee10de306f2510$export$e58f029f0fbfdb29)(e), e.key)) e.preventDefault();
|
|
1695
|
-
let target = (Text.$d4ee10de306f2510$export$e58f029f0fbfdb29)(e);
|
|
1696
|
-
let wasPressed = (Text.$d4ee10de306f2510$export$4282f70798064fe0)(state.target, target);
|
|
1697
|
-
triggerPressEndEvent($f6c31cce2adf654f$var$createEvent(state.target, e), 'keyboard', wasPressed);
|
|
1698
|
-
if (wasPressed) triggerSyntheticClickEvent(e, state.target);
|
|
1699
|
-
removeAllGlobalListeners();
|
|
1700
|
-
// If a link was triggered with a key other than Enter, open the URL ourselves.
|
|
1701
|
-
// This means the link has a role override, and the default browser behavior
|
|
1702
|
-
// only applies when using the Enter key.
|
|
1703
|
-
if (e.key !== 'Enter' && $f6c31cce2adf654f$var$isHTMLAnchorLink(state.target) && (Text.$d4ee10de306f2510$export$4282f70798064fe0)(state.target, target) && !e[$f6c31cce2adf654f$var$LINK_CLICKED]) {
|
|
1704
|
-
// Store a hidden property on the event so we only trigger link click once,
|
|
1705
|
-
// even if there are multiple usePress instances attached to the element.
|
|
1706
|
-
e[$f6c31cce2adf654f$var$LINK_CLICKED] = true;
|
|
1707
|
-
(Text.$ea8dcbcb9ea1b556$export$95185d699e05d4d7)(state.target, e, false);
|
|
1708
|
-
}
|
|
1709
|
-
state.isPressed = false;
|
|
1710
|
-
setIsElemKeyPressed(false);
|
|
1711
|
-
(_state_metaKeyEvents1 = state.metaKeyEvents) === null || _state_metaKeyEvents1 === void 0 ? void 0 : _state_metaKeyEvents1.delete(e.key);
|
|
1712
|
-
} else if (e.key === 'Meta' && ((_state_metaKeyEvents = state.metaKeyEvents) === null || _state_metaKeyEvents === void 0 ? void 0 : _state_metaKeyEvents.size)) {
|
|
1713
|
-
var _state_target;
|
|
1714
|
-
// If we recorded keydown events that occurred while the Meta key was pressed,
|
|
1715
|
-
// and those haven't received keyup events already, fire keyup events ourselves.
|
|
1716
|
-
// See comment above for more info about the macOS bug causing this.
|
|
1717
|
-
let events = state.metaKeyEvents;
|
|
1718
|
-
state.metaKeyEvents = undefined;
|
|
1719
|
-
for (let event of events.values())(_state_target = state.target) === null || _state_target === void 0 ? void 0 : _state_target.dispatchEvent(new KeyboardEvent('keyup', event));
|
|
1720
|
-
}
|
|
1721
|
-
};
|
|
1722
|
-
// Focus may move before the key up event, so register the event on the document
|
|
1723
|
-
// instead of the same element where the key down event occurred. Make it capturing so that it will trigger
|
|
1724
|
-
// before stopPropagation from useKeyboard on a child element may happen and thus we can still call triggerPress for the parent element.
|
|
1725
|
-
let originalTarget = state.target;
|
|
1726
|
-
let pressUp = (e)=>{
|
|
1727
|
-
if (originalTarget && $f6c31cce2adf654f$var$isValidKeyboardEvent(e, originalTarget) && !e.repeat && (Text.$d4ee10de306f2510$export$4282f70798064fe0)(originalTarget, (Text.$d4ee10de306f2510$export$e58f029f0fbfdb29)(e)) && state.target) triggerPressUpEvent($f6c31cce2adf654f$var$createEvent(state.target, e), 'keyboard');
|
|
1728
|
-
};
|
|
1729
|
-
let listener = (Text.$ff5963eb1fccf552$export$e08e3b67e392101e)(pressUp, onKeyUp);
|
|
1730
|
-
addGlobalListener((Text.$431fbd86ca7dc216$export$b204af158042fbac)(state.target), 'keyup', listener, true);
|
|
1731
|
-
return ()=>{
|
|
1732
|
-
removeGlobalListener((Text.$431fbd86ca7dc216$export$b204af158042fbac)(state.target), 'keyup', listener, true);
|
|
1733
|
-
};
|
|
1734
|
-
}
|
|
1735
|
-
}, [
|
|
1736
|
-
isElemKeyPressed,
|
|
1737
|
-
addGlobalListener,
|
|
1738
|
-
removeAllGlobalListeners,
|
|
1739
|
-
removeGlobalListener
|
|
1740
|
-
]);
|
|
1741
|
-
let [isPointerPressed, setIsPointerPressed] = (React.useState)(null);
|
|
1742
|
-
(Text.$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c)(()=>{
|
|
1743
|
-
let state = ref.current;
|
|
1744
|
-
if (isPointerPressed === 'pointer') {
|
|
1745
|
-
let onPointerUp = (e)=>{
|
|
1746
|
-
if (e.pointerId === state.activePointerId && state.isPressed && e.button === 0 && state.target) {
|
|
1747
|
-
if ((Text.$d4ee10de306f2510$export$4282f70798064fe0)(state.target, (Text.$d4ee10de306f2510$export$e58f029f0fbfdb29)(e)) && state.pointerType != null) {
|
|
1748
|
-
// Wait for onClick to fire onPress. This avoids browser issues when the DOM
|
|
1749
|
-
// is mutated between onPointerUp and onClick, and is more compatible with third party libraries.
|
|
1750
|
-
// https://github.com/adobe/react-spectrum/issues/1513
|
|
1751
|
-
// https://issues.chromium.org/issues/40732224
|
|
1752
|
-
// However, iOS and Android do not focus or fire onClick after a long press.
|
|
1753
|
-
// We work around this by triggering a click ourselves after a timeout.
|
|
1754
|
-
// This timeout is canceled during the click event in case the real one fires first.
|
|
1755
|
-
// The timeout must be at least 32ms, because Safari on iOS delays the click event on
|
|
1756
|
-
// non-form elements without certain ARIA roles (for hover emulation).
|
|
1757
|
-
// https://github.com/WebKit/WebKit/blob/dccfae42bb29bd4bdef052e469f604a9387241c0/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm#L875-L892
|
|
1758
|
-
let clicked = false;
|
|
1759
|
-
let timeout = setTimeout(()=>{
|
|
1760
|
-
if (state.isPressed && state.target instanceof HTMLElement) {
|
|
1761
|
-
if (clicked) cancelEvent(e);
|
|
1762
|
-
else {
|
|
1763
|
-
(Text.$7215afc6de606d6b$export$de79e2c695e052f3)(state.target);
|
|
1764
|
-
state.target.click();
|
|
1765
|
-
}
|
|
1766
|
-
}
|
|
1767
|
-
}, 80);
|
|
1768
|
-
// Use a capturing listener to track if a click occurred.
|
|
1769
|
-
// If stopPropagation is called it may never reach our handler.
|
|
1770
|
-
if (e.currentTarget) addGlobalListener(e.currentTarget, 'click', ()=>clicked = true, true);
|
|
1771
|
-
state.disposables.push(()=>clearTimeout(timeout));
|
|
1772
|
-
} else cancelEvent(e);
|
|
1773
|
-
// Ignore subsequent onPointerLeave event before onClick on touch devices.
|
|
1774
|
-
state.isOverTarget = false;
|
|
1775
|
-
}
|
|
1776
|
-
};
|
|
1777
|
-
let onPointerCancel = (e)=>{
|
|
1778
|
-
cancelEvent(e);
|
|
1779
|
-
};
|
|
1780
|
-
addGlobalListener((Text.$431fbd86ca7dc216$export$b204af158042fbac)(state.target), 'pointerup', onPointerUp, false);
|
|
1781
|
-
addGlobalListener((Text.$431fbd86ca7dc216$export$b204af158042fbac)(state.target), 'pointercancel', onPointerCancel, false);
|
|
1782
|
-
return ()=>{
|
|
1783
|
-
removeGlobalListener((Text.$431fbd86ca7dc216$export$b204af158042fbac)(state.target), 'pointerup', onPointerUp, false);
|
|
1784
|
-
removeGlobalListener((Text.$431fbd86ca7dc216$export$b204af158042fbac)(state.target), 'pointercancel', onPointerCancel, false);
|
|
1785
|
-
};
|
|
1786
|
-
} else if (isPointerPressed === 'mouse' && process.env.NODE_ENV === 'test') {
|
|
1787
|
-
let onMouseUp = (e)=>{
|
|
1788
|
-
// Only handle left clicks
|
|
1789
|
-
if (e.button !== 0) return;
|
|
1790
|
-
if (state.ignoreEmulatedMouseEvents) {
|
|
1791
|
-
state.ignoreEmulatedMouseEvents = false;
|
|
1792
|
-
return;
|
|
1793
|
-
}
|
|
1794
|
-
if (state.target && (Text.$d4ee10de306f2510$export$4282f70798064fe0)(state.target, e.target) && state.pointerType != null) ;
|
|
1795
|
-
else cancelEvent(e);
|
|
1796
|
-
state.isOverTarget = false;
|
|
1797
|
-
};
|
|
1798
|
-
addGlobalListener((Text.$431fbd86ca7dc216$export$b204af158042fbac)(state.target), 'mouseup', onMouseUp, false);
|
|
1799
|
-
return ()=>{
|
|
1800
|
-
removeGlobalListener((Text.$431fbd86ca7dc216$export$b204af158042fbac)(state.target), 'mouseup', onMouseUp, false);
|
|
1801
|
-
};
|
|
1802
|
-
} else if (isPointerPressed === 'touch' && process.env.NODE_ENV === 'test') {
|
|
1803
|
-
let onScroll = (e)=>{
|
|
1804
|
-
if (state.isPressed && (Text.$d4ee10de306f2510$export$4282f70798064fe0)((Text.$d4ee10de306f2510$export$e58f029f0fbfdb29)(e), state.target)) cancelEvent({
|
|
1805
|
-
currentTarget: state.target,
|
|
1806
|
-
shiftKey: false,
|
|
1807
|
-
ctrlKey: false,
|
|
1808
|
-
metaKey: false,
|
|
1809
|
-
altKey: false
|
|
1810
|
-
});
|
|
1811
|
-
};
|
|
1812
|
-
addGlobalListener((Text.$431fbd86ca7dc216$export$f21a1ffae260145a)(state.target), 'scroll', onScroll, true);
|
|
1813
|
-
return ()=>{
|
|
1814
|
-
removeGlobalListener((Text.$431fbd86ca7dc216$export$f21a1ffae260145a)(state.target), 'scroll', onScroll, true);
|
|
1815
|
-
};
|
|
1816
|
-
}
|
|
1817
|
-
}, [
|
|
1818
|
-
isPointerPressed,
|
|
1819
|
-
addGlobalListener,
|
|
1820
|
-
removeGlobalListener
|
|
1821
|
-
]);
|
|
1649
|
+
});
|
|
1822
1650
|
let pressProps = (React.useMemo)(()=>{
|
|
1823
1651
|
let state = ref.current;
|
|
1824
1652
|
let pressProps = {
|
|
1825
1653
|
onKeyDown (e) {
|
|
1826
|
-
if ($f6c31cce2adf654f$var$isValidKeyboardEvent(e.nativeEvent, e.currentTarget) && (Text.$d4ee10de306f2510$export$4282f70798064fe0)(e.currentTarget, (Text.$d4ee10de306f2510$export$e58f029f0fbfdb29)(e))) {
|
|
1654
|
+
if ($f6c31cce2adf654f$var$isValidKeyboardEvent(e.nativeEvent, e.currentTarget) && (Text.$d4ee10de306f2510$export$4282f70798064fe0)(e.currentTarget, (Text.$d4ee10de306f2510$export$e58f029f0fbfdb29)(e.nativeEvent))) {
|
|
1827
1655
|
var _state_metaKeyEvents;
|
|
1828
|
-
if ($f6c31cce2adf654f$var$shouldPreventDefaultKeyboard((Text.$d4ee10de306f2510$export$e58f029f0fbfdb29)(e), e.key)) e.preventDefault();
|
|
1656
|
+
if ($f6c31cce2adf654f$var$shouldPreventDefaultKeyboard((Text.$d4ee10de306f2510$export$e58f029f0fbfdb29)(e.nativeEvent), e.key)) e.preventDefault();
|
|
1829
1657
|
// If the event is repeating, it may have started on a different element
|
|
1830
1658
|
// after which focus moved to the current element. Ignore these events and
|
|
1831
1659
|
// only handle the first key down event.
|
|
@@ -1833,9 +1661,16 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
1833
1661
|
if (!state.isPressed && !e.repeat) {
|
|
1834
1662
|
state.target = e.currentTarget;
|
|
1835
1663
|
state.isPressed = true;
|
|
1836
|
-
setIsElemKeyPressed(true);
|
|
1837
1664
|
state.pointerType = 'keyboard';
|
|
1838
1665
|
shouldStopPropagation = triggerPressStart(e, 'keyboard');
|
|
1666
|
+
// Focus may move before the key up event, so register the event on the document
|
|
1667
|
+
// instead of the same element where the key down event occurred. Make it capturing so that it will trigger
|
|
1668
|
+
// before stopPropagation from useKeyboard on a child element may happen and thus we can still call triggerPress for the parent element.
|
|
1669
|
+
let originalTarget = e.currentTarget;
|
|
1670
|
+
let pressUp = (e)=>{
|
|
1671
|
+
if ($f6c31cce2adf654f$var$isValidKeyboardEvent(e, originalTarget) && !e.repeat && (Text.$d4ee10de306f2510$export$4282f70798064fe0)(originalTarget, (Text.$d4ee10de306f2510$export$e58f029f0fbfdb29)(e)) && state.target) triggerPressUp($f6c31cce2adf654f$var$createEvent(state.target, e), 'keyboard');
|
|
1672
|
+
};
|
|
1673
|
+
addGlobalListener((Text.$431fbd86ca7dc216$export$b204af158042fbac)(e.currentTarget), 'keyup', (Text.$ff5963eb1fccf552$export$e08e3b67e392101e)(pressUp, onKeyUp), true);
|
|
1839
1674
|
}
|
|
1840
1675
|
if (shouldStopPropagation) e.stopPropagation();
|
|
1841
1676
|
// Keep track of the keydown events that occur while the Meta (e.g. Command) key is held.
|
|
@@ -1849,8 +1684,8 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
1849
1684
|
} else if (e.key === 'Meta') state.metaKeyEvents = new Map();
|
|
1850
1685
|
},
|
|
1851
1686
|
onClick (e) {
|
|
1852
|
-
if (e && !(Text.$d4ee10de306f2510$export$4282f70798064fe0)(e.currentTarget, (Text.$d4ee10de306f2510$export$e58f029f0fbfdb29)(e))) return;
|
|
1853
|
-
if (e && e.button === 0 && !state.isTriggeringEvent && !(
|
|
1687
|
+
if (e && !(Text.$d4ee10de306f2510$export$4282f70798064fe0)(e.currentTarget, (Text.$d4ee10de306f2510$export$e58f029f0fbfdb29)(e.nativeEvent))) return;
|
|
1688
|
+
if (e && e.button === 0 && !state.isTriggeringEvent && !($ea8dcbcb9ea1b556$export$95185d699e05d4d7).isOpening) {
|
|
1854
1689
|
let shouldStopPropagation = true;
|
|
1855
1690
|
if (isDisabled) e.preventDefault();
|
|
1856
1691
|
// If triggered from a screen reader or by using element.click(),
|
|
@@ -1875,10 +1710,41 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
1875
1710
|
}
|
|
1876
1711
|
}
|
|
1877
1712
|
};
|
|
1713
|
+
let onKeyUp = (e)=>{
|
|
1714
|
+
var _state_metaKeyEvents;
|
|
1715
|
+
if (state.isPressed && state.target && $f6c31cce2adf654f$var$isValidKeyboardEvent(e, state.target)) {
|
|
1716
|
+
var _state_metaKeyEvents1;
|
|
1717
|
+
if ($f6c31cce2adf654f$var$shouldPreventDefaultKeyboard((Text.$d4ee10de306f2510$export$e58f029f0fbfdb29)(e), e.key)) e.preventDefault();
|
|
1718
|
+
let target = (Text.$d4ee10de306f2510$export$e58f029f0fbfdb29)(e);
|
|
1719
|
+
let wasPressed = (Text.$d4ee10de306f2510$export$4282f70798064fe0)(state.target, (Text.$d4ee10de306f2510$export$e58f029f0fbfdb29)(e));
|
|
1720
|
+
triggerPressEnd($f6c31cce2adf654f$var$createEvent(state.target, e), 'keyboard', wasPressed);
|
|
1721
|
+
if (wasPressed) triggerSyntheticClick(e, state.target);
|
|
1722
|
+
removeAllGlobalListeners();
|
|
1723
|
+
// If a link was triggered with a key other than Enter, open the URL ourselves.
|
|
1724
|
+
// This means the link has a role override, and the default browser behavior
|
|
1725
|
+
// only applies when using the Enter key.
|
|
1726
|
+
if (e.key !== 'Enter' && $f6c31cce2adf654f$var$isHTMLAnchorLink(state.target) && (Text.$d4ee10de306f2510$export$4282f70798064fe0)(state.target, target) && !e[$f6c31cce2adf654f$var$LINK_CLICKED]) {
|
|
1727
|
+
// Store a hidden property on the event so we only trigger link click once,
|
|
1728
|
+
// even if there are multiple usePress instances attached to the element.
|
|
1729
|
+
e[$f6c31cce2adf654f$var$LINK_CLICKED] = true;
|
|
1730
|
+
($ea8dcbcb9ea1b556$export$95185d699e05d4d7)(state.target, e, false);
|
|
1731
|
+
}
|
|
1732
|
+
state.isPressed = false;
|
|
1733
|
+
(_state_metaKeyEvents1 = state.metaKeyEvents) === null || _state_metaKeyEvents1 === void 0 ? void 0 : _state_metaKeyEvents1.delete(e.key);
|
|
1734
|
+
} else if (e.key === 'Meta' && ((_state_metaKeyEvents = state.metaKeyEvents) === null || _state_metaKeyEvents === void 0 ? void 0 : _state_metaKeyEvents.size)) {
|
|
1735
|
+
var _state_target;
|
|
1736
|
+
// If we recorded keydown events that occurred while the Meta key was pressed,
|
|
1737
|
+
// and those haven't received keyup events already, fire keyup events ourselves.
|
|
1738
|
+
// See comment above for more info about the macOS bug causing this.
|
|
1739
|
+
let events = state.metaKeyEvents;
|
|
1740
|
+
state.metaKeyEvents = undefined;
|
|
1741
|
+
for (let event of events.values())(_state_target = state.target) === null || _state_target === void 0 ? void 0 : _state_target.dispatchEvent(new KeyboardEvent('keyup', event));
|
|
1742
|
+
}
|
|
1743
|
+
};
|
|
1878
1744
|
if (typeof PointerEvent !== 'undefined') {
|
|
1879
1745
|
pressProps.onPointerDown = (e)=>{
|
|
1880
1746
|
// Only handle left clicks, and ignore events that bubbled through portals.
|
|
1881
|
-
if (e.button !== 0 || !(Text.$d4ee10de306f2510$export$4282f70798064fe0)(e.currentTarget, (Text.$d4ee10de306f2510$export$e58f029f0fbfdb29)(e))) return;
|
|
1747
|
+
if (e.button !== 0 || !(Text.$d4ee10de306f2510$export$4282f70798064fe0)(e.currentTarget, (Text.$d4ee10de306f2510$export$e58f029f0fbfdb29)(e.nativeEvent))) return;
|
|
1882
1748
|
// iOS safari fires pointer events from VoiceOver with incorrect coordinates/target.
|
|
1883
1749
|
// Ignore and let the onClick handler take care of it instead.
|
|
1884
1750
|
// https://bugs.webkit.org/show_bug.cgi?id=222627
|
|
@@ -1891,7 +1757,6 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
1891
1757
|
let shouldStopPropagation = true;
|
|
1892
1758
|
if (!state.isPressed) {
|
|
1893
1759
|
state.isPressed = true;
|
|
1894
|
-
setIsPointerPressed('pointer');
|
|
1895
1760
|
state.isOverTarget = true;
|
|
1896
1761
|
state.activePointerId = e.pointerId;
|
|
1897
1762
|
state.target = e.currentTarget;
|
|
@@ -1899,17 +1764,15 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
1899
1764
|
shouldStopPropagation = triggerPressStart(e, state.pointerType);
|
|
1900
1765
|
// Release pointer capture so that touch interactions can leave the original target.
|
|
1901
1766
|
// This enables onPointerLeave and onPointerEnter to fire.
|
|
1902
|
-
let target = (Text.$d4ee10de306f2510$export$e58f029f0fbfdb29)(e);
|
|
1903
|
-
if ('releasePointerCapture' in target)
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
} else target.releasePointerCapture(e.pointerId);
|
|
1907
|
-
}
|
|
1767
|
+
let target = (Text.$d4ee10de306f2510$export$e58f029f0fbfdb29)(e.nativeEvent);
|
|
1768
|
+
if ('releasePointerCapture' in target) target.releasePointerCapture(e.pointerId);
|
|
1769
|
+
addGlobalListener((Text.$431fbd86ca7dc216$export$b204af158042fbac)(e.currentTarget), 'pointerup', onPointerUp, false);
|
|
1770
|
+
addGlobalListener((Text.$431fbd86ca7dc216$export$b204af158042fbac)(e.currentTarget), 'pointercancel', onPointerCancel, false);
|
|
1908
1771
|
}
|
|
1909
1772
|
if (shouldStopPropagation) e.stopPropagation();
|
|
1910
1773
|
};
|
|
1911
1774
|
pressProps.onMouseDown = (e)=>{
|
|
1912
|
-
if (!(Text.$d4ee10de306f2510$export$4282f70798064fe0)(e.currentTarget, (Text.$d4ee10de306f2510$export$e58f029f0fbfdb29)(e))) return;
|
|
1775
|
+
if (!(Text.$d4ee10de306f2510$export$4282f70798064fe0)(e.currentTarget, (Text.$d4ee10de306f2510$export$e58f029f0fbfdb29)(e.nativeEvent))) return;
|
|
1913
1776
|
if (e.button === 0) {
|
|
1914
1777
|
if (preventFocusOnPress) {
|
|
1915
1778
|
let dispose = (Text.$8a9cb279dc87e130$export$cabe61c495ee3649)(e.target);
|
|
@@ -1920,7 +1783,7 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
1920
1783
|
};
|
|
1921
1784
|
pressProps.onPointerUp = (e)=>{
|
|
1922
1785
|
// iOS fires pointerup with zero width and height, so check the pointerType recorded during pointerdown.
|
|
1923
|
-
if (!(Text.$d4ee10de306f2510$export$4282f70798064fe0)(e.currentTarget, (Text.$d4ee10de306f2510$export$e58f029f0fbfdb29)(e)) || state.pointerType === 'virtual') return;
|
|
1786
|
+
if (!(Text.$d4ee10de306f2510$export$4282f70798064fe0)(e.currentTarget, (Text.$d4ee10de306f2510$export$e58f029f0fbfdb29)(e.nativeEvent)) || state.pointerType === 'virtual') return;
|
|
1924
1787
|
// Only handle left clicks. If isPressed is true, delay until onClick.
|
|
1925
1788
|
if (e.button === 0 && !state.isPressed) triggerPressUp(e, state.pointerType || e.pointerType);
|
|
1926
1789
|
};
|
|
@@ -1937,8 +1800,43 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
1937
1800
|
cancelOnPointerExit(e);
|
|
1938
1801
|
}
|
|
1939
1802
|
};
|
|
1803
|
+
let onPointerUp = (e)=>{
|
|
1804
|
+
if (e.pointerId === state.activePointerId && state.isPressed && e.button === 0 && state.target) {
|
|
1805
|
+
if ((Text.$d4ee10de306f2510$export$4282f70798064fe0)(state.target, (Text.$d4ee10de306f2510$export$e58f029f0fbfdb29)(e)) && state.pointerType != null) {
|
|
1806
|
+
// Wait for onClick to fire onPress. This avoids browser issues when the DOM
|
|
1807
|
+
// is mutated between onPointerUp and onClick, and is more compatible with third party libraries.
|
|
1808
|
+
// https://github.com/adobe/react-spectrum/issues/1513
|
|
1809
|
+
// https://issues.chromium.org/issues/40732224
|
|
1810
|
+
// However, iOS and Android do not focus or fire onClick after a long press.
|
|
1811
|
+
// We work around this by triggering a click ourselves after a timeout.
|
|
1812
|
+
// This timeout is canceled during the click event in case the real one fires first.
|
|
1813
|
+
// The timeout must be at least 32ms, because Safari on iOS delays the click event on
|
|
1814
|
+
// non-form elements without certain ARIA roles (for hover emulation).
|
|
1815
|
+
// https://github.com/WebKit/WebKit/blob/dccfae42bb29bd4bdef052e469f604a9387241c0/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm#L875-L892
|
|
1816
|
+
let clicked = false;
|
|
1817
|
+
let timeout = setTimeout(()=>{
|
|
1818
|
+
if (state.isPressed && state.target instanceof HTMLElement) {
|
|
1819
|
+
if (clicked) cancel(e);
|
|
1820
|
+
else {
|
|
1821
|
+
(Text.$7215afc6de606d6b$export$de79e2c695e052f3)(state.target);
|
|
1822
|
+
state.target.click();
|
|
1823
|
+
}
|
|
1824
|
+
}
|
|
1825
|
+
}, 80);
|
|
1826
|
+
// Use a capturing listener to track if a click occurred.
|
|
1827
|
+
// If stopPropagation is called it may never reach our handler.
|
|
1828
|
+
addGlobalListener(e.currentTarget, 'click', ()=>clicked = true, true);
|
|
1829
|
+
state.disposables.push(()=>clearTimeout(timeout));
|
|
1830
|
+
} else cancel(e);
|
|
1831
|
+
// Ignore subsequent onPointerLeave event before onClick on touch devices.
|
|
1832
|
+
state.isOverTarget = false;
|
|
1833
|
+
}
|
|
1834
|
+
};
|
|
1835
|
+
let onPointerCancel = (e)=>{
|
|
1836
|
+
cancel(e);
|
|
1837
|
+
};
|
|
1940
1838
|
pressProps.onDragStart = (e)=>{
|
|
1941
|
-
if (!(Text.$d4ee10de306f2510$export$4282f70798064fe0)(e.currentTarget, (Text.$d4ee10de306f2510$export$e58f029f0fbfdb29)(e))) return;
|
|
1839
|
+
if (!(Text.$d4ee10de306f2510$export$4282f70798064fe0)(e.currentTarget, (Text.$d4ee10de306f2510$export$e58f029f0fbfdb29)(e.nativeEvent))) return;
|
|
1942
1840
|
// Safari does not call onPointerCancel when a drag starts, whereas Chrome and Firefox do.
|
|
1943
1841
|
cancel(e);
|
|
1944
1842
|
};
|
|
@@ -1947,13 +1845,12 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
1947
1845
|
// All browsers now support pointer events, but JSDOM still does not.
|
|
1948
1846
|
pressProps.onMouseDown = (e)=>{
|
|
1949
1847
|
// Only handle left clicks
|
|
1950
|
-
if (e.button !== 0 || !(Text.$d4ee10de306f2510$export$4282f70798064fe0)(e.currentTarget, (Text.$d4ee10de306f2510$export$e58f029f0fbfdb29)(e))) return;
|
|
1848
|
+
if (e.button !== 0 || !(Text.$d4ee10de306f2510$export$4282f70798064fe0)(e.currentTarget, (Text.$d4ee10de306f2510$export$e58f029f0fbfdb29)(e.nativeEvent))) return;
|
|
1951
1849
|
if (state.ignoreEmulatedMouseEvents) {
|
|
1952
1850
|
e.stopPropagation();
|
|
1953
1851
|
return;
|
|
1954
1852
|
}
|
|
1955
1853
|
state.isPressed = true;
|
|
1956
|
-
setIsPointerPressed('mouse');
|
|
1957
1854
|
state.isOverTarget = true;
|
|
1958
1855
|
state.target = e.currentTarget;
|
|
1959
1856
|
state.pointerType = (Text.$6a7db85432448f7f$export$60278871457622de)(e.nativeEvent) ? 'virtual' : 'mouse';
|
|
@@ -1964,9 +1861,10 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
1964
1861
|
let dispose = (Text.$8a9cb279dc87e130$export$cabe61c495ee3649)(e.target);
|
|
1965
1862
|
if (dispose) state.disposables.push(dispose);
|
|
1966
1863
|
}
|
|
1864
|
+
addGlobalListener((Text.$431fbd86ca7dc216$export$b204af158042fbac)(e.currentTarget), 'mouseup', onMouseUp, false);
|
|
1967
1865
|
};
|
|
1968
1866
|
pressProps.onMouseEnter = (e)=>{
|
|
1969
|
-
if (!(Text.$d4ee10de306f2510$export$4282f70798064fe0)(e.currentTarget, (Text.$d4ee10de306f2510$export$e58f029f0fbfdb29)(e))) return;
|
|
1867
|
+
if (!(Text.$d4ee10de306f2510$export$4282f70798064fe0)(e.currentTarget, (Text.$d4ee10de306f2510$export$e58f029f0fbfdb29)(e.nativeEvent))) return;
|
|
1970
1868
|
let shouldStopPropagation = true;
|
|
1971
1869
|
if (state.isPressed && !state.ignoreEmulatedMouseEvents && state.pointerType != null) {
|
|
1972
1870
|
state.isOverTarget = true;
|
|
@@ -1975,7 +1873,7 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
1975
1873
|
if (shouldStopPropagation) e.stopPropagation();
|
|
1976
1874
|
};
|
|
1977
1875
|
pressProps.onMouseLeave = (e)=>{
|
|
1978
|
-
if (!(Text.$d4ee10de306f2510$export$4282f70798064fe0)(e.currentTarget, (Text.$d4ee10de306f2510$export$e58f029f0fbfdb29)(e))) return;
|
|
1876
|
+
if (!(Text.$d4ee10de306f2510$export$4282f70798064fe0)(e.currentTarget, (Text.$d4ee10de306f2510$export$e58f029f0fbfdb29)(e.nativeEvent))) return;
|
|
1979
1877
|
let shouldStopPropagation = true;
|
|
1980
1878
|
if (state.isPressed && !state.ignoreEmulatedMouseEvents && state.pointerType != null) {
|
|
1981
1879
|
state.isOverTarget = false;
|
|
@@ -1985,26 +1883,37 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
1985
1883
|
if (shouldStopPropagation) e.stopPropagation();
|
|
1986
1884
|
};
|
|
1987
1885
|
pressProps.onMouseUp = (e)=>{
|
|
1988
|
-
if (!(Text.$d4ee10de306f2510$export$4282f70798064fe0)(e.currentTarget, (Text.$d4ee10de306f2510$export$e58f029f0fbfdb29)(e))) return;
|
|
1886
|
+
if (!(Text.$d4ee10de306f2510$export$4282f70798064fe0)(e.currentTarget, (Text.$d4ee10de306f2510$export$e58f029f0fbfdb29)(e.nativeEvent))) return;
|
|
1989
1887
|
if (!state.ignoreEmulatedMouseEvents && e.button === 0 && !state.isPressed) triggerPressUp(e, state.pointerType || 'mouse');
|
|
1990
1888
|
};
|
|
1889
|
+
let onMouseUp = (e)=>{
|
|
1890
|
+
// Only handle left clicks
|
|
1891
|
+
if (e.button !== 0) return;
|
|
1892
|
+
if (state.ignoreEmulatedMouseEvents) {
|
|
1893
|
+
state.ignoreEmulatedMouseEvents = false;
|
|
1894
|
+
return;
|
|
1895
|
+
}
|
|
1896
|
+
if (state.target && state.target.contains(e.target) && state.pointerType != null) ;
|
|
1897
|
+
else cancel(e);
|
|
1898
|
+
state.isOverTarget = false;
|
|
1899
|
+
};
|
|
1991
1900
|
pressProps.onTouchStart = (e)=>{
|
|
1992
|
-
if (!(Text.$d4ee10de306f2510$export$4282f70798064fe0)(e.currentTarget, (Text.$d4ee10de306f2510$export$e58f029f0fbfdb29)(e))) return;
|
|
1901
|
+
if (!(Text.$d4ee10de306f2510$export$4282f70798064fe0)(e.currentTarget, (Text.$d4ee10de306f2510$export$e58f029f0fbfdb29)(e.nativeEvent))) return;
|
|
1993
1902
|
let touch = $f6c31cce2adf654f$var$getTouchFromEvent(e.nativeEvent);
|
|
1994
1903
|
if (!touch) return;
|
|
1995
1904
|
state.activePointerId = touch.identifier;
|
|
1996
1905
|
state.ignoreEmulatedMouseEvents = true;
|
|
1997
1906
|
state.isOverTarget = true;
|
|
1998
1907
|
state.isPressed = true;
|
|
1999
|
-
setIsPointerPressed('touch');
|
|
2000
1908
|
state.target = e.currentTarget;
|
|
2001
1909
|
state.pointerType = 'touch';
|
|
2002
1910
|
if (!allowTextSelectionOnPress) ($14c0b72509d70225$export$16a4697467175487)(state.target);
|
|
2003
1911
|
let shouldStopPropagation = triggerPressStart($f6c31cce2adf654f$var$createTouchEvent(state.target, e), state.pointerType);
|
|
2004
1912
|
if (shouldStopPropagation) e.stopPropagation();
|
|
1913
|
+
addGlobalListener((Text.$431fbd86ca7dc216$export$f21a1ffae260145a)(e.currentTarget), 'scroll', onScroll, true);
|
|
2005
1914
|
};
|
|
2006
1915
|
pressProps.onTouchMove = (e)=>{
|
|
2007
|
-
if (!(Text.$d4ee10de306f2510$export$4282f70798064fe0)(e.currentTarget, (Text.$d4ee10de306f2510$export$e58f029f0fbfdb29)(e))) return;
|
|
1916
|
+
if (!(Text.$d4ee10de306f2510$export$4282f70798064fe0)(e.currentTarget, (Text.$d4ee10de306f2510$export$e58f029f0fbfdb29)(e.nativeEvent))) return;
|
|
2008
1917
|
if (!state.isPressed) {
|
|
2009
1918
|
e.stopPropagation();
|
|
2010
1919
|
return;
|
|
@@ -2024,7 +1933,7 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
2024
1933
|
if (shouldStopPropagation) e.stopPropagation();
|
|
2025
1934
|
};
|
|
2026
1935
|
pressProps.onTouchEnd = (e)=>{
|
|
2027
|
-
if (!(Text.$d4ee10de306f2510$export$4282f70798064fe0)(e.currentTarget, (Text.$d4ee10de306f2510$export$e58f029f0fbfdb29)(e))) return;
|
|
1936
|
+
if (!(Text.$d4ee10de306f2510$export$4282f70798064fe0)(e.currentTarget, (Text.$d4ee10de306f2510$export$e58f029f0fbfdb29)(e.nativeEvent))) return;
|
|
2028
1937
|
if (!state.isPressed) {
|
|
2029
1938
|
e.stopPropagation();
|
|
2030
1939
|
return;
|
|
@@ -2038,7 +1947,6 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
2038
1947
|
} else if (state.isOverTarget && state.pointerType != null) shouldStopPropagation = triggerPressEnd($f6c31cce2adf654f$var$createTouchEvent(state.target, e), state.pointerType, false);
|
|
2039
1948
|
if (shouldStopPropagation) e.stopPropagation();
|
|
2040
1949
|
state.isPressed = false;
|
|
2041
|
-
setIsPointerPressed(null);
|
|
2042
1950
|
state.activePointerId = null;
|
|
2043
1951
|
state.isOverTarget = false;
|
|
2044
1952
|
state.ignoreEmulatedMouseEvents = true;
|
|
@@ -2046,17 +1954,27 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
2046
1954
|
removeAllGlobalListeners();
|
|
2047
1955
|
};
|
|
2048
1956
|
pressProps.onTouchCancel = (e)=>{
|
|
2049
|
-
if (!(Text.$d4ee10de306f2510$export$4282f70798064fe0)(e.currentTarget, (Text.$d4ee10de306f2510$export$e58f029f0fbfdb29)(e))) return;
|
|
1957
|
+
if (!(Text.$d4ee10de306f2510$export$4282f70798064fe0)(e.currentTarget, (Text.$d4ee10de306f2510$export$e58f029f0fbfdb29)(e.nativeEvent))) return;
|
|
2050
1958
|
e.stopPropagation();
|
|
2051
1959
|
if (state.isPressed) cancel($f6c31cce2adf654f$var$createTouchEvent(state.target, e));
|
|
2052
1960
|
};
|
|
1961
|
+
let onScroll = (e)=>{
|
|
1962
|
+
if (state.isPressed && (Text.$d4ee10de306f2510$export$4282f70798064fe0)((Text.$d4ee10de306f2510$export$e58f029f0fbfdb29)(e), state.target)) cancel({
|
|
1963
|
+
currentTarget: state.target,
|
|
1964
|
+
shiftKey: false,
|
|
1965
|
+
ctrlKey: false,
|
|
1966
|
+
metaKey: false,
|
|
1967
|
+
altKey: false
|
|
1968
|
+
});
|
|
1969
|
+
};
|
|
2053
1970
|
pressProps.onDragStart = (e)=>{
|
|
2054
|
-
if (!(Text.$d4ee10de306f2510$export$4282f70798064fe0)(e.currentTarget, (Text.$d4ee10de306f2510$export$e58f029f0fbfdb29)(e))) return;
|
|
1971
|
+
if (!(Text.$d4ee10de306f2510$export$4282f70798064fe0)(e.currentTarget, (Text.$d4ee10de306f2510$export$e58f029f0fbfdb29)(e.nativeEvent))) return;
|
|
2055
1972
|
cancel(e);
|
|
2056
1973
|
};
|
|
2057
1974
|
}
|
|
2058
1975
|
return pressProps;
|
|
2059
1976
|
}, [
|
|
1977
|
+
addGlobalListener,
|
|
2060
1978
|
isDisabled,
|
|
2061
1979
|
preventFocusOnPress,
|
|
2062
1980
|
removeAllGlobalListeners,
|
|
@@ -2161,8 +2079,7 @@ function $f6c31cce2adf654f$var$createEvent(target, e) {
|
|
|
2161
2079
|
metaKey: e.metaKey,
|
|
2162
2080
|
altKey: e.altKey,
|
|
2163
2081
|
clientX: clientX,
|
|
2164
|
-
clientY: clientY
|
|
2165
|
-
key: e.key
|
|
2082
|
+
clientY: clientY
|
|
2166
2083
|
};
|
|
2167
2084
|
}
|
|
2168
2085
|
function $f6c31cce2adf654f$var$getPointClientRect(point) {
|
|
@@ -2285,15 +2202,16 @@ const $3b117e43dc0ca95d$export$27c701ed9e449e99 = /*#__PURE__*/ (React).forwardR
|
|
|
2285
2202
|
const $f1ab8c75478c6f73$export$3351871ee4b288b8 = /*#__PURE__*/ (React).forwardRef(({ children: children, ...props }, ref)=>{
|
|
2286
2203
|
let isRegistered = (React.useRef)(false);
|
|
2287
2204
|
let prevContext = (React.useContext)(($ae1eeba8b9eafd08$export$5165eccb35aaadb5));
|
|
2205
|
+
ref = (Text.$df56164dff5785e2$export$4338b53315abf666)(ref || (prevContext === null || prevContext === void 0 ? void 0 : prevContext.ref));
|
|
2288
2206
|
let context = (Text.$3ef42575df84b30b$export$9d1611c77c2fe928)(prevContext || {}, {
|
|
2289
2207
|
...props,
|
|
2208
|
+
ref: ref,
|
|
2290
2209
|
register () {
|
|
2291
2210
|
isRegistered.current = true;
|
|
2292
2211
|
if (prevContext) prevContext.register();
|
|
2293
2212
|
}
|
|
2294
2213
|
});
|
|
2295
|
-
|
|
2296
|
-
(Text.$e7801be82b4b2a53$export$4debdb1a3f0fa79e)(prevContext, context.ref);
|
|
2214
|
+
(Text.$e7801be82b4b2a53$export$4debdb1a3f0fa79e)(prevContext, ref);
|
|
2297
2215
|
(React.useEffect)(()=>{
|
|
2298
2216
|
if (!isRegistered.current) {
|
|
2299
2217
|
if (process.env.NODE_ENV !== 'production') console.warn("A PressResponder was rendered without a pressable child. Either call the usePress hook, or wrap your DOM node with <Pressable> component.");
|
|
@@ -2388,18 +2306,19 @@ function $e0b6e0b68ec7f50f$export$872b660ac5a1ff98(props) {
|
|
|
2388
2306
|
}
|
|
2389
2307
|
}, [
|
|
2390
2308
|
ref,
|
|
2391
|
-
isDisabled
|
|
2309
|
+
isDisabled,
|
|
2310
|
+
onPointerDown,
|
|
2311
|
+
triggerInteractOutside
|
|
2392
2312
|
]);
|
|
2393
2313
|
}
|
|
2394
2314
|
function $e0b6e0b68ec7f50f$var$isValidEvent(event, ref) {
|
|
2395
2315
|
if (event.button > 0) return false;
|
|
2396
|
-
|
|
2397
|
-
if (target) {
|
|
2316
|
+
if (event.target) {
|
|
2398
2317
|
// if the event target is no longer in the document, ignore
|
|
2399
|
-
const ownerDocument = target.ownerDocument;
|
|
2400
|
-
if (!ownerDocument || !
|
|
2318
|
+
const ownerDocument = event.target.ownerDocument;
|
|
2319
|
+
if (!ownerDocument || !ownerDocument.documentElement.contains(event.target)) return false;
|
|
2401
2320
|
// If the target is within a top layer element (e.g. toasts), ignore.
|
|
2402
|
-
if (target.closest('[data-react-aria-top-layer]')) return false;
|
|
2321
|
+
if (event.target.closest('[data-react-aria-top-layer]')) return false;
|
|
2403
2322
|
}
|
|
2404
2323
|
if (!ref.current) return false;
|
|
2405
2324
|
// When the event source is inside a Shadow DOM, event.target is just the shadow root.
|
|
@@ -2686,23 +2605,22 @@ function $9bf71ea28793e738$var$shouldContainFocus(scopeRef) {
|
|
|
2686
2605
|
}
|
|
2687
2606
|
return true;
|
|
2688
2607
|
}
|
|
2689
|
-
function $9bf71ea28793e738$var$getRadiosInGroup(element) {
|
|
2690
|
-
if (!element.form) // Radio buttons outside a form - query the document
|
|
2691
|
-
return Array.from((Text.$431fbd86ca7dc216$export$b204af158042fbac)(element).querySelectorAll(`input[type="radio"][name="${CSS.escape(element.name)}"]`)).filter((radio)=>!radio.form);
|
|
2692
|
-
// namedItem returns RadioNodeList (iterable) for 2+ elements, but a single Element for exactly 1.
|
|
2693
|
-
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormControlsCollection/namedItem
|
|
2694
|
-
const radioList = element.form.elements.namedItem(element.name);
|
|
2695
|
-
let ownerWindow = (Text.$431fbd86ca7dc216$export$f21a1ffae260145a)(element);
|
|
2696
|
-
if (radioList instanceof ownerWindow.RadioNodeList) return Array.from(radioList).filter((el)=>el instanceof ownerWindow.HTMLInputElement);
|
|
2697
|
-
if (radioList instanceof ownerWindow.HTMLInputElement) return [
|
|
2698
|
-
radioList
|
|
2699
|
-
];
|
|
2700
|
-
return [];
|
|
2701
|
-
}
|
|
2702
2608
|
function $9bf71ea28793e738$var$isTabbableRadio(element) {
|
|
2703
2609
|
if (element.checked) return true;
|
|
2704
|
-
|
|
2705
|
-
|
|
2610
|
+
let radios = [];
|
|
2611
|
+
if (!element.form) radios = [
|
|
2612
|
+
...(Text.$431fbd86ca7dc216$export$b204af158042fbac)(element).querySelectorAll(`input[type="radio"][name="${CSS.escape(element.name)}"]`)
|
|
2613
|
+
].filter((radio)=>!radio.form);
|
|
2614
|
+
else {
|
|
2615
|
+
var _element_form_elements, _element_form;
|
|
2616
|
+
let radioList = (_element_form = element.form) === null || _element_form === void 0 ? void 0 : (_element_form_elements = _element_form.elements) === null || _element_form_elements === void 0 ? void 0 : _element_form_elements.namedItem(element.name);
|
|
2617
|
+
radios = [
|
|
2618
|
+
...radioList !== null && radioList !== void 0 ? radioList : []
|
|
2619
|
+
];
|
|
2620
|
+
}
|
|
2621
|
+
if (!radios) return false;
|
|
2622
|
+
let anyChecked = radios.some((radio)=>radio.checked);
|
|
2623
|
+
return !anyChecked;
|
|
2706
2624
|
}
|
|
2707
2625
|
function $9bf71ea28793e738$var$useFocusContainment(scopeRef, contain) {
|
|
2708
2626
|
let focusedNode = (React.useRef)(undefined);
|
|
@@ -2802,7 +2720,7 @@ function $9bf71ea28793e738$var$isElementInAnyScope(element) {
|
|
|
2802
2720
|
function $9bf71ea28793e738$var$isElementInScope(element, scope) {
|
|
2803
2721
|
if (!element) return false;
|
|
2804
2722
|
if (!scope) return false;
|
|
2805
|
-
return scope.some((node)=>(
|
|
2723
|
+
return scope.some((node)=>node.contains(element));
|
|
2806
2724
|
}
|
|
2807
2725
|
function $9bf71ea28793e738$var$isElementInChildScope(element, scope = null) {
|
|
2808
2726
|
// If the element is within a top layer element (e.g. toasts), always allow moving focus there.
|
|
@@ -3049,8 +2967,9 @@ function $9bf71ea28793e738$export$2d6ec8fc375ceafa(root, opts, scope) {
|
|
|
3049
2967
|
// Create a TreeWalker, ensuring the root is an Element or Document
|
|
3050
2968
|
let walker = ($dfc540311bf7f109$export$4d0f8be8b12a7ef6)(doc, root || doc, NodeFilter.SHOW_ELEMENT, {
|
|
3051
2969
|
acceptNode (node) {
|
|
2970
|
+
var _opts_from;
|
|
3052
2971
|
// Skip nodes inside the starting node.
|
|
3053
|
-
if (
|
|
2972
|
+
if (opts === null || opts === void 0 ? void 0 : (_opts_from = opts.from) === null || _opts_from === void 0 ? void 0 : _opts_from.contains(node)) return NodeFilter.FILTER_REJECT;
|
|
3054
2973
|
if ((opts === null || opts === void 0 ? void 0 : opts.tabbable) && node.tagName === 'INPUT' && node.getAttribute('type') === 'radio') {
|
|
3055
2974
|
// If the radio is in a form, we can get all the other radios by name
|
|
3056
2975
|
if (!$9bf71ea28793e738$var$isTabbableRadio(node)) return NodeFilter.FILTER_REJECT;
|
|
@@ -3183,11 +3102,9 @@ function $55f9b1ae81f22853$export$759df0d867455a91(document) {
|
|
|
3183
3102
|
*/
|
|
3184
3103
|
|
|
3185
3104
|
|
|
3186
|
-
|
|
3187
3105
|
const $a11501f3d1d39e6c$var$visibleOverlays = [];
|
|
3188
3106
|
function $a11501f3d1d39e6c$export$ea8f71083e90600f(props, ref) {
|
|
3189
3107
|
let { onClose: onClose, shouldCloseOnBlur: shouldCloseOnBlur, isOpen: isOpen, isDismissable: isDismissable = false, isKeyboardDismissDisabled: isKeyboardDismissDisabled = false, shouldCloseOnInteractOutside: shouldCloseOnInteractOutside } = props;
|
|
3190
|
-
let lastVisibleOverlay = (React.useRef)(undefined);
|
|
3191
3108
|
// Add the overlay ref to the stack of visible overlays on mount, and remove on unmount.
|
|
3192
3109
|
(React.useEffect)(()=>{
|
|
3193
3110
|
if (isOpen && !$a11501f3d1d39e6c$var$visibleOverlays.includes(ref)) {
|
|
@@ -3206,24 +3123,21 @@ function $a11501f3d1d39e6c$export$ea8f71083e90600f(props, ref) {
|
|
|
3206
3123
|
if ($a11501f3d1d39e6c$var$visibleOverlays[$a11501f3d1d39e6c$var$visibleOverlays.length - 1] === ref && onClose) onClose();
|
|
3207
3124
|
};
|
|
3208
3125
|
let onInteractOutsideStart = (e)=>{
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
if (!shouldCloseOnInteractOutside || shouldCloseOnInteractOutside((Text.$d4ee10de306f2510$export$e58f029f0fbfdb29)(e))) {
|
|
3212
|
-
if (topMostOverlay === ref) {
|
|
3126
|
+
if (!shouldCloseOnInteractOutside || shouldCloseOnInteractOutside(e.target)) {
|
|
3127
|
+
if ($a11501f3d1d39e6c$var$visibleOverlays[$a11501f3d1d39e6c$var$visibleOverlays.length - 1] === ref) {
|
|
3213
3128
|
e.stopPropagation();
|
|
3214
3129
|
e.preventDefault();
|
|
3215
3130
|
}
|
|
3216
3131
|
}
|
|
3217
3132
|
};
|
|
3218
3133
|
let onInteractOutside = (e)=>{
|
|
3219
|
-
if (!shouldCloseOnInteractOutside || shouldCloseOnInteractOutside(
|
|
3134
|
+
if (!shouldCloseOnInteractOutside || shouldCloseOnInteractOutside(e.target)) {
|
|
3220
3135
|
if ($a11501f3d1d39e6c$var$visibleOverlays[$a11501f3d1d39e6c$var$visibleOverlays.length - 1] === ref) {
|
|
3221
3136
|
e.stopPropagation();
|
|
3222
3137
|
e.preventDefault();
|
|
3223
3138
|
}
|
|
3224
|
-
|
|
3139
|
+
onHide();
|
|
3225
3140
|
}
|
|
3226
|
-
lastVisibleOverlay.current = undefined;
|
|
3227
3141
|
};
|
|
3228
3142
|
// Handle the escape key
|
|
3229
3143
|
let onKeyDown = (e)=>{
|
|
@@ -3257,7 +3171,7 @@ function $a11501f3d1d39e6c$export$ea8f71083e90600f(props, ref) {
|
|
|
3257
3171
|
});
|
|
3258
3172
|
let onPointerDownUnderlay = (e)=>{
|
|
3259
3173
|
// fixes a firefox issue that starts text selection https://bugzilla.mozilla.org/show_bug.cgi?id=1675846
|
|
3260
|
-
if (
|
|
3174
|
+
if (e.target === e.currentTarget) e.preventDefault();
|
|
3261
3175
|
};
|
|
3262
3176
|
return {
|
|
3263
3177
|
overlayProps: {
|
|
@@ -3324,6 +3238,18 @@ function $628037886ba31236$export$f9d5c8beee7d008d(props, state, ref) {
|
|
|
3324
3238
|
* governing permissions and limitations under the License.
|
|
3325
3239
|
*/
|
|
3326
3240
|
const $49c51c25361d4cd2$var$visualViewport = typeof document !== 'undefined' && window.visualViewport;
|
|
3241
|
+
// HTML input types that do not cause the software keyboard to appear.
|
|
3242
|
+
const $49c51c25361d4cd2$var$nonTextInputTypes = new Set([
|
|
3243
|
+
'checkbox',
|
|
3244
|
+
'radio',
|
|
3245
|
+
'range',
|
|
3246
|
+
'color',
|
|
3247
|
+
'file',
|
|
3248
|
+
'image',
|
|
3249
|
+
'button',
|
|
3250
|
+
'submit',
|
|
3251
|
+
'reset'
|
|
3252
|
+
]);
|
|
3327
3253
|
// The number of active usePreventScroll calls. Used to determine whether to revert back to the original page style/scroll position
|
|
3328
3254
|
let $49c51c25361d4cd2$var$preventScrollCount = 0;
|
|
3329
3255
|
let $49c51c25361d4cd2$var$restore;
|
|
@@ -3368,46 +3294,29 @@ function $49c51c25361d4cd2$var$preventScrollStandard() {
|
|
|
3368
3294
|
// on the window.
|
|
3369
3295
|
// 2. Set `overscroll-behavior: contain` on nested scrollable regions so they do not scroll the page when at
|
|
3370
3296
|
// the top or bottom. Work around a bug where this does not work when the element does not actually overflow
|
|
3371
|
-
// by preventing default in a `touchmove` event.
|
|
3372
|
-
// zooming or when an element contains text selection, which may allow scrolling in some cases.
|
|
3297
|
+
// by preventing default in a `touchmove` event.
|
|
3373
3298
|
// 3. Prevent default on `touchend` events on input elements and handle focusing the element ourselves.
|
|
3374
|
-
// 4. When
|
|
3375
|
-
//
|
|
3376
|
-
// ourselves, without scrolling the whole page.
|
|
3299
|
+
// 4. When focusing an input, apply a transform to trick Safari into thinking the input is at the top
|
|
3300
|
+
// of the page, which prevents it from scrolling the page. After the input is focused, scroll the element
|
|
3301
|
+
// into view ourselves, without scrolling the whole page.
|
|
3302
|
+
// 5. Offset the body by the scroll position using a negative margin and scroll to the top. This should appear the
|
|
3303
|
+
// same visually, but makes the actual scroll position always zero. This is required to make all of the
|
|
3304
|
+
// above work or Safari will still try to scroll the page when focusing an input.
|
|
3305
|
+
// 6. As a last resort, handle window scroll events, and scroll back to the top. This can happen when attempting
|
|
3306
|
+
// to navigate to an input with the next/previous buttons that's outside a modal.
|
|
3377
3307
|
function $49c51c25361d4cd2$var$preventScrollMobileSafari() {
|
|
3378
|
-
// Set overflow hidden so scrollIntoViewport() (useSelectableCollection) sees isScrollPrevented and
|
|
3379
|
-
// scrolls only scroll parents instead of calling native scrollIntoView() which moves the window.
|
|
3380
|
-
let restoreOverflow = $49c51c25361d4cd2$var$setStyle(document.documentElement, 'overflow', 'hidden');
|
|
3381
3308
|
let scrollable;
|
|
3382
|
-
let
|
|
3309
|
+
let restoreScrollableStyles;
|
|
3383
3310
|
let onTouchStart = (e)=>{
|
|
3384
3311
|
// Store the nearest scrollable parent element from the element that the user touched.
|
|
3385
|
-
|
|
3386
|
-
scrollable
|
|
3387
|
-
|
|
3388
|
-
//
|
|
3389
|
-
|
|
3390
|
-
if (
|
|
3391
|
-
// If this is a range input, allow touch move to allow user to adjust the slider value
|
|
3392
|
-
if (e.composedPath().some((el)=>el instanceof HTMLInputElement && el.type === 'range')) allowTouchMove = true;
|
|
3393
|
-
// If this is a focused input element with a selected range, allow user to drag the selection handles.
|
|
3394
|
-
if ('selectionStart' in target && 'selectionEnd' in target && target.selectionStart < target.selectionEnd && target.ownerDocument.activeElement === target) allowTouchMove = true;
|
|
3312
|
+
scrollable = ($62d8ded9296f3872$export$cfa2225e87938781)(e.target, true);
|
|
3313
|
+
if (scrollable === document.documentElement && scrollable === document.body) return;
|
|
3314
|
+
// Prevent scrolling up when at the top and scrolling down when at the bottom
|
|
3315
|
+
// of a nested scrollable area, otherwise mobile Safari will start scrolling
|
|
3316
|
+
// the window instead.
|
|
3317
|
+
if (scrollable instanceof HTMLElement && window.getComputedStyle(scrollable).overscrollBehavior === 'auto') restoreScrollableStyles = $49c51c25361d4cd2$var$setStyle(scrollable, 'overscrollBehavior', 'contain');
|
|
3395
3318
|
};
|
|
3396
|
-
// Prevent scrolling up when at the top and scrolling down when at the bottom
|
|
3397
|
-
// of a nested scrollable area, otherwise mobile Safari will start scrolling
|
|
3398
|
-
// the window instead.
|
|
3399
|
-
// This must be applied before the touchstart event as of iOS 26, so inject it as a <style> element.
|
|
3400
|
-
let style = document.createElement('style');
|
|
3401
|
-
style.textContent = `
|
|
3402
|
-
@layer {
|
|
3403
|
-
* {
|
|
3404
|
-
overscroll-behavior: contain;
|
|
3405
|
-
}
|
|
3406
|
-
}`.trim();
|
|
3407
|
-
document.head.prepend(style);
|
|
3408
3319
|
let onTouchMove = (e)=>{
|
|
3409
|
-
// Allow pinch-zooming.
|
|
3410
|
-
if (e.touches.length === 2 || allowTouchMove) return;
|
|
3411
3320
|
// Prevent scrolling the window.
|
|
3412
3321
|
if (!scrollable || scrollable === document.documentElement || scrollable === document.body) {
|
|
3413
3322
|
e.preventDefault();
|
|
@@ -3421,40 +3330,53 @@ function $49c51c25361d4cd2$var$preventScrollMobileSafari() {
|
|
|
3421
3330
|
// because it must be set before the touchstart event.
|
|
3422
3331
|
if (scrollable.scrollHeight === scrollable.clientHeight && scrollable.scrollWidth === scrollable.clientWidth) e.preventDefault();
|
|
3423
3332
|
};
|
|
3424
|
-
let
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3333
|
+
let onTouchEnd = ()=>{
|
|
3334
|
+
if (restoreScrollableStyles) restoreScrollableStyles();
|
|
3335
|
+
};
|
|
3336
|
+
let onFocus = (e)=>{
|
|
3337
|
+
let target = e.target;
|
|
3338
|
+
if ($49c51c25361d4cd2$var$willOpenKeyboard(target)) {
|
|
3339
|
+
setupStyles();
|
|
3340
|
+
// Apply a transform to trick Safari into thinking the input is at the top of the page
|
|
3341
|
+
// so it doesn't try to scroll it into view.
|
|
3342
|
+
target.style.transform = 'translateY(-2000px)';
|
|
3343
|
+
requestAnimationFrame(()=>{
|
|
3344
|
+
target.style.transform = '';
|
|
3345
|
+
// This will have prevented the browser from scrolling the focused element into view,
|
|
3346
|
+
// so we need to do this ourselves in a way that doesn't cause the whole page to scroll.
|
|
3347
|
+
if ($49c51c25361d4cd2$var$visualViewport) {
|
|
3348
|
+
if ($49c51c25361d4cd2$var$visualViewport.height < window.innerHeight) // If the keyboard is already visible, do this after one additional frame
|
|
3349
|
+
// to wait for the transform to be removed.
|
|
3350
|
+
requestAnimationFrame(()=>{
|
|
3351
|
+
$49c51c25361d4cd2$var$scrollIntoView(target);
|
|
3352
|
+
});
|
|
3353
|
+
else // Otherwise, wait for the visual viewport to resize before scrolling so we can
|
|
3354
|
+
// measure the correct position to scroll to.
|
|
3355
|
+
$49c51c25361d4cd2$var$visualViewport.addEventListener('resize', ()=>$49c51c25361d4cd2$var$scrollIntoView(target), {
|
|
3356
|
+
once: true
|
|
3357
|
+
});
|
|
3358
|
+
}
|
|
3443
3359
|
});
|
|
3444
3360
|
}
|
|
3445
3361
|
};
|
|
3446
|
-
|
|
3447
|
-
let
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3362
|
+
let restoreStyles = null;
|
|
3363
|
+
let setupStyles = ()=>{
|
|
3364
|
+
if (restoreStyles) return;
|
|
3365
|
+
let onWindowScroll = ()=>{
|
|
3366
|
+
// Last resort. If the window scrolled, scroll it back to the top.
|
|
3367
|
+
// It should always be at the top because the body will have a negative margin (see below).
|
|
3368
|
+
window.scrollTo(0, 0);
|
|
3369
|
+
};
|
|
3370
|
+
// Record the original scroll position so we can restore it.
|
|
3371
|
+
// Then apply a negative margin to the body to offset it by the scroll position. This will
|
|
3372
|
+
// enable us to scroll the window to the top, which is required for the rest of this to work.
|
|
3373
|
+
let scrollX = window.pageXOffset;
|
|
3374
|
+
let scrollY = window.pageYOffset;
|
|
3375
|
+
restoreStyles = (Text.$ff5963eb1fccf552$export$e08e3b67e392101e)($49c51c25361d4cd2$var$addEvent(window, 'scroll', onWindowScroll), $49c51c25361d4cd2$var$setStyle(document.documentElement, 'paddingRight', `${window.innerWidth - document.documentElement.clientWidth}px`), $49c51c25361d4cd2$var$setStyle(document.documentElement, 'overflow', 'hidden'), $49c51c25361d4cd2$var$setStyle(document.body, 'marginTop', `-${scrollY}px`), ()=>{
|
|
3376
|
+
window.scrollTo(scrollX, scrollY);
|
|
3456
3377
|
});
|
|
3457
|
-
|
|
3378
|
+
// Scroll to the top. The negative margin on the body will make this appear the same.
|
|
3379
|
+
window.scrollTo(0, 0);
|
|
3458
3380
|
};
|
|
3459
3381
|
let removeEvents = (Text.$ff5963eb1fccf552$export$e08e3b67e392101e)($49c51c25361d4cd2$var$addEvent(document, 'touchstart', onTouchStart, {
|
|
3460
3382
|
passive: false,
|
|
@@ -3462,12 +3384,15 @@ function $49c51c25361d4cd2$var$preventScrollMobileSafari() {
|
|
|
3462
3384
|
}), $49c51c25361d4cd2$var$addEvent(document, 'touchmove', onTouchMove, {
|
|
3463
3385
|
passive: false,
|
|
3464
3386
|
capture: true
|
|
3465
|
-
}), $49c51c25361d4cd2$var$addEvent(document, '
|
|
3387
|
+
}), $49c51c25361d4cd2$var$addEvent(document, 'touchend', onTouchEnd, {
|
|
3388
|
+
passive: false,
|
|
3389
|
+
capture: true
|
|
3390
|
+
}), $49c51c25361d4cd2$var$addEvent(document, 'focus', onFocus, true));
|
|
3466
3391
|
return ()=>{
|
|
3467
|
-
|
|
3392
|
+
// Restore styles and scroll the page back to where it was.
|
|
3393
|
+
restoreScrollableStyles === null || restoreScrollableStyles === void 0 ? void 0 : restoreScrollableStyles();
|
|
3394
|
+
restoreStyles === null || restoreStyles === void 0 ? void 0 : restoreStyles();
|
|
3468
3395
|
removeEvents();
|
|
3469
|
-
style.remove();
|
|
3470
|
-
HTMLElement.prototype.focus = focus;
|
|
3471
3396
|
};
|
|
3472
3397
|
}
|
|
3473
3398
|
// Sets a CSS property on an element, and returns a function to revert it to the previous value.
|
|
@@ -3488,15 +3413,6 @@ function $49c51c25361d4cd2$var$addEvent(target, event, handler, options) {
|
|
|
3488
3413
|
target.removeEventListener(event, handler, options);
|
|
3489
3414
|
};
|
|
3490
3415
|
}
|
|
3491
|
-
function $49c51c25361d4cd2$var$scrollIntoViewWhenReady(target, wasKeyboardVisible) {
|
|
3492
|
-
if (wasKeyboardVisible || !$49c51c25361d4cd2$var$visualViewport) // If the keyboard was already visible, scroll the target into view immediately.
|
|
3493
|
-
$49c51c25361d4cd2$var$scrollIntoView(target);
|
|
3494
|
-
else // Otherwise, wait for the visual viewport to resize before scrolling so we can
|
|
3495
|
-
// measure the correct position to scroll to.
|
|
3496
|
-
$49c51c25361d4cd2$var$visualViewport.addEventListener('resize', ()=>$49c51c25361d4cd2$var$scrollIntoView(target), {
|
|
3497
|
-
once: true
|
|
3498
|
-
});
|
|
3499
|
-
}
|
|
3500
3416
|
function $49c51c25361d4cd2$var$scrollIntoView(target) {
|
|
3501
3417
|
let root = document.scrollingElement || document.documentElement;
|
|
3502
3418
|
let nextTarget = target;
|
|
@@ -3504,23 +3420,16 @@ function $49c51c25361d4cd2$var$scrollIntoView(target) {
|
|
|
3504
3420
|
// Find the parent scrollable element and adjust the scroll position if the target is not already in view.
|
|
3505
3421
|
let scrollable = ($62d8ded9296f3872$export$cfa2225e87938781)(nextTarget);
|
|
3506
3422
|
if (scrollable !== document.documentElement && scrollable !== document.body && scrollable !== nextTarget) {
|
|
3507
|
-
let
|
|
3508
|
-
let
|
|
3509
|
-
if (
|
|
3510
|
-
let bottom = scrollableRect.bottom;
|
|
3511
|
-
if ($49c51c25361d4cd2$var$visualViewport) bottom = Math.min(bottom, $49c51c25361d4cd2$var$visualViewport.offsetTop + $49c51c25361d4cd2$var$visualViewport.height);
|
|
3512
|
-
// Center within the viewport.
|
|
3513
|
-
let adjustment = targetRect.top - scrollableRect.top - ((bottom - scrollableRect.top) / 2 - targetRect.height / 2);
|
|
3514
|
-
scrollable.scrollTo({
|
|
3515
|
-
// Clamp to the valid range to prevent over-scrolling.
|
|
3516
|
-
top: Math.max(0, Math.min(scrollable.scrollHeight - scrollable.clientHeight, scrollable.scrollTop + adjustment)),
|
|
3517
|
-
behavior: 'smooth'
|
|
3518
|
-
});
|
|
3519
|
-
}
|
|
3423
|
+
let scrollableTop = scrollable.getBoundingClientRect().top;
|
|
3424
|
+
let targetTop = nextTarget.getBoundingClientRect().top;
|
|
3425
|
+
if (targetTop > scrollableTop + nextTarget.clientHeight) scrollable.scrollTop += targetTop - scrollableTop;
|
|
3520
3426
|
}
|
|
3521
3427
|
nextTarget = scrollable.parentElement;
|
|
3522
3428
|
}
|
|
3523
3429
|
}
|
|
3430
|
+
function $49c51c25361d4cd2$var$willOpenKeyboard(target) {
|
|
3431
|
+
return target instanceof HTMLInputElement && !$49c51c25361d4cd2$var$nonTextInputTypes.has(target.type) || target instanceof HTMLTextAreaElement || target instanceof HTMLElement && target.isContentEditable;
|
|
3432
|
+
}
|
|
3524
3433
|
|
|
3525
3434
|
/*
|
|
3526
3435
|
* Copyright 2024 Adobe. All rights reserved.
|
|
@@ -3886,7 +3795,6 @@ function $86ea4cb521eb2e37$export$2317d149ed6f78c4(props) {
|
|
|
3886
3795
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
3887
3796
|
* governing permissions and limitations under the License.
|
|
3888
3797
|
*/
|
|
3889
|
-
|
|
3890
3798
|
const $5e3802645cc19319$var$supportsInert = typeof HTMLElement !== 'undefined' && 'inert' in HTMLElement.prototype;
|
|
3891
3799
|
// Keeps a ref count of all hidden elements. Added to when hiding an element, and
|
|
3892
3800
|
// subtracted from when showing it again. When it reaches zero, aria-hidden is removed.
|
|
@@ -3915,17 +3823,6 @@ function $5e3802645cc19319$export$1c3ebcada18427bf(targets, options) {
|
|
|
3915
3823
|
element.inert = false;
|
|
3916
3824
|
}
|
|
3917
3825
|
};
|
|
3918
|
-
let shadowRootsToWatch = new Set();
|
|
3919
|
-
if ((Text.$f4e2df6bd15f8569$export$98658e8c59125e6a)()) // find all shadow roots that are ancestors of the targets
|
|
3920
|
-
// traverse upwards until the root is reached
|
|
3921
|
-
for (let target of targets){
|
|
3922
|
-
let node = target;
|
|
3923
|
-
while(node && node !== root){
|
|
3924
|
-
let root = node.getRootNode();
|
|
3925
|
-
if ('shadowRoot' in root) shadowRootsToWatch.add(root.shadowRoot);
|
|
3926
|
-
node = root.parentNode;
|
|
3927
|
-
}
|
|
3928
|
-
}
|
|
3929
3826
|
let walk = (root)=>{
|
|
3930
3827
|
// Keep live announcer and top layer elements (e.g. toasts) visible.
|
|
3931
3828
|
for (let element of root.querySelectorAll('[data-live-announcer], [data-react-aria-top-layer]'))visibleNodes.add(element);
|
|
@@ -3937,11 +3834,11 @@ function $5e3802645cc19319$export$1c3ebcada18427bf(targets, options) {
|
|
|
3937
3834
|
if (hiddenNodes.has(node) || visibleNodes.has(node) || node.parentElement && hiddenNodes.has(node.parentElement) && node.parentElement.getAttribute('role') !== 'row') return NodeFilter.FILTER_REJECT;
|
|
3938
3835
|
// Skip this node but continue to children if one of the targets is inside the node.
|
|
3939
3836
|
for (let target of visibleNodes){
|
|
3940
|
-
if ((
|
|
3837
|
+
if (node.contains(target)) return NodeFilter.FILTER_SKIP;
|
|
3941
3838
|
}
|
|
3942
3839
|
return NodeFilter.FILTER_ACCEPT;
|
|
3943
3840
|
};
|
|
3944
|
-
let walker = (
|
|
3841
|
+
let walker = document.createTreeWalker(root, NodeFilter.SHOW_ELEMENT, {
|
|
3945
3842
|
acceptNode: acceptNode
|
|
3946
3843
|
});
|
|
3947
3844
|
// TreeWalker does not include the root.
|
|
@@ -3974,56 +3871,19 @@ function $5e3802645cc19319$export$1c3ebcada18427bf(targets, options) {
|
|
|
3974
3871
|
if (change.type !== 'childList') continue;
|
|
3975
3872
|
// If the parent element of the added nodes is not within one of the targets,
|
|
3976
3873
|
// and not already inside a hidden node, hide all of the new children.
|
|
3977
|
-
if (
|
|
3874
|
+
if (![
|
|
3978
3875
|
...visibleNodes,
|
|
3979
3876
|
...hiddenNodes
|
|
3980
|
-
].some((node)=>(
|
|
3877
|
+
].some((node)=>node.contains(change.target))) for (let node of change.addedNodes){
|
|
3981
3878
|
if ((node instanceof HTMLElement || node instanceof SVGElement) && (node.dataset.liveAnnouncer === 'true' || node.dataset.reactAriaTopLayer === 'true')) visibleNodes.add(node);
|
|
3982
3879
|
else if (node instanceof Element) walk(node);
|
|
3983
3880
|
}
|
|
3984
|
-
if ((Text.$f4e2df6bd15f8569$export$98658e8c59125e6a)()) {
|
|
3985
|
-
// if any of the observed shadow roots were removed, stop observing them
|
|
3986
|
-
for (let shadowRoot of shadowRootsToWatch)if (!shadowRoot.isConnected) {
|
|
3987
|
-
observer.disconnect();
|
|
3988
|
-
break;
|
|
3989
|
-
}
|
|
3990
|
-
}
|
|
3991
3881
|
}
|
|
3992
3882
|
});
|
|
3993
3883
|
observer.observe(root, {
|
|
3994
3884
|
childList: true,
|
|
3995
3885
|
subtree: true
|
|
3996
3886
|
});
|
|
3997
|
-
let shadowObservers = new Set();
|
|
3998
|
-
if ((Text.$f4e2df6bd15f8569$export$98658e8c59125e6a)()) for (let shadowRoot of shadowRootsToWatch){
|
|
3999
|
-
// Disconnect single target instead of all https://github.com/whatwg/dom/issues/126
|
|
4000
|
-
let shadowObserver = new MutationObserver((changes)=>{
|
|
4001
|
-
for (let change of changes){
|
|
4002
|
-
if (change.type !== 'childList') continue;
|
|
4003
|
-
// If the parent element of the added nodes is not within one of the targets,
|
|
4004
|
-
// and not already inside a hidden node, hide all of the new children.
|
|
4005
|
-
if (change.target.isConnected && ![
|
|
4006
|
-
...visibleNodes,
|
|
4007
|
-
...hiddenNodes
|
|
4008
|
-
].some((node)=>(Text.$d4ee10de306f2510$export$4282f70798064fe0)(node, change.target))) for (let node of change.addedNodes){
|
|
4009
|
-
if ((node instanceof HTMLElement || node instanceof SVGElement) && (node.dataset.liveAnnouncer === 'true' || node.dataset.reactAriaTopLayer === 'true')) visibleNodes.add(node);
|
|
4010
|
-
else if (node instanceof Element) walk(node);
|
|
4011
|
-
}
|
|
4012
|
-
if ((Text.$f4e2df6bd15f8569$export$98658e8c59125e6a)()) {
|
|
4013
|
-
// if any of the observed shadow roots were removed, stop observing them
|
|
4014
|
-
for (let shadowRoot of shadowRootsToWatch)if (!shadowRoot.isConnected) {
|
|
4015
|
-
observer.disconnect();
|
|
4016
|
-
break;
|
|
4017
|
-
}
|
|
4018
|
-
}
|
|
4019
|
-
}
|
|
4020
|
-
});
|
|
4021
|
-
shadowObserver.observe(shadowRoot, {
|
|
4022
|
-
childList: true,
|
|
4023
|
-
subtree: true
|
|
4024
|
-
});
|
|
4025
|
-
shadowObservers.add(shadowObserver);
|
|
4026
|
-
}
|
|
4027
3887
|
let observerWrapper = {
|
|
4028
3888
|
visibleNodes: visibleNodes,
|
|
4029
3889
|
hiddenNodes: hiddenNodes,
|
|
@@ -4040,7 +3900,6 @@ function $5e3802645cc19319$export$1c3ebcada18427bf(targets, options) {
|
|
|
4040
3900
|
$5e3802645cc19319$var$observerStack.push(observerWrapper);
|
|
4041
3901
|
return ()=>{
|
|
4042
3902
|
observer.disconnect();
|
|
4043
|
-
if ((Text.$f4e2df6bd15f8569$export$98658e8c59125e6a)()) for (let shadowObserver of shadowObservers)shadowObserver.disconnect();
|
|
4044
3903
|
for (let node of hiddenNodes){
|
|
4045
3904
|
let count = $5e3802645cc19319$var$refCountMap.get(node);
|
|
4046
3905
|
if (count == null) continue;
|
|
@@ -4215,7 +4074,6 @@ function $feb5ffebff200149$export$6aeb1680a0ae8741(collection) {
|
|
|
4215
4074
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
4216
4075
|
* governing permissions and limitations under the License.
|
|
4217
4076
|
*/
|
|
4218
|
-
|
|
4219
4077
|
/**
|
|
4220
4078
|
* Controls how long to wait before clearing the typeahead buffer.
|
|
4221
4079
|
*/ const $fb3050f43d946246$var$TYPEAHEAD_DEBOUNCE_WAIT_MS = 1000; // 1 second
|
|
@@ -4227,7 +4085,7 @@ function $fb3050f43d946246$export$e32c88dfddc6e1d8(options) {
|
|
|
4227
4085
|
}).current;
|
|
4228
4086
|
let onKeyDown = (e)=>{
|
|
4229
4087
|
let character = $fb3050f43d946246$var$getStringForKey(e.key);
|
|
4230
|
-
if (!character || e.ctrlKey || e.metaKey || !
|
|
4088
|
+
if (!character || e.ctrlKey || e.metaKey || !e.currentTarget.contains(e.target) || state.search.length === 0 && character === ' ') return;
|
|
4231
4089
|
// Do not propagate the Spacebar event if it's meant to be part of the search.
|
|
4232
4090
|
// When we time out, the search term becomes empty, hence the check on length.
|
|
4233
4091
|
// Trimming is to account for the case of pressing the Spacebar more than once,
|
|
@@ -4289,16 +4147,17 @@ function $fb3050f43d946246$var$getStringForKey(key) {
|
|
|
4289
4147
|
|
|
4290
4148
|
|
|
4291
4149
|
function $ae20dd8cbca75726$export$d6daf82dcd84e87c(options) {
|
|
4292
|
-
let { selectionManager: manager, keyboardDelegate: delegate, ref: ref, autoFocus: autoFocus = false, shouldFocusWrap: shouldFocusWrap = false, disallowEmptySelection: disallowEmptySelection = false, disallowSelectAll: disallowSelectAll = false, escapeKeyBehavior: escapeKeyBehavior = 'clearSelection', selectOnFocus: selectOnFocus = manager.selectionBehavior === 'replace', disallowTypeAhead: disallowTypeAhead = false, shouldUseVirtualFocus: shouldUseVirtualFocus, allowsTabNavigation: allowsTabNavigation = false, scrollRef: // If no scrollRef is provided, assume the collection ref is the scrollable region
|
|
4150
|
+
let { selectionManager: manager, keyboardDelegate: delegate, ref: ref, autoFocus: autoFocus = false, shouldFocusWrap: shouldFocusWrap = false, disallowEmptySelection: disallowEmptySelection = false, disallowSelectAll: disallowSelectAll = false, escapeKeyBehavior: escapeKeyBehavior = 'clearSelection', selectOnFocus: selectOnFocus = manager.selectionBehavior === 'replace', disallowTypeAhead: disallowTypeAhead = false, shouldUseVirtualFocus: shouldUseVirtualFocus, allowsTabNavigation: allowsTabNavigation = false, isVirtualized: isVirtualized, scrollRef: // If no scrollRef is provided, assume the collection ref is the scrollable region
|
|
4293
4151
|
scrollRef = ref, linkBehavior: linkBehavior = 'action' } = options;
|
|
4294
4152
|
let { direction: direction } = (Text.$18f2051aff69b9bf$export$43bb16f9c6d9e3f7)();
|
|
4295
|
-
let router = (
|
|
4153
|
+
let router = ($ea8dcbcb9ea1b556$export$9a302a45f65d0572)();
|
|
4296
4154
|
let onKeyDown = (e)=>{
|
|
4155
|
+
var _ref_current;
|
|
4297
4156
|
// Prevent option + tab from doing anything since it doesn't move focus to the cells, only buttons/checkboxes
|
|
4298
4157
|
if (e.altKey && e.key === 'Tab') e.preventDefault();
|
|
4299
4158
|
// Keyboard events bubble through portals. Don't handle keyboard events
|
|
4300
4159
|
// for elements outside the collection (e.g. menus).
|
|
4301
|
-
if (!ref.current ||
|
|
4160
|
+
if (!((_ref_current = ref.current) === null || _ref_current === void 0 ? void 0 : _ref_current.contains(e.target))) return;
|
|
4302
4161
|
const navigateToKey = (key, childFocus)=>{
|
|
4303
4162
|
if (key != null) {
|
|
4304
4163
|
if (manager.isLink(key) && linkBehavior === 'selection' && selectOnFocus && !($feb5ffebff200149$export$d3e3bd3e26688c04)(e)) {
|
|
@@ -4436,11 +4295,7 @@ function $ae20dd8cbca75726$export$d6daf82dcd84e87c(options) {
|
|
|
4436
4295
|
last = walker.lastChild();
|
|
4437
4296
|
if (last) next = last;
|
|
4438
4297
|
}while (last);
|
|
4439
|
-
|
|
4440
|
-
// the containing element. We need to special case this so that tab will move focus out of the grid instead of looping between
|
|
4441
|
-
// focusing the containing cell and back to the non-tabbable child element
|
|
4442
|
-
let activeElement = (Text.$d4ee10de306f2510$export$cd4e5573fbe2b576)();
|
|
4443
|
-
if (next && (!(Text.$d4ee10de306f2510$export$b4f377a2b6254582)(next) || activeElement && !(Text.$b4b717babfbb907b$export$bebd5a1431fec25d)(activeElement))) (Text.$7215afc6de606d6b$export$de79e2c695e052f3)(next);
|
|
4298
|
+
if (next && !next.contains(document.activeElement)) (Text.$7215afc6de606d6b$export$de79e2c695e052f3)(next);
|
|
4444
4299
|
}
|
|
4445
4300
|
break;
|
|
4446
4301
|
}
|
|
@@ -4452,7 +4307,7 @@ function $ae20dd8cbca75726$export$d6daf82dcd84e87c(options) {
|
|
|
4452
4307
|
top: 0,
|
|
4453
4308
|
left: 0
|
|
4454
4309
|
});
|
|
4455
|
-
(Text.$e9faafb641e167db$export$90fc3a17d93f704c)(scrollRef, 'scroll', ()=>{
|
|
4310
|
+
(Text.$e9faafb641e167db$export$90fc3a17d93f704c)(scrollRef, 'scroll', isVirtualized ? undefined : ()=>{
|
|
4456
4311
|
var _scrollRef_current, _scrollRef_current1;
|
|
4457
4312
|
var _scrollRef_current_scrollTop, _scrollRef_current_scrollLeft;
|
|
4458
4313
|
scrollPos.current = {
|
|
@@ -4463,11 +4318,11 @@ function $ae20dd8cbca75726$export$d6daf82dcd84e87c(options) {
|
|
|
4463
4318
|
let onFocus = (e)=>{
|
|
4464
4319
|
if (manager.isFocused) {
|
|
4465
4320
|
// If a focus event bubbled through a portal, reset focus state.
|
|
4466
|
-
if (!
|
|
4321
|
+
if (!e.currentTarget.contains(e.target)) manager.setFocused(false);
|
|
4467
4322
|
return;
|
|
4468
4323
|
}
|
|
4469
4324
|
// Focus events can bubble through portals. Ignore these events.
|
|
4470
|
-
if (!
|
|
4325
|
+
if (!e.currentTarget.contains(e.target)) return;
|
|
4471
4326
|
manager.setFocused(true);
|
|
4472
4327
|
if (manager.focusedKey == null) {
|
|
4473
4328
|
var _delegate_getLastKey, _delegate_getFirstKey;
|
|
@@ -4484,7 +4339,7 @@ function $ae20dd8cbca75726$export$d6daf82dcd84e87c(options) {
|
|
|
4484
4339
|
var _manager_lastSelectedKey, _manager_firstSelectedKey;
|
|
4485
4340
|
if (relatedTarget && e.currentTarget.compareDocumentPosition(relatedTarget) & Node.DOCUMENT_POSITION_FOLLOWING) navigateToKey((_manager_lastSelectedKey = manager.lastSelectedKey) !== null && _manager_lastSelectedKey !== void 0 ? _manager_lastSelectedKey : (_delegate_getLastKey = delegate.getLastKey) === null || _delegate_getLastKey === void 0 ? void 0 : _delegate_getLastKey.call(delegate));
|
|
4486
4341
|
else navigateToKey((_manager_firstSelectedKey = manager.firstSelectedKey) !== null && _manager_firstSelectedKey !== void 0 ? _manager_firstSelectedKey : (_delegate_getFirstKey = delegate.getFirstKey) === null || _delegate_getFirstKey === void 0 ? void 0 : _delegate_getFirstKey.call(delegate));
|
|
4487
|
-
} else if (scrollRef.current) {
|
|
4342
|
+
} else if (!isVirtualized && scrollRef.current) {
|
|
4488
4343
|
// Restore the scroll position to what it was before.
|
|
4489
4344
|
scrollRef.current.scrollTop = scrollPos.current.top;
|
|
4490
4345
|
scrollRef.current.scrollLeft = scrollPos.current.left;
|
|
@@ -4494,7 +4349,7 @@ function $ae20dd8cbca75726$export$d6daf82dcd84e87c(options) {
|
|
|
4494
4349
|
let element = ($feb5ffebff200149$export$c3d8340acf92597f)(ref, manager.focusedKey);
|
|
4495
4350
|
if (element instanceof HTMLElement) {
|
|
4496
4351
|
// This prevents a flash of focus on the first/last element in the collection, or the collection itself.
|
|
4497
|
-
if (!(
|
|
4352
|
+
if (!element.contains(document.activeElement) && !shouldUseVirtualFocus) (Text.$7215afc6de606d6b$export$de79e2c695e052f3)(element);
|
|
4498
4353
|
let modality = (Text.$507fabe10e71c6fb$export$630ff653c5ada6a9)();
|
|
4499
4354
|
if (modality === 'keyboard') ($2f04cbc44ee30ce0$export$c826860796309d1b)(element, {
|
|
4500
4355
|
containingElement: ref.current
|
|
@@ -4504,7 +4359,7 @@ function $ae20dd8cbca75726$export$d6daf82dcd84e87c(options) {
|
|
|
4504
4359
|
};
|
|
4505
4360
|
let onBlur = (e)=>{
|
|
4506
4361
|
// Don't set blurred and then focused again if moving focus within the collection.
|
|
4507
|
-
if (!
|
|
4362
|
+
if (!e.currentTarget.contains(e.relatedTarget)) manager.setFocused(false);
|
|
4508
4363
|
};
|
|
4509
4364
|
// Ref to track whether the first item in the collection should be automatically focused. Specifically used for autocomplete when user types
|
|
4510
4365
|
// to focus the first key AFTER the collection updates.
|
|
@@ -4520,40 +4375,44 @@ function $ae20dd8cbca75726$export$d6daf82dcd84e87c(options) {
|
|
|
4520
4375
|
// If the user is typing forwards, autofocus the first option in the list.
|
|
4521
4376
|
if ((detail === null || detail === void 0 ? void 0 : detail.focusStrategy) === 'first') shouldVirtualFocusFirst.current = true;
|
|
4522
4377
|
});
|
|
4523
|
-
|
|
4524
|
-
|
|
4525
|
-
|
|
4526
|
-
|
|
4527
|
-
|
|
4528
|
-
|
|
4529
|
-
|
|
4530
|
-
|
|
4531
|
-
|
|
4532
|
-
|
|
4533
|
-
|
|
4534
|
-
|
|
4535
|
-
|
|
4536
|
-
|
|
4537
|
-
|
|
4538
|
-
|
|
4539
|
-
|
|
4540
|
-
|
|
4541
|
-
|
|
4542
|
-
// after the collection updates after load
|
|
4543
|
-
shouldVirtualFocusFirst.current = false;
|
|
4544
|
-
}
|
|
4378
|
+
let updateActiveDescendant = (Text.$8ae05eaa5c114e9c$export$7f54fc3180508a52)(()=>{
|
|
4379
|
+
var _delegate_getFirstKey;
|
|
4380
|
+
var _delegate_getFirstKey1;
|
|
4381
|
+
let keyToFocus = (_delegate_getFirstKey1 = (_delegate_getFirstKey = delegate.getFirstKey) === null || _delegate_getFirstKey === void 0 ? void 0 : _delegate_getFirstKey.call(delegate)) !== null && _delegate_getFirstKey1 !== void 0 ? _delegate_getFirstKey1 : null;
|
|
4382
|
+
// If no focusable items exist in the list, make sure to clear any activedescendant that may still exist and move focus back to
|
|
4383
|
+
// the original active element (e.g. the autocomplete input)
|
|
4384
|
+
if (keyToFocus == null) {
|
|
4385
|
+
let previousActiveElement = (Text.$d4ee10de306f2510$export$cd4e5573fbe2b576)();
|
|
4386
|
+
($55f9b1ae81f22853$export$76e4e37e5339496d)(ref.current);
|
|
4387
|
+
($55f9b1ae81f22853$export$2b35b76d2e30e129)(previousActiveElement, null);
|
|
4388
|
+
// If there wasn't a focusable key but the collection had items, then that means we aren't in an intermediate load state and all keys are disabled.
|
|
4389
|
+
// Reset shouldVirtualFocusFirst so that we don't erronously autofocus an item when the collection is filtered again.
|
|
4390
|
+
if (manager.collection.size > 0) shouldVirtualFocusFirst.current = false;
|
|
4391
|
+
} else {
|
|
4392
|
+
manager.setFocusedKey(keyToFocus);
|
|
4393
|
+
// Only set shouldVirtualFocusFirst to false if we've successfully set the first key as the focused key
|
|
4394
|
+
// If there wasn't a key to focus, we might be in a temporary loading state so we'll want to still focus the first key
|
|
4395
|
+
// after the collection updates after load
|
|
4396
|
+
shouldVirtualFocusFirst.current = false;
|
|
4545
4397
|
}
|
|
4398
|
+
});
|
|
4399
|
+
($ca9b37712f007381$export$72ef708ab07251f1)(()=>{
|
|
4400
|
+
if (shouldVirtualFocusFirst.current) updateActiveDescendant();
|
|
4546
4401
|
}, [
|
|
4547
|
-
manager.collection
|
|
4402
|
+
manager.collection,
|
|
4403
|
+
updateActiveDescendant
|
|
4548
4404
|
]);
|
|
4549
|
-
|
|
4550
|
-
($ca9b37712f007381$export$72ef708ab07251f1)(()=>{
|
|
4405
|
+
let resetFocusFirstFlag = (Text.$8ae05eaa5c114e9c$export$7f54fc3180508a52)(()=>{
|
|
4551
4406
|
// If user causes the focused key to change in any other way, clear shouldVirtualFocusFirst so we don't
|
|
4552
4407
|
// accidentally move focus from under them. Skip this if the collection was empty because we might be in a load
|
|
4553
4408
|
// state and will still want to focus the first item after load
|
|
4554
4409
|
if (manager.collection.size > 0) shouldVirtualFocusFirst.current = false;
|
|
4410
|
+
});
|
|
4411
|
+
($ca9b37712f007381$export$72ef708ab07251f1)(()=>{
|
|
4412
|
+
resetFocusFirstFlag();
|
|
4555
4413
|
}, [
|
|
4556
|
-
manager.focusedKey
|
|
4414
|
+
manager.focusedKey,
|
|
4415
|
+
resetFocusFirstFlag
|
|
4557
4416
|
]);
|
|
4558
4417
|
(Text.$e9faafb641e167db$export$90fc3a17d93f704c)(ref, ($5671b20cf9b562b2$export$447a38995de2c711), !shouldUseVirtualFocus ? undefined : (e)=>{
|
|
4559
4418
|
var _e_detail;
|
|
@@ -4635,7 +4494,7 @@ function $ae20dd8cbca75726$export$d6daf82dcd84e87c(options) {
|
|
|
4635
4494
|
onBlur: onBlur,
|
|
4636
4495
|
onMouseDown (e) {
|
|
4637
4496
|
// Ignore events that bubbled through portals.
|
|
4638
|
-
if (scrollRef.current ===
|
|
4497
|
+
if (scrollRef.current === e.target) // Prevent focus going to the collection when clicking on the scrollbar.
|
|
4639
4498
|
e.preventDefault();
|
|
4640
4499
|
}
|
|
4641
4500
|
};
|
|
@@ -4674,7 +4533,7 @@ function $ae20dd8cbca75726$export$d6daf82dcd84e87c(options) {
|
|
|
4674
4533
|
|
|
4675
4534
|
function $880e95eb8b93ba9a$export$ecf600387e221c37(options) {
|
|
4676
4535
|
let { id: id, selectionManager: manager, key: key, ref: ref, shouldSelectOnPressUp: shouldSelectOnPressUp, shouldUseVirtualFocus: shouldUseVirtualFocus, focus: focus, isDisabled: isDisabled, onAction: onAction, allowsDifferentPressOrigin: allowsDifferentPressOrigin, linkBehavior: linkBehavior = 'action' } = options;
|
|
4677
|
-
let router = (
|
|
4536
|
+
let router = ($ea8dcbcb9ea1b556$export$9a302a45f65d0572)();
|
|
4678
4537
|
id = (Text.$bdb11010cef70236$export$f680877a34711e37)(id);
|
|
4679
4538
|
let onSelect = (e)=>{
|
|
4680
4539
|
if (e.pointerType === 'keyboard' && ($feb5ffebff200149$export$d3e3bd3e26688c04)(e)) manager.toggleSelection(key);
|
|
@@ -4707,7 +4566,7 @@ function $880e95eb8b93ba9a$export$ecf600387e221c37(options) {
|
|
|
4707
4566
|
if (isFocused && manager.isFocused) {
|
|
4708
4567
|
if (!shouldUseVirtualFocus) {
|
|
4709
4568
|
if (focus) focus();
|
|
4710
|
-
else if (
|
|
4569
|
+
else if (document.activeElement !== ref.current && ref.current) (Text.$3ad3f6e1647bc98d$export$80f3e147d781571c)(ref.current);
|
|
4711
4570
|
} else ($55f9b1ae81f22853$export$76e4e37e5339496d)(ref.current);
|
|
4712
4571
|
}
|
|
4713
4572
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -4727,28 +4586,20 @@ function $880e95eb8b93ba9a$export$ecf600387e221c37(options) {
|
|
|
4727
4586
|
if (!shouldUseVirtualFocus && !isDisabled) itemProps = {
|
|
4728
4587
|
tabIndex: key === manager.focusedKey ? 0 : -1,
|
|
4729
4588
|
onFocus (e) {
|
|
4730
|
-
if (
|
|
4589
|
+
if (e.target === ref.current) manager.setFocusedKey(key);
|
|
4731
4590
|
}
|
|
4732
4591
|
};
|
|
4733
4592
|
else if (isDisabled) itemProps.onMouseDown = (e)=>{
|
|
4734
4593
|
// Prevent focus going to the body when clicking on a disabled item.
|
|
4735
4594
|
e.preventDefault();
|
|
4736
4595
|
};
|
|
4737
|
-
(React.useEffect)(()=>{
|
|
4738
|
-
if (isDisabled && manager.focusedKey === key) manager.setFocusedKey(null);
|
|
4739
|
-
}, [
|
|
4740
|
-
manager,
|
|
4741
|
-
isDisabled,
|
|
4742
|
-
key
|
|
4743
|
-
]);
|
|
4744
4596
|
// With checkbox selection, onAction (i.e. navigation) becomes primary, and occurs on a single click of the row.
|
|
4745
4597
|
// Clicking the checkbox enters selection mode, after which clicking anywhere on any row toggles selection for that row.
|
|
4746
4598
|
// With highlight selection, onAction is secondary, and occurs on double click. Single click selects the row.
|
|
4747
4599
|
// With touch, onAction occurs on single tap, and long press enters selection mode.
|
|
4748
4600
|
let isLinkOverride = manager.isLink(key) && linkBehavior === 'override';
|
|
4749
|
-
let isActionOverride = onAction && options['UNSTABLE_itemBehavior'] === 'action';
|
|
4750
4601
|
let hasLinkAction = manager.isLink(key) && linkBehavior !== 'selection' && linkBehavior !== 'none';
|
|
4751
|
-
let allowsSelection = !isDisabled && manager.canSelectItem(key) && !isLinkOverride
|
|
4602
|
+
let allowsSelection = !isDisabled && manager.canSelectItem(key) && !isLinkOverride;
|
|
4752
4603
|
let allowsActions = (onAction || hasLinkAction) && !isDisabled;
|
|
4753
4604
|
let hasPrimaryAction = allowsActions && (manager.selectionBehavior === 'replace' ? !allowsSelection : !allowsSelection || manager.isEmpty);
|
|
4754
4605
|
let hasSecondaryAction = allowsActions && allowsSelection && manager.selectionBehavior === 'replace';
|
|
@@ -4759,13 +4610,7 @@ function $880e95eb8b93ba9a$export$ecf600387e221c37(options) {
|
|
|
4759
4610
|
let hadPrimaryActionOnPressStart = (React.useRef)(false);
|
|
4760
4611
|
let collectionItemProps = manager.getItemProps(key);
|
|
4761
4612
|
let performAction = (e)=>{
|
|
4762
|
-
if (onAction)
|
|
4763
|
-
var _ref_current;
|
|
4764
|
-
onAction();
|
|
4765
|
-
(_ref_current = ref.current) === null || _ref_current === void 0 ? void 0 : _ref_current.dispatchEvent(new CustomEvent('react-aria-item-action', {
|
|
4766
|
-
bubbles: true
|
|
4767
|
-
}));
|
|
4768
|
-
}
|
|
4613
|
+
if (onAction) onAction();
|
|
4769
4614
|
if (hasLinkAction && ref.current) router.open(ref.current, e, collectionItemProps.href, collectionItemProps.routerOptions);
|
|
4770
4615
|
};
|
|
4771
4616
|
// By default, selection occurs on pointer down. This can be strange if selecting an
|
|
@@ -4782,13 +4627,13 @@ function $880e95eb8b93ba9a$export$ecf600387e221c37(options) {
|
|
|
4782
4627
|
itemPressProps.onPressStart = (e)=>{
|
|
4783
4628
|
modality.current = e.pointerType;
|
|
4784
4629
|
longPressEnabledOnPressStart.current = longPressEnabled;
|
|
4785
|
-
if (e.pointerType === 'keyboard' && (!hasAction || $880e95eb8b93ba9a$var$isSelectionKey(
|
|
4630
|
+
if (e.pointerType === 'keyboard' && (!hasAction || $880e95eb8b93ba9a$var$isSelectionKey())) onSelect(e);
|
|
4786
4631
|
};
|
|
4787
4632
|
// If allowsDifferentPressOrigin and interacting with mouse, make selection happen on pressUp (e.g. open menu on press down, selection on menu item happens on press up.)
|
|
4788
4633
|
// Otherwise, have selection happen onPress (prevents listview row selection when clicking on interactable elements in the row)
|
|
4789
4634
|
if (!allowsDifferentPressOrigin) itemPressProps.onPress = (e)=>{
|
|
4790
4635
|
if (hasPrimaryAction || hasSecondaryAction && e.pointerType !== 'mouse') {
|
|
4791
|
-
if (e.pointerType === 'keyboard' && !$880e95eb8b93ba9a$var$isActionKey(
|
|
4636
|
+
if (e.pointerType === 'keyboard' && !$880e95eb8b93ba9a$var$isActionKey()) return;
|
|
4792
4637
|
performAction(e);
|
|
4793
4638
|
} else if (e.pointerType !== 'keyboard' && allowsSelection) onSelect(e);
|
|
4794
4639
|
};
|
|
@@ -4808,13 +4653,13 @@ function $880e95eb8b93ba9a$export$ecf600387e221c37(options) {
|
|
|
4808
4653
|
// Select on mouse down unless there is a primary action which will occur on mouse up.
|
|
4809
4654
|
// For keyboard, select on key down. If there is an action, the Space key selects on key down,
|
|
4810
4655
|
// and the Enter key performs onAction on key up.
|
|
4811
|
-
if (allowsSelection && (e.pointerType === 'mouse' && !hasPrimaryAction || e.pointerType === 'keyboard' && (!allowsActions || $880e95eb8b93ba9a$var$isSelectionKey(
|
|
4656
|
+
if (allowsSelection && (e.pointerType === 'mouse' && !hasPrimaryAction || e.pointerType === 'keyboard' && (!allowsActions || $880e95eb8b93ba9a$var$isSelectionKey()))) onSelect(e);
|
|
4812
4657
|
};
|
|
4813
4658
|
itemPressProps.onPress = (e)=>{
|
|
4814
4659
|
// Selection occurs on touch up. Primary actions always occur on pointer up.
|
|
4815
4660
|
// Both primary and secondary actions occur on Enter key up. The only exception
|
|
4816
4661
|
// is secondary actions, which occur on double click with a mouse.
|
|
4817
|
-
if (e.pointerType === 'touch' || e.pointerType === 'pen' || e.pointerType === 'virtual' || e.pointerType === 'keyboard' && hasAction && $880e95eb8b93ba9a$var$isActionKey(
|
|
4662
|
+
if (e.pointerType === 'touch' || e.pointerType === 'pen' || e.pointerType === 'virtual' || e.pointerType === 'keyboard' && hasAction && $880e95eb8b93ba9a$var$isActionKey() || e.pointerType === 'mouse' && hadPrimaryActionOnPressStart.current) {
|
|
4818
4663
|
if (hasAction) performAction(e);
|
|
4819
4664
|
else if (allowsSelection) onSelect(e);
|
|
4820
4665
|
}
|
|
@@ -4879,7 +4724,7 @@ function $880e95eb8b93ba9a$export$ecf600387e221c37(options) {
|
|
|
4879
4724
|
// Prevent default on link clicks so that we control exactly
|
|
4880
4725
|
// when they open (to match selection behavior).
|
|
4881
4726
|
let onClick = linkBehavior !== 'none' && manager.isLink(key) ? (e)=>{
|
|
4882
|
-
if (!(
|
|
4727
|
+
if (!($ea8dcbcb9ea1b556$export$95185d699e05d4d7).isOpening) e.preventDefault();
|
|
4883
4728
|
} : undefined;
|
|
4884
4729
|
return {
|
|
4885
4730
|
itemProps: (Text.$3ef42575df84b30b$export$9d1611c77c2fe928)(itemProps, allowsSelection || hasPrimaryAction || shouldUseVirtualFocus && !isDisabled ? pressProps : {}, longPressEnabled ? longPressProps : {}, {
|
|
@@ -4899,11 +4744,13 @@ function $880e95eb8b93ba9a$export$ecf600387e221c37(options) {
|
|
|
4899
4744
|
hasAction: hasAction
|
|
4900
4745
|
};
|
|
4901
4746
|
}
|
|
4902
|
-
function $880e95eb8b93ba9a$var$isActionKey(
|
|
4903
|
-
|
|
4747
|
+
function $880e95eb8b93ba9a$var$isActionKey() {
|
|
4748
|
+
let event = window.event;
|
|
4749
|
+
return (event === null || event === void 0 ? void 0 : event.key) === 'Enter';
|
|
4904
4750
|
}
|
|
4905
|
-
function $880e95eb8b93ba9a$var$isSelectionKey(
|
|
4906
|
-
|
|
4751
|
+
function $880e95eb8b93ba9a$var$isSelectionKey() {
|
|
4752
|
+
let event = window.event;
|
|
4753
|
+
return (event === null || event === void 0 ? void 0 : event.key) === ' ' || (event === null || event === void 0 ? void 0 : event.code) === 'Space';
|
|
4907
4754
|
}
|
|
4908
4755
|
|
|
4909
4756
|
/*
|
|
@@ -4926,8 +4773,8 @@ class $657e4dc4a6e88df0$export$8f5ed9ff9f511381 {
|
|
|
4926
4773
|
let containerRect = container.getBoundingClientRect();
|
|
4927
4774
|
let itemRect = item.getBoundingClientRect();
|
|
4928
4775
|
return {
|
|
4929
|
-
x: itemRect.left - containerRect.left
|
|
4930
|
-
y: itemRect.top - containerRect.top
|
|
4776
|
+
x: itemRect.left - containerRect.left + container.scrollLeft,
|
|
4777
|
+
y: itemRect.top - containerRect.top + container.scrollTop,
|
|
4931
4778
|
width: itemRect.width,
|
|
4932
4779
|
height: itemRect.height
|
|
4933
4780
|
};
|
|
@@ -4942,12 +4789,12 @@ class $657e4dc4a6e88df0$export$8f5ed9ff9f511381 {
|
|
|
4942
4789
|
}
|
|
4943
4790
|
getVisibleRect() {
|
|
4944
4791
|
let container = this.ref.current;
|
|
4945
|
-
var _container_scrollLeft, _container_scrollTop,
|
|
4792
|
+
var _container_scrollLeft, _container_scrollTop, _container_offsetWidth, _container_offsetHeight;
|
|
4946
4793
|
return {
|
|
4947
4794
|
x: (_container_scrollLeft = container === null || container === void 0 ? void 0 : container.scrollLeft) !== null && _container_scrollLeft !== void 0 ? _container_scrollLeft : 0,
|
|
4948
4795
|
y: (_container_scrollTop = container === null || container === void 0 ? void 0 : container.scrollTop) !== null && _container_scrollTop !== void 0 ? _container_scrollTop : 0,
|
|
4949
|
-
width: (
|
|
4950
|
-
height: (
|
|
4796
|
+
width: (_container_offsetWidth = container === null || container === void 0 ? void 0 : container.offsetWidth) !== null && _container_offsetWidth !== void 0 ? _container_offsetWidth : 0,
|
|
4797
|
+
height: (_container_offsetHeight = container === null || container === void 0 ? void 0 : container.offsetHeight) !== null && _container_offsetHeight !== void 0 ? _container_offsetHeight : 0
|
|
4951
4798
|
};
|
|
4952
4799
|
}
|
|
4953
4800
|
constructor(ref){
|
|
@@ -5594,7 +5441,7 @@ $a89a74a39eba465a$exports = {
|
|
|
5594
5441
|
|
|
5595
5442
|
var $edc7c66594a0ae8a$exports = {};
|
|
5596
5443
|
$edc7c66594a0ae8a$exports = {
|
|
5597
|
-
"longPressMessage": `
|
|
5444
|
+
"longPressMessage": `Premere a lungo o premere Alt + Freccia gi\xf9 per aprire il menu`
|
|
5598
5445
|
};
|
|
5599
5446
|
|
|
5600
5447
|
var $f1ab51510712db52$exports = {};
|
|
@@ -5944,7 +5791,7 @@ function $d5336fe17ce95402$export$38eaa17faae8f579(props, state, ref) {
|
|
|
5944
5791
|
|
|
5945
5792
|
|
|
5946
5793
|
function $a2e5df62f93c7633$export$9d32628fc2aea7da(props, state, ref) {
|
|
5947
|
-
let { id: id, key: key, closeOnSelect: closeOnSelect,
|
|
5794
|
+
let { id: id, key: key, closeOnSelect: closeOnSelect, isVirtualized: isVirtualized, 'aria-haspopup': hasPopup, onPressStart: onPressStart, onPressUp: pressUpProp, onPress: onPress, onPressChange: pressChangeProp, onPressEnd: onPressEnd, onClick: onClickProp, onHoverStart: hoverStartProp, onHoverChange: onHoverChange, onHoverEnd: onHoverEnd, onKeyDown: onKeyDown, onKeyUp: onKeyUp, onFocus: onFocus, onFocusChange: onFocusChange, onBlur: onBlur, selectionManager: selectionManager = state.selectionManager } = props;
|
|
5948
5795
|
let isTrigger = !!hasPopup;
|
|
5949
5796
|
let isTriggerExpanded = isTrigger && props['aria-expanded'] === 'true';
|
|
5950
5797
|
var _props_isDisabled;
|
|
@@ -5954,7 +5801,7 @@ function $a2e5df62f93c7633$export$9d32628fc2aea7da(props, state, ref) {
|
|
|
5954
5801
|
let data = ($fc79756100351201$export$6f49b4016bfc8d56).get(state);
|
|
5955
5802
|
let item = state.collection.getItem(key);
|
|
5956
5803
|
let onClose = props.onClose || data.onClose;
|
|
5957
|
-
let router = (
|
|
5804
|
+
let router = ($ea8dcbcb9ea1b556$export$9a302a45f65d0572)();
|
|
5958
5805
|
let performAction = ()=>{
|
|
5959
5806
|
var _item_props;
|
|
5960
5807
|
if (isTrigger) return;
|
|
@@ -5981,7 +5828,6 @@ function $a2e5df62f93c7633$export$9d32628fc2aea7da(props, state, ref) {
|
|
|
5981
5828
|
'aria-label': props['aria-label'],
|
|
5982
5829
|
'aria-labelledby': labelId,
|
|
5983
5830
|
'aria-describedby': [
|
|
5984
|
-
props['aria-describedby'],
|
|
5985
5831
|
descriptionId,
|
|
5986
5832
|
keyboardId
|
|
5987
5833
|
].filter(Boolean).join(' ') || undefined,
|
|
@@ -5991,8 +5837,7 @@ function $a2e5df62f93c7633$export$9d32628fc2aea7da(props, state, ref) {
|
|
|
5991
5837
|
};
|
|
5992
5838
|
if (selectionManager.selectionMode !== 'none' && !isTrigger) ariaProps['aria-checked'] = isSelected;
|
|
5993
5839
|
if (isVirtualized) {
|
|
5994
|
-
|
|
5995
|
-
ariaProps['aria-posinset'] = Number.isNaN(index) ? undefined : index + 1;
|
|
5840
|
+
ariaProps['aria-posinset'] = item === null || item === void 0 ? void 0 : item.index;
|
|
5996
5841
|
ariaProps['aria-setsize'] = ($453cc9f0df89c0a5$export$77d5aafae4e095b2)(state.collection);
|
|
5997
5842
|
}
|
|
5998
5843
|
let isPressedRef = (React.useRef)(false);
|
|
@@ -6016,10 +5861,9 @@ function $a2e5df62f93c7633$export$9d32628fc2aea7da(props, state, ref) {
|
|
|
6016
5861
|
var _interaction_current, _interaction_current1;
|
|
6017
5862
|
onClickProp === null || onClickProp === void 0 ? void 0 : onClickProp(e);
|
|
6018
5863
|
performAction();
|
|
6019
|
-
(
|
|
5864
|
+
($ea8dcbcb9ea1b556$export$13aea1a3cb5e3f1f)(e, router, item.props.href, item === null || item === void 0 ? void 0 : item.props.routerOptions);
|
|
6020
5865
|
let shouldClose = ((_interaction_current = interaction.current) === null || _interaction_current === void 0 ? void 0 : _interaction_current.pointerType) === 'keyboard' ? ((_interaction_current1 = interaction.current) === null || _interaction_current1 === void 0 ? void 0 : _interaction_current1.key) === 'Enter' || selectionManager.selectionMode === 'none' || selectionManager.isLink(key) : selectionManager.selectionMode !== 'multiple' || selectionManager.isLink(key);
|
|
6021
|
-
|
|
6022
|
-
shouldClose = (_ref = shouldCloseOnSelect !== null && shouldCloseOnSelect !== void 0 ? shouldCloseOnSelect : closeOnSelect) !== null && _ref !== void 0 ? _ref : shouldClose;
|
|
5866
|
+
shouldClose = closeOnSelect !== null && closeOnSelect !== void 0 ? closeOnSelect : shouldClose;
|
|
6023
5867
|
if (onClose && !isTrigger && shouldClose) onClose();
|
|
6024
5868
|
interaction.current = null;
|
|
6025
5869
|
};
|
|
@@ -6072,10 +5916,7 @@ function $a2e5df62f93c7633$export$9d32628fc2aea7da(props, state, ref) {
|
|
|
6072
5916
|
pointerType: 'keyboard',
|
|
6073
5917
|
key: ' '
|
|
6074
5918
|
};
|
|
6075
|
-
|
|
6076
|
-
// click above sets modality to "virtual", need to set interaction modality back to 'keyboard' so focusSafely calls properly move focus
|
|
6077
|
-
// to the newly opened submenu's first item.
|
|
6078
|
-
(Text.$507fabe10e71c6fb$export$8397ddfc504fdb9a)('keyboard');
|
|
5919
|
+
e.target.click();
|
|
6079
5920
|
break;
|
|
6080
5921
|
case 'Enter':
|
|
6081
5922
|
interaction.current = {
|
|
@@ -6083,10 +5924,7 @@ function $a2e5df62f93c7633$export$9d32628fc2aea7da(props, state, ref) {
|
|
|
6083
5924
|
key: 'Enter'
|
|
6084
5925
|
};
|
|
6085
5926
|
// Trigger click unless this is a link. Links trigger click natively.
|
|
6086
|
-
if (
|
|
6087
|
-
// click above sets modality to "virtual", need to set interaction modality back to 'keyboard' so focusSafely calls properly move focus
|
|
6088
|
-
// to the newly opened submenu's first item.
|
|
6089
|
-
(Text.$507fabe10e71c6fb$export$8397ddfc504fdb9a)('keyboard');
|
|
5927
|
+
if (e.target.tagName !== 'A') e.target.click();
|
|
6090
5928
|
break;
|
|
6091
5929
|
default:
|
|
6092
5930
|
if (!isTrigger) e.continuePropagation();
|
|
@@ -6096,14 +5934,14 @@ function $a2e5df62f93c7633$export$9d32628fc2aea7da(props, state, ref) {
|
|
|
6096
5934
|
},
|
|
6097
5935
|
onKeyUp: onKeyUp
|
|
6098
5936
|
});
|
|
6099
|
-
let {
|
|
5937
|
+
let { focusProps: focusProps } = (Text.$a1ea59d68270f0dd$export$f8168d8dd8fd66e6)({
|
|
6100
5938
|
onBlur: onBlur,
|
|
6101
5939
|
onFocus: onFocus,
|
|
6102
5940
|
onFocusChange: onFocusChange
|
|
6103
|
-
}
|
|
5941
|
+
});
|
|
6104
5942
|
let domProps = (Text.$65484d02dcb7eb3e$export$457c3d6518dd4c6f)(item === null || item === void 0 ? void 0 : item.props);
|
|
6105
5943
|
delete domProps.id;
|
|
6106
|
-
let linkProps = (
|
|
5944
|
+
let linkProps = ($ea8dcbcb9ea1b556$export$7e924b3091a3bd18)(item === null || item === void 0 ? void 0 : item.props);
|
|
6107
5945
|
return {
|
|
6108
5946
|
menuItemProps: {
|
|
6109
5947
|
...ariaProps,
|
|
@@ -6111,7 +5949,7 @@ function $a2e5df62f93c7633$export$9d32628fc2aea7da(props, state, ref) {
|
|
|
6111
5949
|
onFocus: itemProps.onFocus,
|
|
6112
5950
|
'data-collection': itemProps['data-collection'],
|
|
6113
5951
|
'data-key': itemProps['data-key']
|
|
6114
|
-
} : itemProps, pressProps, hoverProps, keyboardProps,
|
|
5952
|
+
} : itemProps, pressProps, hoverProps, keyboardProps, focusProps, // Prevent DOM focus from moving on mouse down when using virtual focus or this is a submenu/subdialog trigger.
|
|
6115
5953
|
data.shouldUseVirtualFocus || isTrigger ? {
|
|
6116
5954
|
onMouseDown: (e)=>e.preventDefault()
|
|
6117
5955
|
} : undefined, isDisabled ? undefined : {
|
|
@@ -8446,7 +8284,7 @@ const $3674c52c6b3c5bce$export$2ce376c2cc3355c8 = /*#__PURE__*/ ($e1995378a14296
|
|
|
8446
8284
|
|
|
8447
8285
|
const $de32f1b87079253c$export$d2f961adcb0afbe = /*#__PURE__*/ (React.createContext)(null);
|
|
8448
8286
|
|
|
8449
|
-
var styles = {"wrapper":"fpi0W91w2ag-","floatingContainer":"ba-Kj6mvQUw-","menu":"-DayvgvIcVo-","legacySection":"VsRRunpS6Yo-","separator":"jnggqK3YTIU-","triggerWrapper":"oRQQVVq-yxA-","ariaMenu":"QInUBKqkrl0-","ariaItem":"bWR8m7-LKg4-","ariaSection":"PH5vvtLgvXI-","ariaSectionHeader":"iJjIifpa9bk-","sectionHeader":"Bq7pLWj3jm4-","legacyAction":"P4Sdaq0-lZs-","action":"M1BgN-oCmKw-","destructive":"U9ihZZavz9w-","overlay":"_7we5hh6kYs8-","fullWidth":"_5OJ7B6mFcwk-","screenReaderOnly":"Bzvkz60bwWE-"};
|
|
8287
|
+
var styles = {"wrapper":"fpi0W91w2ag-","floatingContainer":"ba-Kj6mvQUw-","menu":"-DayvgvIcVo-","legacySection":"VsRRunpS6Yo-","separator":"jnggqK3YTIU-","triggerWrapper":"oRQQVVq-yxA-","ariaMenu":"QInUBKqkrl0-","ariaItem":"bWR8m7-LKg4-","ariaSection":"PH5vvtLgvXI-","ariaSectionHeader":"iJjIifpa9bk-","sectionHeader":"Bq7pLWj3jm4-","legacyAction":"P4Sdaq0-lZs-","action":"M1BgN-oCmKw-","destructive":"U9ihZZavz9w-","overlay":"_7we5hh6kYs8-","fullWidth":"_5OJ7B6mFcwk-","screenReaderOnly":"Bzvkz60bwWE-","spinning":"_0-VzuzHdi8o-"};
|
|
8450
8288
|
|
|
8451
8289
|
const SMALL_SCREEN_BREAKPOINT = 490;
|
|
8452
8290
|
const MENU_OFFSET = 6;
|