@elliemae/ds-system 2.2.0-alpha.4 → 3.0.0-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/cjs/arithmetic.js +30 -42
  2. package/cjs/constants.js +15 -43
  3. package/cjs/globalStyles.js +22 -44
  4. package/cjs/index.js +83 -42
  5. package/cjs/mobileUtilities.js +26 -57
  6. package/cjs/spaceUtilities.js +46 -72
  7. package/cjs/styled/index.d.js +2 -27
  8. package/cjs/styled/index.js +93 -57
  9. package/cjs/styled/styleGetters.js +30 -42
  10. package/cjs/styled/types.js +11 -34
  11. package/cjs/styled/utils.js +23 -46
  12. package/cjs/th.js +29 -49
  13. package/cjs/theme.js +9 -36
  14. package/cjs/themeProviderHOC.js +29 -42
  15. package/cjs/utils.js +146 -256
  16. package/esm/arithmetic.js +25 -13
  17. package/esm/constants.js +9 -14
  18. package/esm/globalStyles.js +15 -16
  19. package/esm/index.js +11 -14
  20. package/esm/mobileUtilities.js +17 -26
  21. package/esm/spaceUtilities.js +35 -43
  22. package/esm/styled/index.d.js +1 -2
  23. package/esm/styled/index.js +79 -23
  24. package/esm/styled/styleGetters.js +23 -12
  25. package/esm/styled/types.js +1 -6
  26. package/esm/styled/utils.js +16 -16
  27. package/esm/th.js +25 -20
  28. package/esm/theme.js +4 -6
  29. package/esm/themeProviderHOC.js +20 -13
  30. package/esm/utils.js +98 -227
  31. package/package.json +5 -5
  32. package/types/styled/types.d.ts +2 -1
  33. package/types/utils.d.ts +2 -1
  34. package/cjs/arithmetic.js.map +0 -7
  35. package/cjs/constants.js.map +0 -7
  36. package/cjs/globalStyles.js.map +0 -7
  37. package/cjs/index.js.map +0 -7
  38. package/cjs/mobileUtilities.js.map +0 -7
  39. package/cjs/spaceUtilities.js.map +0 -7
  40. package/cjs/styled/index.d.js.map +0 -7
  41. package/cjs/styled/index.js.map +0 -7
  42. package/cjs/styled/styleGetters.js.map +0 -7
  43. package/cjs/styled/types.js.map +0 -7
  44. package/cjs/styled/utils.js.map +0 -7
  45. package/cjs/th.js.map +0 -7
  46. package/cjs/theme.js.map +0 -7
  47. package/cjs/themeProviderHOC.js.map +0 -7
  48. package/cjs/utils.js.map +0 -7
  49. package/esm/arithmetic.js.map +0 -7
  50. package/esm/constants.js.map +0 -7
  51. package/esm/globalStyles.js.map +0 -7
  52. package/esm/index.js.map +0 -7
  53. package/esm/mobileUtilities.js.map +0 -7
  54. package/esm/spaceUtilities.js.map +0 -7
  55. package/esm/styled/index.d.js.map +0 -7
  56. package/esm/styled/index.js.map +0 -7
  57. package/esm/styled/styleGetters.js.map +0 -7
  58. package/esm/styled/types.js.map +0 -7
  59. package/esm/styled/utils.js.map +0 -7
  60. package/esm/th.js.map +0 -7
  61. package/esm/theme.js.map +0 -7
  62. package/esm/themeProviderHOC.js.map +0 -7
  63. package/esm/utils.js.map +0 -7
