@flodesk/grain 2.7.5 → 2.8.1
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/box/index.js +78 -0
- package/es/components/button/index.js +55 -21
- package/es/styles/base.css +1 -0
- package/es/styles/components-variables.css +13 -7
- package/es/styles/variables.css +11 -0
- package/es/types/index.js +2 -1
- package/es/utilities/index.js +9 -1
- package/es/variables/index.js +10 -1
- package/package.json +1 -1
|
@@ -178,6 +178,28 @@ Box.__docgenInfo = {
|
|
|
178
178
|
"required": false,
|
|
179
179
|
"description": ""
|
|
180
180
|
},
|
|
181
|
+
"backgroundColor": {
|
|
182
|
+
"type": {
|
|
183
|
+
"name": "union",
|
|
184
|
+
"value": [{
|
|
185
|
+
"name": "enum",
|
|
186
|
+
"value": [{
|
|
187
|
+
"value": "\"greys\"",
|
|
188
|
+
"computed": false
|
|
189
|
+
}, {
|
|
190
|
+
"value": "\"baseColors\"",
|
|
191
|
+
"computed": false
|
|
192
|
+
}, {
|
|
193
|
+
"value": "\"semanticColors\"",
|
|
194
|
+
"computed": false
|
|
195
|
+
}]
|
|
196
|
+
}, {
|
|
197
|
+
"name": "string"
|
|
198
|
+
}]
|
|
199
|
+
},
|
|
200
|
+
"required": false,
|
|
201
|
+
"description": ""
|
|
202
|
+
},
|
|
181
203
|
"borderSide": {
|
|
182
204
|
"type": {
|
|
183
205
|
"name": "enum",
|
|
@@ -207,6 +229,40 @@ Box.__docgenInfo = {
|
|
|
207
229
|
"required": false,
|
|
208
230
|
"description": ""
|
|
209
231
|
},
|
|
232
|
+
"borderWidth": {
|
|
233
|
+
"type": {
|
|
234
|
+
"name": "union",
|
|
235
|
+
"value": [{
|
|
236
|
+
"name": "number"
|
|
237
|
+
}, {
|
|
238
|
+
"name": "string"
|
|
239
|
+
}]
|
|
240
|
+
},
|
|
241
|
+
"required": false,
|
|
242
|
+
"description": ""
|
|
243
|
+
},
|
|
244
|
+
"borderColor": {
|
|
245
|
+
"type": {
|
|
246
|
+
"name": "union",
|
|
247
|
+
"value": [{
|
|
248
|
+
"name": "enum",
|
|
249
|
+
"value": [{
|
|
250
|
+
"value": "\"greys\"",
|
|
251
|
+
"computed": false
|
|
252
|
+
}, {
|
|
253
|
+
"value": "\"baseColors\"",
|
|
254
|
+
"computed": false
|
|
255
|
+
}, {
|
|
256
|
+
"value": "\"semanticColors\"",
|
|
257
|
+
"computed": false
|
|
258
|
+
}]
|
|
259
|
+
}, {
|
|
260
|
+
"name": "string"
|
|
261
|
+
}]
|
|
262
|
+
},
|
|
263
|
+
"required": false,
|
|
264
|
+
"description": ""
|
|
265
|
+
},
|
|
210
266
|
"width": {
|
|
211
267
|
"type": {
|
|
212
268
|
"name": "union",
|
|
@@ -253,6 +309,28 @@ Box.__docgenInfo = {
|
|
|
253
309
|
"required": false,
|
|
254
310
|
"description": ""
|
|
255
311
|
},
|
|
312
|
+
"shadow": {
|
|
313
|
+
"type": {
|
|
314
|
+
"name": "union",
|
|
315
|
+
"value": [{
|
|
316
|
+
"name": "enum",
|
|
317
|
+
"value": [{
|
|
318
|
+
"value": "\"s\"",
|
|
319
|
+
"computed": false
|
|
320
|
+
}, {
|
|
321
|
+
"value": "\"m\"",
|
|
322
|
+
"computed": false
|
|
323
|
+
}, {
|
|
324
|
+
"value": "\"l\"",
|
|
325
|
+
"computed": false
|
|
326
|
+
}]
|
|
327
|
+
}, {
|
|
328
|
+
"name": "string"
|
|
329
|
+
}]
|
|
330
|
+
},
|
|
331
|
+
"required": false,
|
|
332
|
+
"description": ""
|
|
333
|
+
},
|
|
256
334
|
"padding": {
|
|
257
335
|
"type": {
|
|
258
336
|
"name": "union",
|
|
@@ -13,6 +13,8 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
13
13
|
|
|
14
14
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
15
15
|
|
|
16
|
+
require("core-js/modules/es.array.concat.js");
|
|
17
|
+
|
|
16
18
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
17
19
|
|
|
18
20
|
var _utilities = require("../../utilities");
|
|
@@ -21,30 +23,37 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
21
23
|
|
|
22
24
|
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
23
25
|
|
|
24
|
-
var
|
|
26
|
+
var _react2 = require("@emotion/react");
|
|
27
|
+
|
|
28
|
+
var _excluded = ["children", "tag", "variant", "isDisabled"];
|
|
25
29
|
|
|
26
|
-
var _templateObject, _templateObject2;
|
|
30
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
27
31
|
|
|
28
32
|
var __jsx = _react.default.createElement;
|
|
33
|
+
var variants = {
|
|
34
|
+
neutral: (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n color: inherit;\n background-color: transparent;\n border-color: ", ";\n\n &:hover {\n border-color: ", ";\n }\n &:active {\n border-color: ", ";\n }\n "])), (0, _utilities.getColor)('buttonBorder'), (0, _utilities.getColor)('buttonBorderHover'), (0, _utilities.getColor)('buttonBorderActive')),
|
|
35
|
+
primary: (0, _react2.css)(_templateObject2 || (_templateObject2 = (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)('body'), (0, _utilities.getColor)('grey7'), (0, _utilities.getColor)('grey2'))
|
|
36
|
+
};
|
|
29
37
|
|
|
30
|
-
var Wrapper = _styled.default.button(
|
|
38
|
+
var Wrapper = _styled.default.button(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\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 \n ", ";\n \n ", ";\n \n &:hover {\n transition: ", ";\n }\n \n &:active {\n transition: 0s;\n }\n"])), (0, _utilities.getWeight)('medium'), (0, _utilities.getRadius)('s'), (0, _utilities.getTransition)('slow'), function (p) {
|
|
39
|
+
return !p.isDisabled && variants[p.variant];
|
|
40
|
+
}, function (p) {
|
|
41
|
+
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
|
+
}, (0, _utilities.getTransition)('fast'));
|
|
31
43
|
|
|
32
|
-
var ButtonText = _styled.default.span(
|
|
44
|
+
var ButtonText = _styled.default.span(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n --opticalCompensation: -0.3px;\n\n position: relative;\n top: var(--opticalCompensation);\n"])));
|
|
33
45
|
|
|
34
46
|
var Button = function Button(_ref) {
|
|
35
47
|
var children = _ref.children,
|
|
36
|
-
_ref$size = _ref.size,
|
|
37
|
-
size = _ref$size === void 0 ? 'm' : _ref$size,
|
|
38
|
-
_ref$weight = _ref.weight,
|
|
39
|
-
weight = _ref$weight === void 0 ? 'normal' : _ref$weight,
|
|
40
|
-
color = _ref.color,
|
|
41
48
|
tag = _ref.tag,
|
|
49
|
+
_ref$variant = _ref.variant,
|
|
50
|
+
variant = _ref$variant === void 0 ? 'neutral' : _ref$variant,
|
|
51
|
+
isDisabled = _ref.isDisabled,
|
|
42
52
|
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
43
53
|
return __jsx(Wrapper, (0, _extends2.default)({
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
as: tag
|
|
54
|
+
as: tag,
|
|
55
|
+
variant: variant,
|
|
56
|
+
isDisabled: isDisabled
|
|
48
57
|
}, props), __jsx(ButtonText, null, children));
|
|
49
58
|
};
|
|
50
59
|
|
|
@@ -54,19 +63,44 @@ Button.__docgenInfo = {
|
|
|
54
63
|
"methods": [],
|
|
55
64
|
"displayName": "Button",
|
|
56
65
|
"props": {
|
|
57
|
-
"
|
|
66
|
+
"variant": {
|
|
58
67
|
"defaultValue": {
|
|
59
|
-
"value": "'
|
|
68
|
+
"value": "'neutral'",
|
|
60
69
|
"computed": false
|
|
61
70
|
},
|
|
62
|
-
"
|
|
71
|
+
"type": {
|
|
72
|
+
"name": "enum",
|
|
73
|
+
"value": [{
|
|
74
|
+
"value": "\"neutral\"",
|
|
75
|
+
"computed": false
|
|
76
|
+
}, {
|
|
77
|
+
"value": "\"primary\"",
|
|
78
|
+
"computed": false
|
|
79
|
+
}]
|
|
80
|
+
},
|
|
81
|
+
"required": false,
|
|
82
|
+
"description": ""
|
|
63
83
|
},
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
|
|
84
|
+
"children": {
|
|
85
|
+
"type": {
|
|
86
|
+
"name": "node"
|
|
87
|
+
},
|
|
88
|
+
"required": false,
|
|
89
|
+
"description": ""
|
|
90
|
+
},
|
|
91
|
+
"onClick": {
|
|
92
|
+
"type": {
|
|
93
|
+
"name": "func"
|
|
94
|
+
},
|
|
95
|
+
"required": false,
|
|
96
|
+
"description": ""
|
|
97
|
+
},
|
|
98
|
+
"isDisabled": {
|
|
99
|
+
"type": {
|
|
100
|
+
"name": "bool"
|
|
68
101
|
},
|
|
69
|
-
"required": false
|
|
102
|
+
"required": false,
|
|
103
|
+
"description": ""
|
|
70
104
|
}
|
|
71
105
|
}
|
|
72
106
|
};
|
package/es/styles/base.css
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
:root {
|
|
2
|
-
--grn-textBoxHeight-s:
|
|
3
|
-
--grn-textBoxHeight-m:
|
|
4
|
-
|
|
5
|
-
--grn-fieldTextBoxPaddingX-s:
|
|
6
|
-
--grn-fieldTextBoxPaddingX-m:
|
|
7
|
-
|
|
8
|
-
--grn-buttonTextBoxPaddingX-m:
|
|
2
|
+
--grn-textBoxHeight-s: 28px;
|
|
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%);
|
|
9
15
|
}
|
package/es/styles/variables.css
CHANGED
|
@@ -31,6 +31,11 @@
|
|
|
31
31
|
--grn-radius-l: 15px;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
:root {
|
|
35
|
+
--grn-transition-slow: 400ms;
|
|
36
|
+
--grn-transition-fast: 200ms;
|
|
37
|
+
}
|
|
38
|
+
|
|
34
39
|
:root {
|
|
35
40
|
--grn-color-grey8-HSL: 0 0% 7%;
|
|
36
41
|
|
|
@@ -42,10 +47,14 @@
|
|
|
42
47
|
--grn-color-grey3: hsl(0 0% 83%);
|
|
43
48
|
--grn-color-grey2: hsl(0 0% 93%);
|
|
44
49
|
--grn-color-grey1: hsl(0 0% 98%);
|
|
50
|
+
}
|
|
45
51
|
|
|
52
|
+
:root {
|
|
46
53
|
--grn-color-blue: hsl(218 74% 54%);
|
|
47
54
|
--grn-color-red: hsl(6 66% 65%);
|
|
55
|
+
}
|
|
48
56
|
|
|
57
|
+
:root {
|
|
49
58
|
--grn-color-body: var(--grn-color-grey8);
|
|
50
59
|
--grn-color-bodyDimmed: hsl(var(--grn-color-grey8-HSL) / 50%);
|
|
51
60
|
--grn-color-accent: var(--grn-color-grey8);
|
|
@@ -55,6 +64,8 @@
|
|
|
55
64
|
--grn-color-border: hsl(var(--grn-color-grey8-HSL) / 15%);
|
|
56
65
|
--grn-color-selection: var(--grn-color-blue);
|
|
57
66
|
--grn-color-danger: var(--grn-color-red);
|
|
67
|
+
--grn-color-disabledContent: var(--grn-color-grey5);
|
|
68
|
+
--grn-color-disabledBackground: hsl(var(--grn-color-grey8-HSL) / 12%);
|
|
58
69
|
}
|
|
59
70
|
|
|
60
71
|
:root {
|
package/es/types/index.js
CHANGED
|
@@ -20,7 +20,8 @@ var types = {
|
|
|
20
20
|
space: _propTypes.default.oneOfType([_propTypes.default.oneOf(Object.keys(_variables.vars.spaces)), _propTypes.default.number, _propTypes.default.string]),
|
|
21
21
|
dimension: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
22
22
|
side: _propTypes.default.oneOf(["all", "left", "right", "top", "bottom", "x", "y"]),
|
|
23
|
-
radius: _propTypes.default.oneOfType([_propTypes.default.oneOf(
|
|
23
|
+
radius: _propTypes.default.oneOfType([_propTypes.default.oneOf(Object.keys(_variables.vars.radiuses)), _propTypes.default.string]),
|
|
24
|
+
shadow: _propTypes.default.oneOfType([_propTypes.default.oneOf(Object.keys(_variables.vars.shadows)), _propTypes.default.string]),
|
|
24
25
|
position: _propTypes.default.oneOf(["static", "relative", "fixed", "absolute", "sticky"]),
|
|
25
26
|
textSize: _propTypes.default.oneOfType([_propTypes.default.oneOf(Object.keys(_variables.vars.textSizes)), _propTypes.default.number, _propTypes.default.string]),
|
|
26
27
|
weight: _propTypes.default.oneOf(Object.keys(_variables.vars.weights)),
|
package/es/utilities/index.js
CHANGED
|
@@ -23,7 +23,7 @@ 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.getRadius = exports.getWeight = exports.getTextSize = exports.getShadow = exports.getColor = exports.getCssVar = exports.getCssVarCore = exports.isBrowser = void 0;
|
|
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;
|
|
27
27
|
|
|
28
28
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
29
29
|
|
|
@@ -104,6 +104,14 @@ var getRadius = function getRadius(radius) {
|
|
|
104
104
|
|
|
105
105
|
exports.getRadius = getRadius;
|
|
106
106
|
|
|
107
|
+
var getTransition = function getTransition(transition) {
|
|
108
|
+
if (transition in _variables.vars.transitions) {
|
|
109
|
+
return getCssVar("transition", transition);
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
exports.getTransition = getTransition;
|
|
114
|
+
|
|
107
115
|
var getSpace = function getSpace(space) {
|
|
108
116
|
if (isNaN(space)) {
|
|
109
117
|
if (space in _variables.vars.spaces) {
|
package/es/variables/index.js
CHANGED
|
@@ -39,6 +39,10 @@ var vars = {
|
|
|
39
39
|
m: "m",
|
|
40
40
|
l: "l"
|
|
41
41
|
},
|
|
42
|
+
transitions: {
|
|
43
|
+
slow: "slow",
|
|
44
|
+
fast: "fast"
|
|
45
|
+
},
|
|
42
46
|
colors: {
|
|
43
47
|
greys: {
|
|
44
48
|
grey8: "grey8",
|
|
@@ -62,8 +66,13 @@ var vars = {
|
|
|
62
66
|
background: "background",
|
|
63
67
|
overlay: "overlay",
|
|
64
68
|
border: "border",
|
|
69
|
+
buttonBorder: "buttonBorder",
|
|
70
|
+
buttonBorderHover: "buttonBorderHover",
|
|
71
|
+
buttonBorderActive: "buttonBorderActive",
|
|
65
72
|
selection: "selection",
|
|
66
|
-
danger: "danger"
|
|
73
|
+
danger: "danger",
|
|
74
|
+
disabledContent: "disabledContent",
|
|
75
|
+
disabledBackground: "disabledBackground"
|
|
67
76
|
}
|
|
68
77
|
}
|
|
69
78
|
};
|