@flodesk/grain 1.0.3 → 1.1.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.
@@ -0,0 +1,18 @@
1
+ :root {
2
+ --base: 15px;
3
+ --ratio: calc(0.2vw + 2px);
4
+
5
+ --grn-text-sm: 13px;
6
+ --grn-text-md: var(--base);
7
+ --grn-text-lg: calc(var(--grn-text-md) + var(--ratio));
8
+ --grn-text-xl: calc(var(--grn-text-lg) + var(--ratio));
9
+ --grn-text-xxl: calc(var(--grn-text-xl) + var(--ratio));
10
+
11
+ --grn-weight-normal: 400;
12
+ --grn-weight-bold: 600;
13
+ }
14
+
15
+ * {
16
+ letter-spacing: calc(1.3px - 0.07em);
17
+ line-height: calc(5px + 1em);
18
+ }
@@ -0,0 +1,5 @@
1
+ import React from "react";
2
+ export var AnotherTestComponent = function AnotherTestComponent(_ref) {
3
+ var children = _ref.children;
4
+ return /*#__PURE__*/React.createElement("h1", null, children);
5
+ };
@@ -1,2 +1,3 @@
1
1
  export { TestComponent } from "./test-component";
2
2
  export { AnotherTestComponent } from "./another-test-component";
