@zac-apps/commons 1.0.1 → 1.0.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.
package/dist/index.js ADDED
@@ -0,0 +1,722 @@
1
+ 'use strict';
2
+
3
+ var _defineProperty = require('@babel/runtime/helpers/defineProperty');
4
+ var React = require('react');
5
+ var Snackbar = require('@mui/material/Snackbar');
6
+ var MuiAlert = require('@mui/material/Alert');
7
+ var jsxRuntime = require('react/jsx-runtime');
8
+ var Grid = require('@mui/material/Unstable_Grid2');
9
+ var Accordion = require('@mui/material/Accordion');
10
+ var AccordionSummary = require('@mui/material/AccordionSummary');
11
+ var AccordionDetails = require('@mui/material/AccordionDetails');
12
+ var Typography = require('@mui/material/Typography');
13
+ var ExpandMoreIcon = require('@mui/icons-material/ExpandMore');
14
+ var styles = require('@mui/material/styles');
15
+ var red = require('@mui/material/colors/red');
16
+ var pink = require('@mui/material/colors/pink');
17
+ var lightGreen = require('@mui/material/colors/lightGreen');
18
+ var green = require('@mui/material/colors/green');
19
+ var yellow = require('@mui/material/colors/yellow');
20
+ var Table = require('@mui/material/Table');
21
+ var TableContainer = require('@mui/material/TableContainer');
22
+ var Paper = require('@mui/material/Paper');
23
+ var Link = require('next/link');
24
+ var Link$1 = require('@mui/material/Link');
25
+ var CssBaseline = require('@mui/material/CssBaseline');
26
+ var react = require('@emotion/react');
27
+ var Box = require('@mui/material/Box');
28
+ var navigation = require('next/navigation');
29
+ var createCache = require('@emotion/cache');
30
+ var AppBar = require('@mui/material/AppBar');
31
+ var Toolbar = require('@mui/material/Toolbar');
32
+ var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
33
+ var IconButton = require('@mui/material/IconButton');
34
+ var MenuItem = require('@mui/material/MenuItem');
35
+ var Menu = require('@mui/material/Menu');
36
+ var Divider = require('@mui/material/Divider');
37
+ var MenuIcon = require('@mui/icons-material/Menu');
38
+ var MenuOpenIcon = require('@mui/icons-material/MenuOpen');
39
+ var footer_content_js = require('../../../../conf/footer_content.js');
40
+ var CircularProgress = require('@mui/material/CircularProgress');
41
+ var ToggleButtonGroup = require('@mui/material/ToggleButtonGroup');
42
+ var ToggleButton = require('@mui/material/ToggleButton');
43
+ var Image = require('next/image');
44
+ var Button = require('@mui/material/Button');
45
+ var TableCell = require('@mui/material/TableCell');
46
+ var useMediaQuery = require('@mui/material/useMediaQuery');
47
+ var Drawer = require('@mui/material/Drawer');
48
+ var List = require('@mui/material/List');
49
+ var ListItem = require('@mui/material/ListItem');
50
+ var ManageSearchIcon = require('@mui/icons-material/ManageSearch');
51
+ var CloseIcon = require('@mui/icons-material/Close');
52
+ var reactRouterDom = require('react-router-dom');
53
+
54
+ function _interopNamespaceDefault(e) {
55
+ var n = Object.create(null);
56
+ if (e) {
57
+ Object.keys(e).forEach(function (k) {
58
+ if (k !== 'default') {
59
+ var d = Object.getOwnPropertyDescriptor(e, k);
60
+ Object.defineProperty(n, k, d.get ? d : {
61
+ enumerable: true,
62
+ get: function () { return e[k]; }
63
+ });
64
+ }
65
+ });
66
+ }
67
+ n.default = e;
68
+ return Object.freeze(n);
69
+ }
70
+
71
+ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
72
+
73
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
74
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
75
+ var Alert = /*#__PURE__*/React.forwardRef(function Alert(props, ref) {
76
+ return /*#__PURE__*/jsxRuntime.jsx(MuiAlert, _objectSpread({
77
+ elevation: 6,
78
+ ref: ref,
79
+ variant: "filled"
80
+ }, props));
81
+ });
82
+ function ErrorAlert(_ref) {
83
+ var alert = _ref.alert,
84
+ SetAlert = _ref.SetAlert,
85
+ message = _ref.message;
86
+ var handleClose = function handleClose(event, reason) {
87
+ if (reason === "clickaway") {
88
+ return;
89
+ }
90
+ SetAlert(false);
91
+ };
92
+ return /*#__PURE__*/jsxRuntime.jsx(Snackbar, {
93
+ open: alert,
94
+ autoHideDuration: 3000,
95
+ onClose: handleClose,
96
+ children: /*#__PURE__*/jsxRuntime.jsx(Alert, {
97
+ severity: "error",
98
+ onClose: handleClose,
99
+ sx: {
100
+ width: "100%"
101
+ },
102
+ children: message
103
+ })
104
+ });
105
+ }
106
+
107
+ var AppTheme = styles.createTheme({
108
+ palette: {
109
+ primary: {
110
+ main: "#c1002a"
111
+ },
112
+ secondary: {
113
+ main: "#636363"
114
+ },
115
+ error: {
116
+ main: pink[900]
117
+ },
118
+ running: {
119
+ main: red[900],
120
+ contrastText: "#fff"
121
+ },
122
+ available: {
123
+ main: lightGreen[200],
124
+ contrastText: "#000"
125
+ },
126
+ info: {
127
+ main: pink[100]
128
+ },
129
+ success: {
130
+ main: yellow[500]
131
+ },
132
+ empty: {
133
+ main: green[500],
134
+ contrastText: "#000"
135
+ }
136
+ }
137
+ });
138
+
139
+ function AppCard(props) {
140
+ return /*#__PURE__*/jsxRuntime.jsx(Grid, {
141
+ xs: props.xs || props.size || 12,
142
+ lg: props.lg || props.size || 6,
143
+ md: props.md || 12,
144
+ children: /*#__PURE__*/jsxRuntime.jsxs(Accordion, {
145
+ defaultExpanded: !props.collapsed,
146
+ square: false,
147
+ elevation: 2,
148
+ children: [/*#__PURE__*/jsxRuntime.jsx(AccordionSummary, {
149
+ expandIcon: /*#__PURE__*/jsxRuntime.jsx(ExpandMoreIcon, {}),
150
+ sx: {
151
+ backgroundColor: AppTheme.palette.divider
152
+ },
153
+ children: /*#__PURE__*/jsxRuntime.jsx(Typography, {
154
+ variant: "h5",
155
+ children: props.title
156
+ })
157
+ }), /*#__PURE__*/jsxRuntime.jsx(AccordionDetails, {
158
+ children: props.children
159
+ })]
160
+ })
161
+ });
162
+ }
163
+
164
+ function AppGrid(_ref) {
165
+ var children = _ref.children,
166
+ reverse = _ref.reverse;
167
+ var wrapper = reverse ? "wrap-reverse" : "wrap";
168
+ return /*#__PURE__*/jsxRuntime.jsx(Grid, {
169
+ container: true,
170
+ spacing: 2,
171
+ sx: {
172
+ display: "flex",
173
+ flexGrow: 1,
174
+ justifyContent: "center",
175
+ flexWrap: wrapper
176
+ },
177
+ children: children
178
+ });
179
+ }
180
+
181
+ function AppTable(_ref) {
182
+ var children = _ref.children;
183
+ return /*#__PURE__*/jsxRuntime.jsx(TableContainer, {
184
+ component: Paper,
185
+ children: /*#__PURE__*/jsxRuntime.jsx(Table, {
186
+ size: "small",
187
+ "aria-label": "a dense table",
188
+ children: children
189
+ })
190
+ });
191
+ }
192
+
193
+ // prepend: true moves MUI styles to the top of the <head> so they're loaded first.
194
+ // It allows developers to easily override MUI styles with other styling solutions, like CSS modules.
195
+ function createEmotionCache() {
196
+ return createCache({
197
+ key: "css",
198
+ prepend: true
199
+ });
200
+ }
201
+
202
+ function AppMenu(_ref) {
203
+ var title = _ref.title,
204
+ children = _ref.children;
205
+ if (!title) {
206
+ title = "JGU-ZAC Apps";
207
+ }
208
+ return /*#__PURE__*/jsxRuntime.jsx(AppBar, {
209
+ position: "sticky",
210
+ children: /*#__PURE__*/jsxRuntime.jsxs(Toolbar, {
211
+ children: [children, "\u2003", /*#__PURE__*/jsxRuntime.jsx(Typography, {
212
+ variant: "h6",
213
+ component: "div",
214
+ sx: {
215
+ flexGrow: 1
216
+ },
217
+ children: title
218
+ }), /*#__PURE__*/jsxRuntime.jsx("img", {
219
+ src: "/zac_logo.png",
220
+ width: "48px",
221
+ alt: "zac-logo"
222
+ })]
223
+ })
224
+ });
225
+ }
226
+
227
+ function MenuButton(_ref) {
228
+ var anchorEl = _ref.anchorEl;
229
+ if (anchorEl) {
230
+ return /*#__PURE__*/jsxRuntime.jsx(MenuOpenIcon, {});
231
+ } else {
232
+ return /*#__PURE__*/jsxRuntime.jsx(MenuIcon, {});
233
+ }
234
+ }
235
+
236
+ function NextListMenu(_ref) {
237
+ var availApps = _ref.availApps,
238
+ start = _ref.start;
239
+ var _React$useState = React__namespace.useState(null),
240
+ _React$useState2 = _slicedToArray(_React$useState, 2),
241
+ anchorEl = _React$useState2[0],
242
+ setAnchorEl = _React$useState2[1];
243
+ var open = Boolean(anchorEl);
244
+ var handleClickListItem = function handleClickListItem(event) {
245
+ setAnchorEl(event.currentTarget);
246
+ };
247
+ var handleClose = function handleClose() {
248
+ setAnchorEl(null);
249
+ };
250
+ var pathname = navigation.usePathname();
251
+ var basePath = process.env.basePath;
252
+ function StartEntry() {
253
+ if (start) {
254
+ return /*#__PURE__*/jsxRuntime.jsxs(React__namespace.Fragment, {
255
+ children: [/*#__PURE__*/jsxRuntime.jsx(MenuItem, {
256
+ component: Link,
257
+ href: basePath,
258
+ selected: pathname === basePath,
259
+ onClick: handleClose,
260
+ children: "Start"
261
+ }), /*#__PURE__*/jsxRuntime.jsx(Divider, {})]
262
+ });
263
+ } else return null;
264
+ }
265
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
266
+ children: [/*#__PURE__*/jsxRuntime.jsx(IconButton, {
267
+ size: "large",
268
+ edge: "start",
269
+ color: "inherit",
270
+ "aria-label": "menu",
271
+ sx: {
272
+ mr: 2
273
+ },
274
+ onClick: handleClickListItem,
275
+ children: /*#__PURE__*/jsxRuntime.jsx(MenuButton, {
276
+ anchorEl: anchorEl
277
+ })
278
+ }), /*#__PURE__*/jsxRuntime.jsxs(Menu, {
279
+ id: "lock-menu",
280
+ anchorEl: anchorEl,
281
+ open: open,
282
+ onClose: handleClose,
283
+ MenuListProps: {
284
+ "aria-labelledby": "lock-button",
285
+ role: "listbox"
286
+ },
287
+ children: [/*#__PURE__*/jsxRuntime.jsx(StartEntry, {}), availApps.map(function (option, index) {
288
+ return /*#__PURE__*/jsxRuntime.jsx(MenuItem, {
289
+ component: Link,
290
+ href: option.path,
291
+ selected: pathname === option.path + "/",
292
+ onClick: handleClose,
293
+ children: option.name
294
+ }, option.name);
295
+ })]
296
+ })]
297
+ });
298
+ }
299
+
300
+ function Footer() {
301
+ return /*#__PURE__*/jsxRuntime.jsx(React.Fragment, {
302
+ children: /*#__PURE__*/jsxRuntime.jsx(Grid, {
303
+ sx: {
304
+ p: 1,
305
+ backgroundColor: AppTheme.palette.divider,
306
+ display: "flex",
307
+ flexDirection: "row",
308
+ justifyContent: "center",
309
+ alignItems: "center",
310
+ minHeight: 64
311
+ },
312
+ children: /*#__PURE__*/jsxRuntime.jsx(Grid, {
313
+ children: /*#__PURE__*/jsxRuntime.jsx(Typography, {
314
+ variant: "body2",
315
+ children: footer_content_js.footerContent
316
+ })
317
+ })
318
+ })
319
+ });
320
+ }
321
+
322
+ var clientSideEmotionCache = createEmotionCache();
323
+ function AppWrapper(_ref) {
324
+ var title = _ref.title,
325
+ availApps = _ref.availApps,
326
+ children = _ref.children;
327
+ var basePath = process.env.basePath;
328
+ return /*#__PURE__*/jsxRuntime.jsx(react.CacheProvider, {
329
+ value: clientSideEmotionCache,
330
+ children: /*#__PURE__*/jsxRuntime.jsxs(styles.ThemeProvider, {
331
+ theme: AppTheme,
332
+ children: [/*#__PURE__*/jsxRuntime.jsx(CssBaseline, {}), /*#__PURE__*/jsxRuntime.jsx(AppMenu, {
333
+ title: /*#__PURE__*/jsxRuntime.jsx(Link$1, {
334
+ sx: {
335
+ color: AppTheme.palette.primary.contrastText
336
+ },
337
+ href: basePath,
338
+ component: Link.Link,
339
+ children: title
340
+ }),
341
+ children: /*#__PURE__*/jsxRuntime.jsx(NextListMenu, {
342
+ availApps: availApps,
343
+ start: true
344
+ })
345
+ }), /*#__PURE__*/jsxRuntime.jsx(Box, {
346
+ sx: {
347
+ p: 3,
348
+ minHeight: "calc(100% - 128px)",
349
+ display: "flex",
350
+ justifyContent: "center"
351
+ },
352
+ children: children
353
+ }), /*#__PURE__*/jsxRuntime.jsx(Footer, {})]
354
+ })
355
+ });
356
+ }
357
+
358
+ function DivTitle(_ref) {
359
+ var children = _ref.children;
360
+ return /*#__PURE__*/jsxRuntime.jsx(Divider, {
361
+ textAlign: "left",
362
+ children: children
363
+ });
364
+ }
365
+
366
+ function Percentage(number) {
367
+ var resultStr = number.toString() + " %";
368
+ return resultStr;
369
+ }
370
+
371
+ var PreferenceContext = /*#__PURE__*/React.createContext(null);
372
+
373
+ function Progress() {
374
+ return /*#__PURE__*/jsxRuntime.jsx(Grid, {
375
+ container: true,
376
+ sx: {
377
+ display: "flex",
378
+ flexGrow: 1,
379
+ justifyContent: "center",
380
+ alignContent: "center"
381
+ },
382
+ children: /*#__PURE__*/jsxRuntime.jsx(CircularProgress, {})
383
+ });
384
+ }
385
+
386
+ function PublicFetch(_ref) {
387
+ var url = _ref.url,
388
+ SetState = _ref.SetState,
389
+ SetMetaData = _ref.SetMetaData,
390
+ reload = _ref.reload,
391
+ SetReload = _ref.SetReload;
392
+ var _useState = React.useState(),
393
+ _useState2 = _slicedToArray(_useState, 2),
394
+ internal = _useState2[0],
395
+ SetInternal = _useState2[1];
396
+ var state = null;
397
+ if (!SetState) {
398
+ SetState = SetInternal;
399
+ state = internal;
400
+ }
401
+ if (!reload) {
402
+ reload = false;
403
+ }
404
+ React.useEffect(function () {
405
+ fetch(url, {
406
+ headers: {
407
+ "Content-Type": "application/json",
408
+ Accept: "application/json"
409
+ }
410
+ }).then(function (response) {
411
+ if (SetMetaData) {
412
+ SetMetaData(response.headers);
413
+ }
414
+ console.log(response);
415
+ return response.json();
416
+ }).then(function (json) {
417
+ console.log(json);
418
+ SetState(json);
419
+ });
420
+ if (SetReload) {
421
+ SetReload(false);
422
+ }
423
+ }, [reload]);
424
+ return state;
425
+ }
426
+
427
+ function RespGrid(_ref) {
428
+ var children = _ref.children,
429
+ matches = _ref.matches,
430
+ justify = _ref.justify;
431
+ if (matches) {
432
+ return /*#__PURE__*/jsxRuntime.jsx(Grid, {
433
+ sx: {
434
+ display: "flex",
435
+ justifyContent: justify,
436
+ alignItems: "center"
437
+ },
438
+ children: children
439
+ });
440
+ } else {
441
+ return /*#__PURE__*/jsxRuntime.jsx(Grid, {
442
+ sx: {
443
+ display: "flex",
444
+ flexDirection: "column",
445
+ justifyContent: "center",
446
+ alignItems: "center"
447
+ },
448
+ children: children
449
+ });
450
+ }
451
+ }
452
+
453
+ function SpecSwitch(_ref) {
454
+ var listmode = _ref.listmode,
455
+ setup = _ref.setup,
456
+ spec = _ref.spec,
457
+ SetSpec = _ref.SetSpec,
458
+ SetFilter = _ref.SetFilter,
459
+ routerActive = _ref.routerActive;
460
+ var router = navigation.useRouter();
461
+ var pathname = navigation.usePathname();
462
+ return /*#__PURE__*/jsxRuntime.jsx(React.Fragment, {
463
+ children: /*#__PURE__*/jsxRuntime.jsx(Grid, {
464
+ children: /*#__PURE__*/jsxRuntime.jsx(ToggleButtonGroup, {
465
+ value: spec,
466
+ exclusive: true,
467
+ color: "primary",
468
+ onChange: function onChange(event, value) {
469
+ if (value !== null) {
470
+ SetSpec(value);
471
+ SetFilter ? SetFilter({}) : null;
472
+ routerActive ? router.push(pathname + "?spec=" + value + "&mode=" + listmode) : null;
473
+ }
474
+ },
475
+ size: "small",
476
+ children: Object.keys(setup).map(function (entry) {
477
+ return /*#__PURE__*/jsxRuntime.jsx(ToggleButton, {
478
+ value: entry,
479
+ children: entry
480
+ }, "spec_" + entry);
481
+ })
482
+ })
483
+ })
484
+ });
485
+ }
486
+
487
+ function Start(_ref) {
488
+ var availApps = _ref.availApps;
489
+ return /*#__PURE__*/jsxRuntime.jsx(Grid, {
490
+ children: /*#__PURE__*/jsxRuntime.jsxs(AppCard, {
491
+ title: "Welcome to ZAC Apps",
492
+ xs: 12,
493
+ lg: 8,
494
+ children: [/*#__PURE__*/jsxRuntime.jsx("p", {
495
+ children: "Select an app to get started."
496
+ }), /*#__PURE__*/jsxRuntime.jsx(Grid, {
497
+ container: true,
498
+ sx: {
499
+ display: "flex",
500
+ flexWrap: "wrap",
501
+ justifyContent: "center"
502
+ },
503
+ children: availApps.map(function (app) {
504
+ return /*#__PURE__*/jsxRuntime.jsxs(Button, {
505
+ sx: {
506
+ m: 5,
507
+ minWidth: 250,
508
+ display: "flex",
509
+ flexDirection: "column"
510
+ },
511
+ variant: "outlined",
512
+ component: Link,
513
+ href: app.path,
514
+ children: [/*#__PURE__*/jsxRuntime.jsx("p", {
515
+ children: /*#__PURE__*/jsxRuntime.jsx(Image, {
516
+ src: app.icon,
517
+ alt: app.name,
518
+ height: 100
519
+ })
520
+ }), /*#__PURE__*/jsxRuntime.jsx("p", {
521
+ children: app.name
522
+ })]
523
+ }, "button_" + app.path);
524
+ })
525
+ })]
526
+ })
527
+ });
528
+ }
529
+
530
+ var TableHeadCell = styles.styled(TableCell)(function (_ref) {
531
+ var theme = _ref.theme;
532
+ return _defineProperty(_defineProperty({}, "&.".concat(TableCell.tableCellClasses.head), {
533
+ backgroundColor: theme.palette.divider
534
+ }), "&.".concat(TableCell.tableCellClasses.body), {
535
+ fontSize: 14
536
+ });
537
+ });
538
+
539
+ function useFetch(_ref) {
540
+ var url = _ref.url,
541
+ reload = _ref.reload,
542
+ SetReload = _ref.SetReload;
543
+ // Define states for data and metadata
544
+
545
+ var _useState = React.useState(),
546
+ _useState2 = _slicedToArray(_useState, 2),
547
+ data = _useState2[0],
548
+ SetData = _useState2[1];
549
+ var _useState3 = React.useState(),
550
+ _useState4 = _slicedToArray(_useState3, 2),
551
+ metadata = _useState4[0],
552
+ SetMetadata = _useState4[1];
553
+
554
+ // Fetch data from url
555
+
556
+ React.useEffect(function () {
557
+ fetch(url, {
558
+ headers: {
559
+ "Content-Type": "application/json",
560
+ Accept: "application/json"
561
+ }
562
+ }).then(function (response) {
563
+ SetMetadata(response.headers);
564
+ console.log(response);
565
+ return response.json();
566
+ }).then(function (json) {
567
+ console.log(json);
568
+ SetData(json);
569
+ });
570
+ if (reload) {
571
+ SetReload(false); // Reset reload state
572
+ }
573
+ }, [reload]); // Fetch is triggered by reload state
574
+
575
+ // Return data and metadata as object
576
+
577
+ var internal = {
578
+ data: data,
579
+ metadata: metadata
580
+ };
581
+ return internal;
582
+ }
583
+
584
+ function AppDrawer(_ref) {
585
+ var children = _ref.children;
586
+ var matches = useMediaQuery(AppTheme.breakpoints.up("lg"));
587
+ var _useState = React.useState(false),
588
+ _useState2 = _slicedToArray(_useState, 2),
589
+ open = _useState2[0],
590
+ SetOpen = _useState2[1];
591
+ var toggleDrawer = function toggleDrawer(state) {
592
+ return function (event) {
593
+ if (event.type === "keydown" && (event.key === "Tab" || event.key === "Shift")) {
594
+ return;
595
+ }
596
+ SetOpen(state);
597
+ };
598
+ };
599
+ var list = function list() {
600
+ return /*#__PURE__*/jsxRuntime.jsx(Box, {
601
+ role: "presentation",
602
+ width: matches ? "420px" : "100%",
603
+ children: /*#__PURE__*/jsxRuntime.jsxs(List, {
604
+ children: [/*#__PURE__*/jsxRuntime.jsx(ListItem, {
605
+ sx: {
606
+ justifyContent: "right"
607
+ },
608
+ children: /*#__PURE__*/jsxRuntime.jsx(IconButton, {
609
+ onClick: toggleDrawer(false),
610
+ children: /*#__PURE__*/jsxRuntime.jsx(CloseIcon, {})
611
+ })
612
+ }), /*#__PURE__*/jsxRuntime.jsx(Divider, {}), children]
613
+ })
614
+ });
615
+ };
616
+ return /*#__PURE__*/jsxRuntime.jsxs(React.Fragment, {
617
+ children: [/*#__PURE__*/jsxRuntime.jsx(Button, {
618
+ variant: "outlined",
619
+ onClick: toggleDrawer(true),
620
+ startIcon: /*#__PURE__*/jsxRuntime.jsx(ManageSearchIcon, {
621
+ fontSize: "inherit"
622
+ }),
623
+ children: "Search/Filter"
624
+ }), /*#__PURE__*/jsxRuntime.jsx(Drawer, {
625
+ anchor: "left",
626
+ open: open,
627
+ onClose: toggleDrawer(false),
628
+ sx: {
629
+ maxWidth: "350px"
630
+ },
631
+ children: list()
632
+ })]
633
+ });
634
+ }
635
+
636
+ var basePath = process.env.basePath;
637
+ function ListMenu(_ref) {
638
+ var availApps = _ref.availApps,
639
+ start = _ref.start;
640
+ var _React$useState = React__namespace.useState(null),
641
+ _React$useState2 = _slicedToArray(_React$useState, 2),
642
+ anchorEl = _React$useState2[0],
643
+ setAnchorEl = _React$useState2[1];
644
+ var open = Boolean(anchorEl);
645
+ var handleClickListItem = function handleClickListItem(event) {
646
+ setAnchorEl(event.currentTarget);
647
+ };
648
+ var handleClose = function handleClose() {
649
+ setAnchorEl(null);
650
+ };
651
+ var location = reactRouterDom.useLocation();
652
+ function StartEntry() {
653
+ if (start) {
654
+ return /*#__PURE__*/jsxRuntime.jsxs(React__namespace.Fragment, {
655
+ children: [/*#__PURE__*/jsxRuntime.jsx(MenuItem, {
656
+ component: reactRouterDom.Link,
657
+ to: "/start",
658
+ selected: location.pathname === basePath + "/start",
659
+ onClick: handleClose,
660
+ children: "Start"
661
+ }), /*#__PURE__*/jsxRuntime.jsx(Divider, {})]
662
+ });
663
+ } else return null;
664
+ }
665
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
666
+ children: [/*#__PURE__*/jsxRuntime.jsx(IconButton, {
667
+ size: "large",
668
+ edge: "start",
669
+ color: "inherit",
670
+ "aria-label": "menu",
671
+ sx: {
672
+ mr: 2
673
+ },
674
+ onClick: handleClickListItem,
675
+ children: /*#__PURE__*/jsxRuntime.jsx(MenuButton, {
676
+ anchorEl: anchorEl
677
+ })
678
+ }), /*#__PURE__*/jsxRuntime.jsxs(Menu, {
679
+ id: "lock-menu",
680
+ anchorEl: anchorEl,
681
+ open: open,
682
+ onClose: handleClose,
683
+ MenuListProps: {
684
+ "aria-labelledby": "lock-button",
685
+ role: "listbox"
686
+ },
687
+ children: [/*#__PURE__*/jsxRuntime.jsx(StartEntry, {}), availApps.map(function (option, index) {
688
+ return /*#__PURE__*/jsxRuntime.jsx(MenuItem, {
689
+ component: reactRouterDom.Link,
690
+ to: option.path,
691
+ selected: basePath + option.path === location.pathname,
692
+ onClick: handleClose,
693
+ children: option.name
694
+ }, option.name);
695
+ })]
696
+ })]
697
+ });
698
+ }
699
+
700
+ exports.Alert = ErrorAlert;
701
+ exports.AppCard = AppCard;
702
+ exports.AppDrawer = AppDrawer;
703
+ exports.AppGrid = AppGrid;
704
+ exports.AppMenu = AppMenu;
705
+ exports.AppTable = AppTable;
706
+ exports.AppTheme = AppTheme;
707
+ exports.AppWrapper = AppWrapper;
708
+ exports.DivTitle = DivTitle;
709
+ exports.Footer = Footer;
710
+ exports.ListMenu = ListMenu;
711
+ exports.MenuButton = MenuButton;
712
+ exports.NextListMenu = NextListMenu;
713
+ exports.Percentage = Percentage;
714
+ exports.PreferenceContext = PreferenceContext;
715
+ exports.Progress = Progress;
716
+ exports.PublicFetch = PublicFetch;
717
+ exports.RespGrid = RespGrid;
718
+ exports.SpecSwitch = SpecSwitch;
719
+ exports.Start = Start;
720
+ exports.TableHeadCell = TableHeadCell;
721
+ exports.createEmotionCache = createEmotionCache;
722
+ exports.useFetch = useFetch;
package/package.json CHANGED
@@ -1,67 +1,66 @@
1
1
  {
2
- "name": "@zac-apps/commons",
3
- "version": "1.0.1",
4
- "scripts": {
5
- "rollup": "node_modules/rollup/dist/rollup.js",
6
- "dev": "next dev",
7
- "build": "rollup -c",
8
- "start": "next start",
9
- "lint": "next lint",
10
- "storybook": "storybook dev -p 6006",
11
- "build-storybook": "storybook build",
12
- "semantic-release": "semantic-release"
13
- },
14
- "main": "dist/index.js",
15
- "publishConfig": {
16
- "access": "public"
17
- },
18
- "files": [
19
- "dist",
20
- "assets"
21
- ],
22
- "repository": {
23
- "type": "git",
24
- "url": "https://gitlab.rlp.net/liermann/zac-apps-commons.git"
25
- },
26
- "keywords": [
27
- "JGU"
28
- ],
29
- "author": "ZAC",
30
- "license": "CC-BY-SA-4.0",
31
- "dependencies": {
32
- "@emotion/styled": "^11.11.0",
33
- "@fontsource/roboto": "^5.0.8",
34
- "@mui/icons-material": "^5.14.16",
35
- "@mui/material": "^5.14.17",
36
- "@mui/x-date-pickers": "^6.18.1",
37
- "next": "14.0.3",
38
- "react": "^18",
39
- "react-dom": "^18"
40
- },
41
- "devDependencies": {
42
- "@babel/plugin-transform-runtime": "^7.23.4",
43
- "@rollup/plugin-babel": "^6.0.4",
44
- "@rollup/plugin-commonjs": "^25.0.7",
45
- "@rollup/plugin-json": "^6.0.1",
46
- "@rollup/plugin-node-resolve": "^15.2.3",
47
- "@semantic-release/git": "^10.0.1",
48
- "@semantic-release/gitlab": "^12.1.1",
49
- "@semantic-release/npm": "^11.0.1",
50
- "@storybook/addon-essentials": "^7.6.1",
51
- "@storybook/addon-interactions": "^7.6.1",
52
- "@storybook/addon-links": "^7.6.1",
53
- "@storybook/addon-onboarding": "^1.0.8",
54
- "@storybook/blocks": "^7.6.1",
55
- "@storybook/nextjs": "^7.6.1",
56
- "@storybook/react": "^7.6.1",
57
- "@storybook/test": "^7.6.1",
58
- "babel-loader": "^9.1.3",
59
- "eslint": "^8",
60
- "eslint-config-next": "14.0.3",
61
- "eslint-plugin-storybook": "^0.6.15",
62
- "rollup": "^4.6.0",
63
- "semantic-release": "^22.0.8",
64
- "storybook": "^7.6.1"
65
- },
66
- "description": "This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app)."
2
+ "name": "@zac-apps/commons",
3
+ "version": "1.0.2",
4
+ "scripts": {
5
+ "rollup": "node_modules/rollup/dist/rollup.js",
6
+ "dev": "next dev",
7
+ "build": "rollup -c",
8
+ "start": "next start",
9
+ "lint": "next lint",
10
+ "storybook": "storybook dev -p 6006",
11
+ "build-storybook": "storybook build",
12
+ "semantic-release": "semantic-release"
13
+ },
14
+ "main": "dist/index.js",
15
+ "publishConfig": {
16
+ "access": "public"
17
+ },
18
+ "files": [
19
+ "dist"
20
+ ],
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "https://gitlab.rlp.net/liermann/zac-apps-commons.git"
24
+ },
25
+ "keywords": [
26
+ "JGU"
27
+ ],
28
+ "author": "ZAC",
29
+ "license": "CC-BY-SA-4.0",
30
+ "dependencies": {
31
+ "@emotion/styled": "^11.11.0",
32
+ "@fontsource/roboto": "^5.0.8",
33
+ "@mui/icons-material": "^5.14.16",
34
+ "@mui/material": "^5.14.17",
35
+ "@mui/x-date-pickers": "^6.18.1",
36
+ "next": "14.0.3",
37
+ "react": "^18",
38
+ "react-dom": "^18"
39
+ },
40
+ "devDependencies": {
41
+ "@babel/plugin-transform-runtime": "^7.23.4",
42
+ "@rollup/plugin-babel": "^6.0.4",
43
+ "@rollup/plugin-commonjs": "^25.0.7",
44
+ "@rollup/plugin-json": "^6.0.1",
45
+ "@rollup/plugin-node-resolve": "^15.2.3",
46
+ "@semantic-release/git": "^10.0.1",
47
+ "@semantic-release/gitlab": "^12.1.1",
48
+ "@semantic-release/npm": "^11.0.1",
49
+ "@storybook/addon-essentials": "^7.6.1",
50
+ "@storybook/addon-interactions": "^7.6.1",
51
+ "@storybook/addon-links": "^7.6.1",
52
+ "@storybook/addon-onboarding": "^1.0.8",
53
+ "@storybook/blocks": "^7.6.1",
54
+ "@storybook/nextjs": "^7.6.1",
55
+ "@storybook/react": "^7.6.1",
56
+ "@storybook/test": "^7.6.1",
57
+ "babel-loader": "^9.1.3",
58
+ "eslint": "^8",
59
+ "eslint-config-next": "14.0.3",
60
+ "eslint-plugin-storybook": "^0.6.15",
61
+ "rollup": "^4.6.0",
62
+ "semantic-release": "^22.0.8",
63
+ "storybook": "^7.6.1"
64
+ },
65
+ "description": "This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app)."
67
66
  }
