@jetbrains/ring-ui 5.0.89 → 5.0.90
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/button-ng/button-ng.examples.js +0 -3
- package/components/global/theme.d.ts +8 -1
- package/components/global/theme.js +22 -8
- package/components/global/variables_dark.css +8 -8
- package/components/header/header.css +2 -1
- package/components/loader-inline/loader-inline.css +2 -1
- package/components/message/message.js +13 -11
- package/components/place-under-ng/place-under-ng.examples.js +3 -4
- package/components/progress-bar/progress-bar.css +2 -1
- package/components/progress-bar-ng/progress-bar-ng.examples.js +0 -4
- package/components/table-legacy-ng/table-legacy-ng.examples.js +0 -5
- package/components/tabs/tabs.css +2 -1
- package/components/tabs-ng/tabs-ng.examples.js +0 -34
- package/dist/_helpers/theme.js +29 -10
- package/dist/global/theme.d.ts +8 -1
- package/dist/global/theme.js +1 -1
- package/dist/message/message.js +6 -4
- package/dist/style.css +1 -1
- package/package.json +9 -8
|
@@ -8,7 +8,6 @@ import angularDecorator, {APP_NAME} from '../../.storybook/angular-decorator';
|
|
|
8
8
|
import IconNG from '../icon-ng/icon-ng';
|
|
9
9
|
import CheckboxNG from '../checkbox-ng/checkbox-ng';
|
|
10
10
|
import Theme from '../global/theme';
|
|
11
|
-
import styles from '../global/variables_dark.css';
|
|
12
11
|
|
|
13
12
|
import ButtonNG from './button-ng';
|
|
14
13
|
|
|
@@ -87,8 +86,6 @@ export const basic = () => {
|
|
|
87
86
|
return `
|
|
88
87
|
<div ng-controller="testCtrl">
|
|
89
88
|
<div class="buttons">${renderAllButtons()}</div>
|
|
90
|
-
|
|
91
|
-
<div class="buttons ${styles.dark}">${renderAllButtons()}</div>
|
|
92
89
|
</div>
|
|
93
90
|
`;
|
|
94
91
|
|
|
@@ -1,14 +1,21 @@
|
|
|
1
|
-
import React, { HTMLAttributes } from 'react';
|
|
1
|
+
import React, { HTMLAttributes, ReactElement } from 'react';
|
|
2
2
|
declare enum Theme {
|
|
3
3
|
AUTO = "auto",
|
|
4
4
|
LIGHT = "light",
|
|
5
5
|
DARK = "dark"
|
|
6
6
|
}
|
|
7
7
|
export declare function useTheme(): Theme.LIGHT | Theme.DARK;
|
|
8
|
+
export declare function useThemeClasses(theme: Theme): string;
|
|
9
|
+
export interface WithThemeClassesProps {
|
|
10
|
+
theme: Theme;
|
|
11
|
+
children: (classes: string) => ReactElement;
|
|
12
|
+
}
|
|
13
|
+
export declare function WithThemeClasses({ theme, children }: WithThemeClassesProps): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
8
14
|
export declare function applyTheme(theme: Theme.DARK | Theme.LIGHT, container: HTMLElement): void;
|
|
9
15
|
export interface ThemeProviderProps extends HTMLAttributes<HTMLDivElement> {
|
|
10
16
|
theme?: Theme;
|
|
11
17
|
passToPopups?: boolean;
|
|
18
|
+
target?: HTMLElement;
|
|
12
19
|
}
|
|
13
20
|
export declare const ThemeProvider: React.ForwardRefExoticComponent<ThemeProviderProps & React.RefAttributes<HTMLDivElement>>;
|
|
14
21
|
export default Theme;
|
|
@@ -22,6 +22,18 @@ export function useTheme() {
|
|
|
22
22
|
}, []);
|
|
23
23
|
return dark ? Theme.DARK : Theme.LIGHT;
|
|
24
24
|
}
|
|
25
|
+
export function useThemeClasses(theme) {
|
|
26
|
+
const systemTheme = useTheme();
|
|
27
|
+
const resolvedTheme = theme === Theme.AUTO ? systemTheme : theme;
|
|
28
|
+
return classNames({
|
|
29
|
+
[styles.dark]: resolvedTheme === Theme.DARK,
|
|
30
|
+
[defaultStyles.light]: resolvedTheme === Theme.LIGHT
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
export function WithThemeClasses({ theme, children }) {
|
|
34
|
+
const themeClasses = useThemeClasses(theme);
|
|
35
|
+
return children(themeClasses);
|
|
36
|
+
}
|
|
25
37
|
export function applyTheme(theme, container) {
|
|
26
38
|
if (theme === Theme.DARK) {
|
|
27
39
|
container.classList.remove(defaultStyles.light);
|
|
@@ -34,20 +46,22 @@ export function applyTheme(theme, container) {
|
|
|
34
46
|
container.classList.add(defaultStyles.light);
|
|
35
47
|
}
|
|
36
48
|
}
|
|
37
|
-
export const ThemeProvider = forwardRef(function ThemeProvider({ theme = Theme.AUTO, className, passToPopups, children, ...restProps }, ref) {
|
|
49
|
+
export const ThemeProvider = forwardRef(function ThemeProvider({ theme = Theme.AUTO, className, passToPopups, children, target, ...restProps }, ref) {
|
|
38
50
|
const systemTheme = useTheme();
|
|
39
51
|
const resolvedTheme = theme === Theme.AUTO ? systemTheme : theme;
|
|
40
52
|
const id = useMemo(() => getUID('popups-with-theme-'), []);
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
if (target != null) {
|
|
55
|
+
applyTheme(resolvedTheme, target);
|
|
56
|
+
}
|
|
57
|
+
}, [resolvedTheme, target]);
|
|
58
|
+
const themeClasses = useThemeClasses(theme);
|
|
45
59
|
const parentTarget = useContext(PopupTargetContext);
|
|
46
|
-
return (<div ref={ref} className={classNames(className, themeClasses)} {...restProps}>{passToPopups
|
|
60
|
+
return (<div ref={ref} className={target != null ? undefined : classNames(className, themeClasses)} {...restProps}>{passToPopups
|
|
47
61
|
? (<PopupTarget id={id}>
|
|
48
|
-
{
|
|
62
|
+
{popupTarget => (<>
|
|
49
63
|
{children}
|
|
50
|
-
{createPortal(<div className={themeClasses}>{
|
|
64
|
+
{createPortal(<div className={themeClasses}>{popupTarget}</div>, parentTarget && getPopupContainer(parentTarget) || document.body)}
|
|
51
65
|
</>)}
|
|
52
66
|
</PopupTarget>)
|
|
53
67
|
: children}
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
--ring-icon-color: rgb(var(--ring-icon-components)); /* #80929d */
|
|
12
12
|
--ring-icon-secondary-components: 128, 146, 157;
|
|
13
13
|
--ring-icon-secondary-color: rgb(var(--ring-icon-secondary-components)); /* #80929d */
|
|
14
|
-
--ring-border-disabled-components:
|
|
15
|
-
--ring-border-disabled-color: rgb(var(--ring-border-disabled-components)); /* #
|
|
14
|
+
--ring-border-disabled-components: 54, 54, 54;
|
|
15
|
+
--ring-border-disabled-color: rgb(var(--ring-border-disabled-components)); /* #363636 */
|
|
16
16
|
--ring-border-unselected-disabled-components: 54, 54, 54;
|
|
17
17
|
--ring-border-unselected-disabled-color: rgb(var(--ring-border-unselected-disabled-components)); /* #363636 */
|
|
18
18
|
--ring-icon-disabled-components: 80, 82, 83;
|
|
@@ -59,8 +59,8 @@
|
|
|
59
59
|
--ring-heading-color: var(--ring-text-color);
|
|
60
60
|
--ring-secondary-components: 128, 146, 157;
|
|
61
61
|
--ring-secondary-color: rgb(var(--ring-secondary-components)); /* #80929d */
|
|
62
|
-
--ring-disabled-components:
|
|
63
|
-
--ring-disabled-color: rgb(var(--ring-disabled-components)); /* #
|
|
62
|
+
--ring-disabled-components: 81, 95, 104;
|
|
63
|
+
--ring-disabled-color: rgb(var(--ring-disabled-components)); /* #515F68 */
|
|
64
64
|
|
|
65
65
|
/* Background */
|
|
66
66
|
--ring-content-background-components: 35, 39, 43;
|
|
@@ -85,10 +85,10 @@
|
|
|
85
85
|
--ring-warning-background-color: rgb(var(--ring-warning-background-components)); /* #593d01 */
|
|
86
86
|
--ring-added-background-components: 54, 89, 71;
|
|
87
87
|
--ring-added-background-color: rgb(var(--ring-added-background-components)); /* #365947 */
|
|
88
|
-
--ring-disabled-background-components:
|
|
89
|
-
--ring-disabled-background-color: rgb(var(--ring-disabled-background-components)); /* #
|
|
90
|
-
--ring-disabled-selected-background-components:
|
|
91
|
-
--ring-disabled-selected-background-color: rgb(var(--ring-disabled-selected-background-components)); /* #
|
|
88
|
+
--ring-disabled-background-components: 54, 54, 54;
|
|
89
|
+
--ring-disabled-background-color: rgb(var(--ring-disabled-background-components)); /* #363636 */
|
|
90
|
+
--ring-disabled-selected-background-components: 44, 47, 51;
|
|
91
|
+
--ring-disabled-selected-background-color: rgb(var(--ring-disabled-selected-background-components)); /* #2C2F33 */
|
|
92
92
|
--ring-button-danger-active-components: 38, 8, 10;
|
|
93
93
|
--ring-button-danger-active-color: rgb(var(--ring-button-danger-active-components)); /* #26080a */
|
|
94
94
|
--ring-button-primary-background-components: 0, 126, 229;
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
--ring-loader-inline-stops: #ff00eb, #bd3bff, #008eff, #58ba00, #f48700, #ff00eb;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
.dark
|
|
11
|
+
.dark,
|
|
12
|
+
:global(.ring-ui-theme-dark) {
|
|
12
13
|
/* stylelint-disable-next-line color-no-hex */
|
|
13
14
|
--ring-loader-inline-stops: #ff2eef, #d178ff, #289fff, #88d444, #ffe000, #ff2eef;
|
|
14
15
|
}
|
|
@@ -6,7 +6,7 @@ import Popup from '../popup/popup';
|
|
|
6
6
|
import { Directions } from '../popup/popup.consts';
|
|
7
7
|
import Icon from '../icon/icon';
|
|
8
8
|
import Button from '../button/button';
|
|
9
|
-
import Theme, { ThemeProvider } from '../global/theme';
|
|
9
|
+
import Theme, { ThemeProvider, WithThemeClasses } from '../global/theme';
|
|
10
10
|
import darkStyles from '../global/variables_dark.css';
|
|
11
11
|
import styles from './message.css';
|
|
12
12
|
/**
|
|
@@ -96,17 +96,19 @@ export default class Message extends Component {
|
|
|
96
96
|
? [this.props.direction]
|
|
97
97
|
: this.props.directions;
|
|
98
98
|
const { direction } = this.state;
|
|
99
|
-
return (<
|
|
100
|
-
<
|
|
101
|
-
|
|
99
|
+
return (<WithThemeClasses theme={theme}>
|
|
100
|
+
{themeClasses => (<Popup ref={this.popupRef} hidden={false} directions={popupDirections} className={classNames(classes, themeClasses)} offset={UNIT * 2} onDirectionChange={this._onDirectionChange} {...popupProps}>
|
|
101
|
+
<ThemeProvider theme={theme} passToPopups>
|
|
102
|
+
{direction && (<div className={tailClasses} style={getTailOffsets(this.getTailOffset())[direction]}/>)}
|
|
102
103
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
104
|
+
{icon && <Icon className={styles.icon} glyph={icon}/>}
|
|
105
|
+
{title && <h1 data-test="rgMessageTitle" className={styles.title}>{title}</h1>}
|
|
106
|
+
{children && <div className={styles.description}>{children}</div>}
|
|
107
|
+
{(onClose || buttonProps) && (<Button className={styles.button} onClick={onClose} primary {...buttonProps}>{translations.gotIt}</Button>)}
|
|
108
|
+
{onDismiss && <Button onClick={onDismiss} text>{translations.dismiss}</Button>}
|
|
109
|
+
</ThemeProvider>
|
|
110
|
+
</Popup>)}
|
|
111
|
+
</WithThemeClasses>);
|
|
110
112
|
}
|
|
111
113
|
}
|
|
112
114
|
Message.propTypes = {
|
|
@@ -68,8 +68,7 @@ basic.parameters = {
|
|
|
68
68
|
right: 0;
|
|
69
69
|
width: 50%;
|
|
70
70
|
padding: 16px;
|
|
71
|
-
background-color:
|
|
72
|
-
color: #fff;
|
|
71
|
+
background-color: var(--ring-selected-background-color);
|
|
73
72
|
}
|
|
74
73
|
|
|
75
74
|
.head {
|
|
@@ -81,14 +80,14 @@ basic.parameters = {
|
|
|
81
80
|
top: 0;
|
|
82
81
|
width: 100%;
|
|
83
82
|
padding: 16px;
|
|
84
|
-
background-color:
|
|
83
|
+
background-color: var(--ring-hover-background-color);
|
|
85
84
|
}
|
|
86
85
|
|
|
87
86
|
.scrollable {
|
|
88
87
|
height: 1000px;
|
|
89
88
|
padding: 16px;
|
|
90
89
|
padding-top: 64px;
|
|
91
|
-
background-color:
|
|
90
|
+
background-color: var(--ring-sidebar-background-color);
|
|
92
91
|
}
|
|
93
92
|
</style>
|
|
94
93
|
`
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
--ring-progress-bar-line-background-color: rgba(255, 255, 255, 0.6);
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
.dark
|
|
11
|
+
.dark,
|
|
12
|
+
:global(.ring-ui-theme-dark) {
|
|
12
13
|
--ring-progress-bar-background-color: rgba(255, 255, 255, 0.3);
|
|
13
14
|
--ring-progress-bar-line-background-color: rgba(255, 255, 255, 0.4);
|
|
14
15
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import angular from 'angular';
|
|
2
2
|
|
|
3
3
|
import angularDecorator, {APP_NAME} from '../../.storybook/angular-decorator';
|
|
4
|
-
import darkStyles from '../global/variables_dark.css';
|
|
5
4
|
|
|
6
5
|
import RingProgressBar from './progress-bar-ng';
|
|
7
6
|
|
|
@@ -34,9 +33,6 @@ export const basic = () => {
|
|
|
34
33
|
<div style="height: 25px; padding-top: 25px;">
|
|
35
34
|
<rg-progress-bar label="'Progress'" value="ctrl.value" class="example-progress"></rg-progress-bar>
|
|
36
35
|
</div>
|
|
37
|
-
<div class="${darkStyles.dark}" style="height: 25px; background: var(--ring-content-background-color); padding-top: 25px;">
|
|
38
|
-
<rg-progress-bar label="'Progress'" value="ctrl.value" class="example-progress"></rg-progress-bar>
|
|
39
|
-
</div>
|
|
40
36
|
<div style="height: 25px; background: #F0F0F0; padding-top: 25px;">
|
|
41
37
|
<rg-progress-bar label="'Progress'" value="ctrl.value" class="example-progress"></rg-progress-bar>
|
|
42
38
|
</div>
|
|
@@ -173,7 +173,6 @@ export const withSidebar = () => {
|
|
|
173
173
|
<rg-legacy-table-title>Avatar</rg-legacy-table-title>
|
|
174
174
|
<rg-legacy-table-title>Check</rg-legacy-table-title>
|
|
175
175
|
<rg-legacy-table-title active>Name</rg-legacy-table-title>
|
|
176
|
-
<rg-legacy-table-title></rg-legacy-table-title>
|
|
177
176
|
</rg-legacy-table-header>
|
|
178
177
|
|
|
179
178
|
<rg-legacy-table-row row-item="item" ng-repeat="item in ctrl.itemsArray">
|
|
@@ -183,10 +182,6 @@ export const withSidebar = () => {
|
|
|
183
182
|
</rg-legacy-table-column>
|
|
184
183
|
<rg-legacy-table-checkbox-cell aria-label="Toggle row checked state"></rg-legacy-table-checkbox-cell>
|
|
185
184
|
<rg-legacy-table-column limited>{{::item.name }}</rg-legacy-table-column>
|
|
186
|
-
<rg-legacy-table-column>
|
|
187
|
-
<rg-sidebar-toggle-button ng-show="item.active"
|
|
188
|
-
model="ctrl.isShowSideBar"></rg-sidebar-toggle-button>
|
|
189
|
-
</rg-legacy-table-column>
|
|
190
185
|
</rg-legacy-table-row>
|
|
191
186
|
</rg-legacy-table>
|
|
192
187
|
</div>
|
package/components/tabs/tabs.css
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import angular from 'angular';
|
|
2
2
|
|
|
3
3
|
import angularDecorator, {APP_NAME} from '../../.storybook/angular-decorator';
|
|
4
|
-
import darkStyles from '../global/variables_dark.css';
|
|
5
4
|
|
|
6
5
|
import RingTabs from './tabs-ng';
|
|
7
6
|
|
|
@@ -29,36 +28,3 @@ export const basic = () => {
|
|
|
29
28
|
};
|
|
30
29
|
|
|
31
30
|
basic.storyName = 'basic';
|
|
32
|
-
|
|
33
|
-
export const dark = () => {
|
|
34
|
-
angular.module(APP_NAME, [RingTabs]);
|
|
35
|
-
|
|
36
|
-
return `
|
|
37
|
-
<div class="${darkStyles.dark}">
|
|
38
|
-
<rg-tabs class="container container_tabs">
|
|
39
|
-
<rg-tabs-pane x-title="Settings">Settings tab content</rg-tabs-pane>
|
|
40
|
-
<rg-tabs-pane x-title="Access" counter="7">Access tab content</rg-tabs-pane>
|
|
41
|
-
<rg-tabs-pane x-title="Disabled" ng-disabled="true" counter="8">Inaccessible tab content</rg-tabs-pane>
|
|
42
|
-
<rg-tabs-pane x-title="Members">Members tab content</rg-tabs-pane>
|
|
43
|
-
<rg-tabs-pane x-title="Members" counter="666">Members 666 tab content</rg-tabs-pane>
|
|
44
|
-
</rg-tabs>
|
|
45
|
-
</div>
|
|
46
|
-
`;
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
dark.storyName = 'dark';
|
|
50
|
-
|
|
51
|
-
dark.parameters = {
|
|
52
|
-
storyStyles: `
|
|
53
|
-
<style>
|
|
54
|
-
body {
|
|
55
|
-
margin: 0 !important;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
.container {
|
|
59
|
-
padding: 8px;
|
|
60
|
-
background: var(--ring-content-background-color);
|
|
61
|
-
color: var(--ring-text-color);
|
|
62
|
-
}
|
|
63
|
-
</style>`
|
|
64
|
-
};
|
package/dist/_helpers/theme.js
CHANGED
|
@@ -26,6 +26,22 @@ function useTheme() {
|
|
|
26
26
|
}, []);
|
|
27
27
|
return dark ? Theme.DARK : Theme.LIGHT;
|
|
28
28
|
}
|
|
29
|
+
function useThemeClasses(theme) {
|
|
30
|
+
const systemTheme = useTheme();
|
|
31
|
+
const resolvedTheme = theme === Theme.AUTO ? systemTheme : theme;
|
|
32
|
+
return classNames({
|
|
33
|
+
[modules_59717246.dark]: resolvedTheme === Theme.DARK,
|
|
34
|
+
[modules_6381a4b3.light]: resolvedTheme === Theme.LIGHT
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
function WithThemeClasses(_ref) {
|
|
38
|
+
let {
|
|
39
|
+
theme,
|
|
40
|
+
children
|
|
41
|
+
} = _ref;
|
|
42
|
+
const themeClasses = useThemeClasses(theme);
|
|
43
|
+
return children(themeClasses);
|
|
44
|
+
}
|
|
29
45
|
function applyTheme(theme, container) {
|
|
30
46
|
if (theme === Theme.DARK) {
|
|
31
47
|
container.classList.remove(modules_6381a4b3.light);
|
|
@@ -37,31 +53,34 @@ function applyTheme(theme, container) {
|
|
|
37
53
|
container.classList.add(modules_6381a4b3.light);
|
|
38
54
|
}
|
|
39
55
|
}
|
|
40
|
-
const ThemeProvider = /*#__PURE__*/forwardRef(function ThemeProvider(
|
|
56
|
+
const ThemeProvider = /*#__PURE__*/forwardRef(function ThemeProvider(_ref2, ref) {
|
|
41
57
|
let {
|
|
42
58
|
theme = Theme.AUTO,
|
|
43
59
|
className,
|
|
44
60
|
passToPopups,
|
|
45
61
|
children,
|
|
62
|
+
target,
|
|
46
63
|
...restProps
|
|
47
|
-
} =
|
|
64
|
+
} = _ref2;
|
|
48
65
|
const systemTheme = useTheme();
|
|
49
66
|
const resolvedTheme = theme === Theme.AUTO ? systemTheme : theme;
|
|
50
67
|
const id = useMemo(() => getUID('popups-with-theme-'), []);
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
68
|
+
useEffect(() => {
|
|
69
|
+
if (target != null) {
|
|
70
|
+
applyTheme(resolvedTheme, target);
|
|
71
|
+
}
|
|
72
|
+
}, [resolvedTheme, target]);
|
|
73
|
+
const themeClasses = useThemeClasses(theme);
|
|
55
74
|
const parentTarget = useContext(PopupTargetContext);
|
|
56
75
|
return /*#__PURE__*/React.createElement("div", _extends({
|
|
57
76
|
ref: ref,
|
|
58
|
-
className: classNames(className, themeClasses)
|
|
77
|
+
className: target != null ? undefined : classNames(className, themeClasses)
|
|
59
78
|
}, restProps), passToPopups ? /*#__PURE__*/React.createElement(PopupTarget, {
|
|
60
79
|
id: id
|
|
61
|
-
},
|
|
80
|
+
}, popupTarget => /*#__PURE__*/React.createElement(React.Fragment, null, children, /*#__PURE__*/createPortal( /*#__PURE__*/React.createElement("div", {
|
|
62
81
|
className: themeClasses
|
|
63
|
-
},
|
|
82
|
+
}, popupTarget), parentTarget && getPopupContainer(parentTarget) || document.body))) : children);
|
|
64
83
|
});
|
|
65
84
|
var Theme$1 = Theme;
|
|
66
85
|
|
|
67
|
-
export { Theme$1 as T, ThemeProvider as a,
|
|
86
|
+
export { Theme$1 as T, WithThemeClasses as W, ThemeProvider as a, useThemeClasses as b, applyTheme as c, modules_59717246 as m, useTheme as u };
|
package/dist/global/theme.d.ts
CHANGED
|
@@ -1,14 +1,21 @@
|
|
|
1
|
-
import React, { HTMLAttributes } from 'react';
|
|
1
|
+
import React, { HTMLAttributes, ReactElement } from 'react';
|
|
2
2
|
declare enum Theme {
|
|
3
3
|
AUTO = "auto",
|
|
4
4
|
LIGHT = "light",
|
|
5
5
|
DARK = "dark"
|
|
6
6
|
}
|
|
7
7
|
export declare function useTheme(): Theme.LIGHT | Theme.DARK;
|
|
8
|
+
export declare function useThemeClasses(theme: Theme): string;
|
|
9
|
+
export interface WithThemeClassesProps {
|
|
10
|
+
theme: Theme;
|
|
11
|
+
children: (classes: string) => ReactElement;
|
|
12
|
+
}
|
|
13
|
+
export declare function WithThemeClasses({ theme, children }: WithThemeClassesProps): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
8
14
|
export declare function applyTheme(theme: Theme.DARK | Theme.LIGHT, container: HTMLElement): void;
|
|
9
15
|
export interface ThemeProviderProps extends HTMLAttributes<HTMLDivElement> {
|
|
10
16
|
theme?: Theme;
|
|
11
17
|
passToPopups?: boolean;
|
|
18
|
+
target?: HTMLElement;
|
|
12
19
|
}
|
|
13
20
|
export declare const ThemeProvider: React.ForwardRefExoticComponent<ThemeProviderProps & React.RefAttributes<HTMLDivElement>>;
|
|
14
21
|
export default Theme;
|
package/dist/global/theme.js
CHANGED
|
@@ -4,7 +4,7 @@ import 'classnames';
|
|
|
4
4
|
import 'react-dom';
|
|
5
5
|
import '../popup/popup.target.js';
|
|
6
6
|
import '../popup/popup.js';
|
|
7
|
-
export { a as ThemeProvider,
|
|
7
|
+
export { a as ThemeProvider, W as WithThemeClasses, c as applyTheme, T as default, u as useTheme, b as useThemeClasses } from '../_helpers/theme.js';
|
|
8
8
|
import './get-uid.js';
|
|
9
9
|
import 'prop-types';
|
|
10
10
|
import './schedule-raf.js';
|
package/dist/message/message.js
CHANGED
|
@@ -7,7 +7,7 @@ import Popup from '../popup/popup.js';
|
|
|
7
7
|
import { Directions } from '../popup/popup.consts.js';
|
|
8
8
|
import Icon from '../icon/icon.js';
|
|
9
9
|
import { Button } from '../button/button.js';
|
|
10
|
-
import { T as Theme, m as modules_59717246, a as ThemeProvider } from '../_helpers/theme.js';
|
|
10
|
+
import { T as Theme, m as modules_59717246, W as WithThemeClasses, a as ThemeProvider } from '../_helpers/theme.js';
|
|
11
11
|
import 'react-dom';
|
|
12
12
|
import '../global/get-uid.js';
|
|
13
13
|
import '../global/schedule-raf.js';
|
|
@@ -159,11 +159,13 @@ class Message extends Component {
|
|
|
159
159
|
const {
|
|
160
160
|
direction
|
|
161
161
|
} = this.state;
|
|
162
|
-
return /*#__PURE__*/React.createElement(
|
|
162
|
+
return /*#__PURE__*/React.createElement(WithThemeClasses, {
|
|
163
|
+
theme: theme
|
|
164
|
+
}, themeClasses => /*#__PURE__*/React.createElement(Popup, _extends({
|
|
163
165
|
ref: this.popupRef,
|
|
164
166
|
hidden: false,
|
|
165
167
|
directions: popupDirections,
|
|
166
|
-
className: classes,
|
|
168
|
+
className: classNames(classes, themeClasses),
|
|
167
169
|
offset: UNIT * 2,
|
|
168
170
|
onDirectionChange: this._onDirectionChange
|
|
169
171
|
}, popupProps), /*#__PURE__*/React.createElement(ThemeProvider, {
|
|
@@ -187,7 +189,7 @@ class Message extends Component {
|
|
|
187
189
|
}, buttonProps), translations.gotIt), onDismiss && /*#__PURE__*/React.createElement(Button, {
|
|
188
190
|
onClick: onDismiss,
|
|
189
191
|
text: true
|
|
190
|
-
}, translations.dismiss)));
|
|
192
|
+
}, translations.dismiss))));
|
|
191
193
|
}
|
|
192
194
|
}
|
|
193
195
|
_defineProperty(Message, "defaultProps", {
|