orc-shared 1.2.0-dev.4 → 1.2.0-dev.5

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,113 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.default = void 0;
5
+
6
+ var _react = _interopRequireDefault(require("react"));
7
+
8
+ var _Link = _interopRequireDefault(require("@material-ui/core/Link"));
9
+
10
+ var _Icon = _interopRequireDefault(require("../DataDisplay/Icon"));
11
+
12
+ var _styles = require("@material-ui/core/styles");
13
+
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+
16
+ (function () {
17
+ var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
18
+ enterModule && enterModule(module);
19
+ })();
20
+
21
+ (function () {
22
+ var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
23
+ enterModule && enterModule(module);
24
+ })();
25
+
26
+ var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
27
+ return a;
28
+ };
29
+
30
+ var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
31
+ return a;
32
+ };
33
+
34
+ var useStyles = (0, _styles.makeStyles)(function (theme) {
35
+ return {
36
+ icon: {
37
+ paddingLeft: theme.spacing(1),
38
+ width: theme.spacing(1.2),
39
+ color: theme.palette.primary.main
40
+ }
41
+ };
42
+ });
43
+
44
+ var ExternalLink = function ExternalLink(_ref) {
45
+ var id = _ref.id,
46
+ url = _ref.url,
47
+ children = _ref.children;
48
+ var classes = useStyles();
49
+ return /*#__PURE__*/_react.default.createElement(_Link.default, {
50
+ id: id,
51
+ href: url,
52
+ rel: "noreferrer",
53
+ target: "_blank",
54
+ underline: "always"
55
+ }, children, /*#__PURE__*/_react.default.createElement(_Icon.default, {
56
+ id: "open-in-new-tab",
57
+ className: classes.icon
58
+ }));
59
+ };
60
+
61
+ __signature__(ExternalLink, "useStyles{classes}", function () {
62
+ return [useStyles];
63
+ });
64
+
65
+ __signature__(ExternalLink, "useStyles{classes}", function () {
66
+ return [useStyles];
67
+ });
68
+
69
+ var _default = ExternalLink;
70
+ var _default2 = _default;
71
+ var _default3 = _default2;
72
+ exports.default = _default3;
73
+ ;
74
+
75
+ (function () {
76
+ var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;
77
+
78
+ if (!reactHotLoader) {
79
+ return;
80
+ }
81
+
82
+ reactHotLoader.register(useStyles, "useStyles", "/home/vsts/work/1/s/src/components/MaterialUI/Navigation/ExternalLink.js");
83
+ reactHotLoader.register(ExternalLink, "ExternalLink", "/home/vsts/work/1/s/src/components/MaterialUI/Navigation/ExternalLink.js");
84
+ reactHotLoader.register(_default, "default", "/home/vsts/work/1/s/src/components/MaterialUI/Navigation/ExternalLink.js");
85
+ })();
86
+
87
+ ;
88
+
89
+ (function () {
90
+ var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
91
+ leaveModule && leaveModule(module);
92
+ })();
93
+
94
+ ;
95
+
96
+ (function () {
97
+ var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;
98
+
99
+ if (!reactHotLoader) {
100
+ return;
101
+ }
102
+
103
+ reactHotLoader.register(useStyles, "useStyles", "/home/vsts/work/1/s/src/components/MaterialUI/Navigation/ExternalLink.js");
104
+ reactHotLoader.register(ExternalLink, "ExternalLink", "/home/vsts/work/1/s/src/components/MaterialUI/Navigation/ExternalLink.js");
105
+ reactHotLoader.register(_default2, "default", "/home/vsts/work/1/s/src/components/MaterialUI/Navigation/ExternalLink.js");
106
+ })();
107
+
108
+ ;
109
+
110
+ (function () {
111
+ var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
112
+ leaveModule && leaveModule(module);
113
+ })();
@@ -189,6 +189,11 @@ var setThemeOverrides = function setThemeOverrides(theme) {
189
189
  }
190
190
  })
191
191
  }),
