@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.
- package/cjs/arithmetic.js +30 -42
- package/cjs/constants.js +15 -43
- package/cjs/globalStyles.js +22 -44
- package/cjs/index.js +83 -42
- package/cjs/mobileUtilities.js +26 -57
- package/cjs/spaceUtilities.js +46 -72
- package/cjs/styled/index.d.js +2 -27
- package/cjs/styled/index.js +93 -57
- package/cjs/styled/styleGetters.js +30 -42
- package/cjs/styled/types.js +11 -34
- package/cjs/styled/utils.js +23 -46
- package/cjs/th.js +29 -49
- package/cjs/theme.js +9 -36
- package/cjs/themeProviderHOC.js +29 -42
- package/cjs/utils.js +146 -256
- package/esm/arithmetic.js +25 -13
- package/esm/constants.js +9 -14
- package/esm/globalStyles.js +15 -16
- package/esm/index.js +11 -14
- package/esm/mobileUtilities.js +17 -26
- package/esm/spaceUtilities.js +35 -43
- package/esm/styled/index.d.js +1 -2
- package/esm/styled/index.js +79 -23
- package/esm/styled/styleGetters.js +23 -12
- package/esm/styled/types.js +1 -6
- package/esm/styled/utils.js +16 -16
- package/esm/th.js +25 -20
- package/esm/theme.js +4 -6
- package/esm/themeProviderHOC.js +20 -13
- package/esm/utils.js +98 -227
- package/package.json +5 -5
- package/types/styled/types.d.ts +2 -1
- package/types/utils.d.ts +2 -1
- package/cjs/arithmetic.js.map +0 -7
- package/cjs/constants.js.map +0 -7
- package/cjs/globalStyles.js.map +0 -7
- package/cjs/index.js.map +0 -7
- package/cjs/mobileUtilities.js.map +0 -7
- package/cjs/spaceUtilities.js.map +0 -7
- package/cjs/styled/index.d.js.map +0 -7
- package/cjs/styled/index.js.map +0 -7
- package/cjs/styled/styleGetters.js.map +0 -7
- package/cjs/styled/types.js.map +0 -7
- package/cjs/styled/utils.js.map +0 -7
- package/cjs/th.js.map +0 -7
- package/cjs/theme.js.map +0 -7
- package/cjs/themeProviderHOC.js.map +0 -7
- package/cjs/utils.js.map +0 -7
- package/esm/arithmetic.js.map +0 -7
- package/esm/constants.js.map +0 -7
- package/esm/globalStyles.js.map +0 -7
- package/esm/index.js.map +0 -7
- package/esm/mobileUtilities.js.map +0 -7
- package/esm/spaceUtilities.js.map +0 -7
- package/esm/styled/index.d.js.map +0 -7
- package/esm/styled/index.js.map +0 -7
- package/esm/styled/styleGetters.js.map +0 -7
- package/esm/styled/types.js.map +0 -7
- package/esm/styled/utils.js.map +0 -7
- package/esm/th.js.map +0 -7
- package/esm/theme.js.map +0 -7
- package/esm/themeProviderHOC.js.map +0 -7
- package/esm/utils.js.map +0 -7
package/cjs/utils.js
CHANGED
|
@@ -1,294 +1,184 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
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
|
|
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
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
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
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
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(
|
|
122
|
-
return
|
|
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
|
|
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
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
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
|
|
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
|
-
|
|
162
|
-
|
|
163
|
-
font-size:
|
|
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
|
-
|
|
168
|
-
|
|
169
|
-
font-size:
|
|
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
|
-
|
|
174
|
-
|
|
175
|
-
font-size:
|
|
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
|
-
|
|
180
|
-
|
|
181
|
-
font-size:
|
|
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
|
-
|
|
186
|
-
|
|
187
|
-
font-size:
|
|
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
|
-
|
|
193
|
-
|
|
194
|
-
font-size:
|
|
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
|
-
|
|
199
|
-
|
|
200
|
-
font-size:
|
|
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
|
-
|
|
205
|
-
|
|
206
|
-
font-size:
|
|
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
|
-
|
|
211
|
-
|
|
212
|
-
font-size:
|
|
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
|
-
|
|
217
|
-
|
|
218
|
-
line-height:
|
|
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(
|
|
228
|
-
|
|
229
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
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
|
|
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 {
|
|
5
|
+
return {
|
|
6
|
+
number,
|
|
7
|
+
unit
|
|
8
|
+
};
|
|
5
9
|
}
|
|
6
10
|
function op(operator, n1, n2) {
|
|
7
|
-
const {
|
|
8
|
-
|
|
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
|
-
|
|
23
|
+
|
|
24
|
+
case '+':
|
|
13
25
|
return Number(number) + Number(number2) + (unit || unit2);
|
|
14
|
-
|
|
26
|
+
|
|
27
|
+
case '-':
|
|
15
28
|
return Number(number) - Number(number2) + (unit || unit2);
|
|
16
|
-
|
|
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
|
-
|
|
23
|
-
|
|
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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
4
|
+
'8px': '4px',
|
|
5
|
+
'16px': '8px',
|
|
6
|
+
'32px': '16px',
|
|
7
|
+
'48px': '24px',
|
|
8
|
+
'56px': '32px',
|
|
9
|
+
'64px': '48px',
|
|
10
|
+
'72px': '64px'
|
|
12
11
|
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
mobileBaseFont,
|
|
16
|
-
translateUnits
|
|
17
|
-
};
|
|
18
|
-
//# sourceMappingURL=constants.js.map
|
|
12
|
+
|
|
13
|
+
export { desktopBaseFont, mobileBaseFont, translateUnits };
|
package/esm/globalStyles.js
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
|
|
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';
|
package/esm/mobileUtilities.js
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useState, useEffect } from
|
|
3
|
-
import { theme } from
|
|
4
|
-
import {
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
22
|
-
|
|
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
|
-
|
|
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
|
-
|
|
38
|
-
|
|
39
|
-
isMobile,
|
|
40
|
-
toMobile,
|
|
41
|
-
useIsMobile
|
|
42
|
-
};
|
|
43
|
-
//# sourceMappingURL=mobileUtilities.js.map
|
|
33
|
+
|
|
34
|
+
export { __UNSAFE_SPACE_TO_DIMSUM, isMobile, toMobile, useIsMobile };
|