@flodesk/grain 5.3.2 → 5.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/components/arrange.js +4 -4
- package/es/components/box.js +33 -28
- package/es/components/button.js +15 -5
- package/es/components/stack.js +1 -1
- package/es/components/text.js +1 -1
- package/es/styles/variables.css +5 -5
- package/es/types.js +7 -5
- package/package.json +1 -1
package/es/components/arrange.js
CHANGED
|
@@ -68,13 +68,13 @@ export var Arrange = function Arrange(_ref) {
|
|
|
68
68
|
}, props), children);
|
|
69
69
|
};
|
|
70
70
|
Arrange.propTypes = {
|
|
71
|
-
gap: types.
|
|
72
|
-
columns: types.
|
|
71
|
+
gap: types.responsiveSpace,
|
|
72
|
+
columns: types.responsiveColumns,
|
|
73
73
|
autoFlow: types.autoFlow,
|
|
74
74
|
alignItems: types.gridItemsAlignment,
|
|
75
75
|
justifyItems: types.gridItemsAlignment,
|
|
76
76
|
justifyContent: types.gridContentPosition,
|
|
77
77
|
alignContent: types.gridContentPosition,
|
|
78
|
-
width: types.
|
|
79
|
-
height: types.
|
|
78
|
+
width: types.responsiveDimension,
|
|
79
|
+
height: types.responsiveDimension
|
|
80
80
|
};
|
package/es/components/box.js
CHANGED
|
@@ -4,7 +4,7 @@ import "core-js/modules/es.object.define-properties.js";
|
|
|
4
4
|
import "core-js/modules/es.object.keys.js";
|
|
5
5
|
import "core-js/modules/es.array.index-of.js";
|
|
6
6
|
import "core-js/modules/es.symbol.js";
|
|
7
|
-
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"];
|
|
7
|
+
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", "zIndex"];
|
|
8
8
|
|
|
9
9
|
var _templateObject;
|
|
10
10
|
|
|
@@ -21,7 +21,7 @@ import React from 'react';
|
|
|
21
21
|
import styled from '@emotion/styled';
|
|
22
22
|
import { types } from '../types';
|
|
23
23
|
import PropTypes from 'prop-types';
|
|
24
|
-
var Wrapper = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\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) {
|
|
24
|
+
var Wrapper = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\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 ", ";\n"])), function (p) {
|
|
25
25
|
return getBorder(p.borderSide, p.borderWidth, p.borderColor);
|
|
26
26
|
}, function (p) {
|
|
27
27
|
return getResponsiveSpace('padding', p.padding);
|
|
@@ -77,6 +77,8 @@ var Wrapper = styled.div(_templateObject || (_templateObject = _taggedTemplateLi
|
|
|
77
77
|
return p.overflow;
|
|
78
78
|
}, function (p) {
|
|
79
79
|
return p.aspectRatio;
|
|
80
|
+
}, function (p) {
|
|
81
|
+
return p.zIndex && "z-index: ".concat(p.zIndex);
|
|
80
82
|
});
|
|
81
83
|
export var Box = function Box(_ref) {
|
|
82
84
|
var children = _ref.children,
|
|
@@ -116,6 +118,7 @@ export var Box = function Box(_ref) {
|
|
|
116
118
|
shadow = _ref.shadow,
|
|
117
119
|
overflow = _ref.overflow,
|
|
118
120
|
aspectRatio = _ref.aspectRatio,
|
|
121
|
+
zIndex = _ref.zIndex,
|
|
119
122
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
120
123
|
|
|
121
124
|
return /*#__PURE__*/React.createElement(Wrapper, Object.assign({
|
|
@@ -148,7 +151,8 @@ export var Box = function Box(_ref) {
|
|
|
148
151
|
right: right,
|
|
149
152
|
shadow: shadow,
|
|
150
153
|
overflow: overflow,
|
|
151
|
-
aspectRatio: aspectRatio
|
|
154
|
+
aspectRatio: aspectRatio,
|
|
155
|
+
zIndex: zIndex
|
|
152
156
|
}, props), children);
|
|
153
157
|
};
|
|
154
158
|
Box.propTypes = {
|
|
@@ -157,33 +161,34 @@ Box.propTypes = {
|
|
|
157
161
|
borderSide: types.side,
|
|
158
162
|
borderWidth: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
159
163
|
borderColor: types.color,
|
|
160
|
-
width: types.
|
|
161
|
-
minWidth: types.
|
|
162
|
-
maxWidth: types.
|
|
163
|
-
height: types.
|
|
164
|
-
minHeight: types.
|
|
165
|
-
maxHeight: types.
|
|
164
|
+
width: types.responsiveDimension,
|
|
165
|
+
minWidth: types.responsiveDimension,
|
|
166
|
+
maxWidth: types.responsiveDimension,
|
|
167
|
+
height: types.responsiveDimension,
|
|
168
|
+
minHeight: types.responsiveDimension,
|
|
169
|
+
maxHeight: types.responsiveDimension,
|
|
166
170
|
radius: types.radius,
|
|
167
171
|
shadow: types.shadow,
|
|
168
|
-
padding: types.
|
|
169
|
-
paddingTop: types.
|
|
170
|
-
paddingBottom: types.
|
|
171
|
-
paddingLeft: types.
|
|
172
|
-
paddingRight: types.
|
|
173
|
-
paddingX: types.
|
|
174
|
-
paddingY: types.
|
|
175
|
-
margin: types.
|
|
176
|
-
marginTop: types.
|
|
177
|
-
marginBottom: types.
|
|
178
|
-
marginLeft: types.
|
|
179
|
-
marginRight: types.
|
|
180
|
-
marginX: types.
|
|
181
|
-
marginY: types.
|
|
172
|
+
padding: types.responsiveSpace,
|
|
173
|
+
paddingTop: types.responsiveSpace,
|
|
174
|
+
paddingBottom: types.responsiveSpace,
|
|
175
|
+
paddingLeft: types.responsiveSpace,
|
|
176
|
+
paddingRight: types.responsiveSpace,
|
|
177
|
+
paddingX: types.responsiveSpace,
|
|
178
|
+
paddingY: types.responsiveSpace,
|
|
179
|
+
margin: types.responsiveSpace,
|
|
180
|
+
marginTop: types.responsiveSpace,
|
|
181
|
+
marginBottom: types.responsiveSpace,
|
|
182
|
+
marginLeft: types.responsiveSpace,
|
|
183
|
+
marginRight: types.responsiveSpace,
|
|
184
|
+
marginX: types.responsiveSpace,
|
|
185
|
+
marginY: types.responsiveSpace,
|
|
182
186
|
position: types.position,
|
|
183
|
-
top: types.
|
|
184
|
-
bottom: types.
|
|
185
|
-
left: types.
|
|
186
|
-
right: types.
|
|
187
|
+
top: types.responsiveSpace,
|
|
188
|
+
bottom: types.responsiveSpace,
|
|
189
|
+
left: types.responsiveSpace,
|
|
190
|
+
right: types.responsiveSpace,
|
|
187
191
|
overflow: types.overflow,
|
|
188
|
-
aspectRatio: PropTypes.string
|
|
192
|
+
aspectRatio: PropTypes.string,
|
|
193
|
+
zIndex: types.zIndex
|
|
189
194
|
};
|
package/es/components/button.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import "core-js/modules/es.array.slice.js";
|
|
2
2
|
import "core-js/modules/es.object.freeze.js";
|
|
3
3
|
import "core-js/modules/es.object.define-properties.js";
|
|
4
|
+
import "core-js/modules/es.object.keys.js";
|
|
4
5
|
import "core-js/modules/es.array.index-of.js";
|
|
5
6
|
import "core-js/modules/es.symbol.js";
|
|
6
7
|
var _excluded = ["children", "variant", "isDisabled", "icon", "hasFullWidth", "hasSpinner"];
|
|
@@ -8,7 +9,6 @@ var _excluded = ["children", "variant", "isDisabled", "icon", "hasFullWidth", "h
|
|
|
8
9
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
9
10
|
|
|
10
11
|
import "core-js/modules/es.object.assign.js";
|
|
11
|
-
import "core-js/modules/es.object.keys.js";
|
|
12
12
|
|
|
13
13
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
14
14
|
|
|
@@ -24,16 +24,25 @@ import PropTypes from 'prop-types';
|
|
|
24
24
|
import { css } from '@emotion/react';
|
|
25
25
|
import { transitions } from '../foundational';
|
|
26
26
|
import { Spinner } from './spinner';
|
|
27
|
-
var
|
|
27
|
+
var accentCss = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n color: white;\n background-color: ", ";\n border-color: transparent;\n\n &:hover {\n background-color: ", ";\n }\n &:active {\n background-color: ", ";\n }\n"])), getColor('accent'), getColor('grey7'), getColor('grey6'));
|
|
28
|
+
var variables = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\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"])));
|
|
28
29
|
var variants = {
|
|
29
|
-
neutral: css(
|
|
30
|
-
primary:
|
|
30
|
+
neutral: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\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 "]))),
|
|
31
|
+
primary: accentCss,
|
|
32
|
+
accent: accentCss
|
|
31
33
|
};
|
|
32
34
|
var Wrapper = styled.button(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n ", ";\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 height: var(--grn-textBoxHeight-m);\n padding: 0 var(--grn-paddingX-m);\n background-color: transparent;\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 12px;\n\n ", ";\n ", ";\n\n &:disabled {\n color: ", ";\n background-color: ", ";\n border-color: transparent;\n cursor: default;\n }\n"])), variables, transitions, getWeight('medium'), getRadius('s'), function (p) {
|
|
33
35
|
return !p.isDisabled && variants[p.variant];
|
|
34
36
|
}, function (p) {
|
|
35
37
|
return p.hasFullWidth && "width: 100%";
|
|
36
38
|
}, getColor('disabledContent'), getColor('disabledBackground'));
|
|
39
|
+
|
|
40
|
+
var checkDeprecatedVariant = function checkDeprecatedVariant(variant) {
|
|
41
|
+
if (variant === 'primary') {
|
|
42
|
+
console.warn('Grain: The variant `primary` name has changed, use `accent` instead.');
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
37
46
|
export var Button = function Button(_ref) {
|
|
38
47
|
var children = _ref.children,
|
|
39
48
|
_ref$variant = _ref.variant,
|
|
@@ -44,6 +53,7 @@ export var Button = function Button(_ref) {
|
|
|
44
53
|
hasSpinner = _ref.hasSpinner,
|
|
45
54
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
46
55
|
|
|
56
|
+
checkDeprecatedVariant(variant);
|
|
47
57
|
return /*#__PURE__*/React.createElement(Wrapper, Object.assign({
|
|
48
58
|
variant: variant,
|
|
49
59
|
disabled: isDisabled,
|
|
@@ -60,7 +70,7 @@ export var Button = function Button(_ref) {
|
|
|
60
70
|
Button.propTypes = {
|
|
61
71
|
children: PropTypes.node,
|
|
62
72
|
icon: PropTypes.node,
|
|
63
|
-
variant: PropTypes.oneOf(
|
|
73
|
+
variant: PropTypes.oneOf(['neutral', 'accent']),
|
|
64
74
|
onClick: PropTypes.func,
|
|
65
75
|
isDisabled: PropTypes.bool,
|
|
66
76
|
hasFullWidth: PropTypes.bool,
|
package/es/components/stack.js
CHANGED
package/es/components/text.js
CHANGED
package/es/styles/variables.css
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
:root {
|
|
6
6
|
--grn-text-s: 12px;
|
|
7
7
|
--grn-text-m: 14px;
|
|
8
|
-
--grn-text-l:
|
|
8
|
+
--grn-text-l: 18px;
|
|
9
9
|
--grn-text-xl: 24px;
|
|
10
10
|
--grn-text-xxl: 30px;
|
|
11
11
|
}
|
|
@@ -96,16 +96,16 @@
|
|
|
96
96
|
0 2px 8px hsl(0 0% 0% / 2%),
|
|
97
97
|
0 4px 16px hsl(0 0% 0% / 2%)
|
|
98
98
|
;
|
|
99
|
-
|
|
99
|
+
|
|
100
100
|
--grn-shadow-m:
|
|
101
|
-
var(--grn-shadow-s),
|
|
101
|
+
var(--grn-shadow-s),
|
|
102
102
|
0 8px 32px hsl(0 0% 0% / 4%)
|
|
103
103
|
;
|
|
104
|
-
|
|
104
|
+
|
|
105
105
|
--grn-shadow-l:
|
|
106
106
|
var(--grn-shadow-m),
|
|
107
107
|
0 16px 64px hsl(0 0% 0% / 4%),
|
|
108
108
|
0 32px 128px hsl(0 0% 0% / 5%),
|
|
109
109
|
0 64px 128px -32px hsl(0 0% 0% / 5%)
|
|
110
110
|
;
|
|
111
|
-
}
|
|
111
|
+
}
|
package/es/types.js
CHANGED
|
@@ -6,22 +6,24 @@ export var gridItemsAlignments = ['start', 'end', 'center', 'stretch'];
|
|
|
6
6
|
export var autoFlows = ['column', 'row'];
|
|
7
7
|
export var types = {
|
|
8
8
|
color: PropTypes.oneOfType([PropTypes.oneOf(Object.keys(vars.colors)), PropTypes.string]),
|
|
9
|
-
|
|
10
|
-
dimension: PropTypes.oneOfType([PropTypes.number, PropTypes.string
|
|
9
|
+
responsiveSpace: PropTypes.oneOfType([PropTypes.oneOf(Object.keys(vars.spaces)), PropTypes.number, PropTypes.string, PropTypes.object]),
|
|
10
|
+
dimension: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
11
|
+
responsiveDimension: PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.object]),
|
|
11
12
|
side: PropTypes.oneOf(['all', 'left', 'right', 'top', 'bottom', 'x', 'y']),
|
|
12
13
|
radius: PropTypes.oneOfType([PropTypes.oneOf(Object.keys(vars.radii)), PropTypes.string, PropTypes.number]),
|
|
13
14
|
shadow: PropTypes.oneOfType([PropTypes.oneOf(Object.keys(vars.shadows)), PropTypes.string]),
|
|
14
15
|
position: PropTypes.oneOf(['static', 'relative', 'fixed', 'absolute', 'sticky']),
|
|
15
|
-
|
|
16
|
+
responsiveTextSize: PropTypes.oneOfType([PropTypes.oneOf(Object.keys(vars.texts)), PropTypes.string, PropTypes.object]),
|
|
16
17
|
iconSize: PropTypes.oneOfType([PropTypes.oneOf(Object.keys(vars.icons)), PropTypes.number, PropTypes.string]),
|
|
17
18
|
weight: PropTypes.oneOf(Object.keys(vars.weights)),
|
|
18
19
|
textAlign: PropTypes.oneOf(['left', 'center', 'right']),
|
|
19
20
|
overflow: PropTypes.oneOf(['visible', 'hidden', 'scroll', 'auto']),
|
|
20
21
|
fieldSize: PropTypes.oneOf(['s', 'm']),
|
|
21
22
|
textTag: PropTypes.oneOf(['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p', 'span']),
|
|
22
|
-
|
|
23
|
+
responsiveColumns: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
|
|
23
24
|
autoFlow: PropTypes.oneOf(autoFlows),
|
|
24
25
|
gridItemsAlignment: PropTypes.oneOf(gridItemsAlignments),
|
|
25
26
|
gridContentPosition: PropTypes.oneOf(gridContentPositions),
|
|
26
|
-
icon: PropTypes.node
|
|
27
|
+
icon: PropTypes.node,
|
|
28
|
+
zIndex: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
|
27
29
|
};
|