@codecademy/gamut-patterns 1.0.0-alpha.f6cb5a.0 → 67.0.0-alpha.09ad1e.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.
Files changed (42) hide show
  1. package/LICENSE +1 -1
  2. package/dist/patterns/CheckerDense.js +39 -32
  3. package/dist/patterns/CheckerLoose.js +39 -32
  4. package/dist/patterns/CheckerRegular.js +39 -32
  5. package/dist/patterns/DiagonalADense.js +73 -66
  6. package/dist/patterns/DiagonalALoose.js +217 -210
  7. package/dist/patterns/DiagonalARegular.js +121 -114
  8. package/dist/patterns/DiagonalBDense.js +55 -48
  9. package/dist/patterns/DiagonalBLoose.js +123 -116
  10. package/dist/patterns/DiagonalBRegular.js +79 -72
  11. package/dist/patterns/DotDense.js +34 -27
  12. package/dist/patterns/DotLoose.js +77 -70
  13. package/dist/patterns/DotRegular.js +34 -27
  14. package/dist/patterns/ExDense.js +56 -49
  15. package/dist/patterns/ExLoose.js +56 -49
  16. package/dist/patterns/ExRegular.js +56 -49
  17. package/dist/patterns/FlowerDense.js +50 -43
  18. package/dist/patterns/FlowerLoose.js +50 -43
  19. package/dist/patterns/FlowerRegular.js +50 -43
  20. package/dist/patterns/GridDense.js +49 -42
  21. package/dist/patterns/GridLoose.js +49 -42
  22. package/dist/patterns/GridRegular.js +49 -42
  23. package/dist/patterns/Herringbone.js +67 -60
  24. package/dist/patterns/RainDense.js +39 -32
  25. package/dist/patterns/RainLoose.js +39 -32
  26. package/dist/patterns/RainRegular.js +39 -32
  27. package/dist/patterns/StripeDense.js +71 -64
  28. package/dist/patterns/StripeLoose.js +203 -196
  29. package/dist/patterns/StripeRegular.js +115 -108
  30. package/dist/props.d.ts +1 -1
  31. package/dist/types.js +1 -0
  32. package/dist/usePatternId.js +4 -6
  33. package/package.json +16 -17
  34. package/.svgo.yml +0 -11
  35. package/CHANGELOG.md +0 -329
  36. package/babel.config.js +0 -5
  37. package/emotion-plugin.js +0 -46
  38. package/index-template.js +0 -10
  39. package/jest.config.js +0 -1
  40. package/pattern-template.js +0 -30
  41. package/svgr.config.js +0 -29
  42. package/tsconfig.json +0 -12
@@ -1,123 +1,130 @@
1
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
-
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ 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; }
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
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
3
7
  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; }
4
-
5
8
  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; }
6
-
7
9
  import * as React from 'react';
8
10
  import { Svg } from '../props';
