@elliemae/ds-system 2.0.0-rc.7 → 2.0.1-rc.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.
@@ -8,14 +8,14 @@ require('lodash');
8
8
  require('./theme.js');
9
9
  require('core-js/modules/web.dom-collections.iterator.js');
10
10
  require('react');
11
- var styledComponents = require('styled-components');
11
+ var styled_component = require('styled-components');
12
12
 
13
13
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
14
14
 
15
15
  var _taggedTemplateLiteral__default = /*#__PURE__*/_interopDefaultLegacy(_taggedTemplateLiteral);
16
16
 
17
17
  var _templateObject;
18
- const GlobalStyles = styledComponents.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 => {
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
19
  let {
20
20
  theme
21
21
  } = _ref;
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 styledComponents = require('styled-components');
14
+ var styled_component = require('styled-components');
13
15
  var polished = require('polished');
14
16
 
15
17
 
@@ -45,34 +47,36 @@ exports.iconColor = utils.iconColor;
45
47
  exports.keyframes = utils.keyframes;
46
48
  exports.onlyFirefox = utils.onlyFirefox;
47
49
  exports.onlySafari = utils.onlySafari;
48
- exports.onlySafariAndFiredox = utils.onlySafariAndFiredox;
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 () { return styledComponents.createGlobalStyle; }
63
+ get: function () { return styled_component.createGlobalStyle; }
60
64
  });
61
65
  Object.defineProperty(exports, 'css', {
62
66
  enumerable: true,
63
- get: function () { return styledComponents.css; }
67
+ get: function () { return styled_component.css; }
64
68
  });
65
69
  Object.defineProperty(exports, 'kfrm', {
66
70
  enumerable: true,
67
- get: function () { return styledComponents.keyframes; }
71
+ get: function () { return styled_component.keyframes; }
68
72
  });
69
73
  Object.defineProperty(exports, 'useTheme', {
70
74
  enumerable: true,
71
- get: function () { return styledComponents.useTheme; }
75
+ get: function () { return styled_component.useTheme; }
72
76
  });
73
77
  Object.defineProperty(exports, 'withTheme', {
74
78
  enumerable: true,
75
- get: function () { return styledComponents.withTheme; }
79
+ get: function () { return styled_component.withTheme; }
76
80
  });
