@flodesk/grain 2.2.0 → 2.3.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.
@@ -7,6 +7,7 @@ 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 { PropTypes } from 'prop-types';
10
11
  import React from "react";
11
12
  import styled from "@emotion/styled";
12
13
  import { types } from '../../types';
@@ -23,15 +24,18 @@ export var Text = function Text(_ref) {
23
24
  size = _ref$size === void 0 ? 'm' : _ref$size,
24
25
  _ref$weight = _ref.weight,
25
26
  weight = _ref$weight === void 0 ? 'normal' : _ref$weight,
26
- color = _ref.color;
27
+ color = _ref.color,
28
+ tag = _ref.tag;
27
29
  return /*#__PURE__*/React.createElement(Wrapper, {
28
30
  size: size,
29
31
  weight: weight,
30
- color: color
32
+ color: color,
33
+ as: tag
31
34
  }, children);
32
35
  };
33
36
  Text.propTypes = {
34
37
  size: types.textSize,
35
38
  weight: types.weight,
36
- color: types.color
39
+ color: types.color,
40
+ tag: PropTypes.string
37
41
  };
package/es/index.js CHANGED
@@ -1 +1,2 @@
1
- export * from "./components";
1
+ export * from "./components";
2
+ export { vars } from "./variables";
@@ -1,67 +1,20 @@
1
- :root {
2
- --grn-unit: 8px;
3
- }
4
-
5
- :root {
6
- --grn-text-s: calc(var(--grn-unit) * 1.625);
7
- --grn-text-m: calc(var(--grn-unit) * 1.875);
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);
11
- }
12
-
13
- :root {
14
- --grn-weight-normal: 400;
15
- --grn-weight-medium: 500;
16
- --grn-weight-semiBold: 600;
17
- }
18
-
19
- :root {
20
- --grn-space-xs: calc(var(--grn-unit) / 2);
21
- --grn-space-s: calc(var(--grn-unit) * 1);
22
- --grn-space-m: calc(var(--grn-unit) * 2);
23
- --grn-space-l: calc(var(--grn-unit) * 3);
24
- --grn-space-xl: calc(var(--grn-unit) * 5);
25
- --grn-space-xxl: calc(var(--grn-unit) * 7);
26
- }
1
+ @import './variables.css';
27
2
 
28
3
  :root {
29
- --grn-radius-s: calc(var(--grn-unit) / 2);
30
- --grn-radius-m: calc(var(--grn-unit) / 1.33);
31
- --grn-radius-l: calc(var(--grn-unit) * 1.25);
32
- }
33
-
34
- :root {
35
- --grey8-HSL: 0 0% 7%;
36
-
37
- --grn-color-grey8: hsl(var(--grey8-HSL));
38
- --grn-color-grey7: hsl(0 0% 20%);
39
- --grn-color-grey6: hsl(0 0% 32%);
40
- --grn-color-grey5: hsl(0 0% 44%);
41
- --grn-color-grey4: hsl(0 0% 63%);
42
- --grn-color-grey3: hsl(0 0% 78%);
43
- --grn-color-grey2: hsl(0 0% 87%);
44
- --grn-color-grey1: hsl(0 0% 96%);
4
+ --grn-letterSpacing-fixed: 1.3px;
5
+ --grn-letterSpacing-relative: 0.07em;
6
+ --grn-letterSpacing-global: calc(var(--grn-letterSpacing-fixed) - var(--grn-letterSpacing-relative));
45
7
 
46
- --grn-color-blue: hsl(218 74% 54%);
47
- --grn-color-red: hsl(6 66% 65%);
48
-
49
- --grn-color-body: var(--grn-color-grey8);
50
- --grn-color-bodyDimmed: hsl(var(--grey8-HSL) / 50%);
51
- --grn-color-accent: var(--grn-color-grey8);
52
- --grn-color-backgroundSecondary: hsl(0 0% 100%);
53
- --grn-color-background: var(--grn-color-grey1);
54
- --grn-color-overlay: hsl(var(--grey8-HSL) / 7%);
55
- --grn-color-border: hsl(var(--grey8-HSL) / 9%);
56
- --grn-color-selection: var(--grn-color-blue);
57
- --grn-color-danger: var(--grn-color-red);
8
+ --grn-lineHeight-fixed: 5px;
9
+ --grn-lineHeight-relative: 1em;
10
+ --grn-lineHeight-global: calc(var(--grn-lineHeight-fixed) + var(--grn-lineHeight-relative));
11
+
12
+ --grn-font-global: 'Beausite Classic', sans-serif;
58
13
  }