9
11
  import { usePatternId } from '../usePatternId';
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import { jsxs as _jsxs } from "react/jsx-runtime";
10
14
  export var StripeRegular = /*#__PURE__*/React.forwardRef(function (_ref, svgRef) {
11
15
  var _ref$title = _ref.title,
12
- title = _ref$title === void 0 ? 'Stripe Regular' : _ref$title,
13
- titleId = _ref.titleId,
14
- props = _objectWithoutProperties(_ref, ["title", "titleId"]);
15
-
16
+ title = _ref$title === void 0 ? 'Stripe Regular' : _ref$title,
17
+ titleId = _ref.titleId,
18
+ props = _objectWithoutProperties(_ref, ["title", "titleId"]);
16
19
  var patternId = usePatternId('StripeRegular');
17
- return /*#__PURE__*/React.createElement(Svg, _extends({
20
+ return /*#__PURE__*/_jsxs(Svg, _objectSpread(_objectSpread({
18
21
  fill: "currentColor",
19
22
  role: "img",
20
23
  "aria-hidden": "true",
21
24
  ref: svgRef,
22
25
  "aria-labelledby": titleId
23
- }, props), title ? /*#__PURE__*/React.createElement("title", {
24
- id: titleId
25
- }, title) : null, /*#__PURE__*/React.createElement("pattern", {
26
- id: patternId,
27
- x: 0,
28
- y: 0,
29
- width: 8,
30
- height: 8,
31
- patternUnits: "userSpaceOnUse"
32
- }, /*#__PURE__*/React.createElement("rect", {
33
- x: 1,
34
- width: 1,
35
- height: 1,
36
- fill: "currentColor"
37
- }), /*#__PURE__*/React.createElement("rect", {
38
- width: 1,
39
- height: 1,
40
- fill: "currentColor"
41
- }), /*#__PURE__*/React.createElement("rect", {
42
- x: 2,
43
- width: 1,
44
- height: 1,
45
- fill: "currentColor"
46
- }), /*#__PURE__*/React.createElement("rect", {
47
- x: 3,
48
- width: 1,
49
- height: 1,
50
- fill: "currentColor"
51
- }), /*#__PURE__*/React.createElement("rect", {
52
- x: 1,
53
- y: 4,
54
- width: 1,
55
- height: 1,
56
- fill: "currentColor"
57
- }), /*#__PURE__*/React.createElement("rect", {
58
- y: 4,
59
- width: 1,
60
- height: 1,
61
- fill: "currentColor"
62
- }), /*#__PURE__*/React.createElement("rect", {
63
- x: 2,
64
- y: 4,
65
- width: 1,
66
- height: 1,
67
- fill: "currentColor"
68
- }), /*#__PURE__*/React.createElement("rect", {
69
- x: 3,
70
- y: 4,
71
- width: 1,
72
- height: 1,
73
- fill: "currentColor"
74
- }), /*#__PURE__*/React.createElement("rect", {
75
- x: 5,
76
- width: 1,
77
- height: 1,
78
- fill: "currentColor"
79
- }), /*#__PURE__*/React.createElement("rect", {
80
- x: 4,
81
- width: 1,
82
- height: 1,
83
- fill: "currentColor"
84
- }), /*#__PURE__*/React.createElement("rect", {
85
- x: 6,
86
- width: 1,
87
- height: 1,
88
- fill: "currentColor"
89
- }), /*#__PURE__*/React.createElement("rect", {
90
- x: 7,
91
- width: 1,
92
- height: 1,
93
- fill: "currentColor"
94
- }), /*#__PURE__*/React.createElement("rect", {
95
- x: 5,
96
- y: 4,
97
- width: 1,
98
- height: 1,
99
- fill: "currentColor"
100
- }), /*#__PURE__*/React.createElement("rect", {
101
- x: 4,
102
- y: 4,
103
- width: 1,
104
- height: 1,
105
- fill: "currentColor"
106
- }), /*#__PURE__*/React.createElement("rect", {
107
- x: 6,
108
- y: 4,
109
- width: 1,
110
- height: 1,
111
- fill: "currentColor"
112
- }), /*#__PURE__*/React.createElement("rect", {
113
- x: 7,
114
- y: 4,
115
- width: 1,
116
- height: 1,
117
- fill: "currentColor"
118
- })), /*#__PURE__*/React.createElement("rect", {
119
- width: "100%",
120
- height: "100%",
121
- fill: "url(#".concat(patternId, ")")
26
+ }, props), {}, {
27
+ children: [title ? /*#__PURE__*/_jsx("title", {
28
+ id: titleId,
29
+ children: title
30
+ }) : null, /*#__PURE__*/_jsxs("pattern", {
31
+ id: patternId,
32
+ x: 0,
33
+ y: 0,
34
+ width: 8,
35
+ height: 8,
36
+ patternUnits: "userSpaceOnUse",
37
+ children: [/*#__PURE__*/_jsx("rect", {
38
+ x: 1,
39
+ width: 1,
40
+ height: 1,
41
+ fill: "currentColor"
42
+ }), /*#__PURE__*/_jsx("rect", {
43
+ width: 1,
44
+ height: 1,
45
+ fill: "currentColor"
46
+ }), /*#__PURE__*/_jsx("rect", {
47
+ x: 2,
48
+ width: 1,
49
+ height: 1,
50
+ fill: "currentColor"
51
+ }), /*#__PURE__*/_jsx("rect", {
52
+ x: 3,
53
+ width: 1,
54
+ height: 1,
55
+ fill: "currentColor"
56
+ }), /*#__PURE__*/_jsx("rect", {
57
+ x: 1,
58
+ y: 4,
59
+ width: 1,
60
+ height: 1,
61
+ fill: "currentColor"
62
+ }), /*#__PURE__*/_jsx("rect", {
63
+ y: 4,
64
+ width: 1,
65
+ height: 1,
66
+ fill: "currentColor"
67
+ }), /*#__PURE__*/_jsx("rect", {
68
+ x: 2,
69
+ y: 4,
70
+ width: 1,
71
+ height: 1,
72
+ fill: "currentColor"
73
+ }), /*#__PURE__*/_jsx("rect", {
74
+ x: 3,
75
+ y: 4,
76
+ width: 1,
77
+ height: 1,
78
+ fill: "currentColor"
79
+ }), /*#__PURE__*/_jsx("rect", {
80
+ x: 5,
81
+ width: 1,
82
+ height: 1,
83
+ fill: "currentColor"
84
+ }), /*#__PURE__*/_jsx("rect", {
85
+ x: 4,
86
+ width: 1,
87
+ height: 1,
88
+ fill: "currentColor"
89
+ }), /*#__PURE__*/_jsx("rect", {
90
+ x: 6,
91
+ width: 1,
92
+ height: 1,
93
+ fill: "currentColor"
94
+ }), /*#__PURE__*/_jsx("rect", {
95
+ x: 7,
96
+ width: 1,
97
+ height: 1,
98
+ fill: "currentColor"
99
+ }), /*#__PURE__*/_jsx("rect", {
100
+ x: 5,
101
+ y: 4,
102
+ width: 1,
103
+ height: 1,
104
+ fill: "currentColor"
105
+ }), /*#__PURE__*/_jsx("rect", {
106
+ x: 4,
107
+ y: 4,
108
+ width: 1,
109
+ height: 1,
110
+ fill: "currentColor"
111
+ }), /*#__PURE__*/_jsx("rect", {
112
+ x: 6,
113
+ y: 4,
114
+ width: 1,
115
+ height: 1,
116
+ fill: "currentColor"
117
+ }), /*#__PURE__*/_jsx("rect", {
118
+ x: 7,
119
+ y: 4,
120
+ width: 1,
121
+ height: 1,
122
+ fill: "currentColor"
123
+ })]
124
+ }), /*#__PURE__*/_jsx("rect", {
125
+ width: "100%",
126
+ height: "100%",
127
+ fill: "url(#".concat(patternId, ")")
128
+ })]
122
129
  }));
123
130
  });
package/dist/props.d.ts CHANGED
@@ -177,7 +177,7 @@ declare const patternStyles: import("@codecademy/variance/dist/types/config").Pa
177
177
  readonly scale: "spacing";
178
178
  };
179
179
  }>>]>>;
