@elliemae/ds-system 2.0.0-alpha.1 → 2.0.0-alpha.13
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/cjs/arithmetic.js +2 -0
- package/cjs/globalStyles.js +14 -12
- package/cjs/index.js +12 -20
- package/cjs/mobileUtilities.js +3 -2
- package/cjs/spaceUtilities.js +14 -9
- package/cjs/styled/index.d.js +2 -0
- package/cjs/styled/index.js +124 -0
- package/cjs/styled/styleGetters.js +44 -0
- package/cjs/styled/types.js +12 -0
- package/cjs/styled/utils.js +24 -0
- package/cjs/th.js +32 -0
- package/cjs/themeProviderHOC.js +8 -3
- package/cjs/utils.js +60 -125
- package/esm/arithmetic.js +2 -0
- package/esm/globalStyles.js +9 -11
- package/esm/index.js +3 -1
- package/esm/mobileUtilities.js +3 -2
- package/esm/spaceUtilities.js +14 -9
- package/esm/styled/index.d.js +1 -0
- package/esm/styled/index.js +115 -0
- package/esm/styled/styleGetters.js +38 -0
- package/esm/styled/types.js +1 -0
- package/esm/styled/utils.js +18 -0
- package/esm/th.js +28 -0
- package/esm/themeProviderHOC.js +5 -0
- package/esm/utils.js +44 -97
- package/package.json +27 -7
- package/types/arithmetic.d.ts +2 -2
- package/types/index.d.ts +2 -0
- package/types/styled/index.d.ts +2 -0
- package/types/styled/styleGetters.d.ts +4 -0
- package/types/styled/types.d.ts +28 -0
- package/types/styled/utils.d.ts +6 -0
- package/types/th.d.ts +14 -0
- package/types/utils.d.ts +10 -10
- package/cjs/package.json +0 -7
- package/esm/package.json +0 -7
package/cjs/arithmetic.js
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
6
|
+
|
|
5
7
|
function getNumberAndUnit(numberStrWithUnit) {
|
|
6
8
|
const [number, unit] = String(numberStrWithUnit).match(/[a-z]+|[(/^\-?\d*.\d+|\d+),?]+/gi);
|
|
7
9
|
return {
|
package/cjs/globalStyles.js
CHANGED
|
@@ -2,22 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var _taggedTemplateLiteral = require('@babel/runtime/helpers/taggedTemplateLiteral');
|
|
5
6
|
require('polished');
|
|
6
7
|
require('lodash');
|
|
7
8
|
require('./theme.js');
|
|
9
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
8
10
|
require('react');
|
|
9
|
-
var
|
|
11
|
+
var styled_component = require('styled-components');
|
|
10
12
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
13
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
14
|
+
|
|
15
|
+
var _taggedTemplateLiteral__default = /*#__PURE__*/_interopDefaultLegacy(_taggedTemplateLiteral);
|
|
16
|
+
|
|
17
|
+
var _templateObject;
|
|
18
|
+
const GlobalStyles = styled_component.createGlobalStyle(_templateObject || (_templateObject = _taggedTemplateLiteral__default["default"](["\n :root, body {\n overscroll-behavior-y: none;\n\n ", "\n\n font-size: ", ";\n\n @media(min-width: ", ") {\n font-size: ", ";\n }\n\n }\n"])), props => void 0, props => props.device === 'desktop' ? '13px' : '16px', _ref => {
|
|
19
|
+
let {
|
|
20
|
+
theme
|
|
21
|
+
} = _ref;
|
|
22
|
+
return theme.breakpoints.small;
|
|
23
|
+
}, props => props.device === 'mobile' ? '16px' : '13px');
|
|
22
24
|
|
|
23
25
|
exports.GlobalStyles = GlobalStyles;
|
package/cjs/index.js
CHANGED
|
@@ -7,9 +7,11 @@ var spaceUtilities = require('./spaceUtilities.js');
|
|
|
7
7
|
var mobileUtilities = require('./mobileUtilities.js');
|
|
8
8
|
var utils = require('./utils.js');
|
|
9
9
|
var arithmetic = require('./arithmetic.js');
|
|
10
|
+
var th = require('./th.js');
|
|
10
11
|
var theme = require('./theme.js');
|
|
12
|
+
var index = require('./styled/index.js');
|
|
11
13
|
var themeProviderHOC = require('./themeProviderHOC.js');
|
|
12
|
-
var
|
|
14
|
+
var styled_component = require('styled-components');
|
|
13
15
|
var polished = require('polished');
|
|
14
16
|
|
|
15
17
|
|
|
@@ -45,48 +47,38 @@ exports.iconColor = utils.iconColor;
|
|
|
45
47
|
exports.keyframes = utils.keyframes;
|
|
46
48
|
exports.onlyFirefox = utils.onlyFirefox;
|
|
47
49
|
exports.onlySafari = utils.onlySafari;
|
|
48
|
-
exports.
|
|
50
|
+
exports.onlySafariAndFirefox = utils.onlySafariAndFirefox;
|
|
49
51
|
exports.safariAndFirefoxBold = utils.safariAndFirefoxBold;
|
|
50
52
|
exports.textStyle = utils.textStyle;
|
|
51
53
|
exports.transition = utils.transition;
|
|
52
54
|
exports.truncate = utils.truncate;
|
|
53
55
|
exports.getNumberAndUnit = arithmetic.getNumberAndUnit;
|
|
54
56
|
exports.op = arithmetic.op;
|
|
57
|
+
exports.th = th.th;
|
|
55
58
|
exports.theme = theme.theme;
|
|
59
|
+
exports.styled = index.styled;
|
|
56
60
|
exports.themeProviderHOC = themeProviderHOC.themeProviderHOC;
|
|
57
61
|
Object.defineProperty(exports, 'createGlobalStyle', {
|
|
58
62
|
enumerable: true,
|
|
59
|
-
get: function () {
|
|
60
|
-
return styledComponents.createGlobalStyle;
|
|
61
|
-
}
|
|
63
|
+
get: function () { return styled_component.createGlobalStyle; }
|
|
62
64
|
});
|
|
63
65
|
Object.defineProperty(exports, 'css', {
|
|
64
66
|
enumerable: true,
|
|
65
|
-
get: function () {
|
|
66
|
-
return styledComponents.css;
|
|
67
|
-
}
|
|
67
|
+
get: function () { return styled_component.css; }
|
|
68
68
|
});
|
|
69
69
|
Object.defineProperty(exports, 'kfrm', {
|
|
70
70
|
enumerable: true,
|
|
71
|
-
get: function () {
|
|
72
|
-
return styledComponents.keyframes;
|
|
73
|
-
}
|
|
71
|
+
get: function () { return styled_component.keyframes; }
|
|
74
72
|
});
|
|
75
73
|
Object.defineProperty(exports, 'useTheme', {
|
|
76
74
|
enumerable: true,
|
|
77
|
-
get: function () {
|
|
78
|
-
return styledComponents.useTheme;
|
|
79
|
-
}
|
|
75
|
+
get: function () { return styled_component.useTheme; }
|
|
80
76
|
});
|
|
81
77
|
Object.defineProperty(exports, 'withTheme', {
|
|
82
78
|
enumerable: true,
|
|
83
|
-
get: function () {
|
|
84
|
-
return styledComponents.withTheme;
|
|
85
|
-
}
|
|
79
|
+
get: function () { return styled_component.withTheme; }
|
|
86
80
|
});
|
|
87
81
|
Object.defineProperty(exports, 'rgba', {
|
|
88
82
|
enumerable: true,
|
|
89
|
-
get: function () {
|
|
90
|
-
return polished.rgba;
|
|
91
|
-
}
|
|
83
|
+
get: function () { return polished.rgba; }
|
|
92
84
|
});
|
package/cjs/mobileUtilities.js
CHANGED
|
@@ -2,17 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
5
6
|
var react = require('react');
|
|
6
7
|
var theme = require('./theme.js');
|
|
7
8
|
var constants = require('./constants.js');
|
|
8
9
|
|
|
9
10
|
function __UNSAFE_SPACE_TO_DIMSUM(unit) {
|
|
10
11
|
if (constants.translateUnits[unit]) return constants.translateUnits[unit];
|
|
11
|
-
return
|
|
12
|
+
return "".concat(parseFloat(unit) * (constants.mobileBaseFont / constants.desktopBaseFont) / 2, "px");
|
|
12
13
|
}
|
|
13
14
|
function toMobile(unit) {
|
|
14
15
|
if (!isMobile()) return unit;
|
|
15
|
-
return
|
|
16
|
+
return "".concat(parseFloat(unit) * (constants.desktopBaseFont / constants.mobileBaseFont), "rem");
|
|
16
17
|
}
|
|
17
18
|
const useIsMobile = () => {
|
|
18
19
|
const [mobile, setMobile] = react.useState(isMobile());
|
package/cjs/spaceUtilities.js
CHANGED
|
@@ -2,26 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
require('core-js/modules/esnext.async-iterator.map.js');
|
|
6
|
+
require('core-js/modules/esnext.iterator.map.js');
|
|
7
|
+
require('core-js/modules/esnext.async-iterator.some.js');
|
|
8
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
9
|
+
require('core-js/modules/esnext.iterator.some.js');
|
|
5
10
|
var lodash = require('lodash');
|
|
6
11
|
var theme = require('./theme.js');
|
|
7
12
|
|
|
8
13
|
function mapGap(gutter) {
|
|
9
14
|
if (!gutter) return '0rem';
|
|
10
15
|
if (String(gutter).includes('rem') || String(gutter).includes('px')) return gutter;
|
|
11
|
-
return
|
|
16
|
+
return "".concat(theme.theme.space[gutter]);
|
|
12
17
|
}
|
|
13
18
|
function mapGutter(gutter) {
|
|
14
19
|
if (!gutter) return '0rem';
|
|
15
|
-
return
|
|
20
|
+
return "".concat(theme.theme.space[gutter], " * 2");
|
|
16
21
|
}
|
|
17
22
|
function mapSpace(width) {
|
|
18
|
-
if (typeof width === 'string') return lodash.get(theme.theme, width) ?
|
|
19
|
-
return
|
|
23
|
+
if (typeof width === 'string') return lodash.get(theme.theme, width) ? "".concat(lodash.get(theme.theme, width)) : width;
|
|
24
|
+
return "".concat(width * 100, "%");
|
|
20
25
|
}
|
|
21
26
|
function fixSpaceGutter(width, gutter) {
|
|
22
27
|
if (!width) return '';
|
|
23
|
-
if (Array.isArray(width)) return width.map(w =>
|
|
24
|
-
return
|
|
28
|
+
if (Array.isArray(width)) return width.map(w => "calc(".concat(mapSpace(w), " - (").concat(mapGutter(gutter), "))"));
|
|
29
|
+
return "calc(".concat(mapSpace(width), " - (").concat(mapGutter(gutter), "))");
|
|
25
30
|
}
|
|
26
31
|
function fixSpace(width) {
|
|
27
32
|
if (!width) return '';
|
|
@@ -36,13 +41,13 @@ function fixSpace(width) {
|
|
|
36
41
|
|
|
37
42
|
function numbersToFr(grid) {
|
|
38
43
|
const den = grid.map(f => f < 1 ? Math.floor(1 / f) : f);
|
|
39
|
-
return den.map(d =>
|
|
44
|
+
return den.map(d => "".concat(d, "fr"));
|
|
40
45
|
}
|
|
41
46
|
function mapGrid(width) {
|
|
42
|
-
if (lodash.get(theme.theme, width)) return
|
|
47
|
+
if (lodash.get(theme.theme, width)) return "".concat(lodash.get(theme.theme, width));
|
|
43
48
|
if (typeof width === 'string') return width;
|
|
44
49
|
const den = width < 1 ? Math.floor(1 / width) : width;
|
|
45
|
-
return
|
|
50
|
+
return "".concat(den, "fr");
|
|
46
51
|
}
|
|
47
52
|
function mapTemplateGrid(grid) {
|
|
48
53
|
if (Array.isArray(grid)) {
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
6
|
+
require('core-js/modules/esnext.async-iterator.map.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.map.js');
|
|
8
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
9
|
+
require('core-js/modules/esnext.async-iterator.reduce.js');
|
|
10
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
11
|
+
require('core-js/modules/esnext.iterator.reduce.js');
|
|
12
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
13
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
14
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
15
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
16
|
+
var styled_component = require('styled-components');
|
|
17
|
+
var styleGetters = require('./styleGetters.js');
|
|
18
|
+
var utils = require('./utils.js');
|
|
19
|
+
|
|
20
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
21
|
+
|
|
22
|
+
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
23
|
+
var styled_component__default = /*#__PURE__*/_interopDefaultLegacy(styled_component);
|
|
24
|
+
|
|
25
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
26
|
+
|
|
27
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
28
|
+
|
|
29
|
+
const styledFunction = function (tag) {
|
|
30
|
+
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
31
|
+
name: null,
|
|
32
|
+
slot: null
|
|
33
|
+
};
|
|
34
|
+
const {
|
|
35
|
+
name: componentName,
|
|
36
|
+
slot: componentSlot
|
|
37
|
+
} = options;
|
|
38
|
+
|
|
39
|
+
const func = function (styleArg) {
|
|
40
|
+
for (var _len = arguments.length, expressions = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
41
|
+
expressions[_key - 1] = arguments[_key];
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/*
|
|
45
|
+
* These are the internal expression written in dimsum
|
|
46
|
+
* We just coerce with the default theme in case users
|
|
47
|
+
* forget to add the ThemeProvider
|
|
48
|
+
*/
|
|
49
|
+
const expressionsWithDefaultTheme = expressions ? expressions.map(stylesArg => typeof stylesArg === 'function' ? props => stylesArg(_objectSpread(_objectSpread({}, props), {}, {
|
|
50
|
+
theme: utils.coerceWithDefaultTheme(props.theme)
|
|
51
|
+
})) : stylesArg) : [];
|
|
52
|
+
let transformedStyleArg = styleArg;
|
|
53
|
+
/*
|
|
54
|
+
* Here we get the style overrides from the user
|
|
55
|
+
*/
|
|
56
|
+
|
|
57
|
+
if (componentName && componentSlot) {
|
|
58
|
+
expressionsWithDefaultTheme.push(props => {
|
|
59
|
+
const theme = utils.coerceWithDefaultTheme(props.theme);
|
|
60
|
+
const styleOverrides = styleGetters.getStyleOverrides(componentName, theme);
|
|
61
|
+
|
|
62
|
+
if (styleOverrides) {
|
|
63
|
+
return [styleOverrides[componentSlot]];
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return null;
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
/*
|
|
70
|
+
* Here we get the variant overrides from the user (only for the root)
|
|
71
|
+
*/
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
if (componentName && componentSlot === 'root') {
|
|
75
|
+
expressionsWithDefaultTheme.push(props => {
|
|
76
|
+
const theme = utils.coerceWithDefaultTheme(props.theme);
|
|
77
|
+
return styleGetters.variantsResolver(props, styleGetters.getVariantStyles(componentName, theme), theme, componentName);
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const numOfCustomFnsApplied = expressionsWithDefaultTheme.length - expressions.length;
|
|
82
|
+
|
|
83
|
+
if (Array.isArray(styleArg) && numOfCustomFnsApplied > 0) {
|
|
84
|
+
// Here we are adding placeholders for all the new functions that we are gonna call
|
|
85
|
+
const placeholders = new Array(numOfCustomFnsApplied).fill('');
|
|
86
|
+
transformedStyleArg = Object.assign([...styleArg, ...placeholders], {
|
|
87
|
+
raw: [...styleArg.raw, ...placeholders]
|
|
88
|
+
});
|
|
89
|
+
} else if (typeof styleArg === 'function') {
|
|
90
|
+
// Here we just coerce with the default theme
|
|
91
|
+
transformedStyleArg = props => styleArg(_objectSpread(_objectSpread({}, props), {}, {
|
|
92
|
+
theme: utils.coerceWithDefaultTheme(props.theme)
|
|
93
|
+
}));
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
let Component = /*#__PURE__*/styled_component__default["default"](tag);
|
|
97
|
+
const displayName = componentName !== null && componentSlot !== null ? "".concat(componentName).concat(componentSlot) : null;
|
|
98
|
+
|
|
99
|
+
if (displayName !== null) {
|
|
100
|
+
Component = Component.attrs({
|
|
101
|
+
className: "".concat(componentName).concat(componentSlot)
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
Component = Component(transformedStyleArg, ...expressionsWithDefaultTheme);
|
|
106
|
+
|
|
107
|
+
if (displayName !== null) {
|
|
108
|
+
Component.displayName = displayName;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
return Component;
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
return func;
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
const styledObject = Object.keys(styled_component__default["default"]).reduce((obj, key) => {
|
|
118
|
+
const castedKey = key;
|
|
119
|
+
obj[castedKey] = styledFunction(castedKey);
|
|
120
|
+
return obj;
|
|
121
|
+
}, {});
|
|
122
|
+
const styled = Object.assign(styledFunction, styledObject);
|
|
123
|
+
|
|
124
|
+
exports.styled = styled;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
require('core-js/modules/esnext.async-iterator.reduce.js');
|
|
6
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.reduce.js');
|
|
8
|
+
require('core-js/modules/esnext.async-iterator.every.js');
|
|
9
|
+
require('core-js/modules/esnext.iterator.every.js');
|
|
10
|
+
var utils = require('./utils.js');
|
|
11
|
+
|
|
12
|
+
const getStyleOverrides = (name, theme) => {
|
|
13
|
+
var _theme$components, _theme$components$nam;
|
|
14
|
+
|
|
15
|
+
return ((_theme$components = theme.components) === null || _theme$components === void 0 ? void 0 : (_theme$components$nam = _theme$components[name]) === null || _theme$components$nam === void 0 ? void 0 : _theme$components$nam.styleOverrides) || null;
|
|
16
|
+
};
|
|
17
|
+
const getVariantStyles = (name, theme) => {
|
|
18
|
+
var _theme$components2, _theme$components2$na;
|
|
19
|
+
|
|
20
|
+
const variants = ((_theme$components2 = theme.components) === null || _theme$components2 === void 0 ? void 0 : (_theme$components2$na = _theme$components2[name]) === null || _theme$components2$na === void 0 ? void 0 : _theme$components2$na.variants) || [];
|
|
21
|
+
return variants.reduce((styles, definition) => {
|
|
22
|
+
const key = utils.propsToClassKey(definition.props);
|
|
23
|
+
styles[key] = definition.style;
|
|
24
|
+
return styles;
|
|
25
|
+
}, {});
|
|
26
|
+
};
|
|
27
|
+
const variantsResolver = (props, styles, theme, name) => {
|
|
28
|
+
var _theme$components3, _theme$components3$na;
|
|
29
|
+
|
|
30
|
+
const themeVariants = (theme === null || theme === void 0 ? void 0 : (_theme$components3 = theme.components) === null || _theme$components3 === void 0 ? void 0 : (_theme$components3$na = _theme$components3[name]) === null || _theme$components3$na === void 0 ? void 0 : _theme$components3$na.variants) || [];
|
|
31
|
+
return themeVariants.reduce((variantsStyles, themeVariant) => {
|
|
32
|
+
const isMatch = Object.keys(themeVariant.props).every(key => props[key] === themeVariant.props[key]);
|
|
33
|
+
|
|
34
|
+
if (isMatch) {
|
|
35
|
+
variantsStyles.push(styles[utils.propsToClassKey(themeVariant.props)]);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return variantsStyles;
|
|
39
|
+
}, []);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
exports.getStyleOverrides = getStyleOverrides;
|
|
43
|
+
exports.getVariantStyles = getVariantStyles;
|
|
44
|
+
exports.variantsResolver = variantsResolver;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var styled_component = require('styled-components');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
Object.defineProperty(exports, 'CSSObject', {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () { return styled_component.CSSObject; }
|
|
12
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
require('core-js/modules/esnext.async-iterator.reduce.js');
|
|
6
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.reduce.js');
|
|
8
|
+
var dsUtilities = require('@elliemae/ds-utilities');
|
|
9
|
+
var theme = require('../theme.js');
|
|
10
|
+
|
|
11
|
+
const systemTheme = theme.theme;
|
|
12
|
+
const isEmpty = string => string.length === 0;
|
|
13
|
+
const coerceWithDefaultTheme = themeInput => themeInput !== null && themeInput !== void 0 ? themeInput : systemTheme;
|
|
14
|
+
const propsToClassKey = props => Object.keys(props).sort().reduce((classKey, key) => {
|
|
15
|
+
if (key === 'color') {
|
|
16
|
+
return classKey + isEmpty(String(classKey)) ? String(props[key]) : dsUtilities.capitalize(String(props[key]));
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return "".concat(classKey).concat(isEmpty(String(classKey)) ? key : dsUtilities.capitalize(key)).concat(dsUtilities.capitalize(props[key].toString()));
|
|
20
|
+
}, '');
|
|
21
|
+
|
|
22
|
+
exports.coerceWithDefaultTheme = coerceWithDefaultTheme;
|
|
23
|
+
exports.isEmpty = isEmpty;
|
|
24
|
+
exports.propsToClassKey = propsToClassKey;
|
package/cjs/th.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
6
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
8
|
+
|
|
9
|
+
const th = property => (value, dfault) => _ref => {
|
|
10
|
+
var _result;
|
|
11
|
+
|
|
12
|
+
let {
|
|
13
|
+
theme
|
|
14
|
+
} = _ref;
|
|
15
|
+
const parts = value.split('-');
|
|
16
|
+
let result = theme[property];
|
|
17
|
+
parts.forEach(part => {
|
|
18
|
+
if (result) result = result[part];
|
|
19
|
+
});
|
|
20
|
+
return (_result = result) !== null && _result !== void 0 ? _result : dfault;
|
|
21
|
+
};
|
|
22
|
+
th.space = th('space');
|
|
23
|
+
th.fontSize = th('fontSizes');
|
|
24
|
+
th.fontWeight = th('fontWeights');
|
|
25
|
+
th.lineHeight = th('lineHeights');
|
|
26
|
+
th.letterSpacing = th('letterSpacings');
|
|
27
|
+
th.font = th('fonts');
|
|
28
|
+
th.color = th('colors');
|
|
29
|
+
th.breakpoint = th('breakpoints');
|
|
30
|
+
th.media = th('media');
|
|
31
|
+
|
|
32
|
+
exports.th = th;
|
package/cjs/themeProviderHOC.js
CHANGED
|
@@ -2,10 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
6
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
8
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
9
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
5
10
|
var _jsx2 = require('@babel/runtime/helpers/jsx');
|
|
6
11
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
7
12
|
require('react');
|
|
8
|
-
var
|
|
13
|
+
var styled_component = require('styled-components');
|
|
9
14
|
var theme = require('./theme.js');
|
|
10
15
|
var jsxRuntime = require('react/jsx-runtime');
|
|
11
16
|
|
|
@@ -16,8 +21,8 @@ var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_definePropert
|
|
|
16
21
|
|
|
17
22
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
18
23
|
|
|
19
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default[
|
|
20
|
-
const themeProviderHOC = Component => props => /*#__PURE__*/_jsx2__default[
|
|
24
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
25
|
+
const themeProviderHOC = Component => props => /*#__PURE__*/_jsx2__default["default"](styled_component.ThemeProvider, {
|
|
21
26
|
theme: theme.theme
|
|
22
27
|
}, void 0, /*#__PURE__*/jsxRuntime.jsx(Component, _objectSpread({}, props)));
|
|
23
28
|
|