package/cjs/utils.js CHANGED
@@ -1,294 +1,184 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __reExport = (target, module2, copyDefault, desc) => {
13
- if (module2 && typeof module2 === "object" || typeof module2 === "function") {
14
- for (let key of __getOwnPropNames(module2))
15
- if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
16
- __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
17
- }
18
- return target;
19
- };
20
- var __toESM = (module2, isNodeMode) => {
21
- return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
22
- };
23
- var __toCommonJS = /* @__PURE__ */ ((cache) => {
24
- return (module2, temp) => {
25
- return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
26
- };
27
- })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
28
- var utils_exports = {};
29
- __export(utils_exports, {
30
- active: () => active,
31
- animation: () => animation,
32
- border: () => border,
33
- boxShadow: () => boxShadow,
34
- buttonLink: () => buttonLink,
35
- clearFocus: () => clearFocus,
36
- color: () => color,
37
- createGlobalStyle: () => import_styled_components.createGlobalStyle,
38
- css: () => import_styled_components.css,
39
- disabled: () => disabled,
40
- fakeActive: () => fakeActive,
41
- fakeBorder: () => fakeBorder,
42
- flexCenter: () => flexCenter,
43
- focus: () => focus,
44
- focusAfter: () => focusAfter,
45
- hover: () => hover,
46
- iconColor: () => iconColor,
47
- keyframes: () => keyframes,
48
- kfrm: () => import_styled_components.keyframes,
49
- onlyFirefox: () => onlyFirefox,
50
- onlySafari: () => onlySafari,
51
- onlySafariAndFirefox: () => onlySafariAndFirefox,
52
- rgba: () => import_polished.rgba,
53
- safariAndFirefoxBold: () => safariAndFirefoxBold,
54
- textStyle: () => textStyle,
55
- transition: () => transition,
56
- truncate: () => truncate,
57
- useTheme: () => import_styled_components.useTheme,
58
- withTheme: () => import_styled_components.withTheme
59
- });
60
- var React = __toESM(require("react"));
61
- var import_polished = require("polished");
62
- var import_lodash = require("lodash");
63
- var import_styled_components = require("styled-components");
64
- var import_theme = require("./theme");
65
- var import_mobileUtilities = require("./mobileUtilities");
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var polished = require('polished');
6
+ var lodash = require('lodash');
7
+ var theme = require('./theme.js');
8
+ var mobileUtilities = require('./mobileUtilities.js');
9
+ var styled_component = require('styled-components');
10
+
11
+ /* eslint-disable no-shadow */
66
12
  function truncate(width) {
67
- return (props) => import_styled_components.css`
68
- ${!!width || props.width ? `width: ${props.width || width};` : ""}
69
- white-space: nowrap;
70
- overflow: hidden;
71
- text-overflow: ellipsis;
72
- `;
13
+ return props => styled_component.css(["", " white-space:nowrap;overflow:hidden;text-overflow:ellipsis;"], !!width || props.width ? "width: ".concat(props.width || width, ";") : '');
73
14
  }
74
15
  function flexCenter() {
75
- return `
76
- display: flex;
77
- justify-content: center;
78
- align-items: center;
79
- `;
16
+ return "\n display: flex;\n justify-content: center;\n align-items: center;\n ";
80
17
  }
81
18
  function disabled() {
82
- return `
83
- cursor: not-allowed;
84
- pointer-events: none;
85
- `;
19
+ return "\n cursor: not-allowed;\n pointer-events: none;\n ";
86
20
  }
87
21
  function keyframes(obj) {
88
- return import_styled_components.keyframes`${(0, import_lodash.reduce)(obj, (result, value, key) => `
89
- ${result}
90
- ${key}% {
91
- ${value}
92
- }
93
- `, "")}
94
- `;
95
- }
96
- function boxShadow(top, left, blur, color2, inset = false) {
97
- return `box-shadow: ${inset ? "inset" : ""} ${top} ${left} ${blur} ${color2};`;
98
- }
99
- function color(variant = "neutral", type = 400) {
100
- return import_styled_components.css`
101
- color: ${(props) => props.theme.colors[variant][type]};
102
- `;
103
- }
104
- function border(color2 = import_theme.theme.colors.brand[600], size = "1px", type = "solid") {
105
- return `${size} ${type} ${color2}`;
22
+ return styled_component.keyframes(["", ""], lodash.reduce(obj, (result, value, key) => "\n ".concat(result, "\n ").concat(key, "% {\n ").concat(value, "\n }\n "), ''));
23
+ } // eslint-disable-next-line max-params
24
+
25
+ function boxShadow(top, left, blur, color) {
26
+ let inset = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
27
+ return "box-shadow: ".concat(inset ? 'inset' : '', " ").concat(top, " ").concat(left, " ").concat(blur, " ").concat(color, ";");
28
+ }
29
+ function color() {
30
+ let variant = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'neutral';
31
+ let type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 400;
32
+ return styled_component.css(["color:", ";"], props => props.theme.colors[variant][type]);
33
+ }
34
+ function border() {
35
+ let color = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : theme.theme.colors.brand[600];
36
+ let size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '1px';
37
+ let type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'solid';
38
+ return "".concat(size, " ").concat(type, " ").concat(color);
106
39
  }