180
- export declare type PatternStyleProps = StyleProps<typeof patternStyles>;
180
+ export type PatternStyleProps = StyleProps<typeof patternStyles>;
181
181
  export interface PatternProps extends Omit<React.SVGProps<SVGSVGElement>, keyof PatternStyleProps>, PatternStyleProps {
182
182
  /**
183
183
  * A suffix added to the end of the unique generated ID for the icon. This is useful if you have multiple of the same icon on the page and need to pass accessibility guidelines.
package/dist/types.js CHANGED
@@ -0,0 +1 @@
1
+ export {};
@@ -1,10 +1,8 @@
1
+ import { useId } from '@reach/auto-id';
1
2
  import { useMemo } from 'react';
2
- var counter = {};
3
3
  export function usePatternId(id) {
4
+ var generatedId = useId();
4
5
  return useMemo(function () {
5
- var key = id.toLowerCase();
6
- var idCounter = (counter === null || counter === void 0 ? void 0 : counter[key]) || 0;
7
- counter[key] = idCounter;
8
- return "".concat(id, "-pattern-").concat(counter[key] += 1);
9
- }, [id]);
6
+ return "".concat(id, "-pattern-").concat(generatedId);
7
+ }, [id, generatedId]);
10
8
  }
package/package.json CHANGED
@@ -4,27 +4,31 @@
4
4
  "url": "https://github.com/Codecademy/gamut/issues"
5
5
  },
6
6
  "dependencies": {
7
- "@codecademy/gamut-styles": "13.0.0-alpha.f6cb5a.0",
8
- "@codecademy/variance": "1.0.0-alpha.f6cb5a.0",
7
+ "@codecademy/gamut-styles": "67.0.0-alpha.09ad1e.0",
8
+ "@codecademy/variance": "67.0.0-alpha.09ad1e.0",
9
9
  "classnames": "^2.2.5"
10
10
  },
11
+ "devDependencies": {
12
+ "@svgr/cli": "5.5.0",
13
+ "@testing-library/react": "^12.1.2",
14
+ "lodash": "^4.17.5",
15
+ "svgo": "^1.3.2"
16
+ },
11
17
  "description": "Pattern library for Codecademy",
12
18
  "homepage": "https://github.com/Codecademy/gamut#readme",
13
19
  "name": "@codecademy/gamut-patterns",
14
20
  "module": "dist/index.js",
15
21
  "types": "dist/index.d.ts",
16
22
  "main": "dist/index.js",
23
+ "files": [
24
+ "dist"
25
+ ],
17
26
  "license": "MIT",
18
27
  "peerDependencies": {
19
28
  "@emotion/react": "^11.4.0",
20
29
  "@emotion/styled": "^11.3.0",
21
- "react": ">=17.0.2",
22
- "react-dom": ">=17.0.2"
23
- },
24
- "devDependencies": {
25
- "@svgr/cli": "5.5.0",
26
- "lodash": "^4.17.5",
27
- "svgo": "^1.3.2"
30
+ "react": "^17.0.2 || ^18.2.0",
31
+ "react-dom": "^17.0.2 || ^18.2.0"
28
32
  },
29
33
  "publishConfig": {
30
34
  "access": "public"
@@ -34,15 +38,10 @@
34
38
  "url": "git+ssh://git@github.com/Codecademy/gamut.git"
35
39
  },
36
40
  "scripts": {
37
- "verify": "tsc --noEmit",
38
41
  "format": "svgo -f ./src/svg --pretty --config=.svgo.yml",
39
- "build:icons": "rm -rf ./src/patterns && svgr --out-dir ./src/patterns --ext 'tsx' ./src/svg",
40
- "build:types": "tsc --emitDeclarationOnly",
41
- "build:compile": "babel ./src --out-dir ./dist --copy-files --extensions \".ts,.tsx\"",
42
- "build": "yarn build:icons && yarn build:compile && yarn build:types",
43
- "lernaBuildTask": "yarn build"
42
+ "build": "nx build @codecademy/gamut-patterns"
44
43
  },
45
44
  "sideEffects": false,
46
- "version": "1.0.0-alpha.f6cb5a.0",
47
- "gitHead": "ff424ba13fc62985621d93a45a2b4296dd2fbe5f"
45
+ "version": "67.0.0-alpha.09ad1e.0",
46
+ "gitHead": "430c6d83990991443428d7d476f069d368022b83"
48
47
  }
package/.svgo.yml DELETED
@@ -1,11 +0,0 @@
1
- multipass: true
2
-
3
- plugins:
4
- - inlineStyles:
5
- onlyMatchedOnce: false
6
- - removeDimensions: true
7
- - removeViewBox: false
8
- - removeTitle: true
9
- - removeDesc: true
10
- - mergePaths: false
11
- - convertShapeToPath: false