@flodesk/grain 2.19.2 → 2.19.5
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/es/components/arrange.js +39 -34
- package/es/components/box.js +121 -61
- package/es/components/icon.js +3 -3
- package/es/components/text.js +3 -1
- package/es/types.js +4 -4
- package/es/utilities/helpers.js +61 -0
- package/es/utilities/index.js +125 -0
- package/es/utilities/responsive.js +52 -0
- package/es/utilities/styles.js +174 -0
- package/es/variables.js +6 -6
- package/package.json +1 -1
- package/es/utilities.js +0 -212
package/es/components/arrange.js
CHANGED
|
@@ -23,18 +23,16 @@ var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
|
23
23
|
|
|
24
24
|
var _types = require("../types");
|
|
25
25
|
|
|
26
|
-
var _box = require("./box");
|
|
27
|
-
|
|
28
26
|
var _excluded = ["children", "gap", "columns", "autoFlow", "justifyItems", "alignItems", "justifyContent", "alignContent", "placeItems", "placeContent"];
|
|
29
27
|
|
|
30
28
|
var _templateObject;
|
|
31
29
|
|
|
32
30
|
var __jsx = _react.default.createElement;
|
|
33
31
|
|
|
34
|
-
var Wrapper = _styled.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: grid;\n ", ";\n
|
|
32
|
+
var Wrapper = _styled.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: grid;\n ", ";\n ", ";\n grid-template-columns: ", ";\n justify-items: ", ";\n align-items: ", ";\n justify-content: ", ";\n align-content: ", ";\n place-items: ", ";\n place-content: ", ";\n"])), function (p) {
|
|
35
33
|
return !p.columns && "grid-auto-flow: ".concat(p.autoFlow);
|
|
36
34
|
}, function (p) {
|
|
37
|
-
return (0, _utilities.getSpace)(p.gap);
|
|
35
|
+
return (0, _utilities.getSpace)('gap', p.gap);
|
|
38
36
|
}, function (p) {
|
|
39
37
|
return (0, _utilities.getGridColumns)(p.columns);
|
|
40
38
|
}, function (p) {
|
|
@@ -60,7 +58,8 @@ var Arrange = function Arrange(_ref) {
|
|
|
60
58
|
justifyItems = _ref.justifyItems,
|
|
61
59
|
_ref$alignItems = _ref.alignItems,
|
|
62
60
|
alignItems = _ref$alignItems === void 0 ? 'center' : _ref$alignItems,
|
|
63
|
-
justifyContent = _ref.justifyContent,
|
|
61
|
+
_ref$justifyContent = _ref.justifyContent,
|
|
62
|
+
justifyContent = _ref$justifyContent === void 0 ? 'start' : _ref$justifyContent,
|
|
64
63
|
alignContent = _ref.alignContent,
|
|
65
64
|
placeItems = _ref.placeItems,
|
|
66
65
|
placeContent = _ref.placeContent,
|
|
@@ -126,6 +125,39 @@ Arrange.__docgenInfo = {
|
|
|
126
125
|
"required": false,
|
|
127
126
|
"description": ""
|
|
128
127
|
},
|
|
128
|
+
"justifyContent": {
|
|
129
|
+
"defaultValue": {
|
|
130
|
+
"value": "'start'",
|
|
131
|
+
"computed": false
|
|
132
|
+
},
|
|
133
|
+
"type": {
|
|
134
|
+
"name": "enum",
|
|
135
|
+
"value": [{
|
|
136
|
+
"value": "\"start\"",
|
|
137
|
+
"computed": false
|
|
138
|
+
}, {
|
|
139
|
+
"value": "\"end\"",
|
|
140
|
+
"computed": false
|
|
141
|
+
}, {
|
|
142
|
+
"value": "\"center\"",
|
|
143
|
+
"computed": false
|
|
144
|
+
}, {
|
|
145
|
+
"value": "\"stretch\"",
|
|
146
|
+
"computed": false
|
|
147
|
+
}, {
|
|
148
|
+
"value": "\"space-around\"",
|
|
149
|
+
"computed": false
|
|
150
|
+
}, {
|
|
151
|
+
"value": "\"space-between\"",
|
|
152
|
+
"computed": false
|
|
153
|
+
}, {
|
|
154
|
+
"value": "\"space-evenly\"",
|
|
155
|
+
"computed": false
|
|
156
|
+
}]
|
|
157
|
+
},
|
|
158
|
+
"required": false,
|
|
159
|
+
"description": ""
|
|
160
|
+
},
|
|
129
161
|
"gap": {
|
|
130
162
|
"type": {
|
|
131
163
|
"name": "union",
|
|
@@ -154,6 +186,8 @@ Arrange.__docgenInfo = {
|
|
|
154
186
|
"name": "number"
|
|
155
187
|
}, {
|
|
156
188
|
"name": "string"
|
|
189
|
+
}, {
|
|
190
|
+
"name": "object"
|
|
157
191
|
}]
|
|
158
192
|
},
|
|
159
193
|
"required": false,
|
|
@@ -191,35 +225,6 @@ Arrange.__docgenInfo = {
|
|
|
191
225
|
"required": false,
|
|
192
226
|
"description": ""
|
|
193
227
|
},
|
|
194
|
-
"justifyContent": {
|
|
195
|
-
"type": {
|
|
196
|
-
"name": "enum",
|
|
197
|
-
"value": [{
|
|
198
|
-
"value": "\"start\"",
|
|
199
|
-
"computed": false
|
|
200
|
-
}, {
|
|
201
|
-
"value": "\"end\"",
|
|
202
|
-
"computed": false
|
|
203
|
-
}, {
|
|
204
|
-
"value": "\"center\"",
|
|
205
|
-
"computed": false
|
|
206
|
-
}, {
|
|
207
|
-
"value": "\"stretch\"",
|
|
208
|
-
"computed": false
|
|
209
|
-
}, {
|
|
210
|
-
"value": "\"space-around\"",
|
|
211
|
-
"computed": false
|
|
212
|
-
}, {
|
|
213
|
-
"value": "\"space-between\"",
|
|
214
|
-
"computed": false
|
|
215
|
-
}, {
|
|
216
|
-
"value": "\"space-evenly\"",
|
|
217
|
-
"computed": false
|
|
218
|
-
}]
|
|
219
|
-
},
|
|
220
|
-
"required": false,
|
|
221
|
-
"description": ""
|
|
222
|
-
},
|
|
223
228
|
"alignContent": {
|
|
224
229
|
"type": {
|
|
225
230
|
"name": "enum",
|
package/es/components/box.js
CHANGED
|
@@ -23,54 +23,54 @@ var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
|
23
23
|
|
|
24
24
|
var _types = require("../types");
|
|
25
25
|
|
|
26
|
-
var _excluded = ["children", "color", "backgroundColor", "
|
|
26
|
+
var _excluded = ["children", "color", "backgroundColor", "borderColor", "borderWidth", "borderSide", "width", "minWidth", "maxWidth", "height", "minHeight", "maxHeight", "radius", "padding", "paddingTop", "paddingBottom", "paddingLeft", "paddingRight", "paddingX", "paddingY", "margin", "marginTop", "marginBottom", "marginLeft", "marginRight", "marginX", "marginY", "position", "top", "bottom", "left", "right", "shadow", "overflow", "aspectRatio"];
|
|
27
27
|
|
|
28
28
|
var _templateObject;
|
|
29
29
|
|
|
30
30
|
var __jsx = _react.default.createElement;
|
|
31
31
|
|
|
32
|
-
var Wrapper = _styled.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n ", ";\n \n
|
|
32
|
+
var Wrapper = _styled.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n ", ";\n \n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n \n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n \n ", ";\n ", ";\n ", ";\n ", ";\n \n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n\n color: ", ";\n background-color: ", ";\n \n position: ", ";\n border-radius: ", ";\n box-shadow: ", ";\n overflow: ", ";\n aspect-ratio: ", ";\n"])), function (p) {
|
|
33
33
|
return (0, _utilities.getBorder)(p.borderSide, p.borderWidth, p.borderColor);
|
|
34
34
|
}, function (p) {
|
|
35
|
-
return (0, _utilities.getSpace)(p.padding);
|
|
35
|
+
return (0, _utilities.getSpace)('padding', p.padding);
|
|
36
36
|
}, function (p) {
|
|
37
|
-
return (0, _utilities.getSpace)(p.paddingTop);
|
|
37
|
+
return (0, _utilities.getSpace)('padding-top', p.paddingTop);
|
|
38
38
|
}, function (p) {
|
|
39
|
-
return (0, _utilities.getSpace)(p.paddingBottom);
|
|
39
|
+
return (0, _utilities.getSpace)('padding-bottom', p.paddingBottom);
|
|
40
40
|
}, function (p) {
|
|
41
|
-
return (0, _utilities.getSpace)(p.paddingLeft);
|
|
41
|
+
return (0, _utilities.getSpace)('padding-left', p.paddingLeft);
|
|
42
42
|
}, function (p) {
|
|
43
|
-
return (0, _utilities.getSpace)(p.paddingRight);
|
|
43
|
+
return (0, _utilities.getSpace)('padding-right', p.paddingRight);
|
|
44
44
|
}, function (p) {
|
|
45
|
-
return (0, _utilities.getSpace)(p.margin);
|
|
45
|
+
return (0, _utilities.getSpace)('margin', p.margin);
|
|
46
46
|
}, function (p) {
|
|
47
|
-
return (0, _utilities.getSpace)(p.marginTop);
|
|
47
|
+
return (0, _utilities.getSpace)('margin-top', p.marginTop);
|
|
48
48
|
}, function (p) {
|
|
49
|
-
return (0, _utilities.getSpace)(p.marginBottom);
|
|
49
|
+
return (0, _utilities.getSpace)('margin-bottom', p.marginBottom);
|
|
50
50
|
}, function (p) {
|
|
51
|
-
return (0, _utilities.getSpace)(p.marginLeft);
|
|
51
|
+
return (0, _utilities.getSpace)('margin-left', p.marginLeft);
|
|
52
52
|
}, function (p) {
|
|
53
|
-
return (0, _utilities.getSpace)(p.marginRight);
|
|
53
|
+
return (0, _utilities.getSpace)('margin-right', p.marginRight);
|
|
54
54
|
}, function (p) {
|
|
55
|
-
return (0, _utilities.getSpace)(p.top);
|
|
55
|
+
return (0, _utilities.getSpace)('top', p.top);
|
|
56
56
|
}, function (p) {
|
|
57
|
-
return (0, _utilities.getSpace)(p.bottom);
|
|
57
|
+
return (0, _utilities.getSpace)('bottom', p.bottom);
|
|
58
58
|
}, function (p) {
|
|
59
|
-
return (0, _utilities.getSpace)(p.left);
|
|
59
|
+
return (0, _utilities.getSpace)('left', p.left);
|
|
60
60
|
}, function (p) {
|
|
61
|
-
return (0, _utilities.getSpace)(p.right);
|
|
61
|
+
return (0, _utilities.getSpace)('right', p.right);
|
|
62
62
|
}, function (p) {
|
|
63
|
-
return (0, _utilities.getDimension)(p.width);
|
|
63
|
+
return (0, _utilities.getDimension)('width', p.width);
|
|
64
64
|
}, function (p) {
|
|
65
|
-
return (0, _utilities.getDimension)(p.minWidth);
|
|
65
|
+
return (0, _utilities.getDimension)('min-width', p.minWidth);
|
|
66
66
|
}, function (p) {
|
|
67
|
-
return (0, _utilities.getDimension)(p.maxWidth);
|
|
67
|
+
return (0, _utilities.getDimension)('max-width', p.maxWidth);
|
|
68
68
|
}, function (p) {
|
|
69
|
-
return (0, _utilities.getDimension)(p.height);
|
|
69
|
+
return (0, _utilities.getDimension)('height', p.height);
|
|
70
70
|
}, function (p) {
|
|
71
|
-
return (0, _utilities.getDimension)(p.minHeight);
|
|
71
|
+
return (0, _utilities.getDimension)('min-height', p.minHeight);
|
|
72
72
|
}, function (p) {
|
|
73
|
-
return (0, _utilities.getDimension)(p.maxHeight);
|
|
73
|
+
return (0, _utilities.getDimension)('max-height', p.maxHeight);
|
|
74
74
|
}, function (p) {
|
|
75
75
|
return (0, _utilities.getColor)(p.color);
|
|
76
76
|
}, function (p) {
|
|
@@ -91,9 +91,11 @@ var Box = function Box(_ref) {
|
|
|
91
91
|
var children = _ref.children,
|
|
92
92
|
color = _ref.color,
|
|
93
93
|
backgroundColor = _ref.backgroundColor,
|
|
94
|
+
_ref$borderColor = _ref.borderColor,
|
|
95
|
+
borderColor = _ref$borderColor === void 0 ? 'border' : _ref$borderColor,
|
|
96
|
+
_ref$borderWidth = _ref.borderWidth,
|
|
97
|
+
borderWidth = _ref$borderWidth === void 0 ? '1px' : _ref$borderWidth,
|
|
94
98
|
borderSide = _ref.borderSide,
|
|
95
|
-
borderWidth = _ref.borderWidth,
|
|
96
|
-
borderColor = _ref.borderColor,
|
|
97
99
|
width = _ref.width,
|
|
98
100
|
minWidth = _ref.minWidth,
|
|
99
101
|
maxWidth = _ref.maxWidth,
|
|
@@ -164,6 +166,53 @@ Box.__docgenInfo = {
|
|
|
164
166
|
"methods": [],
|
|
165
167
|
"displayName": "Box",
|
|
166
168
|
"props": {
|
|
169
|
+
"borderColor": {
|
|
170
|
+
"defaultValue": {
|
|
171
|
+
"value": "'border'",
|
|
172
|
+
"computed": false
|
|
173
|
+
},
|
|
174
|
+
"type": {
|
|
175
|
+
"name": "union",
|
|
176
|
+
"value": [{
|
|
177
|
+
"name": "enum",
|
|
178
|
+
"value": [{
|
|
179
|
+
"value": "\"greys\"",
|
|
180
|
+
"computed": false
|
|
181
|
+
}, {
|
|
182
|
+
"value": "\"fades\"",
|
|
183
|
+
"computed": false
|
|
184
|
+
}, {
|
|
185
|
+
"value": "\"baseColors\"",
|
|
186
|
+
"computed": false
|
|
187
|
+
}, {
|
|
188
|
+
"value": "\"semanticColors\"",
|
|
189
|
+
"computed": false
|
|
190
|
+
}]
|
|
191
|
+
}, {
|
|
192
|
+
"name": "string"
|
|
193
|
+
}]
|
|
194
|
+
},
|
|
195
|
+
"required": false,
|
|
196
|
+
"description": ""
|
|
197
|
+
},
|
|
198
|
+
"borderWidth": {
|
|
199
|
+
"defaultValue": {
|
|
200
|
+
"value": "'1px'",
|
|
201
|
+
"computed": false
|
|
202
|
+
},
|
|
203
|
+
"type": {
|
|
204
|
+
"name": "union",
|
|
205
|
+
"value": [{
|
|
206
|
+
"name": "number"
|
|
207
|
+
}, {
|
|
208
|
+
"name": "string"
|
|
209
|
+
}, {
|
|
210
|
+
"name": "object"
|
|
211
|
+
}]
|
|
212
|
+
},
|
|
213
|
+
"required": false,
|
|
214
|
+
"description": ""
|
|
215
|
+
},
|
|
167
216
|
"color": {
|
|
168
217
|
"type": {
|
|
169
218
|
"name": "union",
|
|
@@ -243,43 +292,6 @@ Box.__docgenInfo = {
|
|
|
243
292
|
"required": false,
|
|
244
293
|
"description": ""
|
|
245
294
|
},
|
|
246
|
-
"borderWidth": {
|
|
247
|
-
"type": {
|
|
248
|
-
"name": "union",
|
|
249
|
-
"value": [{
|
|
250
|
-
"name": "number"
|
|
251
|
-
}, {
|
|
252
|
-
"name": "string"
|
|
253
|
-
}]
|
|
254
|
-
},
|
|
255
|
-
"required": false,
|
|
256
|
-
"description": ""
|
|
257
|
-
},
|
|
258
|
-
"borderColor": {
|
|
259
|
-
"type": {
|
|
260
|
-
"name": "union",
|
|
261
|
-
"value": [{
|
|
262
|
-
"name": "enum",
|
|
263
|
-
"value": [{
|
|
264
|
-
"value": "\"greys\"",
|
|
265
|
-
"computed": false
|
|
266
|
-
}, {
|
|
267
|
-
"value": "\"fades\"",
|
|
268
|
-
"computed": false
|
|
269
|
-
}, {
|
|
270
|
-
"value": "\"baseColors\"",
|
|
271
|
-
"computed": false
|
|
272
|
-
}, {
|
|
273
|
-
"value": "\"semanticColors\"",
|
|
274
|
-
"computed": false
|
|
275
|
-
}]
|
|
276
|
-
}, {
|
|
277
|
-
"name": "string"
|
|
278
|
-
}]
|
|
279
|
-
},
|
|
280
|
-
"required": false,
|
|
281
|
-
"description": ""
|
|
282
|
-
},
|
|
283
295
|
"width": {
|
|
284
296
|
"type": {
|
|
285
297
|
"name": "union",
|
|
@@ -287,6 +299,8 @@ Box.__docgenInfo = {
|
|
|
287
299
|
"name": "number"
|
|
288
300
|
}, {
|
|
289
301
|
"name": "string"
|
|
302
|
+
}, {
|
|
303
|
+
"name": "object"
|
|
290
304
|
}]
|
|
291
305
|
},
|
|
292
306
|
"required": false,
|
|
@@ -299,6 +313,8 @@ Box.__docgenInfo = {
|
|
|
299
313
|
"name": "number"
|
|
300
314
|
}, {
|
|
301
315
|
"name": "string"
|
|
316
|
+
}, {
|
|
317
|
+
"name": "object"
|
|
302
318
|
}]
|
|
303
319
|
},
|
|
304
320
|
"required": false,
|
|
@@ -311,6 +327,8 @@ Box.__docgenInfo = {
|
|
|
311
327
|
"name": "number"
|
|
312
328
|
}, {
|
|
313
329
|
"name": "string"
|
|
330
|
+
}, {
|
|
331
|
+
"name": "object"
|
|
314
332
|
}]
|
|
315
333
|
},
|
|
316
334
|
"required": false,
|
|
@@ -323,6 +341,8 @@ Box.__docgenInfo = {
|
|
|
323
341
|
"name": "number"
|
|
324
342
|
}, {
|
|
325
343
|
"name": "string"
|
|
344
|
+
}, {
|
|
345
|
+
"name": "object"
|
|
326
346
|
}]
|
|
327
347
|
},
|
|
328
348
|
"required": false,
|
|
@@ -335,6 +355,8 @@ Box.__docgenInfo = {
|
|
|
335
355
|
"name": "number"
|
|
336
356
|
}, {
|
|
337
357
|
"name": "string"
|
|
358
|
+
}, {
|
|
359
|
+
"name": "object"
|
|
338
360
|
}]
|
|
339
361
|
},
|
|
340
362
|
"required": false,
|
|
@@ -347,6 +369,8 @@ Box.__docgenInfo = {
|
|
|
347
369
|
"name": "number"
|
|
348
370
|
}, {
|
|
349
371
|
"name": "string"
|
|
372
|
+
}, {
|
|
373
|
+
"name": "object"
|
|
350
374
|
}]
|
|
351
375
|
},
|
|
352
376
|
"required": false,
|
|
@@ -424,6 +448,8 @@ Box.__docgenInfo = {
|
|
|
424
448
|
"name": "number"
|
|
425
449
|
}, {
|
|
426
450
|
"name": "string"
|
|
451
|
+
}, {
|
|
452
|
+
"name": "object"
|
|
427
453
|
}]
|
|
428
454
|
},
|
|
429
455
|
"required": false,
|
|
@@ -457,6 +483,8 @@ Box.__docgenInfo = {
|
|
|
457
483
|
"name": "number"
|
|
458
484
|
}, {
|
|
459
485
|
"name": "string"
|
|
486
|
+
}, {
|
|
487
|
+
"name": "object"
|
|
460
488
|
}]
|
|
461
489
|
},
|
|
462
490
|
"required": false,
|
|
@@ -490,6 +518,8 @@ Box.__docgenInfo = {
|
|
|
490
518
|
"name": "number"
|
|
491
519
|
}, {
|
|
492
520
|
"name": "string"
|
|
521
|
+
}, {
|
|
522
|
+
"name": "object"
|
|
493
523
|
}]
|
|
494
524
|
},
|
|
495
525
|
"required": false,
|
|
@@ -523,6 +553,8 @@ Box.__docgenInfo = {
|
|
|
523
553
|
"name": "number"
|
|
524
554
|
}, {
|
|
525
555
|
"name": "string"
|
|
556
|
+
}, {
|
|
557
|
+
"name": "object"
|
|
526
558
|
}]
|
|
527
559
|
},
|
|
528
560
|
"required": false,
|
|
@@ -556,6 +588,8 @@ Box.__docgenInfo = {
|
|
|
556
588
|
"name": "number"
|
|
557
589
|
}, {
|
|
558
590
|
"name": "string"
|
|
591
|
+
}, {
|
|
592
|
+
"name": "object"
|
|
559
593
|
}]
|
|
560
594
|
},
|
|
561
595
|
"required": false,
|
|
@@ -589,6 +623,8 @@ Box.__docgenInfo = {
|
|
|
589
623
|
"name": "number"
|
|
590
624
|
}, {
|
|
591
625
|
"name": "string"
|
|
626
|
+
}, {
|
|
627
|
+
"name": "object"
|
|
592
628
|
}]
|
|
593
629
|
},
|
|
594
630
|
"required": false,
|
|
@@ -622,6 +658,8 @@ Box.__docgenInfo = {
|
|
|
622
658
|
"name": "number"
|
|
623
659
|
}, {
|
|
624
660
|
"name": "string"
|
|
661
|
+
}, {
|
|
662
|
+
"name": "object"
|
|
625
663
|
}]
|
|
626
664
|
},
|
|
627
665
|
"required": false,
|
|
@@ -655,6 +693,8 @@ Box.__docgenInfo = {
|
|
|
655
693
|
"name": "number"
|
|
656
694
|
}, {
|
|
657
695
|
"name": "string"
|
|
696
|
+
}, {
|
|
697
|
+
"name": "object"
|
|
658
698
|
}]
|
|
659
699
|
},
|
|
660
700
|
"required": false,
|
|
@@ -688,6 +728,8 @@ Box.__docgenInfo = {
|
|
|
688
728
|
"name": "number"
|
|
689
729
|
}, {
|
|
690
730
|
"name": "string"
|
|
731
|
+
}, {
|
|
732
|
+
"name": "object"
|
|
691
733
|
}]
|
|
692
734
|
},
|
|
693
735
|
"required": false,
|
|
@@ -721,6 +763,8 @@ Box.__docgenInfo = {
|
|
|
721
763
|
"name": "number"
|
|
722
764
|
}, {
|
|
723
765
|
"name": "string"
|
|
766
|
+
}, {
|
|
767
|
+
"name": "object"
|
|
724
768
|
}]
|
|
725
769
|
},
|
|
726
770
|
"required": false,
|
|
@@ -754,6 +798,8 @@ Box.__docgenInfo = {
|
|
|
754
798
|
"name": "number"
|
|
755
799
|
}, {
|
|
756
800
|
"name": "string"
|
|
801
|
+
}, {
|
|
802
|
+
"name": "object"
|
|
757
803
|
}]
|
|
758
804
|
},
|
|
759
805
|
"required": false,
|
|
@@ -787,6 +833,8 @@ Box.__docgenInfo = {
|
|
|
787
833
|
"name": "number"
|
|
788
834
|
}, {
|
|
789
835
|
"name": "string"
|
|
836
|
+
}, {
|
|
837
|
+
"name": "object"
|
|
790
838
|
}]
|
|
791
839
|
},
|
|
792
840
|
"required": false,
|
|
@@ -820,6 +868,8 @@ Box.__docgenInfo = {
|
|
|
820
868
|
"name": "number"
|
|
821
869
|
}, {
|
|
822
870
|
"name": "string"
|
|
871
|
+
}, {
|
|
872
|
+
"name": "object"
|
|
823
873
|
}]
|
|
824
874
|
},
|
|
825
875
|
"required": false,
|
|
@@ -853,6 +903,8 @@ Box.__docgenInfo = {
|
|
|
853
903
|
"name": "number"
|
|
854
904
|
}, {
|
|
855
905
|
"name": "string"
|
|
906
|
+
}, {
|
|
907
|
+
"name": "object"
|
|
856
908
|
}]
|
|
857
909
|
},
|
|
858
910
|
"required": false,
|
|
@@ -909,6 +961,8 @@ Box.__docgenInfo = {
|
|
|
909
961
|
"name": "number"
|
|
910
962
|
}, {
|
|
911
963
|
"name": "string"
|
|
964
|
+
}, {
|
|
965
|
+
"name": "object"
|
|
912
966
|
}]
|
|
913
967
|
},
|
|
914
968
|
"required": false,
|
|
@@ -942,6 +996,8 @@ Box.__docgenInfo = {
|
|
|
942
996
|
"name": "number"
|
|
943
997
|
}, {
|
|
944
998
|
"name": "string"
|
|
999
|
+
}, {
|
|
1000
|
+
"name": "object"
|
|
945
1001
|
}]
|
|
946
1002
|
},
|
|
947
1003
|
"required": false,
|
|
@@ -975,6 +1031,8 @@ Box.__docgenInfo = {
|
|
|
975
1031
|
"name": "number"
|
|
976
1032
|
}, {
|
|
977
1033
|
"name": "string"
|
|
1034
|
+
}, {
|
|
1035
|
+
"name": "object"
|
|
978
1036
|
}]
|
|
979
1037
|
},
|
|
980
1038
|
"required": false,
|
|
@@ -1008,6 +1066,8 @@ Box.__docgenInfo = {
|
|
|
1008
1066
|
"name": "number"
|
|
1009
1067
|
}, {
|
|
1010
1068
|
"name": "string"
|
|
1069
|
+
}, {
|
|
1070
|
+
"name": "object"
|
|
1011
1071
|
}]
|
|
1012
1072
|
},
|
|
1013
1073
|
"required": false,
|
package/es/components/icon.js
CHANGED
|
@@ -31,14 +31,14 @@ var _templateObject;
|
|
|
31
31
|
|
|
32
32
|
var __jsx = _react.default.createElement;
|
|
33
33
|
|
|
34
|
-
var Wrapper = _styled.default.span(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: block;\n width: ", ";\n color: ", ";\n \n svg {\n display: block;\n
|
|
34
|
+
var Wrapper = _styled.default.span(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: block;\n width: ", ";\n color: ", ";\n \n svg {\n display: block;\n ", ";\n ", ";\n }\n"])), function (p) {
|
|
35
35
|
return (0, _utilities.getColor)(p.color);
|
|
36
36
|
}, function (p) {
|
|
37
37
|
return (0, _utilities.getColor)(p.color);
|
|
38
38
|
}, function (p) {
|
|
39
|
-
return (0, _utilities.getIconSize)(p.size);
|
|
39
|
+
return (0, _utilities.getIconSize)('height', p.size);
|
|
40
40
|
}, function (p) {
|
|
41
|
-
return p.hasEvenBoundary &&
|
|
41
|
+
return p.hasEvenBoundary && (0, _utilities.getIconSize)('width', p.size);
|
|
42
42
|
});
|
|
43
43
|
|
|
44
44
|
var Icon = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
package/es/components/text.js
CHANGED
|
@@ -29,7 +29,7 @@ var _templateObject;
|
|
|
29
29
|
|
|
30
30
|
var __jsx = _react.default.createElement;
|
|
31
31
|
|
|
32
|
-
var Wrapper = _styled.default.span(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: block;\n
|
|
32
|
+
var Wrapper = _styled.default.span(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: block;\n ", ";\n font-weight: ", ";\n color: ", ";\n text-align: ", ";\n \n ", ";\n ", ";\n ", ";\n"])), function (p) {
|
|
33
33
|
return (0, _utilities.getTextSize)(p.size);
|
|
34
34
|
}, function (p) {
|
|
35
35
|
return (0, _utilities.getWeight)(p.weight);
|
|
@@ -101,6 +101,8 @@ Text.__docgenInfo = {
|
|
|
101
101
|
}]
|
|
102
102
|
}, {
|
|
103
103
|
"name": "string"
|
|
104
|
+
}, {
|
|
105
|
+
"name": "object"
|
|
104
106
|
}]
|
|
105
107
|
},
|
|
106
108
|
"required": false,
|
package/es/types.js
CHANGED
|
@@ -17,14 +17,14 @@ var _variables = require("./variables");
|
|
|
17
17
|
|
|
18
18
|
var types = {
|
|
19
19
|
color: _propTypes.default.oneOfType([_propTypes.default.oneOf(Object.keys(_variables.vars.colors)), _propTypes.default.string]),
|
|
20
|
-
space: _propTypes.default.oneOfType([_propTypes.default.oneOf(Object.keys(_variables.vars.spaces)), _propTypes.default.number, _propTypes.default.string]),
|
|
21
|
-
dimension: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
20
|
+
space: _propTypes.default.oneOfType([_propTypes.default.oneOf(Object.keys(_variables.vars.spaces)), _propTypes.default.number, _propTypes.default.string, _propTypes.default.object]),
|
|
21
|
+
dimension: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string, _propTypes.default.object]),
|
|
22
22
|
side: _propTypes.default.oneOf(["all", "left", "right", "top", "bottom", "x", "y"]),
|
|
23
23
|
radius: _propTypes.default.oneOfType([_propTypes.default.oneOf(Object.keys(_variables.vars.radiuses)), _propTypes.default.string]),
|
|
24
24
|
shadow: _propTypes.default.oneOfType([_propTypes.default.oneOf(Object.keys(_variables.vars.shadows)), _propTypes.default.string]),
|
|
25
25
|
position: _propTypes.default.oneOf(["static", "relative", "fixed", "absolute", "sticky"]),
|
|
26
|
-
textSize: _propTypes.default.oneOfType([_propTypes.default.oneOf(Object.keys(_variables.vars.
|
|
27
|
-
iconSize: _propTypes.default.oneOfType([_propTypes.default.oneOf(Object.keys(_variables.vars.
|
|
26
|
+
textSize: _propTypes.default.oneOfType([_propTypes.default.oneOf(Object.keys(_variables.vars.texts)), _propTypes.default.string, _propTypes.default.object]),
|
|
27
|
+
iconSize: _propTypes.default.oneOfType([_propTypes.default.oneOf(Object.keys(_variables.vars.icons)), _propTypes.default.number, _propTypes.default.string]),
|
|
28
28
|
weight: _propTypes.default.oneOf(Object.keys(_variables.vars.weights)),
|
|
29
29
|
textAlign: _propTypes.default.oneOf(["left", "center", "right"]),
|
|
30
30
|
overflow: _propTypes.default.oneOf(["visible", "hidden", "scroll", "auto"]),
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.object.define-property.js");
|
|
4
|
+
|
|
5
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports.isObject = exports.isArray = exports.isString = exports.isNumber = exports.u = exports.getCssVar = exports.getCssVarCore = exports.isBrowser = void 0;
|
|
11
|
+
|
|
12
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
13
|
+
|
|
14
|
+
require("core-js/modules/es.array.concat.js");
|
|
15
|
+
|
|
16
|
+
var _variables = require("../variables");
|
|
17
|
+
|
|
18
|
+
var isBrowser = typeof window !== "undefined";
|
|
19
|
+
exports.isBrowser = isBrowser;
|
|
20
|
+
|
|
21
|
+
var getCssVarCore = function getCssVarCore(type, value) {
|
|
22
|
+
return "".concat(_variables.grnPrefix).concat(type, "-").concat(value);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
exports.getCssVarCore = getCssVarCore;
|
|
26
|
+
|
|
27
|
+
var getCssVar = function getCssVar(type, value) {
|
|
28
|
+
return "var(".concat(getCssVarCore(type, value), ")");
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
exports.getCssVar = getCssVar;
|
|
32
|
+
|
|
33
|
+
var u = function u(amount) {
|
|
34
|
+
return "calc(var(--grn-unit) * ".concat(amount, ")");
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
exports.u = u;
|
|
38
|
+
|
|
39
|
+
var isNumber = function isNumber(value) {
|
|
40
|
+
return typeof value === "number";
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
exports.isNumber = isNumber;
|
|
44
|
+
|
|
45
|
+
var isString = function isString(value) {
|
|
46
|
+
return typeof value === "string";
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
exports.isString = isString;
|
|
50
|
+
|
|
51
|
+
var isArray = function isArray(value) {
|
|
52
|
+
return Array.isArray(value);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
exports.isArray = isArray;
|
|
56
|
+
|
|
57
|
+
var isObject = function isObject(value) {
|
|
58
|
+
return (0, _typeof2.default)(value) === "object";
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
exports.isObject = isObject;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.object.define-property.js");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
Object.defineProperty(exports, "getDimension", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function get() {
|
|
11
|
+
return _styles.getDimension;
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
Object.defineProperty(exports, "getColor", {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function get() {
|
|
17
|
+
return _styles.getColor;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
Object.defineProperty(exports, "getShadow", {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function get() {
|
|
23
|
+
return _styles.getShadow;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
Object.defineProperty(exports, "getTextSize", {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
get: function get() {
|
|
29
|
+
return _styles.getTextSize;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
Object.defineProperty(exports, "getWeight", {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function get() {
|
|
35
|
+
return _styles.getWeight;
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
Object.defineProperty(exports, "getRadius", {
|
|
39
|
+
enumerable: true,
|
|
40
|
+
get: function get() {
|
|
41
|
+
return _styles.getRadius;
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
Object.defineProperty(exports, "getTransition", {
|
|
45
|
+
enumerable: true,
|
|
46
|
+
get: function get() {
|
|
47
|
+
return _styles.getTransition;
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
Object.defineProperty(exports, "getSpace", {
|
|
51
|
+
enumerable: true,
|
|
52
|
+
get: function get() {
|
|
53
|
+
return _styles.getSpace;
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
Object.defineProperty(exports, "getIconSize", {
|
|
57
|
+
enumerable: true,
|
|
58
|
+
get: function get() {
|
|
59
|
+
return _styles.getIconSize;
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
Object.defineProperty(exports, "getGridColumns", {
|
|
63
|
+
enumerable: true,
|
|
64
|
+
get: function get() {
|
|
65
|
+
return _styles.getGridColumns;
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
Object.defineProperty(exports, "getBorder", {
|
|
69
|
+
enumerable: true,
|
|
70
|
+
get: function get() {
|
|
71
|
+
return _styles.getBorder;
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
Object.defineProperty(exports, "isBrowser", {
|
|
75
|
+
enumerable: true,
|
|
76
|
+
get: function get() {
|
|
77
|
+
return _helpers.isBrowser;
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
Object.defineProperty(exports, "getCssVarCore", {
|
|
81
|
+
enumerable: true,
|
|
82
|
+
get: function get() {
|
|
83
|
+
return _helpers.getCssVarCore;
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
Object.defineProperty(exports, "getCssVar", {
|
|
87
|
+
enumerable: true,
|
|
88
|
+
get: function get() {
|
|
89
|
+
return _helpers.getCssVar;
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
Object.defineProperty(exports, "u", {
|
|
93
|
+
enumerable: true,
|
|
94
|
+
get: function get() {
|
|
95
|
+
return _helpers.u;
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
Object.defineProperty(exports, "isNumber", {
|
|
99
|
+
enumerable: true,
|
|
100
|
+
get: function get() {
|
|
101
|
+
return _helpers.isNumber;
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
Object.defineProperty(exports, "isString", {
|
|
105
|
+
enumerable: true,
|
|
106
|
+
get: function get() {
|
|
107
|
+
return _helpers.isString;
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
Object.defineProperty(exports, "isArray", {
|
|
111
|
+
enumerable: true,
|
|
112
|
+
get: function get() {
|
|
113
|
+
return _helpers.isArray;
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
Object.defineProperty(exports, "isObject", {
|
|
117
|
+
enumerable: true,
|
|
118
|
+
get: function get() {
|
|
119
|
+
return _helpers.isObject;
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
var _styles = require("./styles");
|
|
124
|
+
|
|
125
|
+
var _helpers = require("./helpers");
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.object.define-property.js");
|
|
4
|
+
|
|
5
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports.mapObjToMedia = exports.getMediaCss = void 0;
|
|
11
|
+
|
|
12
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
13
|
+
|
|
14
|
+
require("core-js/modules/es.array.concat.js");
|
|
15
|
+
|
|
16
|
+
require("core-js/modules/es.array.map.js");
|
|
17
|
+
|
|
18
|
+
require("core-js/modules/es.object.entries.js");
|
|
19
|
+
|
|
20
|
+
var _ = require(".");
|
|
21
|
+
|
|
22
|
+
var _variables = require("../variables");
|
|
23
|
+
|
|
24
|
+
var getMediaCss = function getMediaCss(breakpoint, property, value) {
|
|
25
|
+
var getValue = function getValue(val) {
|
|
26
|
+
if (val === 0) return val;
|
|
27
|
+
if ((0, _.isNumber)(val)) return (0, _.u)(val);
|
|
28
|
+
if ((0, _.isString)(val)) return val;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
return "\n @media (min-width: ".concat(breakpoint, ") {\n ").concat(property, ": ").concat(getValue(value), ";\n }\n ");
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
exports.getMediaCss = getMediaCss;
|
|
35
|
+
|
|
36
|
+
var mapObjToMedia = function mapObjToMedia(property, obj, varName) {
|
|
37
|
+
var varGroupName = _variables.varNames[varName].group;
|
|
38
|
+
var varPrefix = _variables.varNames[varName].prefix;
|
|
39
|
+
return Object.entries(obj).map(function (_ref) {
|
|
40
|
+
var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
|
|
41
|
+
breakpoint = _ref2[0],
|
|
42
|
+
value = _ref2[1];
|
|
43
|
+
|
|
44
|
+
if (value in _variables.vars[varGroupName]) {
|
|
45
|
+
return getMediaCss(breakpoint, property, (0, _.getCssVar)(varPrefix, value));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return getMediaCss(breakpoint, property, value);
|
|
49
|
+
}).join("");
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
exports.mapObjToMedia = mapObjToMedia;
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.object.keys.js");
|
|
4
|
+
|
|
5
|
+
require("core-js/modules/es.symbol.js");
|
|
6
|
+
|
|
7
|
+
require("core-js/modules/es.array.filter.js");
|
|
8
|
+
|
|
9
|
+
require("core-js/modules/es.object.to-string.js");
|
|
10
|
+
|
|
11
|
+
require("core-js/modules/es.object.get-own-property-descriptor.js");
|
|
12
|
+
|
|
13
|
+
require("core-js/modules/web.dom-collections.for-each.js");
|
|
14
|
+
|
|
15
|
+
require("core-js/modules/es.object.get-own-property-descriptors.js");
|
|
16
|
+
|
|
17
|
+
require("core-js/modules/es.object.define-properties.js");
|
|
18
|
+
|
|
19
|
+
require("core-js/modules/es.object.define-property.js");
|
|
20
|
+
|
|
21
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
22
|
+
|
|
23
|
+
Object.defineProperty(exports, "__esModule", {
|
|
24
|
+
value: true
|
|
25
|
+
});
|
|
26
|
+
exports.getBorder = exports.getGridColumns = exports.getIconSize = exports.getSpace = exports.getTransition = exports.getRadius = exports.getWeight = exports.getTextSize = exports.getShadow = exports.getColor = exports.getDimension = void 0;
|
|
27
|
+
|
|
28
|
+
require("core-js/modules/es.array.concat.js");
|
|
29
|
+
|
|
30
|
+
require("core-js/modules/es.array.map.js");
|
|
31
|
+
|
|
32
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
33
|
+
|
|
34
|
+
var _ = require(".");
|
|
35
|
+
|
|
36
|
+
var _variables = require("../variables");
|
|
37
|
+
|
|
38
|
+
var _responsive = require("./responsive");
|
|
39
|
+
|
|
40
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
41
|
+
|
|
42
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
43
|
+
|
|
44
|
+
var allColors = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, _variables.vars.colors.baseColors), _variables.vars.colors.greys), _variables.vars.colors.semanticColors), _variables.vars.colors.fades);
|
|
45
|
+
|
|
46
|
+
var getDimension = function getDimension(property, dimension) {
|
|
47
|
+
if ((0, _.isObject)(dimension)) {
|
|
48
|
+
return (0, _responsive.mapObjToMedia)(property, dimension, _variables.varNames.space.prefix);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (dimension === 0) return "".concat(property, ": ").concat(dimension);
|
|
52
|
+
if ((0, _.isString)(dimension)) return "".concat(property, ": ").concat(dimension);
|
|
53
|
+
if ((0, _.isNumber)(dimension)) return "".concat(property, ": ").concat((0, _.u)(dimension));
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
exports.getDimension = getDimension;
|
|
57
|
+
|
|
58
|
+
var getColor = function getColor(color) {
|
|
59
|
+
if (color in allColors) {
|
|
60
|
+
return (0, _.getCssVar)(_variables.varNames.color.prefix, color);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return color;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
exports.getColor = getColor;
|
|
67
|
+
|
|
68
|
+
var getShadow = function getShadow(shadow) {
|
|
69
|
+
if (shadow in _variables.vars.shadows) {
|
|
70
|
+
return (0, _.getCssVar)(_variables.varNames.shadow.prefix, shadow);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return shadow;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
exports.getShadow = getShadow;
|
|
77
|
+
|
|
78
|
+
var getTextSize = function getTextSize(size) {
|
|
79
|
+
var property = "font-size";
|
|
80
|
+
|
|
81
|
+
if (size in _variables.vars.texts) {
|
|
82
|
+
return "".concat(property, ": ").concat((0, _.getCssVar)(_variables.varNames.text.prefix, size));
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if ((0, _.isObject)(size)) {
|
|
86
|
+
return (0, _responsive.mapObjToMedia)(property, size, _variables.varNames.text.prefix);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if ((0, _.isString)(size)) return "".concat(property, ": ").concat(size);
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
exports.getTextSize = getTextSize;
|
|
93
|
+
|
|
94
|
+
var getWeight = function getWeight(weight) {
|
|
95
|
+
if (weight in _variables.vars.weights) {
|
|
96
|
+
return (0, _.getCssVar)(_variables.varNames.weight.prefix, weight);
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
exports.getWeight = getWeight;
|
|
101
|
+
|
|
102
|
+
var getRadius = function getRadius(radius) {
|
|
103
|
+
if (radius in _variables.vars.radiuses) {
|
|
104
|
+
return (0, _.getCssVar)(_variables.varNames.radius.prefix, radius);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (radius === 0) return radius;
|
|
108
|
+
if ((0, _.isString)(radius)) return radius;
|
|
109
|
+
if ((0, _.isNumber)(radius)) return (0, _.u)(radius);
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
exports.getRadius = getRadius;
|
|
113
|
+
|
|
114
|
+
var getTransition = function getTransition(transition) {
|
|
115
|
+
if (transition in _variables.vars.transitions) {
|
|
116
|
+
return (0, _.getCssVar)(_variables.varNames.transition.prefix, transition);
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
exports.getTransition = getTransition;
|
|
121
|
+
|
|
122
|
+
var getSpace = function getSpace(property, space) {
|
|
123
|
+
if (space in _variables.vars.spaces) {
|
|
124
|
+
return "".concat(property, ": ").concat((0, _.getCssVar)(_variables.varNames.space.prefix, space));
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return getDimension(property, space);
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
exports.getSpace = getSpace;
|
|
131
|
+
|
|
132
|
+
var getIconSize = function getIconSize(property, size) {
|
|
133
|
+
if (size in _variables.vars.icons) {
|
|
134
|
+
return "".concat(property, ": ").concat((0, _.getCssVar)(_variables.varNames.icon.prefix, size));
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
return getDimension(property, size);
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
exports.getIconSize = getIconSize;
|
|
141
|
+
|
|
142
|
+
var getGridColumns = function getGridColumns(columns) {
|
|
143
|
+
if (columns) {
|
|
144
|
+
if (isArray(columns)) {
|
|
145
|
+
return columns.map(function (column) {
|
|
146
|
+
return getDimension(column);
|
|
147
|
+
}).join(" ");
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
if ((0, _.isString)(columns)) return columns;
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
exports.getGridColumns = getGridColumns;
|
|
155
|
+
|
|
156
|
+
var getBorder = function getBorder(borderSide, borderWidth, borderColor) {
|
|
157
|
+
var borderSides = {
|
|
158
|
+
all: ["top", "right", "bottom", "left"],
|
|
159
|
+
x: ["right", "left"],
|
|
160
|
+
y: ["top", "bottom"],
|
|
161
|
+
top: ["top"],
|
|
162
|
+
right: ["right"],
|
|
163
|
+
bottom: ["bottom"],
|
|
164
|
+
left: ["left"]
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
if (borderSide in borderSides) {
|
|
168
|
+
return "\n ".concat(borderSides[borderSide].map(function (side) {
|
|
169
|
+
return "border-".concat(side, "-style: solid");
|
|
170
|
+
}).join(";"), ";\n\n border-color: ").concat(getColor(borderColor), ";\n ").concat(getDimension("border-width", borderWidth), ";\n ");
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
exports.getBorder = getBorder;
|
package/es/variables.js
CHANGED
|
@@ -16,12 +16,12 @@ var _vars;
|
|
|
16
16
|
var grnPrefix = "--grn-";
|
|
17
17
|
exports.grnPrefix = grnPrefix;
|
|
18
18
|
var varNames = {
|
|
19
|
-
|
|
20
|
-
group: "
|
|
19
|
+
text: {
|
|
20
|
+
group: "texts",
|
|
21
21
|
prefix: "text"
|
|
22
22
|
},
|
|
23
|
-
|
|
24
|
-
group: "
|
|
23
|
+
icon: {
|
|
24
|
+
group: "icons",
|
|
25
25
|
prefix: "icon"
|
|
26
26
|
},
|
|
27
27
|
space: {
|
|
@@ -50,13 +50,13 @@ var varNames = {
|
|
|
50
50
|
}
|
|
51
51
|
};
|
|
52
52
|
exports.varNames = varNames;
|
|
53
|
-
var vars = (_vars = {}, (0, _defineProperty2.default)(_vars, varNames.
|
|
53
|
+
var vars = (_vars = {}, (0, _defineProperty2.default)(_vars, varNames.text.group, {
|
|
54
54
|
s: "s",
|
|
55
55
|
m: "m",
|
|
56
56
|
l: "l",
|
|
57
57
|
xl: "xl",
|
|
58
58
|
xxl: "xxl"
|
|
59
|
-
}), (0, _defineProperty2.default)(_vars, varNames.
|
|
59
|
+
}), (0, _defineProperty2.default)(_vars, varNames.icon.group, {
|
|
60
60
|
s: "s",
|
|
61
61
|
m: "m",
|
|
62
62
|
l: "l",
|
package/package.json
CHANGED
package/es/utilities.js
DELETED
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
require("core-js/modules/es.object.keys.js");
|
|
4
|
-
|
|
5
|
-
require("core-js/modules/es.symbol.js");
|
|
6
|
-
|
|
7
|
-
require("core-js/modules/es.array.filter.js");
|
|
8
|
-
|
|
9
|
-
require("core-js/modules/es.object.to-string.js");
|
|
10
|
-
|
|
11
|
-
require("core-js/modules/es.object.get-own-property-descriptor.js");
|
|
12
|
-
|
|
13
|
-
require("core-js/modules/web.dom-collections.for-each.js");
|
|
14
|
-
|
|
15
|
-
require("core-js/modules/es.object.get-own-property-descriptors.js");
|
|
16
|
-
|
|
17
|
-
require("core-js/modules/es.object.define-properties.js");
|
|
18
|
-
|
|
19
|
-
require("core-js/modules/es.object.define-property.js");
|
|
20
|
-
|
|
21
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
22
|
-
|
|
23
|
-
Object.defineProperty(exports, "__esModule", {
|
|
24
|
-
value: true
|
|
25
|
-
});
|
|
26
|
-
exports.getBorder = exports.getGridColumns = exports.getIconSize = exports.getDimension = exports.getSpace = exports.getTransition = exports.getRadius = exports.getWeight = exports.getTextSize = exports.getShadow = exports.getColor = exports.getCssVar = exports.getCssVarCore = exports.isBrowser = void 0;
|
|
27
|
-
|
|
28
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
29
|
-
|
|
30
|
-
require("core-js/modules/es.array.concat.js");
|
|
31
|
-
|
|
32
|
-
require("core-js/modules/es.array.map.js");
|
|
33
|
-
|
|
34
|
-
var _variables = require("./variables");
|
|
35
|
-
|
|
36
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
37
|
-
|
|
38
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
39
|
-
|
|
40
|
-
var isBrowser = typeof window !== "undefined";
|
|
41
|
-
exports.isBrowser = isBrowser;
|
|
42
|
-
|
|
43
|
-
var getCssVarCore = function getCssVarCore(type, value) {
|
|
44
|
-
return "".concat(_variables.grnPrefix).concat(type, "-").concat(value);
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
exports.getCssVarCore = getCssVarCore;
|
|
48
|
-
|
|
49
|
-
var getCssVar = function getCssVar(type, value) {
|
|
50
|
-
return "var(".concat(getCssVarCore(type, value), ")");
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
exports.getCssVar = getCssVar;
|
|
54
|
-
|
|
55
|
-
var u = function u(amount) {
|
|
56
|
-
return "calc(var(--grn-unit) * ".concat(amount, ")");
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
var isNumber = function isNumber(value) {
|
|
60
|
-
return typeof value === "number";
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
var isString = function isString(value) {
|
|
64
|
-
return typeof value === "string";
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
var isArray = function isArray(value) {
|
|
68
|
-
return Array.isArray(value);
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
var getColor = function getColor(color) {
|
|
72
|
-
if (color in _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, _variables.vars.colors.baseColors), _variables.vars.colors.greys), _variables.vars.colors.semanticColors), _variables.vars.colors.fades)) {
|
|
73
|
-
return getCssVar(_variables.varNames.color.prefix, color);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
return color;
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
exports.getColor = getColor;
|
|
80
|
-
|
|
81
|
-
var getShadow = function getShadow(shadow) {
|
|
82
|
-
if (shadow in _variables.vars.shadows) {
|
|
83
|
-
return getCssVar(_variables.varNames.shadow.prefix, shadow);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
return shadow;
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
exports.getShadow = getShadow;
|
|
90
|
-
|
|
91
|
-
var getTextSize = function getTextSize(size) {
|
|
92
|
-
if (size in _variables.vars.textSizes) {
|
|
93
|
-
return getCssVar(_variables.varNames.textSize.prefix, size);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
if (isString(size)) {
|
|
97
|
-
return size;
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
exports.getTextSize = getTextSize;
|
|
102
|
-
|
|
103
|
-
var getWeight = function getWeight(weight) {
|
|
104
|
-
if (weight in _variables.vars.weights) {
|
|
105
|
-
return getCssVar(_variables.varNames.weight.prefix, weight);
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
exports.getWeight = getWeight;
|
|
110
|
-
|
|
111
|
-
var getRadius = function getRadius(radius) {
|
|
112
|
-
if (radius in _variables.vars.radiuses) {
|
|
113
|
-
return getCssVar(_variables.varNames.radius.prefix, radius);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
if (isString(radius)) {
|
|
117
|
-
return radius;
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
exports.getRadius = getRadius;
|
|
122
|
-
|
|
123
|
-
var getTransition = function getTransition(transition) {
|
|
124
|
-
if (transition in _variables.vars.transitions) {
|
|
125
|
-
return getCssVar(_variables.varNames.transition.prefix, transition);
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
exports.getTransition = getTransition;
|
|
130
|
-
|
|
131
|
-
var getSpace = function getSpace(space) {
|
|
132
|
-
if (space === 0) return space;
|
|
133
|
-
|
|
134
|
-
if (isNumber(space)) {
|
|
135
|
-
return u(space);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
if (space in _variables.vars.spaces) {
|
|
139
|
-
return getCssVar(_variables.varNames.space.prefix, space);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
if (isString(space)) {
|
|
143
|
-
return space;
|
|
144
|
-
}
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
exports.getSpace = getSpace;
|
|
148
|
-
|
|
149
|
-
var getDimension = function getDimension(dimension) {
|
|
150
|
-
if (dimension === 0) return dimension;
|
|
151
|
-
|
|
152
|
-
if (isNumber(dimension)) {
|
|
153
|
-
return u(dimension);
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
if (isString(dimension)) {
|
|
157
|
-
return dimension;
|
|
158
|
-
}
|
|
159
|
-
};
|
|
160
|
-
|
|
161
|
-
exports.getDimension = getDimension;
|
|
162
|
-
|
|
163
|
-
var getIconSize = function getIconSize(size) {
|
|
164
|
-
if (size === 0) return size;
|
|
165
|
-
|
|
166
|
-
if (size in _variables.vars.iconSizes) {
|
|
167
|
-
return getCssVar(_variables.varNames.iconSize.prefix, size);
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
if (isNumber(size) || isString(size)) {
|
|
171
|
-
return getDimension(size);
|
|
172
|
-
}
|
|
173
|
-
};
|
|
174
|
-
|
|
175
|
-
exports.getIconSize = getIconSize;
|
|
176
|
-
|
|
177
|
-
var getGridColumns = function getGridColumns(columns) {
|
|
178
|
-
if (columns) {
|
|
179
|
-
if (isArray(columns)) {
|
|
180
|
-
return columns.map(function (column) {
|
|
181
|
-
return getDimension(column);
|
|
182
|
-
}).join(" ");
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
if (isString(columns)) {
|
|
186
|
-
return columns;
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
};
|
|
190
|
-
|
|
191
|
-
exports.getGridColumns = getGridColumns;
|
|
192
|
-
|
|
193
|
-
var getBorder = function getBorder(borderSide) {
|
|
194
|
-
var borderWidth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "1px";
|
|
195
|
-
var borderColor = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "border";
|
|
196
|
-
var w = getSpace(borderWidth);
|
|
197
|
-
var borderSideStyles = {
|
|
198
|
-
x: "0 ".concat(w),
|
|
199
|
-
y: "".concat(w, " 0"),
|
|
200
|
-
all: "".concat(w),
|
|
201
|
-
top: "".concat(w, " 0 0 0"),
|
|
202
|
-
right: "0 ".concat(w, " 0 0"),
|
|
203
|
-
bottom: "0 0 ".concat(w, " 0"),
|
|
204
|
-
left: "0 0 0 ".concat(w)
|
|
205
|
-
};
|
|
206
|
-
|
|
207
|
-
if (borderSide in borderSideStyles) {
|
|
208
|
-
return "\n border-style: solid;\n border-width: ".concat(borderSideStyles[borderSide], ";\n border-color: ").concat(getColor(borderColor), ";\n ");
|
|
209
|
-
}
|
|
210
|
-
};
|
|
211
|
-
|
|
212
|
-
exports.getBorder = getBorder;
|