107
40
  function animation(animationKeyframes, animationLength, animationTimingFn) {
108
- return (props) => import_styled_components.css`
109
- animation: ${props.animationKeyframes || animationKeyframes} ${props.animationLength || animationLength}
110
- ${props.animationTimingFn || animationTimingFn};
111
- `;
112
- }
113
- function focus(color2 = import_theme.theme.colors.brand[600]) {
114
- return () => import_styled_components.css`
115
- outline: none;
116
- border: 1px solid ${color2};
117
- box-shadow: inset 0 0 0 1px ${(0, import_polished.lighten)(0.3, color2)};
118
- border-radius: 2px;
119
- `;
41
+ return props => styled_component.css(["animation:", " ", " ", ";"], props.animationKeyframes || animationKeyframes, props.animationLength || animationLength, props.animationTimingFn || animationTimingFn);
42
+ } // 0.0769
43
+
44
+ function focus() {
45
+ let color = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : theme.theme.colors.brand[600];
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));
120
47
  }
121
- function focusAfter(color2) {
122
- return import_styled_components.css`
123
- outline: none;
124
- position: relative;
125
- &:after {
126
- content: '';
127
- z-index: 10;
128
- position: absolute;
129
- top: 0;
130
- left: 0;
131
- width: 100%;
132
- height: 100%;
133
- pointer-events: none;
134
- ${focus(color2)}
135
- }
136
- `;
48
+ function focusAfter(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));
137
50
  }
138
51
  function active() {
139
- return (props) => import_styled_components.css`
140
- outline: none;
141
- border: 1px solid ${props.theme.colors.brand[700]};
142
- border-radius: 2px;
143
- `;
52
+ return props => styled_component.css(["outline:none;border:1px solid ", ";border-radius:2px;"], props.theme.colors.brand[700]);
144
53
  }
