@flodesk/grain 2.7.4 → 2.8.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/components/box/index.js +867 -58
- package/es/components/button/index.js +97 -32
- package/es/components/index.js +39 -4
- package/es/components/input/index.js +55 -25
- package/es/components/text/index.js +156 -33
- package/es/index.js +38 -2
- package/es/styles/components-variables.css +13 -7
- package/es/styles/variables.css +11 -0
- package/es/types/index.js +31 -14
- package/es/utilities/index.js +88 -33
- package/es/variables/index.js +23 -4
- package/package.json +2 -1
package/es/utilities/index.js
CHANGED
|
@@ -1,60 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.object.keys.js");
|
|
4
|
+
|
|
5
|
+
require("core-js/modules/es.symbol.js");
|
|
6
|
+
|
|
7
|
+
require("core-js/modules/es.array.filter.js");
|
|
8
|
+
|
|
9
|
+
require("core-js/modules/es.object.to-string.js");
|
|
10
|
+
|
|
11
|
+
require("core-js/modules/es.object.get-own-property-descriptor.js");
|
|
12
|
+
|
|
13
|
+
require("core-js/modules/web.dom-collections.for-each.js");
|
|
14
|
+
|
|
15
|
+
require("core-js/modules/es.object.get-own-property-descriptors.js");
|
|
16
|
+
|
|
17
|
+
require("core-js/modules/es.object.define-properties.js");
|
|
18
|
+
|
|
19
|
+
require("core-js/modules/es.object.define-property.js");
|
|
20
|
+
|
|
21
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
22
|
+
|
|
23
|
+
Object.defineProperty(exports, "__esModule", {
|
|
24
|
+
value: true
|
|
25
|
+
});
|
|
26
|
+
exports.getBorder = exports.getSpace = exports.getTransition = exports.getRadius = exports.getWeight = exports.getTextSize = exports.getShadow = exports.getColor = exports.getCssVar = exports.getCssVarCore = exports.isBrowser = void 0;
|
|
27
|
+
|
|
28
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
29
|
+
|
|
30
|
+
require("core-js/modules/es.array.concat.js");
|
|
31
|
+
|
|
32
|
+
var _variables = require("../variables");
|
|
33
|
+
|
|
1
34
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
35
|
|
|
3
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
import "core-js/modules/es.symbol.js";
|
|
11
|
-
import "core-js/modules/es.array.filter.js";
|
|
12
|
-
import "core-js/modules/es.object.to-string.js";
|
|
13
|
-
import "core-js/modules/es.object.get-own-property-descriptor.js";
|
|
14
|
-
import "core-js/modules/web.dom-collections.for-each.js";
|
|
15
|
-
import "core-js/modules/es.object.get-own-property-descriptors.js";
|
|
16
|
-
import "core-js/modules/es.object.define-properties.js";
|
|
17
|
-
import { grnPrefix, vars } from "../variables";
|
|
18
|
-
export var isBrowser = typeof window !== "undefined";
|
|
19
|
-
export var getCssVarCore = function getCssVarCore(type, value) {
|
|
20
|
-
return "".concat(grnPrefix).concat(type, "-").concat(value);
|
|
36
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
37
|
+
|
|
38
|
+
var isBrowser = typeof window !== "undefined";
|
|
39
|
+
exports.isBrowser = isBrowser;
|
|
40
|
+
|
|
41
|
+
var getCssVarCore = function getCssVarCore(type, value) {
|
|
42
|
+
return "".concat(_variables.grnPrefix).concat(type, "-").concat(value);
|
|
21
43
|
};
|
|
22
|
-
|
|
44
|
+
|
|
45
|
+
exports.getCssVarCore = getCssVarCore;
|
|
46
|
+
|
|
47
|
+
var getCssVar = function getCssVar(type, value) {
|
|
23
48
|
return "var(".concat(getCssVarCore(type, value), ")");
|
|
24
49
|
};
|
|
25
50
|
|
|
51
|
+
exports.getCssVar = getCssVar;
|
|
52
|
+
|
|
26
53
|
var u = function u(amount) {
|
|
27
54
|
return "calc(var(--grn-unit) * ".concat(amount, ")");
|
|
28
55
|
};
|
|
29
56
|
|
|
30
|
-
|
|
31
|
-
if (color in _objectSpread(_objectSpread(_objectSpread({}, vars.colors.baseColors), vars.colors.greys), vars.colors.semanticColors)) {
|
|
57
|
+
var getColor = function getColor(color) {
|
|
58
|
+
if (color in _objectSpread(_objectSpread(_objectSpread({}, _variables.vars.colors.baseColors), _variables.vars.colors.greys), _variables.vars.colors.semanticColors)) {
|
|
32
59
|
return getCssVar("color", color);
|
|
33
60
|
}
|
|
34
61
|
|
|
35
62
|
return color;
|
|
36
63
|
};
|
|
37
|
-
|
|
38
|
-
|
|
64
|
+
|
|
65
|
+
exports.getColor = getColor;
|
|
66
|
+
|
|
67
|
+
var getShadow = function getShadow(shadow) {
|
|
68
|
+
if (shadow in _variables.vars.shadows) {
|
|
39
69
|
return getCssVar("shadow", shadow);
|
|
40
70
|
}
|
|
41
71
|
|
|
42
72
|
return shadow;
|
|
43
73
|
};
|
|
44
|
-
|
|
45
|
-
|
|
74
|
+
|
|
75
|
+
exports.getShadow = getShadow;
|
|
76
|
+
|
|
77
|
+
var getTextSize = function getTextSize(size) {
|
|
78
|
+
if (size in _variables.vars.textSizes) {
|
|
46
79
|
return getCssVar("text", size);
|
|
47
80
|
}
|
|
48
81
|
|
|
49
82
|
return size;
|
|
50
83
|
};
|
|
51
|
-
|
|
52
|
-
|
|
84
|
+
|
|
85
|
+
exports.getTextSize = getTextSize;
|
|
86
|
+
|
|
87
|
+
var getWeight = function getWeight(weight) {
|
|
88
|
+
if (weight in _variables.vars.weights) {
|
|
53
89
|
return getCssVar("weight", weight);
|
|
54
90
|
}
|
|
55
91
|
};
|
|
56
|
-
|
|
57
|
-
|
|
92
|
+
|
|
93
|
+
exports.getWeight = getWeight;
|
|
94
|
+
|
|
95
|
+
var getRadius = function getRadius(radius) {
|
|
96
|
+
if (radius in _variables.vars.radiuses) {
|
|
58
97
|
return getCssVar("radius", radius);
|
|
59
98
|
}
|
|
60
99
|
|
|
@@ -62,9 +101,20 @@ export var getRadius = function getRadius(radius) {
|
|
|
62
101
|
return radius;
|
|
63
102
|
}
|
|
64
103
|
};
|
|
65
|
-
|
|
104
|
+
|
|
105
|
+
exports.getRadius = getRadius;
|
|
106
|
+
|
|
107
|
+
var getTransition = function getTransition(transition) {
|
|
108
|
+
if (transition in _variables.vars.transitions) {
|
|
109
|
+
return getCssVar("transition", transition);
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
exports.getTransition = getTransition;
|
|
114
|
+
|
|
115
|
+
var getSpace = function getSpace(space) {
|
|
66
116
|
if (isNaN(space)) {
|
|
67
|
-
if (space in vars.spaces) {
|
|
117
|
+
if (space in _variables.vars.spaces) {
|
|
68
118
|
return getCssVar("space", space);
|
|
69
119
|
}
|
|
70
120
|
|
|
@@ -74,7 +124,10 @@ export var getSpace = function getSpace(space) {
|
|
|
74
124
|
if (space === 0) return space;
|
|
75
125
|
return u(space);
|
|
76
126
|
};
|
|
77
|
-
|
|
127
|
+
|
|
128
|
+
exports.getSpace = getSpace;
|
|
129
|
+
|
|
130
|
+
var getBorder = function getBorder(borderSide) {
|
|
78
131
|
var borderWidth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "1px";
|
|
79
132
|
var borderColor = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "border";
|
|
80
133
|
var w = getSpace(borderWidth);
|
|
@@ -91,4 +144,6 @@ export var getBorder = function getBorder(borderSide) {
|
|
|
91
144
|
if (borderSide in borderSideStyles) {
|
|
92
145
|
return "\n border-style: solid;\n border-width: ".concat(borderSideStyles[borderSide], ";\n border-color: ").concat(getColor(borderColor), ";\n ");
|
|
93
146
|
}
|
|
94
|
-
};
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
exports.getBorder = getBorder;
|
package/es/variables/index.js
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.object.define-property.js");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.vars = exports.grnPrefix = void 0;
|
|
9
|
+
var grnPrefix = "--grn-";
|
|
10
|
+
exports.grnPrefix = grnPrefix;
|
|
11
|
+
var vars = {
|
|
3
12
|
textSizes: {
|
|
4
13
|
s: "s",
|
|
5
14
|
m: "m",
|
|
@@ -30,6 +39,10 @@ export var vars = {
|
|
|
30
39
|
m: "m",
|
|
31
40
|
l: "l"
|
|
32
41
|
},
|
|
42
|
+
transitions: {
|
|
43
|
+
slow: "slow",
|
|
44
|
+
fast: "fast"
|
|
45
|
+
},
|
|
33
46
|
colors: {
|
|
34
47
|
greys: {
|
|
35
48
|
grey8: "grey8",
|
|
@@ -53,8 +66,14 @@ export var vars = {
|
|
|
53
66
|
background: "background",
|
|
54
67
|
overlay: "overlay",
|
|
55
68
|
border: "border",
|
|
69
|
+
buttonBorder: "buttonBorder",
|
|
70
|
+
buttonBorderHover: "buttonBorderHover",
|
|
71
|
+
buttonBorderActive: "buttonBorderActive",
|
|
56
72
|
selection: "selection",
|
|
57
|
-
danger: "danger"
|
|
73
|
+
danger: "danger",
|
|
74
|
+
disabledContent: "disabledContent",
|
|
75
|
+
disabledBackground: "disabledBackground"
|
|
58
76
|
}
|
|
59
77
|
}
|
|
60
|
-
};
|
|
78
|
+
};
|
|
79
|
+
exports.vars = vars;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flodesk/grain",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.8.0",
|
|
4
4
|
"description": "Flodesk design system",
|
|
5
5
|
"module": "es/index.js",
|
|
6
6
|
"author": "Flodesk",
|
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
"eslint": "8.16.0",
|
|
47
47
|
"eslint-config-next": "12.1.6",
|
|
48
48
|
"next": "12.1.6",
|
|
49
|
+
"react-docgen": "^6.0.0-alpha.3",
|
|
49
50
|
"react-live": "^3.1.0",
|
|
50
51
|
"semantic-release": "^19.0.2",
|
|
51
52
|
"vercel": "^25.1.0"
|