3
+ export { Text } from "./text";
@@ -0,0 +1,5 @@
1
+ import React from "react";
2
+ export var TestComponent = function TestComponent(_ref) {
3
+ var children = _ref.children;
4
+ return /*#__PURE__*/React.createElement("button", null, children);
5
+ };
@@ -0,0 +1,33 @@
1
+ import "core-js/modules/es.array.slice.js";
2
+ import "core-js/modules/es.object.freeze.js";
3
+ import "core-js/modules/es.object.define-properties.js";
4
+
5
+ var _templateObject;
6
+
7
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
8
+
9
+ import PropTypes from 'prop-types';
10
+ import React from "react";
11
+ import styled from "@emotion/styled";
12
+ var Wrapper = styled.span(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: block;\n font-size: var(--grn-text-", ");\n font-weight: var(--grn-weight-", ");\n"])), function (p) {
13
+ return p.size;
14
+ }, function (p) {
15
+ return p.weight;
16
+ });
17
+ export var Text = function Text(_ref) {
18
+ var children = _ref.children,
19
+ _ref$size = _ref.size,
20
+ size = _ref$size === void 0 ? 'md' : _ref$size,
21
+ _ref$weight = _ref.weight,
22
+ weight = _ref$weight === void 0 ? 'normal' : _ref$weight;
23
+ return /*#__PURE__*/React.createElement(Wrapper, {
24
+ size: size,
25
+ weight: weight
26
+ }, children);
27
+ };
28
+ var sizes = ['sm', 'md', 'lg', 'xl', 'xxl'];
29
+ var weights = ['normal', 'bold'];
30
+ Text.propTypes = {
31
+ size: PropTypes.oneOf(sizes),
32
+ weight: PropTypes.oneOf(weights)
33
+ };
@@ -0,0 +1,49 @@
1
+ import "core-js/modules/es.symbol.js";
2
+ import "core-js/modules/es.symbol.description.js";
3
+ import "core-js/modules/es.object.to-string.js";
4
+ import "core-js/modules/es.symbol.iterator.js";
5
+ import "core-js/modules/es.array.iterator.js";
6
+ import "core-js/modules/es.string.iterator.js";
7
+ import "core-js/modules/web.dom-collections.iterator.js";
8
+ import "core-js/modules/es.array.slice.js";
9
+ import "core-js/modules/es.array.from.js";
10
+ import "core-js/modules/es.regexp.exec.js";
11
+
12
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
13
+
14
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
15
+
16
+ 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); }
17
+
18
+ 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; }
19
+
20
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
21
+
22
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
23
+
24
+ import { useEffect, useState } from "react";
25
+ export function useWindowSize() {
26
+ var _useState = useState({
27
+ width: undefined,
28
+ height: undefined
29
+ }),
30
+ _useState2 = _slicedToArray(_useState, 2),
31
+ windowSize = _useState2[0],
32
+ setWindowSize = _useState2[1];
33
+
34
+ useEffect(function () {
35
+ function handleResize() {
36
+ setWindowSize({
37
+ width: window.innerWidth,
38
+ height: window.innerHeight
39
+ });
40
+ }
41
+
42
+ window.addEventListener("resize", handleResize);
43
+ handleResize();
44
+ return function () {
45
+ return window.removeEventListener("resize", handleResize);
46
+ };
47
+ }, []);
48
+ return windowSize;
49
+ }
package/es/index.js ADDED
@@ -0,0 +1 @@
1
+ export * from "./components";
package/package.json CHANGED
@@ -1,9 +1,8 @@
1
1
  {
2
2
  "name": "@flodesk/grain",
3
- "version": "1.0.3",
3
+ "version": "1.1.1",
4
4
  "description": "Flodesk design system",
5
- "module": "src/index.js",
6
- "main": "src/index.js",
5
+ "module": "es/index.js",
7
6
  "author": "Flodesk",
8
7
  "license": "UNLICENSED",
9
8
  "scripts": {
@@ -12,28 +11,40 @@
12
11
  "build": "next build",
13
12
  "start": "next start",
14
13
  "lint": "next lint",
15
- "semantic-release": "semantic-release"
14
+ "semantic-release": "semantic-release",
15
+ "build:es": "del es/* && cross-env NODE_ENV=production babel --config-file ./babel.config.es.js --out-dir es --copy-files src"
16
16
  },
17
17
  "publishConfig": {
18
18
  "access": "public"
19
19
  },
20
20
  "files": [
21
- "src"
21
+ "es"
22
22
  ],
23
23
  "dependencies": {
24
- "react": "18.1.0",
25
- "react-dom": "18.1.0"
24
+ "core-js": "^3.22.8",
25
+ "@emotion/react": "^11.9.0",
26
+ "@emotion/styled": "^11.8.1"
27
+ },
28
+ "peerDependencies": {
29
+ "react": ">=16.8",
30
+ "react-dom": ">=16.8"
26
31
  },
27
32
  "devDependencies": {
33
+ "@babel/cli": "^7.17.10",
34
+ "@babel/plugin-transform-runtime": "^7.18.2",
35
+ "@babel/preset-env": "^7.18.2",
36
+ "@babel/preset-react": "^7.17.12",
28
37
  "@mdx-js/loader": "^2.1.1",
29
38
  "@next/mdx": "^12.1.6",
30
- "next": "12.1.6",
31
39
  "@semantic-release/git": "^10.0.1",
32
40
  "@semantic-release/gitlab": "^9.3.1",
33
41
  "@semantic-release/npm": "^9.0.1",
42
+ "cross-env": "^7.0.3",
43
+ "del-cli": "^4.0.1",
34
44
  "eslint": "8.16.0",
35
45
  "eslint-config-next": "12.1.6",
36
- "semantic-release": "^19.0.2",
37
- "react-live": "^3.1.0"
46
+ "next": "12.1.6",
47
+ "react-live": "^3.1.0",
48
+ "semantic-release": "^19.0.2"
38
49
  }
39
50
  }
@@ -1,5 +0,0 @@
1
- import React from "react"
2
-
3
- export const AnotherTestComponent = ({ children }) => (
4
- <h1>{children}</h1>
5
- )
@@ -1,5 +0,0 @@
1
- import React from "react"
2
-
3
- export const TestComponent = ({ children }) => (
4
- <button>{children}</button>
5
- )
package/src/index.js DELETED
@@ -1 +0,0 @@
1
- export * from "./components";