@dmsi/wedgekit-react 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/classNames.js +150 -0
- package/dist/components/AccessCard.js +63 -0
- package/dist/components/AccessCardGroup.js +73 -0
- package/dist/components/AccessChangerTabItem.js +51 -0
- package/dist/components/Accordion.js +99 -0
- package/dist/components/Alert.js +78 -0
- package/dist/components/Breadcrumbs.js +111 -0
- package/dist/components/Button.js +137 -0
- package/dist/components/CalendarRange.js +405 -0
- package/dist/components/Caption.js +99 -0
- package/dist/components/Card.js +50 -0
- package/dist/components/Checkbox.js +108 -0
- package/dist/components/CompactImagesPreview.js +120 -0
- package/dist/components/ContentTab.js +68 -0
- package/dist/components/ContentTabs.js +96 -0
- package/dist/components/DMSiLogo.js +54 -0
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.js +27 -0
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.js +79 -0
- package/dist/components/DataGrid/PinnedColumns.js +165 -0
- package/dist/components/DataGrid/SummaryRow/SummaryCell.js +51 -0
- package/dist/components/DataGrid/SummaryRow/aggregations.js +55 -0
- package/dist/components/DataGrid/SummaryRow/index.js +86 -0
- package/dist/components/DataGrid/TableBody/GroupRow.js +243 -0
- package/dist/components/DataGrid/TableBody/LoadingCell.js +33 -0
- package/dist/components/DataGrid/TableBody/TableBodyRow.js +136 -0
- package/dist/components/DataGrid/TableBody/index.js +161 -0
- package/dist/components/DataGrid/index.js +696 -0
- package/dist/components/DataGrid/utils.js +20 -0
- package/dist/components/DataGridCell.js +412 -0
- package/dist/components/DataTable.js +700 -0
- package/dist/components/DateInput.js +193 -0
- package/dist/components/DateRangeInput.js +368 -0
- package/dist/components/DebugJson.js +28 -0
- package/dist/components/Display.js +46 -0
- package/dist/components/EditingContext.js +34 -0
- package/dist/components/EmblaCarousel/ArrowButtons.js +83 -0
- package/dist/components/EmblaCarousel/SelectedSnapDisplay.js +12 -0
- package/dist/components/EmblaCarousel/index.js +153 -0
- package/dist/components/EmblaCarousel/usePrevNextButtons.js +21 -0
- package/dist/components/EmblaCarousel/useSelectedSnapDisplay.js +15 -0
- package/dist/components/EmptyCartIcon.js +25 -0
- package/dist/components/FilterGroup.js +198 -0
- package/dist/components/FullViewportBox.js +19 -0
- package/dist/components/Grid.js +54 -0
- package/dist/components/Heading.js +50 -0
- package/dist/components/HorizontalDivider.js +20 -0
- package/dist/components/Icon.js +73 -0
- package/dist/components/ImagePlaceholder.js +22 -0
- package/dist/components/Input.js +469 -0
- package/dist/components/InputGroup.js +45 -0
- package/dist/components/Label.js +37 -0
- package/dist/components/Link.js +69 -0
- package/dist/components/List.js +12 -0
- package/dist/components/ListGroup.js +54 -0
- package/dist/components/LiveChatComponent.js +25 -0
- package/dist/components/LoadingScrim.js +22 -0
- package/dist/components/LogoAgilityTopBar.js +90 -0
- package/dist/components/LogoDMSiTopBar.js +54 -0
- package/dist/components/LogoMillworkTopBar.js +196 -0
- package/dist/components/MainBar.js +58 -0
- package/dist/components/MaxViewportBox.js +19 -0
- package/dist/components/Menu.js +202 -0
- package/dist/components/MenuOption.js +161 -0
- package/dist/components/MobileDataGrid/ColumnList.js +85 -0
- package/dist/components/MobileDataGrid/ColumnSelector/index.js +100 -0
- package/dist/components/MobileDataGrid/GridContextProvider/GridContext.d.ts.map +1 -1
- package/dist/components/MobileDataGrid/GridContextProvider/GridContext.js +6 -0
- package/dist/components/MobileDataGrid/GridContextProvider/index.js +80 -0
- package/dist/components/MobileDataGrid/GridContextProvider/useGridContext.js +11 -0
- package/dist/components/MobileDataGrid/MobileDataGridCard/MobileDataGridColumn.js +18 -0
- package/dist/components/MobileDataGrid/MobileDataGridCard/index.js +130 -0
- package/dist/components/MobileDataGrid/MobileDataGridHeader.js +67 -0
- package/dist/components/MobileDataGrid/RowDetailModalProvider/ModalContent.js +42 -0
- package/dist/components/MobileDataGrid/RowDetailModalProvider/index.js +58 -0
- package/dist/components/MobileDataGrid/dataGridReducer.js +28 -0
- package/dist/components/MobileDataGrid/index.js +78 -0
- package/dist/components/MobileNavMenu.js +173 -0
- package/dist/components/Modal.js +201 -0
- package/dist/components/ModalButtons.js +57 -0
- package/dist/components/ModalContent.js +24 -0
- package/dist/components/ModalHeader.js +74 -0
- package/dist/components/ModalScrim.js +32 -0
- package/dist/components/NavigationTab.js +72 -0
- package/dist/components/NavigationTabs.js +45 -0
- package/dist/components/NestedMenu.js +119 -0
- package/dist/components/Notification.js +91 -0
- package/dist/components/OptionPill.js +103 -0
- package/dist/components/OrderCheckIcon.js +28 -0
- package/dist/components/PDFViewer/DownloadIcon.js +25 -0
- package/dist/components/PDFViewer/PDFElement.js +77 -0
- package/dist/components/PDFViewer/PDFNavigation.js +64 -0
- package/dist/components/PDFViewer/PDFPage.js +28 -0
- package/dist/components/PDFViewer/index.js +124 -0
- package/dist/components/Pagination.js +117 -0
- package/dist/components/Paragraph.js +43 -0
- package/dist/components/Password.js +47 -0
- package/dist/components/ProductImagePreview/CarouselPagination.js +48 -0
- package/dist/components/ProductImagePreview/MobileImageCarousel.js +146 -0
- package/dist/components/ProductImagePreview/ProductPrimaryImage.js +138 -0
- package/dist/components/ProductImagePreview/Thumbnail.js +46 -0
- package/dist/components/ProductImagePreview/ZoomWindow.js +74 -0
- package/dist/components/ProductImagePreview/index.js +189 -0
- package/dist/components/ProductImagePreview/useProductImagePreview.js +85 -0
- package/dist/components/ProjectBar.js +54 -0
- package/dist/components/Radio.js +113 -0
- package/dist/components/Search.js +89 -0
- package/dist/components/SearchResultImage/index.js +26 -0
- package/dist/components/Select.js +122 -0
- package/dist/components/SideMenu.js +24 -0
- package/dist/components/SideMenuGroup.js +80 -0
- package/dist/components/SideMenuItem.js +79 -0
- package/dist/components/SimpleTable.js +60 -0
- package/dist/components/SkeletonParagraph.js +24 -0
- package/dist/components/Spinner.js +30 -0
- package/dist/components/Stack.js +174 -0
- package/dist/components/StatusPill.js +44 -0
- package/dist/components/Stepper.js +138 -0
- package/dist/components/Subheader.js +41 -0
- package/dist/components/Surface.js +30 -0
- package/dist/components/Swatch.js +1498 -0
- package/dist/components/Textarea.js +106 -0
- package/dist/components/Theme.js +25 -0
- package/dist/components/Time.js +225 -0
- package/dist/components/Toast.js +170 -0
- package/dist/components/Tooltip.js +102 -0
- package/dist/components/TopBar.js +119 -0
- package/dist/components/Upload.js +107 -0
- package/dist/components/WorldpayIframe.js +19 -0
- package/dist/hooks/useEditCell.js +23 -0
- package/dist/hooks/useInfiniteScroll.js +25 -0
- package/dist/hooks/useKeydown.js +20 -0
- package/dist/hooks/useMatchesMedia.js +15 -0
- package/dist/hooks/useMenuSystem.js +186 -0
- package/dist/hooks/useMounted.js +9 -0
- package/dist/hooks/useTableLayout/computeColumns.js +59 -0
- package/dist/hooks/useTableLayout/storage.js +64 -0
- package/dist/hooks/useTableLayout/useTableLayout.js +163 -0
- package/dist/index.js +249 -53839
- package/dist/lib/loadFonts.js +11 -0
- package/dist/node_modules/@dnd-kit/accessibility/dist/accessibility.esm.js +56 -0
- package/dist/node_modules/@dnd-kit/core/dist/core.esm.js +2299 -0
- package/dist/node_modules/@dnd-kit/modifiers/dist/modifiers.esm.js +13 -0
- package/dist/node_modules/@dnd-kit/sortable/dist/sortable.esm.js +367 -0
- package/dist/node_modules/@dnd-kit/utilities/dist/utilities.esm.js +235 -0
- package/dist/node_modules/@headlessui/react/dist/components/description/description.js +45 -0
- package/dist/node_modules/@headlessui/react/dist/components/keyboard.js +4 -0
- package/dist/node_modules/@headlessui/react/dist/components/label/label.js +62 -0
- package/dist/node_modules/@headlessui/react/dist/components/switch/switch.js +56 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-active-press.js +33 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-controllable.js +10 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-default-value.js +8 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-disposables.js +9 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-event.js +9 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-iso-morphic-effect.js +8 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-latest-value.js +11 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-resolve-button-type.js +12 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-slot.js +7 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-sync-refs.js +16 -0
- package/dist/node_modules/@headlessui/react/dist/internal/disabled.js +8 -0
- package/dist/node_modules/@headlessui/react/dist/internal/form-fields.js +35 -0
- package/dist/node_modules/@headlessui/react/dist/internal/hidden.js +13 -0
- package/dist/node_modules/@headlessui/react/dist/internal/id.js +8 -0
- package/dist/node_modules/@headlessui/react/dist/utils/bugs.js +19 -0
- package/dist/node_modules/@headlessui/react/dist/utils/class-names.js +6 -0
- package/dist/node_modules/@headlessui/react/dist/utils/disposables.js +40 -0
- package/dist/node_modules/@headlessui/react/dist/utils/dom.js +34 -0
- package/dist/node_modules/@headlessui/react/dist/utils/env.js +34 -0
- package/dist/node_modules/@headlessui/react/dist/utils/form.js +32 -0
- package/dist/node_modules/@headlessui/react/dist/utils/match.js +11 -0
- package/dist/node_modules/@headlessui/react/dist/utils/micro-task.js +8 -0
- package/dist/node_modules/@headlessui/react/dist/utils/owner.js +8 -0
- package/dist/node_modules/@headlessui/react/dist/utils/render.js +126 -0
- package/dist/node_modules/@js-temporal/polyfill/dist/index.esm.js +3913 -0
- package/dist/node_modules/@mikecousins/react-pdf/dist/index.js +83 -0
- package/dist/node_modules/@react-aria/focus/dist/useFocusRing.js +38 -0
- package/dist/node_modules/@react-aria/interactions/dist/useFocus.js +31 -0
- package/dist/node_modules/@react-aria/interactions/dist/useFocusVisible.js +99 -0
- package/dist/node_modules/@react-aria/interactions/dist/useFocusWithin.js +59 -0
- package/dist/node_modules/@react-aria/interactions/dist/useHover.js +86 -0
- package/dist/node_modules/@react-aria/interactions/dist/utils.js +68 -0
- package/dist/node_modules/@react-aria/utils/dist/DOMFunctions.js +32 -0
- package/dist/node_modules/@react-aria/utils/dist/domHelpers.js +15 -0
- package/dist/node_modules/@react-aria/utils/dist/focusWithoutScrolling.js +45 -0
- package/dist/node_modules/@react-aria/utils/dist/isVirtualEvent.js +7 -0
- package/dist/node_modules/@react-aria/utils/dist/openLink.js +28 -0
- package/dist/node_modules/@react-aria/utils/dist/platform.js +47 -0
- package/dist/node_modules/@react-aria/utils/dist/useGlobalListeners.js +34 -0
- package/dist/node_modules/@react-aria/utils/dist/useLayoutEffect.js +6 -0
- package/dist/node_modules/@react-stately/flags/dist/import.js +7 -0
- package/dist/node_modules/@tanstack/react-table/build/lib/index.js +94 -0
- package/dist/node_modules/@tanstack/react-virtual/dist/esm/index.js +38 -0
- package/dist/node_modules/@tanstack/table-core/build/lib/index.js +1954 -0
- package/dist/node_modules/@tanstack/virtual-core/dist/esm/index.js +575 -0
- package/dist/node_modules/@tanstack/virtual-core/dist/esm/utils.js +52 -0
- package/dist/node_modules/clsx/dist/clsx.js +17 -0
- package/dist/node_modules/embla-carousel/esm/embla-carousel.esm.js +1204 -0
- package/dist/node_modules/embla-carousel-autoplay/esm/embla-carousel-autoplay.esm.js +126 -0
- package/dist/node_modules/embla-carousel-react/esm/embla-carousel-react.esm.js +24 -0
- package/dist/node_modules/embla-carousel-reactive-utils/esm/embla-carousel-reactive-utils.esm.js +35 -0
- package/dist/node_modules/jsbi/dist/jsbi.js +1040 -0
- package/dist/node_modules/react-use/esm/usePrevious.js +10 -0
- package/dist/static/no-results-image.png.js +4 -0
- package/dist/utils/date-patch-dashes.js +28 -0
- package/dist/utils/date.js +95 -0
- package/dist/utils/formatting.js +22 -0
- package/dist/utils/index.js +4 -0
- package/dist/utils/mergeObjectArrays.js +18 -0
- package/dist/utils.js +20 -0
- package/package.json +1 -1
- /package/dist/{pdf-l6QfMa5e.js → node_modules/pdfjs-dist/build/pdf.js} +0 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { useState as I, useRef as n, useEffect as e } from "react";
|
|
2
|
+
function i(f) {
|
|
3
|
+
return typeof f == "function";
|
|
4
|
+
}
|
|
5
|
+
const W = ({ canvasRef: f, file: j, onDocumentLoadSuccess: R, onDocumentLoadFail: d, onPageLoadSuccess: w, onPageLoadFail: h, onPageRenderSuccess: v, onPageRenderFail: x, scale: z = 1, rotate: m = 0, page: A = 1, cMapUrl: p, cMapPacked: B, workerSrc: D, withCredentials: G = !1 }) => {
|
|
6
|
+
const [o, J] = I(), [K, N] = I(), c = n(null), y = n(null), E = n(R), q = n(d), C = n(w), P = n(h), k = n(v), T = n(x);
|
|
7
|
+
return e(() => {
|
|
8
|
+
E.current = R;
|
|
9
|
+
}, [R]), e(() => {
|
|
10
|
+
q.current = d;
|
|
11
|
+
}, [d]), e(() => {
|
|
12
|
+
C.current = w;
|
|
13
|
+
}, [w]), e(() => {
|
|
14
|
+
P.current = h;
|
|
15
|
+
}, [h]), e(() => {
|
|
16
|
+
k.current = v;
|
|
17
|
+
}, [v]), e(() => {
|
|
18
|
+
T.current = x;
|
|
19
|
+
}, [x]), e(() => {
|
|
20
|
+
if (typeof window > "u") return;
|
|
21
|
+
const u = {
|
|
22
|
+
url: j,
|
|
23
|
+
withCredentials: G
|
|
24
|
+
};
|
|
25
|
+
p && (u.cMapUrl = p, u.cMapPacked = B), import("../../../pdfjs-dist/build/pdf.js").then(({ GlobalWorkerOptions: t, getDocument: V, version: s }) => {
|
|
26
|
+
t.workerSrc = D, V(u).promise.then((r) => {
|
|
27
|
+
J(r), i(E.current) && E.current(r);
|
|
28
|
+
}, () => {
|
|
29
|
+
i(q.current) && q.current();
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
}, [
|
|
33
|
+
j,
|
|
34
|
+
G,
|
|
35
|
+
p,
|
|
36
|
+
B,
|
|
37
|
+
D
|
|
38
|
+
]), e(() => {
|
|
39
|
+
const u = (t) => {
|
|
40
|
+
const V = m === 0 ? t.rotate : t.rotate + m, s = t.getViewport({
|
|
41
|
+
scale: z,
|
|
42
|
+
rotation: V
|
|
43
|
+
}), r = f.current;
|
|
44
|
+
if (!r) return;
|
|
45
|
+
const b = r.getContext("2d");
|
|
46
|
+
if (!b) return;
|
|
47
|
+
const l = typeof window < "u" ? window.devicePixelRatio : 1;
|
|
48
|
+
if (r.height = s.height * l, r.width = s.width * l, b.scale(l, l), c.current) {
|
|
49
|
+
y.current = t, c.current.cancel();
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
return c.current = t.render({
|
|
53
|
+
canvasContext: b,
|
|
54
|
+
canvas: r,
|
|
55
|
+
viewport: s
|
|
56
|
+
}), c.current.promise.then(() => {
|
|
57
|
+
c.current = null, i(k.current) && k.current(t);
|
|
58
|
+
}, (H) => {
|
|
59
|
+
if (c.current = null, H && H.name === "RenderingCancelledException") {
|
|
60
|
+
const O = y.current ?? t;
|
|
61
|
+
y.current = null, u(O);
|
|
62
|
+
} else i(T.current) && T.current();
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
o && o.getPage(A).then((t) => {
|
|
66
|
+
N(t), i(C.current) && C.current(t), u(t);
|
|
67
|
+
}, () => {
|
|
68
|
+
i(P.current) && P.current();
|
|
69
|
+
});
|
|
70
|
+
}, [
|
|
71
|
+
f,
|
|
72
|
+
A,
|
|
73
|
+
o,
|
|
74
|
+
m,
|
|
75
|
+
z
|
|
76
|
+
]), {
|
|
77
|
+
pdfDocument: o,
|
|
78
|
+
pdfPage: K
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
export {
|
|
82
|
+
W as usePdf
|
|
83
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { useFocus as V } from "../../interactions/dist/useFocus.js";
|
|
2
|
+
import { isFocusVisible as r, useFocusVisibleListener as h } from "../../interactions/dist/useFocusVisible.js";
|
|
3
|
+
import { useFocusWithin as x } from "../../interactions/dist/useFocusWithin.js";
|
|
4
|
+
import { useRef as m, useState as a, useCallback as f } from "react";
|
|
5
|
+
function I(n = {}) {
|
|
6
|
+
let { autoFocus: b = !1, isTextInput: u, within: i } = n, s = m({
|
|
7
|
+
isFocused: !1,
|
|
8
|
+
isFocusVisible: b || r()
|
|
9
|
+
}), [o, l] = a(!1), [d, F] = a(() => s.current.isFocused && s.current.isFocusVisible), t = f(() => F(s.current.isFocused && s.current.isFocusVisible), []), c = f((e) => {
|
|
10
|
+
s.current.isFocused = e, s.current.isFocusVisible = r(), l(e), t();
|
|
11
|
+
}, [
|
|
12
|
+
t
|
|
13
|
+
]);
|
|
14
|
+
h((e) => {
|
|
15
|
+
s.current.isFocusVisible = e, t();
|
|
16
|
+
}, [
|
|
17
|
+
u,
|
|
18
|
+
o
|
|
19
|
+
], {
|
|
20
|
+
enabled: o,
|
|
21
|
+
isTextInput: u
|
|
22
|
+
});
|
|
23
|
+
let { focusProps: p } = V({
|
|
24
|
+
isDisabled: i,
|
|
25
|
+
onFocusChange: c
|
|
26
|
+
}), { focusWithinProps: $ } = x({
|
|
27
|
+
isDisabled: !i,
|
|
28
|
+
onFocusWithinChange: c
|
|
29
|
+
});
|
|
30
|
+
return {
|
|
31
|
+
isFocused: o,
|
|
32
|
+
isFocusVisible: d,
|
|
33
|
+
focusProps: i ? $ : p
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
export {
|
|
37
|
+
I as useFocusRing
|
|
38
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { useSyntheticBlurEvent as m } from "./utils.js";
|
|
2
|
+
import { useCallback as d } from "react";
|
|
3
|
+
import { getEventTarget as a, getActiveElement as i } from "../../utils/dist/DOMFunctions.js";
|
|
4
|
+
import { getOwnerDocument as b } from "../../utils/dist/domHelpers.js";
|
|
5
|
+
function B($) {
|
|
6
|
+
let { isDisabled: c, onFocus: n, onBlur: t, onFocusChange: e } = $;
|
|
7
|
+
const f = d((o) => {
|
|
8
|
+
if (a(o) === o.currentTarget)
|
|
9
|
+
return t && t(o), e && e(!1), !0;
|
|
10
|
+
}, [
|
|
11
|
+
t,
|
|
12
|
+
e
|
|
13
|
+
]), s = m(f), l = d((o) => {
|
|
14
|
+
let r = a(o);
|
|
15
|
+
const u = b(r), p = u ? i(u) : i();
|
|
16
|
+
r === o.currentTarget && r === p && (n && n(o), e && e(!0), s(o));
|
|
17
|
+
}, [
|
|
18
|
+
e,
|
|
19
|
+
n,
|
|
20
|
+
s
|
|
21
|
+
]);
|
|
22
|
+
return {
|
|
23
|
+
focusProps: {
|
|
24
|
+
onFocus: !c && (n || e || t) ? l : void 0,
|
|
25
|
+
onBlur: !c && (t || e) ? f : void 0
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export {
|
|
30
|
+
B as useFocus
|
|
31
|
+
};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { ignoreFocusEvent as h } from "./utils.js";
|
|
2
|
+
import { getEventTarget as c, getActiveElement as H } from "../../utils/dist/DOMFunctions.js";
|
|
3
|
+
import { getOwnerWindow as a, getOwnerDocument as $ } from "../../utils/dist/domHelpers.js";
|
|
4
|
+
import { openLink as L } from "../../utils/dist/openLink.js";
|
|
5
|
+
import { isMac as O } from "../../utils/dist/platform.js";
|
|
6
|
+
import { isVirtualClick as F } from "../../utils/dist/isVirtualEvent.js";
|
|
7
|
+
import { useEffect as I } from "react";
|
|
8
|
+
let s = null;
|
|
9
|
+
const l = /* @__PURE__ */ new Set();
|
|
10
|
+
let u = /* @__PURE__ */ new Map(), i = !1, p = !1;
|
|
11
|
+
const K = {
|
|
12
|
+
Tab: !0,
|
|
13
|
+
Escape: !0
|
|
14
|
+
};
|
|
15
|
+
function m(e, n) {
|
|
16
|
+
for (let t of l) t(e, n);
|
|
17
|
+
}
|
|
18
|
+
function C(e) {
|
|
19
|
+
return !(e.metaKey || !O() && e.altKey || e.ctrlKey || e.key === "Control" || e.key === "Shift" || e.key === "Meta");
|
|
20
|
+
}
|
|
21
|
+
function b(e) {
|
|
22
|
+
i = !0, !L.isOpening && C(e) && (s = "keyboard", m("keyboard", e));
|
|
23
|
+
}
|
|
24
|
+
function o(e) {
|
|
25
|
+
s = "pointer", "pointerType" in e && e.pointerType, (e.type === "mousedown" || e.type === "pointerdown") && (i = !0, m("pointer", e));
|
|
26
|
+
}
|
|
27
|
+
function y(e) {
|
|
28
|
+
!L.isOpening && F(e) && (i = !0, s = "virtual");
|
|
29
|
+
}
|
|
30
|
+
function w(e) {
|
|
31
|
+
c(e) === window || c(e) === document || h || !e.isTrusted || (!i && !p && (s = "virtual", m("virtual", e)), i = !1, p = !1);
|
|
32
|
+
}
|
|
33
|
+
function T() {
|
|
34
|
+
i = !1, p = !0;
|
|
35
|
+
}
|
|
36
|
+
function E(e) {
|
|
37
|
+
if (typeof window > "u" || typeof document > "u" || u.get(a(e))) return;
|
|
38
|
+
const n = a(e), t = $(e);
|
|
39
|
+
let r = n.HTMLElement.prototype.focus;
|
|
40
|
+
n.HTMLElement.prototype.focus = function() {
|
|
41
|
+
i = !0, r.apply(this, arguments);
|
|
42
|
+
}, t.addEventListener("keydown", b, !0), t.addEventListener("keyup", b, !0), t.addEventListener("click", y, !0), n.addEventListener("focus", w, !0), n.addEventListener("blur", T, !1), typeof PointerEvent < "u" ? (t.addEventListener("pointerdown", o, !0), t.addEventListener("pointermove", o, !0), t.addEventListener("pointerup", o, !0)) : process.env.NODE_ENV === "test" && (t.addEventListener("mousedown", o, !0), t.addEventListener("mousemove", o, !0), t.addEventListener("mouseup", o, !0)), n.addEventListener("beforeunload", () => {
|
|
43
|
+
g(e);
|
|
44
|
+
}, {
|
|
45
|
+
once: !0
|
|
46
|
+
}), u.set(n, {
|
|
47
|
+
focus: r
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
const g = (e, n) => {
|
|
51
|
+
const t = a(e), r = $(e);
|
|
52
|
+
n && r.removeEventListener("DOMContentLoaded", n), u.has(t) && (t.HTMLElement.prototype.focus = u.get(t).focus, r.removeEventListener("keydown", b, !0), r.removeEventListener("keyup", b, !0), r.removeEventListener("click", y, !0), t.removeEventListener("focus", w, !0), t.removeEventListener("blur", T, !1), typeof PointerEvent < "u" ? (r.removeEventListener("pointerdown", o, !0), r.removeEventListener("pointermove", o, !0), r.removeEventListener("pointerup", o, !0)) : process.env.NODE_ENV === "test" && (r.removeEventListener("mousedown", o, !0), r.removeEventListener("mousemove", o, !0), r.removeEventListener("mouseup", o, !0)), u.delete(t));
|
|
53
|
+
};
|
|
54
|
+
function S(e) {
|
|
55
|
+
const n = $(e);
|
|
56
|
+
let t;
|
|
57
|
+
return n.readyState !== "loading" ? E(e) : (t = () => {
|
|
58
|
+
E(e);
|
|
59
|
+
}, n.addEventListener("DOMContentLoaded", t)), () => g(e, t);
|
|
60
|
+
}
|
|
61
|
+
typeof document < "u" && S();
|
|
62
|
+
function V() {
|
|
63
|
+
return s !== "pointer";
|
|
64
|
+
}
|
|
65
|
+
const D = /* @__PURE__ */ new Set([
|
|
66
|
+
"checkbox",
|
|
67
|
+
"radio",
|
|
68
|
+
"range",
|
|
69
|
+
"color",
|
|
70
|
+
"file",
|
|
71
|
+
"image",
|
|
72
|
+
"button",
|
|
73
|
+
"submit",
|
|
74
|
+
"reset"
|
|
75
|
+
]);
|
|
76
|
+
function j(e, n, t) {
|
|
77
|
+
let r = $(t ? c(t) : void 0), d = t ? c(t) : void 0;
|
|
78
|
+
const v = typeof window < "u" ? a(d).HTMLInputElement : HTMLInputElement, k = typeof window < "u" ? a(d).HTMLTextAreaElement : HTMLTextAreaElement, x = typeof window < "u" ? a(d).HTMLElement : HTMLElement, M = typeof window < "u" ? a(d).KeyboardEvent : KeyboardEvent;
|
|
79
|
+
let f = H(r);
|
|
80
|
+
return e = e || f instanceof v && !D.has(f.type) || f instanceof k || f instanceof x && f.isContentEditable, !(e && n === "keyboard" && t instanceof M && !K[t.key]);
|
|
81
|
+
}
|
|
82
|
+
function U(e, n, t) {
|
|
83
|
+
E(), I(() => {
|
|
84
|
+
if (t?.enabled === !1) return;
|
|
85
|
+
let r = (d, v) => {
|
|
86
|
+
j(!!t?.isTextInput, d, v) && e(V());
|
|
87
|
+
};
|
|
88
|
+
return l.add(r), () => {
|
|
89
|
+
l.delete(r);
|
|
90
|
+
};
|
|
91
|
+
}, n);
|
|
92
|
+
}
|
|
93
|
+
export {
|
|
94
|
+
S as addWindowFocusTracking,
|
|
95
|
+
l as changeHandlers,
|
|
96
|
+
u as hasSetupGlobalListeners,
|
|
97
|
+
V as isFocusVisible,
|
|
98
|
+
U as useFocusVisibleListener
|
|
99
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { useSyntheticBlurEvent as x, setEventTarget as E, createSyntheticEvent as B } from "./utils.js";
|
|
2
|
+
import { useRef as G, useCallback as p } from "react";
|
|
3
|
+
import { nodeContains as i, getEventTarget as o, getActiveElement as L } from "../../utils/dist/DOMFunctions.js";
|
|
4
|
+
import { getOwnerDocument as w } from "../../utils/dist/domHelpers.js";
|
|
5
|
+
import { useGlobalListeners as C } from "../../utils/dist/useGlobalListeners.js";
|
|
6
|
+
function k(g) {
|
|
7
|
+
let { isDisabled: m, onBlurWithin: c, onFocusWithin: s, onFocusWithinChange: t } = g, r = G({
|
|
8
|
+
isFocusWithin: !1
|
|
9
|
+
}), { addGlobalListener: u, removeAllGlobalListeners: l } = C(), n = p((e) => {
|
|
10
|
+
i(e.currentTarget, o(e)) && r.current.isFocusWithin && !i(e.currentTarget, e.relatedTarget) && (r.current.isFocusWithin = !1, l(), c && c(e), t && t(!1));
|
|
11
|
+
}, [
|
|
12
|
+
c,
|
|
13
|
+
t,
|
|
14
|
+
r,
|
|
15
|
+
l
|
|
16
|
+
]), f = x(n), F = p((e) => {
|
|
17
|
+
if (!i(e.currentTarget, o(e))) return;
|
|
18
|
+
let d = o(e);
|
|
19
|
+
const a = w(d), W = L(a);
|
|
20
|
+
if (!r.current.isFocusWithin && W === d) {
|
|
21
|
+
s && s(e), t && t(!0), r.current.isFocusWithin = !0, f(e);
|
|
22
|
+
let $ = e.currentTarget;
|
|
23
|
+
u(a, "focus", (v) => {
|
|
24
|
+
let b = o(v);
|
|
25
|
+
if (r.current.isFocusWithin && !i($, b)) {
|
|
26
|
+
let h = new a.defaultView.FocusEvent("blur", {
|
|
27
|
+
relatedTarget: b
|
|
28
|
+
});
|
|
29
|
+
E(h, $);
|
|
30
|
+
let T = B(h);
|
|
31
|
+
n(T);
|
|
32
|
+
}
|
|
33
|
+
}, {
|
|
34
|
+
capture: !0
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}, [
|
|
38
|
+
s,
|
|
39
|
+
t,
|
|
40
|
+
f,
|
|
41
|
+
u,
|
|
42
|
+
n
|
|
43
|
+
]);
|
|
44
|
+
return m ? {
|
|
45
|
+
focusWithinProps: {
|
|
46
|
+
// These cannot be null, that would conflict in mergeProps
|
|
47
|
+
onFocus: void 0,
|
|
48
|
+
onBlur: void 0
|
|
49
|
+
}
|
|
50
|
+
} : {
|
|
51
|
+
focusWithinProps: {
|
|
52
|
+
onFocus: F,
|
|
53
|
+
onBlur: n
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
export {
|
|
58
|
+
k as useFocusWithin
|
|
59
|
+
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { nodeContains as d, getEventTarget as a } from "../../utils/dist/DOMFunctions.js";
|
|
2
|
+
import { getOwnerDocument as M } from "../../utils/dist/domHelpers.js";
|
|
3
|
+
import { useGlobalListeners as G } from "../../utils/dist/useGlobalListeners.js";
|
|
4
|
+
import { useState as x, useRef as D, useEffect as h, useMemo as N } from "react";
|
|
5
|
+
let l = !1, f = 0;
|
|
6
|
+
function c() {
|
|
7
|
+
l = !0, setTimeout(() => {
|
|
8
|
+
l = !1;
|
|
9
|
+
}, 50);
|
|
10
|
+
}
|
|
11
|
+
function T(v) {
|
|
12
|
+
v.pointerType === "touch" && c();
|
|
13
|
+
}
|
|
14
|
+
function S() {
|
|
15
|
+
if (!(typeof document > "u"))
|
|
16
|
+
return f === 0 && (typeof PointerEvent < "u" ? document.addEventListener("pointerup", T) : process.env.NODE_ENV === "test" && document.addEventListener("touchend", c)), f++, () => {
|
|
17
|
+
f--, !(f > 0) && (typeof PointerEvent < "u" ? document.removeEventListener("pointerup", T) : process.env.NODE_ENV === "test" && document.removeEventListener("touchend", c));
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
function A(v) {
|
|
21
|
+
let { onHoverStart: p, onHoverChange: s, onHoverEnd: g, isDisabled: r } = v, [y, $] = x(!1), t = D({
|
|
22
|
+
isHovered: !1,
|
|
23
|
+
ignoreEmulatedMouseEvents: !1,
|
|
24
|
+
pointerType: "",
|
|
25
|
+
target: null
|
|
26
|
+
}).current;
|
|
27
|
+
h(S, []);
|
|
28
|
+
let { addGlobalListener: m, removeAllGlobalListeners: b } = G(), { hoverProps: L, triggerHoverEnd: P } = N(() => {
|
|
29
|
+
let H = (e, n) => {
|
|
30
|
+
if (t.pointerType = n, r || n === "touch" || t.isHovered || !d(e.currentTarget, a(e))) return;
|
|
31
|
+
t.isHovered = !0;
|
|
32
|
+
let i = e.currentTarget;
|
|
33
|
+
t.target = i, m(M(a(e)), "pointerover", (E) => {
|
|
34
|
+
t.isHovered && t.target && !d(t.target, a(E)) && u(E, E.pointerType);
|
|
35
|
+
}, {
|
|
36
|
+
capture: !0
|
|
37
|
+
}), p && p({
|
|
38
|
+
type: "hoverstart",
|
|
39
|
+
target: i,
|
|
40
|
+
pointerType: n
|
|
41
|
+
}), s && s(!0), $(!0);
|
|
42
|
+
}, u = (e, n) => {
|
|
43
|
+
let i = t.target;
|
|
44
|
+
t.pointerType = "", t.target = null, !(n === "touch" || !t.isHovered || !i) && (t.isHovered = !1, b(), g && g({
|
|
45
|
+
type: "hoverend",
|
|
46
|
+
target: i,
|
|
47
|
+
pointerType: n
|
|
48
|
+
}), s && s(!1), $(!1));
|
|
49
|
+
}, o = {};
|
|
50
|
+
return typeof PointerEvent < "u" ? (o.onPointerEnter = (e) => {
|
|
51
|
+
l && e.pointerType === "mouse" || H(e, e.pointerType);
|
|
52
|
+
}, o.onPointerLeave = (e) => {
|
|
53
|
+
!r && d(e.currentTarget, a(e)) && u(e, e.pointerType);
|
|
54
|
+
}) : process.env.NODE_ENV === "test" && (o.onTouchStart = () => {
|
|
55
|
+
t.ignoreEmulatedMouseEvents = !0;
|
|
56
|
+
}, o.onMouseEnter = (e) => {
|
|
57
|
+
!t.ignoreEmulatedMouseEvents && !l && H(e, "mouse"), t.ignoreEmulatedMouseEvents = !1;
|
|
58
|
+
}, o.onMouseLeave = (e) => {
|
|
59
|
+
!r && d(e.currentTarget, a(e)) && u(e, "mouse");
|
|
60
|
+
}), {
|
|
61
|
+
hoverProps: o,
|
|
62
|
+
triggerHoverEnd: u
|
|
63
|
+
};
|
|
64
|
+
}, [
|
|
65
|
+
p,
|
|
66
|
+
s,
|
|
67
|
+
g,
|
|
68
|
+
r,
|
|
69
|
+
t,
|
|
70
|
+
m,
|
|
71
|
+
b
|
|
72
|
+
]);
|
|
73
|
+
return h(() => {
|
|
74
|
+
r && P({
|
|
75
|
+
currentTarget: t.target
|
|
76
|
+
}, t.pointerType);
|
|
77
|
+
}, [
|
|
78
|
+
r
|
|
79
|
+
]), {
|
|
80
|
+
hoverProps: L,
|
|
81
|
+
isHovered: y
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
export {
|
|
85
|
+
A as useHover
|
|
86
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { getEventTarget as u, getActiveElement as o } from "../../utils/dist/DOMFunctions.js";
|
|
2
|
+
import { useLayoutEffect as l } from "../../utils/dist/useLayoutEffect.js";
|
|
3
|
+
import { useRef as i, useCallback as b } from "react";
|
|
4
|
+
function f(t) {
|
|
5
|
+
let e = t;
|
|
6
|
+
return e.nativeEvent = t, e.isDefaultPrevented = () => e.defaultPrevented, e.isPropagationStopped = () => e.cancelBubble, e.persist = () => {
|
|
7
|
+
}, e;
|
|
8
|
+
}
|
|
9
|
+
function E(t, e) {
|
|
10
|
+
Object.defineProperty(t, "target", {
|
|
11
|
+
value: e
|
|
12
|
+
}), Object.defineProperty(t, "currentTarget", {
|
|
13
|
+
value: e
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
function g(t) {
|
|
17
|
+
let e = i({
|
|
18
|
+
isFocused: !1,
|
|
19
|
+
observer: null
|
|
20
|
+
});
|
|
21
|
+
return l(() => {
|
|
22
|
+
const n = e.current;
|
|
23
|
+
return () => {
|
|
24
|
+
n.observer && (n.observer.disconnect(), n.observer = null);
|
|
25
|
+
};
|
|
26
|
+
}, []), b((n) => {
|
|
27
|
+
let c = u(n);
|
|
28
|
+
if (c instanceof HTMLButtonElement || c instanceof HTMLInputElement || c instanceof HTMLTextAreaElement || c instanceof HTMLSelectElement) {
|
|
29
|
+
e.current.isFocused = !0;
|
|
30
|
+
let r = c, d = (a) => {
|
|
31
|
+
if (e.current.isFocused = !1, r.disabled) {
|
|
32
|
+
let s = f(a);
|
|
33
|
+
t?.(s);
|
|
34
|
+
}
|
|
35
|
+
e.current.observer && (e.current.observer.disconnect(), e.current.observer = null);
|
|
36
|
+
};
|
|
37
|
+
r.addEventListener("focusout", d, {
|
|
38
|
+
once: !0
|
|
39
|
+
}), e.current.observer = new MutationObserver(() => {
|
|
40
|
+
if (e.current.isFocused && r.disabled) {
|
|
41
|
+
var a;
|
|
42
|
+
(a = e.current.observer) === null || a === void 0 || a.disconnect();
|
|
43
|
+
let s = r === o() ? null : o();
|
|
44
|
+
r.dispatchEvent(new FocusEvent("blur", {
|
|
45
|
+
relatedTarget: s
|
|
46
|
+
})), r.dispatchEvent(new FocusEvent("focusout", {
|
|
47
|
+
bubbles: !0,
|
|
48
|
+
relatedTarget: s
|
|
49
|
+
}));
|
|
50
|
+
}
|
|
51
|
+
}), e.current.observer.observe(r, {
|
|
52
|
+
attributes: !0,
|
|
53
|
+
attributeFilter: [
|
|
54
|
+
"disabled"
|
|
55
|
+
]
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
}, [
|
|
59
|
+
t
|
|
60
|
+
]);
|
|
61
|
+
}
|
|
62
|
+
let T = !1;
|
|
63
|
+
export {
|
|
64
|
+
f as createSyntheticEvent,
|
|
65
|
+
T as ignoreFocusEvent,
|
|
66
|
+
E as setEventTarget,
|
|
67
|
+
g as useSyntheticBlurEvent
|
|
68
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { isShadowRoot as r } from "./domHelpers.js";
|
|
2
|
+
import { shadowDOM as o } from "../../../@react-stately/flags/dist/import.js";
|
|
3
|
+
function l(t, a) {
|
|
4
|
+
if (!o()) return a && t ? t.contains(a) : !1;
|
|
5
|
+
if (!t || !a) return !1;
|
|
6
|
+
let e = a;
|
|
7
|
+
for (; e !== null; ) {
|
|
8
|
+
if (e === t) return !0;
|
|
9
|
+
e.tagName === "SLOT" && e.assignedSlot ? e = e.assignedSlot.parentNode : r(e) ? e = e.host : e = e.parentNode;
|
|
10
|
+
}
|
|
11
|
+
return !1;
|
|
12
|
+
}
|
|
13
|
+
const n = (t = document) => {
|
|
14
|
+
var a;
|
|
15
|
+
if (!o()) return t.activeElement;
|
|
16
|
+
let e = t.activeElement;
|
|
17
|
+
for (; e && "shadowRoot" in e && (!((a = e.shadowRoot) === null || a === void 0) && a.activeElement); ) e = e.shadowRoot.activeElement;
|
|
18
|
+
return e;
|
|
19
|
+
};
|
|
20
|
+
function s(t) {
|
|
21
|
+
if (o() && t.target instanceof Element && t.target.shadowRoot) {
|
|
22
|
+
var a, e;
|
|
23
|
+
if ("composedPath" in t) return (a = t.composedPath()[0]) !== null && a !== void 0 ? a : null;
|
|
24
|
+
if ("composedPath" in t.nativeEvent) return (e = t.nativeEvent.composedPath()[0]) !== null && e !== void 0 ? e : null;
|
|
25
|
+
}
|
|
26
|
+
return t.target;
|
|
27
|
+
}
|
|
28
|
+
export {
|
|
29
|
+
n as getActiveElement,
|
|
30
|
+
s as getEventTarget,
|
|
31
|
+
l as nodeContains
|
|
32
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const t = (o) => {
|
|
2
|
+
var n;
|
|
3
|
+
return (n = o?.ownerDocument) !== null && n !== void 0 ? n : document;
|
|
4
|
+
}, e = (o) => o && "window" in o && o.window === o ? o : t(o).defaultView || window;
|
|
5
|
+
function d(o) {
|
|
6
|
+
return o !== null && typeof o == "object" && "nodeType" in o && typeof o.nodeType == "number";
|
|
7
|
+
}
|
|
8
|
+
function c(o) {
|
|
9
|
+
return d(o) && o.nodeType === Node.DOCUMENT_FRAGMENT_NODE && "host" in o;
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
t as getOwnerDocument,
|
|
13
|
+
e as getOwnerWindow,
|
|
14
|
+
c as isShadowRoot
|
|
15
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
function f(l) {
|
|
2
|
+
if (c()) l.focus({
|
|
3
|
+
preventScroll: !0
|
|
4
|
+
});
|
|
5
|
+
else {
|
|
6
|
+
let e = n(l);
|
|
7
|
+
l.focus(), s(e);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
let r = null;
|
|
11
|
+
function c() {
|
|
12
|
+
if (r == null) {
|
|
13
|
+
r = !1;
|
|
14
|
+
try {
|
|
15
|
+
document.createElement("div").focus({
|
|
16
|
+
get preventScroll() {
|
|
17
|
+
return r = !0, !0;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
} catch {
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return r;
|
|
24
|
+
}
|
|
25
|
+
function n(l) {
|
|
26
|
+
let e = l.parentNode, o = [], t = document.scrollingElement || document.documentElement;
|
|
27
|
+
for (; e instanceof HTMLElement && e !== t; )
|
|
28
|
+
(e.offsetHeight < e.scrollHeight || e.offsetWidth < e.scrollWidth) && o.push({
|
|
29
|
+
element: e,
|
|
30
|
+
scrollTop: e.scrollTop,
|
|
31
|
+
scrollLeft: e.scrollLeft
|
|
32
|
+
}), e = e.parentNode;
|
|
33
|
+
return t instanceof HTMLElement && o.push({
|
|
34
|
+
element: t,
|
|
35
|
+
scrollTop: t.scrollTop,
|
|
36
|
+
scrollLeft: t.scrollLeft
|
|
37
|
+
}), o;
|
|
38
|
+
}
|
|
39
|
+
function s(l) {
|
|
40
|
+
for (let { element: e, scrollTop: o, scrollLeft: t } of l)
|
|
41
|
+
e.scrollTop = o, e.scrollLeft = t;
|
|
42
|
+
}
|
|
43
|
+
export {
|
|
44
|
+
f as focusWithoutScrolling
|
|
45
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { focusWithoutScrolling as f } from "./focusWithoutScrolling.js";
|
|
2
|
+
import { isFirefox as p, isWebKit as K, isMac as l, isIPad as $ } from "./platform.js";
|
|
3
|
+
import "react";
|
|
4
|
+
function o(e, c, d = !0) {
|
|
5
|
+
var t, a;
|
|
6
|
+
let { metaKey: i, ctrlKey: n, altKey: s, shiftKey: r } = c;
|
|
7
|
+
p() && (!((a = window.event) === null || a === void 0 || (t = a.type) === null || t === void 0) && t.startsWith("key")) && e.target === "_blank" && (l() ? i = !0 : n = !0);
|
|
8
|
+
let y = K() && l() && !$() && process.env.NODE_ENV !== "test" ? new KeyboardEvent("keydown", {
|
|
9
|
+
keyIdentifier: "Enter",
|
|
10
|
+
metaKey: i,
|
|
11
|
+
ctrlKey: n,
|
|
12
|
+
altKey: s,
|
|
13
|
+
shiftKey: r
|
|
14
|
+
}) : new MouseEvent("click", {
|
|
15
|
+
metaKey: i,
|
|
16
|
+
ctrlKey: n,
|
|
17
|
+
altKey: s,
|
|
18
|
+
shiftKey: r,
|
|
19
|
+
detail: 1,
|
|
20
|
+
bubbles: !0,
|
|
21
|
+
cancelable: !0
|
|
22
|
+
});
|
|
23
|
+
o.isOpening = d, f(e), e.dispatchEvent(y), o.isOpening = !1;
|
|
24
|
+
}
|
|
25
|
+
o.isOpening = !1;
|
|
26
|
+
export {
|
|
27
|
+
o as openLink
|
|
28
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
function a(t) {
|
|
2
|
+
var n;
|
|
3
|
+
if (typeof window > "u" || window.navigator == null) return !1;
|
|
4
|
+
let o = (n = window.navigator.userAgentData) === null || n === void 0 ? void 0 : n.brands;
|
|
5
|
+
return Array.isArray(o) && o.some((s) => t.test(s.brand)) || t.test(window.navigator.userAgent);
|
|
6
|
+
}
|
|
7
|
+
function r(t) {
|
|
8
|
+
var n;
|
|
9
|
+
return typeof window < "u" && window.navigator != null ? t.test(((n = window.navigator.userAgentData) === null || n === void 0 ? void 0 : n.platform) || window.navigator.platform) : !1;
|
|
10
|
+
}
|
|
11
|
+
function e(t) {
|
|
12
|
+
if (process.env.NODE_ENV === "test") return t;
|
|
13
|
+
let n = null;
|
|
14
|
+
return () => (n == null && (n = t()), n);
|
|
15
|
+
}
|
|
16
|
+
const i = e(function() {
|
|
17
|
+
return r(/^Mac/i);
|
|
18
|
+
}), c = e(function() {
|
|
19
|
+
return r(/^iPhone/i);
|
|
20
|
+
}), u = e(function() {
|
|
21
|
+
return r(/^iPad/i) || // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
|
|
22
|
+
i() && navigator.maxTouchPoints > 1;
|
|
23
|
+
}), d = e(function() {
|
|
24
|
+
return c() || u();
|
|
25
|
+
});
|
|
26
|
+
e(function() {
|
|
27
|
+
return i() || d();
|
|
28
|
+
});
|
|
29
|
+
const f = e(function() {
|
|
30
|
+
return a(/AppleWebKit/i) && !$();
|
|
31
|
+
}), $ = e(function() {
|
|
32
|
+
return a(/Chrome/i);
|
|
33
|
+
}), l = e(function() {
|
|
34
|
+
return a(/Android/i);
|
|
35
|
+
}), w = e(function() {
|
|
36
|
+
return a(/Firefox/i);
|
|
37
|
+
});
|
|
38
|
+
export {
|
|
39
|
+
l as isAndroid,
|
|
40
|
+
$ as isChrome,
|
|
41
|
+
w as isFirefox,
|
|
42
|
+
d as isIOS,
|
|
43
|
+
u as isIPad,
|
|
44
|
+
c as isIPhone,
|
|
45
|
+
i as isMac,
|
|
46
|
+
f as isWebKit
|
|
47
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { useRef as c, useCallback as f, useEffect as b } from "react";
|
|
2
|
+
function L() {
|
|
3
|
+
let o = c(/* @__PURE__ */ new Map()), u = f((e, l, r, t) => {
|
|
4
|
+
let n = t?.once ? (...d) => {
|
|
5
|
+
o.current.delete(r), r(...d);
|
|
6
|
+
} : r;
|
|
7
|
+
o.current.set(r, {
|
|
8
|
+
type: l,
|
|
9
|
+
eventTarget: e,
|
|
10
|
+
fn: n,
|
|
11
|
+
options: t
|
|
12
|
+
}), e.addEventListener(l, n, t);
|
|
13
|
+
}, []), a = f((e, l, r, t) => {
|
|
14
|
+
var n;
|
|
15
|
+
let d = ((n = o.current.get(r)) === null || n === void 0 ? void 0 : n.fn) || r;
|
|
16
|
+
e.removeEventListener(l, d, t), o.current.delete(r);
|
|
17
|
+
}, []), s = f(() => {
|
|
18
|
+
o.current.forEach((e, l) => {
|
|
19
|
+
a(e.eventTarget, e.type, l, e.options);
|
|
20
|
+
});
|
|
21
|
+
}, [
|
|
22
|
+
a
|
|
23
|
+
]);
|
|
24
|
+
return b(() => s, [
|
|
25
|
+
s
|
|
26
|
+
]), {
|
|
27
|
+
addGlobalListener: u,
|
|
28
|
+
removeGlobalListener: a,
|
|
29
|
+
removeAllGlobalListeners: s
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export {
|
|
33
|
+
L as useGlobalListeners
|
|
34
|
+
};
|