145
54
  function hover() {
146
- return (props) => import_styled_components.css`
147
- outline: 1px solid ${props.theme.colors.brand[600]};
148
- outline-offset: -1px;
149
- `;
150
- }
151
- function textStyle(type, weight = "regular") {
152
- return (props) => {
153
- let cssVar = `font-weight: ${props.theme.fontWeights[weight]};`;
55
+ return props => styled_component.css(["outline:1px solid ", ";outline-offset:-1px;"], props.theme.colors.brand[600]);
56
+ }
57
+ function textStyle(type) {
58
+ let weight = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'regular';
59
+ // eslint-disable-next-line complexity
60
+ return props => {
61
+ let cssVar = "font-weight: ".concat(props.theme.fontWeights[weight], ";"); // eslint-disable-next-line default-case
62
+
154
63
  switch (type) {
155
- case "h1":
156
- cssVar += `
157
- font-size: ${(0, import_mobileUtilities.toMobile)("2.7692rem")};
158
- line-height: normal;
159
- `;
64
+ case 'h1':
65
+ cssVar += "\n font-size: ".concat(mobileUtilities.toMobile('2.7692rem'), ";\n line-height: normal;\n ");
160
66
  break;
161
- case "h2":
162
- cssVar += `
163
- font-size: ${(0, import_mobileUtilities.toMobile)(props.theme.fontSizes.title[800])};
164
- line-height: normal;
165
- `;
67
+
68
+ case 'h2':
69
+ cssVar += "\n font-size: ".concat(mobileUtilities.toMobile(props.theme.fontSizes.title[800]), ";\n line-height: normal;\n ");
166
70
  break;
167
- case "h3":
168
- cssVar += `
169
- font-size: ${(0, import_mobileUtilities.toMobile)(props.theme.fontSizes.title[700])};
170
- line-height: 1.2;
171
- `;
71
+
72
+ case 'h3':
73
+ cssVar += "\n font-size: ".concat(mobileUtilities.toMobile(props.theme.fontSizes.title[700]), ";\n line-height: 1.2;\n ");
172
74
  break;
173
- case "h4":
174
- cssVar += `
175
- font-size: ${(0, import_mobileUtilities.toMobile)(props.theme.fontSizes.title[600])};
176
- line-height: normal;
177
- `;
75
+
76
+ case 'h4':
77
+ cssVar += "\n font-size: ".concat(mobileUtilities.toMobile(props.theme.fontSizes.title[600]), ";\n line-height: normal;\n ");
178
78
  break;
179
- case "h5":
180
- cssVar += `
181
- font-size: ${(0, import_mobileUtilities.toMobile)(props.theme.fontSizes.title[500])};
182
- line-height: normal;
183
- `;
79
+
80
+ case 'h5':
81
+ cssVar += "\n font-size: ".concat(mobileUtilities.toMobile(props.theme.fontSizes.title[500]), ";\n line-height: normal;\n ");
184
82
  break;
185
- case "section-header":
186
- cssVar += `
187
- font-size: ${(0, import_mobileUtilities.toMobile)(props.theme.fontSizes.title[500])};
188
- line-height: normal;
189
- text-transform: uppercase;
190
- `;
83
+
84
+ case 'section-header':
85
+ cssVar += "\n font-size: ".concat(mobileUtilities.toMobile(props.theme.fontSizes.title[500]), ";\n line-height: normal;\n text-transform: uppercase;\n ");
191
86
  break;
192
- case "body":
193
- cssVar += `
194
- font-size: ${(0, import_mobileUtilities.toMobile)(props.theme.fontSizes.value[400])};
195
- line-height: normal;
196
- `;
87
+
88
+ case 'body':
89
+ cssVar += "\n font-size: ".concat(mobileUtilities.toMobile(props.theme.fontSizes.value[400]), ";\n line-height: normal;\n ");
197
90
  break;
198
- case "body-small":
199
- cssVar += `
200
- font-size: ${(0, import_mobileUtilities.toMobile)(props.theme.fontSizes.value[300])};
201
- line-height: normal;
202
- `;
91
+
92
+ case 'body-small':
93
+ cssVar += "\n font-size: ".concat(mobileUtilities.toMobile(props.theme.fontSizes.value[300]), ";\n line-height: normal;\n ");
203
94
  break;
204
- case "body-micro":
205
- cssVar += `
206
- font-size: ${(0, import_mobileUtilities.toMobile)(props.theme.fontSizes.microText[200])};
207
- line-height: normal;
208
- `;
95
+
96
+ case 'body-micro':
97
+ cssVar += "\n font-size: ".concat(mobileUtilities.toMobile(props.theme.fontSizes.microText[200]), ";\n line-height: normal;\n ");
209
98
  break;
210
- case "list":
211
- cssVar += `
212
- font-size: ${(0, import_mobileUtilities.toMobile)(props.theme.fontSizes.value[400])};
213
- line-height: normal;
214
- `;
99
+
100
+ case 'list':
101
+ cssVar += "\n font-size: ".concat(mobileUtilities.toMobile(props.theme.fontSizes.value[400]), ";\n line-height: normal;\n ");
215
102
  break;
216
- case "link":
217
- cssVar += `
218
- line-height: ${props.theme.xl};
219
- color: ${props.theme.colors.brand[600]};
220
- cursor: pointer;
221
- `;
103
+
104
+ case 'link':
105
+ cssVar += "\n line-height: ".concat(props.theme.xl, ";\n color: ").concat(props.theme.colors.brand[600], ";\n cursor: pointer;\n ");
222
106
  break;
223
107
  }
108
+
224
109
  return cssVar;
225
110
  };
226
111
  }
227
- function iconColor(variant = "neutral", type = 400) {
228
- return import_styled_components.css`
229
- fill: ${(props) => props.theme.colors[variant][type]};
230
- `;
112
+ function iconColor() {
113
+ let variant = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'neutral';
114
+ let type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 400;
115
+ return styled_component.css(["fill:", ";"], props => props.theme.colors[variant][type]);
231
116
  }
232
117
  function fakeBorder() {
233
- return import_styled_components.css`
234
- box-shadow: inset 0 0 0 1px ${(props) => props.theme.colors.neutral[200]};
235
- border-radius: 2px;
236
- `;
118
+ return styled_component.css(["box-shadow:inset 0 0 0 1px ", ";border-radius:2px;"], props => props.theme.colors.neutral[200]);
237
119
  }
238
120
  function fakeActive() {
239
- return import_styled_components.css`
240
- outline: none;
241
- box-shadow: inset 0 0 0 1px ${(props) => props.theme.colors.brand[700]};
242
- border-radius: 2px;
243
- `;
121
+ return styled_component.css(["outline:none;box-shadow:inset 0 0 0 1px ", ";border-radius:2px;"], props => props.theme.colors.brand[700]);
244
122
  }
245
123
  function clearFocus() {
246
- return `
247
- border: none;
248
- box-shadow: none;
249
- `;
124
+ return "\n border: none;\n box-shadow: none;\n ";
250
125
  }
251
126
  function buttonLink() {
252
- return `
253
- background-color: transparent;
254
- border: 1px solid transparent;
255
- cursor: pointer;
256
- `;
257
- }
258
- function transition(t = "all 1s ease") {
259
- return `
260
- transition: ${t};
261
- `;
262
- }
263
- const onlySafariAndFirefox = (styles) => import_styled_components.css`
264
- @media not all and (min-resolution: 0.001dpcm) {
265
- ${styles}
266
- }
267
- @media screen and (min--moz-device-pixel-ratio: 0) {
268
- ${styles}
269
- }
270
- `;
271
- const onlySafari = (styles) => `
272
- @media not all and (min-resolution: 0.001dpcm) {
273
- ${styles}
274
- }
275
- `;
276
- const onlyFirefox = (styles) => `
277
- @media screen and (min--moz-device-pixel-ratio: 0) {
278
- ${styles}
279
- }
280
- `;
281
- const safariAndFirefoxBold = (color2) => `
282
- @media not all and (min-resolution: 0.001dpcm) {
283
- font-weight: 400;
284
- -webkit-font-smoothing: subpixel-antialiased;
285
- -webkit-text-stroke: 0.4px ${color2};
286
- }
287
- @media screen and (min--moz-device-pixel-ratio: 0) {
288
- font-weight: 400;
289
- -webkit-font-smoothing: subpixel-antialiased;
290
- -webkit-text-stroke: 0.4px ${color2};
291
- }
292
- `;
293
- module.exports = __toCommonJS(utils_exports);
294
- //# sourceMappingURL=utils.js.map
127
+ return "\n background-color: transparent;\n border: 1px solid transparent;\n cursor: pointer;\n ";
128
+ }
129
+ function transition() {
130
+ let t = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'all 1s ease';
131
+ return "\n transition: ".concat(t, ";\n ");
132
+ }
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");
137
+
138
+ Object.defineProperty(exports, 'rgba', {
139
+ enumerable: true,
140
+ get: function () { return polished.rgba; }
141
+ });
142
+ Object.defineProperty(exports, 'createGlobalStyle', {
143
+ enumerable: true,
144
+ get: function () { return styled_component.createGlobalStyle; }
145
+ });
146
+ Object.defineProperty(exports, 'css', {
147
+ enumerable: true,
148
+ get: function () { return styled_component.css; }
149
+ });
150
+ Object.defineProperty(exports, 'kfrm', {
151
+ enumerable: true,
152
+ get: function () { return styled_component.keyframes; }
153
+ });
154
+ Object.defineProperty(exports, 'useTheme', {
155
+ enumerable: true,
156
+ get: function () { return styled_component.useTheme; }
157
+ });
158
+ Object.defineProperty(exports, 'withTheme', {
159
+ enumerable: true,
160
+ get: function () { return styled_component.withTheme; }
161
+ });
162
+ exports.active = active;
163
+ exports.animation = animation;
164
+ exports.border = border;
165
+ exports.boxShadow = boxShadow;
166
+ exports.buttonLink = buttonLink;
167
+ exports.clearFocus = clearFocus;
168
+ exports.color = color;
169
+ exports.disabled = disabled;
170
+ exports.fakeActive = fakeActive;
171
+ exports.fakeBorder = fakeBorder;
172
+ exports.flexCenter = flexCenter;
173
+ exports.focus = focus;
174
+ exports.focusAfter = focusAfter;
175
+ exports.hover = hover;
176
+ exports.iconColor = iconColor;
177
+ exports.keyframes = keyframes;
178
+ exports.onlyFirefox = onlyFirefox;
179
+ exports.onlySafari = onlySafari;
180
+ exports.onlySafariAndFirefox = onlySafariAndFirefox;
181
+ exports.safariAndFirefoxBold = safariAndFirefoxBold;
182
+ exports.textStyle = textStyle;
183
+ exports.transition = transition;
184
+ exports.truncate = truncate;
package/esm/arithmetic.js CHANGED
@@ -1,26 +1,38 @@
1
- import * as React from "react";
1
+ import 'core-js/modules/web.dom-collections.iterator.js';
2
+
2
3
  function getNumberAndUnit(numberStrWithUnit) {
3
4
  const [number, unit] = String(numberStrWithUnit).match(/[a-z]+|[(/^\-?\d*.\d+|\d+),?]+/gi);
4
- return { number, unit };
5
+ return {
6
+ number,
7
+ unit
8
+ };
5
9
  }
6
10
  function op(operator, n1, n2) {
7
- const { number, unit } = getNumberAndUnit(n1);
8
- const { number: number2, unit: unit2 } = getNumberAndUnit(n2);
11
+ const {
12
+ number,
13
+ unit
14
+ } = getNumberAndUnit(n1);
15
+ const {
16
+ number: number2,
17
+ unit: unit2
18
+ } = getNumberAndUnit(n2);
19
+
9
20
  switch (operator) {
10
- case "*":
21
+ case '*':
11
22
  return Number(number) * Number(number2) + (unit || unit2);
12
- case "+":
23
+
24
+ case '+':
13
25
  return Number(number) + Number(number2) + (unit || unit2);
14
- case "-":
26
+
27
+ case '-':
15
28
  return Number(number) - Number(number2) + (unit || unit2);
16
- case "/":
29
+
30
+ case '/':
17
31
  return Number(number) / Number(number2) + (unit || unit2);
32
+
18
33
  default:
19
34
  return Number(number) + Number(number2) + (unit || unit2);
20
35
  }
21
36
  }
22
- export {
23
- getNumberAndUnit,
24
- op
25
- };
26
- //# sourceMappingURL=arithmetic.js.map
37
+
38
+ export { getNumberAndUnit, op };
package/esm/constants.js CHANGED
@@ -1,18 +1,13 @@
1
- import * as React from "react";
2
1
  const desktopBaseFont = 13;
3
2
  const mobileBaseFont = 16;
4
3
  const translateUnits = {
5
- "8px": "4px",
6
- "16px": "8px",
7
- "32px": "16px",
8
- "48px": "24px",
9
- "56px": "32px",
10
- "64px": "48px",
11
- "72px": "64px"
4
+ '8px': '4px',
5
+ '16px': '8px',
6
+ '32px': '16px',
7
+ '48px': '24px',
8
+ '56px': '32px',
9
+ '64px': '48px',
10
+ '72px': '64px'
12
11
  };
13
- export {
14
- desktopBaseFont,
15
- mobileBaseFont,
16
- translateUnits
17
- };
18
- //# sourceMappingURL=constants.js.map
12
+
13
+ export { desktopBaseFont, mobileBaseFont, translateUnits };
@@ -1,18 +1,17 @@
1
- import * as React from "react";
2
- import { createGlobalStyle } from "./utils";
3
- const GlobalStyles = createGlobalStyle`
4
- :root, body {
5
- overscroll-behavior-y: none;
1
+ import _taggedTemplateLiteral from '@babel/runtime/helpers/esm/taggedTemplateLiteral';
2
+ import 'polished';
3
+ import 'lodash';
4
+ import './theme.js';
5
+ import 'core-js/modules/web.dom-collections.iterator.js';
6
+ import 'react';
7
+ import { createGlobalStyle } from 'styled-components';
6
8
 
7
- font-size: ${(props) => props.device === "desktop" ? "13px" : "16px"};
9
+ var _templateObject;
10
+ const GlobalStyles = createGlobalStyle(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n :root, body {\n overscroll-behavior-y: none;\n\n font-size: ", ";\n\n @media(min-width: ", ") {\n font-size: ", ";\n }\n\n }\n"])), props => props.device === 'desktop' ? '13px' : '16px', _ref => {
11
+ let {
12
+ theme
13
+ } = _ref;
14
+ return theme.breakpoints.small;
15
+ }, props => props.device === 'mobile' ? '16px' : '13px');
8
16
 
9
- @media(min-width: ${({ theme }) => theme.breakpoints.small}) {
10
- font-size: ${(props) => props.device === "mobile" ? "16px" : "13px"};
11
- }
12
-
13
- }
14
- `;
15
- export {
16
- GlobalStyles
17
- };
18
- //# sourceMappingURL=globalStyles.js.map
17
+ export { GlobalStyles };
package/esm/index.js CHANGED
@@ -1,14 +1,11 @@
1
- import * as React from "react";
2
- export * from "./globalStyles";
3
- export * from "./spaceUtilities";
4
- export * from "./mobileUtilities";
5
- export * from "./utils";
6
- export * from "./arithmetic";
7
- export * from "./th";
8
- export * from "./theme";
9
- export * from "./styled";
10
- import { themeProviderHOC } from "./themeProviderHOC";
11
- export {
12
- themeProviderHOC
13
- };
14
- //# sourceMappingURL=index.js.map
1
+ export { GlobalStyles } from './globalStyles.js';
2
+ export { fixSpace, fixSpaceGutter, mapGap, mapGrid, mapGutter, mapSpace, mapTemplateGrid, numbersToFr } from './spaceUtilities.js';
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, onlySafariAndFirefox, safariAndFirefoxBold, textStyle, transition, truncate } from './utils.js';
5
+ export { getNumberAndUnit, op } from './arithmetic.js';
6
+ export { th } from './th.js';
7
+ export { theme } from './theme.js';
8
+ export { styled } from './styled/index.js';
9
+ export { themeProviderHOC } from './themeProviderHOC.js';
10
+ export { createGlobalStyle, css, keyframes as kfrm, useTheme, withTheme } from 'styled-components';
11
+ export { rgba } from 'polished';
@@ -1,16 +1,15 @@
1
- import * as React from "react";
2
- import { useState, useEffect } from "react";
3
- import { theme } from "./theme";
4
- import { desktopBaseFont, mobileBaseFont, translateUnits } from "./constants";
1
+ import 'core-js/modules/web.dom-collections.iterator.js';
2
+ import { useState, useEffect } from 'react';
3
+ import { theme } from './theme.js';
4
+ import { translateUnits, mobileBaseFont, desktopBaseFont } from './constants.js';
5
+
5
6
  function __UNSAFE_SPACE_TO_DIMSUM(unit) {
6
- if (translateUnits[unit])
7
- return translateUnits[unit];
8
- return `${parseFloat(unit) * (mobileBaseFont / desktopBaseFont) / 2}px`;
7
+ if (translateUnits[unit]) return translateUnits[unit];
8
+ return "".concat(parseFloat(unit) * (mobileBaseFont / desktopBaseFont) / 2, "px");
9
9
  }
