@flodesk/grain 2.7.2 → 2.7.3

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.
@@ -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", "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"];
7
+ 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"];
8
8
 
9
9
  var _templateObject;
10
10
 
@@ -20,6 +20,7 @@ import { getBorder, getColor, getRadius, getSpace, getShadow } from '../../utili
20
20
  import React from "react";
21
21
  import styled from "@emotion/styled";
22
22
  import { types } from '../../types';
23
+ import { PropTypes } from 'prop-types';
23
24
 
24
25
  var getSpaceCss = function getSpaceCss(propertyName, propertyValue) {
25
26
  if (propertyValue || propertyValue === 0) {
@@ -27,8 +28,10 @@ var getSpaceCss = function getSpaceCss(propertyName, propertyValue) {
27
28
  }
28
29
  };
29
30
 
30
- 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 color: ", ";\n background-color: ", ";\n width: ", ";\n height: ", ";\n border-radius: ", ";\n box-shadow: ", ";\n"])), function (p) {
31
+ 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 position: ", ";\n color: ", ";\n background-color: ", ";\n width: ", ";\n height: ", ";\n border-radius: ", ";\n box-shadow: ", ";\n overflow: ", ";\n aspect-ratio: ", ";\n"])), function (p) {
31
32
  return getBorder(p.borderSide, p.borderWidth, p.borderColor);
33
+ }, function (p) {
34
+ return getSpaceCss('padding', p.padding);
32
35
  }, function (p) {
33
36
  return getSpaceCss('padding-top', p.paddingTop);
34
37
  }, function (p) {
@@ -37,6 +40,8 @@ var Wrapper = styled.div(_templateObject || (_templateObject = _taggedTemplateLi
37
40
  return getSpaceCss('padding-left', p.paddingLeft);
38
41
  }, function (p) {
39
42
  return getSpaceCss('padding-right', p.paddingRight);
43
+ }, function (p) {
44
+ return getSpaceCss('margin', p.margin);
40
45
  }, function (p) {
41
46
  return getSpaceCss('margin-top', p.marginTop);
42
47
  }, function (p) {
@@ -54,7 +59,7 @@ var Wrapper = styled.div(_templateObject || (_templateObject = _taggedTemplateLi
54
59
  }, function (p) {
55
60
  return getSpaceCss('right', p.right);
56
61
  }, function (p) {
57
- return p.position && "position: ".concat(p.position);
62
+ return p.position;
58
63
  }, function (p) {
59
64
  return getColor(p.color);
60
65
  }, function (p) {
@@ -67,6 +72,10 @@ var Wrapper = styled.div(_templateObject || (_templateObject = _taggedTemplateLi
67
72
  return getRadius(p.radius);
68
73
  }, function (p) {
69
74
  return getShadow(p.shadow);
75
+ }, function (p) {
76
+ return p.overflow;
77
+ }, function (p) {
78
+ return p.aspectRatio;
70
79
  });
71
80
  export var Box = function Box(_ref) {
72
81
  var children = _ref.children,
@@ -98,6 +107,8 @@ export var Box = function Box(_ref) {
98
107
  left = _ref.left,
99
108
  right = _ref.right,
100
109
  shadow = _ref.shadow,
110
+ overflow = _ref.overflow,
111
+ aspectRatio = _ref.aspectRatio,
101
112
  props = _objectWithoutProperties(_ref, _excluded);
102
113
 
103
114
  return /*#__PURE__*/React.createElement(Wrapper, Object.assign({
@@ -109,20 +120,24 @@ export var Box = function Box(_ref) {
109
120
  width: width,
110
121
  height: height,
111
122
  radius: radius,
112
- paddingTop: padding || paddingY || paddingTop,
113
- paddingBottom: padding || paddingY || paddingBottom,
114
- paddingLeft: padding || paddingX || paddingLeft,
115
- paddingRight: padding || paddingX || paddingRight,
116
- marginTop: margin || marginY || marginTop,
117
- marginBottom: margin || marginY || marginBottom,
118
- marginLeft: margin || marginX || marginLeft,
119
- marginRight: margin || marginX || marginRight,
123
+ padding: padding,
124
+ paddingTop: paddingY || paddingTop,
125
+ paddingBottom: paddingY || paddingBottom,
126
+ paddingLeft: paddingX || paddingLeft,
127
+ paddingRight: paddingX || paddingRight,
128
+ margin: margin,
129
+ marginTop: marginY || marginTop,
130
+ marginBottom: marginY || marginBottom,
131
+ marginLeft: marginX || marginLeft,
132
+ marginRight: marginX || marginRight,
120
133
  position: position,
121
134
  top: top,
122
135
  bottom: bottom,
123
136
  left: left,
124
137
  right: right,
125
- shadow: shadow
138
+ shadow: shadow,
139
+ overflow: overflow,
140
+ aspectRatio: aspectRatio
126
141
  }, props), children);
127
142
  };
128
143
  Box.propTypes = {
@@ -149,5 +164,7 @@ Box.propTypes = {
149
164
  top: types.space,
150
165
  bottom: types.space,
151
166
  left: types.space,
152
- right: types.space
167
+ right: types.space,
168
+ overflow: types.overflow,
169
+ aspectRatio: PropTypes.string
153
170
  };
@@ -16,13 +16,11 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
16
16
 
17
17
  function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
18
18
 
19
- import { getColor, getRadius, getSpace, getTextSize, getWeight } from '../../utilities';
20
- import { PropTypes } from 'prop-types';
19
+ import { getColor, getRadius, getTextSize, getWeight } from '../../utilities';
21
20
  import React from "react";
22
21
  import styled from "@emotion/styled";
23
- import { types } from '../../types';
24
- var Wrapper = styled.button(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n appearance: none;\n border: none;\n font-family: inherit;\n font-size: ", ";\n font-weight: ", ";\n cursor: pointer;\n background-color: ", ";\n color: ", ";\n border-radius: 0.34em;\n height: var(--grn-textBoxHeight);\n padding: 0 var(--grn-buttonTextBoxPaddingX);\n"])), getTextSize('m'), getWeight('medium'), getColor('body'), getColor('white'));
25
- var ButtonText = styled.span(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: relative;\n top: -0.3px;\n"])));
22
+ var Wrapper = styled.button(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n appearance: none;\n border: none;\n font-family: inherit;\n font-size: ", ";\n font-weight: ", ";\n cursor: pointer;\n background-color: ", ";\n color: ", ";\n border-radius: ", ";\n height: var(--grn-textBoxHeight-m);\n padding: 0 var(--grn-buttonTextBoxPaddingX-m);\n"])), getTextSize('m'), getWeight('medium'), getColor('body'), getColor('white'), getRadius('m'));
23
+ var ButtonText = styled.span(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n --opticalCompensation: -0.3px;\n\n position: relative;\n top: var(--opticalCompensation);\n"])));
26
24
  export var Button = function Button(_ref) {
27
25
  var children = _ref.children,
28
26
  _ref$size = _ref.size,
@@ -1,9 +1,9 @@
1
1
  :root {
2
2
  --grn-textBoxHeight-s: calc(var(--grn-unit) * 3.5);
3
3
  --grn-textBoxHeight-m: calc(var(--grn-unit) * 5);
4
-
5
- --grn-buttonTextBoxPaddingX: calc(var(--grn-textBoxHeight) / 2);
6
-
4
+
7
5
  --grn-fieldTextBoxPaddingX-s: calc(var(--grn-unit) * 1);
8
6
  --grn-fieldTextBoxPaddingX-m: calc(var(--grn-unit) * 1.5);
7
+
8
+ --grn-buttonTextBoxPaddingX-m: calc(var(--grn-unit) * 2.5);
9
9
  }
@@ -41,13 +41,13 @@
41
41
  --grn-color-grey4: hsl(0 0% 63%);
42
42
  --grn-color-grey3: hsl(0 0% 78%);
43
43
  --grn-color-grey2: hsl(0 0% 87%);
44
- --grn-color-grey1: hsl(0 0% 96%);
44
+ --grn-color-grey1: hsl(0 0% 98%);
45
45
 
46
46
  --grn-color-blue: hsl(218 74% 54%);
47
47
  --grn-color-red: hsl(6 66% 65%);
48
48
 
49
49
  --grn-color-body: var(--grn-color-grey8);
50
- --grn-color-bodyDimmed: hsl(var(--grn-color-grey8-HSL) / 60%);
50
+ --grn-color-bodyDimmed: hsl(var(--grn-color-grey8-HSL) / 50%);
51
51
  --grn-color-accent: var(--grn-color-grey8);
52
52
  --grn-color-backgroundSecondary: hsl(0 0% 100%);
53
53
  --grn-color-background: var(--grn-color-grey1);
@@ -58,23 +58,22 @@
58
58
  }
59
59
 
60
60
  :root {
61
- --c: hsl(var(--grn-color-grey8-HSL) / 4%);
62
-
63
61
  --grn-shadow-s:
64
- 0 0px 1px hsl(0 0% 0% / 6%),
65
- 0 1px 2px hsl(0 0% 0% / 5%),
66
- 0 2px 4px hsl(0 0% 0% / 3%),
67
- 0 4px 8px hsl(0 0% 0% / 3%)
62
+ 0 0px 2px hsl(0 0% 0% / 6%),
63
+ 0 1px 4px hsl(0 0% 0% / 3%),
64
+ 0 2px 8px hsl(0 0% 0% / 2%),
65
+ 0 4px 16px hsl(0 0% 0% / 2%)
68
66
  ;
69
67
 
70
68
  --grn-shadow-m:
71
- var(--grn-shadow-s),
72
- 0 8px 16px hsl(0 0% 0% / 3%)
69
+ var(--grn-shadow-s),
70
+ 0 8px 32px hsl(0 0% 0% / 4%)
73
71
  ;
74
72
 
75
73
  --grn-shadow-l:
76
74
  var(--grn-shadow-m),
77
- 0 16px 64px hsl(0 0% 0% / 2%),
78
- 0 32px 128px hsl(0 0% 0% / 2%)
75
+ 0 16px 64px hsl(0 0% 0% / 4%),
76
+ 0 32px 128px hsl(0 0% 0% / 5%),
77
+ 0 64px 128px -32px hsl(0 0% 0% / 5%)
79
78
  ;
80
79
  }
package/es/types/index.js CHANGED
@@ -5,9 +5,10 @@ export var types = {
5
5
  color: PropTypes.oneOfType([PropTypes.oneOf(Object.keys(vars.colors)), PropTypes.string]),
6
6
  space: PropTypes.oneOfType([PropTypes.oneOf(Object.keys(vars.spaces)), PropTypes.number, PropTypes.string]),
7
7
  side: PropTypes.oneOf(["all", "left", "right", "top", "bottom", "x", "y"]),
8
- radius: PropTypes.oneOf(["s", "m", "l"]),
8
+ radius: PropTypes.oneOfType([PropTypes.oneOf(["s", "m", "l"]), PropTypes.string]),
9
9
  position: PropTypes.oneOf(["static", "relative", "fixed", "absolute", "sticky"]),
10
10
  textSize: PropTypes.oneOfType([PropTypes.oneOf(Object.keys(vars.textSizes)), PropTypes.number, PropTypes.string]),
11
11
  weight: PropTypes.oneOf(Object.keys(vars.weights)),
12
- textAlign: PropTypes.oneOf(["left", "center", "right"])
12
+ textAlign: PropTypes.oneOf(["left", "center", "right"]),
13
+ overflow: PropTypes.oneOf(["visible", "hidden", "scroll", "auto"])
13
14
  };
@@ -57,6 +57,10 @@ export var getRadius = function getRadius(radius) {
57
57
  if (radius in vars.radiuses) {
58
58
  return getCssVar("radius", radius);
59
59
  }
60
+
61
+ if (typeof radius === "string") {
62
+ return radius;
63
+ }
60
64
  };
61
65
  export var getSpace = function getSpace(space) {
62
66
  if (isNaN(space)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flodesk/grain",
3
- "version": "2.7.2",
3
+ "version": "2.7.3",
4
4
  "description": "Flodesk design system",
5
5
  "module": "es/index.js",
6
6
  "author": "Flodesk",