@@ -1,26 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <!-- Generator: Adobe Illustrator 27.2.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
- <svg version="1.1" id="Ebene_2_00000041285400425215995260000013550099538385769899_"
4
- xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 73.2 110.2"
5
- style="enable-background:new 0 0 73.2 110.2;" xml:space="preserve">
6
- <style type="text/css">
7
- .st0{fill:#636363;}
8
- </style>
9
- <g id="Ebene_1-2">
10
- <g>
11
- <path class="st0" d="M30.9,52.6v10.7c2.9-1.2,5.4-3.1,7.6-5.5v-0.7h0.6c1.4-1.7,2.6-3.6,3.4-5.8c0.3-0.6,0.6-1.2,0.8-1.8h-9.4
12
- C32.3,49.5,30.9,50.9,30.9,52.6L30.9,52.6z"/>
13
- <path class="st0" d="M28.4,52.6c0-3,2.5-5.5,5.5-5.5h10.1c1-4.6,0.5-10-2.2-13.5c1.4,5.5-4.3,11-9.9,8.7
14
- c-4.7-1.7-6.5-7.1-3.2-11.8c7.3-9.8,2-25.1-10.2-30.5c5.5,10.4-2.9,20.1-7.8,24.1c-4.8,4-8.1,8.2-9.1,10.6
15
- C-3.3,46.7,4,58.1,9,60.8c-2.3-5.2-4.4-15,4.5-24.2c0,0-2.6,9.8,3,16.7c5.6,6.8,5.5,11.9,5.5,11.9c2.1,0,4.3-0.3,6.3-0.9
16
- L28.4,52.6L28.4,52.6z"/>
17
- </g>
18
- <path class="st0" d="M65.7,69.3H38.4V57.1h27.2V69.3L65.7,69.3z M65.7,79.9h-4.5v-4.5h4.5V79.9L65.7,79.9z M65.7,87.4h-4.5v-4.5
19
- h4.5V87.4L65.7,87.4z M65.7,95h-4.5v-4.5h4.5V95L65.7,95z M65.7,102.6h-4.5V98h4.5V102.6L65.7,102.6z M58.1,79.9h-4.5v-4.5h4.5
20
- V79.9L58.1,79.9z M58.1,87.4h-4.5v-4.5h4.5V87.4L58.1,87.4z M58.1,95h-4.5v-4.5h4.5V95L58.1,95z M58.1,102.6h-4.5V98h4.5V102.6
21
- L58.1,102.6z M50.5,79.8H46v-4.5h4.5V79.8L50.5,79.8z M50.5,87.4H46v-4.5h4.5V87.4L50.5,87.4z M50.5,95H46v-4.5h4.5V95L50.5,95z
22
- M50.5,102.6H38.4V98h12.1V102.6L50.5,102.6z M38.4,90.4H43V95h-4.5V90.4L38.4,90.4z M38.4,82.9H43v4.5h-4.5V82.9L38.4,82.9z
23
- M38.4,75.3H43v4.5h-4.5V75.3L38.4,75.3z M70.2,49.5H33.9c-1.7,0-3,1.4-3,3v54.5c0,1.7,1.4,3,3,3h36.3c1.7,0,3-1.4,3-3V52.6
24
- C73.2,50.9,71.9,49.5,70.2,49.5L70.2,49.5z"/>
25
- </g>
26
- </svg>
@@ -1,36 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <!-- Generator: Adobe Illustrator 27.2.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
- <svg version="1.1" id="Ebene_2_00000039106019328201254260000005025511527933610673_"
4
- xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 85.5 106.1"
5
- style="enable-background:new 0 0 85.5 106.1;" xml:space="preserve">
6
- <style type="text/css">
7
- .st0{fill:#636363;}
8
- </style>
9
- <g id="Ebene_1-2">
10
- <g>
11
- <path class="st0" d="M19.6,13.6c0,2.5-2,4.5-4.5,4.5s-4.5-2-4.5-4.5s2-4.5,4.5-4.5S19.6,11.1,19.6,13.6L19.6,13.6z"/>
12
- <path class="st0" d="M15.1,2.3c0,1.3-1,2.3-2.3,2.3s-2.3-1-2.3-2.3s1-2.3,2.3-2.3S15.1,1,15.1,2.3L15.1,2.3z"/>
13
- <path class="st0" d="M28,15.9c0,1.3-1,2.3-2.3,2.3s-2.3-1-2.3-2.3s1-2.3,2.3-2.3S28,14.7,28,15.9L28,15.9z"/>
14
- <path class="st0" d="M30.2,6.1c0,1.7-1.4,3-3,3s-3-1.4-3-3s1.4-3,3-3S30.2,4.4,30.2,6.1C30.2,6.1,30.2,6.1,30.2,6.1z"/>
15
- </g>
16
- <g>
17
- <polygon class="st0" points="49,106.1 41.8,98.8 48.2,92.4 55.5,99.6 49,106.1 "/>
18
- <g>
19
- <path class="st0" d="M46.1,90.3L35,79.2c-6.5-6.5-6.5-17,0-23.6c6.5-6.5,17-6.5,23.5,0l11.1,11.1l6.4-6.4L65,49.2
20
- c-10.1-10.1-26.3-10.1-36.4,0s-10.1,26.4,0,36.4l11,11.1L46.1,90.3L46.1,90.3L46.1,90.3z"/>
21
- <g>
22
- <path class="st0" d="M33.3,53.9c1.8-1.8,3.9-3.2,6.1-4.1v-4.4c-3.4,1.1-6.4,3-9,5.6c-0.2,0.2-0.3,0.4-0.5,0.5h1.9v3h-4.3
23
- c-0.6,1-1.2,2-1.7,3h4.6C31.2,56.2,32.1,55,33.3,53.9L33.3,53.9z"/>
24
- <path class="st0" d="M39.4,62.1v-6.8c-0.9,0.6-1.8,1.2-2.6,2c-2.6,2.6-3.9,5.9-4.1,9.2h2.2C37.4,66.6,39.4,64.6,39.4,62.1z"/>
25
- <path class="st0" d="M22.7,52.7v-1.2h0.8c0.7-1,1.5-2.1,2.4-3h-3.2v-3H29c3.1-2.5,6.6-4.3,10.4-5.3V27.3c0-2.7,2.1-3.9,2.2-3.9
26
- c0.5-0.4,0.9-1.1,0.7-1.7c-0.2-0.7-0.8-1.1-1.4-1.1H1.5c-0.7,0-1.3,0.5-1.4,1.1s0.2,1.4,0.8,1.7c0,0,2.3,1.3,2.3,4v34.8
27
- c0,2.5,2,4.5,4.5,4.5h11C18.7,61.8,20.1,57,22.7,52.7L22.7,52.7z M31.8,42.4h-9.1v-3h9.1V42.4z M31.8,36.3h-9.1v-3h9.1V36.3z
28
- M6,29.5v-2.3c0-1.5-0.4-2.8-1-3.8h32.2c-0.5,1-1,2.3-1,3.8v1.4c-2.3-0.9-6.1-2.2-9.8-2.2c-4.1,0-6.6,0.7-9.2,1.4
29
- C14.5,28.6,11.6,29.4,6,29.5z"/>
30
- <path class="st0" d="M28.9,60.6h-4.3c-0.6,2-0.9,4-1,6.1h4.1C27.8,64.6,28.2,62.5,28.9,60.6z"/>
31
- </g>
32
- </g>
33
- <polygon class="st0" points="71.8,68.9 78.3,62.5 85.5,69.7 79.1,76.1 71.8,68.9 "/>
34
- </g>
35
- </g>
36
- </svg>