@elliemae/ds-system 2.2.0-alpha.3 → 3.0.0-next.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.
Files changed (61) 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 -257
  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 -228
  31. package/package.json +2 -2
  32. package/cjs/arithmetic.js.map +0 -7
  33. package/cjs/constants.js.map +0 -7
  34. package/cjs/globalStyles.js.map +0 -7
  35. package/cjs/index.js.map +0 -7
  36. package/cjs/mobileUtilities.js.map +0 -7
  37. package/cjs/spaceUtilities.js.map +0 -7
  38. package/cjs/styled/index.d.js.map +0 -7
  39. package/cjs/styled/index.js.map +0 -7
  40. package/cjs/styled/styleGetters.js.map +0 -7
  41. package/cjs/styled/types.js.map +0 -7
  42. package/cjs/styled/utils.js.map +0 -7
  43. package/cjs/th.js.map +0 -7
  44. package/cjs/theme.js.map +0 -7
  45. package/cjs/themeProviderHOC.js.map +0 -7
  46. package/cjs/utils.js.map +0 -7
  47. package/esm/arithmetic.js.map +0 -7
  48. package/esm/constants.js.map +0 -7
  49. package/esm/globalStyles.js.map +0 -7
  50. package/esm/index.js.map +0 -7
  51. package/esm/mobileUtilities.js.map +0 -7
  52. package/esm/spaceUtilities.js.map +0 -7
  53. package/esm/styled/index.d.js.map +0 -7
  54. package/esm/styled/index.js.map +0 -7
  55. package/esm/styled/styleGetters.js.map +0 -7
  56. package/esm/styled/types.js.map +0 -7
  57. package/esm/styled/utils.js.map +0 -7
  58. package/esm/th.js.map +0 -7
  59. package/esm/theme.js.map +0 -7
  60. package/esm/themeProviderHOC.js.map +0 -7
  61. package/esm/utils.js.map +0 -7
package/cjs/utils.js CHANGED
@@ -1,295 +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_components2.createGlobalStyle,
38
- css: () => import_styled_components2.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_components2.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_components2.useTheme,
58
- withTheme: () => import_styled_components2.withTheme
59
- });
60
- var React = __toESM(require("react"));
61
- var import_polished = __toESM(require("polished"));
62
- var import_lodash = __toESM(require("lodash"));
63
- var import_theme = __toESM(require("./theme"));
64
- var import_mobileUtilities = __toESM(require("./mobileUtilities"));
65
- var import_styled_components2 = __toESM(require("styled-components"));
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_components2.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_components2.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_components2.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_components2.css`
109
- animation: ${props.animationKeyframes || animationKeyframes}
110
- ${props.animationLength || animationLength}
111
- ${props.animationTimingFn || animationTimingFn};
112
- `;
113
- }
114
- function focus(color2 = import_theme.theme.colors.brand[600]) {
115
- return () => import_styled_components2.css`
116
- outline: none;
117
- border: 1px solid ${color2};
118
- box-shadow: inset 0 0 0 1px ${(0, import_polished.lighten)(0.3, color2)};
119
- border-radius: 2px;
120
- `;
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));
121
47
  }
122
- function focusAfter(color2) {
123
- return import_styled_components2.css`
124
- outline: none;
125
- position: relative;
126
- &:after {
127
- content: '';
128
- z-index: 10;
129
- position: absolute;
130
- top: 0;
131
- left: 0;
132
- width: 100%;
133
- height: 100%;
134
- pointer-events: none;
135
- ${focus(color2)}
136
- }
137
- `;
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));
138
50
  }
139
51
  function active() {
140
- return (props) => import_styled_components2.css`
141
- outline: none;
142
- border: 1px solid ${props.theme.colors.brand[700]};
143
- border-radius: 2px;
144
- `;
52
+ return props => styled_component.css(["outline:none;border:1px solid ", ";border-radius:2px;"], props.theme.colors.brand[700]);
145
53
  }
