@flodesk/grain 2.8.1 → 2.11.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.
- package/es/components/arrange.js +290 -0
- package/es/components/{box/index.js → box.js} +98 -30
- package/es/components/{button/index.js → button.js} +7 -6
- package/es/components/index.js +11 -3
- package/es/components/text-input.js +124 -0
- package/es/components/{text/index.js → text.js} +5 -2
- package/es/styles/components-variables.css +0 -11
- package/es/styles/variables.css +25 -13
- package/es/{types/index.js → types.js} +7 -2
- package/es/{utilities/index.js → utilities.js} +57 -10
- package/es/{variables/index.js → variables.js} +10 -3
- package/package.json +1 -1
- package/es/components/input/index.js +0 -75
|
@@ -0,0 +1,290 @@
|
|
|
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.Arrange = void 0;
|
|
11
|
+
|
|
12
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
+
|
|
14
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
15
|
+
|
|
16
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
17
|
+
|
|
18
|
+
var _utilities = require("../utilities");
|
|
19
|
+
|
|
20
|
+
var _react = _interopRequireDefault(require("react"));
|
|
21
|
+
|
|
22
|
+
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
23
|
+
|
|
24
|
+
var _types = require("../types");
|
|
25
|
+
|
|
26
|
+
var _box = require("./box");
|
|
27
|
+
|
|
28
|
+
var _excluded = ["children", "gap", "columns", "autoFlow", "justifyItems", "alignItems", "justifyContent", "alignContent", "placeItems", "placeContent"];
|
|
29
|
+
|
|
30
|
+
var _templateObject;
|
|
31
|
+
|
|
32
|
+
var __jsx = _react.default.createElement;
|
|
33
|
+
var Wrapper = (0, _styled.default)(_box.Box)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: grid;\n grid-auto-flow: ", ";\n justify-content: start;\n align-items: center;\n gap: ", ";\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) {
|
|
34
|
+
return p.autoFlow;
|
|
35
|
+
}, function (p) {
|
|
36
|
+
return (0, _utilities.getSpace)(p.gap);
|
|
37
|
+
}, function (p) {
|
|
38
|
+
return (0, _utilities.getGridColumns)(p.columns);
|
|
39
|
+
}, function (p) {
|
|
40
|
+
return p.justifyItems;
|
|
41
|
+
}, function (p) {
|
|
42
|
+
return p.alignItems;
|
|
43
|
+
}, function (p) {
|
|
44
|
+
return p.justifyContent;
|
|
45
|
+
}, function (p) {
|
|
46
|
+
return p.alignContent;
|
|
47
|
+
}, function (p) {
|
|
48
|
+
return p.placeItems;
|
|
49
|
+
}, function (p) {
|
|
50
|
+
return p.placeContent;
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
var Arrange = function Arrange(_ref) {
|
|
54
|
+
var children = _ref.children,
|
|
55
|
+
gap = _ref.gap,
|
|
56
|
+
columns = _ref.columns,
|
|
57
|
+
_ref$autoFlow = _ref.autoFlow,
|
|
58
|
+
autoFlow = _ref$autoFlow === void 0 ? 'column' : _ref$autoFlow,
|
|
59
|
+
justifyItems = _ref.justifyItems,
|
|
60
|
+
alignItems = _ref.alignItems,
|
|
61
|
+
justifyContent = _ref.justifyContent,
|
|
62
|
+
alignContent = _ref.alignContent,
|
|
63
|
+
placeItems = _ref.placeItems,
|
|
64
|
+
placeContent = _ref.placeContent,
|
|
65
|
+
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
66
|
+
return __jsx(Wrapper, (0, _extends2.default)({
|
|
67
|
+
gap: gap,
|
|
68
|
+
columns: columns,
|
|
69
|
+
autoFlow: autoFlow
|
|
70
|
+
}, props), children);
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
exports.Arrange = Arrange;
|
|
74
|
+
Arrange.__docgenInfo = {
|
|
75
|
+
"description": "",
|
|
76
|
+
"methods": [],
|
|
77
|
+
"displayName": "Arrange",
|
|
78
|
+
"props": {
|
|
79
|
+
"autoFlow": {
|
|
80
|
+
"defaultValue": {
|
|
81
|
+
"value": "'column'",
|
|
82
|
+
"computed": false
|
|
83
|
+
},
|
|
84
|
+
"type": {
|
|
85
|
+
"name": "enum",
|
|
86
|
+
"value": [{
|
|
87
|
+
"value": "\"column\"",
|
|
88
|
+
"computed": false
|
|
89
|
+
}, {
|
|
90
|
+
"value": "\"row\"",
|
|
91
|
+
"computed": false
|
|
92
|
+
}]
|
|
93
|
+
},
|
|
94
|
+
"required": false,
|
|
95
|
+
"description": ""
|
|
96
|
+
},
|
|
97
|
+
"gap": {
|
|
98
|
+
"type": {
|
|
99
|
+
"name": "union",
|
|
100
|
+
"value": [{
|
|
101
|
+
"name": "enum",
|
|
102
|
+
"value": [{
|
|
103
|
+
"value": "\"xs\"",
|
|
104
|
+
"computed": false
|
|
105
|
+
}, {
|
|
106
|
+
"value": "\"s\"",
|
|
107
|
+
"computed": false
|
|
108
|
+
}, {
|
|
109
|
+
"value": "\"m\"",
|
|
110
|
+
"computed": false
|
|
111
|
+
}, {
|
|
112
|
+
"value": "\"l\"",
|
|
113
|
+
"computed": false
|
|
114
|
+
}, {
|
|
115
|
+
"value": "\"xl\"",
|
|
116
|
+
"computed": false
|
|
117
|
+
}, {
|
|
118
|
+
"value": "\"xxl\"",
|
|
119
|
+
"computed": false
|
|
120
|
+
}]
|
|
121
|
+
}, {
|
|
122
|
+
"name": "number"
|
|
123
|
+
}, {
|
|
124
|
+
"name": "string"
|
|
125
|
+
}]
|
|
126
|
+
},
|
|
127
|
+
"required": false,
|
|
128
|
+
"description": ""
|
|
129
|
+
},
|
|
130
|
+
"columns": {
|
|
131
|
+
"type": {
|
|
132
|
+
"name": "union",
|
|
133
|
+
"value": [{
|
|
134
|
+
"name": "array"
|
|
135
|
+
}, {
|
|
136
|
+
"name": "string"
|
|
137
|
+
}]
|
|
138
|
+
},
|
|
139
|
+
"required": false,
|
|
140
|
+
"description": ""
|
|
141
|
+
},
|
|
142
|
+
"justifyItems": {
|
|
143
|
+
"type": {
|
|
144
|
+
"name": "enum",
|
|
145
|
+
"value": [{
|
|
146
|
+
"value": "\"start\"",
|
|
147
|
+
"computed": false
|
|
148
|
+
}, {
|
|
149
|
+
"value": "\"end\"",
|
|
150
|
+
"computed": false
|
|
151
|
+
}, {
|
|
152
|
+
"value": "\"center\"",
|
|
153
|
+
"computed": false
|
|
154
|
+
}, {
|
|
155
|
+
"value": "\"stretch\"",
|
|
156
|
+
"computed": false
|
|
157
|
+
}]
|
|
158
|
+
},
|
|
159
|
+
"required": false,
|
|
160
|
+
"description": ""
|
|
161
|
+
},
|
|
162
|
+
"alignItems": {
|
|
163
|
+
"type": {
|
|
164
|
+
"name": "enum",
|
|
165
|
+
"value": [{
|
|
166
|
+
"value": "\"start\"",
|
|
167
|
+
"computed": false
|
|
168
|
+
}, {
|
|
169
|
+
"value": "\"end\"",
|
|
170
|
+
"computed": false
|
|
171
|
+
}, {
|
|
172
|
+
"value": "\"center\"",
|
|
173
|
+
"computed": false
|
|
174
|
+
}, {
|
|
175
|
+
"value": "\"stretch\"",
|
|
176
|
+
"computed": false
|
|
177
|
+
}]
|
|
178
|
+
},
|
|
179
|
+
"required": false,
|
|
180
|
+
"description": ""
|
|
181
|
+
},
|
|
182
|
+
"justifyContent": {
|
|
183
|
+
"type": {
|
|
184
|
+
"name": "enum",
|
|
185
|
+
"value": [{
|
|
186
|
+
"value": "\"start\"",
|
|
187
|
+
"computed": false
|
|
188
|
+
}, {
|
|
189
|
+
"value": "\"end\"",
|
|
190
|
+
"computed": false
|
|
191
|
+
}, {
|
|
192
|
+
"value": "\"center\"",
|
|
193
|
+
"computed": false
|
|
194
|
+
}, {
|
|
195
|
+
"value": "\"stretch\"",
|
|
196
|
+
"computed": false
|
|
197
|
+
}, {
|
|
198
|
+
"value": "\"space-around\"",
|
|
199
|
+
"computed": false
|
|
200
|
+
}, {
|
|
201
|
+
"value": "\"space-between\"",
|
|
202
|
+
"computed": false
|
|
203
|
+
}, {
|
|
204
|
+
"value": "\"space-evenly\"",
|
|
205
|
+
"computed": false
|
|
206
|
+
}]
|
|
207
|
+
},
|
|
208
|
+
"required": false,
|
|
209
|
+
"description": ""
|
|
210
|
+
},
|
|
211
|
+
"alignContent": {
|
|
212
|
+
"type": {
|
|
213
|
+
"name": "enum",
|
|
214
|
+
"value": [{
|
|
215
|
+
"value": "\"start\"",
|
|
216
|
+
"computed": false
|
|
217
|
+
}, {
|
|
218
|
+
"value": "\"end\"",
|
|
219
|
+
"computed": false
|
|
220
|
+
}, {
|
|
221
|
+
"value": "\"center\"",
|
|
222
|
+
"computed": false
|
|
223
|
+
}, {
|
|
224
|
+
"value": "\"stretch\"",
|
|
225
|
+
"computed": false
|
|
226
|
+
}, {
|
|
227
|
+
"value": "\"space-around\"",
|
|
228
|
+
"computed": false
|
|
229
|
+
}, {
|
|
230
|
+
"value": "\"space-between\"",
|
|
231
|
+
"computed": false
|
|
232
|
+
}, {
|
|
233
|
+
"value": "\"space-evenly\"",
|
|
234
|
+
"computed": false
|
|
235
|
+
}]
|
|
236
|
+
},
|
|
237
|
+
"required": false,
|
|
238
|
+
"description": ""
|
|
239
|
+
},
|
|
240
|
+
"placeItems": {
|
|
241
|
+
"type": {
|
|
242
|
+
"name": "enum",
|
|
243
|
+
"value": [{
|
|
244
|
+
"value": "\"start\"",
|
|
245
|
+
"computed": false
|
|
246
|
+
}, {
|
|
247
|
+
"value": "\"end\"",
|
|
248
|
+
"computed": false
|
|
249
|
+
}, {
|
|
250
|
+
"value": "\"center\"",
|
|
251
|
+
"computed": false
|
|
252
|
+
}, {
|
|
253
|
+
"value": "\"stretch\"",
|
|
254
|
+
"computed": false
|
|
255
|
+
}]
|
|
256
|
+
},
|
|
257
|
+
"required": false,
|
|
258
|
+
"description": ""
|
|
259
|
+
},
|
|
260
|
+
"placeContent": {
|
|
261
|
+
"type": {
|
|
262
|
+
"name": "enum",
|
|
263
|
+
"value": [{
|
|
264
|
+
"value": "\"start\"",
|
|
265
|
+
"computed": false
|
|
266
|
+
}, {
|
|
267
|
+
"value": "\"end\"",
|
|
268
|
+
"computed": false
|
|
269
|
+
}, {
|
|
270
|
+
"value": "\"center\"",
|
|
271
|
+
"computed": false
|
|
272
|
+
}, {
|
|
273
|
+
"value": "\"stretch\"",
|
|
274
|
+
"computed": false
|
|
275
|
+
}, {
|
|
276
|
+
"value": "\"space-around\"",
|
|
277
|
+
"computed": false
|
|
278
|
+
}, {
|
|
279
|
+
"value": "\"space-between\"",
|
|
280
|
+
"computed": false
|
|
281
|
+
}, {
|
|
282
|
+
"value": "\"space-evenly\"",
|
|
283
|
+
"computed": false
|
|
284
|
+
}]
|
|
285
|
+
},
|
|
286
|
+
"required": false,
|
|
287
|
+
"description": ""
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
};
|
|
@@ -15,68 +15,68 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
|
15
15
|
|
|
16
16
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
17
17
|
|
|
18
|
-
require("
|
|
19
|
-
|
|
20
|
-
var _utilities = require("../../utilities");
|
|
18
|
+
var _utilities = require("../utilities");
|
|
21
19
|
|
|
22
20
|
var _react = _interopRequireDefault(require("react"));
|
|
23
21
|
|
|
24
22
|
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
25
23
|
|
|
26
|
-
var _types = require("
|
|
24
|
+
var _types = require("../types");
|
|
27
25
|
|
|
28
|
-
var _excluded = ["children", "color", "backgroundColor", "borderSide", "borderWidth", "borderColor", "width", "height", "radius", "padding", "paddingTop", "paddingBottom", "paddingLeft", "paddingRight", "paddingX", "paddingY", "margin", "marginTop", "marginBottom", "marginLeft", "marginRight", "marginX", "marginY", "position", "top", "bottom", "left", "right", "shadow", "overflow", "aspectRatio"];
|
|
26
|
+
var _excluded = ["children", "color", "backgroundColor", "borderSide", "borderWidth", "borderColor", "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"];
|
|
29
27
|
|
|
30
28
|
var _templateObject;
|
|
31
29
|
|
|
32
30
|
var __jsx = _react.default.createElement;
|
|
33
31
|
|
|
34
|
-
var
|
|
35
|
-
if (propertyValue || propertyValue === 0) {
|
|
36
|
-
return "".concat(propertyName, ": ").concat((0, _utilities.getSpace)(propertyValue));
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
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 position: ", ";\n color: ", ";\n background-color: ", ";\n width: ", ";\n height: ", ";\n border-radius: ", ";\n box-shadow: ", ";\n overflow: ", ";\n aspect-ratio: ", ";\n"])), function (p) {
|
|
32
|
+
var Wrapper = _styled.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n ", ";\n \n padding:", ";\n padding-top:", ";\n padding-bottom:", ";\n padding-left:", ";\n padding-right:", ";\n \n margin:", ";\n margin-top:", ";\n margin-bottom:", ";\n margin-left:", ";\n margin-right:", ";\n \n top:", ";\n bottom:", ";\n left:", ";\n right:", ";\n \n width: ", ";\n min-width: ", ";\n max-width: ", ";\n height: ", ";\n min-height: ", ";\n max-height: ", ";\n\n color: ", ";\n background-color: ", ";\n \n position: ", ";\n border-radius: ", ";\n box-shadow: ", ";\n overflow: ", ";\n aspect-ratio: ", ";\n"])), function (p) {
|
|
41
33
|
return (0, _utilities.getBorder)(p.borderSide, p.borderWidth, p.borderColor);
|
|
42
34
|
}, function (p) {
|
|
43
|
-
return
|
|
35
|
+
return (0, _utilities.getSpace)(p.padding);
|
|
44
36
|
}, function (p) {
|
|
45
|
-
return
|
|
37
|
+
return (0, _utilities.getSpace)(p.paddingTop);
|
|
46
38
|
}, function (p) {
|
|
47
|
-
return
|
|
39
|
+
return (0, _utilities.getSpace)(p.paddingBottom);
|
|
48
40
|
}, function (p) {
|
|
49
|
-
return
|
|
41
|
+
return (0, _utilities.getSpace)(p.paddingLeft);
|
|
50
42
|
}, function (p) {
|
|
51
|
-
return
|
|
43
|
+
return (0, _utilities.getSpace)(p.paddingRight);
|
|
52
44
|
}, function (p) {
|
|
53
|
-
return
|
|
45
|
+
return (0, _utilities.getSpace)(p.margin);
|
|
54
46
|
}, function (p) {
|
|
55
|
-
return
|
|
47
|
+
return (0, _utilities.getSpace)(p.marginTop);
|
|
56
48
|
}, function (p) {
|
|
57
|
-
return
|
|
49
|
+
return (0, _utilities.getSpace)(p.marginBottom);
|
|
58
50
|
}, function (p) {
|
|
59
|
-
return
|
|
51
|
+
return (0, _utilities.getSpace)(p.marginLeft);
|
|
60
52
|
}, function (p) {
|
|
61
|
-
return
|
|
53
|
+
return (0, _utilities.getSpace)(p.marginRight);
|
|
62
54
|
}, function (p) {
|
|
63
|
-
return
|
|
55
|
+
return (0, _utilities.getSpace)(p.top);
|
|
64
56
|
}, function (p) {
|
|
65
|
-
return
|
|
57
|
+
return (0, _utilities.getSpace)(p.bottom);
|
|
66
58
|
}, function (p) {
|
|
67
|
-
return
|
|
59
|
+
return (0, _utilities.getSpace)(p.left);
|
|
68
60
|
}, function (p) {
|
|
69
|
-
return
|
|
61
|
+
return (0, _utilities.getSpace)(p.right);
|
|
70
62
|
}, function (p) {
|
|
71
|
-
return p.
|
|
63
|
+
return (0, _utilities.getDimension)(p.width);
|
|
64
|
+
}, function (p) {
|
|
65
|
+
return (0, _utilities.getDimension)(p.minWidth);
|
|
66
|
+
}, function (p) {
|
|
67
|
+
return (0, _utilities.getDimension)(p.maxWidth);
|
|
68
|
+
}, function (p) {
|
|
69
|
+
return (0, _utilities.getDimension)(p.height);
|
|
70
|
+
}, function (p) {
|
|
71
|
+
return (0, _utilities.getDimension)(p.minHeight);
|
|
72
|
+
}, function (p) {
|
|
73
|
+
return (0, _utilities.getDimension)(p.maxHeight);
|
|
72
74
|
}, function (p) {
|
|
73
75
|
return (0, _utilities.getColor)(p.color);
|
|
74
76
|
}, function (p) {
|
|
75
77
|
return (0, _utilities.getColor)(p.backgroundColor);
|
|
76
78
|
}, function (p) {
|
|
77
|
-
return
|
|
78
|
-
}, function (p) {
|
|
79
|
-
return (0, _utilities.getSpace)(p.height);
|
|
79
|
+
return p.position;
|
|
80
80
|
}, function (p) {
|
|
81
81
|
return (0, _utilities.getRadius)(p.radius);
|
|
82
82
|
}, function (p) {
|
|
@@ -95,7 +95,11 @@ var Box = function Box(_ref) {
|
|
|
95
95
|
borderWidth = _ref.borderWidth,
|
|
96
96
|
borderColor = _ref.borderColor,
|
|
97
97
|
width = _ref.width,
|
|
98
|
+
minWidth = _ref.minWidth,
|
|
99
|
+
maxWidth = _ref.maxWidth,
|
|
98
100
|
height = _ref.height,
|
|
101
|
+
minHeight = _ref.minHeight,
|
|
102
|
+
maxHeight = _ref.maxHeight,
|
|
99
103
|
radius = _ref.radius,
|
|
100
104
|
padding = _ref.padding,
|
|
101
105
|
paddingTop = _ref.paddingTop,
|
|
@@ -127,7 +131,11 @@ var Box = function Box(_ref) {
|
|
|
127
131
|
borderWidth: borderWidth,
|
|
128
132
|
borderColor: borderColor,
|
|
129
133
|
width: width,
|
|
134
|
+
minWidth: minWidth,
|
|
135
|
+
maxWidth: maxWidth,
|
|
130
136
|
height: height,
|
|
137
|
+
minHeight: minHeight,
|
|
138
|
+
maxHeight: maxHeight,
|
|
131
139
|
radius: radius,
|
|
132
140
|
padding: padding,
|
|
133
141
|
paddingTop: paddingY || paddingTop,
|
|
@@ -164,6 +172,9 @@ Box.__docgenInfo = {
|
|
|
164
172
|
"value": [{
|
|
165
173
|
"value": "\"greys\"",
|
|
166
174
|
"computed": false
|
|
175
|
+
}, {
|
|
176
|
+
"value": "\"fades\"",
|
|
177
|
+
"computed": false
|
|
167
178
|
}, {
|
|
168
179
|
"value": "\"baseColors\"",
|
|
169
180
|
"computed": false
|
|
@@ -186,6 +197,9 @@ Box.__docgenInfo = {
|
|
|
186
197
|
"value": [{
|
|
187
198
|
"value": "\"greys\"",
|
|
188
199
|
"computed": false
|
|
200
|
+
}, {
|
|
201
|
+
"value": "\"fades\"",
|
|
202
|
+
"computed": false
|
|
189
203
|
}, {
|
|
190
204
|
"value": "\"baseColors\"",
|
|
191
205
|
"computed": false
|
|
@@ -249,6 +263,9 @@ Box.__docgenInfo = {
|
|
|
249
263
|
"value": [{
|
|
250
264
|
"value": "\"greys\"",
|
|
251
265
|
"computed": false
|
|
266
|
+
}, {
|
|
267
|
+
"value": "\"fades\"",
|
|
268
|
+
"computed": false
|
|
252
269
|
}, {
|
|
253
270
|
"value": "\"baseColors\"",
|
|
254
271
|
"computed": false
|
|
@@ -275,6 +292,30 @@ Box.__docgenInfo = {
|
|
|
275
292
|
"required": false,
|
|
276
293
|
"description": ""
|
|
277
294
|
},
|
|
295
|
+
"minWidth": {
|
|
296
|
+
"type": {
|
|
297
|
+
"name": "union",
|
|
298
|
+
"value": [{
|
|
299
|
+
"name": "number"
|
|
300
|
+
}, {
|
|
301
|
+
"name": "string"
|
|
302
|
+
}]
|
|
303
|
+
},
|
|
304
|
+
"required": false,
|
|
305
|
+
"description": ""
|
|
306
|
+
},
|
|
307
|
+
"maxWidth": {
|
|
308
|
+
"type": {
|
|
309
|
+
"name": "union",
|
|
310
|
+
"value": [{
|
|
311
|
+
"name": "number"
|
|
312
|
+
}, {
|
|
313
|
+
"name": "string"
|
|
314
|
+
}]
|
|
315
|
+
},
|
|
316
|
+
"required": false,
|
|
317
|
+
"description": ""
|
|
318
|
+
},
|
|
278
319
|
"height": {
|
|
279
320
|
"type": {
|
|
280
321
|
"name": "union",
|
|
@@ -287,12 +328,39 @@ Box.__docgenInfo = {
|
|
|
287
328
|
"required": false,
|
|
288
329
|
"description": ""
|
|
289
330
|
},
|
|
331
|
+
"minHeight": {
|
|
332
|
+
"type": {
|
|
333
|
+
"name": "union",
|
|
334
|
+
"value": [{
|
|
335
|
+
"name": "number"
|
|
336
|
+
}, {
|
|
337
|
+
"name": "string"
|
|
338
|
+
}]
|
|
339
|
+
},
|
|
340
|
+
"required": false,
|
|
341
|
+
"description": ""
|
|
342
|
+
},
|
|
343
|
+
"maxHeight": {
|
|
344
|
+
"type": {
|
|
345
|
+
"name": "union",
|
|
346
|
+
"value": [{
|
|
347
|
+
"name": "number"
|
|
348
|
+
}, {
|
|
349
|
+
"name": "string"
|
|
350
|
+
}]
|
|
351
|
+
},
|
|
352
|
+
"required": false,
|
|
353
|
+
"description": ""
|
|
354
|
+
},
|
|
290
355
|
"radius": {
|
|
291
356
|
"type": {
|
|
292
357
|
"name": "union",
|
|
293
358
|
"value": [{
|
|
294
359
|
"name": "enum",
|
|
295
360
|
"value": [{
|
|
361
|
+
"value": "\"xs\"",
|
|
362
|
+
"computed": false
|
|
363
|
+
}, {
|
|
296
364
|
"value": "\"s\"",
|
|
297
365
|
"computed": false
|
|
298
366
|
}, {
|
|
@@ -17,7 +17,7 @@ require("core-js/modules/es.array.concat.js");
|
|
|
17
17
|
|
|
18
18
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
19
19
|
|
|
20
|
-
var _utilities = require("
|
|
20
|
+
var _utilities = require("../utilities");
|
|
21
21
|
|
|
22
22
|
var _react = _interopRequireDefault(require("react"));
|
|
23
23
|
|
|
@@ -27,21 +27,22 @@ var _react2 = require("@emotion/react");
|
|
|
27
27
|
|
|
28
28
|
var _excluded = ["children", "tag", "variant", "isDisabled"];
|
|
29
29
|
|
|
30
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
30
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
31
31
|
|
|
32
32
|
var __jsx = _react.default.createElement;
|
|
33
|
+
var variables = (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n --grn-buttonTextBoxPaddingX-m: 20px;\n --grn-color-buttonBorder: var(--grn-color-fade4);\n --grn-color-buttonBorder-hover: var(--grn-color-fade6);\n --grn-color-buttonBorder-active: var(--grn-color-grey8);\n"])));
|
|
33
34
|
var variants = {
|
|
34
|
-
neutral: (0, _react2.css)(
|
|
35
|
-
primary: (0, _react2.css)(
|
|
35
|
+
neutral: (0, _react2.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n color: inherit;\n background-color: transparent;\n border-color: var(--grn-color-buttonBorder);\n\n &:hover {\n border-color: var(--grn-color-buttonBorder-hover);\n }\n &:active {\n border-color: var(--grn-color-buttonBorder-active);\n }\n "]))),
|
|
36
|
+
primary: (0, _react2.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n color: white;\n background-color: ", ";\n border-color: transparent;\n\n &:hover {\n background-color: ", ";\n }\n &:active {\n color: ", ";\n background-color: black;\n }\n "])), (0, _utilities.getColor)('accent'), (0, _utilities.getColor)('grey7'), (0, _utilities.getColor)('grey2'))
|
|
36
37
|
};
|
|
37
38
|
|
|
38
|
-
var Wrapper = _styled.default.button(
|
|
39
|
+
var Wrapper = _styled.default.button(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n ", ";\n appearance: none;\n border: none;\n font-family: inherit;\n font-size: inherit;\n cursor: pointer;\n border-width: 1px;\n border-style: solid;\n font-weight: ", ";\n border-radius: ", ";\n transition: ", ";\n height: var(--grn-textBoxHeight-m);\n padding: 0 var(--grn-buttonTextBoxPaddingX-m);\n background-color: transparent;\n\n ", ";\n\n ", ";\n\n &:hover {\n transition: ", ";\n }\n\n &:active {\n transition: 0s;\n }\n"])), variables, (0, _utilities.getWeight)('medium'), (0, _utilities.getRadius)('s'), (0, _utilities.getTransition)('slow'), function (p) {
|
|
39
40
|
return !p.isDisabled && variants[p.variant];
|
|
40
41
|
}, function (p) {
|
|
41
42
|
return p.isDisabled && "\n color: ".concat((0, _utilities.getColor)('disabledContent'), ";\n background-color: ").concat((0, _utilities.getColor)('disabledBackground'), ";\n border-color: transparent;\n cursor: default;\n ");
|
|
42
43
|
}, (0, _utilities.getTransition)('fast'));
|
|
43
44
|
|
|
44
|
-
var ButtonText = _styled.default.span(
|
|
45
|
+
var ButtonText = _styled.default.span(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n --opticalCompensation: -0.3px;\n\n position: relative;\n top: var(--opticalCompensation);\n"])));
|
|
45
46
|
|
|
46
47
|
var Button = function Button(_ref) {
|
|
47
48
|
var children = _ref.children,
|
package/es/components/index.js
CHANGED
|
@@ -23,10 +23,16 @@ Object.defineProperty(exports, "Button", {
|
|
|
23
23
|
return _button.Button;
|
|
24
24
|
}
|
|
25
25
|
});
|
|
26
|
-
Object.defineProperty(exports, "
|
|
26
|
+
Object.defineProperty(exports, "TextInput", {
|
|
27
27
|
enumerable: true,
|
|
28
28
|
get: function get() {
|
|
29
|
-
return
|
|
29
|
+
return _textInput.TextInput;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
Object.defineProperty(exports, "Arrange", {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function get() {
|
|
35
|
+
return _arrange.Arrange;
|
|
30
36
|
}
|
|
31
37
|
});
|
|
32
38
|
|
|
@@ -36,4 +42,6 @@ var _box = require("./box");
|
|
|
36
42
|
|
|
37
43
|
var _button = require("./button");
|
|
38
44
|
|
|
39
|
-
var
|
|
45
|
+
var _textInput = require("./text-input");
|
|
46
|
+
|
|
47
|
+
var _arrange = require("./arrange");
|
|
@@ -0,0 +1,124 @@
|
|
|
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.TextInput = void 0;
|
|
11
|
+
|
|
12
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
+
|
|
14
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
15
|
+
|
|
16
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
17
|
+
|
|
18
|
+
var _utilities = require("../utilities");
|
|
19
|
+
|
|
20
|
+
var _react = _interopRequireDefault(require("react"));
|
|
21
|
+
|
|
22
|
+
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
23
|
+
|
|
24
|
+
var _types = require("../types");
|
|
25
|
+
|
|
26
|
+
var _react2 = require("@emotion/react");
|
|
27
|
+
|
|
28
|
+
var _excluded = ["value", "placeholder", "size", "label", "id"];
|
|
29
|
+
|
|
30
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
|
|
31
|
+
|
|
32
|
+
var __jsx = _react.default.createElement;
|
|
33
|
+
var variables = (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n --grn-fieldTextBoxPaddingX-s: 8px;\n --grn-fieldTextBoxPaddingX-m: 12px;\n --grn-color-fieldBorder: var(--grn-color-fade3);\n --grn-color-fieldBorder-hover: var(--grn-color-fade6);\n"])));
|
|
34
|
+
var inputSizes = {
|
|
35
|
+
s: (0, _react2.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n height: var(--grn-textBoxHeight-s);\n padding: 0 var(--grn-fieldTextBoxPaddingX-s);\n border-radius: ", ";\n "])), (0, _utilities.getRadius)('xs')),
|
|
36
|
+
m: (0, _react2.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n height: var(--grn-textBoxHeight-m);\n padding: 0 var(--grn-fieldTextBoxPaddingX-m);\n border-radius: ", ";\n "])), (0, _utilities.getRadius)('s'))
|
|
37
|
+
};
|
|
38
|
+
var labelSizes = {
|
|
39
|
+
s: '2px',
|
|
40
|
+
m: 'xs'
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
var Wrapper = _styled.default.div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n ", ";\n font-size: ", ";\n"])), variables, function (p) {
|
|
44
|
+
return (0, _utilities.getTextSize)(p.size);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
var Label = _styled.default.label(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n display: block;\n margin-bottom: ", ";\n"])), function (p) {
|
|
48
|
+
return (0, _utilities.getSpace)(labelSizes[p.size]);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
var InputField = _styled.default.input(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\n appearance: none;\n border: none;\n font-family: inherit;\n background-color: transparent;\n color: inherit;\n font-size: inherit;\n transition: ", ";\n border: 1px solid var(--grn-color-fieldBorder);\n width: 100%;\n ", ";\n outline: none;\n\n &::placeholder {\n color: ", ";\n }\n\n &:hover {\n transition: ", ";\n border-color: var(--grn-color-fieldBorder-hover);\n }\n \n &:focus {\n transition: 0s;\n border-color: var(--grn-color-selection);\n }\n"])), (0, _utilities.getTransition)('slow'), function (p) {
|
|
52
|
+
return inputSizes[p.size];
|
|
53
|
+
}, (0, _utilities.getColor)('grey5'), (0, _utilities.getTransition)('fast'));
|
|
54
|
+
|
|
55
|
+
var TextInput = function TextInput(_ref) {
|
|
56
|
+
var value = _ref.value,
|
|
57
|
+
placeholder = _ref.placeholder,
|
|
58
|
+
_ref$size = _ref.size,
|
|
59
|
+
size = _ref$size === void 0 ? 'm' : _ref$size,
|
|
60
|
+
label = _ref.label,
|
|
61
|
+
id = _ref.id,
|
|
62
|
+
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
63
|
+
return __jsx(Wrapper, {
|
|
64
|
+
size: size,
|
|
65
|
+
type: "text"
|
|
66
|
+
}, label && __jsx(Label, {
|
|
67
|
+
htmlFor: id,
|
|
68
|
+
size: size
|
|
69
|
+
}, label), __jsx(InputField, (0, _extends2.default)({
|
|
70
|
+
value: value,
|
|
71
|
+
placeholder: placeholder,
|
|
72
|
+
size: size,
|
|
73
|
+
label: label,
|
|
74
|
+
id: id
|
|
75
|
+
}, props)));
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
exports.TextInput = TextInput;
|
|
79
|
+
TextInput.__docgenInfo = {
|
|
80
|
+
"description": "",
|
|
81
|
+
"methods": [],
|
|
82
|
+
"displayName": "TextInput",
|
|
83
|
+
"props": {
|
|
84
|
+
"size": {
|
|
85
|
+
"defaultValue": {
|
|
86
|
+
"value": "'m'",
|
|
87
|
+
"computed": false
|
|
88
|
+
},
|
|
89
|
+
"type": {
|
|
90
|
+
"name": "enum",
|
|
91
|
+
"value": [{
|
|
92
|
+
"value": "\"s\"",
|
|
93
|
+
"computed": false
|
|
94
|
+
}, {
|
|
95
|
+
"value": "\"m\"",
|
|
96
|
+
"computed": false
|
|
97
|
+
}]
|
|
98
|
+
},
|
|
99
|
+
"required": false,
|
|
100
|
+
"description": ""
|
|
101
|
+
},
|
|
102
|
+
"id": {
|
|
103
|
+
"type": {
|
|
104
|
+
"name": "string"
|
|
105
|
+
},
|
|
106
|
+
"required": true,
|
|
107
|
+
"description": ""
|
|
108
|
+
},
|
|
109
|
+
"value": {
|
|
110
|
+
"type": {
|
|
111
|
+
"name": "string"
|
|
112
|
+
},
|
|
113
|
+
"required": false,
|
|
114
|
+
"description": ""
|
|
115
|
+
},
|
|
116
|
+
"label": {
|
|
117
|
+
"type": {
|
|
118
|
+
"name": "node"
|
|
119
|
+
},
|
|
120
|
+
"required": false,
|
|
121
|
+
"description": ""
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
};
|
|
@@ -15,13 +15,13 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
|
15
15
|
|
|
16
16
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
17
17
|
|
|
18
|
-
var _utilities = require("
|
|
18
|
+
var _utilities = require("../utilities");
|
|
19
19
|
|
|
20
20
|
var _react = _interopRequireDefault(require("react"));
|
|
21
21
|
|
|
22
22
|
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
23
23
|
|
|
24
|
-
var _types = require("
|
|
24
|
+
var _types = require("../types");
|
|
25
25
|
|
|
26
26
|
var _excluded = ["children", "size", "weight", "color", "tag", "hasEllipsis", "ellipsisLines", "align"];
|
|
27
27
|
|
|
@@ -137,6 +137,9 @@ Text.__docgenInfo = {
|
|
|
137
137
|
"value": [{
|
|
138
138
|
"value": "\"greys\"",
|
|
139
139
|
"computed": false
|
|
140
|
+
}, {
|
|
141
|
+
"value": "\"fades\"",
|
|
142
|
+
"computed": false
|
|
140
143
|
}, {
|
|
141
144
|
"value": "\"baseColors\"",
|
|
142
145
|
"computed": false
|
|
@@ -1,15 +1,4 @@
|
|
|
1
1
|
:root {
|
|
2
2
|
--grn-textBoxHeight-s: 28px;
|
|
3
3
|
--grn-textBoxHeight-m: 40px;
|
|
4
|
-
|
|
5
|
-
--grn-fieldTextBoxPaddingX-s: 8px;
|
|
6
|
-
--grn-fieldTextBoxPaddingX-m: 12px;
|
|
7
|
-
|
|
8
|
-
--grn-buttonTextBoxPaddingX-m: 20px;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
:root {
|
|
12
|
-
--grn-color-buttonBorder: hsl(var(--grn-color-grey8-HSL) / 30%);
|
|
13
|
-
--grn-color-buttonBorderHover: hsl(var(--grn-color-grey8-HSL) / 50%);
|
|
14
|
-
--grn-color-buttonBorderActive: hsl(var(--grn-color-grey8-HSL) / 80%);
|
|
15
4
|
}
|
package/es/styles/variables.css
CHANGED
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
:root {
|
|
29
|
+
--grn-radius-xs: 3.5px;
|
|
29
30
|
--grn-radius-s: 5px;
|
|
30
31
|
--grn-radius-m: 10px;
|
|
31
32
|
--grn-radius-l: 15px;
|
|
@@ -37,16 +38,27 @@
|
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
:root {
|
|
40
|
-
--grn-color-grey8-
|
|
41
|
+
--grn-color-grey8-HS: 0 0%;
|
|
42
|
+
--grn-color-grey8-HSL: var(--grn-color-grey8-HS) 7%;
|
|
41
43
|
|
|
42
44
|
--grn-color-grey8: hsl(var(--grn-color-grey8-HSL));
|
|
43
|
-
--grn-color-grey7: hsl(
|
|
44
|
-
--grn-color-grey6: hsl(
|
|
45
|
-
--grn-color-grey5: hsl(
|
|
46
|
-
--grn-color-grey4: hsl(
|
|
47
|
-
--grn-color-grey3: hsl(
|
|
48
|
-
--grn-color-grey2: hsl(
|
|
49
|
-
--grn-color-grey1: hsl(
|
|
45
|
+
--grn-color-grey7: hsl(var(--grn-color-grey8-HS) 20%);
|
|
46
|
+
--grn-color-grey6: hsl(var(--grn-color-grey8-HS) 32%);
|
|
47
|
+
--grn-color-grey5: hsl(var(--grn-color-grey8-HS) 50%);
|
|
48
|
+
--grn-color-grey4: hsl(var(--grn-color-grey8-HS) 66%);
|
|
49
|
+
--grn-color-grey3: hsl(var(--grn-color-grey8-HS) 83%);
|
|
50
|
+
--grn-color-grey2: hsl(var(--grn-color-grey8-HS) 93%);
|
|
51
|
+
--grn-color-grey1: hsl(var(--grn-color-grey8-HS) 98%);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
:root {
|
|
55
|
+
--grn-color-fade7: hsl(var(--grn-color-grey8-HS) 0% / 49%);
|
|
56
|
+
--grn-color-fade6: hsl(var(--grn-color-grey8-HS) 0% / 42%);
|
|
57
|
+
--grn-color-fade5: hsl(var(--grn-color-grey8-HS) 0% / 35%);
|
|
58
|
+
--grn-color-fade4: hsl(var(--grn-color-grey8-HS) 0% / 28%);
|
|
59
|
+
--grn-color-fade3: hsl(var(--grn-color-grey8-HS) 0% / 21%);
|
|
60
|
+
--grn-color-fade2: hsl(var(--grn-color-grey8-HS) 0% / 14%);
|
|
61
|
+
--grn-color-fade1: hsl(var(--grn-color-grey8-HS) 0% / 7%);
|
|
50
62
|
}
|
|
51
63
|
|
|
52
64
|
:root {
|
|
@@ -56,16 +68,16 @@
|
|
|
56
68
|
|
|
57
69
|
:root {
|
|
58
70
|
--grn-color-body: var(--grn-color-grey8);
|
|
59
|
-
--grn-color-bodyDimmed:
|
|
71
|
+
--grn-color-bodyDimmed: var(--grn-color-fade7);
|
|
60
72
|
--grn-color-accent: var(--grn-color-grey8);
|
|
61
|
-
--grn-color-backgroundSecondary:
|
|
73
|
+
--grn-color-backgroundSecondary: white;
|
|
62
74
|
--grn-color-background: var(--grn-color-grey1);
|
|
63
|
-
--grn-color-overlay:
|
|
64
|
-
--grn-color-border:
|
|
75
|
+
--grn-color-overlay: var(--grn-color-fade1);
|
|
76
|
+
--grn-color-border: var(--grn-color-fade2);
|
|
65
77
|
--grn-color-selection: var(--grn-color-blue);
|
|
66
78
|
--grn-color-danger: var(--grn-color-red);
|
|
67
79
|
--grn-color-disabledContent: var(--grn-color-grey5);
|
|
68
|
-
--grn-color-disabledBackground:
|
|
80
|
+
--grn-color-disabledBackground: var(--grn-color-fade1);
|
|
69
81
|
}
|
|
70
82
|
|
|
71
83
|
:root {
|
|
@@ -13,7 +13,7 @@ require("core-js/modules/es.object.keys.js");
|
|
|
13
13
|
|
|
14
14
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
15
|
|
|
16
|
-
var _variables = require("
|
|
16
|
+
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]),
|
|
@@ -26,6 +26,11 @@ var types = {
|
|
|
26
26
|
textSize: _propTypes.default.oneOfType([_propTypes.default.oneOf(Object.keys(_variables.vars.textSizes)), _propTypes.default.number, _propTypes.default.string]),
|
|
27
27
|
weight: _propTypes.default.oneOf(Object.keys(_variables.vars.weights)),
|
|
28
28
|
textAlign: _propTypes.default.oneOf(["left", "center", "right"]),
|
|
29
|
-
overflow: _propTypes.default.oneOf(["visible", "hidden", "scroll", "auto"])
|
|
29
|
+
overflow: _propTypes.default.oneOf(["visible", "hidden", "scroll", "auto"]),
|
|
30
|
+
fieldSize: _propTypes.default.oneOf(["s", "m"]),
|
|
31
|
+
columns: _propTypes.default.oneOfType([_propTypes.default.array, _propTypes.default.string]),
|
|
32
|
+
autoFlow: _propTypes.default.oneOf(["column", "row"]),
|
|
33
|
+
gridItemsAlignments: _propTypes.default.oneOf(["start", "end", "center", "stretch"]),
|
|
34
|
+
gridContentPositions: _propTypes.default.oneOf(["start", "end", "center", "stretch", "space-around", "space-between", "space-evenly"])
|
|
30
35
|
};
|
|
31
36
|
exports.types = types;
|
|
@@ -23,13 +23,15 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
23
23
|
Object.defineProperty(exports, "__esModule", {
|
|
24
24
|
value: true
|
|
25
25
|
});
|
|
26
|
-
exports.getBorder = exports.getSpace = exports.getTransition = exports.getRadius = exports.getWeight = exports.getTextSize = exports.getShadow = exports.getColor = exports.getCssVar = exports.getCssVarCore = exports.isBrowser = void 0;
|
|
26
|
+
exports.getBorder = exports.getGridColumns = 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
27
|
|
|
28
28
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
29
29
|
|
|
30
30
|
require("core-js/modules/es.array.concat.js");
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
require("core-js/modules/es.array.map.js");
|
|
33
|
+
|
|
34
|
+
var _variables = require("./variables");
|
|
33
35
|
|
|
34
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; }
|
|
35
37
|
|
|
@@ -54,8 +56,20 @@ var u = function u(amount) {
|
|
|
54
56
|
return "calc(var(--grn-unit) * ".concat(amount, ")");
|
|
55
57
|
};
|
|
56
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
|
+
|
|
57
71
|
var getColor = function getColor(color) {
|
|
58
|
-
if (color in _objectSpread(_objectSpread(_objectSpread({}, _variables.vars.colors.baseColors), _variables.vars.colors.greys), _variables.vars.colors.semanticColors)) {
|
|
72
|
+
if (color in _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, _variables.vars.colors.baseColors), _variables.vars.colors.greys), _variables.vars.colors.semanticColors), _variables.vars.colors.fades)) {
|
|
59
73
|
return getCssVar("color", color);
|
|
60
74
|
}
|
|
61
75
|
|
|
@@ -113,20 +127,53 @@ var getTransition = function getTransition(transition) {
|
|
|
113
127
|
exports.getTransition = getTransition;
|
|
114
128
|
|
|
115
129
|
var getSpace = function getSpace(space) {
|
|
116
|
-
if (
|
|
117
|
-
if (space in _variables.vars.spaces) {
|
|
118
|
-
return getCssVar("space", space);
|
|
119
|
-
}
|
|
130
|
+
if (space === 0) return space;
|
|
120
131
|
|
|
121
|
-
|
|
132
|
+
if (isNumber(space)) {
|
|
133
|
+
return u(space);
|
|
122
134
|
}
|
|
123
135
|
|
|
124
|
-
if (space
|
|
125
|
-
|
|
136
|
+
if (space in _variables.vars.spaces) {
|
|
137
|
+
return getCssVar("space", space);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
if (isString(space)) {
|
|
141
|
+
return space;
|
|
142
|
+
}
|
|
126
143
|
};
|
|
127
144
|
|
|
128
145
|
exports.getSpace = getSpace;
|
|
129
146
|
|
|
147
|
+
var getDimension = function getDimension(dimension) {
|
|
148
|
+
if (dimension === 0) return dimension;
|
|
149
|
+
|
|
150
|
+
if (isNumber(dimension)) {
|
|
151
|
+
return u(dimension);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (isString(dimension)) {
|
|
155
|
+
return dimension;
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
exports.getDimension = getDimension;
|
|
160
|
+
|
|
161
|
+
var getGridColumns = function getGridColumns(columns) {
|
|
162
|
+
if (columns) {
|
|
163
|
+
if (isArray(columns)) {
|
|
164
|
+
return columns.map(function (column) {
|
|
165
|
+
return getDimension(column);
|
|
166
|
+
}).join(" ");
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
if (isString(columns)) {
|
|
170
|
+
return columns;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
exports.getGridColumns = getGridColumns;
|
|
176
|
+
|
|
130
177
|
var getBorder = function getBorder(borderSide) {
|
|
131
178
|
var borderWidth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "1px";
|
|
132
179
|
var borderColor = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "border";
|
|
@@ -30,6 +30,7 @@ var vars = {
|
|
|
30
30
|
semiBold: "semiBold"
|
|
31
31
|
},
|
|
32
32
|
radiuses: {
|
|
33
|
+
xs: "xs",
|
|
33
34
|
s: "s",
|
|
34
35
|
m: "m",
|
|
35
36
|
l: "l"
|
|
@@ -54,6 +55,15 @@ var vars = {
|
|
|
54
55
|
grey2: "grey2",
|
|
55
56
|
grey1: "grey1"
|
|
56
57
|
},
|
|
58
|
+
fades: {
|
|
59
|
+
fade7: "fade7",
|
|
60
|
+
fade6: "fade6",
|
|
61
|
+
fade5: "fade5",
|
|
62
|
+
fade4: "fade4",
|
|
63
|
+
fade3: "fade3",
|
|
64
|
+
fade2: "fade2",
|
|
65
|
+
fade1: "fade1"
|
|
66
|
+
},
|
|
57
67
|
baseColors: {
|
|
58
68
|
blue: "blue",
|
|
59
69
|
red: "red"
|
|
@@ -66,9 +76,6 @@ var vars = {
|
|
|
66
76
|
background: "background",
|
|
67
77
|
overlay: "overlay",
|
|
68
78
|
border: "border",
|
|
69
|
-
buttonBorder: "buttonBorder",
|
|
70
|
-
buttonBorderHover: "buttonBorderHover",
|
|
71
|
-
buttonBorderActive: "buttonBorderActive",
|
|
72
79
|
selection: "selection",
|
|
73
80
|
danger: "danger",
|
|
74
81
|
disabledContent: "disabledContent",
|
package/package.json
CHANGED
|
@@ -1,75 +0,0 @@
|
|
|
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.Input = void 0;
|
|
11
|
-
|
|
12
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
-
|
|
14
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
15
|
-
|
|
16
|
-
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
17
|
-
|
|
18
|
-
var _utilities = require("../../utilities");
|
|
19
|
-
|
|
20
|
-
var _react = _interopRequireDefault(require("react"));
|
|
21
|
-
|
|
22
|
-
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
23
|
-
|
|
24
|
-
var _types = require("../../types");
|
|
25
|
-
|
|
26
|
-
var _excluded = ["value", "placeholder", "size"];
|
|
27
|
-
|
|
28
|
-
var _templateObject;
|
|
29
|
-
|
|
30
|
-
var __jsx = _react.default.createElement;
|
|
31
|
-
|
|
32
|
-
var Wrapper = _styled.default.input(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n appearance: none;\n border: none;\n font-family: inherit;\n background-color: transparent;\n color: inherit;\n font-size: ", ";\n border-radius: ", ";\n border: 1px solid ", ";\n height: ", ";\n padding: 0 ", ";\n width: 100%;\n"])), function (p) {
|
|
33
|
-
return (0, _utilities.getTextSize)(p.size);
|
|
34
|
-
}, (0, _utilities.getRadius)('m'), (0, _utilities.getColor)('grey3'), function (p) {
|
|
35
|
-
return "var(--grn-textBoxHeight-".concat(p.size, ")");
|
|
36
|
-
}, function (p) {
|
|
37
|
-
return "var(--grn-fieldTextBoxPaddingX-".concat(p.size, ")");
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
var Input = function Input(_ref) {
|
|
41
|
-
var value = _ref.value,
|
|
42
|
-
_ref$placeholder = _ref.placeholder,
|
|
43
|
-
placeholder = _ref$placeholder === void 0 ? 'Placeholder' : _ref$placeholder,
|
|
44
|
-
_ref$size = _ref.size,
|
|
45
|
-
size = _ref$size === void 0 ? 'm' : _ref$size,
|
|
46
|
-
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
47
|
-
return __jsx(Wrapper, (0, _extends2.default)({
|
|
48
|
-
value: value,
|
|
49
|
-
placeholder: placeholder,
|
|
50
|
-
size: size
|
|
51
|
-
}, props));
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
exports.Input = Input;
|
|
55
|
-
Input.__docgenInfo = {
|
|
56
|
-
"description": "",
|
|
57
|
-
"methods": [],
|
|
58
|
-
"displayName": "Input",
|
|
59
|
-
"props": {
|
|
60
|
-
"placeholder": {
|
|
61
|
-
"defaultValue": {
|
|
62
|
-
"value": "'Placeholder'",
|
|
63
|
-
"computed": false
|
|
64
|
-
},
|
|
65
|
-
"required": false
|
|
66
|
-
},
|
|
67
|
-
"size": {
|
|
68
|
-
"defaultValue": {
|
|
69
|
-
"value": "'m'",
|
|
70
|
-
"computed": false
|
|
71
|
-
},
|
|
72
|
-
"required": false
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
};
|