@flodesk/grain 1.2.3 → 1.4.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/base-styles.css +13 -6
- package/es/components/text/index.js +12 -8
- package/es/utilities/index.js +15 -2
- package/es/variables/index.js +42 -0
- package/package.json +3 -2
package/es/base-styles.css
CHANGED
|
@@ -3,13 +3,11 @@
|
|
|
3
3
|
}
|
|
4
4
|
|
|
5
5
|
:root {
|
|
6
|
-
--textIncrement: calc(0.2vw + 2px);
|
|
7
|
-
|
|
8
6
|
--grn-text-s: calc(var(--grn-unit) * 1.625);
|
|
9
7
|
--grn-text-m: calc(var(--grn-unit) * 1.875);
|
|
10
|
-
--grn-text-l: calc(var(--grn-
|
|
11
|
-
--grn-text-xl: calc(var(--grn-
|
|
12
|
-
--grn-text-xxl: calc(var(--grn-
|
|
8
|
+
--grn-text-l: calc(var(--grn-unit) * 2.5);
|
|
9
|
+
--grn-text-xl: calc(var(--grn-unit) * 3.125);
|
|
10
|
+
--grn-text-xxl: calc(var(--grn-unit) * 3.75);
|
|
13
11
|
}
|
|
14
12
|
|
|
15
13
|
:root {
|
|
@@ -29,8 +27,17 @@
|
|
|
29
27
|
|
|
30
28
|
:root {
|
|
31
29
|
--grn-color-body: hsl(0 0% 7%);
|
|
32
|
-
--grn-color-bodyDimmed: hsl(0 0% 7% /
|
|
30
|
+
--grn-color-bodyDimmed: hsl(0 0% 7% / 50%);
|
|
33
31
|
--grn-color-primary: hsl(0 0% 7%);
|
|
32
|
+
|
|
33
|
+
--grn-color-grey8: hsl(0 0% 7%);
|
|
34
|
+
--grn-color-grey7: hsl(0 0% 20%);
|
|
35
|
+
--grn-color-grey6: hsl(0 0% 32%);
|
|
36
|
+
--grn-color-grey5: hsl(0 0% 44%);
|
|
37
|
+
--grn-color-grey4: hsl(0 0% 63%);
|
|
38
|
+
--grn-color-grey3: hsl(0 0% 78%);
|
|
39
|
+
--grn-color-grey2: hsl(0 0% 87%);
|
|
40
|
+
--grn-color-grey1: hsl(0 0% 96%);
|
|
34
41
|
}
|
|
35
42
|
|
|
36
43
|
* {
|
|
@@ -6,29 +6,33 @@ var _templateObject;
|
|
|
6
6
|
|
|
7
7
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
8
8
|
|
|
9
|
+
import { getColor, getTextSize, getWeight } from '../../utilities';
|
|
10
|
+
import { textSizes, weights } from '../../variables';
|
|
9
11
|
import PropTypes from 'prop-types';
|
|
10
12
|
import React from "react";
|
|
11
|
-
import { getTextSize } from '../../utilities';
|
|
12
13
|
import styled from "@emotion/styled";
|
|
13
|
-
|
|
14
|
-
export var weights = ['normal', 'medium', 'semiBold'];
|
|
15
|
-
var Wrapper = styled.span(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: block;\n font-size: ", ";\n font-weight: var(--grn-weight-", ");\n"])), function (p) {
|
|
14
|
+
var Wrapper = styled.span(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: block;\n font-size: ", ";\n font-weight: ", ";\n color: ", ";\n"])), function (p) {
|
|
16
15
|
return getTextSize(p.size);
|
|
17
16
|
}, function (p) {
|
|
18
|
-
return p.weight;
|
|
17
|
+
return getWeight(p.weight);
|
|
18
|
+
}, function (p) {
|
|
19
|
+
return getColor(p.color);
|
|
19
20
|
});
|
|
20
21
|
export var Text = function Text(_ref) {
|
|
21
22
|
var children = _ref.children,
|
|
22
23
|
_ref$size = _ref.size,
|
|
23
24
|
size = _ref$size === void 0 ? 'm' : _ref$size,
|
|
24
25
|
_ref$weight = _ref.weight,
|
|
25
|
-
weight = _ref$weight === void 0 ? 'normal' : _ref$weight
|
|
26
|
+
weight = _ref$weight === void 0 ? 'normal' : _ref$weight,
|
|
27
|
+
color = _ref.color;
|
|
26
28
|
return /*#__PURE__*/React.createElement(Wrapper, {
|
|
27
29
|
size: size,
|
|
28
|
-
weight: weight
|
|
30
|
+
weight: weight,
|
|
31
|
+
color: color
|
|
29
32
|
}, children);
|
|
30
33
|
};
|
|
31
34
|
Text.propTypes = {
|
|
32
35
|
size: PropTypes.oneOf(textSizes),
|
|
33
|
-
weight: PropTypes.oneOf(weights)
|
|
36
|
+
weight: PropTypes.oneOf(weights),
|
|
37
|
+
color: PropTypes.oneOfType([PropTypes.oneOf(weights), PropTypes.string])
|
|
34
38
|
};
|
package/es/utilities/index.js
CHANGED
|
@@ -1,10 +1,23 @@
|
|
|
1
1
|
import "core-js/modules/es.array.includes.js";
|
|
2
2
|
import "core-js/modules/es.string.includes.js";
|
|
3
|
-
import
|
|
3
|
+
import "core-js/modules/es.array.concat.js";
|
|
4
|
+
import { allColors, colorVarPrefix, cssVarPrefix, textSizes, textVarPrefix, weightVarPrefix, weights } from "../variables";
|
|
5
|
+
export var getColor = function getColor(color) {
|
|
6
|
+
if (allColors.includes(color)) {
|
|
7
|
+
return "var(".concat(cssVarPrefix).concat(colorVarPrefix).concat(color, ")");
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
return color;
|
|
11
|
+
};
|
|
4
12
|
export var getTextSize = function getTextSize(size) {
|
|
5
13
|
if (textSizes.includes(size)) {
|
|
6
|
-
return "var(
|
|
14
|
+
return "var(".concat(cssVarPrefix).concat(textVarPrefix).concat(size, ")");
|
|
7
15
|
}
|
|
8
16
|
|
|
9
17
|
return size;
|
|
18
|
+
};
|
|
19
|
+
export var getWeight = function getWeight(weight) {
|
|
20
|
+
if (weights.includes(weight)) {
|
|
21
|
+
return "var(".concat(cssVarPrefix).concat(weightVarPrefix).concat(weight, ")");
|
|
22
|
+
}
|
|
10
23
|
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
2
|
+
|
|
3
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
|
|
5
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
6
|
+
|
|
7
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
8
|
+
|
|
9
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
10
|
+
|
|
11
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
12
|
+
|
|
13
|
+
import "core-js/modules/es.array.reverse.js";
|
|
14
|
+
import "core-js/modules/es.array.concat.js";
|
|
15
|
+
import "core-js/modules/es.symbol.js";
|
|
16
|
+
import "core-js/modules/es.symbol.description.js";
|
|
17
|
+
import "core-js/modules/es.object.to-string.js";
|
|
18
|
+
import "core-js/modules/es.symbol.iterator.js";
|
|
19
|
+
import "core-js/modules/es.array.iterator.js";
|
|
20
|
+
import "core-js/modules/es.string.iterator.js";
|
|
21
|
+
import "core-js/modules/web.dom-collections.iterator.js";
|
|
22
|
+
import "core-js/modules/es.array.from.js";
|
|
23
|
+
import "core-js/modules/es.array.slice.js";
|
|
24
|
+
import "core-js/modules/es.regexp.exec.js";
|
|
25
|
+
var greysAmount = 8;
|
|
26
|
+
var greysArray = [];
|
|
27
|
+
|
|
28
|
+
for (var step = 1; step < greysAmount + 1; step++) {
|
|
29
|
+
greysArray.push("grey" + step);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export var cssVarPrefix = "--grn-";
|
|
33
|
+
export var spaceVarPrefix = "space-";
|
|
34
|
+
export var weightVarPrefix = "weight-";
|
|
35
|
+
export var textVarPrefix = "text-";
|
|
36
|
+
export var colorVarPrefix = "color-";
|
|
37
|
+
export var greys = greysArray.reverse();
|
|
38
|
+
export var semanticColors = ["body", "bodyDimmed", "primary"];
|
|
39
|
+
export var textSizes = ["s", "m", "l", "xl", "xxl"];
|
|
40
|
+
export var spaces = ["xs", "s", "m", "l", "xl", "xxl"];
|
|
41
|
+
export var weights = ["normal", "medium", "semiBold"];
|
|
42
|
+
export var allColors = [].concat(_toConsumableArray(greys), semanticColors);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flodesk/grain",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "Flodesk design system",
|
|
5
5
|
"module": "es/index.js",
|
|
6
6
|
"author": "Flodesk",
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
"eslint-config-next": "12.1.6",
|
|
48
48
|
"next": "12.1.6",
|
|
49
49
|
"react-live": "^3.1.0",
|
|
50
|
-
"semantic-release": "^19.0.2"
|
|
50
|
+
"semantic-release": "^19.0.2",
|
|
51
|
+
"vercel": "^25.1.0"
|
|
51
52
|
}
|
|
52
53
|
}
|