@lumx/react 2.2.2 → 2.2.3-alpha-export-hook1
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/esm/_internal/AlertDialog.js +1 -1
- package/esm/_internal/AutocompleteMultiple.js.map +1 -1
- package/esm/_internal/ButtonGroup.js +0 -4
- package/esm/_internal/ButtonGroup.js.map +1 -1
- package/esm/_internal/Checkbox2.js +6 -4
- package/esm/_internal/Checkbox2.js.map +1 -1
- package/esm/_internal/Chip2.js +2 -1
- package/esm/_internal/Chip2.js.map +1 -1
- package/esm/_internal/ChipGroup.js.map +1 -1
- package/esm/_internal/ClickAwayProvider.js +1 -1
- package/esm/_internal/ClickAwayProvider.js.map +1 -1
- package/esm/_internal/DatePickerField.js +0 -4
- package/esm/_internal/DatePickerField.js.map +1 -1
- package/esm/_internal/Dialog2.js.map +1 -1
- package/esm/_internal/Dropdown2.js +1 -1
- package/esm/_internal/Dropdown2.js.map +1 -1
- package/esm/_internal/IconButton.js +0 -4
- package/esm/_internal/IconButton.js.map +1 -1
- package/esm/_internal/Lightbox2.js.map +1 -1
- package/esm/_internal/List2.js +20 -4
- package/esm/_internal/List2.js.map +1 -1
- package/esm/_internal/Notification2.js.map +1 -1
- package/esm/_internal/Popover2.js.map +1 -1
- package/esm/_internal/ProgressTrackerStepPanel.js.map +1 -1
- package/esm/_internal/RadioGroup.js +1 -1
- package/esm/_internal/SelectMultiple.js +1 -1
- package/esm/_internal/SelectMultiple.js.map +1 -1
- package/esm/_internal/SideNavigationItem.js +2 -1
- package/esm/_internal/SideNavigationItem.js.map +1 -1
- package/esm/_internal/Slider2.js +1 -1
- package/esm/_internal/Slider2.js.map +1 -1
- package/esm/_internal/SlideshowControls.js +100 -2
- package/esm/_internal/SlideshowControls.js.map +1 -1
- package/esm/_internal/Switch2.js +6 -4
- package/esm/_internal/Switch2.js.map +1 -1
- package/esm/_internal/TabPanel.js.map +1 -1
- package/esm/_internal/TableRow.js +2 -1
- package/esm/_internal/TableRow.js.map +1 -1
- package/esm/_internal/TextField.js +1 -1
- package/esm/_internal/Tooltip2.js +12 -145
- package/esm/_internal/Tooltip2.js.map +1 -1
- package/esm/_internal/alert-dialog.js +3 -3
- package/esm/_internal/autocomplete.js +6 -5
- package/esm/_internal/autocomplete.js.map +1 -1
- package/esm/_internal/avatar.js +1 -2
- package/esm/_internal/avatar.js.map +1 -1
- package/esm/_internal/badge.js +1 -2
- package/esm/_internal/badge.js.map +1 -1
- package/esm/_internal/button.js +4 -4
- package/esm/_internal/checkbox.js +2 -3
- package/esm/_internal/checkbox.js.map +1 -1
- package/esm/_internal/chip.js +2 -2
- package/esm/_internal/comment-block.js +1 -2
- package/esm/_internal/comment-block.js.map +1 -1
- package/esm/_internal/constants.js.map +1 -1
- package/esm/_internal/date-picker.js +4 -4
- package/esm/_internal/dialog.js +2 -2
- package/esm/_internal/divider.js +1 -2
- package/esm/_internal/divider.js.map +1 -1
- package/esm/_internal/drag-handle.js +1 -2
- package/esm/_internal/drag-handle.js.map +1 -1
- package/esm/_internal/dropdown.js +4 -3
- package/esm/_internal/dropdown.js.map +1 -1
- package/esm/_internal/expansion-panel.js +4 -4
- package/esm/_internal/flag.js +1 -2
- package/esm/_internal/flag.js.map +1 -1
- package/esm/_internal/flex-box.js +1 -2
- package/esm/_internal/flex-box.js.map +1 -1
- package/esm/_internal/getRootClassName.js +40 -166
- package/esm/_internal/getRootClassName.js.map +1 -1
- package/esm/_internal/grid.js +1 -2
- package/esm/_internal/grid.js.map +1 -1
- package/esm/_internal/icon.js +1 -2
- package/esm/_internal/icon.js.map +1 -1
- package/esm/_internal/image-block.js +1 -2
- package/esm/_internal/image-block.js.map +1 -1
- package/esm/{index2.js → _internal/index.js} +1 -1
- package/esm/_internal/index.js.map +1 -0
- package/esm/_internal/input-helper.js +1 -2
- package/esm/_internal/input-helper.js.map +1 -1
- package/esm/_internal/input-label.js +1 -2
- package/esm/_internal/input-label.js.map +1 -1
- package/esm/_internal/lightbox.js +4 -4
- package/esm/_internal/link-preview.js +1 -2
- package/esm/_internal/link-preview.js.map +1 -1
- package/esm/_internal/link.js +1 -2
- package/esm/_internal/link.js.map +1 -1
- package/esm/_internal/list.js +3 -3
- package/esm/_internal/message.js +1 -2
- package/esm/_internal/message.js.map +1 -1
- package/esm/_internal/mosaic.js +1 -2
- package/esm/_internal/mosaic.js.map +1 -1
- package/esm/_internal/notification.js +1 -2
- package/esm/_internal/notification.js.map +1 -1
- package/esm/_internal/onEnterPressed.js +20 -0
- package/esm/_internal/onEnterPressed.js.map +1 -0
- package/esm/_internal/onEscapePressed.js +20 -0
- package/esm/_internal/onEscapePressed.js.map +1 -0
- package/esm/_internal/popover.js +2 -2
- package/esm/_internal/post-block.js +1 -2
- package/esm/_internal/post-block.js.map +1 -1
- package/esm/_internal/progress-tracker.js +2 -3
- package/esm/_internal/progress-tracker.js.map +1 -1
- package/esm/_internal/progress.js +1 -2
- package/esm/_internal/progress.js.map +1 -1
- package/esm/_internal/radio-button.js +2 -3
- package/esm/_internal/radio-button.js.map +1 -1
- package/esm/_internal/select.js +6 -5
- package/esm/_internal/select.js.map +1 -1
- package/esm/_internal/side-navigation.js +5 -4
- package/esm/_internal/side-navigation.js.map +1 -1
- package/esm/_internal/skeleton.js +1 -2
- package/esm/_internal/skeleton.js.map +1 -1
- package/esm/_internal/slider.js +2 -3
- package/esm/_internal/slider.js.map +1 -1
- package/esm/_internal/slideshow.js +6 -5
- package/esm/_internal/slideshow.js.map +1 -1
- package/esm/_internal/switch.js +2 -3
- package/esm/_internal/switch.js.map +1 -1
- package/esm/_internal/table.js +2 -2
- package/esm/_internal/tabs.js +2 -3
- package/esm/_internal/tabs.js.map +1 -1
- package/esm/_internal/text-field.js +4 -4
- package/esm/_internal/thumbnail.js +1 -2
- package/esm/_internal/thumbnail.js.map +1 -1
- package/esm/_internal/toolbar.js +1 -2
- package/esm/_internal/toolbar.js.map +1 -1
- package/esm/_internal/tooltip.js +4 -4
- package/esm/_internal/uploader.js +1 -2
- package/esm/_internal/uploader.js.map +1 -1
- package/esm/_internal/useDelayedVisibility.js.map +1 -1
- package/esm/_internal/useDisableBodyScroll.js.map +1 -1
- package/esm/_internal/useFocusTrap.js.map +1 -1
- package/esm/_internal/useRovingTabIndex.js +1 -1
- package/esm/_internal/useRovingTabIndex.js.map +1 -1
- package/esm/_internal/user-block.js +1 -2
- package/esm/_internal/user-block.js.map +1 -1
- package/esm/hooks/useOpenHoverOrLongPress.js +172 -0
- package/esm/hooks/useOpenHoverOrLongPress.js.map +1 -0
- package/esm/index.js +8 -6
- package/esm/index.js.map +1 -1
- package/package.json +4 -4
- package/src/{hooks → _internal/hooks}/useBooleanState.tsx +0 -0
- package/src/{hooks → _internal/hooks}/useCallbackOnEscape.ts +0 -0
- package/src/{hooks → _internal/hooks}/useChipGroupNavigation.tsx +0 -0
- package/src/{hooks → _internal/hooks}/useClickAway.tsx +0 -0
- package/src/{hooks → _internal/hooks}/useDelayedVisibility.tsx +0 -0
- package/src/{hooks → _internal/hooks}/useDisableBodyScroll.ts +0 -0
- package/src/{hooks → _internal/hooks}/useEventCallback.tsx +0 -0
- package/src/{hooks → _internal/hooks}/useFocus.tsx +0 -0
- package/src/{hooks → _internal/hooks}/useFocusTrap.ts +0 -0
- package/src/{hooks → _internal/hooks}/useInfiniteScroll.tsx +0 -0
- package/src/{hooks → _internal/hooks}/useIntersectionObserver.tsx +0 -0
- package/src/{hooks → _internal/hooks}/useInterval.tsx +1 -1
- package/src/{hooks → _internal/hooks}/useKeyboardListNavigation.tsx +0 -0
- package/src/{hooks → _internal/hooks}/useListenFocus.tsx +0 -0
- package/src/{hooks → _internal/hooks}/useOnResize.ts +0 -0
- package/src/{hooks → _internal/hooks}/useRovingTabIndex.tsx +0 -0
- package/src/{hooks → _internal/hooks}/useStopPropagation.ts +0 -0
- package/src/components/autocomplete/Autocomplete.tsx +1 -1
- package/src/components/button/__snapshots__/IconButton.test.tsx.snap +0 -5
- package/src/components/checkbox/Checkbox.test.tsx +14 -0
- package/src/components/checkbox/Checkbox.tsx +5 -1
- package/src/components/checkbox/__snapshots__/Checkbox.test.tsx.snap +51 -0
- package/src/components/chip/Chip.tsx +1 -1
- package/src/components/chip/ChipGroup.tsx +1 -1
- package/src/components/date-picker/DatePickerField.tsx +2 -2
- package/src/components/dialog/Dialog.test.tsx +1 -1
- package/src/components/dialog/Dialog.tsx +5 -5
- package/src/components/dropdown/Dropdown.tsx +1 -1
- package/src/components/lightbox/Lightbox.tsx +4 -4
- package/src/components/list/List.tsx +1 -1
- package/src/components/mosaic/Mosaic.test.tsx +1 -1
- package/src/components/notification/Notification.tsx +1 -1
- package/src/components/popover/Popover.tsx +2 -2
- package/src/components/progress-tracker/ProgressTracker.tsx +1 -1
- package/src/components/select/Select.stories.tsx +1 -1
- package/src/components/select/SelectMultiple.stories.tsx +1 -1
- package/src/components/select/WithSelectContext.tsx +1 -1
- package/src/components/slider/Slider.tsx +1 -1
- package/src/components/slideshow/Slideshow.tsx +1 -1
- package/src/components/slideshow/useSwipeNavigate.ts +1 -1
- package/src/components/switch/Switch.test.tsx +10 -0
- package/src/components/switch/Switch.tsx +5 -1
- package/src/components/switch/__snapshots__/Switch.test.tsx.snap +30 -0
- package/src/components/tabs/TabList.tsx +4 -4
- package/src/components/tooltip/Tooltip.tsx +7 -4
- package/src/constants.ts +7 -1
- package/src/hooks/useOpenHoverOrLongPress.ts +140 -0
- package/src/utils/ClickAwayProvider/ClickAwayProvider.tsx +1 -1
- package/src/utils/browserDoesNotSupportHover.test.js +24 -0
- package/src/utils/browserDoesNotSupportHover.ts +2 -0
- package/types.d.ts +6 -2
- package/esm/index2.js.map +0 -1
- package/src/components/tooltip/useTooltipOpen.tsx +0 -112
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { d as _slicedToArray } from '../_internal/_rollupPluginBabelHelpers.js';
|
|
2
|
+
import { useState, useEffect } from 'react';
|
|
3
|
+
import { o as onEscapePressed } from '../_internal/onEscapePressed.js';
|
|
4
|
+
|
|
5
|
+
/** Return true if the browser does not support pointer hover */
|
|
6
|
+
var browserDoesNotSupportHover = function browserDoesNotSupportHover() {
|
|
7
|
+
var _window$matchMedia, _window;
|
|
8
|
+
|
|
9
|
+
return !!((_window$matchMedia = (_window = window).matchMedia) === null || _window$matchMedia === void 0 ? void 0 : _window$matchMedia.call(_window, '(hover: none)').matches);
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
var DEFAULT_CONFIG = {
|
|
13
|
+
hover: {
|
|
14
|
+
openDelay: 500,
|
|
15
|
+
closeDelay: 0
|
|
16
|
+
},
|
|
17
|
+
longPress: {
|
|
18
|
+
openDelay: 250,
|
|
19
|
+
closeDelay: 3000
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Hook controlling an open/close action on hover on device supporting pointer hover
|
|
24
|
+
* and on long press on device not supporting pointer hover.
|
|
25
|
+
*
|
|
26
|
+
* @param anchorElement Anchor element on which the hover or longPress is watched.
|
|
27
|
+
* @param config Open/close delay configuration.
|
|
28
|
+
* @return true/false boolean.
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
function useOpenHoverOrLongPress(anchorElement) {
|
|
32
|
+
var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
33
|
+
|
|
34
|
+
var _useState = useState(false),
|
|
35
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
36
|
+
isOpen = _useState2[0],
|
|
37
|
+
setIsOpen = _useState2[1];
|
|
38
|
+
|
|
39
|
+
var activation = browserDoesNotSupportHover() ? 'longPress' : 'hover';
|
|
40
|
+
var _DEFAULT_CONFIG$activ = DEFAULT_CONFIG[activation],
|
|
41
|
+
defaultOpenDelay = _DEFAULT_CONFIG$activ.openDelay,
|
|
42
|
+
defaultCloseDelay = _DEFAULT_CONFIG$activ.closeDelay;
|
|
43
|
+
|
|
44
|
+
var _ref = (config === null || config === void 0 ? void 0 : config[activation]) || {},
|
|
45
|
+
_ref$openDelay = _ref.openDelay,
|
|
46
|
+
openDelay = _ref$openDelay === void 0 ? defaultOpenDelay : _ref$openDelay,
|
|
47
|
+
_ref$closeDelay = _ref.closeDelay,
|
|
48
|
+
closeDelay = _ref$closeDelay === void 0 ? defaultCloseDelay : _ref$closeDelay;
|
|
49
|
+
|
|
50
|
+
useEffect(function () {
|
|
51
|
+
if (!anchorElement) {
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
var timer;
|
|
56
|
+
var openStartTime;
|
|
57
|
+
var shouldOpen; // Run timer to defer updating the isOpen state.
|
|
58
|
+
|
|
59
|
+
var deferUpdate = function deferUpdate(duration) {
|
|
60
|
+
if (timer) clearTimeout(timer);
|
|
61
|
+
timer = setTimeout(function () {
|
|
62
|
+
setIsOpen(!!shouldOpen);
|
|
63
|
+
}, duration);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
var hasTouch = 'ontouchstart' in window; // Open (or/and cancel closing).
|
|
67
|
+
|
|
68
|
+
var open = function open() {
|
|
69
|
+
if (shouldOpen && !timer) return;
|
|
70
|
+
shouldOpen = true;
|
|
71
|
+
openStartTime = Date.now();
|
|
72
|
+
deferUpdate(openDelay);
|
|
73
|
+
}; // Close or cancel opening
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
var close = function close() {
|
|
77
|
+
var overrideDelay = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : closeDelay;
|
|
78
|
+
if (!shouldOpen && !timer) return;
|
|
79
|
+
shouldOpen = false;
|
|
80
|
+
deferUpdate(overrideDelay);
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
var closeImmediately = function closeImmediately() {
|
|
84
|
+
return close(0);
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* Handle touchend event
|
|
88
|
+
* If `touchend` comes before the open delay => cancel open (close immediate).
|
|
89
|
+
* Else if `touchend` comes after the open delay => open takes priority, the anchor's default touch end event is prevented.
|
|
90
|
+
*/
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
var touchEnd = function touchEnd(evt) {
|
|
94
|
+
if (!openStartTime) return;
|
|
95
|
+
|
|
96
|
+
if (Date.now() - openStartTime >= openDelay) {
|
|
97
|
+
// Tooltip take priority, event prevented.
|
|
98
|
+
evt.stopPropagation();
|
|
99
|
+
evt.preventDefault();
|
|
100
|
+
anchorElement.focus(); // Close with delay.
|
|
101
|
+
|
|
102
|
+
close();
|
|
103
|
+
} else {
|
|
104
|
+
// Close immediately.
|
|
105
|
+
closeImmediately();
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
var events = []; // Long press activation.
|
|
110
|
+
|
|
111
|
+
if (activation === 'longPress') {
|
|
112
|
+
events.push([anchorElement, hasTouch ? 'touchstart' : 'mousedown', open], [anchorElement, hasTouch ? 'touchend' : 'mouseup', touchEnd]);
|
|
113
|
+
} // Hover activation.
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
if (activation === 'hover') {
|
|
117
|
+
events.push([anchorElement, 'mouseenter', open], [anchorElement, 'mouseleave', close], [anchorElement, 'mouseup', closeImmediately]);
|
|
118
|
+
} // Events always applied no matter the browser:
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
events.push( // Open on focus.
|
|
122
|
+
[anchorElement, 'focusin', open], // Close on lost focus.
|
|
123
|
+
[anchorElement, 'focusout', closeImmediately], // Close on ESC keydown
|
|
124
|
+
[anchorElement, 'keydown', onEscapePressed(closeImmediately)]); // Attach events
|
|
125
|
+
|
|
126
|
+
for (var _i = 0, _events = events; _i < _events.length; _i++) {
|
|
127
|
+
var _events$_i = _slicedToArray(_events[_i], 3),
|
|
128
|
+
node = _events$_i[0],
|
|
129
|
+
eventType = _events$_i[1],
|
|
130
|
+
evenHandler = _events$_i[2];
|
|
131
|
+
|
|
132
|
+
node.addEventListener(eventType, evenHandler);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
return function () {
|
|
136
|
+
// Detach events.
|
|
137
|
+
var _iteratorNormalCompletion = true;
|
|
138
|
+
var _didIteratorError = false;
|
|
139
|
+
var _iteratorError = undefined;
|
|
140
|
+
|
|
141
|
+
try {
|
|
142
|
+
for (var _iterator = events[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
143
|
+
var _step$value = _slicedToArray(_step.value, 3),
|
|
144
|
+
node = _step$value[0],
|
|
145
|
+
eventType = _step$value[1],
|
|
146
|
+
evenHandler = _step$value[2];
|
|
147
|
+
|
|
148
|
+
node.removeEventListener(eventType, evenHandler);
|
|
149
|
+
}
|
|
150
|
+
} catch (err) {
|
|
151
|
+
_didIteratorError = true;
|
|
152
|
+
_iteratorError = err;
|
|
153
|
+
} finally {
|
|
154
|
+
try {
|
|
155
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
156
|
+
_iterator.return();
|
|
157
|
+
}
|
|
158
|
+
} finally {
|
|
159
|
+
if (_didIteratorError) {
|
|
160
|
+
throw _iteratorError;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
closeImmediately();
|
|
166
|
+
};
|
|
167
|
+
}, [activation, anchorElement, closeDelay, openDelay]);
|
|
168
|
+
return isOpen;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export { DEFAULT_CONFIG, useOpenHoverOrLongPress };
|
|
172
|
+
//# sourceMappingURL=useOpenHoverOrLongPress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useOpenHoverOrLongPress.js","sources":["../../../src/utils/browserDoesNotSupportHover.ts","../../../src/hooks/useOpenHoverOrLongPress.ts"],"sourcesContent":["/** Return true if the browser does not support pointer hover */\nexport const browserDoesNotSupportHover = (): boolean => !!window.matchMedia?.('(hover: none)').matches;\n","import { onEscapePressed } from '@lumx/react/utils';\nimport { useEffect, useState } from 'react';\nimport { browserDoesNotSupportHover } from '@lumx/react/utils/browserDoesNotSupportHover';\n\ninterface OpenCloseConfig {\n openDelay: number;\n closeDelay: number;\n}\n\ninterface Config {\n hover: OpenCloseConfig;\n longPress: OpenCloseConfig;\n}\n\nexport const DEFAULT_CONFIG: Config = {\n hover: {\n openDelay: 500,\n closeDelay: 0,\n },\n longPress: {\n openDelay: 250,\n closeDelay: 3000,\n },\n};\n\n/**\n * Hook controlling an open/close action on hover on device supporting pointer hover\n * and on long press on device not supporting pointer hover.\n *\n * @param anchorElement Anchor element on which the hover or longPress is watched.\n * @param config Open/close delay configuration.\n * @return true/false boolean.\n */\nexport function useOpenHoverOrLongPress(\n anchorElement: HTMLElement | null,\n config: { hover?: Partial<OpenCloseConfig>; longPress?: Partial<OpenCloseConfig> } = {},\n): boolean {\n const [isOpen, setIsOpen] = useState(false);\n const activation = browserDoesNotSupportHover() ? 'longPress' : 'hover';\n const { openDelay: defaultOpenDelay, closeDelay: defaultCloseDelay } = DEFAULT_CONFIG[activation];\n const { openDelay = defaultOpenDelay, closeDelay = defaultCloseDelay } = config?.[activation] || {};\n\n useEffect(() => {\n if (!anchorElement) {\n return undefined;\n }\n let timer: number | undefined;\n let openStartTime: number | undefined;\n let shouldOpen: boolean | undefined;\n\n // Run timer to defer updating the isOpen state.\n const deferUpdate = (duration: number) => {\n if (timer) clearTimeout(timer);\n timer = setTimeout(() => {\n setIsOpen(!!shouldOpen);\n }, duration) as any;\n };\n\n const hasTouch = 'ontouchstart' in window;\n\n // Open (or/and cancel closing).\n const open = () => {\n if (shouldOpen && !timer) return;\n shouldOpen = true;\n openStartTime = Date.now();\n deferUpdate(openDelay);\n };\n\n // Close or cancel opening\n const close = (overrideDelay = closeDelay) => {\n if (!shouldOpen && !timer) return;\n shouldOpen = false;\n deferUpdate(overrideDelay);\n };\n const closeImmediately = () => close(0);\n\n /**\n * Handle touchend event\n * If `touchend` comes before the open delay => cancel open (close immediate).\n * Else if `touchend` comes after the open delay => open takes priority, the anchor's default touch end event is prevented.\n */\n const touchEnd = (evt: Event) => {\n if (!openStartTime) return;\n if (Date.now() - openStartTime >= openDelay) {\n // Tooltip take priority, event prevented.\n evt.stopPropagation();\n evt.preventDefault();\n anchorElement.focus();\n // Close with delay.\n close();\n } else {\n // Close immediately.\n closeImmediately();\n }\n };\n\n const events: Array<[Node, Event['type'], any]> = [];\n\n // Long press activation.\n if (activation === 'longPress') {\n events.push(\n [anchorElement, hasTouch ? 'touchstart' : 'mousedown', open],\n [anchorElement, hasTouch ? 'touchend' : 'mouseup', touchEnd],\n );\n }\n\n // Hover activation.\n if (activation === 'hover') {\n events.push(\n [anchorElement, 'mouseenter', open],\n [anchorElement, 'mouseleave', close],\n [anchorElement, 'mouseup', closeImmediately],\n );\n }\n\n // Events always applied no matter the browser:\n events.push(\n // Open on focus.\n [anchorElement, 'focusin', open],\n // Close on lost focus.\n [anchorElement, 'focusout', closeImmediately],\n // Close on ESC keydown\n [anchorElement, 'keydown', onEscapePressed(closeImmediately)],\n );\n\n // Attach events\n for (const [node, eventType, evenHandler] of events) {\n node.addEventListener(eventType, evenHandler);\n }\n return () => {\n // Detach events.\n for (const [node, eventType, evenHandler] of events) {\n node.removeEventListener(eventType, evenHandler);\n }\n closeImmediately();\n };\n }, [activation, anchorElement, closeDelay, openDelay]);\n\n return isOpen;\n}\n"],"names":["browserDoesNotSupportHover","window","matchMedia","matches","DEFAULT_CONFIG","hover","openDelay","closeDelay","longPress","useOpenHoverOrLongPress","anchorElement","config","useState","isOpen","setIsOpen","activation","defaultOpenDelay","defaultCloseDelay","useEffect","undefined","timer","openStartTime","shouldOpen","deferUpdate","duration","clearTimeout","setTimeout","hasTouch","open","Date","now","close","overrideDelay","closeImmediately","touchEnd","evt","stopPropagation","preventDefault","focus","events","push","onEscapePressed","node","eventType","evenHandler","addEventListener","removeEventListener"],"mappings":";;;;AAAA;AACO,IAAMA,0BAA0B,GAAG,SAA7BA,0BAA6B;AAAA;;AAAA,SAAe,CAAC,wBAAC,WAAAC,MAAM,EAACC,UAAR,uDAAC,iCAAoB,eAApB,EAAqCC,O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atio, ColorPalette, ColorVariant, Emphasis, Kind, Ori
|
|
|
3
3
|
import 'react';
|
|
4
4
|
import './_internal/getRootClassName.js';
|
|
5
5
|
import './_internal/mdi.js';
|
|
6
|
-
import './
|
|
6
|
+
import './_internal/index.js';
|
|
7
|
+
import 'lodash/noop';
|
|
8
|
+
export { S as Slideshow, b as SlideshowControls, a as SlideshowItem } from './_internal/SlideshowControls.js';
|
|
7
9
|
import 'lodash/isBoolean';
|
|
8
|
-
import 'lodash/isEmpty';
|
|
9
10
|
import 'lodash/kebabCase';
|
|
10
|
-
import 'lodash/
|
|
11
|
+
import 'lodash/isEmpty';
|
|
12
|
+
export { L as List, a as ListItem, i as isClickable } from './_internal/List2.js';
|
|
13
|
+
import './_internal/onEnterPressed.js';
|
|
14
|
+
import './_internal/onEscapePressed.js';
|
|
11
15
|
import './_internal/constants.js';
|
|
12
16
|
import 'lodash/concat';
|
|
13
17
|
import 'lodash/dropRight';
|
|
@@ -46,7 +50,6 @@ import './_internal/useDelayedVisibility.js';
|
|
|
46
50
|
import './_internal/useDisableBodyScroll.js';
|
|
47
51
|
export { D as DEFAULT_PROPS, a as Divider } from './_internal/Divider2.js';
|
|
48
52
|
export { D as DragHandle } from './_internal/DragHandle.js';
|
|
49
|
-
export { L as List, a as ListItem, i as isClickable } from './_internal/List2.js';
|
|
50
53
|
export { D as Dropdown } from './_internal/Dropdown2.js';
|
|
51
54
|
export { E as ExpansionPanel } from './_internal/ExpansionPanel.js';
|
|
52
55
|
export { F as Flag } from './_internal/Flag2.js';
|
|
@@ -75,7 +78,6 @@ export { a as Select, c as SelectMultiple, b as SelectMultipleField, S as Select
|
|
|
75
78
|
export { S as SideNavigation, a as SideNavigationItem } from './_internal/SideNavigationItem.js';
|
|
76
79
|
export { S as SkeletonCircle, b as SkeletonRectangle, a as SkeletonRectangleVariant, c as SkeletonTypography } from './_internal/SkeletonTypography.js';
|
|
77
80
|
export { S as Slider, c as clamp } from './_internal/Slider2.js';
|
|
78
|
-
export { S as Slideshow, b as SlideshowControls, a as SlideshowItem } from './_internal/SlideshowControls.js';
|
|
79
81
|
export { S as Switch } from './_internal/Switch2.js';
|
|
80
82
|
export { T as Table, a as TableBody, d as TableCell, c as TableCellVariant, e as TableHeader, f as TableRow, b as ThOrder } from './_internal/TableRow.js';
|
|
81
83
|
export { c as Tab, b as TabList, a as TabListLayout, d as TabPanel, T as TabProvider } from './_internal/TabPanel.js';
|
|
@@ -83,8 +85,8 @@ export { T as TextField } from './_internal/TextField.js';
|
|
|
83
85
|
export { T as Thumbnail, u as useFocusPointStyle } from './_internal/Thumbnail2.js';
|
|
84
86
|
export { T as ThumbnailAspectRatio, a as ThumbnailVariant } from './_internal/types.js';
|
|
85
87
|
export { T as Toolbar } from './_internal/Toolbar2.js';
|
|
88
|
+
import './hooks/useOpenHoverOrLongPress.js';
|
|
86
89
|
export { T as Tooltip } from './_internal/Tooltip2.js';
|
|
87
|
-
import 'lodash/debounce';
|
|
88
90
|
export { a as Uploader, U as UploaderVariant } from './_internal/Uploader2.js';
|
|
89
91
|
export { U as UserBlock } from './_internal/UserBlock.js';
|
|
90
92
|
//# sourceMappingURL=index.js.map
|
package/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"@juggle/resize-observer": "^3.2.0",
|
|
10
|
-
"@lumx/core": "^2.2.
|
|
11
|
-
"@lumx/icons": "^2.2.
|
|
10
|
+
"@lumx/core": "^2.2.3-alpha-export-hook1",
|
|
11
|
+
"@lumx/icons": "^2.2.3-alpha-export-hook1",
|
|
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": "2.2.
|
|
124
|
-
"gitHead": "
|
|
123
|
+
"version": "2.2.3-alpha-export-hook1",
|
|
124
|
+
"gitHead": "3c84d9a188d0b1bef0848b9e832dbdba6c22ff4e"
|
|
125
125
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -6,7 +6,7 @@ import { Dropdown, IconButtonProps, Offset, Placement, TextField, Theme } from '
|
|
|
6
6
|
|
|
7
7
|
import { Comp, GenericProps, getRootClassName, handleBasicClasses } from '@lumx/react/utils';
|
|
8
8
|
|
|
9
|
-
import { useFocus } from '@lumx/react/hooks/useFocus';
|
|
9
|
+
import { useFocus } from '@lumx/react/_internal/hooks/useFocus';
|
|
10
10
|
import { mergeRefs } from '@lumx/react/utils/mergeRefs';
|
|
11
11
|
|
|
12
12
|
/**
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
exports[`<IconButton> Props should forward any CSS class 1`] = `
|
|
4
4
|
<Tooltip
|
|
5
|
-
delay={500}
|
|
6
5
|
placement="bottom"
|
|
7
6
|
>
|
|
8
7
|
<ButtonRoot
|
|
@@ -19,7 +18,6 @@ exports[`<IconButton> Props should forward any CSS class 1`] = `
|
|
|
19
18
|
|
|
20
19
|
exports[`<IconButton> Props should use default props 1`] = `
|
|
21
20
|
<Tooltip
|
|
22
|
-
delay={500}
|
|
23
21
|
placement="bottom"
|
|
24
22
|
>
|
|
25
23
|
<ButtonRoot
|
|
@@ -35,7 +33,6 @@ exports[`<IconButton> Props should use default props 1`] = `
|
|
|
35
33
|
|
|
36
34
|
exports[`<IconButton> Snapshots and structure should render icon button 1`] = `
|
|
37
35
|
<Tooltip
|
|
38
|
-
delay={500}
|
|
39
36
|
placement="bottom"
|
|
40
37
|
>
|
|
41
38
|
<ButtonRoot
|
|
@@ -51,7 +48,6 @@ exports[`<IconButton> Snapshots and structure should render icon button 1`] = `
|
|
|
51
48
|
|
|
52
49
|
exports[`<IconButton> Snapshots and structure should render icon button with an image 1`] = `
|
|
53
50
|
<Tooltip
|
|
54
|
-
delay={500}
|
|
55
51
|
placement="bottom"
|
|
56
52
|
>
|
|
57
53
|
<ButtonRoot
|
|
@@ -70,7 +66,6 @@ exports[`<IconButton> Snapshots and structure should render icon button with an
|
|
|
70
66
|
|
|
71
67
|
exports[`<IconButton> Snapshots and structure should render icon button with an image if both props are set 1`] = `
|
|
72
68
|
<Tooltip
|
|
73
|
-
delay={500}
|
|
74
69
|
placement="bottom"
|
|
75
70
|
>
|
|
76
71
|
<ButtonRoot
|
|
@@ -64,6 +64,20 @@ describe(`<${Checkbox.displayName}>`, () => {
|
|
|
64
64
|
expect(label).toExist();
|
|
65
65
|
expect(wrapper).toMatchSnapshot();
|
|
66
66
|
});
|
|
67
|
+
|
|
68
|
+
it('should use the given props while passing custom props to input', () => {
|
|
69
|
+
const { helper, label, wrapper } = setup({
|
|
70
|
+
helper: 'Test helper',
|
|
71
|
+
label: 'Test label',
|
|
72
|
+
inputProps: {
|
|
73
|
+
'aria-labelledby': 'labelledby-id',
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
expect(helper).toExist();
|
|
78
|
+
expect(label).toExist();
|
|
79
|
+
expect(wrapper).toMatchSnapshot();
|
|
80
|
+
});
|
|
67
81
|
});
|
|
68
82
|
|
|
69
83
|
// 3. Test events.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useMemo, forwardRef, ReactNode, SyntheticEvent } from 'react';
|
|
1
|
+
import React, { useMemo, forwardRef, ReactNode, SyntheticEvent, InputHTMLAttributes } from 'react';
|
|
2
2
|
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import { uid } from 'uid';
|
|
@@ -30,6 +30,8 @@ export interface CheckboxProps extends GenericProps {
|
|
|
30
30
|
value?: string;
|
|
31
31
|
/** On change callback. */
|
|
32
32
|
onChange?(isChecked: boolean, value?: string, name?: string, event?: SyntheticEvent): void;
|
|
33
|
+
/** optional props for input */
|
|
34
|
+
inputProps?: InputHTMLAttributes<HTMLInputElement>;
|
|
33
35
|
}
|
|
34
36
|
|
|
35
37
|
/**
|
|
@@ -70,6 +72,7 @@ export const Checkbox: Comp<CheckboxProps, HTMLDivElement> = forwardRef((props,
|
|
|
70
72
|
onChange,
|
|
71
73
|
theme,
|
|
72
74
|
value,
|
|
75
|
+
inputProps = {},
|
|
73
76
|
...forwardedProps
|
|
74
77
|
} = props;
|
|
75
78
|
const inputId = useMemo(() => id || `${CLASSNAME.toLowerCase()}-${uid()}`, [id]);
|
|
@@ -105,6 +108,7 @@ export const Checkbox: Comp<CheckboxProps, HTMLDivElement> = forwardRef((props,
|
|
|
105
108
|
value={value}
|
|
106
109
|
checked={isChecked}
|
|
107
110
|
onChange={handleChange}
|
|
111
|
+
{...inputProps}
|
|
108
112
|
/>
|
|
109
113
|
|
|
110
114
|
<div className={`${CLASSNAME}__input-placeholder`}>
|
|
@@ -50,6 +50,57 @@ exports[`<Checkbox> Props should use the given props 1`] = `
|
|
|
50
50
|
</div>
|
|
51
51
|
`;
|
|
52
52
|
|
|
53
|
+
exports[`<Checkbox> Props should use the given props while passing custom props to input 1`] = `
|
|
54
|
+
<div
|
|
55
|
+
className="lumx-checkbox lumx-checkbox--is-unchecked lumx-checkbox--theme-light"
|
|
56
|
+
>
|
|
57
|
+
<div
|
|
58
|
+
className="lumx-checkbox__input-wrapper"
|
|
59
|
+
>
|
|
60
|
+
<input
|
|
61
|
+
aria-labelledby="labelledby-id"
|
|
62
|
+
className="lumx-checkbox__input-native"
|
|
63
|
+
id="fixedId"
|
|
64
|
+
onChange={[Function]}
|
|
65
|
+
tabIndex={0}
|
|
66
|
+
type="checkbox"
|
|
67
|
+
/>
|
|
68
|
+
<div
|
|
69
|
+
className="lumx-checkbox__input-placeholder"
|
|
70
|
+
>
|
|
71
|
+
<div
|
|
72
|
+
className="lumx-checkbox__input-background"
|
|
73
|
+
/>
|
|
74
|
+
<div
|
|
75
|
+
className="lumx-checkbox__input-indicator"
|
|
76
|
+
>
|
|
77
|
+
<Icon
|
|
78
|
+
icon="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"
|
|
79
|
+
/>
|
|
80
|
+
</div>
|
|
81
|
+
</div>
|
|
82
|
+
</div>
|
|
83
|
+
<div
|
|
84
|
+
className="lumx-checkbox__content"
|
|
85
|
+
>
|
|
86
|
+
<InputLabel
|
|
87
|
+
className="lumx-checkbox__label"
|
|
88
|
+
htmlFor="fixedId"
|
|
89
|
+
theme="light"
|
|
90
|
+
>
|
|
91
|
+
Test label
|
|
92
|
+
</InputLabel>
|
|
93
|
+
<InputHelper
|
|
94
|
+
className="lumx-checkbox__helper"
|
|
95
|
+
kind="info"
|
|
96
|
+
theme="light"
|
|
97
|
+
>
|
|
98
|
+
Test helper
|
|
99
|
+
</InputHelper>
|
|
100
|
+
</div>
|
|
101
|
+
</div>
|
|
102
|
+
`;
|
|
103
|
+
|
|
53
104
|
exports[`<Checkbox> Snapshots and structure should render correctly 1`] = `
|
|
54
105
|
<div
|
|
55
106
|
className="lumx-checkbox lumx-checkbox--is-unchecked lumx-checkbox--theme-light"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Color, ColorPalette, Size, Theme } from '@lumx/react';
|
|
2
|
-
import { useStopPropagation } from '@lumx/react/hooks/useStopPropagation';
|
|
2
|
+
import { useStopPropagation } from '@lumx/react/_internal/hooks/useStopPropagation';
|
|
3
3
|
|
|
4
4
|
import { Comp, GenericProps, getRootClassName, handleBasicClasses, onEnterPressed } from '@lumx/react/utils';
|
|
5
5
|
|
|
@@ -5,7 +5,7 @@ import classNames from 'classnames';
|
|
|
5
5
|
|
|
6
6
|
import { Comp, GenericProps, getRootClassName, handleBasicClasses } from '@lumx/react/utils';
|
|
7
7
|
|
|
8
|
-
import { useChipGroupNavigation } from '@lumx/react/hooks/useChipGroupNavigation';
|
|
8
|
+
import { useChipGroupNavigation } from '@lumx/react/_internal/hooks/useChipGroupNavigation';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Defines the props of the component.
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { DatePicker, Placement, Popover, TextField, IconButtonProps } from '@lumx/react';
|
|
2
|
-
import { useFocusTrap } from '@lumx/react/hooks/useFocusTrap';
|
|
2
|
+
import { useFocusTrap } from '@lumx/react/_internal/hooks/useFocusTrap';
|
|
3
3
|
|
|
4
4
|
import moment from 'moment';
|
|
5
5
|
|
|
6
6
|
import React, { forwardRef, SyntheticEvent, useCallback, useRef, useState } from 'react';
|
|
7
7
|
|
|
8
|
-
import { useFocus } from '@lumx/react/hooks/useFocus';
|
|
8
|
+
import { useFocus } from '@lumx/react/_internal/hooks/useFocus';
|
|
9
9
|
import { Comp, GenericProps } from '@lumx/react/utils';
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -10,7 +10,7 @@ import * as stories from './Dialog.stories';
|
|
|
10
10
|
const CLASSNAME = Dialog.className as string;
|
|
11
11
|
|
|
12
12
|
// Mock out the useIntersectionObserver hook since it can't work with Jest/Enzyme.
|
|
13
|
-
jest.mock('@lumx/react/hooks/useIntersectionObserver', () => ({
|
|
13
|
+
jest.mock('@lumx/react/_internal/hooks/useIntersectionObserver', () => ({
|
|
14
14
|
useIntersectionObserver: () => new Map(),
|
|
15
15
|
}));
|
|
16
16
|
|
|
@@ -6,9 +6,9 @@ import classNames from 'classnames';
|
|
|
6
6
|
import { Progress, ProgressVariant, Size } from '@lumx/react';
|
|
7
7
|
|
|
8
8
|
import { DIALOG_TRANSITION_DURATION, DOCUMENT } from '@lumx/react/constants';
|
|
9
|
-
import { useCallbackOnEscape } from '@lumx/react/hooks/useCallbackOnEscape';
|
|
10
|
-
import { useFocusTrap } from '@lumx/react/hooks/useFocusTrap';
|
|
11
|
-
import { useIntersectionObserver } from '@lumx/react/hooks/useIntersectionObserver';
|
|
9
|
+
import { useCallbackOnEscape } from '@lumx/react/_internal/hooks/useCallbackOnEscape';
|
|
10
|
+
import { useFocusTrap } from '@lumx/react/_internal/hooks/useFocusTrap';
|
|
11
|
+
import { useIntersectionObserver } from '@lumx/react/_internal/hooks/useIntersectionObserver';
|
|
12
12
|
import {
|
|
13
13
|
Comp,
|
|
14
14
|
GenericProps,
|
|
@@ -20,8 +20,8 @@ import {
|
|
|
20
20
|
import { ClickAwayProvider } from '@lumx/react/utils/ClickAwayProvider';
|
|
21
21
|
import { mergeRefs } from '@lumx/react/utils/mergeRefs';
|
|
22
22
|
|
|
23
|
-
import { useDelayedVisibility } from '@lumx/react/hooks/useDelayedVisibility';
|
|
24
|
-
import { useDisableBodyScroll } from '@lumx/react/hooks/useDisableBodyScroll';
|
|
23
|
+
import { useDelayedVisibility } from '@lumx/react/_internal/hooks/useDelayedVisibility';
|
|
24
|
+
import { useDisableBodyScroll } from '@lumx/react/_internal/hooks/useDisableBodyScroll';
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* Defines the props of the component.
|
|
@@ -4,7 +4,7 @@ import classNames from 'classnames';
|
|
|
4
4
|
|
|
5
5
|
import { List, ListProps } from '@lumx/react/components/list/List';
|
|
6
6
|
import { Offset, Placement, Popover } from '@lumx/react/components/popover/Popover';
|
|
7
|
-
import { useInfiniteScroll } from '@lumx/react/hooks/useInfiniteScroll';
|
|
7
|
+
import { useInfiniteScroll } from '@lumx/react/_internal/hooks/useInfiniteScroll';
|
|
8
8
|
import { Comp, GenericProps, getRootClassName, handleBasicClasses, isComponent } from '@lumx/react/utils';
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -8,12 +8,12 @@ import { ColorPalette, Emphasis, IconButton, IconButtonProps, Theme } from '@lum
|
|
|
8
8
|
import { DOCUMENT } from '@lumx/react/constants';
|
|
9
9
|
import { Comp, GenericProps, getRootClassName, handleBasicClasses } from '@lumx/react/utils';
|
|
10
10
|
|
|
11
|
-
import { useFocusTrap } from '@lumx/react/hooks/useFocusTrap';
|
|
12
|
-
import { useDelayedVisibility } from '@lumx/react/hooks/useDelayedVisibility';
|
|
13
|
-
import { useDisableBodyScroll } from '@lumx/react/hooks/useDisableBodyScroll';
|
|
11
|
+
import { useFocusTrap } from '@lumx/react/_internal/hooks/useFocusTrap';
|
|
12
|
+
import { useDelayedVisibility } from '@lumx/react/_internal/hooks/useDelayedVisibility';
|
|
13
|
+
import { useDisableBodyScroll } from '@lumx/react/_internal/hooks/useDisableBodyScroll';
|
|
14
14
|
import { ClickAwayProvider } from '@lumx/react/utils/ClickAwayProvider';
|
|
15
15
|
import { mergeRefs } from '@lumx/react/utils/mergeRefs';
|
|
16
|
-
import { useCallbackOnEscape } from '@lumx/react/hooks/useCallbackOnEscape';
|
|
16
|
+
import { useCallbackOnEscape } from '@lumx/react/_internal/hooks/useCallbackOnEscape';
|
|
17
17
|
|
|
18
18
|
const LIGHTBOX_TRANSITION_DURATION = 400;
|
|
19
19
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Size } from '@lumx/react';
|
|
2
2
|
|
|
3
|
-
import { useKeyboardListNavigation } from '@lumx/react/hooks/useKeyboardListNavigation';
|
|
3
|
+
import { useKeyboardListNavigation } from '@lumx/react/_internal/hooks/useKeyboardListNavigation';
|
|
4
4
|
import { Comp, GenericProps, getRootClassName, handleBasicClasses } from '@lumx/react/utils';
|
|
5
5
|
import { mergeRefs } from '@lumx/react/utils/mergeRefs';
|
|
6
6
|
|
|
@@ -11,7 +11,7 @@ import * as stories from './Mosaic.stories';
|
|
|
11
11
|
const CLASSNAME = Mosaic.className as string;
|
|
12
12
|
|
|
13
13
|
// Mock out the useIntersectionObserver hook since it can't work with Jest/Enzyme.
|
|
14
|
-
jest.mock('@lumx/react/hooks/useIntersectionObserver', () => ({
|
|
14
|
+
jest.mock('@lumx/react/_internal/hooks/useIntersectionObserver', () => ({
|
|
15
15
|
useIntersectionObserver: () => new Map(),
|
|
16
16
|
}));
|
|
17
17
|
|
|
@@ -11,7 +11,7 @@ import { DOCUMENT, NOTIFICATION_TRANSITION_DURATION } from '@lumx/react/constant
|
|
|
11
11
|
import { NOTIFICATION_CONFIGURATION } from '@lumx/react/components/notification/constants';
|
|
12
12
|
import { Comp, GenericProps, getRootClassName, handleBasicClasses } from '@lumx/react/utils';
|
|
13
13
|
|
|
14
|
-
import { useDelayedVisibility } from '@lumx/react/hooks/useDelayedVisibility';
|
|
14
|
+
import { useDelayedVisibility } from '@lumx/react/_internal/hooks/useDelayedVisibility';
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* Defines the props of the component.
|
|
@@ -6,8 +6,8 @@ import { usePopper } from 'react-popper';
|
|
|
6
6
|
import classNames from 'classnames';
|
|
7
7
|
|
|
8
8
|
import { DOCUMENT, WINDOW } from '@lumx/react/constants';
|
|
9
|
-
import { useCallbackOnEscape } from '@lumx/react/hooks/useCallbackOnEscape';
|
|
10
|
-
import { useFocus } from '@lumx/react/hooks/useFocus';
|
|
9
|
+
import { useCallbackOnEscape } from '@lumx/react/_internal/hooks/useCallbackOnEscape';
|
|
10
|
+
import { useFocus } from '@lumx/react/_internal/hooks/useFocus';
|
|
11
11
|
import { ClickAwayProvider } from '@lumx/react/utils/ClickAwayProvider';
|
|
12
12
|
|
|
13
13
|
import { Comp, GenericProps, getRootClassName, handleBasicClasses, ValueOf } from '@lumx/react/utils';
|
|
@@ -4,7 +4,7 @@ import classNames from 'classnames';
|
|
|
4
4
|
|
|
5
5
|
import { Comp, GenericProps, getRootClassName, handleBasicClasses } from '@lumx/react/utils';
|
|
6
6
|
import { mergeRefs } from '@lumx/react/utils/mergeRefs';
|
|
7
|
-
import { useRovingTabIndex } from '
|
|
7
|
+
import { useRovingTabIndex } from '@lumx/react/_internal/hooks/useRovingTabIndex';
|
|
8
8
|
import { useTabProviderContextState } from '../tabs/state';
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { List, ListItem, Select, Size, TextField } from '@lumx/react';
|
|
2
|
-
import { useBooleanState } from '@lumx/react/hooks/useBooleanState';
|
|
2
|
+
import { useBooleanState } from '@lumx/react/_internal/hooks/useBooleanState';
|
|
3
3
|
import { text } from '@storybook/addon-knobs';
|
|
4
4
|
import noop from 'lodash/noop';
|
|
5
5
|
import range from 'lodash/range';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* istanbul ignore file */
|
|
2
2
|
import { Chip, List, ListItem, SelectMultiple, Size } from '@lumx/react';
|
|
3
|
-
import { useBooleanState } from '@lumx/react/hooks/useBooleanState';
|
|
3
|
+
import { useBooleanState } from '@lumx/react/_internal/hooks/useBooleanState';
|
|
4
4
|
import noop from 'lodash/noop';
|
|
5
5
|
import React, { MouseEventHandler, SyntheticEvent, useState } from 'react';
|
|
6
6
|
import { SelectVariant } from './constants';
|