@lumx/react 3.0.2-alpha-react-utils.2 → 3.0.2-alpha-react-utils.3
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/_internal/{6340c129.js → ClickAwayProvider.js} +107 -2
- package/_internal/ClickAwayProvider.js.map +1 -0
- package/_internal/{eca6d4dc.d.ts → types.d.ts} +1 -1
- package/index.d.ts +2627 -56
- package/index.js +12438 -56
- package/index.js.map +1 -1
- package/package.json +4 -4
- package/utils/index.d.ts +1 -1
- package/utils/index.js +1 -1
- package/_internal/0062d1bc.js +0 -220
- package/_internal/0062d1bc.js.map +0 -1
- package/_internal/03e8323d.d.ts +0 -118
- package/_internal/0402f9bc.d.ts +0 -183
- package/_internal/0b370acc.js +0 -796
- package/_internal/0b370acc.js.map +0 -1
- package/_internal/0d154d73.d.ts +0 -67
- package/_internal/113e3b40.d.ts +0 -31
- package/_internal/12ab39e4.js +0 -58
- package/_internal/12ab39e4.js.map +0 -1
- package/_internal/13e759f3.js +0 -343
- package/_internal/13e759f3.js.map +0 -1
- package/_internal/158b46d5.js +0 -151
- package/_internal/158b46d5.js.map +0 -1
- package/_internal/17b74e16.d.ts +0 -31
- package/_internal/1b1530a4.d.ts +0 -43
- package/_internal/20976405.js +0 -87
- package/_internal/20976405.js.map +0 -1
- package/_internal/20b0e9a5.d.ts +0 -77
- package/_internal/26cd9c63.js +0 -118
- package/_internal/26cd9c63.js.map +0 -1
- package/_internal/27f21164.js +0 -79
- package/_internal/27f21164.js.map +0 -1
- package/_internal/288dfd0f.js +0 -13
- package/_internal/288dfd0f.js.map +0 -1
- package/_internal/28aaf23a.d.ts +0 -41
- package/_internal/2c829c0b.d.ts +0 -57
- package/_internal/2cc0aec5.js +0 -86
- package/_internal/2cc0aec5.js.map +0 -1
- package/_internal/2d0a5b28.js +0 -23
- package/_internal/2d0a5b28.js.map +0 -1
- package/_internal/2d4b5a5e.d.ts +0 -92
- package/_internal/2d770113.d.ts +0 -38
- package/_internal/2fe97f00.js +0 -291
- package/_internal/2fe97f00.js.map +0 -1
- package/_internal/31c16fa0.d.ts +0 -37
- package/_internal/329a01d3.js +0 -25
- package/_internal/329a01d3.js.map +0 -1
- package/_internal/3326e990.js +0 -168
- package/_internal/3326e990.js.map +0 -1
- package/_internal/377b2f44.js +0 -70
- package/_internal/377b2f44.js.map +0 -1
- package/_internal/3b8d2a6e.js +0 -124
- package/_internal/3b8d2a6e.js.map +0 -1
- package/_internal/3bd3186e.d.ts +0 -57
- package/_internal/48e40868.js +0 -101
- package/_internal/48e40868.js.map +0 -1
- package/_internal/490ec1da.js +0 -322
- package/_internal/490ec1da.js.map +0 -1
- package/_internal/49127d69.d.ts +0 -52
- package/_internal/4dcd87cb.js +0 -78
- package/_internal/4dcd87cb.js.map +0 -1
- package/_internal/4f44d848.js +0 -157
- package/_internal/4f44d848.js.map +0 -1
- package/_internal/4fc64a2e.js +0 -27
- package/_internal/4fc64a2e.js.map +0 -1
- package/_internal/53a831be.js +0 -108
- package/_internal/53a831be.js.map +0 -1
- package/_internal/55271fa1.d.ts +0 -34
- package/_internal/55d30377.d.ts +0 -22
- package/_internal/56385b04.js +0 -116
- package/_internal/56385b04.js.map +0 -1
- package/_internal/599e250a.d.ts +0 -88
- package/_internal/5a054691.d.ts +0 -33
- package/_internal/5a127b58.js +0 -82
- package/_internal/5a127b58.js.map +0 -1
- package/_internal/5a1c0db4.js +0 -156
- package/_internal/5a1c0db4.js.map +0 -1
- package/_internal/5babcc39.js +0 -147
- package/_internal/5babcc39.js.map +0 -1
- package/_internal/5c1bf4d4.d.ts +0 -81
- package/_internal/5d8ed4ee.js +0 -113
- package/_internal/5d8ed4ee.js.map +0 -1
- package/_internal/616f2912.js +0 -301
- package/_internal/616f2912.js.map +0 -1
- package/_internal/61f915de.d.ts +0 -49
- package/_internal/620081fa.js +0 -122
- package/_internal/620081fa.js.map +0 -1
- package/_internal/6340c129.js.map +0 -1
- package/_internal/6581c863.d.ts +0 -34
- package/_internal/66de4d45.d.ts +0 -32
- package/_internal/6735c5c8.d.ts +0 -62
- package/_internal/69dd1472.js +0 -112
- package/_internal/69dd1472.js.map +0 -1
- package/_internal/6a0e1c77.js +0 -327
- package/_internal/6a0e1c77.js.map +0 -1
- package/_internal/701c20b0.d.ts +0 -24
- package/_internal/7391188a.js +0 -81
- package/_internal/7391188a.js.map +0 -1
- package/_internal/74cb6c26.js +0 -136
- package/_internal/74cb6c26.js.map +0 -1
- package/_internal/761031bf.js +0 -314
- package/_internal/761031bf.js.map +0 -1
- package/_internal/76fed69d.js +0 -50
- package/_internal/76fed69d.js.map +0 -1
- package/_internal/78ef8e34.js +0 -40
- package/_internal/78ef8e34.js.map +0 -1
- package/_internal/7b906e16.d.ts +0 -17
- package/_internal/7be11ddc.d.ts +0 -35
- package/_internal/7d39705e.d.ts +0 -20
- package/_internal/7e03266f.js +0 -47
- package/_internal/7e03266f.js.map +0 -1
- package/_internal/7e8d0ac5.js +0 -84
- package/_internal/7e8d0ac5.js.map +0 -1
- package/_internal/7ffa45f6.js +0 -48
- package/_internal/7ffa45f6.js.map +0 -1
- package/_internal/84c1ec44.js +0 -257
- package/_internal/84c1ec44.js.map +0 -1
- package/_internal/8518279f.js +0 -96
- package/_internal/8518279f.js.map +0 -1
- package/_internal/853713cd.js +0 -25
- package/_internal/853713cd.js.map +0 -1
- package/_internal/86566d75.d.ts +0 -27
- package/_internal/86d22dde.d.ts +0 -57
- package/_internal/8e755ded.d.ts +0 -101
- package/_internal/901471f5.d.ts +0 -37
- package/_internal/935ce959.d.ts +0 -49
- package/_internal/97089888.d.ts +0 -16
- package/_internal/97cc728c.d.ts +0 -26
- package/_internal/9ab3c637.js +0 -2474
- package/_internal/9ab3c637.js.map +0 -1
- package/_internal/9ca3f59c.js +0 -60
- package/_internal/9ca3f59c.js.map +0 -1
- package/_internal/9e95ea38.d.ts +0 -43
- package/_internal/a0108f92.js +0 -84
- package/_internal/a0108f92.js.map +0 -1
- package/_internal/a493a193.d.ts +0 -65
- package/_internal/a521723d.js +0 -120
- package/_internal/a521723d.js.map +0 -1
- package/_internal/a6fad025.d.ts +0 -107
- package/_internal/a8fa525f.js +0 -124
- package/_internal/a8fa525f.js.map +0 -1
- package/_internal/aca2ecf5.js +0 -141
- package/_internal/aca2ecf5.js.map +0 -1
- package/_internal/aef2ef1c.js +0 -53
- package/_internal/aef2ef1c.js.map +0 -1
- package/_internal/af048b0c.js +0 -89
- package/_internal/af048b0c.js.map +0 -1
- package/_internal/af2cd0cd.d.ts +0 -17
- package/_internal/afec6b62.js +0 -864
- package/_internal/afec6b62.js.map +0 -1
- package/_internal/b0eb3a30.js +0 -72
- package/_internal/b0eb3a30.js.map +0 -1
- package/_internal/b89517ea.js +0 -275
- package/_internal/b89517ea.js.map +0 -1
- package/_internal/bafa6fcc.js +0 -116
- package/_internal/bafa6fcc.js.map +0 -1
- package/_internal/bbbeb49e.js +0 -47
- package/_internal/bbbeb49e.js.map +0 -1
- package/_internal/c11f6162.d.ts +0 -52
- package/_internal/c723dab4.js +0 -133
- package/_internal/c723dab4.js.map +0 -1
- package/_internal/c87cc857.d.ts +0 -42
- package/_internal/c97f8d04.js +0 -424
- package/_internal/c97f8d04.js.map +0 -1
- package/_internal/cbb373ea.d.ts +0 -6
- package/_internal/cbef23b6.d.ts +0 -104
- package/_internal/cdf77f06.d.ts +0 -88
- package/_internal/d350f2ff.js +0 -105
- package/_internal/d350f2ff.js.map +0 -1
- package/_internal/d71a8cf7.js +0 -54
- package/_internal/d71a8cf7.js.map +0 -1
- package/_internal/d9337952.js +0 -96
- package/_internal/d9337952.js.map +0 -1
- package/_internal/def14e1a.d.ts +0 -24
- package/_internal/e0cd29c7.d.ts +0 -35
- package/_internal/e354228f.js +0 -145
- package/_internal/e354228f.js.map +0 -1
- package/_internal/e3922a05.d.ts +0 -22
- package/_internal/e3cb6177.d.ts +0 -75
- package/_internal/e810c841.d.ts +0 -182
- package/_internal/ea700b01.d.ts +0 -43
- package/_internal/eed07003.js +0 -122
- package/_internal/eed07003.js.map +0 -1
- package/_internal/f1c9b334.d.ts +0 -22
- package/_internal/f3c3a674.js +0 -281
- package/_internal/f3c3a674.js.map +0 -1
- package/_internal/f571cdcd.js +0 -132
- package/_internal/f571cdcd.js.map +0 -1
- package/_internal/f5bdff7e.js +0 -282
- package/_internal/f5bdff7e.js.map +0 -1
- package/_internal/f851fc00.d.ts +0 -34
- package/_internal/f859b007.d.ts +0 -49
- package/_internal/fb384b79.d.ts +0 -38
- package/_internal/fc4c034b.js +0 -63
- package/_internal/fc4c034b.js.map +0 -1
- package/_internal/fc608bd9.js +0 -16
- package/_internal/fc608bd9.js.map +0 -1
- package/_internal/fd1f4d68.d.ts +0 -36
- package/_internal/fd867c9d.js +0 -346
- package/_internal/fd867c9d.js.map +0 -1
- package/_internal/ff8081e5.js +0 -57
- package/_internal/ff8081e5.js.map +0 -1
- package/_internal/ffd1bfe3.js +0 -123
- package/_internal/ffd1bfe3.js.map +0 -1
- package/components/alert-dialog.d.ts +0 -6
- package/components/alert-dialog.js +0 -2
- package/components/alert-dialog.js.map +0 -1
- package/components/autocomplete.d.ts +0 -8
- package/components/autocomplete.js +0 -2
- package/components/autocomplete.js.map +0 -1
- package/components/avatar.d.ts +0 -4
- package/components/avatar.js +0 -2
- package/components/avatar.js.map +0 -1
- package/components/badge.d.ts +0 -3
- package/components/badge.js +0 -2
- package/components/badge.js.map +0 -1
- package/components/button.d.ts +0 -8
- package/components/button.js +0 -4
- package/components/button.js.map +0 -1
- package/components/checkbox.d.ts +0 -3
- package/components/checkbox.js +0 -2
- package/components/checkbox.js.map +0 -1
- package/components/chip.d.ts +0 -3
- package/components/chip.js +0 -3
- package/components/chip.js.map +0 -1
- package/components/comment-block.d.ts +0 -5
- package/components/comment-block.js +0 -2
- package/components/comment-block.js.map +0 -1
- package/components/date-picker.d.ts +0 -7
- package/components/date-picker.js +0 -2
- package/components/date-picker.js.map +0 -1
- package/components/dialog.d.ts +0 -3
- package/components/dialog.js +0 -2
- package/components/dialog.js.map +0 -1
- package/components/divider.d.ts +0 -3
- package/components/divider.js +0 -2
- package/components/divider.js.map +0 -1
- package/components/drag-handle.d.ts +0 -3
- package/components/drag-handle.js +0 -2
- package/components/drag-handle.js.map +0 -1
- package/components/dropdown.d.ts +0 -4
- package/components/dropdown.js +0 -2
- package/components/dropdown.js.map +0 -1
- package/components/expansion-panel.d.ts +0 -7
- package/components/expansion-panel.js +0 -2
- package/components/expansion-panel.js.map +0 -1
- package/components/flag.d.ts +0 -3
- package/components/flag.js +0 -2
- package/components/flag.js.map +0 -1
- package/components/flex-box.d.ts +0 -3
- package/components/flex-box.js +0 -2
- package/components/flex-box.js.map +0 -1
- package/components/generic-block.d.ts +0 -4
- package/components/generic-block.js +0 -2
- package/components/generic-block.js.map +0 -1
- package/components/grid.d.ts +0 -3
- package/components/grid.js +0 -2
- package/components/grid.js.map +0 -1
- package/components/heading.d.ts +0 -4
- package/components/heading.js +0 -2
- package/components/heading.js.map +0 -1
- package/components/icon.d.ts +0 -3
- package/components/icon.js +0 -2
- package/components/icon.js.map +0 -1
- package/components/image-block.d.ts +0 -4
- package/components/image-block.js +0 -2
- package/components/image-block.js.map +0 -1
- package/components/input-helper.d.ts +0 -3
- package/components/input-helper.js +0 -2
- package/components/input-helper.js.map +0 -1
- package/components/input-label.d.ts +0 -3
- package/components/input-label.js +0 -2
- package/components/input-label.js.map +0 -1
- package/components/lightbox.d.ts +0 -7
- package/components/lightbox.js +0 -2
- package/components/lightbox.js.map +0 -1
- package/components/link-preview.d.ts +0 -5
- package/components/link-preview.js +0 -2
- package/components/link-preview.js.map +0 -1
- package/components/link.d.ts +0 -3
- package/components/link.js +0 -2
- package/components/link.js.map +0 -1
- package/components/list.d.ts +0 -3
- package/components/list.js +0 -3
- package/components/list.js.map +0 -1
- package/components/message.d.ts +0 -3
- package/components/message.js +0 -2
- package/components/message.js.map +0 -1
- package/components/mosaic.d.ts +0 -4
- package/components/mosaic.js +0 -2
- package/components/mosaic.js.map +0 -1
- package/components/notification.d.ts +0 -3
- package/components/notification.js +0 -2
- package/components/notification.js.map +0 -1
- package/components/popover.d.ts +0 -3
- package/components/popover.js +0 -2
- package/components/popover.js.map +0 -1
- package/components/post-block.d.ts +0 -4
- package/components/post-block.js +0 -2
- package/components/post-block.js.map +0 -1
- package/components/progress-tracker.d.ts +0 -3
- package/components/progress-tracker.js +0 -2
- package/components/progress-tracker.js.map +0 -1
- package/components/progress.d.ts +0 -3
- package/components/progress.js +0 -2
- package/components/progress.js.map +0 -1
- package/components/radio-button.d.ts +0 -3
- package/components/radio-button.js +0 -2
- package/components/radio-button.js.map +0 -1
- package/components/select.d.ts +0 -7
- package/components/select.js +0 -2
- package/components/select.js.map +0 -1
- package/components/side-navigation.d.ts +0 -7
- package/components/side-navigation.js +0 -2
- package/components/side-navigation.js.map +0 -1
- package/components/skeleton.d.ts +0 -3
- package/components/skeleton.js +0 -2
- package/components/skeleton.js.map +0 -1
- package/components/slider.d.ts +0 -3
- package/components/slider.js +0 -2
- package/components/slider.js.map +0 -1
- package/components/slideshow.d.ts +0 -7
- package/components/slideshow.js +0 -2
- package/components/slideshow.js.map +0 -1
- package/components/switch.d.ts +0 -3
- package/components/switch.js +0 -2
- package/components/switch.js.map +0 -1
- package/components/table.d.ts +0 -3
- package/components/table.js +0 -2
- package/components/table.js.map +0 -1
- package/components/tabs.d.ts +0 -4
- package/components/tabs.js +0 -2
- package/components/tabs.js.map +0 -1
- package/components/text-field.d.ts +0 -7
- package/components/text-field.js +0 -2
- package/components/text-field.js.map +0 -1
- package/components/text.d.ts +0 -3
- package/components/text.js +0 -2
- package/components/text.js.map +0 -1
- package/components/thumbnail.d.ts +0 -4
- package/components/thumbnail.js +0 -3
- package/components/thumbnail.js.map +0 -1
- package/components/toolbar.d.ts +0 -3
- package/components/toolbar.js +0 -2
- package/components/toolbar.js.map +0 -1
- package/components/tooltip.d.ts +0 -4
- package/components/tooltip.js +0 -2
- package/components/tooltip.js.map +0 -1
- package/components/uploader.d.ts +0 -3
- package/components/uploader.js +0 -2
- package/components/uploader.js.map +0 -1
- package/components/user-block.d.ts +0 -5
- package/components/user-block.js +0 -2
- package/components/user-block.js.map +0 -1
- package/components.d.ts +0 -2
- package/components.js +0 -156
- package/components.js.map +0 -1
package/package.json
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"@juggle/resize-observer": "^3.2.0",
|
|
10
|
-
"@lumx/core": "^3.0.2-alpha-react-utils.
|
|
11
|
-
"@lumx/icons": "^3.0.2-alpha-react-utils.
|
|
10
|
+
"@lumx/core": "^3.0.2-alpha-react-utils.3",
|
|
11
|
+
"@lumx/icons": "^3.0.2-alpha-react-utils.3",
|
|
12
12
|
"@popperjs/core": "^2.5.4",
|
|
13
13
|
"body-scroll-lock": "^3.1.5",
|
|
14
14
|
"classnames": "^2.2.6",
|
|
@@ -120,6 +120,6 @@
|
|
|
120
120
|
"build:storybook": "cd storybook && ./build"
|
|
121
121
|
},
|
|
122
122
|
"sideEffects": false,
|
|
123
|
-
"version": "3.0.2-alpha-react-utils.
|
|
124
|
-
"gitHead": "
|
|
123
|
+
"version": "3.0.2-alpha-react-utils.3",
|
|
124
|
+
"gitHead": "190431ec45dfcb8ee619060ca97eeda6a88a9db4"
|
|
125
125
|
}
|
package/utils/index.d.ts
CHANGED
package/utils/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { C as ClickAwayProvider } from '../_internal/
|
|
1
|
+
export { C as ClickAwayProvider } from '../_internal/ClickAwayProvider.js';
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/_internal/0062d1bc.js
DELETED
|
@@ -1,220 +0,0 @@
|
|
|
1
|
-
import { useEffect } from 'react';
|
|
2
|
-
|
|
3
|
-
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
|
|
4
|
-
|
|
5
|
-
// Older browsers don't support event options, feature detect it.
|
|
6
|
-
|
|
7
|
-
// Adopted and modified solution from Bohdan Didukh (2017)
|
|
8
|
-
// https://stackoverflow.com/questions/41594997/ios-10-safari-prevent-scrolling-behind-a-fixed-overlay-and-maintain-scroll-posi
|
|
9
|
-
|
|
10
|
-
var hasPassiveEvents = false;
|
|
11
|
-
if (typeof window !== 'undefined') {
|
|
12
|
-
var passiveTestOptions = {
|
|
13
|
-
get passive() {
|
|
14
|
-
hasPassiveEvents = true;
|
|
15
|
-
return undefined;
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
window.addEventListener('testPassive', null, passiveTestOptions);
|
|
19
|
-
window.removeEventListener('testPassive', null, passiveTestOptions);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
var isIosDevice = typeof window !== 'undefined' && window.navigator && window.navigator.platform && (/iP(ad|hone|od)/.test(window.navigator.platform) || window.navigator.platform === 'MacIntel' && window.navigator.maxTouchPoints > 1);
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
var locks = [];
|
|
26
|
-
var documentListenerAdded = false;
|
|
27
|
-
var initialClientY = -1;
|
|
28
|
-
var previousBodyOverflowSetting = void 0;
|
|
29
|
-
var previousBodyPaddingRight = void 0;
|
|
30
|
-
|
|
31
|
-
// returns true if `el` should be allowed to receive touchmove events.
|
|
32
|
-
var allowTouchMove = function allowTouchMove(el) {
|
|
33
|
-
return locks.some(function (lock) {
|
|
34
|
-
if (lock.options.allowTouchMove && lock.options.allowTouchMove(el)) {
|
|
35
|
-
return true;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
return false;
|
|
39
|
-
});
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
var preventDefault = function preventDefault(rawEvent) {
|
|
43
|
-
var e = rawEvent || window.event;
|
|
44
|
-
|
|
45
|
-
// For the case whereby consumers adds a touchmove event listener to document.
|
|
46
|
-
// Recall that we do document.addEventListener('touchmove', preventDefault, { passive: false })
|
|
47
|
-
// in disableBodyScroll - so if we provide this opportunity to allowTouchMove, then
|
|
48
|
-
// the touchmove event on document will break.
|
|
49
|
-
if (allowTouchMove(e.target)) {
|
|
50
|
-
return true;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// Do not prevent if the event has more than one touch (usually meaning this is a multi touch gesture like pinch to zoom).
|
|
54
|
-
if (e.touches.length > 1) return true;
|
|
55
|
-
|
|
56
|
-
if (e.preventDefault) e.preventDefault();
|
|
57
|
-
|
|
58
|
-
return false;
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
var setOverflowHidden = function setOverflowHidden(options) {
|
|
62
|
-
// If previousBodyPaddingRight is already set, don't set it again.
|
|
63
|
-
if (previousBodyPaddingRight === undefined) {
|
|
64
|
-
var _reserveScrollBarGap = !!options && options.reserveScrollBarGap === true;
|
|
65
|
-
var scrollBarGap = window.innerWidth - document.documentElement.clientWidth;
|
|
66
|
-
|
|
67
|
-
if (_reserveScrollBarGap && scrollBarGap > 0) {
|
|
68
|
-
previousBodyPaddingRight = document.body.style.paddingRight;
|
|
69
|
-
document.body.style.paddingRight = scrollBarGap + 'px';
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// If previousBodyOverflowSetting is already set, don't set it again.
|
|
74
|
-
if (previousBodyOverflowSetting === undefined) {
|
|
75
|
-
previousBodyOverflowSetting = document.body.style.overflow;
|
|
76
|
-
document.body.style.overflow = 'hidden';
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
var restoreOverflowSetting = function restoreOverflowSetting() {
|
|
81
|
-
if (previousBodyPaddingRight !== undefined) {
|
|
82
|
-
document.body.style.paddingRight = previousBodyPaddingRight;
|
|
83
|
-
|
|
84
|
-
// Restore previousBodyPaddingRight to undefined so setOverflowHidden knows it
|
|
85
|
-
// can be set again.
|
|
86
|
-
previousBodyPaddingRight = undefined;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
if (previousBodyOverflowSetting !== undefined) {
|
|
90
|
-
document.body.style.overflow = previousBodyOverflowSetting;
|
|
91
|
-
|
|
92
|
-
// Restore previousBodyOverflowSetting to undefined
|
|
93
|
-
// so setOverflowHidden knows it can be set again.
|
|
94
|
-
previousBodyOverflowSetting = undefined;
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
// https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollHeight#Problems_and_solutions
|
|
99
|
-
var isTargetElementTotallyScrolled = function isTargetElementTotallyScrolled(targetElement) {
|
|
100
|
-
return targetElement ? targetElement.scrollHeight - targetElement.scrollTop <= targetElement.clientHeight : false;
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
var handleScroll = function handleScroll(event, targetElement) {
|
|
104
|
-
var clientY = event.targetTouches[0].clientY - initialClientY;
|
|
105
|
-
|
|
106
|
-
if (allowTouchMove(event.target)) {
|
|
107
|
-
return false;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
if (targetElement && targetElement.scrollTop === 0 && clientY > 0) {
|
|
111
|
-
// element is at the top of its scroll.
|
|
112
|
-
return preventDefault(event);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
if (isTargetElementTotallyScrolled(targetElement) && clientY < 0) {
|
|
116
|
-
// element is at the bottom of its scroll.
|
|
117
|
-
return preventDefault(event);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
event.stopPropagation();
|
|
121
|
-
return true;
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
var disableBodyScroll = function disableBodyScroll(targetElement, options) {
|
|
125
|
-
// targetElement must be provided
|
|
126
|
-
if (!targetElement) {
|
|
127
|
-
// eslint-disable-next-line no-console
|
|
128
|
-
console.error('disableBodyScroll unsuccessful - targetElement must be provided when calling disableBodyScroll on IOS devices.');
|
|
129
|
-
return;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
// disableBodyScroll must not have been called on this targetElement before
|
|
133
|
-
if (locks.some(function (lock) {
|
|
134
|
-
return lock.targetElement === targetElement;
|
|
135
|
-
})) {
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
var lock = {
|
|
140
|
-
targetElement: targetElement,
|
|
141
|
-
options: options || {}
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
locks = [].concat(_toConsumableArray(locks), [lock]);
|
|
145
|
-
|
|
146
|
-
if (isIosDevice) {
|
|
147
|
-
targetElement.ontouchstart = function (event) {
|
|
148
|
-
if (event.targetTouches.length === 1) {
|
|
149
|
-
// detect single touch.
|
|
150
|
-
initialClientY = event.targetTouches[0].clientY;
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
targetElement.ontouchmove = function (event) {
|
|
154
|
-
if (event.targetTouches.length === 1) {
|
|
155
|
-
// detect single touch.
|
|
156
|
-
handleScroll(event, targetElement);
|
|
157
|
-
}
|
|
158
|
-
};
|
|
159
|
-
|
|
160
|
-
if (!documentListenerAdded) {
|
|
161
|
-
document.addEventListener('touchmove', preventDefault, hasPassiveEvents ? { passive: false } : undefined);
|
|
162
|
-
documentListenerAdded = true;
|
|
163
|
-
}
|
|
164
|
-
} else {
|
|
165
|
-
setOverflowHidden(options);
|
|
166
|
-
}
|
|
167
|
-
};
|
|
168
|
-
|
|
169
|
-
var enableBodyScroll = function enableBodyScroll(targetElement) {
|
|
170
|
-
if (!targetElement) {
|
|
171
|
-
// eslint-disable-next-line no-console
|
|
172
|
-
console.error('enableBodyScroll unsuccessful - targetElement must be provided when calling enableBodyScroll on IOS devices.');
|
|
173
|
-
return;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
locks = locks.filter(function (lock) {
|
|
177
|
-
return lock.targetElement !== targetElement;
|
|
178
|
-
});
|
|
179
|
-
|
|
180
|
-
if (isIosDevice) {
|
|
181
|
-
targetElement.ontouchstart = null;
|
|
182
|
-
targetElement.ontouchmove = null;
|
|
183
|
-
|
|
184
|
-
if (documentListenerAdded && locks.length === 0) {
|
|
185
|
-
document.removeEventListener('touchmove', preventDefault, hasPassiveEvents ? { passive: false } : undefined);
|
|
186
|
-
documentListenerAdded = false;
|
|
187
|
-
}
|
|
188
|
-
} else if (!locks.length) {
|
|
189
|
-
restoreOverflowSetting();
|
|
190
|
-
}
|
|
191
|
-
};
|
|
192
|
-
|
|
193
|
-
/**
|
|
194
|
-
* Disables the scroll on the body to make it only usable in the current modal element.
|
|
195
|
-
* When the modal element is not provided anymore, the scroll is restored.
|
|
196
|
-
*
|
|
197
|
-
* @param modalElement The modal element.
|
|
198
|
-
*/
|
|
199
|
-
var useDisableBodyScroll = function useDisableBodyScroll(modalElement) {
|
|
200
|
-
useEffect(function () {
|
|
201
|
-
if (!modalElement) {
|
|
202
|
-
return undefined;
|
|
203
|
-
} // Fixing the document overflow style to prevent a bug that scrolls the window to the top.
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
var previousDocumentOverflow = document.documentElement.style.overflow;
|
|
207
|
-
document.documentElement.style.overflow = 'visible';
|
|
208
|
-
disableBodyScroll(modalElement);
|
|
209
|
-
return function () {
|
|
210
|
-
enableBodyScroll(modalElement); // Restore the previous overflow style.
|
|
211
|
-
|
|
212
|
-
requestAnimationFrame(function () {
|
|
213
|
-
document.documentElement.style.overflow = previousDocumentOverflow;
|
|
214
|
-
});
|
|
215
|
-
};
|
|
216
|
-
}, [modalElement]);
|
|
217
|
-
};
|
|
218
|
-
|
|
219
|
-
export { useDisableBodyScroll as u };
|
|
220
|
-
//# sourceMappingURL=0062d1bc.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"0062d1bc.js","sources":["../../../../node_modules/body-scroll-lock/lib/bodyScrollLock.esm.js","../../src/hooks/useDisableBodyScroll.ts"],"sourcesContent":["function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }\n\n// Older browsers don't support event options, feature detect it.\n\n// Adopted and modified solution from Bohdan Didukh (2017)\n// https://stackoverflow.com/questions/41594997/ios-10-safari-prevent-scrolling-behind-a-fixed-overlay-and-maintain-scroll-posi\n\nvar hasPassiveEvents = false;\nif (typeof window !== 'undefined') {\n var passiveTestOptions = {\n get passive() {\n hasPassiveEvents = true;\n return undefined;\n }\n };\n window.addEventListener('testPassive', null, passiveTestOptions);\n window.removeEventListener('testPassive', null, passiveTestOptions);\n}\n\nvar isIosDevice = typeof window !== 'undefined' && window.navigator && window.navigator.platform && (/iP(ad|hone|od)/.test(window.navigator.platform) || window.navigator.platform === 'MacIntel' && window.navigator.maxTouchPoints > 1);\n\n\nvar locks = [];\nvar documentListenerAdded = false;\nvar initialClientY = -1;\nvar previousBodyOverflowSetting = void 0;\nvar previousBodyPaddingRight = void 0;\n\n// returns true if `el` should be allowed to receive touchmove events.\nvar allowTouchMove = function allowTouchMove(el) {\n return locks.some(function (lock) {\n if (lock.options.allowTouchMove && lock.options.allowTouchMove(el)) {\n return true;\n }\n\n return false;\n });\n};\n\nvar preventDefault = function preventDefault(rawEvent) {\n var e = rawEvent || window.event;\n\n // For the case whereby consumers adds a touchmove event listener to document.\n // Recall that we do document.addEventListener('touchmove', preventDefault, { passive: false })\n // in disableBodyScroll - so if we provide this opportunity to allowTouchMove, then\n // the touchmove event on document will break.\n if (allowTouchMove(e.target)) {\n return true;\n }\n\n // Do not prevent if the event has more than one touch (usually meaning this is a multi touch gesture like pinch to zoom).\n if (e.touches.length > 1) return true;\n\n if (e.preventDefault) e.preventDefault();\n\n return false;\n};\n\nvar setOverflowHidden = function setOverflowHidden(options) {\n // If previousBodyPaddingRight is already set, don't set it again.\n if (previousBodyPaddingRight === undefined) {\n var _reserveScrollBarGap = !!options && options.reserveScrollBarGap === true;\n var scrollBarGap = window.innerWidth - document.documentElement.clientWidth;\n\n if (_reserveScrollBarGap && scrollBarGap > 0) {\n previousBodyPaddingRight = document.body.style.paddingRight;\n document.body.style.paddingRight = scrollBarGap + 'px';\n }\n }\n\n // If previousBodyOverflowSetting is already set, don't set it again.\n if (previousBodyOverflowSetting === undefined) {\n previousBodyOverflowSetting = document.body.style.overflow;\n document.body.style.overflow = 'hidden';\n }\n};\n\nvar restoreOverflowSetting = function restoreOverflowSetting() {\n if (previousBodyPaddingRight !== undefined) {\n document.body.style.paddingRight = previousBodyPaddingRight;\n\n // Restore previousBodyPaddingRight to undefined so setOverflowHidden knows it\n // can be set again.\n previousBodyPaddingRight = undefined;\n }\n\n if (previousBodyOverflowSetting !== undefined) {\n document.body.style.overflow = previousBodyOverflowSetting;\n\n // Restore previousBodyOverflowSetting to undefined\n // so setOverflowHidden knows it can be set again.\n previousBodyOverflowSetting = undefined;\n }\n};\n\n// https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollHeight#Problems_and_solutions\nvar isTargetElementTotallyScrolled = function isTargetElementTotallyScrolled(targetElement) {\n return targetElement ? targetElement.scrollHeight - targetElement.scrollTop <= targetElement.clientHeight : false;\n};\n\nvar handleScroll = function handleScroll(event, targetElement) {\n var clientY = event.targetTouches[0].clientY - initialClientY;\n\n if (allowTouchMove(event.target)) {\n return false;\n }\n\n if (targetElement && targetElement.scrollTop === 0 && clientY > 0) {\n // element is at the top of its scroll.\n return preventDefault(event);\n }\n\n if (isTargetElementTotallyScrolled(targetElement) && clientY < 0) {\n // element is at the bottom of its scroll.\n return preventDefault(event);\n }\n\n event.stopPropagation();\n return true;\n};\n\nexport var disableBodyScroll = function disableBodyScroll(targetElement, options) {\n // targetElement must be provided\n if (!targetElement) {\n // eslint-disable-next-line no-console\n console.error('disableBodyScroll unsuccessful - targetElement must be provided when calling disableBodyScroll on IOS devices.');\n return;\n }\n\n // disableBodyScroll must not have been called on this targetElement before\n if (locks.some(function (lock) {\n return lock.targetElement === targetElement;\n })) {\n return;\n }\n\n var lock = {\n targetElement: targetElement,\n options: options || {}\n };\n\n locks = [].concat(_toConsumableArray(locks), [lock]);\n\n if (isIosDevice) {\n targetElement.ontouchstart = function (event) {\n if (event.targetTouches.length === 1) {\n // detect single touch.\n initialClientY = event.targetTouches[0].clientY;\n }\n };\n targetElement.ontouchmove = function (event) {\n if (event.targetTouches.length === 1) {\n // detect single touch.\n handleScroll(event, targetElement);\n }\n };\n\n if (!documentListenerAdded) {\n document.addEventListener('touchmove', preventDefault, hasPassiveEvents ? { passive: false } : undefined);\n documentListenerAdded = true;\n }\n } else {\n setOverflowHidden(options);\n }\n};\n\nexport var clearAllBodyScrollLocks = function clearAllBodyScrollLocks() {\n if (isIosDevice) {\n // Clear all locks ontouchstart/ontouchmove handlers, and the references.\n locks.forEach(function (lock) {\n lock.targetElement.ontouchstart = null;\n lock.targetElement.ontouchmove = null;\n });\n\n if (documentListenerAdded) {\n document.removeEventListener('touchmove', preventDefault, hasPassiveEvents ? { passive: false } : undefined);\n documentListenerAdded = false;\n }\n\n // Reset initial clientY.\n initialClientY = -1;\n } else {\n restoreOverflowSetting();\n }\n\n locks = [];\n};\n\nexport var enableBodyScroll = function enableBodyScroll(targetElement) {\n if (!targetElement) {\n // eslint-disable-next-line no-console\n console.error('enableBodyScroll unsuccessful - targetElement must be provided when calling enableBodyScroll on IOS devices.');\n return;\n }\n\n locks = locks.filter(function (lock) {\n return lock.targetElement !== targetElement;\n });\n\n if (isIosDevice) {\n targetElement.ontouchstart = null;\n targetElement.ontouchmove = null;\n\n if (documentListenerAdded && locks.length === 0) {\n document.removeEventListener('touchmove', preventDefault, hasPassiveEvents ? { passive: false } : undefined);\n documentListenerAdded = false;\n }\n } else if (!locks.length) {\n restoreOverflowSetting();\n }\n};\n\n","import { useEffect } from 'react';\nimport { disableBodyScroll, enableBodyScroll } from 'body-scroll-lock';\nimport { Falsy } from '@lumx/react/utils/type';\n\n/**\n * Disables the scroll on the body to make it only usable in the current modal element.\n * When the modal element is not provided anymore, the scroll is restored.\n *\n * @param modalElement The modal element.\n */\nexport const useDisableBodyScroll = (modalElement: Element | Falsy): void => {\n useEffect(() => {\n if (!modalElement) {\n return undefined;\n }\n // Fixing the document overflow style to prevent a bug that scrolls the window to the top.\n const previousDocumentOverflow = document.documentElement.style.overflow;\n document.documentElement.style.overflow = 'visible';\n disableBodyScroll(modalElement);\n return () => {\n enableBodyScroll(modalElement);\n // Restore the previous overflow style.\n requestAnimationFrame(() => {\n document.documentElement.style.overflow = previousDocumentOverflow;\n });\n };\n }, [modalElement]);\n};\n"],"names":["useDisableBodyScroll","modalElement","useEffect","undefined","previousDocumentOverflow","document","documentElement","style","overflow","disableBodyScroll","enableBodyScroll","requestAnimationFrame"],"mappings":";;AAAA,SAAS,kBAAkB,CAAC,GAAG,EAAE,EAAE,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,EAAE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,IAAI,CAAC,EAAE,MAAM,EAAE,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE;AACnM;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,gBAAgB,GAAG,KAAK,CAAC;AAC7B,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;AACnC,EAAE,IAAI,kBAAkB,GAAG;AAC3B,IAAI,IAAI,OAAO,GAAG;AAClB,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAC9B,MAAM,OAAO,SAAS,CAAC;AACvB,KAAK;AACL,GAAG,CAAC;AACJ,EAAE,MAAM,CAAC,gBAAgB,CAAC,aAAa,EAAE,IAAI,EAAE,kBAAkB,CAAC,CAAC;AACnE,EAAE,MAAM,CAAC,mBAAmB,CAAC,aAAa,EAAE,IAAI,EAAE,kBAAkB,CAAC,CAAC;AACtE,CAAC;AACD;AACA,IAAI,WAAW,GAAG,OAAO,MAAM,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,CAA+BC,QAA/B,GAA0CJ,wBAA1C;AACH,OAFoB,CAArB;AAGH,KAND;AAOH,GAfQ,EAeN,CAACH,YAAD,CAfM,CAAT;AAgBH;;;;"}
|
package/_internal/03e8323d.d.ts
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import React, { RefObject, SetStateAction, ReactNode, Key, SyntheticEvent, Ref } from 'react';
|
|
2
|
-
import { l as GenericProps, S as Size, k as Comp } from './eca6d4dc.js';
|
|
3
|
-
|
|
4
|
-
declare type Listener = (evt: KeyboardEvent) => void;
|
|
5
|
-
interface UseKeyboardListNavigationType {
|
|
6
|
-
/** the current active index */
|
|
7
|
-
activeItemIndex: number;
|
|
8
|
-
/** callback to be used when a key is pressed. usually used with the native prop `onKeyDown` */
|
|
9
|
-
onKeyboardNavigation: Listener;
|
|
10
|
-
/** Resets the active index to the initial state */
|
|
11
|
-
resetActiveIndex(): void;
|
|
12
|
-
/** Sets the active index to a given value */
|
|
13
|
-
setActiveItemIndex(value: SetStateAction<number>): void;
|
|
14
|
-
}
|
|
15
|
-
declare type useKeyboardListNavigationType = <I>(items: I[], ref: RefObject<HTMLElement>, onListItemSelected: (itemSelected: I) => void, onListItemNavigated?: (itemSelected: I) => void, onEnterPressed?: (itemSelected: string) => void, onBackspacePressed?: Listener, keepFocusAfterSelection?: boolean, initialIndex?: number, preventTabOnEnteredValue?: boolean) => UseKeyboardListNavigationType;
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Defines the props of the component.
|
|
19
|
-
*/
|
|
20
|
-
interface ListProps extends GenericProps {
|
|
21
|
-
/** List content (should be ListItem, ListSubheader or ListDivider). */
|
|
22
|
-
children: ReactNode;
|
|
23
|
-
/**
|
|
24
|
-
* Whether the list items are clickable.
|
|
25
|
-
* @deprecated not needed anymore.
|
|
26
|
-
*/
|
|
27
|
-
isClickable?: boolean;
|
|
28
|
-
/** Item padding size. */
|
|
29
|
-
itemPadding?: Extract<Size, 'big' | 'huge'>;
|
|
30
|
-
/** Tab index of the list. Default to -1 */
|
|
31
|
-
tabIndex?: number;
|
|
32
|
-
/**
|
|
33
|
-
* On list item selected callback.
|
|
34
|
-
*
|
|
35
|
-
* @param key React key of the selected item.
|
|
36
|
-
* @param index Index of the selected item among the sibling items.
|
|
37
|
-
* @param evt Source event (either mouse or keyboard event).
|
|
38
|
-
*/
|
|
39
|
-
onListItemSelected?(key: Key, index: number, evt: SyntheticEvent): void;
|
|
40
|
-
}
|
|
41
|
-
declare const List: Comp<ListProps, HTMLUListElement> & {
|
|
42
|
-
useKeyboardListNavigation: useKeyboardListNavigationType;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
declare type ListItemSize = Extract<Size, 'tiny' | 'regular' | 'big' | 'huge'>;
|
|
46
|
-
/**
|
|
47
|
-
* Defines the props of the component.
|
|
48
|
-
*/
|
|
49
|
-
interface ListItemProps extends GenericProps {
|
|
50
|
-
/** A component to be rendered after the content. */
|
|
51
|
-
after?: ReactNode;
|
|
52
|
-
/** A component to be rendered before the content. */
|
|
53
|
-
before?: ReactNode;
|
|
54
|
-
/** Content. */
|
|
55
|
-
children: string | ReactNode;
|
|
56
|
-
/** Whether the list item should be highlighted or not. */
|
|
57
|
-
isHighlighted?: boolean;
|
|
58
|
-
/** Whether the component is selected or not. */
|
|
59
|
-
isSelected?: boolean;
|
|
60
|
-
/** Whether link/button is disabled or not. */
|
|
61
|
-
isDisabled?: boolean;
|
|
62
|
-
/** Reference to the <li> element. */
|
|
63
|
-
listItemRef?: Ref<HTMLLIElement>;
|
|
64
|
-
/** Custom react component for the link (can be used to inject react router Link). */
|
|
65
|
-
linkAs?: 'a' | any;
|
|
66
|
-
/** Props that will be passed on to the Link */
|
|
67
|
-
linkProps?: React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>;
|
|
68
|
-
/** Reference to the link element. */
|
|
69
|
-
linkRef?: Ref<HTMLAnchorElement>;
|
|
70
|
-
/** Size variant. */
|
|
71
|
-
size?: ListItemSize;
|
|
72
|
-
/** On selected callback. */
|
|
73
|
-
onItemSelected?(evt: SyntheticEvent): void;
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Check if the list item is clickable.
|
|
77
|
-
* @return `true` if the list item is clickable; `false` otherwise.
|
|
78
|
-
*/
|
|
79
|
-
declare function isClickable({ linkProps, onItemSelected }: Partial<ListItemProps>): boolean;
|
|
80
|
-
/**
|
|
81
|
-
* ListItem component.
|
|
82
|
-
*
|
|
83
|
-
* @param props Component props.
|
|
84
|
-
* @param ref Component ref.
|
|
85
|
-
* @return React element.
|
|
86
|
-
*/
|
|
87
|
-
declare const ListItem: Comp<ListItemProps, HTMLLIElement>;
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Defines the props of the component.
|
|
91
|
-
*/
|
|
92
|
-
declare type ListDividerProps = GenericProps;
|
|
93
|
-
/**
|
|
94
|
-
* ListDivider component.
|
|
95
|
-
*
|
|
96
|
-
* @param props Component props.
|
|
97
|
-
* @param ref Component ref.
|
|
98
|
-
* @return React element.
|
|
99
|
-
*/
|
|
100
|
-
declare const ListDivider: Comp<ListDividerProps, HTMLLIElement>;
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Defines the props of the component.
|
|
104
|
-
*/
|
|
105
|
-
interface ListSubheaderProps extends GenericProps {
|
|
106
|
-
/** Content. */
|
|
107
|
-
children: string | ReactNode;
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* ListSubheader component.
|
|
111
|
-
*
|
|
112
|
-
* @param props Component props.
|
|
113
|
-
* @param ref Component ref.
|
|
114
|
-
* @return React element.
|
|
115
|
-
*/
|
|
116
|
-
declare const ListSubheader: Comp<ListSubheaderProps, HTMLLIElement>;
|
|
117
|
-
|
|
118
|
-
export { ListProps as L, List as a, ListItemSize as b, ListItemProps as c, ListItem as d, ListDividerProps as e, ListDivider as f, ListSubheaderProps as g, ListSubheader as h, isClickable as i };
|
package/_internal/0402f9bc.d.ts
DELETED
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
import React, { RefObject } from 'react';
|
|
2
|
-
import { l as GenericProps, k as Comp, m as HasTheme } from './eca6d4dc.js';
|
|
3
|
-
import { I as IconButtonProps } from './2d770113.js';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Defines the props of the component.
|
|
7
|
-
*/
|
|
8
|
-
interface SlideshowProps extends GenericProps, Pick<SlidesProps, 'autoPlay' | 'slidesId' | 'id' | 'theme' | 'fillHeight' | 'groupBy' | 'slideGroupLabel'> {
|
|
9
|
-
/** current slide active */
|
|
10
|
-
activeIndex?: SlidesProps['activeIndex'];
|
|
11
|
-
/** Interval between each slide when automatic rotation is enabled. */
|
|
12
|
-
interval?: number;
|
|
13
|
-
/** Props to pass to the slideshow controls (minus those already set by the Slideshow props). */
|
|
14
|
-
slideshowControlsProps?: Pick<SlideshowControlsProps, 'nextButtonProps' | 'previousButtonProps' | 'paginationItemProps'> & Omit<SlideshowControlsProps, 'activeIndex' | 'onPaginationClick' | 'onNextClick' | 'onPreviousClick' | 'slidesCount' | 'parentRef' | 'theme'>;
|
|
15
|
-
/** Callback when slide changes */
|
|
16
|
-
onChange?(index: number): void;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Slideshow component.
|
|
20
|
-
*
|
|
21
|
-
* @param props Component props.
|
|
22
|
-
* @param ref Component ref.
|
|
23
|
-
* @return React element.
|
|
24
|
-
*/
|
|
25
|
-
declare const Slideshow: Comp<SlideshowProps, HTMLDivElement>;
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Defines the props of the component.
|
|
29
|
-
*/
|
|
30
|
-
interface SlideshowItemProps extends GenericProps {
|
|
31
|
-
/** interval in which slides are automatically shown */
|
|
32
|
-
interval?: number;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* SlideshowItem component.
|
|
36
|
-
*
|
|
37
|
-
* @param props Component props.
|
|
38
|
-
* @param ref Component ref.
|
|
39
|
-
* @return React element.
|
|
40
|
-
*/
|
|
41
|
-
declare const SlideshowItem: Comp<SlideshowItemProps, HTMLDivElement>;
|
|
42
|
-
|
|
43
|
-
interface UseSlideshowControlsOptions {
|
|
44
|
-
/** default active index to be displayed */
|
|
45
|
-
defaultActiveIndex?: number;
|
|
46
|
-
/** total slides to display */
|
|
47
|
-
itemsCount: number;
|
|
48
|
-
/** Index of the current slide. */
|
|
49
|
-
activeIndex?: number;
|
|
50
|
-
/** Whether the automatic rotation of the slideshow is enabled or not. */
|
|
51
|
-
autoPlay?: boolean;
|
|
52
|
-
/** Whether the image has to fill its container height or not. */
|
|
53
|
-
fillHeight?: boolean;
|
|
54
|
-
/** Number of slides to group together. */
|
|
55
|
-
groupBy?: number;
|
|
56
|
-
/** Interval between each slide when automatic rotation is enabled. */
|
|
57
|
-
interval?: number;
|
|
58
|
-
/** Callback when slide changes */
|
|
59
|
-
onChange?(index: number): void;
|
|
60
|
-
/** slideshow HTML id attribute */
|
|
61
|
-
id?: string;
|
|
62
|
-
/** slides wrapper HTML id attribute */
|
|
63
|
-
slidesId?: string;
|
|
64
|
-
}
|
|
65
|
-
interface UseSlideshowControls {
|
|
66
|
-
/** Index for the first visible slide, should be used when groupBy is passed in */
|
|
67
|
-
startIndexVisible: number;
|
|
68
|
-
/** Index for the last visible slide, should be used when groupBy is passed in */
|
|
69
|
-
endIndexVisible: number;
|
|
70
|
-
/** total slides to be displayed */
|
|
71
|
-
slidesCount: number;
|
|
72
|
-
/** callback to set */
|
|
73
|
-
setSlideshow: (element: HTMLDivElement | null) => void;
|
|
74
|
-
/** reference to the slideshow element */
|
|
75
|
-
slideshow: HTMLDivElement | null;
|
|
76
|
-
/** id to be used for the slideshow */
|
|
77
|
-
slideshowId: string;
|
|
78
|
-
/** id to be used for the wrapper that contains the slides */
|
|
79
|
-
slideshowSlidesId: string;
|
|
80
|
-
/** callback that triggers the previous slide while using the slideshow controls */
|
|
81
|
-
onPreviousClick: (loopback: boolean) => void;
|
|
82
|
-
/** callback that triggers the next slide while using the slideshow controls */
|
|
83
|
-
onNextClick: (loopback: boolean) => void;
|
|
84
|
-
/** callback that triggers a specific page while using the slideshow controls */
|
|
85
|
-
onPaginationClick: (index: number) => void;
|
|
86
|
-
/** whether the slideshow is autoplaying or not */
|
|
87
|
-
isAutoPlaying: boolean;
|
|
88
|
-
/** whether the slideshow was force paused or not */
|
|
89
|
-
isForcePaused: boolean;
|
|
90
|
-
/** callback to change whether the slideshow is autoplaying or not */
|
|
91
|
-
toggleAutoPlay: () => void;
|
|
92
|
-
/** calback to change whether the slideshow should be force paused or not */
|
|
93
|
-
toggleForcePause: () => void;
|
|
94
|
-
/** current active slide index */
|
|
95
|
-
activeIndex: number;
|
|
96
|
-
/** set the current index as the active one */
|
|
97
|
-
setActiveIndex: (index: number) => void;
|
|
98
|
-
/** callback that stops the auto play */
|
|
99
|
-
stopAutoPlay: () => void;
|
|
100
|
-
/** callback that starts the auto play */
|
|
101
|
-
startAutoPlay: () => void;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* Defines the props of the component.
|
|
106
|
-
*/
|
|
107
|
-
interface SlideshowControlsProps extends GenericProps, HasTheme {
|
|
108
|
-
/** Index of the current slide. */
|
|
109
|
-
activeIndex?: number;
|
|
110
|
-
/** Props to pass to the next button (minus those already set by the SlideshowControls props). */
|
|
111
|
-
nextButtonProps: Pick<IconButtonProps, 'label'> & Omit<IconButtonProps, 'label' | 'onClick' | 'icon' | 'emphasis' | 'color'>;
|
|
112
|
-
/** Reference to the parent element on which we want to listen touch swipe. */
|
|
113
|
-
parentRef?: RefObject<HTMLDivElement> | HTMLDivElement | null;
|
|
114
|
-
/** Props to pass to the previous button (minus those already set by the SlideshowControls props). */
|
|
115
|
-
previousButtonProps: Pick<IconButtonProps, 'label'> & Omit<IconButtonProps, 'label' | 'onClick' | 'icon' | 'emphasis' | 'color'>;
|
|
116
|
-
/** Props to pass to the pagination wrapper */
|
|
117
|
-
paginationProps?: Omit<React.HTMLAttributes<HTMLDivElement>, 'className' | 'style' | 'role'>;
|
|
118
|
-
/** Number of slides. */
|
|
119
|
-
slidesCount: number;
|
|
120
|
-
/** On next button click callback. */
|
|
121
|
-
onNextClick?(loopback?: boolean): void;
|
|
122
|
-
/** On pagination change callback. */
|
|
123
|
-
onPaginationClick?(index: number): void;
|
|
124
|
-
/** On previous button click callback. */
|
|
125
|
-
onPreviousClick?(loopback?: boolean): void;
|
|
126
|
-
/** whether the slideshow is currently playing */
|
|
127
|
-
isAutoPlaying?: boolean;
|
|
128
|
-
/**
|
|
129
|
-
* function to be executed in order to retrieve the label for the pagination item
|
|
130
|
-
* @deprecated Use paginationItemProps instead.
|
|
131
|
-
* */
|
|
132
|
-
paginationItemLabel?: (index: number) => string;
|
|
133
|
-
/**
|
|
134
|
-
* function to be executed in order to retrieve the props for a pagination item.
|
|
135
|
-
*/
|
|
136
|
-
paginationItemProps?: (itemIndex: number) => React.HTMLAttributes<HTMLButtonElement> & {
|
|
137
|
-
label?: string;
|
|
138
|
-
};
|
|
139
|
-
/** Props to pass to the lay button (minus those already set by the SlideshowControls props). */
|
|
140
|
-
playButtonProps?: Pick<IconButtonProps, 'label'> & Omit<IconButtonProps, 'label' | 'onClick' | 'icon' | 'emphasis' | 'color'>;
|
|
141
|
-
}
|
|
142
|
-
declare const SlideshowControls: Comp<SlideshowControlsProps, HTMLDivElement> & {
|
|
143
|
-
useSlideshowControls: ({ activeIndex, groupBy, interval, autoPlay, defaultActiveIndex, onChange, itemsCount, id, slidesId, }: UseSlideshowControlsOptions) => UseSlideshowControls;
|
|
144
|
-
useSlideshowControlsDefaultOptions: Partial<UseSlideshowControlsOptions>;
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
interface SlidesProps extends GenericProps, HasTheme {
|
|
148
|
-
/** current slide active */
|
|
149
|
-
activeIndex: number;
|
|
150
|
-
/** slides id to be added to the wrapper */
|
|
151
|
-
id?: string;
|
|
152
|
-
/** Whether the automatic rotation of the slideshow is enabled or not. */
|
|
153
|
-
autoPlay?: boolean;
|
|
154
|
-
/** Whether the image has to fill its container height or not. */
|
|
155
|
-
fillHeight?: boolean;
|
|
156
|
-
/** Number of slides to group together. */
|
|
157
|
-
groupBy?: number;
|
|
158
|
-
/** whether the slides are currently playing or not */
|
|
159
|
-
isAutoPlaying?: boolean;
|
|
160
|
-
/** id to be passed in into the slides */
|
|
161
|
-
slidesId?: string;
|
|
162
|
-
/** callback to change whether the slideshow is playing or not */
|
|
163
|
-
toggleAutoPlay: () => void;
|
|
164
|
-
/** component to be rendered after the slides */
|
|
165
|
-
afterSlides?: React.ReactNode;
|
|
166
|
-
/** Whether the slides have controls linked */
|
|
167
|
-
hasControls?: boolean;
|
|
168
|
-
/**
|
|
169
|
-
* Accessible label to set on a slide group.
|
|
170
|
-
* Receives the group position starting from 1 and the total number of groups.
|
|
171
|
-
* */
|
|
172
|
-
slideGroupLabel?: (groupPosition: number, groupTotal: number) => string;
|
|
173
|
-
}
|
|
174
|
-
/**
|
|
175
|
-
* Slides component.
|
|
176
|
-
*
|
|
177
|
-
* @param props Component props.
|
|
178
|
-
* @param ref Component ref.
|
|
179
|
-
* @return React element.
|
|
180
|
-
*/
|
|
181
|
-
declare const Slides: Comp<SlidesProps, HTMLDivElement>;
|
|
182
|
-
|
|
183
|
-
export { SlideshowProps as S, Slideshow as a, SlideshowItemProps as b, SlideshowItem as c, SlideshowControlsProps as d, SlideshowControls as e, SlidesProps as f, Slides as g };
|