10
10
  function toMobile(unit) {
11
- if (!isMobile())
12
- return unit;
13
- return `${parseFloat(unit) * (desktopBaseFont / mobileBaseFont)}rem`;
11
+ if (!isMobile()) return unit;
12
+ return "".concat(parseFloat(unit) * (desktopBaseFont / mobileBaseFont), "rem");
14
13
  }
15
14
  const useIsMobile = () => {
16
15
  const [mobile, setMobile] = useState(isMobile());
@@ -18,26 +17,18 @@ const useIsMobile = () => {
18
17
  function handleResize() {
19
18
  setMobile(isMobile());
20
19
  }
21
- if (window)
22
- window.addEventListener("resize", handleResize);
20
+
21
+ if (window) window.addEventListener('resize', handleResize);
23
22
  return () => {
24
- if (window)
25
- window.removeEventListener("resize", handleResize);
23
+ if (window) window.removeEventListener('resize', handleResize);
26
24
  };
27
25
  }, []);
28
- if (!window)
29
- return false;
26
+ if (!window) return false;
30
27
  return mobile;
31
28
  };
32
29
  const isMobile = () => {
33
- if (!window)
34
- return false;
35
- return Number(theme.breakpoints.medium.split("px")[0]) - window.innerWidth >= 0;
30
+ if (!window) return false;
31
+ return Number(theme.breakpoints.medium.split('px')[0]) - window.innerWidth >= 0;
36
32
  };
37
- export {
38
- __UNSAFE_SPACE_TO_DIMSUM,
39
- isMobile,
40
- toMobile,
41
- useIsMobile
42
- };
43
- //# sourceMappingURL=mobileUtilities.js.map
33
+
34
+ export { __UNSAFE_SPACE_TO_DIMSUM, isMobile, toMobile, useIsMobile };