146
54
  function hover() {
147
- return (props) => import_styled_components2.css`
148
- outline: 1px solid ${props.theme.colors.brand[600]};
149
- outline-offset: -1px;
150
- `;
151
- }
152
- function textStyle(type, weight = "regular") {
153
- return (props) => {
154
- 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
+
155
63
  switch (type) {
156
- case "h1":
157
- cssVar += `
158
- font-size: ${(0, import_mobileUtilities.toMobile)("2.7692rem")};
159
- line-height: normal;
160
- `;
64
+ case 'h1':
65
+ cssVar += "\n font-size: ".concat(mobileUtilities.toMobile('2.7692rem'), ";\n line-height: normal;\n ");
161
66
  break;
162
- case "h2":
163
- cssVar += `
164
- font-size: ${(0, import_mobileUtilities.toMobile)(props.theme.fontSizes.title[800])};
165
- line-height: normal;
166
- `;
67
+
68
+ case 'h2':
69
+ cssVar += "\n font-size: ".concat(mobileUtilities.toMobile(props.theme.fontSizes.title[800]), ";\n line-height: normal;\n ");
167
70
  break;
168
- case "h3":
169
- cssVar += `
170
- font-size: ${(0, import_mobileUtilities.toMobile)(props.theme.fontSizes.title[700])};
171
- line-height: 1.2;
172
- `;
71
+
72
+ case 'h3':
73
+ cssVar += "\n font-size: ".concat(mobileUtilities.toMobile(props.theme.fontSizes.title[700]), ";\n line-height: 1.2;\n ");
173
74
  break;
174
- case "h4":
175
- cssVar += `
176
- font-size: ${(0, import_mobileUtilities.toMobile)(props.theme.fontSizes.title[600])};
177
- line-height: normal;
178
- `;
75
+
76
+ case 'h4':
77
+ cssVar += "\n font-size: ".concat(mobileUtilities.toMobile(props.theme.fontSizes.title[600]), ";\n line-height: normal;\n ");
179
78
  break;
180
- case "h5":
181
- cssVar += `
182
- font-size: ${(0, import_mobileUtilities.toMobile)(props.theme.fontSizes.title[500])};
183
- line-height: normal;
184
- `;
79
+
80
+ case 'h5':
81
+ cssVar += "\n font-size: ".concat(mobileUtilities.toMobile(props.theme.fontSizes.title[500]), ";\n line-height: normal;\n ");
185
82
  break;
186
- case "section-header":
187
- cssVar += `
188
- font-size: ${(0, import_mobileUtilities.toMobile)(props.theme.fontSizes.title[500])};
189
- line-height: normal;
190
- text-transform: uppercase;
191
- `;
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 ");
192
86
  break;
193
- case "body":
194
- cssVar += `
195
- font-size: ${(0, import_mobileUtilities.toMobile)(props.theme.fontSizes.value[400])};
196
- line-height: normal;
197
- `;
87
+
88
+ case 'body':
89
+ cssVar += "\n font-size: ".concat(mobileUtilities.toMobile(props.theme.fontSizes.value[400]), ";\n line-height: normal;\n ");
198
90
  break;
199
- case "body-small":
200
- cssVar += `
201
- font-size: ${(0, import_mobileUtilities.toMobile)(props.theme.fontSizes.value[300])};
202
- line-height: normal;
203
- `;
91
+
92
+ case 'body-small':
93
+ cssVar += "\n font-size: ".concat(mobileUtilities.toMobile(props.theme.fontSizes.value[300]), ";\n line-height: normal;\n ");
204
94
  break;
205
- case "body-micro":
206
- cssVar += `
207
- font-size: ${(0, import_mobileUtilities.toMobile)(props.theme.fontSizes.microText[200])};
208
- line-height: normal;
209
- `;
95
+
96
+ case 'body-micro':
97
+ cssVar += "\n font-size: ".concat(mobileUtilities.toMobile(props.theme.fontSizes.microText[200]), ";\n line-height: normal;\n ");
210
98
  break;
211
- case "list":
212
- cssVar += `
213
- font-size: ${(0, import_mobileUtilities.toMobile)(props.theme.fontSizes.value[400])};
214
- line-height: normal;
215
- `;
99
+
100
+ case 'list':
101
+ cssVar += "\n font-size: ".concat(mobileUtilities.toMobile(props.theme.fontSizes.value[400]), ";\n line-height: normal;\n ");
216
102
  break;
217
- case "link":
218
- cssVar += `
219
- line-height: ${props.theme.xl};
220
- color: ${props.theme.colors.brand[600]};
221
- cursor: pointer;
222
- `;
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 ");
223
106
  break;
224
107
  }
108
+
225
109
  return cssVar;
226
110
  };
227
111
  }
228
- function iconColor(variant = "neutral", type = 400) {
229
- return import_styled_components2.css`
230
- fill: ${(props) => props.theme.colors[variant][type]};
231
- `;
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]);
232
116
  }
233
117
  function fakeBorder() {
234
- return import_styled_components2.css`
235
- box-shadow: inset 0 0 0 1px ${(props) => props.theme.colors.neutral[200]};
236
- border-radius: 2px;
237
- `;
118
+ return styled_component.css(["box-shadow:inset 0 0 0 1px ", ";border-radius:2px;"], props => props.theme.colors.neutral[200]);
238
119
  }
239
120
  function fakeActive() {
240
- return import_styled_components2.css`
241
- outline: none;
242
- box-shadow: inset 0 0 0 1px ${(props) => props.theme.colors.brand[700]};
243
- border-radius: 2px;
244
- `;
121
+ return styled_component.css(["outline:none;box-shadow:inset 0 0 0 1px ", ";border-radius:2px;"], props => props.theme.colors.brand[700]);
245
122
  }
246
123
  function clearFocus() {
247
- return `
248
- border: none;
249
- box-shadow: none;
250
- `;
124
+ return "\n border: none;\n box-shadow: none;\n ";
251
125
  }
252
126
  function buttonLink() {
253
- return `
254
- background-color: transparent;
255
- border: 1px solid transparent;
256
- cursor: pointer;
257
- `;
258
- }
259
- function transition(t = "all 1s ease") {
260
- return `
261
- transition: ${t};
262
- `;
263
- }
264
- const onlySafariAndFirefox = (styles) => import_styled_components2.css`
265
- @media not all and (min-resolution: 0.001dpcm) {
266
- ${styles}
267
- }
268
- @media screen and (min--moz-device-pixel-ratio: 0) {
269
- ${styles}
270
- }
271
- `;
272
- const onlySafari = (styles) => `
273
- @media not all and (min-resolution: 0.001dpcm) {
274
- ${styles}
275
- }
276
- `;
277
- const onlyFirefox = (styles) => `
278
- @media screen and (min--moz-device-pixel-ratio: 0) {
279
- ${styles}
280
- }
281
- `;
282
- const safariAndFirefoxBold = (color2) => `
283
- @media not all and (min-resolution: 0.001dpcm) {
284
- font-weight: 400;
285
- -webkit-font-smoothing: subpixel-antialiased;
286
- -webkit-text-stroke: 0.4px ${color2};
287
- }
288
- @media screen and (min--moz-device-pixel-ratio: 0) {
289
- font-weight: 400;
290
- -webkit-font-smoothing: subpixel-antialiased;
291
- -webkit-text-stroke: 0.4px ${color2};
292
- }
293
- `;
294
- module.exports = __toCommonJS(utils_exports);
295
- //# 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 };