@flodesk/grain 2.22.1 → 3.0.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 +3 -3
- package/es/components/text-input.js +1 -1
- package/es/types.js +1 -1
- package/es/utilities/index.js +1 -1
- package/es/utilities/responsive.js +20 -0
- package/es/utilities/styles.js +2 -13
- package/package.json +3 -2
package/es/components/arrange.js
CHANGED
|
@@ -16,16 +16,16 @@ 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 {
|
|
19
|
+
import { getResponsiveDimension, getResponsiveGridColumns, getResponsiveSpace } from '../utilities';
|
|
20
20
|
import React from 'react';
|
|
21
21
|
import styled from '@emotion/styled';
|
|
22
22
|
import { types } from '../types';
|
|
23
|
-
var Wrapper = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: grid;\n ", ";\n ", ";\n
|
|
23
|
+
var Wrapper = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: grid;\n ", ";\n ", ";\n ", ";\n justify-items: ", ";\n align-items: ", ";\n justify-content: ", ";\n align-content: ", ";\n ", ";\n ", ";\n"])), function (p) {
|
|
24
24
|
return !p.columns && "grid-auto-flow: ".concat(p.autoFlow);
|
|
25
25
|
}, function (p) {
|
|
26
26
|
return getResponsiveSpace('gap', p.gap);
|
|
27
27
|
}, function (p) {
|
|
28
|
-
return
|
|
28
|
+
return getResponsiveGridColumns(p.columns);
|
|
29
29
|
}, function (p) {
|
|
30
30
|
return p.justifyItems;
|
|
31
31
|
}, function (p) {
|
|
@@ -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 (
|
|
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;
|
package/es/types.js
CHANGED
|
@@ -18,7 +18,7 @@ export var types = {
|
|
|
18
18
|
textAlign: PropTypes.oneOf(['left', 'center', 'right']),
|
|
19
19
|
overflow: PropTypes.oneOf(['visible', 'hidden', 'scroll', 'auto']),
|
|
20
20
|
fieldSize: PropTypes.oneOf(['s', 'm']),
|
|
21
|
-
columns: PropTypes.oneOfType([PropTypes.
|
|
21
|
+
columns: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
|
|
22
22
|
autoFlow: PropTypes.oneOf(autoFlows),
|
|
23
23
|
gridItemsAlignment: PropTypes.oneOf(gridItemsAlignments),
|
|
24
24
|
gridContentPosition: PropTypes.oneOf(gridContentPositions),
|
package/es/utilities/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { getDimension } from './responsive';
|
|
2
2
|
export { getResponsiveDimension } from './responsive';
|
|
3
|
+
export { getResponsiveGridColumns } from './responsive';
|
|
3
4
|
export { getColor } from './styles';
|
|
4
5
|
export { getShadow } from './styles';
|
|
5
6
|
export { getTextSize } from './responsive';
|
|
@@ -9,7 +10,6 @@ export { getRadius } from './styles';
|
|
|
9
10
|
export { getTransition } from './styles';
|
|
10
11
|
export { getResponsiveSpace } from './responsive';
|
|
11
12
|
export { getIconSize } from './styles';
|
|
12
|
-
export { getGridColumns } from './styles';
|
|
13
13
|
export { getBorder } from './styles';
|
|
14
14
|
export { isBrowser } from './helpers';
|
|
15
15
|
export { getCssVarCore } from './helpers';
|
|
@@ -104,4 +104,24 @@ export var getResponsiveTextSize = function getResponsiveTextSize(size) {
|
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
return "".concat(property, ": ").concat(getTextSize(size));
|
|
107
|
+
};
|
|
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
|
+
export var getResponsiveGridColumns = function getResponsiveGridColumns(columns) {
|
|
119
|
+
if (!columns) return;
|
|
120
|
+
var property = 'grid-template-columns';
|
|
121
|
+
|
|
122
|
+
if (isObject(columns)) {
|
|
123
|
+
return mapColumnsToMedia(property, columns);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
return "".concat(property, ": ").concat(columns);
|
|
107
127
|
};
|
package/es/utilities/styles.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "core-js/modules/es.array.map.js";
|
|
2
1
|
import "core-js/modules/es.array.concat.js";
|
|
2
|
+
import "core-js/modules/es.array.map.js";
|
|
3
3
|
import "core-js/modules/es.object.define-property.js";
|
|
4
4
|
import "core-js/modules/es.object.keys.js";
|
|
5
5
|
import "core-js/modules/es.symbol.js";
|
|
@@ -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
|
|
19
|
+
import { getCssVar, isNumber, isString, u } from '.';
|
|
20
20
|
import { vars, varInfo } from '../variables';
|
|
21
21
|
import { getDimension } from './responsive';
|
|
22
22
|
|
|
@@ -62,17 +62,6 @@ export var getIconSize = function getIconSize(size) {
|
|
|
62
62
|
|
|
63
63
|
return getDimension(size);
|
|
64
64
|
};
|
|
65
|
-
export var getGridColumns = function getGridColumns(columns) {
|
|
66
|
-
if (columns) {
|
|
67
|
-
if (isArray(columns)) {
|
|
68
|
-
return columns.map(function (column) {
|
|
69
|
-
return getDimension(column);
|
|
70
|
-
}).join(' ');
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
if (isString(columns)) return columns;
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
65
|
export var getBorder = function getBorder(borderSide, borderWidth, borderColor) {
|
|
77
66
|
var borderSides = {
|
|
78
67
|
all: ["top", "right", "bottom", "left"],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flodesk/grain",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.2",
|
|
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": "
|
|
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",
|