@abcagency/hc-ui-components 1.3.82 → 1.3.83
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/components/HireControlMap.js +1 -1
- package/dist/components/containers/filter/commute-container.js +1 -1
- package/dist/components/containers/maps/map-container.js +1 -1
- package/dist/components/containers/maps/map-marker-container.js +1 -1
- package/dist/components/modules/accordions/default.js +2 -2
- package/dist/components/modules/buttons/button-group-apply.js +1 -1
- package/dist/components/modules/buttons/default.js +2 -2
- package/dist/components/modules/cards/default.js +2 -2
- package/dist/components/modules/dialogs/apply-dialog.js +1 -1
- package/dist/components/modules/filter/commute.js +2 -2
- package/dist/components/modules/filter/sort.js +2 -2
- package/dist/components/modules/grid.js +1 -1
- package/dist/components/modules/icon.js +1 -1
- package/dist/components/modules/list/header.js +1 -1
- package/dist/components/modules/list/item-expand-card/index.js +1 -1
- package/dist/components/modules/maps/map-marker.js +1 -1
- package/dist/components/modules/maps/map.js +1 -1
- package/dist/components/modules/maps/place-marker.js +1 -1
- package/dist/components/modules/maps/tabs.js +39 -23
- package/dist/components/modules/maps/tabs.js.map +1 -1
- package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +802 -0
- package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js.map +1 -0
- package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +679 -0
- package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js.map +1 -0
- package/dist/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +343 -0
- package/dist/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js.map +1 -0
- package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +140 -0
- package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js.map +1 -0
- package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +137 -0
- package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.js.map +1 -0
- package/dist/node_modules/@headlessui/react/dist/components/combobox/combobox.js +33 -0
- package/dist/node_modules/@headlessui/react/dist/components/combobox/combobox.js.map +1 -0
- package/dist/node_modules/@headlessui/react/dist/components/keyboard.js +4 -0
- package/dist/node_modules/@headlessui/react/dist/components/keyboard.js.map +1 -0
- package/dist/node_modules/@headlessui/react/dist/components/transitions/transition.js +19 -0
- package/dist/node_modules/@headlessui/react/dist/components/transitions/transition.js.map +1 -0
- package/dist/node_modules/@headlessui/react/dist/components/transitions/utils/transition.js +8 -0
- package/dist/node_modules/@headlessui/react/dist/components/transitions/utils/transition.js.map +1 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-computed.js +8 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-computed.js.map +1 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-controllable.js +7 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-controllable.js.map +1 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-disposables.js +7 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-disposables.js.map +1 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-document-event.js +7 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-document-event.js.map +1 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-event.js +7 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-event.js.map +1 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-flags.js +7 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-flags.js.map +1 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-id.js +9 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-id.js.map +1 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-is-mounted.js +7 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-is-mounted.js.map +1 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-iso-morphic-effect.js +7 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-iso-morphic-effect.js.map +1 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-latest-value.js +7 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-latest-value.js.map +1 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-outside-click.js +10 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-outside-click.js.map +1 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-owner.js +7 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-owner.js.map +1 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-resolve-button-type.js +7 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-resolve-button-type.js.map +1 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-server-handoff-complete.js +7 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-server-handoff-complete.js.map +1 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-sync-refs.js +7 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-sync-refs.js.map +1 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-tracked-pointer.js +6 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-tracked-pointer.js.map +1 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-transition.js +11 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-transition.js.map +1 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-tree-walker.js +8 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-tree-walker.js.map +1 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-watch.js +7 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-watch.js.map +1 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-window-event.js +7 -0
- package/dist/node_modules/@headlessui/react/dist/hooks/use-window-event.js.map +1 -0
- package/dist/node_modules/@headlessui/react/dist/internal/hidden.js +6 -0
- package/dist/node_modules/@headlessui/react/dist/internal/hidden.js.map +1 -0
- package/dist/node_modules/@headlessui/react/dist/internal/open-closed.js +6 -0
- package/dist/node_modules/@headlessui/react/dist/internal/open-closed.js.map +1 -0
- package/dist/node_modules/@headlessui/react/dist/utils/active-element-history.js +6 -0
- package/dist/node_modules/@headlessui/react/dist/utils/active-element-history.js.map +1 -0
- package/dist/node_modules/@headlessui/react/dist/utils/bugs.js +4 -0
- package/dist/node_modules/@headlessui/react/dist/utils/bugs.js.map +1 -0
- package/dist/node_modules/@headlessui/react/dist/utils/calculate-active-index.js +4 -0
- package/dist/node_modules/@headlessui/react/dist/utils/calculate-active-index.js.map +1 -0
- package/dist/node_modules/@headlessui/react/dist/utils/class-names.js +4 -0
- package/dist/node_modules/@headlessui/react/dist/utils/class-names.js.map +1 -0
- package/dist/node_modules/@headlessui/react/dist/utils/disposables.js +6 -0
- package/dist/node_modules/@headlessui/react/dist/utils/disposables.js.map +1 -0
- package/dist/node_modules/@headlessui/react/dist/utils/document-ready.js +4 -0
- package/dist/node_modules/@headlessui/react/dist/utils/document-ready.js.map +1 -0
- package/dist/node_modules/@headlessui/react/dist/utils/env.js +4 -0
- package/dist/node_modules/@headlessui/react/dist/utils/env.js.map +1 -0
- package/dist/node_modules/@headlessui/react/dist/utils/focus-management.js +7 -0
- package/dist/node_modules/@headlessui/react/dist/utils/focus-management.js.map +1 -0
- package/dist/node_modules/@headlessui/react/dist/utils/form.js +4 -0
- package/dist/node_modules/@headlessui/react/dist/utils/form.js.map +1 -0
- package/dist/node_modules/@headlessui/react/dist/utils/match.js +4 -0
- package/dist/node_modules/@headlessui/react/dist/utils/match.js.map +1 -0
- package/dist/node_modules/@headlessui/react/dist/utils/micro-task.js +4 -0
- package/dist/node_modules/@headlessui/react/dist/utils/micro-task.js.map +1 -0
- package/dist/node_modules/@headlessui/react/dist/utils/once.js +4 -0
- package/dist/node_modules/@headlessui/react/dist/utils/once.js.map +1 -0
- package/dist/node_modules/@headlessui/react/dist/utils/owner.js +6 -0
- package/dist/node_modules/@headlessui/react/dist/utils/owner.js.map +1 -0
- package/dist/node_modules/@headlessui/react/dist/utils/platform.js +4 -0
- package/dist/node_modules/@headlessui/react/dist/utils/platform.js.map +1 -0
- package/dist/node_modules/@headlessui/react/dist/utils/render.js +11 -0
- package/dist/node_modules/@headlessui/react/dist/utils/render.js.map +1 -0
- package/dist/node_modules/@iconify/react/dist/iconify.js +1928 -0
- package/dist/node_modules/@iconify/react/dist/iconify.js.map +1 -0
- package/dist/node_modules/@radix-ui/number/dist/index.js +7 -0
- package/dist/node_modules/@radix-ui/number/dist/index.js.map +1 -0
- package/dist/node_modules/@radix-ui/primitive/dist/index.js +12 -0
- package/dist/node_modules/@radix-ui/primitive/dist/index.js.map +1 -0
- package/dist/node_modules/@radix-ui/react-accordion/dist/index.js +304 -0
- package/dist/node_modules/@radix-ui/react-accordion/dist/index.js.map +1 -0
- package/dist/node_modules/@radix-ui/react-arrow/dist/index.js +26 -0
- package/dist/node_modules/@radix-ui/react-arrow/dist/index.js.map +1 -0
- package/dist/node_modules/@radix-ui/react-collapsible/dist/index.js +145 -0
- package/dist/node_modules/@radix-ui/react-collapsible/dist/index.js.map +1 -0
- package/dist/node_modules/@radix-ui/react-collection/dist/index.js +69 -0
- package/dist/node_modules/@radix-ui/react-collection/dist/index.js.map +1 -0
- package/dist/node_modules/@radix-ui/react-compose-refs/dist/index.js +19 -0
- package/dist/node_modules/@radix-ui/react-compose-refs/dist/index.js.map +1 -0
- package/dist/node_modules/@radix-ui/react-context/dist/index.js +80 -0
- package/dist/node_modules/@radix-ui/react-context/dist/index.js.map +1 -0
- package/dist/node_modules/@radix-ui/react-dialog/dist/index.js +320 -0
- package/dist/node_modules/@radix-ui/react-dialog/dist/index.js.map +1 -0
- package/dist/node_modules/@radix-ui/react-direction/dist/index.js +12 -0
- package/dist/node_modules/@radix-ui/react-direction/dist/index.js.map +1 -0
- package/dist/node_modules/@radix-ui/react-dismissable-layer/dist/index.js +212 -0
- package/dist/node_modules/@radix-ui/react-dismissable-layer/dist/index.js.map +1 -0
- package/dist/node_modules/@radix-ui/react-focus-guards/dist/index.js +27 -0
- package/dist/node_modules/@radix-ui/react-focus-guards/dist/index.js.map +1 -0
- package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.js +208 -0
- package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.js.map +1 -0
- package/dist/node_modules/@radix-ui/react-id/dist/index.js +16 -0
- package/dist/node_modules/@radix-ui/react-id/dist/index.js.map +1 -0
- package/dist/node_modules/@radix-ui/react-popper/dist/index.js +279 -0
- package/dist/node_modules/@radix-ui/react-popper/dist/index.js.map +1 -0
- package/dist/node_modules/@radix-ui/react-portal/dist/index.js +18 -0
- package/dist/node_modules/@radix-ui/react-portal/dist/index.js.map +1 -0
- package/dist/node_modules/@radix-ui/react-presence/dist/index.js +120 -0
- package/dist/node_modules/@radix-ui/react-presence/dist/index.js.map +1 -0
- package/dist/node_modules/@radix-ui/react-primitive/dist/index.js +42 -0
- package/dist/node_modules/@radix-ui/react-primitive/dist/index.js.map +1 -0
- package/dist/node_modules/@radix-ui/react-roving-focus/dist/index.js +221 -0
- package/dist/node_modules/@radix-ui/react-roving-focus/dist/index.js.map +1 -0
- package/dist/node_modules/@radix-ui/react-select/dist/index.js +1109 -0
- package/dist/node_modules/@radix-ui/react-select/dist/index.js.map +1 -0
- package/dist/node_modules/@radix-ui/react-slot/dist/index.js +82 -0
- package/dist/node_modules/@radix-ui/react-slot/dist/index.js.map +1 -0
- package/dist/node_modules/@radix-ui/react-tabs/dist/index.js +187 -0
- package/dist/node_modules/@radix-ui/react-tabs/dist/index.js.map +1 -0
- package/dist/node_modules/@radix-ui/react-use-callback-ref/dist/index.js +13 -0
- package/dist/node_modules/@radix-ui/react-use-callback-ref/dist/index.js.map +1 -0
- package/dist/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +47 -0
- package/dist/node_modules/@radix-ui/react-use-controllable-state/dist/index.js.map +1 -0
- package/dist/node_modules/@radix-ui/react-use-escape-keydown/dist/index.js +19 -0
- package/dist/node_modules/@radix-ui/react-use-escape-keydown/dist/index.js.map +1 -0
- package/dist/node_modules/@radix-ui/react-use-layout-effect/dist/index.js +8 -0
- package/dist/node_modules/@radix-ui/react-use-layout-effect/dist/index.js.map +1 -0
- package/dist/node_modules/@radix-ui/react-use-previous/dist/index.js +16 -0
- package/dist/node_modules/@radix-ui/react-use-previous/dist/index.js.map +1 -0
- package/dist/node_modules/@radix-ui/react-use-size/dist/index.js +41 -0
- package/dist/node_modules/@radix-ui/react-use-size/dist/index.js.map +1 -0
- package/dist/node_modules/@radix-ui/react-visually-hidden/dist/index.js +35 -0
- package/dist/node_modules/@radix-ui/react-visually-hidden/dist/index.js.map +1 -0
- package/dist/node_modules/@react-google-maps/api/dist/esm.js +8515 -0
- package/dist/node_modules/@react-google-maps/api/dist/esm.js.map +1 -0
- package/dist/node_modules/@remix-run/router/dist/router.js +271 -0
- package/dist/node_modules/@remix-run/router/dist/router.js.map +1 -0
- package/dist/node_modules/@tanstack/react-virtual/dist/esm/index.js +43 -0
- package/dist/node_modules/@tanstack/react-virtual/dist/esm/index.js.map +1 -0
- package/dist/node_modules/@tanstack/virtual-core/dist/esm/index.js +669 -0
- package/dist/node_modules/@tanstack/virtual-core/dist/esm/index.js.map +1 -0
- package/dist/node_modules/@tanstack/virtual-core/dist/esm/utils.js +61 -0
- package/dist/node_modules/@tanstack/virtual-core/dist/esm/utils.js.map +1 -0
- package/dist/node_modules/aria-hidden/dist/es2015/index.js +137 -0
- package/dist/node_modules/aria-hidden/dist/es2015/index.js.map +1 -0
- package/dist/node_modules/fuse.js/dist/fuse.js +1779 -0
- package/dist/node_modules/fuse.js/dist/fuse.js.map +1 -0
- package/dist/node_modules/get-nonce/dist/es2015/index.js +9 -0
- package/dist/node_modules/get-nonce/dist/es2015/index.js.map +1 -0
- package/dist/node_modules/react/cjs/react-jsx-runtime.production.min.js +17 -0
- package/dist/node_modules/react/cjs/react-jsx-runtime.production.min.js.map +1 -0
- package/dist/node_modules/react/jsx-runtime.js +12 -0
- package/dist/node_modules/react/jsx-runtime.js.map +1 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/Combination.js +10 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/Combination.js.map +1 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/SideEffect.js +161 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/SideEffect.js.map +1 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/UI.js +39 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/UI.js.map +1 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js +22 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js.map +1 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/handleScroll.js +107 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/handleScroll.js.map +1 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/medium.js +6 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/medium.js.map +1 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/sidecar.js +8 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/sidecar.js.map +1 -0
- package/dist/node_modules/react-remove-scroll-bar/dist/es2015/component.js +57 -0
- package/dist/node_modules/react-remove-scroll-bar/dist/es2015/component.js.map +1 -0
- package/dist/node_modules/react-remove-scroll-bar/dist/es2015/constants.js +11 -0
- package/dist/node_modules/react-remove-scroll-bar/dist/es2015/constants.js.map +1 -0
- package/dist/node_modules/react-remove-scroll-bar/dist/es2015/utils.js +32 -0
- package/dist/node_modules/react-remove-scroll-bar/dist/es2015/utils.js.map +1 -0
- package/dist/node_modules/react-router/dist/index.js +280 -0
- package/dist/node_modules/react-router/dist/index.js.map +1 -0
- package/dist/node_modules/react-router-dom/dist/index.js +201 -0
- package/dist/node_modules/react-router-dom/dist/index.js.map +1 -0
- package/dist/node_modules/react-style-singleton/dist/es2015/component.js +20 -0
- package/dist/node_modules/react-style-singleton/dist/es2015/component.js.map +1 -0
- package/dist/node_modules/react-style-singleton/dist/es2015/hook.js +26 -0
- package/dist/node_modules/react-style-singleton/dist/es2015/hook.js.map +1 -0
- package/dist/node_modules/react-style-singleton/dist/es2015/singleton.js +52 -0
- package/dist/node_modules/react-style-singleton/dist/es2015/singleton.js.map +1 -0
- package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js +2530 -0
- package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js.map +1 -0
- package/dist/node_modules/tslib/tslib.es6.js +57 -0
- package/dist/node_modules/tslib/tslib.es6.js.map +1 -0
- package/dist/node_modules/use-callback-ref/dist/es2015/assignRef.js +25 -0
- package/dist/node_modules/use-callback-ref/dist/es2015/assignRef.js.map +1 -0
- package/dist/node_modules/use-callback-ref/dist/es2015/useMergeRef.js +49 -0
- package/dist/node_modules/use-callback-ref/dist/es2015/useMergeRef.js.map +1 -0
- package/dist/node_modules/use-callback-ref/dist/es2015/useRef.js +43 -0
- package/dist/node_modules/use-callback-ref/dist/es2015/useRef.js.map +1 -0
- package/dist/node_modules/use-places-autocomplete/dist/index.esm.js +243 -0
- package/dist/node_modules/use-places-autocomplete/dist/index.esm.js.map +1 -0
- package/dist/node_modules/use-sidecar/dist/es2015/exports.js +22 -0
- package/dist/node_modules/use-sidecar/dist/es2015/exports.js.map +1 -0
- package/dist/node_modules/use-sidecar/dist/es2015/medium.js +78 -0
- package/dist/node_modules/use-sidecar/dist/es2015/medium.js.map +1 -0
- package/dist/styles/index.css +1 -1
- package/dist/util/filterUtil.js +1 -1
- package/package.json +1 -1
- package/src/components/modules/maps/tabs.js +57 -24
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
var alwaysContainsScroll = function (node) {
|
|
2
|
+
// textarea will always _contain_ scroll inside self. It only can be hidden
|
|
3
|
+
return node.tagName === 'TEXTAREA';
|
|
4
|
+
};
|
|
5
|
+
var elementCanBeScrolled = function (node, overflow) {
|
|
6
|
+
var styles = window.getComputedStyle(node);
|
|
7
|
+
return (
|
|
8
|
+
// not-not-scrollable
|
|
9
|
+
styles[overflow] !== 'hidden' &&
|
|
10
|
+
// contains scroll inside self
|
|
11
|
+
!(styles.overflowY === styles.overflowX && !alwaysContainsScroll(node) && styles[overflow] === 'visible'));
|
|
12
|
+
};
|
|
13
|
+
var elementCouldBeVScrolled = function (node) { return elementCanBeScrolled(node, 'overflowY'); };
|
|
14
|
+
var elementCouldBeHScrolled = function (node) { return elementCanBeScrolled(node, 'overflowX'); };
|
|
15
|
+
var locationCouldBeScrolled = function (axis, node) {
|
|
16
|
+
var ownerDocument = node.ownerDocument;
|
|
17
|
+
var current = node;
|
|
18
|
+
do {
|
|
19
|
+
// Skip over shadow root
|
|
20
|
+
if (typeof ShadowRoot !== 'undefined' && current instanceof ShadowRoot) {
|
|
21
|
+
current = current.host;
|
|
22
|
+
}
|
|
23
|
+
var isScrollable = elementCouldBeScrolled(axis, current);
|
|
24
|
+
if (isScrollable) {
|
|
25
|
+
var _a = getScrollVariables(axis, current), s = _a[1], d = _a[2];
|
|
26
|
+
if (s > d) {
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
current = current.parentNode;
|
|
31
|
+
} while (current && current !== ownerDocument.body);
|
|
32
|
+
return false;
|
|
33
|
+
};
|
|
34
|
+
var getVScrollVariables = function (_a) {
|
|
35
|
+
var scrollTop = _a.scrollTop, scrollHeight = _a.scrollHeight, clientHeight = _a.clientHeight;
|
|
36
|
+
return [
|
|
37
|
+
scrollTop,
|
|
38
|
+
scrollHeight,
|
|
39
|
+
clientHeight,
|
|
40
|
+
];
|
|
41
|
+
};
|
|
42
|
+
var getHScrollVariables = function (_a) {
|
|
43
|
+
var scrollLeft = _a.scrollLeft, scrollWidth = _a.scrollWidth, clientWidth = _a.clientWidth;
|
|
44
|
+
return [
|
|
45
|
+
scrollLeft,
|
|
46
|
+
scrollWidth,
|
|
47
|
+
clientWidth,
|
|
48
|
+
];
|
|
49
|
+
};
|
|
50
|
+
var elementCouldBeScrolled = function (axis, node) {
|
|
51
|
+
return axis === 'v' ? elementCouldBeVScrolled(node) : elementCouldBeHScrolled(node);
|
|
52
|
+
};
|
|
53
|
+
var getScrollVariables = function (axis, node) {
|
|
54
|
+
return axis === 'v' ? getVScrollVariables(node) : getHScrollVariables(node);
|
|
55
|
+
};
|
|
56
|
+
var getDirectionFactor = function (axis, direction) {
|
|
57
|
+
/**
|
|
58
|
+
* If the element's direction is rtl (right-to-left), then scrollLeft is 0 when the scrollbar is at its rightmost position,
|
|
59
|
+
* and then increasingly negative as you scroll towards the end of the content.
|
|
60
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollLeft
|
|
61
|
+
*/
|
|
62
|
+
return axis === 'h' && direction === 'rtl' ? -1 : 1;
|
|
63
|
+
};
|
|
64
|
+
var handleScroll = function (axis, endTarget, event, sourceDelta, noOverscroll) {
|
|
65
|
+
var directionFactor = getDirectionFactor(axis, window.getComputedStyle(endTarget).direction);
|
|
66
|
+
var delta = directionFactor * sourceDelta;
|
|
67
|
+
// find scrollable target
|
|
68
|
+
var target = event.target;
|
|
69
|
+
var targetInLock = endTarget.contains(target);
|
|
70
|
+
var shouldCancelScroll = false;
|
|
71
|
+
var isDeltaPositive = delta > 0;
|
|
72
|
+
var availableScroll = 0;
|
|
73
|
+
var availableScrollTop = 0;
|
|
74
|
+
do {
|
|
75
|
+
var _a = getScrollVariables(axis, target), position = _a[0], scroll_1 = _a[1], capacity = _a[2];
|
|
76
|
+
var elementScroll = scroll_1 - capacity - directionFactor * position;
|
|
77
|
+
if (position || elementScroll) {
|
|
78
|
+
if (elementCouldBeScrolled(axis, target)) {
|
|
79
|
+
availableScroll += elementScroll;
|
|
80
|
+
availableScrollTop += position;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
if (target instanceof ShadowRoot) {
|
|
84
|
+
target = target.host;
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
target = target.parentNode;
|
|
88
|
+
}
|
|
89
|
+
} while (
|
|
90
|
+
// portaled content
|
|
91
|
+
(!targetInLock && target !== document.body) ||
|
|
92
|
+
// self content
|
|
93
|
+
(targetInLock && (endTarget.contains(target) || endTarget === target)));
|
|
94
|
+
// handle epsilon around 0 (non standard zoom levels)
|
|
95
|
+
if (isDeltaPositive &&
|
|
96
|
+
((Math.abs(availableScroll) < 1) || (!noOverscroll ))) {
|
|
97
|
+
shouldCancelScroll = true;
|
|
98
|
+
}
|
|
99
|
+
else if (!isDeltaPositive &&
|
|
100
|
+
((Math.abs(availableScrollTop) < 1) || (!noOverscroll ))) {
|
|
101
|
+
shouldCancelScroll = true;
|
|
102
|
+
}
|
|
103
|
+
return shouldCancelScroll;
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
export { handleScroll, locationCouldBeScrolled };
|
|
107
|
+
//# sourceMappingURL=handleScroll.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleScroll.js","sources":["../../../../../node_modules/react-remove-scroll/dist/es2015/handleScroll.js"],"sourcesContent":["var alwaysContainsScroll = function (node) {\n // textarea will always _contain_ scroll inside self. It only can be hidden\n return node.tagName === 'TEXTAREA';\n};\nvar elementCanBeScrolled = function (node, overflow) {\n var styles = window.getComputedStyle(node);\n return (\n // not-not-scrollable\n styles[overflow] !== 'hidden' &&\n // contains scroll inside self\n !(styles.overflowY === styles.overflowX && !alwaysContainsScroll(node) && styles[overflow] === 'visible'));\n};\nvar elementCouldBeVScrolled = function (node) { return elementCanBeScrolled(node, 'overflowY'); };\nvar elementCouldBeHScrolled = function (node) { return elementCanBeScrolled(node, 'overflowX'); };\nexport var locationCouldBeScrolled = function (axis, node) {\n var ownerDocument = node.ownerDocument;\n var current = node;\n do {\n // Skip over shadow root\n if (typeof ShadowRoot !== 'undefined' && current instanceof ShadowRoot) {\n current = current.host;\n }\n var isScrollable = elementCouldBeScrolled(axis, current);\n if (isScrollable) {\n var _a = getScrollVariables(axis, current), s = _a[1], d = _a[2];\n if (s > d) {\n return true;\n }\n }\n current = current.parentNode;\n } while (current && current !== ownerDocument.body);\n return false;\n};\nvar getVScrollVariables = function (_a) {\n var scrollTop = _a.scrollTop, scrollHeight = _a.scrollHeight, clientHeight = _a.clientHeight;\n return [\n scrollTop,\n scrollHeight,\n clientHeight,\n ];\n};\nvar getHScrollVariables = function (_a) {\n var scrollLeft = _a.scrollLeft, scrollWidth = _a.scrollWidth, clientWidth = _a.clientWidth;\n return [\n scrollLeft,\n scrollWidth,\n clientWidth,\n ];\n};\nvar elementCouldBeScrolled = function (axis, node) {\n return axis === 'v' ? elementCouldBeVScrolled(node) : elementCouldBeHScrolled(node);\n};\nvar getScrollVariables = function (axis, node) {\n return axis === 'v' ? getVScrollVariables(node) : getHScrollVariables(node);\n};\nvar getDirectionFactor = function (axis, direction) {\n /**\n * If the element's direction is rtl (right-to-left), then scrollLeft is 0 when the scrollbar is at its rightmost position,\n * and then increasingly negative as you scroll towards the end of the content.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollLeft\n */\n return axis === 'h' && direction === 'rtl' ? -1 : 1;\n};\nexport var handleScroll = function (axis, endTarget, event, sourceDelta, noOverscroll) {\n var directionFactor = getDirectionFactor(axis, window.getComputedStyle(endTarget).direction);\n var delta = directionFactor * sourceDelta;\n // find scrollable target\n var target = event.target;\n var targetInLock = endTarget.contains(target);\n var shouldCancelScroll = false;\n var isDeltaPositive = delta > 0;\n var availableScroll = 0;\n var availableScrollTop = 0;\n do {\n var _a = getScrollVariables(axis, target), position = _a[0], scroll_1 = _a[1], capacity = _a[2];\n var elementScroll = scroll_1 - capacity - directionFactor * position;\n if (position || elementScroll) {\n if (elementCouldBeScrolled(axis, target)) {\n availableScroll += elementScroll;\n availableScrollTop += position;\n }\n }\n if (target instanceof ShadowRoot) {\n target = target.host;\n }\n else {\n target = target.parentNode;\n }\n } while (\n // portaled content\n (!targetInLock && target !== document.body) ||\n // self content\n (targetInLock && (endTarget.contains(target) || endTarget === target)));\n // handle epsilon around 0 (non standard zoom levels)\n if (isDeltaPositive &&\n ((noOverscroll && Math.abs(availableScroll) < 1) || (!noOverscroll && delta > availableScroll))) {\n shouldCancelScroll = true;\n }\n else if (!isDeltaPositive &&\n ((noOverscroll && Math.abs(availableScrollTop) < 1) || (!noOverscroll && -delta > availableScrollTop))) {\n shouldCancelScroll = true;\n }\n return shouldCancelScroll;\n};\n"],"names":[],"mappings":"AAAA,IAAI,oBAAoB,GAAG,UAAU,IAAI,EAAE;AAC3C;AACA,IAAI,OAAO,IAAI,CAAC,OAAO,KAAK,UAAU,CAAC;AACvC,CAAC,CAAC;AACF,IAAI,oBAAoB,GAAG,UAAU,IAAI,EAAE,QAAQ,EAAE;AACrD,IAAI,IAAI,MAAM,GAAG,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;AAC/C,IAAI;AACJ;AACA,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,QAAQ;AACjC;AACA,QAAQ,EAAE,MAAM,CAAC,SAAS,KAAK,MAAM,CAAC,SAAS,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,SAAS,CAAC,EAAE;AACnH,CAAC,CAAC;AACF,IAAI,uBAAuB,GAAG,UAAU,IAAI,EAAE,EAAE,OAAO,oBAAoB,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC,EAAE,CAAC;AAClG,IAAI,uBAAuB,GAAG,UAAU,IAAI,EAAE,EAAE,OAAO,oBAAoB,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC,EAAE,CAAC;AACxF,IAAC,uBAAuB,GAAG,UAAU,IAAI,EAAE,IAAI,EAAE;AAC3D,IAAI,IAAI,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC;AAC3C,IAAI,IAAI,OAAO,GAAG,IAAI,CAAC;AACvB,IAAI,GAAG;AACP;AACA,QAAQ,IAAI,OAAO,UAAU,KAAK,WAAW,IAAI,OAAO,YAAY,UAAU,EAAE;AAChF,YAAY,OAAO,GAAG,OAAO,CAAC,IAAI,C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AACxG,QAAQ,IAAI,aAAa,GAAG,QAAQ,GAAG,QAAQ,GAAG,eAAe,GAAG,QAAQ,CAAC;AAC7E,QAAQ,IAAI,QAAQ,IAAI,aAAa,EAAE;AACvC,YAAY,IAAI,sBAAsB,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE;AACtD,gBAAgB,eAAe,IAAI,aAAa,CAAC;AACjD,gBAAgB,kBAAkB,IAAI,QAAQ,CAAC;AAC/C,aAAa;AACb,SAAS;AACT,QAAQ,IAAI,MAAM,YAAY,UAAU,EAAE;AAC1C,YAAY,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC;AACjC,SAAS;AACT,aAAa;AACb,YAAY,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC;AACvC,SAAS;AACT,KAAK;AACL;AACA,IAAI,CAAC,CAAC,YAAY,IAAI,MAAM,KAAK,QAAQ,CAAC,IAAI;AAC9C;AACA,SAAS,YAAY,KAAK,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,SAAS,KAAK,MAAM,CAAC,CAAC,EAAE;AAChF;AACA,IAAI,IAAI,eAAe;AACvB,SAAS,CAAiB,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,GAAG,CAAC,MAAM,CAAC,YAAY,CAA2B,CAAC,CAAC,EAAE;AACzG,QAAQ,kBAAkB,GAAG,IAAI,CAAC;AAClC,KAAK;AACL,SAAS,IAAI,CAAC,eAAe;AAC7B,SAAS,CAAiB,IAAI,CAAC,GAAG,CAAC,kBAAkB,CAAC,GAAG,CAAC,MAAM,CAAC,YAAY,CAA+B,CAAC,CAAC,EAAE;AAChH,QAAQ,kBAAkB,GAAG,IAAI,CAAC;AAClC,KAAK;AACL,IAAI,OAAO,kBAAkB,CAAC;AAC9B;;;;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"medium.js","sources":["../../../../../node_modules/react-remove-scroll/dist/es2015/medium.js"],"sourcesContent":["import { createSidecarMedium } from 'use-sidecar';\nexport var effectCar = createSidecarMedium();\n"],"names":[],"mappings":";;AACU,IAAC,SAAS,GAAG,mBAAmB;;;;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { RemoveScrollSideCar } from './SideEffect.js';
|
|
2
|
+
import { effectCar } from './medium.js';
|
|
3
|
+
import { exportSidecar } from '../../../use-sidecar/dist/es2015/exports.js';
|
|
4
|
+
|
|
5
|
+
var SideCar = exportSidecar(effectCar, RemoveScrollSideCar);
|
|
6
|
+
|
|
7
|
+
export { SideCar as default };
|
|
8
|
+
//# sourceMappingURL=sidecar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sidecar.js","sources":["../../../../../node_modules/react-remove-scroll/dist/es2015/sidecar.js"],"sourcesContent":["import { exportSidecar } from 'use-sidecar';\nimport { RemoveScrollSideCar } from './SideEffect';\nimport { effectCar } from './medium';\nexport default exportSidecar(effectCar, RemoveScrollSideCar);\n"],"names":[],"mappings":";;;;AAGA,cAAe,aAAa,CAAC,SAAS,EAAE,mBAAmB,CAAC;;;;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { styleSingleton } from '../../../react-style-singleton/dist/es2015/component.js';
|
|
3
|
+
import { noScrollbarsClassName, zeroRightClassName, fullWidthClassName, removedBarSizeVariable } from './constants.js';
|
|
4
|
+
import { getGapWidth } from './utils.js';
|
|
5
|
+
|
|
6
|
+
var Style = styleSingleton();
|
|
7
|
+
var lockAttribute = 'data-scroll-locked';
|
|
8
|
+
// important tip - once we measure scrollBar width and remove them
|
|
9
|
+
// we could not repeat this operation
|
|
10
|
+
// thus we are using style-singleton - only the first "yet correct" style will be applied.
|
|
11
|
+
var getStyles = function (_a, allowRelative, gapMode, important) {
|
|
12
|
+
var left = _a.left, top = _a.top, right = _a.right, gap = _a.gap;
|
|
13
|
+
if (gapMode === void 0) { gapMode = 'margin'; }
|
|
14
|
+
return "\n .".concat(noScrollbarsClassName, " {\n overflow: hidden ").concat(important, ";\n padding-right: ").concat(gap, "px ").concat(important, ";\n }\n body[").concat(lockAttribute, "] {\n overflow: hidden ").concat(important, ";\n overscroll-behavior: contain;\n ").concat([
|
|
15
|
+
allowRelative && "position: relative ".concat(important, ";"),
|
|
16
|
+
gapMode === 'margin' &&
|
|
17
|
+
"\n padding-left: ".concat(left, "px;\n padding-top: ").concat(top, "px;\n padding-right: ").concat(right, "px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(gap, "px ").concat(important, ";\n "),
|
|
18
|
+
gapMode === 'padding' && "padding-right: ".concat(gap, "px ").concat(important, ";"),
|
|
19
|
+
]
|
|
20
|
+
.filter(Boolean)
|
|
21
|
+
.join(''), "\n }\n \n .").concat(zeroRightClassName, " {\n right: ").concat(gap, "px ").concat(important, ";\n }\n \n .").concat(fullWidthClassName, " {\n margin-right: ").concat(gap, "px ").concat(important, ";\n }\n \n .").concat(zeroRightClassName, " .").concat(zeroRightClassName, " {\n right: 0 ").concat(important, ";\n }\n \n .").concat(fullWidthClassName, " .").concat(fullWidthClassName, " {\n margin-right: 0 ").concat(important, ";\n }\n \n body[").concat(lockAttribute, "] {\n ").concat(removedBarSizeVariable, ": ").concat(gap, "px;\n }\n");
|
|
22
|
+
};
|
|
23
|
+
var getCurrentUseCounter = function () {
|
|
24
|
+
var counter = parseInt(document.body.getAttribute(lockAttribute) || '0', 10);
|
|
25
|
+
return isFinite(counter) ? counter : 0;
|
|
26
|
+
};
|
|
27
|
+
var useLockAttribute = function () {
|
|
28
|
+
React.useEffect(function () {
|
|
29
|
+
document.body.setAttribute(lockAttribute, (getCurrentUseCounter() + 1).toString());
|
|
30
|
+
return function () {
|
|
31
|
+
var newCounter = getCurrentUseCounter() - 1;
|
|
32
|
+
if (newCounter <= 0) {
|
|
33
|
+
document.body.removeAttribute(lockAttribute);
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
document.body.setAttribute(lockAttribute, newCounter.toString());
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
}, []);
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Removes page scrollbar and blocks page scroll when mounted
|
|
43
|
+
*/
|
|
44
|
+
var RemoveScrollBar = function (_a) {
|
|
45
|
+
var noRelative = _a.noRelative, noImportant = _a.noImportant, _b = _a.gapMode, gapMode = _b === void 0 ? 'margin' : _b;
|
|
46
|
+
useLockAttribute();
|
|
47
|
+
/*
|
|
48
|
+
gap will be measured on every component mount
|
|
49
|
+
however it will be used only by the "first" invocation
|
|
50
|
+
due to singleton nature of <Style
|
|
51
|
+
*/
|
|
52
|
+
var gap = React.useMemo(function () { return getGapWidth(gapMode); }, [gapMode]);
|
|
53
|
+
return React.createElement(Style, { styles: getStyles(gap, !noRelative, gapMode, !noImportant ? '!important' : '') });
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export { RemoveScrollBar, lockAttribute, useLockAttribute };
|
|
57
|
+
//# sourceMappingURL=component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component.js","sources":["../../../../../node_modules/react-remove-scroll-bar/dist/es2015/component.js"],"sourcesContent":["import * as React from 'react';\nimport { styleSingleton } from 'react-style-singleton';\nimport { fullWidthClassName, zeroRightClassName, noScrollbarsClassName, removedBarSizeVariable } from './constants';\nimport { getGapWidth } from './utils';\nvar Style = styleSingleton();\nexport var lockAttribute = 'data-scroll-locked';\n// important tip - once we measure scrollBar width and remove them\n// we could not repeat this operation\n// thus we are using style-singleton - only the first \"yet correct\" style will be applied.\nvar getStyles = function (_a, allowRelative, gapMode, important) {\n var left = _a.left, top = _a.top, right = _a.right, gap = _a.gap;\n if (gapMode === void 0) { gapMode = 'margin'; }\n return \"\\n .\".concat(noScrollbarsClassName, \" {\\n overflow: hidden \").concat(important, \";\\n padding-right: \").concat(gap, \"px \").concat(important, \";\\n }\\n body[\").concat(lockAttribute, \"] {\\n overflow: hidden \").concat(important, \";\\n overscroll-behavior: contain;\\n \").concat([\n allowRelative && \"position: relative \".concat(important, \";\"),\n gapMode === 'margin' &&\n \"\\n padding-left: \".concat(left, \"px;\\n padding-top: \").concat(top, \"px;\\n padding-right: \").concat(right, \"px;\\n margin-left:0;\\n margin-top:0;\\n margin-right: \").concat(gap, \"px \").concat(important, \";\\n \"),\n gapMode === 'padding' && \"padding-right: \".concat(gap, \"px \").concat(important, \";\"),\n ]\n .filter(Boolean)\n .join(''), \"\\n }\\n \\n .\").concat(zeroRightClassName, \" {\\n right: \").concat(gap, \"px \").concat(important, \";\\n }\\n \\n .\").concat(fullWidthClassName, \" {\\n margin-right: \").concat(gap, \"px \").concat(important, \";\\n }\\n \\n .\").concat(zeroRightClassName, \" .\").concat(zeroRightClassName, \" {\\n right: 0 \").concat(important, \";\\n }\\n \\n .\").concat(fullWidthClassName, \" .\").concat(fullWidthClassName, \" {\\n margin-right: 0 \").concat(important, \";\\n }\\n \\n body[\").concat(lockAttribute, \"] {\\n \").concat(removedBarSizeVariable, \": \").concat(gap, \"px;\\n }\\n\");\n};\nvar getCurrentUseCounter = function () {\n var counter = parseInt(document.body.getAttribute(lockAttribute) || '0', 10);\n return isFinite(counter) ? counter : 0;\n};\nexport var useLockAttribute = function () {\n React.useEffect(function () {\n document.body.setAttribute(lockAttribute, (getCurrentUseCounter() + 1).toString());\n return function () {\n var newCounter = getCurrentUseCounter() - 1;\n if (newCounter <= 0) {\n document.body.removeAttribute(lockAttribute);\n }\n else {\n document.body.setAttribute(lockAttribute, newCounter.toString());\n }\n };\n }, []);\n};\n/**\n * Removes page scrollbar and blocks page scroll when mounted\n */\nexport var RemoveScrollBar = function (_a) {\n var noRelative = _a.noRelative, noImportant = _a.noImportant, _b = _a.gapMode, gapMode = _b === void 0 ? 'margin' : _b;\n useLockAttribute();\n /*\n gap will be measured on every component mount\n however it will be used only by the \"first\" invocation\n due to singleton nature of <Style\n */\n var gap = React.useMemo(function () { return getGapWidth(gapMode); }, [gapM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+
var fullWidthClassName = 'width-before-scroll-bar';
|
|
3
|
+
var noScrollbarsClassName = 'with-scroll-bars-hidden';
|
|
4
|
+
/**
|
|
5
|
+
* Name of a CSS variable containing the amount of "hidden" scrollbar
|
|
6
|
+
* ! might be undefined ! use will fallback!
|
|
7
|
+
*/
|
|
8
|
+
var removedBarSizeVariable = '--removed-body-scroll-bar-size';
|
|
9
|
+
|
|
10
|
+
export { fullWidthClassName, noScrollbarsClassName, removedBarSizeVariable, zeroRightClassName };
|
|
11
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sources":["../../../../../node_modules/react-remove-scroll-bar/dist/es2015/constants.js"],"sourcesContent":["export var zeroRightClassName = 'right-scroll-bar-position';\nexport var fullWidthClassName = 'width-before-scroll-bar';\nexport var noScrollbarsClassName = 'with-scroll-bars-hidden';\n/**\n * Name of a CSS variable containing the amount of \"hidden\" scrollbar\n * ! might be undefined ! use will fallback!\n */\nexport var removedBarSizeVariable = '--removed-body-scroll-bar-size';\n"],"names":[],"mappings":"AAAU,IAAC,kBAAkB,GAAG,4BAA4B;AAClD,IAAC,kBAAkB,GAAG,0BAA0B;AAChD,IAAC,qBAAqB,GAAG,0BAA0B;AAC7D;AACA;AACA;AACA;AACU,IAAC,sBAAsB,GAAG;;;;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
var zeroGap = {
|
|
2
|
+
left: 0,
|
|
3
|
+
top: 0,
|
|
4
|
+
right: 0,
|
|
5
|
+
gap: 0,
|
|
6
|
+
};
|
|
7
|
+
var parse = function (x) { return parseInt(x || '', 10) || 0; };
|
|
8
|
+
var getOffset = function (gapMode) {
|
|
9
|
+
var cs = window.getComputedStyle(document.body);
|
|
10
|
+
var left = cs[gapMode === 'padding' ? 'paddingLeft' : 'marginLeft'];
|
|
11
|
+
var top = cs[gapMode === 'padding' ? 'paddingTop' : 'marginTop'];
|
|
12
|
+
var right = cs[gapMode === 'padding' ? 'paddingRight' : 'marginRight'];
|
|
13
|
+
return [parse(left), parse(top), parse(right)];
|
|
14
|
+
};
|
|
15
|
+
var getGapWidth = function (gapMode) {
|
|
16
|
+
if (gapMode === void 0) { gapMode = 'margin'; }
|
|
17
|
+
if (typeof window === 'undefined') {
|
|
18
|
+
return zeroGap;
|
|
19
|
+
}
|
|
20
|
+
var offsets = getOffset(gapMode);
|
|
21
|
+
var documentWidth = document.documentElement.clientWidth;
|
|
22
|
+
var windowWidth = window.innerWidth;
|
|
23
|
+
return {
|
|
24
|
+
left: offsets[0],
|
|
25
|
+
top: offsets[1],
|
|
26
|
+
right: offsets[2],
|
|
27
|
+
gap: Math.max(0, windowWidth - documentWidth + offsets[2] - offsets[0]),
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export { getGapWidth, zeroGap };
|
|
32
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../../../node_modules/react-remove-scroll-bar/dist/es2015/utils.js"],"sourcesContent":["export var zeroGap = {\n left: 0,\n top: 0,\n right: 0,\n gap: 0,\n};\nvar parse = function (x) { return parseInt(x || '', 10) || 0; };\nvar getOffset = function (gapMode) {\n var cs = window.getComputedStyle(document.body);\n var left = cs[gapMode === 'padding' ? 'paddingLeft' : 'marginLeft'];\n var top = cs[gapMode === 'padding' ? 'paddingTop' : 'marginTop'];\n var right = cs[gapMode === 'padding' ? 'paddingRight' : 'marginRight'];\n return [parse(left), parse(top), parse(right)];\n};\nexport var getGapWidth = function (gapMode) {\n if (gapMode === void 0) { gapMode = 'margin'; }\n if (typeof window === 'undefined') {\n return zeroGap;\n }\n var offsets = getOffset(gapMode);\n var documentWidth = document.documentElement.clientWidth;\n var windowWidth = window.innerWidth;\n return {\n left: offsets[0],\n top: offsets[1],\n right: offsets[2],\n gap: Math.max(0, windowWidth - documentWidth + offsets[2] - offsets[0]),\n };\n};\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GAAG,MAAM,CAAC,UAAU,CAAC;AACxC,IAAI,OAAO;AACX,QAAQ,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;AACxB,QAAQ,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC;AACvB,QAAQ,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;AACzB,QAAQ,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,WAAW,GAAG,aAAa,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;AAC/E,KAAK,CAAC;AACN;;;;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { UNSAFE_invariant as invariant, joinPaths, UNSAFE_getResolveToMatches as getResolveToMatches, resolveTo } from '../../@remix-run/router/dist/router.js';
|
|
3
|
+
export { Action as NavigationType, createPath, parsePath, resolvePath } from '../../@remix-run/router/dist/router.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* React Router v6.24.1
|
|
7
|
+
*
|
|
8
|
+
* Copyright (c) Remix Software Inc.
|
|
9
|
+
*
|
|
10
|
+
* This source code is licensed under the MIT license found in the
|
|
11
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
12
|
+
*
|
|
13
|
+
* @license MIT
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
function _extends() {
|
|
17
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
18
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
19
|
+
var source = arguments[i];
|
|
20
|
+
for (var key in source) {
|
|
21
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
22
|
+
target[key] = source[key];
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return target;
|
|
27
|
+
};
|
|
28
|
+
return _extends.apply(this, arguments);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Create react-specific types from the agnostic types in @remix-run/router to
|
|
32
|
+
// export from react-router
|
|
33
|
+
const DataRouterContext = /*#__PURE__*/React.createContext(null);
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* A Navigator is a "location changer"; it's how you get to different locations.
|
|
37
|
+
*
|
|
38
|
+
* Every history instance conforms to the Navigator interface, but the
|
|
39
|
+
* distinction is useful primarily when it comes to the low-level `<Router>` API
|
|
40
|
+
* where both the location and a navigator must be provided separately in order
|
|
41
|
+
* to avoid "tearing" that may occur in a suspense-enabled app if the action
|
|
42
|
+
* and/or location were to be read directly from the history instance.
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
const NavigationContext = /*#__PURE__*/React.createContext(null);
|
|
46
|
+
const LocationContext = /*#__PURE__*/React.createContext(null);
|
|
47
|
+
const RouteContext = /*#__PURE__*/React.createContext({
|
|
48
|
+
outlet: null,
|
|
49
|
+
matches: [],
|
|
50
|
+
isDataRoute: false
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Returns the full href for the given "to" value. This is useful for building
|
|
55
|
+
* custom links that are also accessible and preserve right-click behavior.
|
|
56
|
+
*
|
|
57
|
+
* @see https://reactrouter.com/hooks/use-href
|
|
58
|
+
*/
|
|
59
|
+
function useHref(to, _temp) {
|
|
60
|
+
let {
|
|
61
|
+
relative
|
|
62
|
+
} = _temp === void 0 ? {} : _temp;
|
|
63
|
+
!useInRouterContext() ? invariant(false) : void 0;
|
|
64
|
+
let {
|
|
65
|
+
basename,
|
|
66
|
+
navigator
|
|
67
|
+
} = React.useContext(NavigationContext);
|
|
68
|
+
let {
|
|
69
|
+
hash,
|
|
70
|
+
pathname,
|
|
71
|
+
search
|
|
72
|
+
} = useResolvedPath(to, {
|
|
73
|
+
relative
|
|
74
|
+
});
|
|
75
|
+
let joinedPathname = pathname;
|
|
76
|
+
|
|
77
|
+
// If we're operating within a basename, prepend it to the pathname prior
|
|
78
|
+
// to creating the href. If this is a root navigation, then just use the raw
|
|
79
|
+
// basename which allows the basename to have full control over the presence
|
|
80
|
+
// of a trailing slash on root links
|
|
81
|
+
if (basename !== "/") {
|
|
82
|
+
joinedPathname = pathname === "/" ? basename : joinPaths([basename, pathname]);
|
|
83
|
+
}
|
|
84
|
+
return navigator.createHref({
|
|
85
|
+
pathname: joinedPathname,
|
|
86
|
+
search,
|
|
87
|
+
hash
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Returns true if this component is a descendant of a `<Router>`.
|
|
93
|
+
*
|
|
94
|
+
* @see https://reactrouter.com/hooks/use-in-router-context
|
|
95
|
+
*/
|
|
96
|
+
function useInRouterContext() {
|
|
97
|
+
return React.useContext(LocationContext) != null;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Returns the current location object, which represents the current URL in web
|
|
102
|
+
* browsers.
|
|
103
|
+
*
|
|
104
|
+
* Note: If you're using this it may mean you're doing some of your own
|
|
105
|
+
* "routing" in your app, and we'd like to know what your use case is. We may
|
|
106
|
+
* be able to provide something higher-level to better suit your needs.
|
|
107
|
+
*
|
|
108
|
+
* @see https://reactrouter.com/hooks/use-location
|
|
109
|
+
*/
|
|
110
|
+
function useLocation() {
|
|
111
|
+
!useInRouterContext() ? invariant(false) : void 0;
|
|
112
|
+
return React.useContext(LocationContext).location;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// Mute warnings for calls to useNavigate in SSR environments
|
|
116
|
+
function useIsomorphicLayoutEffect(cb) {
|
|
117
|
+
let isStatic = React.useContext(NavigationContext).static;
|
|
118
|
+
if (!isStatic) {
|
|
119
|
+
// We should be able to get rid of this once react 18.3 is released
|
|
120
|
+
// See: https://github.com/facebook/react/pull/26395
|
|
121
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
122
|
+
React.useLayoutEffect(cb);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Returns an imperative method for changing the location. Used by `<Link>`s, but
|
|
128
|
+
* may also be used by other elements to change the location.
|
|
129
|
+
*
|
|
130
|
+
* @see https://reactrouter.com/hooks/use-navigate
|
|
131
|
+
*/
|
|
132
|
+
function useNavigate() {
|
|
133
|
+
let {
|
|
134
|
+
isDataRoute
|
|
135
|
+
} = React.useContext(RouteContext);
|
|
136
|
+
// Conditional usage is OK here because the usage of a data router is static
|
|
137
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
138
|
+
return isDataRoute ? useNavigateStable() : useNavigateUnstable();
|
|
139
|
+
}
|
|
140
|
+
function useNavigateUnstable() {
|
|
141
|
+
!useInRouterContext() ? invariant(false) : void 0;
|
|
142
|
+
let dataRouterContext = React.useContext(DataRouterContext);
|
|
143
|
+
let {
|
|
144
|
+
basename,
|
|
145
|
+
future,
|
|
146
|
+
navigator
|
|
147
|
+
} = React.useContext(NavigationContext);
|
|
148
|
+
let {
|
|
149
|
+
matches
|
|
150
|
+
} = React.useContext(RouteContext);
|
|
151
|
+
let {
|
|
152
|
+
pathname: locationPathname
|
|
153
|
+
} = useLocation();
|
|
154
|
+
let routePathnamesJson = JSON.stringify(getResolveToMatches(matches, future.v7_relativeSplatPath));
|
|
155
|
+
let activeRef = React.useRef(false);
|
|
156
|
+
useIsomorphicLayoutEffect(() => {
|
|
157
|
+
activeRef.current = true;
|
|
158
|
+
});
|
|
159
|
+
let navigate = React.useCallback(function (to, options) {
|
|
160
|
+
if (options === void 0) {
|
|
161
|
+
options = {};
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// Short circuit here since if this happens on first render the navigate
|
|
165
|
+
// is useless because we haven't wired up our history listener yet
|
|
166
|
+
if (!activeRef.current) return;
|
|
167
|
+
if (typeof to === "number") {
|
|
168
|
+
navigator.go(to);
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
let path = resolveTo(to, JSON.parse(routePathnamesJson), locationPathname, options.relative === "path");
|
|
172
|
+
|
|
173
|
+
// If we're operating within a basename, prepend it to the pathname prior
|
|
174
|
+
// to handing off to history (but only if we're not in a data router,
|
|
175
|
+
// otherwise it'll prepend the basename inside of the router).
|
|
176
|
+
// If this is a root navigation, then we navigate to the raw basename
|
|
177
|
+
// which allows the basename to have full control over the presence of a
|
|
178
|
+
// trailing slash on root links
|
|
179
|
+
if (dataRouterContext == null && basename !== "/") {
|
|
180
|
+
path.pathname = path.pathname === "/" ? basename : joinPaths([basename, path.pathname]);
|
|
181
|
+
}
|
|
182
|
+
(!!options.replace ? navigator.replace : navigator.push)(path, options.state, options);
|
|
183
|
+
}, [basename, navigator, routePathnamesJson, locationPathname, dataRouterContext]);
|
|
184
|
+
return navigate;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Resolves the pathname of the given `to` value against the current location.
|
|
189
|
+
*
|
|
190
|
+
* @see https://reactrouter.com/hooks/use-resolved-path
|
|
191
|
+
*/
|
|
192
|
+
function useResolvedPath(to, _temp2) {
|
|
193
|
+
let {
|
|
194
|
+
relative
|
|
195
|
+
} = _temp2 === void 0 ? {} : _temp2;
|
|
196
|
+
let {
|
|
197
|
+
future
|
|
198
|
+
} = React.useContext(NavigationContext);
|
|
199
|
+
let {
|
|
200
|
+
matches
|
|
201
|
+
} = React.useContext(RouteContext);
|
|
202
|
+
let {
|
|
203
|
+
pathname: locationPathname
|
|
204
|
+
} = useLocation();
|
|
205
|
+
let routePathnamesJson = JSON.stringify(getResolveToMatches(matches, future.v7_relativeSplatPath));
|
|
206
|
+
return React.useMemo(() => resolveTo(to, JSON.parse(routePathnamesJson), locationPathname, relative === "path"), [to, routePathnamesJson, locationPathname, relative]);
|
|
207
|
+
}
|
|
208
|
+
var DataRouterHook = /*#__PURE__*/function (DataRouterHook) {
|
|
209
|
+
DataRouterHook["UseBlocker"] = "useBlocker";
|
|
210
|
+
DataRouterHook["UseRevalidator"] = "useRevalidator";
|
|
211
|
+
DataRouterHook["UseNavigateStable"] = "useNavigate";
|
|
212
|
+
return DataRouterHook;
|
|
213
|
+
}(DataRouterHook || {});
|
|
214
|
+
var DataRouterStateHook = /*#__PURE__*/function (DataRouterStateHook) {
|
|
215
|
+
DataRouterStateHook["UseBlocker"] = "useBlocker";
|
|
216
|
+
DataRouterStateHook["UseLoaderData"] = "useLoaderData";
|
|
217
|
+
DataRouterStateHook["UseActionData"] = "useActionData";
|
|
218
|
+
DataRouterStateHook["UseRouteError"] = "useRouteError";
|
|
219
|
+
DataRouterStateHook["UseNavigation"] = "useNavigation";
|
|
220
|
+
DataRouterStateHook["UseRouteLoaderData"] = "useRouteLoaderData";
|
|
221
|
+
DataRouterStateHook["UseMatches"] = "useMatches";
|
|
222
|
+
DataRouterStateHook["UseRevalidator"] = "useRevalidator";
|
|
223
|
+
DataRouterStateHook["UseNavigateStable"] = "useNavigate";
|
|
224
|
+
DataRouterStateHook["UseRouteId"] = "useRouteId";
|
|
225
|
+
return DataRouterStateHook;
|
|
226
|
+
}(DataRouterStateHook || {});
|
|
227
|
+
function useDataRouterContext(hookName) {
|
|
228
|
+
let ctx = React.useContext(DataRouterContext);
|
|
229
|
+
!ctx ? invariant(false) : void 0;
|
|
230
|
+
return ctx;
|
|
231
|
+
}
|
|
232
|
+
function useRouteContext(hookName) {
|
|
233
|
+
let route = React.useContext(RouteContext);
|
|
234
|
+
!route ? invariant(false) : void 0;
|
|
235
|
+
return route;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// Internal version with hookName-aware debugging
|
|
239
|
+
function useCurrentRouteId(hookName) {
|
|
240
|
+
let route = useRouteContext();
|
|
241
|
+
let thisRoute = route.matches[route.matches.length - 1];
|
|
242
|
+
!thisRoute.route.id ? invariant(false) : void 0;
|
|
243
|
+
return thisRoute.route.id;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Stable version of useNavigate that is used when we are in the context of
|
|
248
|
+
* a RouterProvider.
|
|
249
|
+
*/
|
|
250
|
+
function useNavigateStable() {
|
|
251
|
+
let {
|
|
252
|
+
router
|
|
253
|
+
} = useDataRouterContext(DataRouterHook.UseNavigateStable);
|
|
254
|
+
let id = useCurrentRouteId(DataRouterStateHook.UseNavigateStable);
|
|
255
|
+
let activeRef = React.useRef(false);
|
|
256
|
+
useIsomorphicLayoutEffect(() => {
|
|
257
|
+
activeRef.current = true;
|
|
258
|
+
});
|
|
259
|
+
let navigate = React.useCallback(function (to, options) {
|
|
260
|
+
if (options === void 0) {
|
|
261
|
+
options = {};
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
// Short circuit here since if this happens on first render the navigate
|
|
265
|
+
// is useless because we haven't wired up our router subscriber yet
|
|
266
|
+
if (!activeRef.current) return;
|
|
267
|
+
if (typeof to === "number") {
|
|
268
|
+
router.navigate(to);
|
|
269
|
+
} else {
|
|
270
|
+
router.navigate(to, _extends({
|
|
271
|
+
fromRouteId: id
|
|
272
|
+
}, options));
|
|
273
|
+
}
|
|
274
|
+
}, [router, id]);
|
|
275
|
+
return navigate;
|
|
276
|
+
}
|
|
277
|
+
new Promise(() => {});
|
|
278
|
+
|
|
279
|
+
export { DataRouterContext as UNSAFE_DataRouterContext, LocationContext as UNSAFE_LocationContext, NavigationContext as UNSAFE_NavigationContext, RouteContext as UNSAFE_RouteContext, useHref, useInRouterContext, useLocation, useNavigate, useResolvedPath };
|
|
280
|
+
//# sourceMappingURL=index.js.map
|