@flodesk/grain 3.0.0 → 3.0.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.
@@ -68,7 +68,7 @@ var Wrapper = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplate
68
68
  var Label = styled.label(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n display: block;\n margin-bottom: ", ";\n"])), function (p) {
69
69
  return sizesStyles[p.size].labelGap;
70
70
  });
71
- var InputField = styled.input(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n ", ";\n appearance: none;\n border: none;\n font-family: inherit;\n background-color: transparent;\n color: inherit;\n font-size: inherit;\n transition-property: border-color;\n border: 1px solid var(--grn-color-fieldBorder);\n width: 100%;\n border-radius: ", ";\n height: ", ";\n padding: ", ";\n ", ";\n outline: none;\n\n &::placeholder {\n color: ", ";\n }\n\n &:hover {\n border-color: var(--grn-color-fieldBorder-hover);\n }\n\n &:focus {\n transition: 0s;\n border-color: var(--grn-color-grey6);\n }\n"])), transitions, function (p) {
71
+ var InputField = styled.input(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n ", ";\n appearance: none;\n border: none;\n font-family: inherit;\n background-color: transparent;\n color: inherit;\n font-size: inherit;\n transition-property: border-color;\n border: 1px solid var(--grn-color-fieldBorder);\n width: 100%;\n border-radius: ", ";\n height: ", ";\n padding: ", ";\n ", ";\n outline: none;\n\n &::placeholder {\n color: ", ";\n }\n\n &:hover {\n border-color: var(--grn-color-fieldBorder-hover);\n }\n\n &:focus {\n transition: 0s;\n border-color: var(--grn-color-grey6);\n }\n"])), transitions, function () {
72
72
  return getRadius('s');
73
73
  }, function (p) {
74
74
  return sizesStyles[p.size].height;
@@ -13,7 +13,6 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
13
  import "core-js/modules/es.array.concat.js";
14
14
  import "core-js/modules/es.array.map.js";
15
15
  import "core-js/modules/es.object.entries.js";
16
- import "core-js/modules/es.array.reverse.js";
17
16
  import "core-js/modules/es.symbol.js";
18
17
  import "core-js/modules/es.symbol.description.js";
19
18
  import "core-js/modules/es.object.to-string.js";
@@ -40,20 +39,23 @@ export var getMediaCss = function getMediaCss(mediaQuery, property, value) {
40
39
  return "\n ".concat(mediaQuery, " {\n ").concat(property, ": ").concat(getValue(value), ";\n }\n ");
41
40
  };
42
41
  export var mapObjToMedia = function mapObjToMedia(property, obj, type) {
43
- var varPrefix = varInfo[type].prefix;
42
+ var checkValueInVars = function checkValueInVars(value) {
43
+ if (type && value in vars[type]) {
44
+ var varPrefix = varInfo[type].prefix;
45
+ return getCssVar(varPrefix, value);
46
+ }
47
+
48
+ return value;
49
+ };
50
+
44
51
  var declarations = Object.entries(obj).map(function (_ref) {
45
52
  var _ref2 = _slicedToArray(_ref, 2),
46
53
  mediaQuery = _ref2[0],
47
54
  value = _ref2[1];
48
55
 
49
- if (value in vars[type]) {
50
- return getMediaCss(mediaQuery, property, getCssVar(varPrefix, value));
51
- }
52
-
53
- return getMediaCss(mediaQuery, property, value);
54
- }); // reverse array to make sure max-widths correctly override
55
-
56
- declarations.reverse().join('');
56
+ return getMediaCss(mediaQuery, property, checkValueInVars(value));
57
+ });
58
+ declarations.join('');
57
59
  return declarations;
58
60
  };
59
61
  export var getDimension = function getDimension(dimension) {
@@ -61,14 +63,14 @@ export var getDimension = function getDimension(dimension) {
61
63
  if (isString(dimension)) return dimension;
62
64
  if (isNumber(dimension)) return u(dimension);
63
65
  };
64
- export var getSpace = function getSpace(value) {
65
- if (value in vars.spaces) {
66
- return getCssVar(varInfo.spaces.prefix, value);
66
+ export var getSpace = function getSpace(space) {
67
+ if (space in vars.spaces) {
68
+ return getCssVar(varInfo.spaces.prefix, space);
67
69
  }
68
70
 
69
- if (value === 0) return value;
70
- if (isString(value)) return value;
71
- if (isNumber(value)) return u(value);
71
+ if (space === 0) return space;
72
+ if (isString(space)) return space;
73
+ if (isNumber(space)) return u(space);
72
74
  };
73
75
  export var getResponsiveDimension = function getResponsiveDimension(property, dimension) {
74
76
  if (!dimension) return;
@@ -105,22 +107,12 @@ export var getResponsiveTextSize = function getResponsiveTextSize(size) {
105
107
 
106
108
  return "".concat(property, ": ").concat(getTextSize(size));
107
109
  };
108
- export var mapColumnsToMedia = function mapColumnsToMedia(property, obj) {
109
- var declarations = Object.entries(obj).map(function (_ref3) {
110
- var _ref4 = _slicedToArray(_ref3, 2),
111
- breakpoint = _ref4[0],
112
- value = _ref4[1];
113
-
114
- return getMediaCss(breakpoint, property, value);
115
- });
116
- return declarations.join('');
117
- };
118
110
  export var getResponsiveGridColumns = function getResponsiveGridColumns(columns) {
119
111
  if (!columns) return;
120
112
  var property = 'grid-template-columns';
121
113
 
122
114
  if (isObject(columns)) {
123
- return mapColumnsToMedia(property, columns);
115
+ return mapObjToMedia(property, columns);
124
116
  }
125
117
 
126
118
  return "".concat(property, ": ").concat(columns);
@@ -16,7 +16,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
16
16
 
17
17
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
18
18
 
19
- import { getCssVar, isNumber, isString, u, isArray } from '.';
19
+ import { getCssVar, isNumber, isString, u } from '.';
20
20
  import { vars, varInfo } from '../variables';
21
21
  import { getDimension } from './responsive';
22
22
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flodesk/grain",
3
- "version": "3.0.0",
3
+ "version": "3.0.3",
4
4
  "description": "Flodesk design system",
5
5
  "module": "es/index.js",
6
6
  "author": "Flodesk",
@@ -10,7 +10,7 @@
10
10
  "dev": "next dev -p 4000",
11
11
  "build": "next build",
12
12
  "start": "next start",
13
- "lint": "next lint --dir .",
13
+ "lint": "eslint --ext .js --ext .ts --ext .jsx --ext .mdx .",
14
14
  "semantic-release": "semantic-release",
15
15
  "build:es": "del es/* && cross-env NODE_ENV=production babel --no-babelrc --config-file ./babel.config.es.js --out-dir es --copy-files src"
16
16
  },
@@ -47,6 +47,7 @@
47
47
  "eslint-config-next": "12.1.6",
48
48
  "eslint-config-prettier": "^8.5.0",
49
49
  "eslint-plugin-import": "^2.26.0",
50
+ "eslint-plugin-mdx": "^2.0.2",
50
51
  "eslint-plugin-prettier": "^4.2.1",
51
52
  "next": "12.1.6",
52
53
  "prettier": "^2.7.1",