77
81
  Object.defineProperty(exports, 'rgba', {
78
82
  enumerable: true,
@@ -0,0 +1,2 @@
1
+ 'use strict';
2
+
@@ -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;
@@ -10,7 +10,7 @@ require('core-js/modules/esnext.iterator.for-each.js');
10
10
  var _jsx2 = require('@babel/runtime/helpers/jsx');
11
11
  var _defineProperty = require('@babel/runtime/helpers/defineProperty');
12
12
  require('react');
13
- var styledComponents = require('styled-components');
13
+ var styled_component = require('styled-components');
14
14
  var theme = require('./theme.js');
15
15
  var jsxRuntime = require('react/jsx-runtime');
16
16
 
@@ -22,7 +22,7 @@ var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_definePropert
22
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; }
23
23
 
24
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"](styledComponents.ThemeProvider, {
25
+ const themeProviderHOC = Component => props => /*#__PURE__*/_jsx2__default["default"](styled_component.ThemeProvider, {
26
26
  theme: theme.theme
27
27
  }, void 0, /*#__PURE__*/jsxRuntime.jsx(Component, _objectSpread({}, props)));
28
28
 
package/cjs/utils.js CHANGED
@@ -6,11 +6,11 @@ var polished = require('polished');
6
6
  var lodash = require('lodash');
7
7
  var theme = require('./theme.js');
8
8
  var mobileUtilities = require('./mobileUtilities.js');
9
- var styledComponents = require('styled-components');
9
+ var styled_component = require('styled-components');
10
10
 
11
11
  /* eslint-disable no-shadow */
12
12
  function truncate(width) {
13
- return props => styledComponents.css(["", " white-space:nowrap;overflow:hidden;text-overflow:ellipsis;"], !!width || props.width ? "width: ".concat(props.width || width, ";") : '');
13
+ return props => styled_component.css(["", " white-space:nowrap;overflow:hidden;text-overflow:ellipsis;"], !!width || props.width ? "width: ".concat(props.width || width, ";") : '');
14
14
  }
15
15
  function flexCenter() {
16
16
  return "\n display: flex;\n justify-content: center;\n align-items: center;\n ";
@@ -19,7 +19,7 @@ function disabled() {
19
19
  return "\n cursor: not-allowed;\n pointer-events: none;\n ";
20
20
  }
21
21
  function keyframes(obj) {
22
- return styledComponents.keyframes(["", ""], lodash.reduce(obj, (result, value, key) => "\n ".concat(result, "\n ").concat(key, "% {\n ").concat(value, "\n }\n "), ''));
22
+ return styled_component.keyframes(["", ""], lodash.reduce(obj, (result, value, key) => "\n ".concat(result, "\n ").concat(key, "% {\n ").concat(value, "\n }\n "), ''));
23
23
  } // eslint-disable-next-line max-params
24
24
 
25
25
  function boxShadow(top, left, blur, color) {
@@ -29,7 +29,7 @@ function boxShadow(top, left, blur, color) {
29
29
  function color() {
30
30
  let variant = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'neutral';
31
31
  let type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 400;
32
- return styledComponents.css(["color:", ";"], props => props.theme.colors[variant][type]);
32
+ return styled_component.css(["color:", ";"], props => props.theme.colors[variant][type]);
33
33
  }
34
34
  function border() {
35
35
  let color = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : theme.theme.colors.brand[600];
@@ -38,21 +38,21 @@ function border() {
38
38
  return "".concat(size, " ").concat(type, " ").concat(color);
39
39
  }
40
40
  function animation(animationKeyframes, animationLength, animationTimingFn) {
41
- return props => styledComponents.css(["animation:", " ", " ", ";"], props.animationKeyframes || animationKeyframes, props.animationLength || animationLength, props.animationTimingFn || animationTimingFn);
41
+ return props => styled_component.css(["animation:", " ", " ", ";"], props.animationKeyframes || animationKeyframes, props.animationLength || animationLength, props.animationTimingFn || animationTimingFn);
42
42
  } // 0.0769
43
43
 
44
44
  function focus() {
45
45
  let color = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : theme.theme.colors.brand[600];
46
- return () => styledComponents.css(["outline:none;border:1px solid ", ";box-shadow:inset 0 0 0 1px ", ";border-radius:2px;"], color, polished.lighten(0.3, color));
46
+ return () => styled_component.css(["outline:none;border:1px solid ", ";box-shadow:inset 0 0 0 1px ", ";border-radius:2px;"], color, polished.lighten(0.3, color));
47
47
  }
48
48
  function focusAfter(color) {
49
- return styledComponents.css(["outline:none;position:relative;&:after{content:'';z-index:10;position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;", "}"], focus(color));
49
+ return styled_component.css(["outline:none;position:relative;&:after{content:'';z-index:10;position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;", "}"], focus(color));
50
50
  }
51
51
  function active() {
52
- return props => styledComponents.css(["outline:none;border:1px solid ", ";border-radius:2px;"], props.theme.colors.brand[700]);
52
+ return props => styled_component.css(["outline:none;border:1px solid ", ";border-radius:2px;"], props.theme.colors.brand[700]);
53
53
  }
54
54
  function hover() {
55
- return props => styledComponents.css(["outline:1px solid ", ";outline-offset:-1px;"], props.theme.colors.brand[600]);
55
+ return props => styled_component.css(["outline:1px solid ", ";outline-offset:-1px;"], props.theme.colors.brand[600]);
56
56
  }
57
57
  function textStyle(type) {
58
58
  let weight = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'regular';
@@ -112,13 +112,13 @@ function textStyle(type) {
112
112
  function iconColor() {
113
113
  let variant = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'neutral';
114
114
  let type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 400;
115
- return styledComponents.css(["fill:", ";"], props => props.theme.colors[variant][type]);
115
+ return styled_component.css(["fill:", ";"], props => props.theme.colors[variant][type]);
116
116
  }
117
117
  function fakeBorder() {
118
- return styledComponents.css(["box-shadow:inset 0 0 0 1px ", ";border-radius:2px;"], props => props.theme.colors.neutral[200]);
118
+ return styled_component.css(["box-shadow:inset 0 0 0 1px ", ";border-radius:2px;"], props => props.theme.colors.neutral[200]);
119
119
  }
120
120
  function fakeActive() {
121
- return styledComponents.css(["outline:none;box-shadow:inset 0 0 0 1px ", ";border-radius:2px;"], props => props.theme.colors.brand[700]);
121
+ return styled_component.css(["outline:none;box-shadow:inset 0 0 0 1px ", ";border-radius:2px;"], props => props.theme.colors.brand[700]);
122
122
  }
123
123
  function clearFocus() {
124
124
  return "\n border: none;\n box-shadow: none;\n ";
@@ -130,18 +130,10 @@ function transition() {
130
130
  let t = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'all 1s ease';
131
131
  return "\n transition: ".concat(t, ";\n ");
132
132
  }
133
- function onlySafariAndFiredox(styles) {
134
- return styledComponents.css(["@media not all and (min-resolution:0.001dpcm){", "}@media screen and (min--moz-device-pixel-ratio:0){", "}"], styles, styles);
135
- }
136
- function onlySafari(styles) {
137
- return styledComponents.css(["@media not all and (min-resolution:0.001dpcm){", "}"], styles);
138
- }
139
- function onlyFirefox(styles) {
140
- return styledComponents.css(["@media screen and (min--moz-device-pixel-ratio:0){", "}"], styles);
141
- }
142
- function safariAndFirefoxBold(color) {
143
- return styledComponents.css(["@media not all and (min-resolution:0.001dpcm){font-weight:400;-webkit-font-smoothing:subpixel-antialiased;-webkit-text-stroke:0.4px ", ";}@media screen and (min--moz-device-pixel-ratio:0){font-weight:400;-webkit-font-smoothing:subpixel-antialiased;-webkit-text-stroke:0.4px ", ";}"], color, color);
144
- }
133
+ const onlySafariAndFirefox = styles => styled_component.css(["@media not all and (min-resolution:0.001dpcm){", "}@media screen and (min--moz-device-pixel-ratio:0){", "}"], styles, styles);
134
+ const onlySafari = styles => "\n @media not all and (min-resolution: 0.001dpcm) {\n ".concat(styles, "\n }\n ");
135
+ const onlyFirefox = styles => "\n @media screen and (min--moz-device-pixel-ratio: 0) {\n ".concat(styles, "\n }\n ");
136
+ const safariAndFirefoxBold = color => "\n @media not all and (min-resolution: 0.001dpcm) {\n font-weight: 400;\n -webkit-font-smoothing: subpixel-antialiased;\n -webkit-text-stroke: 0.4px ".concat(color, ";\n }\n @media screen and (min--moz-device-pixel-ratio: 0) {\n font-weight: 400;\n -webkit-font-smoothing: subpixel-antialiased;\n -webkit-text-stroke: 0.4px ").concat(color, ";\n }\n");
145
137
 
146
138
  Object.defineProperty(exports, 'rgba', {
147
139
  enumerable: true,
@@ -149,23 +141,23 @@ Object.defineProperty(exports, 'rgba', {
149
141
  });
150
142
  Object.defineProperty(exports, 'createGlobalStyle', {
151
143
  enumerable: true,
152
- get: function () { return styledComponents.createGlobalStyle; }
144
+ get: function () { return styled_component.createGlobalStyle; }
153
145
  });
154
146
  Object.defineProperty(exports, 'css', {
155
147
  enumerable: true,
156
- get: function () { return styledComponents.css; }
148
+ get: function () { return styled_component.css; }
157
149
  });
158
150
  Object.defineProperty(exports, 'kfrm', {
159
151
  enumerable: true,
160
- get: function () { return styledComponents.keyframes; }
152
+ get: function () { return styled_component.keyframes; }
161
153
  });
162
154
  Object.defineProperty(exports, 'useTheme', {
163
155
  enumerable: true,
164
- get: function () { return styledComponents.useTheme; }
156
+ get: function () { return styled_component.useTheme; }
165
157
  });
166
158
  Object.defineProperty(exports, 'withTheme', {
167
159
  enumerable: true,
168
- get: function () { return styledComponents.withTheme; }
160
+ get: function () { return styled_component.withTheme; }
169
161
  });
170
162
  exports.active = active;
171
163
  exports.animation = animation;
@@ -185,7 +177,7 @@ exports.iconColor = iconColor;
185
177
  exports.keyframes = keyframes;
186
178
  exports.onlyFirefox = onlyFirefox;
187
179
  exports.onlySafari = onlySafari;
188
- exports.onlySafariAndFiredox = onlySafariAndFiredox;
180
+ exports.onlySafariAndFirefox = onlySafariAndFirefox;
189
181
  exports.safariAndFirefoxBold = safariAndFirefoxBold;
190
182
  exports.textStyle = textStyle;
191
183
  exports.transition = transition;
package/esm/index.js CHANGED
@@ -1,9 +1,11 @@
1
1
  export { GlobalStyles } from './globalStyles.js';
2
2
  export { fixSpace, fixSpaceGutter, mapGap, mapGrid, mapGutter, mapSpace, mapTemplateGrid, numbersToFr } from './spaceUtilities.js';
3
3
  export { __UNSAFE_SPACE_TO_DIMSUM, isMobile, toMobile, useIsMobile } from './mobileUtilities.js';
4
- export { active, animation, border, boxShadow, buttonLink, clearFocus, color, disabled, fakeActive, fakeBorder, flexCenter, focus, focusAfter, hover, iconColor, keyframes, onlyFirefox, onlySafari, onlySafariAndFiredox, safariAndFirefoxBold, textStyle, transition, truncate } from './utils.js';
4
+ export { active, animation, border, boxShadow, buttonLink, clearFocus, color, disabled, fakeActive, fakeBorder, flexCenter, focus, focusAfter, hover, iconColor, keyframes, onlyFirefox, onlySafari, onlySafariAndFirefox, safariAndFirefoxBold, textStyle, transition, truncate } from './utils.js';
5
5
  export { getNumberAndUnit, op } from './arithmetic.js';
6
+ export { th } from './th.js';
6
7
  export { theme } from './theme.js';
8
+ export { styled } from './styled/index.js';
7
9
  export { themeProviderHOC } from './themeProviderHOC.js';
8
10
  export { createGlobalStyle, css, keyframes as kfrm, useTheme, withTheme } from 'styled-components';
9
11
  export { rgba } from 'polished';
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,115 @@
1
+ import 'core-js/modules/esnext.async-iterator.filter.js';
2
+ import 'core-js/modules/esnext.iterator.filter.js';
3
+ import 'core-js/modules/esnext.async-iterator.for-each.js';
4
+ import 'core-js/modules/esnext.iterator.for-each.js';
5
+ import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
6
+ import 'core-js/modules/esnext.async-iterator.map.js';
7
+ import 'core-js/modules/esnext.iterator.map.js';
8
+ import 'core-js/modules/web.dom-collections.iterator.js';
9
+ import 'core-js/modules/esnext.async-iterator.reduce.js';
10
+ import 'core-js/modules/esnext.iterator.constructor.js';
11
+ import 'core-js/modules/esnext.iterator.reduce.js';
12
+ import styled_component from 'styled-components';
13
+ import { getStyleOverrides, variantsResolver, getVariantStyles } from './styleGetters.js';
14
+ import { coerceWithDefaultTheme } from './utils.js';
15
+
16
+ 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; }
17
+
18
+ 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(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; }
19
+
20
+ const styledFunction = function (tag) {
21
+ let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
22
+ name: null,
23
+ slot: null
24
+ };
25
+ const {
26
+ name: componentName,
27
+ slot: componentSlot
28
+ } = options;
29
+
30
+ const func = function (styleArg) {
31
+ for (var _len = arguments.length, expressions = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
32
+ expressions[_key - 1] = arguments[_key];
33
+ }
34
+
35
+ /*
36
+ * These are the internal expression written in dimsum
37
+ * We just coerce with the default theme in case users
38
+ * forget to add the ThemeProvider
39
+ */
40
+ const expressionsWithDefaultTheme = expressions ? expressions.map(stylesArg => typeof stylesArg === 'function' ? props => stylesArg(_objectSpread(_objectSpread({}, props), {}, {
41
+ theme: coerceWithDefaultTheme(props.theme)
42
+ })) : stylesArg) : [];
43
+ let transformedStyleArg = styleArg;
44
+ /*
45
+ * Here we get the style overrides from the user
46
+ */
47
+
48
+ if (componentName && componentSlot) {
49
+ expressionsWithDefaultTheme.push(props => {
50
+ const theme = coerceWithDefaultTheme(props.theme);
51
+ const styleOverrides = getStyleOverrides(componentName, theme);
52
+
53
+ if (styleOverrides) {
54
+ return [styleOverrides[componentSlot]];
55
+ }
56
+
57
+ return null;
58
+ });
59
+ }
60
+ /*
61
+ * Here we get the variant overrides from the user (only for the root)
62
+ */
63
+
64
+
65
+ if (componentName && componentSlot === 'root') {
66
+ expressionsWithDefaultTheme.push(props => {
67
+ const theme = coerceWithDefaultTheme(props.theme);
68
+ return variantsResolver(props, getVariantStyles(componentName, theme), theme, componentName);
69
+ });
70
+ }
71
+
72
+ const numOfCustomFnsApplied = expressionsWithDefaultTheme.length - expressions.length;
73
+
74
+ if (Array.isArray(styleArg) && numOfCustomFnsApplied > 0) {
75
+ // Here we are adding placeholders for all the new functions that we are gonna call
76
+ const placeholders = new Array(numOfCustomFnsApplied).fill('');
77
+ transformedStyleArg = Object.assign([...styleArg, ...placeholders], {
78
+ raw: [...styleArg.raw, ...placeholders]
79
+ });
80
+ } else if (typeof styleArg === 'function') {
81
+ // Here we just coerce with the default theme
82
+ transformedStyleArg = props => styleArg(_objectSpread(_objectSpread({}, props), {}, {
83
+ theme: coerceWithDefaultTheme(props.theme)
84
+ }));
85
+ }
86
+
87
+ let Component = /*#__PURE__*/styled_component(tag);
88
+ const displayName = componentName !== null && componentSlot !== null ? "".concat(componentName).concat(componentSlot) : null;
89
+
90
+ if (displayName !== null) {
91
+ Component = Component.attrs({
92
+ className: "".concat(componentName).concat(componentSlot)
93
+ });
94
+ }
95
+
96
+ Component = Component(transformedStyleArg, ...expressionsWithDefaultTheme);
97
+
98
+ if (displayName !== null) {
99
+ Component.displayName = displayName;
100
+ }
101
+
102
+ return Component;
103
+ };
104
+
105
+ return func;
106
+ };
107
+
108
+ const styledObject = Object.keys(styled_component).reduce((obj, key) => {
109
+ const castedKey = key;
110
+ obj[castedKey] = styledFunction(castedKey);
111
+ return obj;
112
+ }, {});
113
+ const styled = Object.assign(styledFunction, styledObject);
114
+
115
+ export { styled };
@@ -0,0 +1,38 @@
1
+ import 'core-js/modules/esnext.async-iterator.reduce.js';
2
+ import 'core-js/modules/esnext.iterator.constructor.js';
3
+ import 'core-js/modules/esnext.iterator.reduce.js';
4
+ import 'core-js/modules/esnext.async-iterator.every.js';
5
+ import 'core-js/modules/esnext.iterator.every.js';
6
+ import { propsToClassKey } from './utils.js';
7
+
8
+ const getStyleOverrides = (name, theme) => {
9
+ var _theme$components, _theme$components$nam;
10
+
11
+ 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;
12
+ };
13
+ const getVariantStyles = (name, theme) => {
14
+ var _theme$components2, _theme$components2$na;
15
+
16
+ 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) || [];
17
+ return variants.reduce((styles, definition) => {
18
+ const key = propsToClassKey(definition.props);
19
+ styles[key] = definition.style;
20
+ return styles;
21
+ }, {});
22
+ };
23
+ const variantsResolver = (props, styles, theme, name) => {
24
+ var _theme$components3, _theme$components3$na;
25
+
26
+ 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) || [];
27
+ return themeVariants.reduce((variantsStyles, themeVariant) => {
28
+ const isMatch = Object.keys(themeVariant.props).every(key => props[key] === themeVariant.props[key]);
29
+
30
+ if (isMatch) {
31
+ variantsStyles.push(styles[propsToClassKey(themeVariant.props)]);
32
+ }
33
+
34
+ return variantsStyles;
35
+ }, []);
36
+ };
37
+
38
+ export { getStyleOverrides, getVariantStyles, variantsResolver };
@@ -0,0 +1 @@
1
+ export { CSSObject } from 'styled-components';
@@ -0,0 +1,18 @@
1
+ import 'core-js/modules/esnext.async-iterator.reduce.js';
2
+ import 'core-js/modules/esnext.iterator.constructor.js';
3
+ import 'core-js/modules/esnext.iterator.reduce.js';
4
+ import { capitalize } from '@elliemae/ds-utilities';
5
+ import { theme } from '../theme.js';
6
+
7
+ const systemTheme = theme;
8
+ const isEmpty = string => string.length === 0;
9
+ const coerceWithDefaultTheme = themeInput => themeInput !== null && themeInput !== void 0 ? themeInput : systemTheme;
10
+ const propsToClassKey = props => Object.keys(props).sort().reduce((classKey, key) => {
11
+ if (key === 'color') {
12
+ return classKey + isEmpty(String(classKey)) ? String(props[key]) : capitalize(String(props[key]));
13
+ }
14
+
15
+ return "".concat(classKey).concat(isEmpty(String(classKey)) ? key : capitalize(key)).concat(capitalize(props[key].toString()));
16
+ }, '');
17
+
18
+ export { coerceWithDefaultTheme, isEmpty, propsToClassKey };
package/esm/th.js ADDED
@@ -0,0 +1,28 @@
1
+ import 'core-js/modules/esnext.async-iterator.for-each.js';
2
+ import 'core-js/modules/esnext.iterator.constructor.js';
3
+ import 'core-js/modules/esnext.iterator.for-each.js';
4
+
5
+ const th = property => (value, dfault) => _ref => {
6
+ var _result;
7
+
8
+ let {
9
+ theme
10
+ } = _ref;
11
+ const parts = value.split('-');
12
+ let result = theme[property];
13
+ parts.forEach(part => {
14
+ if (result) result = result[part];
15
+ });
16
+ return (_result = result) !== null && _result !== void 0 ? _result : dfault;
17
+ };
18
+ th.space = th('space');
19
+ th.fontSize = th('fontSizes');
20
+ th.fontWeight = th('fontWeights');
21
+ th.lineHeight = th('lineHeights');
22
+ th.letterSpacing = th('letterSpacings');
23
+ th.font = th('fonts');
24
+ th.color = th('colors');
25
+ th.breakpoint = th('breakpoints');
26
+ th.media = th('media');
27
+
28
+ export { th };
package/esm/utils.js CHANGED
@@ -128,17 +128,9 @@ function transition() {
128
128
  let t = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'all 1s ease';
129
129
  return "\n transition: ".concat(t, ";\n ");
130
130
  }
131
- function onlySafariAndFiredox(styles) {
132
- return css(["@media not all and (min-resolution:0.001dpcm){", "}@media screen and (min--moz-device-pixel-ratio:0){", "}"], styles, styles);
133
- }
134
- function onlySafari(styles) {
135
- return css(["@media not all and (min-resolution:0.001dpcm){", "}"], styles);
136
- }
137
- function onlyFirefox(styles) {
138
- return css(["@media screen and (min--moz-device-pixel-ratio:0){", "}"], styles);
139
- }
140
- function safariAndFirefoxBold(color) {
141
- return css(["@media not all and (min-resolution:0.001dpcm){font-weight:400;-webkit-font-smoothing:subpixel-antialiased;-webkit-text-stroke:0.4px ", ";}@media screen and (min--moz-device-pixel-ratio:0){font-weight:400;-webkit-font-smoothing:subpixel-antialiased;-webkit-text-stroke:0.4px ", ";}"], color, color);
142
- }
131
+ const onlySafariAndFirefox = styles => css(["@media not all and (min-resolution:0.001dpcm){", "}@media screen and (min--moz-device-pixel-ratio:0){", "}"], styles, styles);
132
+ const onlySafari = styles => "\n @media not all and (min-resolution: 0.001dpcm) {\n ".concat(styles, "\n }\n ");
133
+ const onlyFirefox = styles => "\n @media screen and (min--moz-device-pixel-ratio: 0) {\n ".concat(styles, "\n }\n ");
134
+ const safariAndFirefoxBold = color => "\n @media not all and (min-resolution: 0.001dpcm) {\n font-weight: 400;\n -webkit-font-smoothing: subpixel-antialiased;\n -webkit-text-stroke: 0.4px ".concat(color, ";\n }\n @media screen and (min--moz-device-pixel-ratio: 0) {\n font-weight: 400;\n -webkit-font-smoothing: subpixel-antialiased;\n -webkit-text-stroke: 0.4px ").concat(color, ";\n }\n");
143
135
 
144
- export { active, animation, border, boxShadow, buttonLink, clearFocus, color, disabled, fakeActive, fakeBorder, flexCenter, focus, focusAfter, hover, iconColor, keyframes, onlyFirefox, onlySafari, onlySafariAndFiredox, safariAndFirefoxBold, textStyle, transition, truncate };
136
+ export { active, animation, border, boxShadow, buttonLink, clearFocus, color, disabled, fakeActive, fakeBorder, flexCenter, focus, focusAfter, hover, iconColor, keyframes, onlyFirefox, onlySafari, onlySafariAndFirefox, safariAndFirefoxBold, textStyle, transition, truncate };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/ds-system",
3
- "version": "2.0.0-rc.7",
3
+ "version": "2.0.1-rc.0",
4
4
  "license": "MIT",
5
5
  "description": "ICE MT - Dimsum - System",
6
6
  "module": "./esm/index.js",
@@ -23,6 +23,26 @@
23
23
  "import": "./esm/theme.js",
24
24
  "require": "./cjs/theme.js"
25
25
  },
26
+ "./th": {
27
+ "import": "./esm/th.js",
28
+ "require": "./cjs/th.js"
29
+ },
30
+ "./styled/utils": {
31
+ "import": "./esm/styled/utils.js",
32
+ "require": "./cjs/styled/utils.js"
33
+ },
34
+ "./styled/types": {
35
+ "import": "./esm/styled/types.js",
36
+ "require": "./cjs/styled/types.js"
37
+ },
38
+ "./styled/styleGetters": {
39
+ "import": "./esm/styled/styleGetters.js",
40
+ "require": "./cjs/styled/styleGetters.js"
41
+ },
42
+ "./styled": {
43
+ "import": "./esm/styled/index.js",
44
+ "require": "./cjs/styled/index.js"
45
+ },
26
46
  "./spaceUtilities": {
27
47
  "import": "./esm/spaceUtilities.js",
28
48
  "require": "./cjs/spaceUtilities.js"
@@ -69,19 +89,19 @@
69
89
  "generateSubmodules": true
70
90
  },
71
91
  "dependencies": {
92
+ "@elliemae/ds-utilities": "2.0.1-rc.0",
72
93
  "polished": "~3.6.7"
73
94
  },
74
95
  "devDependencies": {
75
- "@elliemae/pui-theme": "~2.2.6",
76
- "styled-components": "~5.3.3",
77
- "styled-system": "~5.1.5"
96
+ "@elliemae/pui-theme": "~2.2.5",
97
+ "@testing-library/jest-dom": "~5.15.0",
98
+ "styled-components": "~5.3.3"
78
99
  },
79
100
  "peerDependencies": {
80
- "@elliemae/pui-theme": "^2.2.6",
101
+ "@elliemae/pui-theme": "^2.2.5",
81
102
  "lodash": "^4.17.21",
82
103
  "react": "~17.0.2",
83
104
  "react-dom": "^17.0.2",
84
- "styled-components": "^5.3.3",
85
- "styled-system": "^5.1.5"
105
+ "styled-components": "^5.3.3"
86
106
  }
87
107
  }
@@ -1,5 +1,5 @@
1
- export declare function getNumberAndUnit(numberStrWithUnit: string): {
1
+ export declare function getNumberAndUnit(numberStrWithUnit: string | number): {
2
2
  number: string;
3
3
  unit: string;
4
4
  };
5
- export declare function op(operator: string, n1: string, n2: string): string;
5
+ export declare function op(operator: string, n1: string, n2: string | number): string;
package/types/index.d.ts CHANGED
@@ -3,5 +3,7 @@ export * from './spaceUtilities';
3
3
  export * from './mobileUtilities';
4
4
  export * from './utils';
5
5
  export * from './arithmetic';
6
+ export * from './th';
6
7
  export * from './theme';
8
+ export * from './styled';
7
9
  export { themeProviderHOC } from './themeProviderHOC';
@@ -0,0 +1,2 @@
1
+ import { Styled } from './types';
2
+ export declare const styled: Styled;
@@ -0,0 +1,4 @@
1
+ import type { Theme, CSSObject } from './types';
2
+ export declare const getStyleOverrides: (name: string, theme: Theme) => CSSObject | null;
3
+ export declare const getVariantStyles: (name: string, theme: Theme) => Record<string, CSSObject>;
4
+ export declare const variantsResolver: (props: Record<string, unknown>, styles: CSSObject, theme: Theme, name: string) => CSSObject[keyof CSSObject][];
@@ -0,0 +1,28 @@
1
+ import React from 'react';
2
+ import type { Theme as PuiTheme } from '@elliemae/pui-theme';
3
+ import { AnyStyledComponent, CSSObject, Interpolation, InterpolationFunction, StyledComponent, StyledComponentInnerAttrs, StyledComponentInnerComponent, StyledComponentInnerOtherProps, StyledComponentPropsWithRef, ThemedStyledProps } from 'styled-components';
4
+ export { CSSObject } from 'styled-components';
5
+ export interface Theme extends PuiTheme {
6
+ components?: {
7
+ [componentName: string]: {
8
+ styleOverrides?: CSSObject;
9
+ variants?: {
10
+ props: Record<string, {
11
+ toString: () => string;
12
+ }>;
13
+ style: CSSObject;
14
+ }[];
15
+ };
16
+ };
17
+ }
18
+ export declare type ThemedStyledFunctionBase<C extends keyof JSX.IntrinsicElements | React.ComponentType<any>, T extends object, O extends object = {}, A extends keyof any = never> = <U extends object = {}>(first: TemplateStringsArray | CSSObject | InterpolationFunction<ThemedStyledProps<StyledComponentPropsWithRef<C> & O & U, T>>, ...rest: Array<Interpolation<ThemedStyledProps<StyledComponentPropsWithRef<C> & O & U, T>>>) => StyledComponent<C, T, O & U, A>;
19
+ declare type ThemedStyledComponentFactories<T extends object> = {
20
+ [TTag in keyof JSX.IntrinsicElements]: ThemedStyledFunctionBase<TTag, T>;
21
+ };
22
+ export declare type StyledFunction = <C extends AnyStyledComponent | keyof JSX.IntrinsicElements | React.ComponentType<any>>(tag: C, options?: {
23
+ name: string | null;
24
+ slot: string | null;
25
+ }) => ThemedStyledFunctionBase<C extends AnyStyledComponent ? StyledComponentInnerComponent<C> : C, Theme, C extends AnyStyledComponent ? StyledComponentInnerOtherProps<C> : {}, C extends AnyStyledComponent ? StyledComponentInnerAttrs<C> : never>;
26
+ export interface StyledObject extends ThemedStyledComponentFactories<Theme> {
27
+ }
28
+ export declare type Styled = StyledFunction & StyledObject;
@@ -0,0 +1,6 @@
1
+ import type { Theme } from './types';
2
+ export declare const isEmpty: (string: string) => boolean;
3
+ export declare const coerceWithDefaultTheme: (themeInput: Theme) => Theme;
4
+ export declare const propsToClassKey: (props: Record<string, {
5
+ toString: () => string;
6
+ }>) => string;
package/types/th.d.ts ADDED
@@ -0,0 +1,14 @@
1
+ declare type thGetter = (value: string, dfault: string) => (theme: any) => string;
2
+ declare type thConstructor = ((property: string) => thGetter) & {
3
+ space: thGetter;
4
+ fontSize: thGetter;
5
+ fontWeight: thGetter;
6
+ lineHeight: thGetter;
7
+ letterSpacing: thGetter;
8
+ font: thGetter;
9
+ color: thGetter;
10
+ breakpoint: thGetter;
11
+ media: thGetter;
12
+ };
13
+ export declare const th: thConstructor;
14
+ export {};
package/types/utils.d.ts CHANGED
@@ -2,7 +2,7 @@ import { rgba } from 'polished';
2
2
  import { Keyframes } from 'styled-components';
3
3
  import { css, withTheme, keyframes as kfrm, createGlobalStyle, useTheme } from 'styled-components';
4
4
  export { withTheme, createGlobalStyle, rgba, useTheme, kfrm, css };
5
- export declare function truncate(width: string): (props: any) => import("styled-components").FlattenSimpleInterpolation;
5
+ export declare function truncate(width?: string): (props: any) => import("styled-components").FlattenSimpleInterpolation;
6
6
  export declare function flexCenter(): string;
7
7
  export declare function disabled(): string;
8
8
  export declare function keyframes(obj: Record<string, unknown>): Keyframes;
@@ -21,7 +21,7 @@ export declare function fakeActive(): import("styled-components").FlattenInterpo
21
21
  export declare function clearFocus(): string;
22
22
  export declare function buttonLink(): string;
23
23
  export declare function transition(t?: string): string;
24
- export declare function onlySafariAndFiredox(styles: string): string;
25
- export declare function onlySafari(styles: string): string;
26
- export declare function onlyFirefox(styles: string): string;
27
- export declare function safariAndFirefoxBold(color: string): string;
24
+ export declare const onlySafariAndFirefox: (styles: string) => string;
25
+ export declare const onlySafari: (styles: string) => string;
26
+ export declare const onlyFirefox: (styles: string) => string;
27
+ export declare const safariAndFirefoxBold: (color: string) => string;