@flodesk/grain 2.5.1 → 2.7.1

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.
@@ -1,9 +1,19 @@
1
1
  import "core-js/modules/es.array.slice.js";
2
2
  import "core-js/modules/es.object.freeze.js";
3
3
  import "core-js/modules/es.object.define-properties.js";
4
+ import "core-js/modules/es.object.keys.js";
5
+ import "core-js/modules/es.array.index-of.js";
6
+ import "core-js/modules/es.symbol.js";
7
+ var _excluded = ["children", "size", "weight", "color", "tag", "hasEllipsis", "ellipsisLines", "align"];
4
8
 
5
9
  var _templateObject;
6
10
 
11
+ import "core-js/modules/es.object.assign.js";
12
+
13
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
14
+
15
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
16
+
7
17
  function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
8
18
 
9
19
  import { getColor, getTextSize, getWeight } from '../../utilities';
@@ -11,12 +21,20 @@ import { PropTypes } from 'prop-types';
11
21
  import React from "react";
12
22
  import styled from "@emotion/styled";
13
23
  import { types } from '../../types';
14
- var Wrapper = styled.span(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: block;\n font-size: ", ";\n font-weight: ", ";\n color: ", ";\n"])), function (p) {
24
+ var Wrapper = styled.span(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: block;\n font-size: ", ";\n font-weight: ", ";\n color: ", ";\n text-align: ", ";\n \n ", ";\n ", ";\n ", ";\n"])), function (p) {
15
25
  return getTextSize(p.size);
16
26
  }, function (p) {
17
27
  return getWeight(p.weight);
18
28
  }, function (p) {
19
29
  return getColor(p.color);
30
+ }, function (p) {
31
+ return p.align;
32
+ }, function (p) {
33
+ return p.hasEllipsis && "\n overflow: hidden;\n text-overflow: ellipsis;\n ";
34
+ }, function (p) {
35
+ return p.hasEllipsis && !p.ellipsisLines && "\n white-space: nowrap;\n ";
36
+ }, function (p) {
37
+ return p.hasEllipsis && p.ellipsisLines && "\n display: -webkit-box;\n -webkit-line-clamp: ".concat(p.ellipsisLines, ";\n -webkit-box-orient: vertical;\n ");
20
38
  });
21
39
  export var Text = function Text(_ref) {
22
40
  var children = _ref.children,
@@ -25,17 +43,28 @@ export var Text = function Text(_ref) {
25
43
  _ref$weight = _ref.weight,
26
44
  weight = _ref$weight === void 0 ? 'normal' : _ref$weight,
27
45
  color = _ref.color,
28
- tag = _ref.tag;
29
- return /*#__PURE__*/React.createElement(Wrapper, {
46
+ tag = _ref.tag,
47
+ hasEllipsis = _ref.hasEllipsis,
48
+ ellipsisLines = _ref.ellipsisLines,
49
+ align = _ref.align,
50
+ props = _objectWithoutProperties(_ref, _excluded);
51
+
52
+ return /*#__PURE__*/React.createElement(Wrapper, Object.assign({
30
53
  size: size,
31
54
  weight: weight,
32
55
  color: color,
33
- as: tag
34
- }, children);
56
+ as: tag,
57
+ hasEllipsis: hasEllipsis,
58
+ ellipsisLines: ellipsisLines,
59
+ align: align
60
+ }, props), children);
35
61
  };
36
62
  Text.propTypes = {
37
63
  size: types.textSize,
38
64
  weight: types.weight,
39
65
  color: types.color,
40
- tag: PropTypes.string
66
+ align: types.textAlign,
67
+ tag: PropTypes.string,
68
+ hasEllipsis: PropTypes.bool,
69
+ ellipsisLines: PropTypes.number
41
70
  };
@@ -26,11 +26,6 @@
26
26
  -moz-osx-font-smoothing: grayscale;
27
27
  }
28
28
 
29
- .grn-context a {
30
- color: inherit;
31
- text-decoration: none;
32
- }
33
-
34
29
  *, *:before, *:after {
35
30
  box-sizing: border-box;
36
31
  }
@@ -3,11 +3,15 @@
3
3
  }
4
4
 
5
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);
6
+ --grn-textDecreaseRatio: 1.146;
7
+ --grn-textIncreaseRatio: 1.207;
8
+ --grn-baseTextSize: calc(var(--grn-unit) * 1.875);
9
+
10
+ --grn-text-s: calc(var(--grn-text-m) / var(--grn-textDecreaseRatio));
11
+ --grn-text-m: var(--grn-baseTextSize);
12
+ --grn-text-l: calc(var(--grn-text-m) * 1.335);
13
+ --grn-text-xl: calc(var(--grn-text-l) * 1.2);
14
+ --grn-text-xxl: calc(var(--grn-text-xl) * 1.25);
11
15
  }
12
16
 
13
17
  :root {
package/es/types/index.js CHANGED
@@ -8,5 +8,6 @@ export var types = {
8
8
  radius: PropTypes.oneOf(["s", "m", "l"]),
9
9
  position: PropTypes.oneOf(["static", "relative", "fixed", "absolute", "sticky"]),
10
10
  textSize: PropTypes.oneOfType([PropTypes.oneOf(Object.keys(vars.textSizes)), PropTypes.number, PropTypes.string]),
11
- weight: PropTypes.oneOf(Object.keys(vars.weights))
11
+ weight: PropTypes.oneOf(Object.keys(vars.weights)),
12
+ textAlign: PropTypes.oneOf(["left", "center", "right"])
12
13
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flodesk/grain",
3
- "version": "2.5.1",
3
+ "version": "2.7.1",
4
4
  "description": "Flodesk design system",
5
5
  "module": "es/index.js",
6
6
  "author": "Flodesk",