@flodesk/grain 1.4.0 → 1.5.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 +8 -5
- package/es/components/text/index.js +4 -4
- package/es/utilities/index.js +7 -7
- package/es/variables/index.js +14 -10
- package/package.json +1 -1
package/es/base-styles.css
CHANGED
|
@@ -26,10 +26,6 @@
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
:root {
|
|
29
|
-
--grn-color-body: hsl(0 0% 7%);
|
|
30
|
-
--grn-color-bodyDimmed: hsl(0 0% 7% / 50%);
|
|
31
|
-
--grn-color-primary: hsl(0 0% 7%);
|
|
32
|
-
|
|
33
29
|
--grn-color-grey8: hsl(0 0% 7%);
|
|
34
30
|
--grn-color-grey7: hsl(0 0% 20%);
|
|
35
31
|
--grn-color-grey6: hsl(0 0% 32%);
|
|
@@ -38,6 +34,13 @@
|
|
|
38
34
|
--grn-color-grey3: hsl(0 0% 78%);
|
|
39
35
|
--grn-color-grey2: hsl(0 0% 87%);
|
|
40
36
|
--grn-color-grey1: hsl(0 0% 96%);
|
|
37
|
+
|
|
38
|
+
--grn-color-body: var(--grn-color-grey8);
|
|
39
|
+
--grn-color-bodyDimmed: hsl(0 0% 7% / 50%);
|
|
40
|
+
--grn-color-primary: var(--grn-color-grey8);
|
|
41
|
+
--grn-color-backgroundSecondary: hsl(0 0% 100%);
|
|
42
|
+
--grn-color-background: var(--grn-color-grey1);
|
|
43
|
+
--grn-color-border: hsl(0 0% 7% / 15%);
|
|
41
44
|
}
|
|
42
45
|
|
|
43
46
|
* {
|
|
@@ -52,7 +55,7 @@
|
|
|
52
55
|
}
|
|
53
56
|
|
|
54
57
|
body {
|
|
55
|
-
font-family: 'BeausiteClassic';
|
|
58
|
+
font-family: 'BeausiteClassic', sans-serif;
|
|
56
59
|
color: var(--grn-color-body);
|
|
57
60
|
font-size: var(--grn-text-m);
|
|
58
61
|
}
|
|
@@ -7,10 +7,10 @@ var _templateObject;
|
|
|
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
9
|
import { getColor, getTextSize, getWeight } from '../../utilities';
|
|
10
|
-
import { textSizes, weights } from '../../variables';
|
|
11
10
|
import PropTypes from 'prop-types';
|
|
12
11
|
import React from "react";
|
|
13
12
|
import styled from "@emotion/styled";
|
|
13
|
+
import { varOptions } from '../../variables';
|
|
14
14
|
var Wrapper = styled.span(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: block;\n font-size: ", ";\n font-weight: ", ";\n color: ", ";\n"])), function (p) {
|
|
15
15
|
return getTextSize(p.size);
|
|
16
16
|
}, function (p) {
|
|
@@ -32,7 +32,7 @@ export var Text = function Text(_ref) {
|
|
|
32
32
|
}, children);
|
|
33
33
|
};
|
|
34
34
|
Text.propTypes = {
|
|
35
|
-
size: PropTypes.oneOf(textSizes),
|
|
36
|
-
weight: PropTypes.oneOf(weights),
|
|
37
|
-
color: PropTypes.oneOfType([PropTypes.oneOf(weights), PropTypes.string])
|
|
35
|
+
size: PropTypes.oneOf(varOptions.textSizes),
|
|
36
|
+
weight: PropTypes.oneOf(varOptions.weights),
|
|
37
|
+
color: PropTypes.oneOfType([PropTypes.oneOf(varOptions.weights), PropTypes.string])
|
|
38
38
|
};
|
package/es/utilities/index.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import "core-js/modules/es.array.includes.js";
|
|
2
2
|
import "core-js/modules/es.string.includes.js";
|
|
3
3
|
import "core-js/modules/es.array.concat.js";
|
|
4
|
-
import {
|
|
4
|
+
import { grnPrefix, varOptions, varPrefixes } from "../variables";
|
|
5
5
|
export var getColor = function getColor(color) {
|
|
6
|
-
if (allColors.includes(color)) {
|
|
7
|
-
return "var(".concat(
|
|
6
|
+
if (varOptions.allColors.includes(color)) {
|
|
7
|
+
return "var(".concat(grnPrefix).concat(varPrefixes.color).concat(color, ")");
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
return color;
|
|
11
11
|
};
|
|
12
12
|
export var getTextSize = function getTextSize(size) {
|
|
13
|
-
if (textSizes.includes(size)) {
|
|
14
|
-
return "var(".concat(
|
|
13
|
+
if (varOptions.textSizes.includes(size)) {
|
|
14
|
+
return "var(".concat(grnPrefix).concat(varPrefixes.text).concat(size, ")");
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
return size;
|
|
18
18
|
};
|
|
19
19
|
export var getWeight = function getWeight(weight) {
|
|
20
|
-
if (weights.includes(weight)) {
|
|
21
|
-
return "var(".concat(
|
|
20
|
+
if (varOptions.weights.includes(weight)) {
|
|
21
|
+
return "var(".concat(grnPrefix).concat(varPrefixes.weight).concat(weight, ")");
|
|
22
22
|
}
|
|
23
23
|
};
|
package/es/variables/index.js
CHANGED
|
@@ -29,14 +29,18 @@ for (var step = 1; step < greysAmount + 1; step++) {
|
|
|
29
29
|
greysArray.push("grey" + step);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
export var
|
|
33
|
-
export var
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
export var grnPrefix = "--grn-";
|
|
33
|
+
export var varPrefixes = {
|
|
34
|
+
space: "space-",
|
|
35
|
+
weight: "weight-",
|
|
36
|
+
text: "text-",
|
|
37
|
+
color: "color-"
|
|
38
|
+
};
|
|
37
39
|
export var greys = greysArray.reverse();
|
|
38
|
-
export var semanticColors = ["body", "bodyDimmed", "primary"];
|
|
39
|
-
export var
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
export var semanticColors = ["body", "bodyDimmed", "primary", "backgroundSecondary", "background", "border"];
|
|
41
|
+
export var varOptions = {
|
|
42
|
+
textSizes: ["s", "m", "l", "xl", "xxl"],
|
|
43
|
+
spaces: ["xs", "s", "m", "l", "xl", "xxl"],
|
|
44
|
+
weights: ["normal", "medium", "semiBold"],
|
|
45
|
+
allColors: [].concat(_toConsumableArray(greys), semanticColors)
|
|
46
|
+
};
|