1 | "use strict";
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", { value: true });
|
4 | var tslib_1 = require("tslib");
|
5 | var getTheme_1 = tslib_1.__importDefault(require("./getTheme"));
|
6 |
|
7 | function themedVariants(variantProp, variants) {
|
8 | return function (props) {
|
9 | var theme = getTheme_1.default(props);
|
10 | if (props && props[variantProp] && variants) {
|
11 | var modes = variants[props[variantProp]];
|
12 | if (modes && modes[theme.mode]) {
|
13 | var value = modes[theme.mode];
|
14 | if (value)
|
15 | return value;
|
16 | }
|
17 | }
|
18 | return '';
|
19 | };
|
20 | }
|
21 | function themed(modesOrVariant, variantModes) {
|
22 | if (typeof modesOrVariant === 'string') {
|
23 | return themedVariants(modesOrVariant, variantModes);
|
24 | }
|
25 | var modes = modesOrVariant;
|
26 | return function (props) {
|
27 |
|
28 | var theme = getTheme_1.default(props);
|
29 |
|
30 | if (theme.mode in modes) {
|
31 | var value = modes[theme.mode];
|
32 | if (value)
|
33 | return value;
|
34 | }
|
35 | return '';
|
36 | };
|
37 | }
|
38 | exports.default = themed;
|
39 |
|
\ | No newline at end of file |