@ringcentral/juno 2.4.1 → 2.4.2
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/Downshift/SuggestionList/SuggestionList.js +4 -1
- package/components/VirtualizedMenu/VirtualizedMenuList.js +1 -12
- package/components/Virtuoso/utils/useHighlightScroll.d.ts +4 -0
- package/components/Virtuoso/utils/useHighlightScroll.js +17 -0
- package/es6/components/Downshift/SuggestionList/SuggestionList.js +5 -2
- package/es6/components/VirtualizedMenu/VirtualizedMenuList.js +3 -14
- package/es6/components/Virtuoso/utils/useHighlightScroll.js +16 -0
- package/es6/foundation/index.js +1 -1
- package/es6/foundation/isWebKit154.js +57 -0
- package/es6/foundation/theme/ThemeProvider.js +4 -4
- package/foundation/index.d.ts +1 -1
- package/foundation/index.js +1 -1
- package/foundation/isWebKit154.d.ts +20 -0
- package/foundation/{isSafari154.js → isWebKit154.js} +22 -17
- package/foundation/theme/ThemeProvider.d.ts +1 -1
- package/foundation/theme/ThemeProvider.js +4 -4
- package/package.json +1 -1
- package/es6/foundation/isSafari154.js +0 -52
- package/foundation/isSafari154.d.ts +0 -15
|
@@ -168,7 +168,10 @@ var SuggestionList = react_1.forwardRef(function (inProps, ref) {
|
|
|
168
168
|
}, [componentsProp, PaddingComponent]);
|
|
169
169
|
return (react_1.default.createElement(SuggestionListContext.Provider, { value: listRef },
|
|
170
170
|
react_1.default.createElement(Virtuoso_1.Virtuoso, tslib_1.__assign({ ref: forkVlRef, totalCount: itemCount, data: itemData, className: className, components: components, itemContent: itemContent }, getMenuProps(), foundation_1.combineProps({
|
|
171
|
-
scrollerRef:
|
|
171
|
+
scrollerRef: function (scrollElm) {
|
|
172
|
+
scrollerRefFn(scrollElm);
|
|
173
|
+
Virtuoso_1.modifyVlScrollerStyle(scrollElm, position);
|
|
174
|
+
},
|
|
172
175
|
itemsRendered: itemsRendered,
|
|
173
176
|
totalListHeightChanged: totalListHeightChanged,
|
|
174
177
|
style: style,
|
|
@@ -180,18 +180,7 @@ var _RcVirtualizedMenuList = react_1.forwardRef(function (inProps, ref) {
|
|
|
180
180
|
[]);
|
|
181
181
|
var combine = foundation_1.combineProps(tslib_1.__assign({ tabIndex: -1, scrollerRef: function (scrollElm) {
|
|
182
182
|
scrollerRefFn(scrollElm);
|
|
183
|
-
|
|
184
|
-
// * Mozilla/5.0 (iPhone; CPU iPhone OS 15_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/100.0.4896.77 Mobile/15E148 Safari/604.1
|
|
185
|
-
// * set that to make safari vl render correctly
|
|
186
|
-
scrollElm.style.transition = foundation_1.fixSafariTransitionStyle;
|
|
187
|
-
if (position) {
|
|
188
|
-
var viewPortElm = scrollElm.firstChild;
|
|
189
|
-
if (viewPortElm) {
|
|
190
|
-
viewPortElm.style.position = position;
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
// resetViewPortStyle
|
|
183
|
+
Virtuoso_1.modifyVlScrollerStyle(scrollElm, position);
|
|
195
184
|
// * when not have scrollerRef mean that is first render
|
|
196
185
|
if (!isMountedRef.current) {
|
|
197
186
|
onMounted();
|
|
@@ -30,4 +30,8 @@ export declare function useHighlightScroll({ containerHeighRef, scrollToIndex, }
|
|
|
30
30
|
*/
|
|
31
31
|
itemsRendered: (e: ListItem<any>[]) => ListItem<any>[];
|
|
32
32
|
};
|
|
33
|
+
/**
|
|
34
|
+
* modify virtuoso style to fix safari scroll bug
|
|
35
|
+
*/
|
|
36
|
+
export declare function modifyVlScrollerStyle(scrollElm: HTMLElement, position?: 'absolute' | 'unset'): void;
|
|
33
37
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var react_1 = require("react");
|
|
4
|
+
var foundation_1 = require("../../../foundation");
|
|
4
5
|
/**
|
|
5
6
|
* scroll into current highlight index
|
|
6
7
|
*/
|
|
@@ -101,3 +102,19 @@ function useHighlightScroll(_a) {
|
|
|
101
102
|
};
|
|
102
103
|
}
|
|
103
104
|
exports.useHighlightScroll = useHighlightScroll;
|
|
105
|
+
/**
|
|
106
|
+
* modify virtuoso style to fix safari scroll bug
|
|
107
|
+
*/
|
|
108
|
+
function modifyVlScrollerStyle(scrollElm, position) {
|
|
109
|
+
if (position === void 0) { position = 'absolute'; }
|
|
110
|
+
if (scrollElm) {
|
|
111
|
+
scrollElm.style.transition = foundation_1.fixWebKitTransitionStyle;
|
|
112
|
+
if (position) {
|
|
113
|
+
var viewPortElm = scrollElm.firstChild;
|
|
114
|
+
if (viewPortElm) {
|
|
115
|
+
viewPortElm.style.position = position;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
exports.modifyVlScrollerStyle = modifyVlScrollerStyle;
|
|
@@ -7,7 +7,7 @@ import { RcBox } from '../../Box';
|
|
|
7
7
|
import { RcIconButton } from '../../Buttons/IconButton';
|
|
8
8
|
import { RcMenuItem } from '../../Menu/MenuItem';
|
|
9
9
|
import { menuListBoundaryPadding, StyledMenuListPadding, } from '../../VirtualizedMenu/styles';
|
|
10
|
-
import { useDynamicHeight, useHighlightScroll, Virtuoso, } from '../../Virtuoso';
|
|
10
|
+
import { modifyVlScrollerStyle, useDynamicHeight, useHighlightScroll, Virtuoso, } from '../../Virtuoso';
|
|
11
11
|
import { SuggestionListStyle } from './styles';
|
|
12
12
|
import { RcSuggestionListClasses } from './utils';
|
|
13
13
|
var SuggestionListContext = createContext(null);
|
|
@@ -166,7 +166,10 @@ var SuggestionList = forwardRef(function (inProps, ref) {
|
|
|
166
166
|
}, [componentsProp, PaddingComponent]);
|
|
167
167
|
return (React.createElement(SuggestionListContext.Provider, { value: listRef },
|
|
168
168
|
React.createElement(Virtuoso, __assign({ ref: forkVlRef, totalCount: itemCount, data: itemData, className: className, components: components, itemContent: itemContent }, getMenuProps(), combineProps({
|
|
169
|
-
scrollerRef:
|
|
169
|
+
scrollerRef: function (scrollElm) {
|
|
170
|
+
scrollerRefFn(scrollElm);
|
|
171
|
+
modifyVlScrollerStyle(scrollElm, position);
|
|
172
|
+
},
|
|
170
173
|
itemsRendered: itemsRendered,
|
|
171
174
|
totalListHeightChanged: totalListHeightChanged,
|
|
172
175
|
style: style,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { __assign, __makeTemplateObject, __rest } from "tslib";
|
|
2
2
|
import React, { forwardRef, useImperativeHandle, useMemo, useRef, } from 'react';
|
|
3
3
|
import { isFragment } from 'react-is';
|
|
4
|
-
import { combineProps,
|
|
4
|
+
import { combineProps, getScrollbarSize, isRcElement, logInDev, styled, useDebounce, useEventCallback, useForkRef, useHiddenTabindex, useKeyboardMoveFocus, useMountState, useOnlyOneFocusable, useRcPortalWindowContext, useTheme, useThemeProps, } from '../../foundation';
|
|
5
5
|
import { RcList } from '../List/List/List';
|
|
6
|
-
import { isOutOfRange, useDynamicHeight, useHighlightScroll, Virtuoso, } from '../Virtuoso';
|
|
6
|
+
import { isOutOfRange, modifyVlScrollerStyle, useDynamicHeight, useHighlightScroll, Virtuoso, } from '../Virtuoso';
|
|
7
7
|
import { RcVisuallyHidden } from '../VisuallyHidden';
|
|
8
8
|
import { StyledMenuListPadding } from './styles';
|
|
9
9
|
var _RcVirtualizedMenuList = forwardRef(function (inProps, ref) {
|
|
@@ -178,18 +178,7 @@ var _RcVirtualizedMenuList = forwardRef(function (inProps, ref) {
|
|
|
178
178
|
[]);
|
|
179
179
|
var combine = combineProps(__assign({ tabIndex: -1, scrollerRef: function (scrollElm) {
|
|
180
180
|
scrollerRefFn(scrollElm);
|
|
181
|
-
|
|
182
|
-
// * Mozilla/5.0 (iPhone; CPU iPhone OS 15_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/100.0.4896.77 Mobile/15E148 Safari/604.1
|
|
183
|
-
// * set that to make safari vl render correctly
|
|
184
|
-
scrollElm.style.transition = fixSafariTransitionStyle;
|
|
185
|
-
if (position) {
|
|
186
|
-
var viewPortElm = scrollElm.firstChild;
|
|
187
|
-
if (viewPortElm) {
|
|
188
|
-
viewPortElm.style.position = position;
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
// resetViewPortStyle
|
|
181
|
+
modifyVlScrollerStyle(scrollElm, position);
|
|
193
182
|
// * when not have scrollerRef mean that is first render
|
|
194
183
|
if (!isMountedRef.current) {
|
|
195
184
|
onMounted();
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useRef } from 'react';
|
|
2
|
+
import { fixWebKitTransitionStyle } from '../../../foundation';
|
|
2
3
|
/**
|
|
3
4
|
* scroll into current highlight index
|
|
4
5
|
*/
|
|
@@ -98,3 +99,18 @@ export function useHighlightScroll(_a) {
|
|
|
98
99
|
itemsRendered: function (e) { return (renderedItemsRef.current = e); },
|
|
99
100
|
};
|
|
100
101
|
}
|
|
102
|
+
/**
|
|
103
|
+
* modify virtuoso style to fix safari scroll bug
|
|
104
|
+
*/
|
|
105
|
+
export function modifyVlScrollerStyle(scrollElm, position) {
|
|
106
|
+
if (position === void 0) { position = 'absolute'; }
|
|
107
|
+
if (scrollElm) {
|
|
108
|
+
scrollElm.style.transition = fixWebKitTransitionStyle;
|
|
109
|
+
if (position) {
|
|
110
|
+
var viewPortElm = scrollElm.firstChild;
|
|
111
|
+
if (viewPortElm) {
|
|
112
|
+
viewPortElm.style.position = position;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
package/es6/foundation/index.js
CHANGED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { __makeTemplateObject } from "tslib";
|
|
2
|
+
import { createGlobalStyle } from 'styled-components';
|
|
3
|
+
import { RcClasses } from './utils/classes';
|
|
4
|
+
import { combineProps } from './utils/combineProps';
|
|
5
|
+
// * this whole file should be remove after webkit154 issue be fixed
|
|
6
|
+
/**
|
|
7
|
+
* Conditionally apply a workaround for the CSS transition bug in Safari 15.4 / WebKit browsers.
|
|
8
|
+
* Remove this workaround once the WebKit bug fix is released.
|
|
9
|
+
*
|
|
10
|
+
* follow up:
|
|
11
|
+
* https://github.com/mui/material-ui/pull/31975/files
|
|
12
|
+
* https://github.com/mui/material-ui/pull/32202/files
|
|
13
|
+
*/
|
|
14
|
+
export var isWebKit154 = typeof navigator !== 'undefined' &&
|
|
15
|
+
/^((?!chrome|android).)*(safari|mobile)/i.test(navigator.userAgent) &&
|
|
16
|
+
/(os |version\/)15(.|_)[4-9]/i.test(navigator.userAgent);
|
|
17
|
+
var FixWebKit154Classes = RcClasses(['paper'], 'RcFixWebKit154');
|
|
18
|
+
/**
|
|
19
|
+
* Conditionally apply a workaround for the CSS transition bug in Safari 15.4.
|
|
20
|
+
* Remove this workaround once the Safari bug is fixed.
|
|
21
|
+
*/
|
|
22
|
+
export var getWebKit154Theme = function (theme, enable) {
|
|
23
|
+
if (enable !== null && enable !== void 0 ? enable : isWebKit154) {
|
|
24
|
+
return combineProps({
|
|
25
|
+
props: {
|
|
26
|
+
// * set all grow related to only have one transition to make animation not shake after safari 15.4
|
|
27
|
+
MuiMenu: {
|
|
28
|
+
PopoverClasses: { paper: FixWebKit154Classes.paper },
|
|
29
|
+
},
|
|
30
|
+
RcVirtualizedMenu: {
|
|
31
|
+
PopoverClasses: { paper: FixWebKit154Classes.paper },
|
|
32
|
+
},
|
|
33
|
+
MuiPopover: {
|
|
34
|
+
PaperProps: { className: FixWebKit154Classes.paper },
|
|
35
|
+
},
|
|
36
|
+
// mui tooltip prop will cover all existing props
|
|
37
|
+
RcTooltip: {
|
|
38
|
+
classes: {
|
|
39
|
+
tooltip: FixWebKit154Classes.paper,
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
// mui grow not accept global prop
|
|
43
|
+
RcGrow: {
|
|
44
|
+
className: FixWebKit154Classes.paper,
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
}, theme);
|
|
48
|
+
}
|
|
49
|
+
return theme;
|
|
50
|
+
};
|
|
51
|
+
export var fixWebKitTransitionStyle = 'all 159ms cubic-bezier(0.4, 0, 0.2, 1) 0ms';
|
|
52
|
+
/**
|
|
53
|
+
* A global style that can be used to
|
|
54
|
+
* apply a workaround for the CSS transition bug after WebKit 15.4.
|
|
55
|
+
*/
|
|
56
|
+
export var GlobalFixWebKitStyle = createGlobalStyle(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n .", " {\n transition: ", " !important;\n }\n"], ["\n .", " {\n transition: ", " !important;\n }\n"])), FixWebKit154Classes.paper, fixWebKitTransitionStyle);
|
|
57
|
+
var templateObject_1;
|
|
@@ -3,7 +3,7 @@ import 'focus-visible';
|
|
|
3
3
|
import React, { createContext, useContext, } from 'react';
|
|
4
4
|
import { createGenerateClassName, MuiThemeProvider, StylesProvider, } from '@material-ui/core/styles';
|
|
5
5
|
import { useResultRef } from '../hooks';
|
|
6
|
-
import {
|
|
6
|
+
import { getWebKit154Theme, GlobalFixWebKitStyle, isWebKit154, } from '../isWebKit154';
|
|
7
7
|
import { ThemeProvider as StyledThemeProvider, useTheme, } from '../styled-components';
|
|
8
8
|
import createTheme from './createTheme';
|
|
9
9
|
var NestedThemeContext = createContext(false);
|
|
@@ -13,16 +13,16 @@ var NestedThemeContext = createContext(false);
|
|
|
13
13
|
* that will user parent's theme when not set theme
|
|
14
14
|
*/
|
|
15
15
|
var SubThemeProvider = function (_a) {
|
|
16
|
-
var themeProp = _a.theme, children = _a.children,
|
|
16
|
+
var themeProp = _a.theme, children = _a.children, fixWebKit154 = _a.fixWebKit154;
|
|
17
17
|
var _b, _c;
|
|
18
18
|
var parentTheme = useTheme();
|
|
19
19
|
var isHaveParentRcTheme = (_c = (_b = parentTheme.palette) === null || _b === void 0 ? void 0 : _b.content) === null || _c === void 0 ? void 0 : _c.brand;
|
|
20
20
|
// TODO: can be remove after safari fix that bug, maybe after v16
|
|
21
|
-
var theme =
|
|
21
|
+
var theme = getWebKit154Theme(!themeProp && isHaveParentRcTheme ? parentTheme : createTheme(themeProp), fixWebKit154);
|
|
22
22
|
return (React.createElement(MuiThemeProvider, { theme: theme },
|
|
23
23
|
React.createElement(StyledThemeProvider, { theme: theme },
|
|
24
24
|
React.createElement(React.Fragment, null,
|
|
25
|
-
(
|
|
25
|
+
(fixWebKit154 !== null && fixWebKit154 !== void 0 ? fixWebKit154 : isWebKit154) && React.createElement(GlobalFixWebKitStyle, null),
|
|
26
26
|
children))));
|
|
27
27
|
};
|
|
28
28
|
/**
|
package/foundation/index.d.ts
CHANGED
package/foundation/index.js
CHANGED
|
@@ -4,7 +4,7 @@ var tslib_1 = require("tslib");
|
|
|
4
4
|
var styled_components_1 = tslib_1.__importDefault(require("./styled-components"));
|
|
5
5
|
exports.styled = styled_components_1.default;
|
|
6
6
|
tslib_1.__exportStar(require("./config"), exports);
|
|
7
|
-
tslib_1.__exportStar(require("./
|
|
7
|
+
tslib_1.__exportStar(require("./isWebKit154"), exports);
|
|
8
8
|
tslib_1.__exportStar(require("./contexts"), exports);
|
|
9
9
|
tslib_1.__exportStar(require("./hoc"), exports);
|
|
10
10
|
tslib_1.__exportStar(require("./hooks"), exports);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Conditionally apply a workaround for the CSS transition bug in Safari 15.4 / WebKit browsers.
|
|
3
|
+
* Remove this workaround once the WebKit bug fix is released.
|
|
4
|
+
*
|
|
5
|
+
* follow up:
|
|
6
|
+
* https://github.com/mui/material-ui/pull/31975/files
|
|
7
|
+
* https://github.com/mui/material-ui/pull/32202/files
|
|
8
|
+
*/
|
|
9
|
+
export declare const isWebKit154: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Conditionally apply a workaround for the CSS transition bug in Safari 15.4.
|
|
12
|
+
* Remove this workaround once the Safari bug is fixed.
|
|
13
|
+
*/
|
|
14
|
+
export declare const getWebKit154Theme: (theme: any, enable?: boolean | undefined) => any;
|
|
15
|
+
export declare const fixWebKitTransitionStyle = "all 159ms cubic-bezier(0.4, 0, 0.2, 1) 0ms";
|
|
16
|
+
/**
|
|
17
|
+
* A global style that can be used to
|
|
18
|
+
* apply a workaround for the CSS transition bug after WebKit 15.4.
|
|
19
|
+
*/
|
|
20
|
+
export declare const GlobalFixWebKitStyle: import("styled-components").GlobalStyleClass<{}, import("styled-components").DefaultTheme>;
|
|
@@ -4,51 +4,56 @@ var tslib_1 = require("tslib");
|
|
|
4
4
|
var styled_components_1 = require("styled-components");
|
|
5
5
|
var classes_1 = require("./utils/classes");
|
|
6
6
|
var combineProps_1 = require("./utils/combineProps");
|
|
7
|
+
// * this whole file should be remove after webkit154 issue be fixed
|
|
7
8
|
/**
|
|
8
|
-
* Conditionally apply a workaround for the CSS transition bug in Safari 15.4.
|
|
9
|
-
* Remove this workaround once the
|
|
9
|
+
* Conditionally apply a workaround for the CSS transition bug in Safari 15.4 / WebKit browsers.
|
|
10
|
+
* Remove this workaround once the WebKit bug fix is released.
|
|
11
|
+
*
|
|
12
|
+
* follow up:
|
|
13
|
+
* https://github.com/mui/material-ui/pull/31975/files
|
|
14
|
+
* https://github.com/mui/material-ui/pull/32202/files
|
|
10
15
|
*/
|
|
11
|
-
exports.
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
var FixSafari154Classes = classes_1.RcClasses(['paper'], 'RcFixSafari154');
|
|
16
|
+
exports.isWebKit154 = typeof navigator !== 'undefined' &&
|
|
17
|
+
/^((?!chrome|android).)*(safari|mobile)/i.test(navigator.userAgent) &&
|
|
18
|
+
/(os |version\/)15(.|_)[4-9]/i.test(navigator.userAgent);
|
|
19
|
+
var FixWebKit154Classes = classes_1.RcClasses(['paper'], 'RcFixWebKit154');
|
|
16
20
|
/**
|
|
17
21
|
* Conditionally apply a workaround for the CSS transition bug in Safari 15.4.
|
|
18
22
|
* Remove this workaround once the Safari bug is fixed.
|
|
19
23
|
*/
|
|
20
|
-
exports.
|
|
21
|
-
if (enable !== null && enable !== void 0 ? enable : exports.
|
|
24
|
+
exports.getWebKit154Theme = function (theme, enable) {
|
|
25
|
+
if (enable !== null && enable !== void 0 ? enable : exports.isWebKit154) {
|
|
22
26
|
return combineProps_1.combineProps({
|
|
23
27
|
props: {
|
|
24
28
|
// * set all grow related to only have one transition to make animation not shake after safari 15.4
|
|
25
29
|
MuiMenu: {
|
|
26
|
-
PopoverClasses: { paper:
|
|
30
|
+
PopoverClasses: { paper: FixWebKit154Classes.paper },
|
|
27
31
|
},
|
|
28
32
|
RcVirtualizedMenu: {
|
|
29
|
-
PopoverClasses: { paper:
|
|
33
|
+
PopoverClasses: { paper: FixWebKit154Classes.paper },
|
|
30
34
|
},
|
|
31
35
|
MuiPopover: {
|
|
32
|
-
PaperProps: { className:
|
|
36
|
+
PaperProps: { className: FixWebKit154Classes.paper },
|
|
33
37
|
},
|
|
34
38
|
// mui tooltip prop will cover all existing props
|
|
35
39
|
RcTooltip: {
|
|
36
40
|
classes: {
|
|
37
|
-
tooltip:
|
|
41
|
+
tooltip: FixWebKit154Classes.paper,
|
|
38
42
|
},
|
|
39
43
|
},
|
|
40
44
|
// mui grow not accept global prop
|
|
41
45
|
RcGrow: {
|
|
42
|
-
className:
|
|
46
|
+
className: FixWebKit154Classes.paper,
|
|
43
47
|
},
|
|
44
48
|
},
|
|
45
49
|
}, theme);
|
|
46
50
|
}
|
|
47
51
|
return theme;
|
|
48
52
|
};
|
|
49
|
-
exports.
|
|
53
|
+
exports.fixWebKitTransitionStyle = 'all 159ms cubic-bezier(0.4, 0, 0.2, 1) 0ms';
|
|
50
54
|
/**
|
|
51
|
-
* A global style that can be used to
|
|
55
|
+
* A global style that can be used to
|
|
56
|
+
* apply a workaround for the CSS transition bug after WebKit 15.4.
|
|
52
57
|
*/
|
|
53
|
-
exports.
|
|
58
|
+
exports.GlobalFixWebKitStyle = styled_components_1.createGlobalStyle(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n .", " {\n transition: ", " !important;\n }\n"], ["\n .", " {\n transition: ", " !important;\n }\n"])), FixWebKit154Classes.paper, exports.fixWebKitTransitionStyle);
|
|
54
59
|
var templateObject_1;
|
|
@@ -5,7 +5,7 @@ require("focus-visible");
|
|
|
5
5
|
var react_1 = tslib_1.__importStar(require("react"));
|
|
6
6
|
var styles_1 = require("@material-ui/core/styles");
|
|
7
7
|
var hooks_1 = require("../hooks");
|
|
8
|
-
var
|
|
8
|
+
var isWebKit154_1 = require("../isWebKit154");
|
|
9
9
|
var styled_components_1 = require("../styled-components");
|
|
10
10
|
var createTheme_1 = tslib_1.__importDefault(require("./createTheme"));
|
|
11
11
|
var NestedThemeContext = react_1.createContext(false);
|
|
@@ -15,16 +15,16 @@ var NestedThemeContext = react_1.createContext(false);
|
|
|
15
15
|
* that will user parent's theme when not set theme
|
|
16
16
|
*/
|
|
17
17
|
var SubThemeProvider = function (_a) {
|
|
18
|
-
var themeProp = _a.theme, children = _a.children,
|
|
18
|
+
var themeProp = _a.theme, children = _a.children, fixWebKit154 = _a.fixWebKit154;
|
|
19
19
|
var _b, _c;
|
|
20
20
|
var parentTheme = styled_components_1.useTheme();
|
|
21
21
|
var isHaveParentRcTheme = (_c = (_b = parentTheme.palette) === null || _b === void 0 ? void 0 : _b.content) === null || _c === void 0 ? void 0 : _c.brand;
|
|
22
22
|
// TODO: can be remove after safari fix that bug, maybe after v16
|
|
23
|
-
var theme =
|
|
23
|
+
var theme = isWebKit154_1.getWebKit154Theme(!themeProp && isHaveParentRcTheme ? parentTheme : createTheme_1.default(themeProp), fixWebKit154);
|
|
24
24
|
return (react_1.default.createElement(styles_1.MuiThemeProvider, { theme: theme },
|
|
25
25
|
react_1.default.createElement(styled_components_1.ThemeProvider, { theme: theme },
|
|
26
26
|
react_1.default.createElement(react_1.default.Fragment, null,
|
|
27
|
-
(
|
|
27
|
+
(fixWebKit154 !== null && fixWebKit154 !== void 0 ? fixWebKit154 : isWebKit154_1.isWebKit154) && react_1.default.createElement(isWebKit154_1.GlobalFixWebKitStyle, null),
|
|
28
28
|
children))));
|
|
29
29
|
};
|
|
30
30
|
/**
|
package/package.json
CHANGED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { __makeTemplateObject } from "tslib";
|
|
2
|
-
import { createGlobalStyle } from 'styled-components';
|
|
3
|
-
import { RcClasses } from './utils/classes';
|
|
4
|
-
import { combineProps } from './utils/combineProps';
|
|
5
|
-
/**
|
|
6
|
-
* Conditionally apply a workaround for the CSS transition bug in Safari 15.4.
|
|
7
|
-
* Remove this workaround once the Safari bug is fixed.
|
|
8
|
-
*/
|
|
9
|
-
export var isSafari154 = typeof navigator !== 'undefined' &&
|
|
10
|
-
(/^((?!chrome|android).)*safari/i.test(navigator.userAgent) ||
|
|
11
|
-
/(iPhone|iPad)/.test(navigator.userAgent)) &&
|
|
12
|
-
/15\.[4-9]/i.test(navigator.userAgent);
|
|
13
|
-
var FixSafari154Classes = RcClasses(['paper'], 'RcFixSafari154');
|
|
14
|
-
/**
|
|
15
|
-
* Conditionally apply a workaround for the CSS transition bug in Safari 15.4.
|
|
16
|
-
* Remove this workaround once the Safari bug is fixed.
|
|
17
|
-
*/
|
|
18
|
-
export var getSafari154Theme = function (theme, enable) {
|
|
19
|
-
if (enable !== null && enable !== void 0 ? enable : isSafari154) {
|
|
20
|
-
return combineProps({
|
|
21
|
-
props: {
|
|
22
|
-
// * set all grow related to only have one transition to make animation not shake after safari 15.4
|
|
23
|
-
MuiMenu: {
|
|
24
|
-
PopoverClasses: { paper: FixSafari154Classes.paper },
|
|
25
|
-
},
|
|
26
|
-
RcVirtualizedMenu: {
|
|
27
|
-
PopoverClasses: { paper: FixSafari154Classes.paper },
|
|
28
|
-
},
|
|
29
|
-
MuiPopover: {
|
|
30
|
-
PaperProps: { className: FixSafari154Classes.paper },
|
|
31
|
-
},
|
|
32
|
-
// mui tooltip prop will cover all existing props
|
|
33
|
-
RcTooltip: {
|
|
34
|
-
classes: {
|
|
35
|
-
tooltip: FixSafari154Classes.paper,
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
// mui grow not accept global prop
|
|
39
|
-
RcGrow: {
|
|
40
|
-
className: FixSafari154Classes.paper,
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
}, theme);
|
|
44
|
-
}
|
|
45
|
-
return theme;
|
|
46
|
-
};
|
|
47
|
-
export var fixSafariTransitionStyle = 'all 159ms cubic-bezier(0.4, 0, 0.2, 1) 0ms';
|
|
48
|
-
/**
|
|
49
|
-
* A global style that can be used to apply a workaround for the CSS transition bug in Safari 15.4.
|
|
50
|
-
*/
|
|
51
|
-
export var GlobalFixSafariStyle = createGlobalStyle(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n .", " {\n transition: ", " !important;\n }\n"], ["\n .", " {\n transition: ", " !important;\n }\n"])), FixSafari154Classes.paper, fixSafariTransitionStyle);
|
|
52
|
-
var templateObject_1;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Conditionally apply a workaround for the CSS transition bug in Safari 15.4.
|
|
3
|
-
* Remove this workaround once the Safari bug is fixed.
|
|
4
|
-
*/
|
|
5
|
-
export declare const isSafari154: boolean;
|
|
6
|
-
/**
|
|
7
|
-
* Conditionally apply a workaround for the CSS transition bug in Safari 15.4.
|
|
8
|
-
* Remove this workaround once the Safari bug is fixed.
|
|
9
|
-
*/
|
|
10
|
-
export declare const getSafari154Theme: (theme: any, enable?: boolean | undefined) => any;
|
|
11
|
-
export declare const fixSafariTransitionStyle = "all 159ms cubic-bezier(0.4, 0, 0.2, 1) 0ms";
|
|
12
|
-
/**
|
|
13
|
-
* A global style that can be used to apply a workaround for the CSS transition bug in Safari 15.4.
|
|
14
|
-
*/
|
|
15
|
-
export declare const GlobalFixSafariStyle: import("styled-components").GlobalStyleClass<{}, import("styled-components").DefaultTheme>;
|