59
14
 
60
15
  * {
61
- letter-spacing: calc(1.3px - 0.07em);
62
- line-height: calc(5px + 1em);
63
- -webkit-font-smoothing: antialiased;
64
- -moz-osx-font-smoothing: grayscale;
16
+ letter-spacing: var(--grn-letterSpacing-global);
17
+ line-height: var(--grn-lineHeight-global);
65
18
  }
66
19
 
67
20
  *, *:before, *:after {
@@ -69,9 +22,11 @@
69
22
  }
70
23
 
71
24
  body {
72
- font-family: 'BeausiteClassic', sans-serif;
25
+ font-family: var(--grn-font-global);
73
26
  color: var(--grn-color-body);
74
27
  font-size: var(--grn-text-m);
28
+ -webkit-font-smoothing: antialiased;
29
+ -moz-osx-font-smoothing: grayscale;
75
30
  }
76
31
 
77
32
  a {
@@ -0,0 +1,57 @@
1
+ :root {
2
+ --grn-unit: 8px;
3
+ }
4
+
5
+ :root {
6
+ --grn-text-s: calc(var(--grn-unit) * 1.625);
7
+ --grn-text-m: calc(var(--grn-unit) * 1.875);
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);
11
+ }
12
+
13
+ :root {
14
+ --grn-weight-normal: 400;
15
+ --grn-weight-medium: 500;
16
+ --grn-weight-semiBold: 600;
17
+ }
18
+
19
+ :root {
20
+ --grn-space-xs: calc(var(--grn-unit) / 2);
21
+ --grn-space-s: calc(var(--grn-unit) * 1);
22
+ --grn-space-m: calc(var(--grn-unit) * 2);
23
+ --grn-space-l: calc(var(--grn-unit) * 3);
24
+ --grn-space-xl: calc(var(--grn-unit) * 5);
25
+ --grn-space-xxl: calc(var(--grn-unit) * 7);
26
+ }
27
+
28
+ :root {
29
+ --grn-radius-s: calc(var(--grn-unit) / 1.333333);
30
+ --grn-radius-m: calc(var(--grn-unit) * 1.5);
31
+ }
32
+
33
+ :root {
34
+ --grn-color-grey8-HSL: 0 0% 7%;
35
+
36
+ --grn-color-grey8: hsl(var(--grn-color-grey8-HSL));
37
+ --grn-color-grey7: hsl(0 0% 20%);
38
+ --grn-color-grey6: hsl(0 0% 32%);
39
+ --grn-color-grey5: hsl(0 0% 44%);
40
+ --grn-color-grey4: hsl(0 0% 63%);
41
+ --grn-color-grey3: hsl(0 0% 78%);
42
+ --grn-color-grey2: hsl(0 0% 87%);
43
+ --grn-color-grey1: hsl(0 0% 96%);
44
+
45
+ --grn-color-blue: hsl(218 74% 54%);
46
+ --grn-color-red: hsl(6 66% 65%);
47
+
48
+ --grn-color-body: var(--grn-color-grey8);
49
+ --grn-color-bodyDimmed: hsl(var(--grn-color-grey8-HSL) / 50%);
50
+ --grn-color-accent: var(--grn-color-grey8);
51
+ --grn-color-backgroundSecondary: hsl(0 0% 100%);
52
+ --grn-color-background: var(--grn-color-grey1);
53
+ --grn-color-overlay: hsl(var(--grn-color-grey8-HSL) / 7%);
54
+ --grn-color-border: hsl(var(--grn-color-grey8-HSL) / 9%);
55
+ --grn-color-selection: var(--grn-color-blue);
56
+ --grn-color-danger: var(--grn-color-red);
57
+ }
@@ -1,4 +1,19 @@
1
+ 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
+
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) { _defineProperty(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; }
4
+
5
+ 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; }
6
+
1
7
  import "core-js/modules/es.array.concat.js";
8
+ import "core-js/modules/es.object.define-property.js";
9
+ import "core-js/modules/es.object.keys.js";
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";
2
17
  import { grnPrefix, vars } from "../variables";
