@flodesk/grain 2.15.0 → 2.16.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/button.js +17 -13
- package/es/components/icon-button.js +115 -0
- package/es/components/icon.js +21 -16
- package/es/components/index.js +17 -1
- package/es/components/text-button.js +85 -0
- package/es/styles/components-variables.css +1 -0
- package/package.json +1 -1
package/es/components/button.js
CHANGED
|
@@ -13,8 +13,6 @@ 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
|
-
|
|
18
16
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
19
17
|
|
|
20
18
|
var _utilities = require("../utilities");
|
|
@@ -27,38 +25,37 @@ var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
|
27
25
|
|
|
28
26
|
var _react2 = require("@emotion/react");
|
|
29
27
|
|
|
30
|
-
var
|
|
28
|
+
var _types = require("../types");
|
|
29
|
+
|
|
30
|
+
var _excluded = ["children", "variant", "isDisabled", "icon"];
|
|
31
31
|
|
|
32
32
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
33
33
|
|
|
34
34
|
var __jsx = _react.default.createElement;
|
|
35
|
-
var variables = (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n --grn-
|
|
35
|
+
var variables = (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n --grn-paddingX-m: 16px;\n --grn-borderColor: var(--grn-color-fade4);\n --grn-borderColor-hover: var(--grn-color-fade6);\n --grn-borderColor-active: var(--grn-color-grey8);\n"])));
|
|
36
36
|
var variants = {
|
|
37
|
-
neutral: (0, _react2.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n color: inherit;\n background-color: transparent;\n border-color: var(--grn-
|
|
37
|
+
neutral: (0, _react2.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n color: inherit;\n background-color: transparent;\n border-color: var(--grn-borderColor);\n\n &:hover {\n border-color: var(--grn-borderColor-hover);\n }\n &:active {\n border-color: var(--grn-borderColor-active);\n }\n "]))),
|
|
38
38
|
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'))
|
|
39
39
|
};
|
|
40
40
|
|
|
41
|
-
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
|
|
41
|
+
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-paddingX-m);\n background-color: transparent;\n display: flex;\n align-items: center;\n gap: 12px;\n\n ", ";\n \n &:hover {\n transition: ", ";\n }\n\n &:active {\n transition: 0s;\n }\n \n &:disabled {\n color: ", ";\n background-color: ", ";\n border-color: transparent;\n cursor: default;\n }\n"])), variables, (0, _utilities.getWeight)('medium'), (0, _utilities.getRadius)('s'), (0, _utilities.getTransition)('slow'), function (p) {
|
|
42
42
|
return !p.isDisabled && variants[p.variant];
|
|
43
|
-
},
|
|
44
|
-
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 ");
|
|
45
|
-
}, (0, _utilities.getTransition)('fast'));
|
|
43
|
+
}, (0, _utilities.getTransition)('fast'), (0, _utilities.getColor)('disabledContent'), (0, _utilities.getColor)('disabledBackground'));
|
|
46
44
|
|
|
47
45
|
var Button = function Button(_ref) {
|
|
48
46
|
var children = _ref.children,
|
|
49
|
-
tag = _ref.tag,
|
|
50
47
|
_ref$variant = _ref.variant,
|
|
51
48
|
variant = _ref$variant === void 0 ? 'neutral' : _ref$variant,
|
|
52
49
|
isDisabled = _ref.isDisabled,
|
|
53
50
|
icon = _ref.icon,
|
|
54
51
|
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
55
52
|
return __jsx(Wrapper, (0, _extends2.default)({
|
|
56
|
-
as: tag,
|
|
57
53
|
variant: variant,
|
|
58
|
-
|
|
54
|
+
disabled: isDisabled,
|
|
59
55
|
icon: icon
|
|
60
56
|
}, props), icon && __jsx(_components.Icon, {
|
|
61
|
-
icon: icon
|
|
57
|
+
icon: icon,
|
|
58
|
+
color: "currentColor"
|
|
62
59
|
}), children);
|
|
63
60
|
};
|
|
64
61
|
|
|
@@ -93,6 +90,13 @@ Button.__docgenInfo = {
|
|
|
93
90
|
"required": false,
|
|
94
91
|
"description": ""
|
|
95
92
|
},
|
|
93
|
+
"icon": {
|
|
94
|
+
"type": {
|
|
95
|
+
"name": "node"
|
|
96
|
+
},
|
|
97
|
+
"required": false,
|
|
98
|
+
"description": ""
|
|
99
|
+
},
|
|
96
100
|
"onClick": {
|
|
97
101
|
"type": {
|
|
98
102
|
"name": "func"
|
|
@@ -0,0 +1,115 @@
|
|
|
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.IconButton = 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 _components = require("../components");
|
|
21
|
+
|
|
22
|
+
var _react = _interopRequireDefault(require("react"));
|
|
23
|
+
|
|
24
|
+
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
25
|
+
|
|
26
|
+
var _react2 = require("@emotion/react");
|
|
27
|
+
|
|
28
|
+
var _types = require("../types");
|
|
29
|
+
|
|
30
|
+
var _excluded = ["children", "isDisabled", "icon", "color"];
|
|
31
|
+
|
|
32
|
+
var _templateObject, _templateObject2;
|
|
33
|
+
|
|
34
|
+
var __jsx = _react.default.createElement;
|
|
35
|
+
var variables = (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n --grn-borderColor-hover: var(--grn-color-fade4);\n --grn-borderColor-active: var(--grn-color-grey8);\n"])));
|
|
36
|
+
|
|
37
|
+
var Wrapper = _styled.default.button(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n ", ";\n appearance: none;\n border: 1px solid transparent;\n padding: 0;\n font-family: inherit;\n font-size: inherit;\n cursor: pointer;\n border-radius: ", ";\n transition: ", ";\n width: var(--grn-clearButtonHeight-m);\n height: var(--grn-clearButtonHeight-m);\n background-color: transparent;\n display: flex;\n align-items: center;\n justify-content: center;\n \n &:hover {\n transition: ", ";\n border-color: var(--grn-borderColor-hover);\n }\n \n &:active {\n transition: 0s;\n border-color: var(--grn-borderColor-active);\n }\n \n &:disabled {\n color: ", ";\n cursor: default;\n border-color: transparent;\n }\n"])), variables, (0, _utilities.getRadius)('s'), (0, _utilities.getTransition)('slow'), (0, _utilities.getTransition)('fast'), (0, _utilities.getColor)('disabledContent'));
|
|
38
|
+
|
|
39
|
+
var IconButton = function IconButton(_ref) {
|
|
40
|
+
var children = _ref.children,
|
|
41
|
+
isDisabled = _ref.isDisabled,
|
|
42
|
+
icon = _ref.icon,
|
|
43
|
+
color = _ref.color,
|
|
44
|
+
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
45
|
+
return __jsx(Wrapper, (0, _extends2.default)({
|
|
46
|
+
disabled: isDisabled,
|
|
47
|
+
icon: icon,
|
|
48
|
+
color: color
|
|
49
|
+
}, props), icon && __jsx(_components.Icon, {
|
|
50
|
+
icon: icon,
|
|
51
|
+
color: "currentColor"
|
|
52
|
+
}), children && children);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
exports.IconButton = IconButton;
|
|
56
|
+
IconButton.__docgenInfo = {
|
|
57
|
+
"description": "",
|
|
58
|
+
"methods": [],
|
|
59
|
+
"displayName": "IconButton",
|
|
60
|
+
"props": {
|
|
61
|
+
"children": {
|
|
62
|
+
"type": {
|
|
63
|
+
"name": "node"
|
|
64
|
+
},
|
|
65
|
+
"required": false,
|
|
66
|
+
"description": ""
|
|
67
|
+
},
|
|
68
|
+
"icon": {
|
|
69
|
+
"type": {
|
|
70
|
+
"name": "node"
|
|
71
|
+
},
|
|
72
|
+
"required": false,
|
|
73
|
+
"description": ""
|
|
74
|
+
},
|
|
75
|
+
"onClick": {
|
|
76
|
+
"type": {
|
|
77
|
+
"name": "func"
|
|
78
|
+
},
|
|
79
|
+
"required": false,
|
|
80
|
+
"description": ""
|
|
81
|
+
},
|
|
82
|
+
"isDisabled": {
|
|
83
|
+
"type": {
|
|
84
|
+
"name": "bool"
|
|
85
|
+
},
|
|
86
|
+
"required": false,
|
|
87
|
+
"description": ""
|
|
88
|
+
},
|
|
89
|
+
"color": {
|
|
90
|
+
"type": {
|
|
91
|
+
"name": "union",
|
|
92
|
+
"value": [{
|
|
93
|
+
"name": "enum",
|
|
94
|
+
"value": [{
|
|
95
|
+
"value": "\"greys\"",
|
|
96
|
+
"computed": false
|
|
97
|
+
}, {
|
|
98
|
+
"value": "\"fades\"",
|
|
99
|
+
"computed": false
|
|
100
|
+
}, {
|
|
101
|
+
"value": "\"baseColors\"",
|
|
102
|
+
"computed": false
|
|
103
|
+
}, {
|
|
104
|
+
"value": "\"semanticColors\"",
|
|
105
|
+
"computed": false
|
|
106
|
+
}]
|
|
107
|
+
}, {
|
|
108
|
+
"name": "string"
|
|
109
|
+
}]
|
|
110
|
+
},
|
|
111
|
+
"required": false,
|
|
112
|
+
"description": ""
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
};
|
package/es/components/icon.js
CHANGED
|
@@ -45,7 +45,8 @@ var Icon = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
|
45
45
|
var icon = _ref.icon,
|
|
46
46
|
_ref$size = _ref.size,
|
|
47
47
|
size = _ref$size === void 0 ? 'm' : _ref$size,
|
|
48
|
-
color = _ref.color,
|
|
48
|
+
_ref$color = _ref.color,
|
|
49
|
+
color = _ref$color === void 0 ? 'body' : _ref$color,
|
|
49
50
|
hasEvenBoundary = _ref.hasEvenBoundary,
|
|
50
51
|
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
51
52
|
return __jsx(Wrapper, (0, _extends2.default)({
|
|
@@ -102,22 +103,11 @@ Icon.__docgenInfo = {
|
|
|
102
103
|
"required": false,
|
|
103
104
|
"description": ""
|
|
104
105
|
},
|
|
105
|
-
"icon": {
|
|
106
|
-
"type": {
|
|
107
|
-
"name": "node"
|
|
108
|
-
},
|
|
109
|
-
"required": false,
|
|
110
|
-
"description": ""
|
|
111
|
-
},
|
|
112
|
-
"hasEvenBoundary": {
|
|
113
|
-
"type": {
|
|
114
|
-
"name": "custom",
|
|
115
|
-
"raw": "PropTypes.boolean"
|
|
116
|
-
},
|
|
117
|
-
"required": false,
|
|
118
|
-
"description": ""
|
|
119
|
-
},
|
|
120
106
|
"color": {
|
|
107
|
+
"defaultValue": {
|
|
108
|
+
"value": "'body'",
|
|
109
|
+
"computed": false
|
|
110
|
+
},
|
|
121
111
|
"type": {
|
|
122
112
|
"name": "union",
|
|
123
113
|
"value": [{
|
|
@@ -141,6 +131,21 @@ Icon.__docgenInfo = {
|
|
|
141
131
|
},
|
|
142
132
|
"required": false,
|
|
143
133
|
"description": ""
|
|
134
|
+
},
|
|
135
|
+
"icon": {
|
|
136
|
+
"type": {
|
|
137
|
+
"name": "node"
|
|
138
|
+
},
|
|
139
|
+
"required": false,
|
|
140
|
+
"description": ""
|
|
141
|
+
},
|
|
142
|
+
"hasEvenBoundary": {
|
|
143
|
+
"type": {
|
|
144
|
+
"name": "custom",
|
|
145
|
+
"raw": "PropTypes.boolean"
|
|
146
|
+
},
|
|
147
|
+
"required": false,
|
|
148
|
+
"description": ""
|
|
144
149
|
}
|
|
145
150
|
}
|
|
146
151
|
};
|
package/es/components/index.js
CHANGED
|
@@ -41,6 +41,18 @@ Object.defineProperty(exports, "Icon", {
|
|
|
41
41
|
return _icon.Icon;
|
|
42
42
|
}
|
|
43
43
|
});
|
|
44
|
+
Object.defineProperty(exports, "IconButton", {
|
|
45
|
+
enumerable: true,
|
|
46
|
+
get: function get() {
|
|
47
|
+
return _iconButton.IconButton;
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
Object.defineProperty(exports, "TextButton", {
|
|
51
|
+
enumerable: true,
|
|
52
|
+
get: function get() {
|
|
53
|
+
return _textButton.TextButton;
|
|
54
|
+
}
|
|
55
|
+
});
|
|
44
56
|
|
|
45
57
|
var _text = require("./text");
|
|
46
58
|
|
|
@@ -52,4 +64,8 @@ var _textInput = require("./text-input");
|
|
|
52
64
|
|
|
53
65
|
var _arrange = require("./arrange");
|
|
54
66
|
|
|
55
|
-
var _icon = require("./icon");
|
|
67
|
+
var _icon = require("./icon");
|
|
68
|
+
|
|
69
|
+
var _iconButton = require("./icon-button");
|
|
70
|
+
|
|
71
|
+
var _textButton = require("./text-button");
|
|
@@ -0,0 +1,85 @@
|
|
|
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.TextButton = 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 _components = require("../components");
|
|
21
|
+
|
|
22
|
+
var _react = _interopRequireDefault(require("react"));
|
|
23
|
+
|
|
24
|
+
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
25
|
+
|
|
26
|
+
var _react2 = require("@emotion/react");
|
|
27
|
+
|
|
28
|
+
var _excluded = ["children", "isDisabled", "icon"];
|
|
29
|
+
|
|
30
|
+
var _templateObject, _templateObject2;
|
|
31
|
+
|
|
32
|
+
var __jsx = _react.default.createElement;
|
|
33
|
+
var variables = (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n --grn-paddingX-m: 8px;\n --grn-borderColor-hover: var(--grn-color-fade4);\n --grn-borderColor-active: var(--grn-color-grey8);\n"])));
|
|
34
|
+
|
|
35
|
+
var Wrapper = _styled.default.button(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n ", ";\n appearance: none;\n border: 1px solid transparent;\n padding: 0 var(--grn-paddingX-m);\n font-family: inherit;\n font-size: inherit;\n cursor: pointer;\n border-radius: ", ";\n font-weight: ", ";\n transition: ", ";\n height: var(--grn-clearButtonHeight-m);\n background-color: transparent;\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 8px;\n \n &:hover {\n transition: ", ";\n border-color: var(--grn-borderColor-hover);\n }\n \n &:active {\n transition: 0s;\n border-color: var(--grn-borderColor-active);\n }\n \n &:disabled {\n color: ", ";\n cursor: default;\n border-color: transparent;\n }\n"])), variables, (0, _utilities.getRadius)('s'), (0, _utilities.getWeight)('medium'), (0, _utilities.getTransition)('slow'), (0, _utilities.getTransition)('fast'), (0, _utilities.getColor)('disabledContent'));
|
|
36
|
+
|
|
37
|
+
var TextButton = function TextButton(_ref) {
|
|
38
|
+
var children = _ref.children,
|
|
39
|
+
isDisabled = _ref.isDisabled,
|
|
40
|
+
icon = _ref.icon,
|
|
41
|
+
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
42
|
+
return __jsx(Wrapper, (0, _extends2.default)({
|
|
43
|
+
disabled: isDisabled,
|
|
44
|
+
icon: icon
|
|
45
|
+
}, props), icon && __jsx(_components.Icon, {
|
|
46
|
+
icon: icon
|
|
47
|
+
}), children && children);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
exports.TextButton = TextButton;
|
|
51
|
+
TextButton.__docgenInfo = {
|
|
52
|
+
"description": "",
|
|
53
|
+
"methods": [],
|
|
54
|
+
"displayName": "TextButton",
|
|
55
|
+
"props": {
|
|
56
|
+
"children": {
|
|
57
|
+
"type": {
|
|
58
|
+
"name": "node"
|
|
59
|
+
},
|
|
60
|
+
"required": false,
|
|
61
|
+
"description": ""
|
|
62
|
+
},
|
|
63
|
+
"icon": {
|
|
64
|
+
"type": {
|
|
65
|
+
"name": "node"
|
|
66
|
+
},
|
|
67
|
+
"required": false,
|
|
68
|
+
"description": ""
|
|
69
|
+
},
|
|
70
|
+
"onClick": {
|
|
71
|
+
"type": {
|
|
72
|
+
"name": "func"
|
|
73
|
+
},
|
|
74
|
+
"required": false,
|
|
75
|
+
"description": ""
|
|
76
|
+
},
|
|
77
|
+
"isDisabled": {
|
|
78
|
+
"type": {
|
|
79
|
+
"name": "bool"
|
|
80
|
+
},
|
|
81
|
+
"required": false,
|
|
82
|
+
"description": ""
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
};
|