192
+ MuiLink: {
193
+ root: {
194
+ fontSize: theme.spacing(1.3)
195
+ }
196
+ },
192
197
  MuiButton: _objectSpread(_objectSpread({}, theme.MuiButton), {}, {
193
198
  root: {
194
199
  padding: "".concat(theme.spacing(0.8), " ").concat(theme.spacing(1)),
@@ -122,6 +122,9 @@
122
122
  <symbol id="icon-dropdown-chevron-down" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 10">
123
123
  <polyline fill="none" stroke-linecap="round" stroke-linejoin="round" points="9 3 5 7 1 3"/>
124
124
  </symbol>
125
+ <symbol id="icon-open-in-new-tab" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 10">
126
+ <path stroke="none" fill-rule="evenodd" d="M8.4375,6.25 L7.8125,6.25 C7.63991102,6.25 7.5,6.38991102 7.5,6.5625 L7.5,8.75 L1.25,8.75 L1.25,2.5 L4.0625,2.5 C4.23508898,2.5 4.375,2.36008898 4.375,2.1875 L4.375,1.5625 C4.375,1.38991102 4.23508898,1.25 4.0625,1.25 L0.9375,1.25 C0.419733047,1.25 0,1.66973305 0,2.1875 L0,9.0625 C0,9.58026695 0.419733047,10 0.9375,10 L7.8125,10 C8.33026695,10 8.75,9.58026695 8.75,9.0625 L8.75,6.5625 C8.75,6.38991102 8.61008898,6.25 8.4375,6.25 Z M9.53125,0 L7.03125,0 C6.61386719,0 6.40527344,0.506054688 6.69921875,0.80078125 L7.39707031,1.49863281 L2.63671875,6.25722656 C2.54845882,6.34518057 2.49884911,6.46465556 2.49884911,6.58925781 C2.49884911,6.71386007 2.54845882,6.83333506 2.63671875,6.92128906 L3.07949219,7.36328125 C3.16744619,7.45154118 3.28692118,7.50115089 3.41152344,7.50115089 C3.53612569,7.50115089 3.65560068,7.45154118 3.74355469,7.36328125 L8.5015625,2.60390625 L9.19921875,3.30078125 C9.4921875,3.59375 10,3.38867188 10,2.96875 L10,0.46875 C10,0.209866524 9.79013348,0 9.53125,0 Z"/>
127
+ </symbol>
125
128
  <symbol id="icon-dropdown-chevron-right" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 10">
126
129
  <polyline fill="none" stroke-linecap="round" stroke-linejoin="round" points="9 3 5 7 1 3" transform="rotate(-90 5 5)"/>
127
130
  </symbol>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orc-shared",
3
- "version": "1.2.0-dev.4",
3
+ "version": "1.2.0-dev.5",
4
4
  "description": "Shared code for Orckestra applications",
5
5
  "main": "./src/index.js",
6
6
  "exports": {
@@ -0,0 +1,25 @@
1
+ import React from "react";
2
+ import Link from "@material-ui/core/Link";
3
+ import Icon from "../DataDisplay/Icon";
4
+ import { makeStyles } from "@material-ui/core/styles";
5
+
6
+ const useStyles = makeStyles(theme => ({
7
+ icon: {
8
+ paddingLeft: theme.spacing(1),
9
+ width: theme.spacing(1.2),
10
+ color: theme.palette.primary.main,
11
+ },
12
+ }));
13
+
14
+ const ExternalLink = ({ id, url, children }) => {
15
+ const classes = useStyles();
16
+
17
+ return (
18
+ <Link id={id} href={url} rel="noreferrer" target="_blank" underline="always">
19
+ {children}
20
+ <Icon id="open-in-new-tab" className={classes.icon} />
21
+ </Link>
22
+ );
23
+ };
24
+
25
+ export default ExternalLink;
@@ -0,0 +1,26 @@
1
+ import React from "react";
2
+ import Link from "@material-ui/core/Link";
3
+ import Icon from "../DataDisplay/Icon";
4
+ import ExternalLink from "./ExternalLink";
5
+
6
+ describe("ExternalLink", () => {
7
+ it("render ExternalLink without errors", () => {
8
+ const children = <div>a div element</div>;
9
+
10
+ expect(
11
+ <ExternalLink id="an_Id" url="https://www.npmjs.com/package/orc-shared" children={children} />,
12
+ "when mounted",
13
+ "to satisfy",
14
+ <Link
15
+ id="an_Id"
16
+ href="https://www.npmjs.com/package/orc-shared"
17
+ rel="noreferrer"
18
+ target="_blank"
19
+ underline="always"
20
+ >
21
+ {children}
22
+ <Icon id="open-in-new-tab" />
23
+ </Link>,
24
+ );
25
+ });
26
+ });
@@ -158,6 +158,11 @@ const setThemeOverrides = theme => ({
158
158
  },
159
159
  },
160
160
  },
161
+ MuiLink: {
162
+ root: {
163
+ fontSize: theme.spacing(1.3),
164
+ },
165
+ },
161
166
  MuiButton: {
162
167
  ...theme.MuiButton,
163
168
  root: {
@@ -122,6 +122,9 @@
122
122
  <symbol id="icon-dropdown-chevron-down" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 10">
123
123
  <polyline fill="none" stroke-linecap="round" stroke-linejoin="round" points="9 3 5 7 1 3"/>
124
124
  </symbol>
125
+ <symbol id="icon-open-in-new-tab" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 10">
126
+ <path stroke="none" fill-rule="evenodd" d="M8.4375,6.25 L7.8125,6.25 C7.63991102,6.25 7.5,6.38991102 7.5,6.5625 L7.5,8.75 L1.25,8.75 L1.25,2.5 L4.0625,2.5 C4.23508898,2.5 4.375,2.36008898 4.375,2.1875 L4.375,1.5625 C4.375,1.38991102 4.23508898,1.25 4.0625,1.25 L0.9375,1.25 C0.419733047,1.25 0,1.66973305 0,2.1875 L0,9.0625 C0,9.58026695 0.419733047,10 0.9375,10 L7.8125,10 C8.33026695,10 8.75,9.58026695 8.75,9.0625 L8.75,6.5625 C8.75,6.38991102 8.61008898,6.25 8.4375,6.25 Z M9.53125,0 L7.03125,0 C6.61386719,0 6.40527344,0.506054688 6.69921875,0.80078125 L7.39707031,1.49863281 L2.63671875,6.25722656 C2.54845882,6.34518057 2.49884911,6.46465556 2.49884911,6.58925781 C2.49884911,6.71386007 2.54845882,6.83333506 2.63671875,6.92128906 L3.07949219,7.36328125 C3.16744619,7.45154118 3.28692118,7.50115089 3.41152344,7.50115089 C3.53612569,7.50115089 3.65560068,7.45154118 3.74355469,7.36328125 L8.5015625,2.60390625 L9.19921875,3.30078125 C9.4921875,3.59375 10,3.38867188 10,2.96875 L10,0.46875 C10,0.209866524 9.79013348,0 9.53125,0 Z"/>
127
+ </symbol>
125
128
  <symbol id="icon-dropdown-chevron-right" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 10">
126
129
  <polyline fill="none" stroke-linecap="round" stroke-linejoin="round" points="9 3 5 7 1 3" transform="rotate(-90 5 5)"/>
127
130
  </symbol>