@ringcentral/juno 2.4.2 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/Buttons/IconButton/IconButton.d.ts +10 -2
- package/components/Buttons/IconButton/IconButton.js +10 -8
- package/components/Buttons/IconButton/styles/StyledIconButton.js +15 -7
- package/components/Buttons/IconButton/utils/IconButtonUtils.d.ts +1 -1
- package/components/Buttons/IconButton/utils/IconButtonUtils.js +9 -1
- package/components/Dialer/DialPad/DialPad.d.ts +25 -7
- package/components/Dialer/DialPad/DialPad.js +6 -6
- package/components/Dialer/DialPad/utils/useDialKeyboard.d.ts +8 -9
- package/components/Dialer/DialTextField/DialTextField.d.ts +3 -1
- package/components/Dialer/DialTextField/DialTextField.js +7 -6
- package/components/Downshift/SuggestionList/SuggestionList.d.ts +74 -2
- package/components/Downshift/styles/DownshiftStyle.d.ts +1 -1
- package/components/Forms/Picker/DatePicker/styles/StyledDatePickerHeader.d.ts +1 -1
- package/components/Forms/Picker/DatePicker/styles/StyledYear.d.ts +1 -1
- package/components/Forms/Picker/TimePicker/styles/StyledSelectionItem.d.ts +1 -1
- package/components/Forms/Picker/TimePicker/styles/StyledTimeIconButton.d.ts +1 -1
- package/components/Forms/Picker/styles/PickerBaseIconButton.d.ts +1 -1
- package/components/Forms/TextField/styles/ClearIconButton.d.ts +2 -2
- package/components/Grid/Grid.d.ts +1 -1
- package/components/Pagination/Pagination/Pagination.d.ts +1 -1
- package/components/Stepper/StepButton/StepButton.d.ts +1 -1
- package/components/Stepper/StepLabel/StepLabel.d.ts +1 -1
- package/components/Table/TableCell/styles/TableCellStyle.js +3 -1
- package/components/Table/types.d.ts +1 -1
- package/components/TablePagination/TablePagination.d.ts +1 -1
- package/components/VirtualizedMenu/VirtualizedMenu.js +11 -0
- package/components/VirtualizedMenu/VirtualizedMenuList.js +6 -2
- package/components/Virtuoso/react-virtuoso/AATree.js +15 -15
- package/components/Virtuoso/react-virtuoso/Grid.d.ts +193 -106
- package/components/Virtuoso/react-virtuoso/Grid.js +19 -24
- package/components/Virtuoso/react-virtuoso/List.d.ts +2664 -596
- package/components/Virtuoso/react-virtuoso/List.js +83 -70
- package/components/Virtuoso/react-virtuoso/Table.d.ts +6253 -0
- package/components/Virtuoso/react-virtuoso/Table.js +184 -0
- package/components/Virtuoso/react-virtuoso/alignToBottomSystem.d.ts +153 -37
- package/components/Virtuoso/react-virtuoso/components.d.ts +248 -41
- package/components/Virtuoso/react-virtuoso/components.js +2 -0
- package/components/Virtuoso/react-virtuoso/domIOSystem.d.ts +2 -4
- package/components/Virtuoso/react-virtuoso/domIOSystem.js +12 -10
- package/components/Virtuoso/react-virtuoso/followOutputSystem.d.ts +146 -27
- package/components/Virtuoso/react-virtuoso/followOutputSystem.js +28 -15
- package/components/Virtuoso/react-virtuoso/gridSystem.d.ts +67 -52
- package/components/Virtuoso/react-virtuoso/gridSystem.js +17 -15
- package/components/Virtuoso/react-virtuoso/groupedListSystem.d.ts +17 -3
- package/components/Virtuoso/react-virtuoso/hooks/useChangedChildSizes.d.ts +2 -1
- package/components/Virtuoso/react-virtuoso/hooks/useChangedChildSizes.js +32 -7
- package/components/Virtuoso/react-virtuoso/hooks/useScrollTop.d.ts +1 -1
- package/components/Virtuoso/react-virtuoso/hooks/useScrollTop.js +40 -26
- package/components/Virtuoso/react-virtuoso/hooks/useSize.d.ts +2 -2
- package/components/Virtuoso/react-virtuoso/hooks/useSize.js +26 -28
- package/components/Virtuoso/react-virtuoso/hooks/useWindowViewportRect.d.ts +1 -1
- package/components/Virtuoso/react-virtuoso/hooks/useWindowViewportRect.js +32 -12
- package/components/Virtuoso/react-virtuoso/index.d.ts +1 -0
- package/components/Virtuoso/react-virtuoso/index.js +2 -0
- package/components/Virtuoso/react-virtuoso/initialItemCountSystem.d.ts +165 -35
- package/components/Virtuoso/react-virtuoso/initialItemCountSystem.js +1 -8
- package/components/Virtuoso/react-virtuoso/initialScrollTopSystem.d.ts +160 -38
- package/components/Virtuoso/react-virtuoso/initialTopMostItemIndexSystem.d.ts +54 -12
- package/components/Virtuoso/react-virtuoso/initialTopMostItemIndexSystem.js +26 -10
- package/components/Virtuoso/react-virtuoso/interfaces.d.ts +134 -28
- package/components/Virtuoso/react-virtuoso/listStateSystem.d.ts +141 -32
- package/components/Virtuoso/react-virtuoso/listStateSystem.js +1 -2
- package/components/Virtuoso/react-virtuoso/listSystem.d.ts +2123 -407
- package/components/Virtuoso/react-virtuoso/listSystem.js +10 -7
- package/components/Virtuoso/react-virtuoso/loggerSystem.d.ts +17 -0
- package/components/Virtuoso/react-virtuoso/loggerSystem.js +37 -0
- package/components/Virtuoso/react-virtuoso/propsReadySystem.d.ts +8 -1
- package/components/Virtuoso/react-virtuoso/propsReadySystem.js +8 -2
- package/components/Virtuoso/react-virtuoso/scrollIntoViewSystem.d.ts +641 -0
- package/components/Virtuoso/react-virtuoso/scrollIntoViewSystem.js +42 -0
- package/components/Virtuoso/react-virtuoso/scrollSeekSystem.d.ts +52 -67
- package/components/Virtuoso/react-virtuoso/scrollSeekSystem.js +11 -25
- package/components/Virtuoso/react-virtuoso/scrollToIndexSystem.d.ts +26 -5
- package/components/Virtuoso/react-virtuoso/scrollToIndexSystem.js +37 -13
- package/components/Virtuoso/react-virtuoso/sizeRangeSystem.d.ts +11 -4
- package/components/Virtuoso/react-virtuoso/sizeRangeSystem.js +44 -15
- package/components/Virtuoso/react-virtuoso/sizeSystem.d.ts +12 -2
- package/components/Virtuoso/react-virtuoso/sizeSystem.js +109 -52
- package/components/Virtuoso/react-virtuoso/stateFlagsSystem.d.ts +17 -5
- package/components/Virtuoso/react-virtuoso/stateFlagsSystem.js +87 -18
- package/components/Virtuoso/react-virtuoso/topItemCountSystem.d.ts +145 -33
- package/components/Virtuoso/react-virtuoso/totalListHeightSystem.d.ts +149 -35
- package/components/Virtuoso/react-virtuoso/upwardScrollFixSystem.d.ts +183 -42
- package/components/Virtuoso/react-virtuoso/upwardScrollFixSystem.js +37 -26
- package/components/Virtuoso/react-virtuoso/utils/correctItemSize.d.ts +1 -0
- package/components/Virtuoso/react-virtuoso/utils/correctItemSize.js +6 -0
- package/components/Virtuoso/react-virtuoso/windowScrollerSystem.d.ts +7 -4
- package/components/Virtuoso/react-virtuoso/windowScrollerSystem.js +9 -7
- package/es6/components/Buttons/IconButton/IconButton.js +12 -10
- package/es6/components/Buttons/IconButton/styles/StyledIconButton.js +16 -8
- package/es6/components/Buttons/IconButton/utils/IconButtonUtils.js +9 -1
- package/es6/components/Dialer/DialPad/DialPad.js +6 -6
- package/es6/components/Dialer/DialTextField/DialTextField.js +7 -6
- package/es6/components/Table/TableCell/TableCell.js +2 -2
- package/es6/components/Table/TableCell/styles/TableCellStyle.js +3 -1
- package/es6/components/VirtualizedMenu/VirtualizedMenu.js +13 -2
- package/es6/components/VirtualizedMenu/VirtualizedMenuList.js +6 -2
- package/es6/components/Virtuoso/react-virtuoso/AATree.js +15 -15
- package/es6/components/Virtuoso/react-virtuoso/Grid.js +20 -25
- package/es6/components/Virtuoso/react-virtuoso/List.js +84 -72
- package/es6/components/Virtuoso/react-virtuoso/Table.js +182 -0
- package/es6/components/Virtuoso/react-virtuoso/components.js +2 -0
- package/es6/components/Virtuoso/react-virtuoso/domIOSystem.js +13 -10
- package/es6/components/Virtuoso/react-virtuoso/followOutputSystem.js +28 -15
- package/es6/components/Virtuoso/react-virtuoso/gridSystem.js +17 -15
- package/es6/components/Virtuoso/react-virtuoso/hooks/useChangedChildSizes.js +31 -6
- package/es6/components/Virtuoso/react-virtuoso/hooks/useScrollTop.js +40 -26
- package/es6/components/Virtuoso/react-virtuoso/hooks/useSize.js +27 -29
- package/es6/components/Virtuoso/react-virtuoso/hooks/useWindowViewportRect.js +32 -12
- package/es6/components/Virtuoso/react-virtuoso/index.js +1 -0
- package/es6/components/Virtuoso/react-virtuoso/initialItemCountSystem.js +1 -8
- package/es6/components/Virtuoso/react-virtuoso/initialTopMostItemIndexSystem.js +25 -10
- package/es6/components/Virtuoso/react-virtuoso/listStateSystem.js +2 -3
- package/es6/components/Virtuoso/react-virtuoso/listSystem.js +10 -7
- package/es6/components/Virtuoso/react-virtuoso/loggerSystem.js +34 -0
- package/es6/components/Virtuoso/react-virtuoso/propsReadySystem.js +9 -2
- package/es6/components/Virtuoso/react-virtuoso/scrollIntoViewSystem.js +40 -0
- package/es6/components/Virtuoso/react-virtuoso/scrollSeekSystem.js +11 -25
- package/es6/components/Virtuoso/react-virtuoso/scrollToIndexSystem.js +37 -13
- package/es6/components/Virtuoso/react-virtuoso/sizeRangeSystem.js +39 -11
- package/es6/components/Virtuoso/react-virtuoso/sizeSystem.js +109 -52
- package/es6/components/Virtuoso/react-virtuoso/stateFlagsSystem.js +87 -18
- package/es6/components/Virtuoso/react-virtuoso/upwardScrollFixSystem.js +39 -28
- package/es6/components/Virtuoso/react-virtuoso/utils/correctItemSize.js +3 -0
- package/es6/components/Virtuoso/react-virtuoso/windowScrollerSystem.js +9 -7
- package/es6/foundation/hooks/useEventListener/useEventListener.js +27 -8
- package/es6/foundation/hooks/useGlobalListener/createGlobalListener.js +81 -0
- package/es6/foundation/hooks/useGlobalListener/index.js +1 -0
- package/es6/foundation/hooks/useGlobalListener/useGlobalListener.js +67 -97
- package/es6/foundation/hooks/useLongPress/useLongPress.js +52 -33
- package/es6/foundation/hooks/useTouchMouseEvent/useTouchMouseEvent.js +27 -28
- package/foundation/hooks/useEventListener/useEventListener.d.ts +12 -16
- package/foundation/hooks/useEventListener/useEventListener.js +26 -7
- package/foundation/hooks/useGlobalListener/createGlobalListener.d.ts +55 -0
- package/foundation/hooks/useGlobalListener/createGlobalListener.js +83 -0
- package/foundation/hooks/useGlobalListener/index.d.ts +1 -0
- package/foundation/hooks/useGlobalListener/index.js +1 -0
- package/foundation/hooks/useGlobalListener/useGlobalListener.d.ts +11 -105
- package/foundation/hooks/useGlobalListener/useGlobalListener.js +67 -97
- package/foundation/hooks/useLongPress/useLongPress.d.ts +10 -8
- package/foundation/hooks/useLongPress/useLongPress.js +50 -31
- package/foundation/hooks/useTouchMouseEvent/useTouchMouseEvent.d.ts +27 -14
- package/foundation/hooks/useTouchMouseEvent/useTouchMouseEvent.js +27 -28
- package/foundation/typings/deepPartial.d.ts +1 -1
- package/package.json +2 -2
|
@@ -5,41 +5,41 @@ var tslib_1 = require("tslib");
|
|
|
5
5
|
var u = tslib_1.__importStar(require("@virtuoso.dev/urx"));
|
|
6
6
|
var domIOSystem_1 = require("./domIOSystem");
|
|
7
7
|
var listStateSystem_1 = require("./listStateSystem");
|
|
8
|
+
var loggerSystem_1 = require("./loggerSystem");
|
|
8
9
|
var sizeSystem_1 = require("./sizeSystem");
|
|
9
10
|
var stateFlagsSystem_1 = require("./stateFlagsSystem");
|
|
10
11
|
/**
|
|
11
12
|
* Fixes upward scrolling by calculating and compensation from changed item heights, using scrollBy.
|
|
12
13
|
*/
|
|
13
14
|
exports.upwardScrollFixSystem = u.system(function (_a) {
|
|
14
|
-
var _b = tslib_1.__read(_a,
|
|
15
|
-
var deviationOffset = u.streamFromEmitter(u.pipe(listState, u.withLatestFrom(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
var
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
var _c = tslib_1.__read(_a, 2), prevItems = _c[1];
|
|
23
|
-
var items = _b.items;
|
|
15
|
+
var _b = tslib_1.__read(_a, 5), _c = _b[0], scrollBy = _c.scrollBy, scrollTop = _c.scrollTop, deviation = _c.deviation, scrollingInProgress = _c.scrollingInProgress, _d = _b[1], isScrolling = _d.isScrolling, isAtBottom = _d.isAtBottom, atBottomState = _d.atBottomState, scrollDirection = _d.scrollDirection, lastJumpDueToItemResize = _d.lastJumpDueToItemResize, listState = _b[2].listState, _e = _b[3], beforeUnshiftWith = _e.beforeUnshiftWith, shiftWithOffset = _e.shiftWithOffset, sizes = _e.sizes, log = _b[4].log;
|
|
16
|
+
var deviationOffset = u.streamFromEmitter(u.pipe(listState, u.withLatestFrom(lastJumpDueToItemResize), u.scan(function (_a,
|
|
17
|
+
// @ts-ignore
|
|
18
|
+
_b) {
|
|
19
|
+
var _c = tslib_1.__read(_a, 3), prevItems = _c[1], prevTotalCount = _c[2];
|
|
20
|
+
var
|
|
21
|
+
// @ts-ignore
|
|
22
|
+
_d = tslib_1.__read(_b, 2), _e = _d[0], items = _e.items, totalCount = _e.totalCount, lastJumpDueToItemResize = _d[1];
|
|
24
23
|
var newDev = 0;
|
|
25
|
-
if (
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
if (
|
|
32
|
-
newDev = items[0].size - prevItems[0].size;
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
24
|
+
if (prevTotalCount === totalCount) {
|
|
25
|
+
if (prevItems.length > 0 && items.length > 0) {
|
|
26
|
+
var firstItemIndex = items[0].originalIndex;
|
|
27
|
+
var prevFirstItemIndex = prevItems[0].originalIndex;
|
|
28
|
+
var atStart = firstItemIndex === 0 && prevFirstItemIndex === 0;
|
|
29
|
+
var onlyItem = items.length === 1;
|
|
30
|
+
if (!atStart) {
|
|
35
31
|
var _loop_1 = function (index) {
|
|
36
32
|
var item = items[index];
|
|
37
33
|
var prevItem = prevItems.find(function (pItem) { return pItem.originalIndex === item.originalIndex; });
|
|
38
34
|
if (!prevItem) {
|
|
39
35
|
return "continue";
|
|
40
36
|
}
|
|
41
|
-
if (item.offset !== prevItem.offset) {
|
|
42
|
-
newDev =
|
|
37
|
+
if (item.offset !== prevItem.offset || onlyItem) {
|
|
38
|
+
newDev =
|
|
39
|
+
item.offset -
|
|
40
|
+
prevItem.offset +
|
|
41
|
+
item.size -
|
|
42
|
+
prevItem.size;
|
|
43
43
|
return "break";
|
|
44
44
|
}
|
|
45
45
|
};
|
|
@@ -50,13 +50,21 @@ exports.upwardScrollFixSystem = u.system(function (_a) {
|
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
+
if (newDev !== 0) {
|
|
54
|
+
newDev += lastJumpDueToItemResize;
|
|
55
|
+
}
|
|
53
56
|
}
|
|
54
|
-
return [newDev, items];
|
|
55
|
-
}, [0, []]), u.filter(function (_a) {
|
|
57
|
+
return [newDev, items, totalCount];
|
|
58
|
+
}, [0, [], 0]), u.filter(function (_a) {
|
|
56
59
|
var _b = tslib_1.__read(_a, 1), amount = _b[0];
|
|
57
60
|
return amount !== 0;
|
|
61
|
+
}), u.withLatestFrom(scrollTop, scrollDirection, scrollingInProgress, log, isAtBottom, atBottomState), u.filter(function (_a) {
|
|
62
|
+
var _b = tslib_1.__read(_a, 4), scrollTop = _b[1], scrollDirection = _b[2], scrollingInProgress = _b[3];
|
|
63
|
+
// console.log({ amount, scrollTop, scrollDirection, scrollingInProgress, isAtBottom, atBottomState })
|
|
64
|
+
return (!scrollingInProgress && scrollTop !== 0 && scrollDirection === stateFlagsSystem_1.UP); // && (isAtBottom ? amount > 0 : true)
|
|
58
65
|
}), u.map(function (_a) {
|
|
59
|
-
var _b = tslib_1.__read(_a, 1), amount =
|
|
66
|
+
var _b = tslib_1.__read(_a, 5), _c = tslib_1.__read(_b[0], 1), amount = _c[0], log = _b[4];
|
|
67
|
+
log('Upward scrolling compensation', { amount: amount }, loggerSystem_1.LogLevel.DEBUG);
|
|
60
68
|
return amount;
|
|
61
69
|
})));
|
|
62
70
|
u.connect(u.pipe(deviationOffset, u.withLatestFrom(deviation), u.map(function (_a) {
|
|
@@ -81,9 +89,12 @@ exports.upwardScrollFixSystem = u.system(function (_a) {
|
|
|
81
89
|
u.publish(scrollBy, { top: -offset, behavior: 'auto' });
|
|
82
90
|
}
|
|
83
91
|
});
|
|
92
|
+
u.connect(u.pipe(shiftWithOffset, u.map(function (offset) {
|
|
93
|
+
return { top: -offset };
|
|
94
|
+
})), scrollBy);
|
|
84
95
|
u.connect(u.pipe(beforeUnshiftWith, u.withLatestFrom(sizes), u.map(function (_a) {
|
|
85
96
|
var _b = tslib_1.__read(_a, 2), offset = _b[0], lastSize = _b[1].lastSize;
|
|
86
97
|
return offset * lastSize;
|
|
87
98
|
})), deviationOffset);
|
|
88
99
|
return { deviation: deviation };
|
|
89
|
-
}, u.tup(domIOSystem_1.domIOSystem, stateFlagsSystem_1.stateFlagsSystem, listStateSystem_1.listStateSystem, sizeSystem_1.sizeSystem));
|
|
100
|
+
}, u.tup(domIOSystem_1.domIOSystem, stateFlagsSystem_1.stateFlagsSystem, listStateSystem_1.listStateSystem, sizeSystem_1.sizeSystem, loggerSystem_1.loggerSystem));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function correctItemSize(el: HTMLElement, dimension: 'height' | 'width'): number;
|
|
@@ -1,32 +1,35 @@
|
|
|
1
1
|
import * as u from '@virtuoso.dev/urx';
|
|
2
2
|
import { WindowViewportInfo } from './interfaces';
|
|
3
3
|
export declare const windowScrollerSystem: u.SystemSpec<[u.SystemSpec<never[], () => {
|
|
4
|
+
scrollContainerState: u.Stream<[number, number]>;
|
|
4
5
|
scrollTop: u.Stream<number>;
|
|
5
6
|
viewportHeight: u.Stream<number>;
|
|
6
7
|
headerHeight: u.StatefulStream<number>;
|
|
7
8
|
footerHeight: u.StatefulStream<number>;
|
|
9
|
+
scrollHeight: u.Stream<number>;
|
|
8
10
|
smoothScrollTargetReached: u.Stream<true>;
|
|
9
11
|
scrollTo: u.Stream<ScrollToOptions>;
|
|
10
12
|
scrollBy: u.Stream<ScrollToOptions>;
|
|
11
|
-
scrollDirection: u.StatefulStream<import("./domIOSystem").ScrollDirection>;
|
|
12
13
|
statefulScrollTop: u.StatefulStream<number>;
|
|
13
14
|
deviation: u.StatefulStream<number>;
|
|
14
15
|
scrollingInProgress: u.StatefulStream<boolean>;
|
|
15
|
-
}>], ([{
|
|
16
|
+
}>], ([{ scrollTo, scrollContainerState }]: [{
|
|
17
|
+
scrollContainerState: u.Stream<[number, number]>;
|
|
16
18
|
scrollTop: u.Stream<number>;
|
|
17
19
|
viewportHeight: u.Stream<number>;
|
|
18
20
|
headerHeight: u.StatefulStream<number>;
|
|
19
21
|
footerHeight: u.StatefulStream<number>;
|
|
22
|
+
scrollHeight: u.Stream<number>;
|
|
20
23
|
smoothScrollTargetReached: u.Stream<true>;
|
|
21
24
|
scrollTo: u.Stream<ScrollToOptions>;
|
|
22
25
|
scrollBy: u.Stream<ScrollToOptions>;
|
|
23
|
-
scrollDirection: u.StatefulStream<import("./domIOSystem").ScrollDirection>;
|
|
24
26
|
statefulScrollTop: u.StatefulStream<number>;
|
|
25
27
|
deviation: u.StatefulStream<number>;
|
|
26
28
|
scrollingInProgress: u.StatefulStream<boolean>;
|
|
27
29
|
}]) => {
|
|
28
30
|
useWindowScroll: u.StatefulStream<boolean>;
|
|
29
|
-
|
|
31
|
+
customScrollParent: u.StatefulStream<HTMLElement | undefined>;
|
|
32
|
+
windowScrollContainerState: u.Stream<[number, number]>;
|
|
30
33
|
windowViewportRect: u.Stream<WindowViewportInfo>;
|
|
31
34
|
windowScrollTo: u.Stream<ScrollToOptions>;
|
|
32
35
|
}>;
|
|
@@ -4,15 +4,16 @@ var tslib_1 = require("tslib");
|
|
|
4
4
|
var u = tslib_1.__importStar(require("@virtuoso.dev/urx"));
|
|
5
5
|
var domIOSystem_1 = require("./domIOSystem");
|
|
6
6
|
exports.windowScrollerSystem = u.system(function (_a) {
|
|
7
|
-
var _b = tslib_1.__read(_a, 1), _c = _b[0],
|
|
7
|
+
var _b = tslib_1.__read(_a, 1), _c = _b[0], scrollTo = _c.scrollTo, scrollContainerState = _c.scrollContainerState;
|
|
8
|
+
var windowScrollContainerState = u.stream();
|
|
8
9
|
var windowViewportRect = u.stream();
|
|
9
|
-
var windowScrollTop = u.stream();
|
|
10
10
|
var windowScrollTo = u.stream();
|
|
11
11
|
var useWindowScroll = u.statefulStream(false);
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
var customScrollParent = u.statefulStream(undefined);
|
|
13
|
+
u.connect(u.pipe(u.combineLatest(windowScrollContainerState, windowViewportRect), u.map(function (_a) {
|
|
14
|
+
var _b = tslib_1.__read(_a, 2), _c = tslib_1.__read(_b[0], 2), windowScrollTop = _c[0], scrollHeight = _c[1], offsetTop = _b[1].offsetTop;
|
|
15
|
+
return [Math.max(0, windowScrollTop - offsetTop), scrollHeight];
|
|
16
|
+
})), scrollContainerState);
|
|
16
17
|
u.connect(u.pipe(scrollTo, u.withLatestFrom(windowViewportRect), u.map(function (_a) {
|
|
17
18
|
var _b = tslib_1.__read(_a, 2), scrollTo = _b[0], offsetTop = _b[1].offsetTop;
|
|
18
19
|
return tslib_1.__assign(tslib_1.__assign({}, scrollTo), { top: scrollTo.top + offsetTop });
|
|
@@ -20,8 +21,9 @@ exports.windowScrollerSystem = u.system(function (_a) {
|
|
|
20
21
|
return {
|
|
21
22
|
// config
|
|
22
23
|
useWindowScroll: useWindowScroll,
|
|
24
|
+
customScrollParent: customScrollParent,
|
|
23
25
|
// input
|
|
24
|
-
|
|
26
|
+
windowScrollContainerState: windowScrollContainerState,
|
|
25
27
|
windowViewportRect: windowViewportRect,
|
|
26
28
|
// signals
|
|
27
29
|
windowScrollTo: windowScrollTo,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __assign, __makeTemplateObject, __rest } from "tslib";
|
|
2
|
-
import React, { forwardRef, memo } from 'react';
|
|
2
|
+
import React, { forwardRef, memo, useMemo } from 'react';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
|
-
import { combineProps, styled, useDeprecatedCheck, useTheme, useThemeProps, } from '../../../foundation';
|
|
4
|
+
import { combineProps, styled, useDeprecatedCheck, useTheme, useThemeProps, combineClasses, } from '../../../foundation';
|
|
5
5
|
import { RcIcon } from '../../Icon';
|
|
6
6
|
import { RcTooltip, withTooltip } from '../../Tooltip';
|
|
7
7
|
import { RcButtonBase } from '../ButtonBase';
|
|
@@ -15,20 +15,23 @@ var _RcIconButton = memo(forwardRef(function (inProps, ref) {
|
|
|
15
15
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
16
16
|
useDeprecatedCheck(RcIconButton, props, rcIconButtonWarning);
|
|
17
17
|
}
|
|
18
|
-
var _b = props.buttonRef, buttonRef = _b === void 0 ? ref : _b, className = props.className,
|
|
18
|
+
var _b = props.buttonRef, buttonRef = _b === void 0 ? ref : _b, IconProps = props.IconProps, className = props.className, classesProp = props.classes, children = props.children, title = props.title, disabledFakeBorder = props.disabledFakeBorder, symbol = props.symbol, disabled = props.disabled, invisible = props.invisible, type = props.type, loading = props.loading, TouchRippleProps = props.TouchRippleProps, variant = props.variant, CircularProgressProps = props.CircularProgressProps, color = props.color, shouldPersistBg = props.shouldPersistBg, stretchIcon = props.stretchIcon, iconColor = props.iconColor, iconSize = props.iconSize, disableTouchRipple = props.disableTouchRipple, useColorWhenDisabled = props.useColorWhenDisabled, size = props.size, radius = props.radius, elevation = props.elevation, activeElevation = props.activeElevation, aRef = props.aRef, tooltipTitle = props.tooltipTitle, tooltipForceHide = props.tooltipForceHide, disableToolTip = props.disableToolTip, alwaysEnableTooltip = props.alwaysEnableTooltip, tooltipPlacement = props.tooltipPlacement, ariaLabel = props.ariaLabel, popperProps = props.popperProps, externalLink = props.externalLink, download = props.download, autoFocus = props.autoFocus, href = props.href, rest = __rest(props, ["buttonRef", "IconProps", "className", "classes", "children", "title", "disabledFakeBorder", "symbol", "disabled", "invisible", "type", "loading", "TouchRippleProps", "variant", "CircularProgressProps", "color", "shouldPersistBg", "stretchIcon", "iconColor", "iconSize", "disableTouchRipple", "useColorWhenDisabled", "size", "radius", "elevation", "activeElevation", "aRef", "tooltipTitle", "tooltipForceHide", "disableToolTip", "alwaysEnableTooltip", "tooltipPlacement", "ariaLabel", "popperProps", "externalLink", "download", "autoFocus", "href"]);
|
|
19
19
|
var theme = useTheme();
|
|
20
20
|
var isOutline = variant === 'outline';
|
|
21
21
|
var isContained = variant === 'contained';
|
|
22
|
+
var isInverse = variant === 'inverse';
|
|
22
23
|
var isPlain = variant === 'plain';
|
|
23
|
-
var
|
|
24
|
-
|
|
25
|
-
_a[
|
|
26
|
-
_a[
|
|
27
|
-
_a[
|
|
24
|
+
var classes = useMemo(function () { return combineClasses(RcIconButtonClasses, classesProp); }, [classesProp]);
|
|
25
|
+
var IconClassName = clsx(className, classes.root, (_a = {},
|
|
26
|
+
_a[classes.disabled] = disabled,
|
|
27
|
+
_a[classes.invisible] = invisible,
|
|
28
|
+
_a[classes.outline] = isOutline,
|
|
29
|
+
_a[classes.contained] = isContained,
|
|
30
|
+
_a[classes.inverse] = isInverse,
|
|
28
31
|
_a));
|
|
29
32
|
var iconButton = (function () {
|
|
30
33
|
var _a, _b;
|
|
31
|
-
var icon = React.isValidElement(children) || children === '' ? children : (React.createElement(RcIcon, { symbol: symbol, className: classes.icon, loading: loading, CircularProgressProps: CircularProgressProps }, children));
|
|
34
|
+
var icon = React.isValidElement(children) || children === '' ? children : (React.createElement(RcIcon, __assign({ symbol: symbol, className: classes.icon, loading: loading, CircularProgressProps: CircularProgressProps }, IconProps), children));
|
|
32
35
|
var iconButton = (React.createElement(RcButtonBase, __assign({ ref: buttonRef, disableRipple: ((_b = (_a = theme.props) === null || _a === void 0 ? void 0 : _a.MuiButtonBase) === null || _b === void 0 ? void 0 : _b.disableRipple) || isPlain, type: type, disabled: disabled, "aria-label": ariaLabel || tooltipTitle || title, title: title, "aria-disabled": disabled, className: IconClassName, TouchRippleProps: combineProps({
|
|
33
36
|
classes: RcIconButtonTouchRippleClasses,
|
|
34
37
|
}, TouchRippleProps) }, rest), icon));
|
|
@@ -55,7 +58,6 @@ RcIconButton.defaultProps = {
|
|
|
55
58
|
type: 'button',
|
|
56
59
|
focusRipple: true,
|
|
57
60
|
disableTouchRipple: true,
|
|
58
|
-
centerRipple: true,
|
|
59
61
|
classes: {},
|
|
60
62
|
useRcTooltip: true,
|
|
61
63
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __makeTemplateObject } from "tslib";
|
|
2
|
-
import { backgroundTransition, css, focusVisible, focusVisibleColor, getParsePaletteColor, nonTouchHoverMedia, palette2, paletteContrastText, px, radius, setOpacity, shadows, } from '../../../../foundation';
|
|
2
|
+
import { backgroundTransition, css, focusVisible, focusVisibleColor, getParsePaletteColor, nonTouchHoverMedia, palette2, paletteContrastText, px, radius, setOpacity, shadows, fakeBorder, } from '../../../../foundation';
|
|
3
3
|
import { RcIcon } from '../../../Icon';
|
|
4
4
|
import { RcIconButtonClasses, RcIconButtonFocusVisibleInsetSize, RcIconButtonSizes, RcIconButtonTouchRippleClasses, } from '../utils';
|
|
5
5
|
export var getFocusVisibleInsetSize = function (_a) {
|
|
@@ -20,7 +20,7 @@ export var plainIconButtonFocusStyle = function (_a) {
|
|
|
20
20
|
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n &:after {\n content: '';\n position: absolute;\n ", ";\n box-shadow: 0 0 0 1px ", ";\n border-radius: ", ";\n pointer-events: none;\n z-index: 1;\n }\n"], ["\n &:after {\n content: '';\n position: absolute;\n ", ";\n box-shadow: 0 0 0 1px ", ";\n border-radius: ", ";\n pointer-events: none;\n z-index: 1;\n }\n"])), getFocusVisibleInsetSize, focusVisibleColor, radius(radiusProp));
|
|
21
21
|
};
|
|
22
22
|
export var iconButtonStyle = function (_a) {
|
|
23
|
-
var variant = _a.variant, size = _a.size, stretchIcon = _a.stretchIcon, color = _a.color, disabled = _a.disabled, useColorWhenDisabled = _a.useColorWhenDisabled, shouldPersistBg = _a.shouldPersistBg, radiusProp = _a.radius, elevation = _a.elevation, activeElevation = _a.activeElevation;
|
|
23
|
+
var variant = _a.variant, size = _a.size, stretchIcon = _a.stretchIcon, color = _a.color, disabled = _a.disabled, useColorWhenDisabled = _a.useColorWhenDisabled, shouldPersistBg = _a.shouldPersistBg, radiusProp = _a.radius, disableRipple = _a.disableRipple, elevation = _a.elevation, disabledFakeBorder = _a.disabledFakeBorder, activeElevation = _a.activeElevation;
|
|
24
24
|
var iconSize = RcIconButtonSizes[size];
|
|
25
25
|
var isCircle = ['plain', 'round', 'inverse', 'contained'].includes(variant);
|
|
26
26
|
var isPlain = variant === 'plain';
|
|
@@ -34,19 +34,27 @@ export var iconButtonStyle = function (_a) {
|
|
|
34
34
|
var persistBgColor = setOpacity(mainColor, isInverse ? '16' : '12');
|
|
35
35
|
var defaultShadow = isContained ? shadows('1') : undefined;
|
|
36
36
|
var nowShadow = elevation !== undefined ? shadows(elevation) : defaultShadow;
|
|
37
|
-
|
|
37
|
+
var radiusValue = radius(currRadius);
|
|
38
|
+
var contrastColorBorder = !disabledFakeBorder &&
|
|
39
|
+
fakeBorder({
|
|
40
|
+
color: palette2('highContrast'),
|
|
41
|
+
radius: currRadius,
|
|
42
|
+
pseudo: true,
|
|
43
|
+
});
|
|
44
|
+
return css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n display: inline-flex;\n justify-content: center;\n align-items: center;\n\n width: ", ";\n height: ", ";\n color: ", ";\n border-radius: ", ";\n transition: ", ";\n cursor: ", ";\n background-color: ", ";\n box-shadow: ", ";\n\n ", ";\n\n ", " {\n font-size: ", ";\n }\n\n ", " {\n &:hover {\n background-color: ", ";\n\n ", " {\n color: ", ";\n }\n }\n }\n\n &:active {\n ", " {\n color: ", ";\n }\n }\n\n ", " {\n background-color: ", ";\n\n &:active {\n ", " {\n color: ", ";\n }\n }\n\n ", ";\n }\n\n &.", " {\n background-color: ", ";\n }\n\n &.", " {\n ", " {\n color: ", ";\n }\n\n background-color: ", ";\n }\n\n &.", " {\n opacity: 0;\n visibility: hidden;\n width: 0;\n height: 0;\n }\n\n &.", " {\n border: 1px solid ", ";\n }\n\n &.", " {\n color: ", ";\n background-color: ", ";\n\n &:before {\n content: '';\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n width: 100%;\n height: 100%;\n border-radius: ", ";\n position: absolute;\n }\n\n ", ";\n\n ", " {\n &:hover {\n &:before {\n background-color: ", ";\n }\n\n ", " {\n color: ", ";\n }\n }\n }\n\n ", " {\n &:before {\n background-color: ", ";\n }\n\n ", " {\n color: ", ";\n }\n }\n\n &:active {\n ", "\n\n ", " {\n color: ", ";\n }\n }\n }\n\n &.", " {\n ", ";\n }\n\n .", " {\n border-radius: 0;\n animation-name: none;\n opacity: 0;\n }\n\n ", "\n "], ["\n display: inline-flex;\n justify-content: center;\n align-items: center;\n\n width: ", ";\n height: ", ";\n color: ", ";\n border-radius: ", ";\n transition: ", ";\n cursor: ", ";\n background-color: ", ";\n box-shadow: ", ";\n\n ",
|
|
38
45
|
";\n\n ", " {\n font-size: ",
|
|
39
46
|
";\n }\n\n ", " {\n &:hover {\n background-color: ",
|
|
40
47
|
";\n\n ", " {\n color: ", ";\n }\n }\n }\n\n &:active {\n ", " {\n color: ", ";\n }\n }\n\n ", " {\n background-color: ",
|
|
41
48
|
";\n\n &:active {\n ", " {\n color: ", ";\n }\n }\n\n ", ";\n }\n\n &.", " {\n background-color: ", ";\n }\n\n &.", " {\n ", " {\n color: ",
|
|
42
|
-
";\n }\n\n background-color: ", ";\n }\n\n &.", " {\n opacity: 0;\n visibility: hidden;\n width: 0;\n height: 0;\n }\n\n &.", " {\n border: 1px solid ", ";\n }\n\n &.", " {\n color: ", ";\n background-color: ", ";\n\n
|
|
49
|
+
";\n }\n\n background-color: ", ";\n }\n\n &.", " {\n opacity: 0;\n visibility: hidden;\n width: 0;\n height: 0;\n }\n\n &.", " {\n border: 1px solid ", ";\n }\n\n &.", " {\n color: ", ";\n background-color: ", ";\n\n &:before {\n content: '';\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n width: 100%;\n height: 100%;\n border-radius: ", ";\n position: absolute;\n }\n\n ", ";\n\n ", " {\n &:hover {\n &:before {\n background-color: ", ";\n }\n\n ", " {\n color: ", ";\n }\n }\n }\n\n ", " {\n &:before {\n background-color: ", ";\n }\n\n ", " {\n color: ", ";\n }\n }\n\n &:active {\n ",
|
|
50
|
+
"\n\n ", " {\n color: ", ";\n }\n }\n }\n\n &.", " {\n ", ";\n }\n\n .", " {\n border-radius: 0;\n animation-name: none;\n opacity: 0;\n }\n\n "
|
|
43
51
|
/**
|
|
44
52
|
* that is equilateral triangle, the third Side length is
|
|
45
53
|
* Math.sqrt(2) = 1.414213562373095, so we scale that
|
|
46
54
|
* to make that full with this square
|
|
47
55
|
*/
|
|
48
56
|
,
|
|
49
|
-
"\n "])), containerSize, containerSize, mainColor,
|
|
57
|
+
"\n "])), containerSize, containerSize, mainColor, radiusValue, backgroundTransition, disabled ? 'default' : 'pointer', (shouldPersistBg || isInverse) && persistBgColor, nowShadow, nowShadow && css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n transition: ", ";\n\n &:active {\n box-shadow: ", ";\n }\n "], ["\n transition: ", ";\n\n &:active {\n box-shadow: ",
|
|
50
58
|
";\n }\n "])), containedVariantTransitions, shadows(activeElevation !== null && activeElevation !== void 0 ? activeElevation : (elevation ? Math.min(+elevation + 11, 24) : '12'))), childrenClass, stretchIcon
|
|
51
59
|
? containerSize
|
|
52
60
|
: px(isOutline
|
|
@@ -57,13 +65,13 @@ export var iconButtonStyle = function (_a) {
|
|
|
57
65
|
? 'transparent'
|
|
58
66
|
: setOpacity(mainColor, isInverse ? '32' : '16'), childrenClass, setOpacity(mainColor, '88'), isPlain && plainIconButtonFocusStyle({ radius: currRadius }), RcIconButtonClasses.persistBg, persistBgColor, RcIconButtonClasses.disabled, childrenClass, useColorWhenDisabled
|
|
59
67
|
? setOpacity(mainColor, '32')
|
|
60
|
-
: palette2('disabled', 'f02'), isInverse && setOpacity(mainColor, '12'), RcIconButtonClasses.invisible, RcIconButtonClasses.outline, palette2('neutral', 'l03'), RcIconButtonClasses.contained, mainColorContrast, mainColor, nonTouchHoverMedia, setOpacity(
|
|
68
|
+
: palette2('disabled', 'f02'), isInverse && setOpacity(mainColor, '12'), RcIconButtonClasses.invisible, RcIconButtonClasses.outline, palette2('neutral', 'l03'), RcIconButtonClasses.contained, mainColorContrast, mainColor, radiusValue, contrastColorBorder, nonTouchHoverMedia, setOpacity(mainColorContrast, '08'), childrenClass, mainColorContrast, focusVisible, setOpacity(mainColorContrast, '16'), childrenClass, mainColorContrast, disableRipple && css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n &:before {\n background-color: ", ";\n }\n "], ["\n &:before {\n background-color: ", ";\n }\n "])), setOpacity(mainColorContrast, '24')), childrenClass, mainColorContrast, RcIconButtonClasses.inverse, contrastColorBorder, RcIconButtonTouchRippleClasses.ripplePulsate,
|
|
61
69
|
/**
|
|
62
70
|
* that is equilateral triangle, the third Side length is
|
|
63
71
|
* Math.sqrt(2) = 1.414213562373095, so we scale that
|
|
64
72
|
* to make that full with this square
|
|
65
73
|
*/
|
|
66
74
|
!isPlain &&
|
|
67
|
-
!['circle', 'round'].includes(currRadius) && css(
|
|
75
|
+
!['circle', 'round'].includes(currRadius) && css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n .", " {\n transform: scale(1.41421357);\n }\n "], ["\n .", " {\n transform: scale(1.41421357);\n }\n "])), RcIconButtonTouchRippleClasses.child));
|
|
68
76
|
};
|
|
69
|
-
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
|
|
77
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import { omit, RcClasses } from '../../../../foundation';
|
|
2
2
|
import { RcIconSizes } from '../../../Icon/utils';
|
|
3
|
-
export var RcIconButtonClasses = RcClasses([
|
|
3
|
+
export var RcIconButtonClasses = RcClasses([
|
|
4
|
+
'root',
|
|
5
|
+
'disabled',
|
|
6
|
+
'invisible',
|
|
7
|
+
'outline',
|
|
8
|
+
'contained',
|
|
9
|
+
'inverse',
|
|
10
|
+
'persistBg',
|
|
11
|
+
], 'RcIconButton');
|
|
4
12
|
export var RcIconButtonTouchRippleClasses = RcClasses(['ripplePulsate', 'child'], 'RcIconButtonTouchRipple');
|
|
5
13
|
export var RcIconButtonSizes = omit(RcIconSizes, ['inherit']);
|
|
6
14
|
export var RcIconButtonFocusVisibleInsetSize = {
|
|
@@ -10,17 +10,17 @@ import { ACCEPTABLE_KEYS, DIALER_PAD_ICONS, DIALER_PAD_PLUS, useKeyAudio, } from
|
|
|
10
10
|
var DEBOUNCE_TIME = 30;
|
|
11
11
|
var _RcDialPad = forwardRef(function (inProps, ref) {
|
|
12
12
|
var props = useThemeProps({ props: inProps, name: 'RcDialPad' });
|
|
13
|
-
var sounds = props.sounds, volume = props.volume, muted = props.muted, classes = props.classes, onChangeProp = props.onChange, longPressDelay = props.longPressDelay, action = props.action, persistBgTime = props.persistBgTime, control = props.control, getDialPadButtonProps = props.getDialPadButtonProps, divProps = __rest(props, ["sounds", "volume", "muted", "classes", "onChange", "longPressDelay", "action", "persistBgTime", "control", "getDialPadButtonProps"]);
|
|
13
|
+
var sounds = props.sounds, volume = props.volume, muted = props.muted, classes = props.classes, onChangeProp = props.onChange, longPressDelay = props.longPressDelay, action = props.action, persistBgTime = props.persistBgTime, control = props.control, getDialPadButtonProps = props.getDialPadButtonProps, _a = props.externalWindow, externalWindow = _a === void 0 ? window : _a, divProps = __rest(props, ["sounds", "volume", "muted", "classes", "onChange", "longPressDelay", "action", "persistBgTime", "control", "getDialPadButtonProps", "externalWindow"]);
|
|
14
14
|
var containerRef = useRef(null);
|
|
15
15
|
var hiddenRef = useRef(null);
|
|
16
16
|
var keyTimerMapRef = useRef({});
|
|
17
17
|
var forkRef = useForkRef(containerRef, ref);
|
|
18
|
-
var
|
|
18
|
+
var _b = useRcDialerContext(), onInsertRef = _b.onInsertRef, dialPadActionRef = _b.dialPadActionRef;
|
|
19
19
|
var focusedIndexRef = useRef(0);
|
|
20
|
-
var
|
|
20
|
+
var _c = useOnlyOneFocusable({
|
|
21
21
|
focusedIndexRef: focusedIndexRef,
|
|
22
22
|
containerRef: containerRef,
|
|
23
|
-
}), focusIndex =
|
|
23
|
+
}), focusIndex = _c.focusIndex, getItemProps = _c.getItemProps, moveFocusedId = _c.moveFocusedId;
|
|
24
24
|
var dialButtonKey = moveFocusedId + "-dial-button";
|
|
25
25
|
var onKeyFocusedIndexHandle = useKeyboardMoveFocus({
|
|
26
26
|
options: DIALER_PAD_ICONS,
|
|
@@ -64,11 +64,11 @@ var _RcDialPad = forwardRef(function (inProps, ref) {
|
|
|
64
64
|
var handleKeyboardEffect = useDebounce(function (value, isKeyup) {
|
|
65
65
|
var _a, _b;
|
|
66
66
|
if (isKeyup) {
|
|
67
|
-
handleChange(value, '
|
|
67
|
+
handleChange(value, 'customKeyboard');
|
|
68
68
|
var toIndex = ACCEPTABLE_KEYS.findIndex(function (x) { return x === value; });
|
|
69
69
|
focusedIndexRef.current = toIndex;
|
|
70
70
|
// * mean that current focus on that dialPad, move focus to dialPad container
|
|
71
|
-
if (((_a = document.activeElement) === null || _a === void 0 ? void 0 : _a.getAttribute(dialButtonKey)) !== null) {
|
|
71
|
+
if (((_a = externalWindow.document.activeElement) === null || _a === void 0 ? void 0 : _a.getAttribute(dialButtonKey)) !== null) {
|
|
72
72
|
(_b = hiddenRef.current) === null || _b === void 0 ? void 0 : _b.focus();
|
|
73
73
|
}
|
|
74
74
|
}
|
|
@@ -8,9 +8,9 @@ import { DialTextFieldStyle } from './styles';
|
|
|
8
8
|
import { getDialPadValueOnlyRegex, useFixedEndSelection } from './utils';
|
|
9
9
|
var _RcDialTextField = forwardRef(function (inProps, ref) {
|
|
10
10
|
var props = useThemeProps({ props: inProps, name: 'RcDialTextField' });
|
|
11
|
-
var children = props.children, value = props.value, onChange = props.onChange, onEmit = props.onEmit, onKeyPress = props.onKeyPress, onKeyDown = props.onKeyDown, onKeyUp = props.onKeyUp, inputRefProp = props.inputRef, inputPropsProp = props.inputProps, InputPropsProp = props.InputProps, onlyAllowKeypadValue = props.onlyAllowKeypadValue, keypadMode = props.keypadMode, rest = __rest(props, ["children", "value", "onChange", "onEmit", "onKeyPress", "onKeyDown", "onKeyUp", "inputRef", "inputProps", "InputProps", "onlyAllowKeypadValue", "keypadMode"]);
|
|
11
|
+
var children = props.children, value = props.value, onChange = props.onChange, onEmit = props.onEmit, onKeyPress = props.onKeyPress, onKeyDown = props.onKeyDown, onKeyUp = props.onKeyUp, inputRefProp = props.inputRef, inputPropsProp = props.inputProps, InputPropsProp = props.InputProps, onlyAllowKeypadValue = props.onlyAllowKeypadValue, keypadMode = props.keypadMode, _a = props.externalWindow, externalWindow = _a === void 0 ? window : _a, rest = __rest(props, ["children", "value", "onChange", "onEmit", "onKeyPress", "onKeyDown", "onKeyUp", "inputRef", "inputProps", "InputProps", "onlyAllowKeypadValue", "keypadMode", "externalWindow"]);
|
|
12
12
|
var dialerContext = useRcDialerContext();
|
|
13
|
-
var
|
|
13
|
+
var _b = useFixedEndSelection(), inputRef = _b.ref, onKeypadModeFocus = _b.onFocus, onKeypadModeKeyDown = _b.onKeyDown, onKeypadModeClick = _b.onClick;
|
|
14
14
|
var forkContextRef = useForkRef(dialerContext.inputRef, inputRef);
|
|
15
15
|
var forkInputRef = useForkRef(inputRefProp, forkContextRef);
|
|
16
16
|
var scrollToPositionRef = useRef();
|
|
@@ -18,7 +18,7 @@ var _RcDialTextField = forwardRef(function (inProps, ref) {
|
|
|
18
18
|
var maxLength = keypadMode ? undefined : inputPropsProp === null || inputPropsProp === void 0 ? void 0 : inputPropsProp.maxLength;
|
|
19
19
|
var checkNotReFocus = useEventCallback(function (reason, isFocus) {
|
|
20
20
|
var elm = inputRef.current;
|
|
21
|
-
var isInputFocus = isFocus !== null && isFocus !== void 0 ? isFocus : document.activeElement === elm;
|
|
21
|
+
var isInputFocus = isFocus !== null && isFocus !== void 0 ? isFocus : externalWindow.document.activeElement === elm;
|
|
22
22
|
if (reason !== 'click' && !isInputFocus) {
|
|
23
23
|
// ! both keydown and touch, only when focus need re-focus
|
|
24
24
|
isNotTriggerRefocusRef.current = true;
|
|
@@ -42,7 +42,7 @@ var _RcDialTextField = forwardRef(function (inProps, ref) {
|
|
|
42
42
|
useImperativeHandle(dialerContext.onDeleteRef, function () { return function (e, reason) {
|
|
43
43
|
var elm = inputRef.current;
|
|
44
44
|
if (elm && (value === null || value === void 0 ? void 0 : value.length)) {
|
|
45
|
-
var isFocus = document.activeElement === elm;
|
|
45
|
+
var isFocus = externalWindow.document.activeElement === elm;
|
|
46
46
|
var toPosition = void 0;
|
|
47
47
|
var toValue = void 0;
|
|
48
48
|
if (isFocus) {
|
|
@@ -71,14 +71,14 @@ var _RcDialTextField = forwardRef(function (inProps, ref) {
|
|
|
71
71
|
onChange === null || onChange === void 0 ? void 0 : onChange(toValue);
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
|
-
}; }, [checkNotReFocus, inputRef, onChange, value]);
|
|
74
|
+
}; }, [checkNotReFocus, externalWindow, inputRef, onChange, value]);
|
|
75
75
|
/**
|
|
76
76
|
* outside change value via this method, with check current input state
|
|
77
77
|
*/
|
|
78
78
|
useImperativeHandle(dialerContext.onInsertRef, function () { return function (addValue, reason) {
|
|
79
79
|
var elm = inputRef.current;
|
|
80
80
|
if (elm) {
|
|
81
|
-
var isFocus = document.activeElement === elm;
|
|
81
|
+
var isFocus = externalWindow.document.activeElement === elm;
|
|
82
82
|
var toPosition = void 0;
|
|
83
83
|
var toValue = void 0;
|
|
84
84
|
// * when keypadMode also add value at latest
|
|
@@ -104,6 +104,7 @@ var _RcDialTextField = forwardRef(function (inProps, ref) {
|
|
|
104
104
|
}
|
|
105
105
|
}; }, [
|
|
106
106
|
checkNotReFocus,
|
|
107
|
+
externalWindow,
|
|
107
108
|
inputRef,
|
|
108
109
|
keypadMode,
|
|
109
110
|
maxLength,
|
|
@@ -6,7 +6,7 @@ import { TableCellStyle } from './styles';
|
|
|
6
6
|
import { RcTableCellClasses } from './utils';
|
|
7
7
|
import { RcButtonBase } from '../../Buttons';
|
|
8
8
|
import { RcIcon } from '../../Icon';
|
|
9
|
-
import { JumpToLatest as
|
|
9
|
+
import { JumpToLatest as DescSortIcon, JumpToUnread as AscSortIcon, } from '@ringcentral/juno-icon';
|
|
10
10
|
import clsx from 'clsx';
|
|
11
11
|
import { RcTableContext } from '../context';
|
|
12
12
|
var _RcTableCell = forwardRef(function (props, ref) {
|
|
@@ -21,7 +21,7 @@ var _RcTableCell = forwardRef(function (props, ref) {
|
|
|
21
21
|
_a[classes.activeSort] = activeSort,
|
|
22
22
|
_a)) },
|
|
23
23
|
childrenProp,
|
|
24
|
-
React.createElement(RcIcon, { size: "small", className: classes.sortIcon, symbol: sortDirection === 'asc' ?
|
|
24
|
+
React.createElement(RcIcon, { size: "small", className: classes.sortIcon, symbol: sortDirection === 'asc' ? AscSortIcon : DescSortIcon })));
|
|
25
25
|
}
|
|
26
26
|
return childrenProp;
|
|
27
27
|
}, [activeSort, childrenProp, classes, sortDirection]);
|
|
@@ -2,12 +2,14 @@ import { __makeTemplateObject } from "tslib";
|
|
|
2
2
|
import { css, fakeBorder, focusVisible, palette2, px, spacing, typography, } from '../../../../foundation';
|
|
3
3
|
import { RcTableCellClasses } from '../utils';
|
|
4
4
|
var SizeMap = {
|
|
5
|
+
xlarge: 64,
|
|
5
6
|
large: 56,
|
|
6
7
|
medium: 48,
|
|
7
8
|
small: 40,
|
|
8
9
|
};
|
|
10
|
+
var HeadTypography = typography('caption2');
|
|
9
11
|
export var TableCellStyle = function (prop) {
|
|
10
12
|
var size = prop.size, sortDirection = prop.sortDirection;
|
|
11
|
-
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n box-sizing: border-box;\n padding: ", ";\n min-width: 96px;\n\n &.", " {\n min-width: unset;\n padding: ", ";\n }\n\n &.", " {\n padding: unset;\n }\n\n &.", " {\n ", "\n height: 40px;\n border-bottom: 1px solid ", ";\n color: ", ";\n background-color: ", ";\n\n padding: ", ";\n\n .", " {\n opacity: 0;\n padding: ", ";\n }\n\n .", " {\n color: ", ";\n\n .", " {\n opacity: 1;\n color: ", ";\n }\n }\n\n .", " {\n display: inline-flex;\n justify-content: flex-start;\n flex-direction: inherit;\n align-items: center;\n\n height: 100%;\n width: 100%;\n padding: ", ";\n\n ", " {\n color: ", ";\n }\n\n &:hover {\n background-color: ", ";\n\n .", " {\n opacity: 1;\n }\n }\n\n ", " {\n ", "\n background-color: ", ";\n }\n }\n }\n\n &.", " {\n ", "\n color: ", ";\n\n padding: ", ";\n height: ", ";\n }\n "], ["\n box-sizing: border-box;\n padding: ", ";\n min-width: 96px;\n\n &.", " {\n min-width: unset;\n padding: ", ";\n }\n\n &.", " {\n padding: unset;\n }\n\n &.", " {\n ", "\n height: 40px;\n border-bottom: 1px solid ", ";\n color: ", ";\n background-color: ", ";\n\n padding: ", ";\n\n .", " {\n opacity: 0;\n padding: ", ";\n }\n\n .", " {\n color: ", ";\n\n .", " {\n opacity: 1;\n color: ", ";\n }\n }\n\n .", " {\n display: inline-flex;\n justify-content: flex-start;\n flex-direction: inherit;\n align-items: center;\n\n height: 100%;\n width: 100%;\n padding: ", ";\n\n ", " {\n color: ", ";\n }\n\n &:hover {\n background-color: ", ";\n\n .", " {\n opacity: 1;\n }\n }\n\n ", " {\n ", "\n background-color: ", ";\n }\n }\n }\n\n &.", " {\n ", "\n color: ", ";\n\n padding: ", ";\n height: ", ";\n }\n "])), spacing(0, 2), RcTableCellClasses.paddingCheckbox, spacing(0, 0, 0, 2), RcTableCellClasses.paddingNone, RcTableCellClasses.head,
|
|
13
|
+
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n box-sizing: border-box;\n padding: ", ";\n min-width: 96px;\n\n &.", " {\n min-width: unset;\n padding: ", ";\n }\n\n &.", " {\n padding: unset;\n }\n\n &.", " {\n ", "\n height: 40px;\n border-bottom: 1px solid ", ";\n color: ", ";\n background-color: ", ";\n\n padding: ", ";\n\n .", " {\n opacity: 0;\n padding: ", ";\n }\n\n .", " {\n color: ", ";\n\n .", " {\n opacity: 1;\n color: ", ";\n }\n }\n\n .", " {\n ", "\n display: inline-flex;\n justify-content: flex-start;\n flex-direction: inherit;\n align-items: center;\n\n height: 100%;\n width: 100%;\n padding: ", ";\n\n ", " {\n color: ", ";\n }\n\n &:hover {\n background-color: ", ";\n\n .", " {\n opacity: 1;\n }\n }\n\n ", " {\n ", "\n background-color: ", ";\n }\n }\n }\n\n &.", " {\n ", "\n color: ", ";\n\n padding: ", ";\n height: ", ";\n }\n "], ["\n box-sizing: border-box;\n padding: ", ";\n min-width: 96px;\n\n &.", " {\n min-width: unset;\n padding: ", ";\n }\n\n &.", " {\n padding: unset;\n }\n\n &.", " {\n ", "\n height: 40px;\n border-bottom: 1px solid ", ";\n color: ", ";\n background-color: ", ";\n\n padding: ", ";\n\n .", " {\n opacity: 0;\n padding: ", ";\n }\n\n .", " {\n color: ", ";\n\n .", " {\n opacity: 1;\n color: ", ";\n }\n }\n\n .", " {\n ", /** cover user agent stylesheet */ "\n display: inline-flex;\n justify-content: flex-start;\n flex-direction: inherit;\n align-items: center;\n\n height: 100%;\n width: 100%;\n padding: ", ";\n\n ", " {\n color: ", ";\n }\n\n &:hover {\n background-color: ", ";\n\n .", " {\n opacity: 1;\n }\n }\n\n ", " {\n ", "\n background-color: ", ";\n }\n }\n }\n\n &.", " {\n ", "\n color: ", ";\n\n padding: ", ";\n height: ", ";\n }\n "])), spacing(0, 2), RcTableCellClasses.paddingCheckbox, spacing(0, 0, 0, 2), RcTableCellClasses.paddingNone, RcTableCellClasses.head, HeadTypography, palette2('neutral', 'l02'), palette2('neutral', 'f05'), palette2('neutral', 'b02'), Boolean(sortDirection) && 'unset', RcTableCellClasses.sortIcon, spacing(0, 2), RcTableCellClasses.activeSort, palette2('interactive', 'f01'), RcTableCellClasses.sortIcon, palette2('neutral', 'f04'), RcTableCellClasses.sortButton, HeadTypography /** cover user agent stylesheet */, spacing(0, 2), RcTableCellClasses.sortIcon, palette2('neutral', 'f04'), palette2('neutral', 'b03'), RcTableCellClasses.sortIcon, focusVisible, fakeBorder({ color: palette2('interactive', 'f01') }), palette2('neutral', 'b03'), RcTableCellClasses.body, typography('body1'), palette2('neutral', 'f06'), size === 'auto' && spacing(3, 2), size !== 'auto' && px(SizeMap[size]));
|
|
12
14
|
};
|
|
13
15
|
var templateObject_1;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __assign, __makeTemplateObject, __rest } from "tslib";
|
|
2
|
-
import React, { forwardRef, useMemo, useRef } from 'react';
|
|
2
|
+
import React, { forwardRef, useEffect, useMemo, useRef } from 'react';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
|
-
import { combineClasses, combineProps, styled, useEventCallback, useForkRef, useRcPortalWindowContext, useThemeProps, } from '../../foundation';
|
|
4
|
+
import { combineClasses, combineProps, styled, useEventCallback, useForceUpdate, useForkRef, useRcPortalWindowContext, useSleep, useThemeProps, } from '../../foundation';
|
|
5
5
|
import { RcPopover } from '../Popover';
|
|
6
6
|
import { VirtualizedMenuStyle } from './styles';
|
|
7
7
|
import { RcVirtualizedMenuClasses } from './utils';
|
|
@@ -48,6 +48,17 @@ var _RcVirtualizedMenu = forwardRef(function (inProps, ref) {
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
});
|
|
51
|
+
var forceUpdate = useForceUpdate();
|
|
52
|
+
var sleep = useSleep().sleep;
|
|
53
|
+
// TODO: fix that when that work
|
|
54
|
+
useEffect(function () {
|
|
55
|
+
if (open) {
|
|
56
|
+
sleep(200).then(function () {
|
|
57
|
+
forceUpdate();
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
61
|
+
}, [open]);
|
|
51
62
|
return (React.createElement(RcPopover, __assign({ ref: handleRef, container: document.body, classes: PopoverClasses, onClose: onClose, open: open, transitionDuration: transitionDuration, PaperProps: PaperProps, TransitionProps: TransitionProps }, rest),
|
|
52
63
|
React.createElement(RcVirtualizedMenuList, __assign({ position: "unset", action: menuListActionRef, autoFocus: autoFocus, autoFocusItem: autoFocusItem, maxHeight: maxHeight, variant: variant, onKeyDown: handleListKeyDown }, MenuListProps, { className: clsx(classes.list, MenuListProps.className) }), children)));
|
|
53
64
|
});
|
|
@@ -161,8 +161,12 @@ var _RcVirtualizedMenuList = forwardRef(function (inProps, ref) {
|
|
|
161
161
|
},
|
|
162
162
|
}); });
|
|
163
163
|
var components = useMemo(function () { return ({
|
|
164
|
-
Header: disablePadding
|
|
165
|
-
|
|
164
|
+
Header: disablePadding
|
|
165
|
+
? undefined
|
|
166
|
+
: StyledMenuListPadding,
|
|
167
|
+
Footer: disablePadding
|
|
168
|
+
? undefined
|
|
169
|
+
: StyledMenuListPadding,
|
|
166
170
|
List: React.forwardRef(function (_a, listRef) {
|
|
167
171
|
var children = _a.children, listRest = __rest(_a, ["children"]);
|
|
168
172
|
var toRef = useForkRef(handleRef, listRef);
|
|
@@ -132,22 +132,22 @@ function adjust(node) {
|
|
|
132
132
|
}
|
|
133
133
|
throw new Error('Unexpected empty nodes');
|
|
134
134
|
}
|
|
135
|
+
else if (isSingle(node)) {
|
|
136
|
+
return split(clone(node, { lvl: lvl - 1 }));
|
|
137
|
+
}
|
|
138
|
+
else if (!empty(r) && !empty(r.l)) {
|
|
139
|
+
var rl = r.l;
|
|
140
|
+
var rlvl = isSingle(rl) ? r.lvl - 1 : r.lvl;
|
|
141
|
+
return clone(rl, {
|
|
142
|
+
l: clone(node, {
|
|
143
|
+
r: rl.l,
|
|
144
|
+
lvl: lvl - 1,
|
|
145
|
+
}),
|
|
146
|
+
r: split(clone(r, { l: rl.r, lvl: rlvl })),
|
|
147
|
+
lvl: rl.lvl + 1,
|
|
148
|
+
});
|
|
149
|
+
}
|
|
135
150
|
else {
|
|
136
|
-
if (isSingle(node)) {
|
|
137
|
-
return split(clone(node, { lvl: lvl - 1 }));
|
|
138
|
-
}
|
|
139
|
-
if (!empty(r) && !empty(r.l)) {
|
|
140
|
-
var rl = r.l;
|
|
141
|
-
var rlvl = isSingle(rl) ? r.lvl - 1 : r.lvl;
|
|
142
|
-
return clone(rl, {
|
|
143
|
-
l: clone(node, {
|
|
144
|
-
r: rl.l,
|
|
145
|
-
lvl: lvl - 1,
|
|
146
|
-
}),
|
|
147
|
-
r: split(clone(r, { l: rl.r, lvl: rlvl })),
|
|
148
|
-
lvl: rl.lvl + 1,
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
151
|
throw new Error('Unexpected empty nodes');
|
|
152
152
|
}
|
|
153
153
|
}
|