3
18
  export var getCssVarCore = function getCssVarCore(type, value) {
4
19
  return "".concat(grnPrefix).concat(type, "-").concat(value);
@@ -12,7 +27,7 @@ var u = function u(amount) {
12
27
  };
13
28
 
14
29
  export var getColor = function getColor(color) {
15
- if (color in vars.colors) {
30
+ if (color in _objectSpread(_objectSpread(_objectSpread({}, vars.colors.baseColors), vars.colors.greys), vars.colors.semanticColors)) {
16
31
  return getCssVar("color", color);
17
32
  }
18
33
 
@@ -47,7 +62,6 @@ export var getSpace = function getSpace(space) {
47
62
  if (space === 0) return space;
48
63
  return u(space);
49
64
  };
50
- console.log("getSpace", getSpace(0));
51
65
  export var getBorder = function getBorder(borderSide) {
52
66
  var borderWidth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "1px";
53
67
  var borderColor = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "border";
@@ -1,45 +1,4 @@
1
- import "core-js/modules/es.object.define-property.js";
2
- import "core-js/modules/es.object.keys.js";
3
- import "core-js/modules/es.symbol.js";
4
- import "core-js/modules/es.array.filter.js";
5
- import "core-js/modules/es.object.to-string.js";
6
- import "core-js/modules/es.object.get-own-property-descriptor.js";
7
- import "core-js/modules/web.dom-collections.for-each.js";
8
- import "core-js/modules/es.object.get-own-property-descriptors.js";
9
- import "core-js/modules/es.object.define-properties.js";
10
-
11
- 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; }
12
-
13
- 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) { _defineProperty(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; }
14
-
15
- 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; }
16
-
17
1
  export var grnPrefix = "--grn-";
18
- export var greys = {
19
- grey8: "grey8",
20
- grey7: "grey7",
21
- grey6: "grey6",
22
- grey5: "grey5",
23
- grey4: "grey4",
24
- grey3: "grey3",
25
- grey2: "grey2",
26
- grey1: "grey1"
27
- };
28
- export var semanticColors = {
29
- body: "body",
30
- bodyDimmed: "bodyDimmed",
31
- accent: "accent",
32
- backgroundSecondary: "backgroundSecondary",
33
- background: "background",
34
- overlay: "overlay",
35
- border: "border",
36
- selection: "selection",
37
- danger: "danger"
38
- };
39
- export var baseColors = {
40
- blue: "blue",
41
- red: "red"
42
- };
43
2
  export var vars = {
44
3
  textSizes: {
45
4
  s: "s",
@@ -63,8 +22,33 @@ export var vars = {
63
22
  },
64
23
  radiuses: {
65
24
  s: "s",
66
- m: "m",
67
- l: "l"
25
+ m: "m"
68
26
  },
69
- colors: _objectSpread(_objectSpread(_objectSpread({}, greys), baseColors), semanticColors)
27
+ colors: {
28
+ greys: {
29
+ grey8: "grey8",
30
+ grey7: "grey7",
31
+ grey6: "grey6",
32
+ grey5: "grey5",
33
+ grey4: "grey4",
34
+ grey3: "grey3",
35
+ grey2: "grey2",
36
+ grey1: "grey1"
37
+ },
38
+ baseColors: {
39
+ blue: "blue",
40
+ red: "red"
41
+ },
42
+ semanticColors: {
43
+ body: "body",
44
+ bodyDimmed: "bodyDimmed",
45
+ accent: "accent",
46
+ backgroundSecondary: "backgroundSecondary",
47
+ background: "background",
48
+ overlay: "overlay",
49
+ border: "border",
50
+ selection: "selection",
51
+ danger: "danger"
52
+ }
53
+ }
70
54
  };
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@flodesk/grain",
3
- "version": "2.2.0",
3
+ "version": "2.3.2",
4
4
  "description": "Flodesk design system",
5
5
  "module": "es/index.js",
6
6
  "author": "Flodesk",
7
7
  "license": "UNLICENSED",
8
8
  "scripts": {
9
9
  "test": "echo \"Error: no test specified\" && exit 1",
10
- "dev": "next dev",
10
+ "dev": "next dev -p 4000",
11
11
  "build": "next build",
12
12
  "start": "next start",
13
13
  "lint": "next lint",