@popmenu/dashboard 0.31.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.
@@ -0,0 +1,801 @@
1
+ import * as React from 'react';
2
+ import React__default, { createElement, forwardRef } from 'react';
3
+ import '@material-ui/lab/Alert';
4
+ import { makeStyles, Typography as Typography$1, Link as Link$1, Paper as Paper$1, Box } from '@material-ui/core';
5
+ import '@material-ui/core/AppBar';
6
+ import MuiAvatar from '@material-ui/core/Avatar';
7
+ import { makeStyles as makeStyles$1, useTheme } from '@material-ui/core/styles';
8
+ import '@material-ui/core/Badge';
9
+ import MuiButton from '@material-ui/core/Button';
10
+ import CircularProgress from '@material-ui/core/CircularProgress';
11
+ import '@material-ui/core/ButtonGroup';
12
+ import Card from '@material-ui/core/Card';
13
+ import '@material-ui/core/CardActionArea';
14
+ import '@material-ui/core/CardActions';
15
+ import CardContent from '@material-ui/core/CardContent';
16
+ import '@material-ui/core/CardHeader';
17
+ import '@material-ui/core/CardMedia';
18
+ import MuiCheckbox from '@material-ui/core/Checkbox';
19
+ import FormControlLabel from '@material-ui/core/FormControlLabel';
20
+ import '@material-ui/core/Chip';
21
+ import '@material-ui/core/Collapse';
22
+ import '@material-ui/core/Dialog';
23
+ import '@material-ui/core/DialogActions';
24
+ import '@material-ui/core/DialogContent';
25
+ import '@material-ui/core/DialogTitle';
26
+ import '@material-ui/core/Drawer';
27
+ import '@material-ui/core/FormControl';
28
+ import '@material-ui/core/Grid';
29
+ import MuiIconButton from '@material-ui/core/IconButton';
30
+ import '@material-ui/core/InputAdornment';
31
+ import '@material-ui/core/LinearProgress';
32
+ import '@material-ui/core/List';
33
+ import '@material-ui/core/ListItem';
34
+ import '@material-ui/core/ListItemIcon';
35
+ import '@material-ui/core/ListItemSecondaryAction';
36
+ import '@material-ui/core/ListItemText';
37
+ import '@material-ui/core/Menu';
38
+ import '@material-ui/core/MenuItem';
39
+ import '@material-ui/core/MenuList';
40
+ import MuiRadio from '@material-ui/core/Radio';
41
+ import '@material-ui/core/TextField';
42
+ import MuiSwitch from '@material-ui/core/Switch';
43
+ import '@material-ui/core/Tab';
44
+ import '@material-ui/core/Tabs';
45
+ import MuiToggleButton from '@material-ui/lab/ToggleButton';
46
+ import MuiToggleButtonGroup from '@material-ui/lab/ToggleButtonGroup';
47
+ import MuiTooltip from '@material-ui/core/Tooltip';
48
+
49
+ /*! *****************************************************************************
50
+ Copyright (c) Microsoft Corporation.
51
+
52
+ Permission to use, copy, modify, and/or distribute this software for any
53
+ purpose with or without fee is hereby granted.
54
+
55
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
56
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
57
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
58
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
59
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
60
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
61
+ PERFORMANCE OF THIS SOFTWARE.
62
+ ***************************************************************************** */
63
+
64
+ var __assign$1 = function() {
65
+ __assign$1 = Object.assign || function __assign(t) {
66
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
67
+ s = arguments[i];
68
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
69
+ }
70
+ return t;
71
+ };
72
+ return __assign$1.apply(this, arguments);
73
+ };
74
+
75
+ function __rest$1(s, e) {
76
+ var t = {};
77
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
78
+ t[p] = s[p];
79
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
80
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
81
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
82
+ t[p[i]] = s[p[i]];
83
+ }
84
+ return t;
85
+ }
86
+
87
+ var _path$D;
88
+
89
+ function _extends$16() { _extends$16 = 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$16.apply(this, arguments); }
90
+
91
+ function SvgUser(props) {
92
+ return /*#__PURE__*/React.createElement("svg", _extends$16({
93
+ viewBox: "0 0 16 16",
94
+ fill: "none",
95
+ strokeLinecap: "round",
96
+ strokeLinejoin: "round",
97
+ width: "1em",
98
+ height: "1em"
99
+ }, props), _path$D || (_path$D = /*#__PURE__*/React.createElement("path", {
100
+ d: "M13.333 14v-1.333A2.667 2.667 0 0010.667 10H5.333a2.667 2.667 0 00-2.666 2.667V14M8 7.333A2.667 2.667 0 108 2a2.667 2.667 0 000 5.333z",
101
+ stroke: "currentColor"
102
+ })));
103
+ }
104
+
105
+ var useIconStyles = makeStyles(function (_a) {
106
+ var spacing = _a.spacing, palette = _a.palette;
107
+ var getFontSize = function (_a) {
108
+ var size = _a.size;
109
+ var sizes = {
110
+ inherit: 'inherit',
111
+ small: spacing(1.5),
112
+ medium: spacing(2),
113
+ large: spacing(2.5),
114
+ 'extra-large': spacing(3),
115
+ };
116
+ return size ? sizes[size] : 'inherit';
117
+ };
118
+ var getColor = function (props) {
119
+ var semanticColors = ['primary', 'secondary', 'info', 'success', 'warning', 'error'];
120
+ var value = 'inherit';
121
+ if (props.color) {
122
+ if (semanticColors.includes(props.color.split('.')[0])) {
123
+ var _a = props.color.split('.'), color = _a[0], _b = _a[1], variant = _b === void 0 ? 'main' : _b;
124
+ value = palette[color][variant];
125
+ }
126
+ else if (props.color.search(/^(rgb|hsla|#)/) !== -1) {
127
+ value = props.color;
128
+ }
129
+ }
130
+ return value;
131
+ };
132
+ return {
133
+ root: {
134
+ color: getColor,
135
+ fontSize: getFontSize,
136
+ strokeWidth: '1.3px',
137
+ },
138
+ };
139
+ });
140
+
141
+ var classnames = {exports: {}};
142
+
143
+ /*!
144
+ Copyright (c) 2018 Jed Watson.
145
+ Licensed under the MIT License (MIT), see
146
+ http://jedwatson.github.io/classnames
147
+ */
148
+
149
+ (function (module) {
150
+ /* global define */
151
+
152
+ (function () {
153
+
154
+ var hasOwn = {}.hasOwnProperty;
155
+
156
+ function classNames() {
157
+ var classes = [];
158
+
159
+ for (var i = 0; i < arguments.length; i++) {
160
+ var arg = arguments[i];
161
+ if (!arg) continue;
162
+
163
+ var argType = typeof arg;
164
+
165
+ if (argType === 'string' || argType === 'number') {
166
+ classes.push(arg);
167
+ } else if (Array.isArray(arg)) {
168
+ if (arg.length) {
169
+ var inner = classNames.apply(null, arg);
170
+ if (inner) {
171
+ classes.push(inner);
172
+ }
173
+ }
174
+ } else if (argType === 'object') {
175
+ if (arg.toString === Object.prototype.toString) {
176
+ for (var key in arg) {
177
+ if (hasOwn.call(arg, key) && arg[key]) {
178
+ classes.push(key);
179
+ }
180
+ }
181
+ } else {
182
+ classes.push(arg.toString());
183
+ }
184
+ }
185
+ }
186
+
187
+ return classes.join(' ');
188
+ }
189
+
190
+ if (module.exports) {
191
+ classNames.default = classNames;
192
+ module.exports = classNames;
193
+ } else {
194
+ window.classNames = classNames;
195
+ }
196
+ }());
197
+ }(classnames));
198
+
199
+ var classNames = classnames.exports;
200
+
201
+ var iconStaticClassName = 'pop-icon';
202
+ var Icon = function (props) {
203
+ var icon = props.icon, className = props.className, restProps = __rest$1(props, ["icon", "className"]);
204
+ var classes = useIconStyles(props);
205
+ var isValid = true;
206
+ if (!icon || (typeof icon === 'function' && icon({}) === undefined)) {
207
+ isValid = false;
208
+ }
209
+ return isValid
210
+ ? createElement(icon, __assign$1({ className: classNames([classes.root, iconStaticClassName, className]) }, restProps))
211
+ : null;
212
+ };
213
+ Icon.defaultProps = {
214
+ size: 'inherit',
215
+ color: 'inherit',
216
+ };
217
+ Icon.displayName = 'Icon';
218
+
219
+ var LoadingStatus;
220
+ (function (LoadingStatus) {
221
+ LoadingStatus["ERROR"] = "ERROR";
222
+ LoadingStatus["LOADED"] = "LOADED";
223
+ LoadingStatus["PENDING"] = "PENDING";
224
+ })(LoadingStatus || (LoadingStatus = {}));
225
+ var useImgProps = function (avatarProps) {
226
+ var _a = React__default.useState(LoadingStatus.PENDING), loaded = _a[0], setLoaded = _a[1];
227
+ var imgProps = __assign$1(__assign$1({}, avatarProps.imgProps), { onLoad: function (event) {
228
+ var _a, _b;
229
+ setLoaded(LoadingStatus.LOADED);
230
+ (_b = (_a = avatarProps.imgProps) === null || _a === void 0 ? void 0 : _a.onLoad) === null || _b === void 0 ? void 0 : _b.call(_a, event);
231
+ } });
232
+ return { imgProps: imgProps, loaded: loaded };
233
+ };
234
+
235
+ var getAvatarDimensions = function (theme, props) {
236
+ var factors = {
237
+ 'extra-small': 3,
238
+ small: 4,
239
+ medium: 5,
240
+ large: 6,
241
+ 'extra-large': 12.5,
242
+ };
243
+ var sizeFactor = factors[props.size || 'medium'];
244
+ return theme.spacing(sizeFactor);
245
+ };
246
+ var getAvatarFontSize = function (props) {
247
+ var fontSizes = {
248
+ 'extra-small': '0.75rem',
249
+ small: '1rem',
250
+ medium: '1rem',
251
+ large: '1.25rem',
252
+ 'extra-large': '3.5rem',
253
+ };
254
+ return fontSizes[props.size];
255
+ };
256
+ var useAvatarStyles = makeStyles$1(function (theme) { return ({
257
+ root: function (props) { return ({
258
+ width: getAvatarDimensions(theme, props),
259
+ height: getAvatarDimensions(theme, props),
260
+ fontSize: getAvatarFontSize(props),
261
+ backgroundColor: props.loaded === LoadingStatus.LOADED ? 'transparent' : props.background,
262
+ color: theme.palette.getContrastText(props.background),
263
+ objectFit: props.fit,
264
+ }); },
265
+ fallback: function (props) { return ({
266
+ fontSize: getAvatarDimensions(theme, props),
267
+ strokeWidth: 1,
268
+ }); },
269
+ }); });
270
+
271
+ var Avatar = forwardRef(function (props, ref) {
272
+ var children = props.children, src = props.src, alt = props.alt, fallback = props.fallback, muiProps = __rest$1(props, ["children", "src", "alt", "fallback"]);
273
+ var _a = useImgProps(props), imgProps = _a.imgProps, loaded = _a.loaded;
274
+ var classes = useAvatarStyles(__assign$1(__assign$1({}, props), { loaded: loaded }));
275
+ var displayAltTextFallback = src && alt;
276
+ var displayNoFallback = fallback === 'none';
277
+ var displayCustomFallback = fallback !== 'none' && typeof fallback !== 'undefined';
278
+ var Fallback;
279
+ if (displayAltTextFallback) {
280
+ Fallback = null;
281
+ }
282
+ else if (displayNoFallback) {
283
+ Fallback = ' ';
284
+ }
285
+ else if (displayCustomFallback) {
286
+ Fallback = fallback;
287
+ }
288
+ else {
289
+ Fallback = React__default.createElement(Icon, { icon: SvgUser, className: classes.fallback });
290
+ }
291
+ return (React__default.createElement(MuiAvatar, __assign$1({ ref: ref, classes: { root: classes.root }, src: src, alt: alt }, muiProps, { imgProps: imgProps }), children || Fallback));
292
+ });
293
+ Avatar.defaultProps = {
294
+ size: 'medium',
295
+ fit: 'cover',
296
+ background: '#E0E0E0',
297
+ };
298
+ Avatar.displayName = 'Avatar';
299
+
300
+ var useButtonStyles = makeStyles$1(function () { return ({
301
+ root: {
302
+ minWidth: 'unset',
303
+ },
304
+ label: {
305
+ textTransform: function (_a) {
306
+ var textTransform = _a.textTransform;
307
+ return textTransform;
308
+ },
309
+ },
310
+ }); });
311
+
312
+ var Button = forwardRef(function (props, ref) {
313
+ props.textTransform; var loading = props.loading, classesOverride = props.classes, className = props.className, muiProps = __rest$1(props, ["textTransform", "loading", "classes", "className"]);
314
+ props.classes; var styleProps = __rest$1(props, ["classes"]);
315
+ var classes = useButtonStyles(styleProps);
316
+ var typography = useTheme().typography;
317
+ var loadingIndicator = {
318
+ startIcon: React__default.createElement(CircularProgress, { color: "inherit", size: typography.button.fontSize }),
319
+ disabled: true,
320
+ };
321
+ return (React__default.createElement(MuiButton, __assign$1({ ref: ref, classes: __assign$1(__assign$1({}, classes), classesOverride), className: classNames([className, 'pm-button']) }, muiProps, (loading && loadingIndicator))));
322
+ });
323
+ Button.displayName = 'Button';
324
+
325
+ var Checkbox = forwardRef(function (props, ref) {
326
+ var label = props.label, disabled = props.disabled, LabelProps = props.LabelProps, muiProps = __rest$1(props, ["label", "disabled", "LabelProps"]);
327
+ var control = React__default.createElement(MuiCheckbox, __assign$1({ disabled: label ? undefined : disabled }, muiProps));
328
+ return label ? (React__default.createElement(FormControlLabel, __assign$1({ disabled: disabled, inputRef: ref, control: control, label: label }, LabelProps))) : (control);
329
+ });
330
+ Checkbox.displayName = 'Checkbox';
331
+
332
+ var defaultTypographyProps = {
333
+ variant: 'body1',
334
+ };
335
+
336
+ var weights = {
337
+ regular: 400,
338
+ medium: 500,
339
+ 'semi-bold': 600,
340
+ bold: 700,
341
+ };
342
+ var getCustomColor = function (theme, color) {
343
+ var isCommonColor = color && ['white', 'black'].includes(color);
344
+ var isGreyColor = color && color.match(/^grey\.\d{3}/);
345
+ var isSemanticColor = color && color.match(/(primary|secondary|info|success|error|warning).?(light|dark)?/);
346
+ var isTextColor = color && ['textPrimary', 'textSecondary'].includes(color);
347
+ switch (true) {
348
+ case isCommonColor:
349
+ return theme.palette.common[color];
350
+ case Boolean(isGreyColor):
351
+ var scale = color.split('.')[1];
352
+ return theme.palette.grey[scale] || theme.palette.grey[900];
353
+ case Boolean(isSemanticColor):
354
+ var _a = color.split('.'), paletteKey = _a[0], _b = _a[1], variant = _b === void 0 ? 'main' : _b;
355
+ return theme.palette[paletteKey][variant];
356
+ case isTextColor:
357
+ return theme.palette.text[color.slice(4).toLowerCase()];
358
+ default:
359
+ return undefined;
360
+ }
361
+ };
362
+ var useTypographyStyles = makeStyles$1(function (theme) {
363
+ var _a;
364
+ return ({
365
+ root: (_a = {},
366
+ _a["& ." + iconStaticClassName] = {
367
+ position: 'relative',
368
+ top: '0.125em',
369
+ padding: '0 0.125em',
370
+ boxSizing: 'content-box',
371
+ },
372
+ _a.fontFamily = theme.typography.fontFamily,
373
+ _a.fontWeight = function (_a) {
374
+ var variant = _a.variant, weight = _a.weight;
375
+ return (weight ? weights[weight] : theme.typography[variant].fontWeight);
376
+ },
377
+ _a.fontSize = function (_a) {
378
+ var variant = _a.variant;
379
+ return theme.typography[variant].fontSize;
380
+ },
381
+ _a.lineHeight = function (_a) {
382
+ var variant = _a.variant;
383
+ return theme.typography[variant].lineHeight;
384
+ },
385
+ _a.textTransform = function (_a) {
386
+ var variant = _a.variant;
387
+ return theme.typography[variant].textTransform;
388
+ },
389
+ _a.color = function (_a) {
390
+ var color = _a.color, variant = _a.variant;
391
+ return (color && getCustomColor(theme, color)) || theme.typography[variant].color;
392
+ },
393
+ _a),
394
+ caption: {
395
+ display: 'inline',
396
+ },
397
+ overline: {
398
+ display: 'inline',
399
+ },
400
+ });
401
+ });
402
+
403
+ var Typography = forwardRef(function (props, ref) {
404
+ props.weight; props.color; var restProps = __rest$1(props, ["weight", "color"]);
405
+ var classes = useTypographyStyles(__assign$1({}, props));
406
+ var variantMapping = { subtitle1: 'p' };
407
+ return React__default.createElement(Typography$1, __assign$1({ ref: ref, classes: classes, variantMapping: variantMapping }, restProps));
408
+ });
409
+ Typography.displayName = 'Typography';
410
+ Typography.defaultProps = defaultTypographyProps;
411
+
412
+ var getFadeStop = function (_a, typographyVariant) {
413
+ var typography = _a.typography;
414
+ return !isNaN(Number(typography[typographyVariant].lineHeight))
415
+ ? typography[typographyVariant].lineHeight + "rem"
416
+ : typography[typographyVariant].lineHeight;
417
+ };
418
+ makeStyles(function (theme) { return ({
419
+ overlay: {
420
+ position: 'absolute',
421
+ top: 0,
422
+ left: 0,
423
+ height: '100%',
424
+ width: '100%',
425
+ background: function (props) { return "linear-gradient(to top, white, #FFF0 " + getFadeStop(theme, props.typographyVariant) + ")"; },
426
+ },
427
+ }); });
428
+
429
+ var SemanticColors;
430
+ (function (SemanticColors) {
431
+ SemanticColors["PRIMARY_MAIN"] = "primary.main";
432
+ SemanticColors["PRIMARY_DARK"] = "primary.dark";
433
+ SemanticColors["PRIMARY_LIGHT"] = "primary.light";
434
+ SemanticColors["SECONDARY_MAIN"] = "secondary.main";
435
+ SemanticColors["SECONDARY_DARK"] = "secondary.dark";
436
+ SemanticColors["SECONDARY_LIGHT"] = "secondary.light";
437
+ })(SemanticColors || (SemanticColors = {}));
438
+ makeStyles(function (theme) { return ({
439
+ dividerRoot: {
440
+ gap: theme.spacing(2),
441
+ },
442
+ textRoot: {
443
+ color: function (props) {
444
+ var textColor = props.textColor;
445
+ if (Object.values(SemanticColors).includes(textColor)) {
446
+ var _a = textColor.split('.'), semanticColor = _a[0], shade = _a[1];
447
+ return theme.palette[semanticColor][shade];
448
+ }
449
+ else if (textColor) {
450
+ return textColor;
451
+ }
452
+ else {
453
+ return 'black';
454
+ }
455
+ },
456
+ textTransform: function (props) { return props.textTransform; },
457
+ },
458
+ dividerLine: {
459
+ backgroundColor: function (props) {
460
+ var dividerColor = props.dividerColor;
461
+ if (Object.values(SemanticColors).includes(dividerColor)) {
462
+ var _a = dividerColor.split('.'), semanticColor = _a[0], shade = _a[1];
463
+ return theme.palette[semanticColor][shade];
464
+ }
465
+ else if (dividerColor) {
466
+ return dividerColor;
467
+ }
468
+ else {
469
+ return theme.palette.grey[500];
470
+ }
471
+ },
472
+ },
473
+ }); });
474
+
475
+ var IconButton = forwardRef(function (props, ref) {
476
+ return React__default.createElement(MuiIconButton, __assign$1({ ref: ref }, props));
477
+ });
478
+ IconButton.displayName = 'IconButton';
479
+ IconButton.defaultProps = {
480
+ color: 'secondary',
481
+ };
482
+
483
+ var useLinkStyles = makeStyles$1(function (theme) { return ({
484
+ root: function (props) {
485
+ var _a;
486
+ return (__assign$1(__assign$1({ display: 'flex' }, (props.color === undefined && { color: theme.palette.info.main })), (_a = {}, _a["& ." + iconStaticClassName] = {
487
+ alignSelf: 'center',
488
+ }, _a)));
489
+ },
490
+ }); });
491
+
492
+ var Link = forwardRef(function (props, ref) {
493
+ var children = props.children, muiProps = __rest$1(props, ["children"]);
494
+ var classes = useLinkStyles(props);
495
+ return (React__default.createElement(Link$1, __assign$1({ ref: ref, classes: { root: classes.root } }, muiProps), children));
496
+ });
497
+ Link.defaultProps = {
498
+ variant: 'body1',
499
+ };
500
+ Link.displayName = 'Link';
501
+
502
+ var useStyles = makeStyles(function (_a) {
503
+ var spacing = _a.spacing;
504
+ return ({
505
+ root: {
506
+ '&:last-child': {
507
+ marginBottom: 0,
508
+ },
509
+ marginBottom: spacing(4),
510
+ padding: spacing(4),
511
+ },
512
+ });
513
+ });
514
+ var Paper = forwardRef(function (props, ref) {
515
+ var legacyStyles = props.legacyStyles, restProps = __rest$1(props, ["legacyStyles"]);
516
+ var classes = useStyles(props);
517
+ return React__default.createElement(Paper$1, __assign$1({}, ref, { classes: __assign$1({}, (legacyStyles && classes)) }, restProps));
518
+ });
519
+ Paper.displayName = 'Paper';
520
+ Paper.defaultProps = {
521
+ legacyStyles: false,
522
+ };
523
+
524
+ var Radio = forwardRef(function (props, ref) {
525
+ var label = props.label, disabled = props.disabled, LabelProps = props.LabelProps, muiProps = __rest$1(props, ["label", "disabled", "LabelProps"]);
526
+ var control = React__default.createElement(MuiRadio, __assign$1({ disabled: label ? undefined : disabled }, muiProps));
527
+ return label ? (React__default.createElement(FormControlLabel, __assign$1({ disabled: disabled, inputRef: ref, control: control, label: label }, LabelProps))) : (control);
528
+ });
529
+ Radio.displayName = 'Radio';
530
+
531
+ makeStyles$1(function () { return ({
532
+ textfield: {
533
+ background: function (props) { return (props.backgroundTransparency ? '#FFFFFF44' : 'none'); },
534
+ borderTopLeftRadius: 4,
535
+ borderBottomLeftRadius: 4,
536
+ '& fieldset': {
537
+ borderRight: 'none',
538
+ borderTopRightRadius: 0,
539
+ borderBottomRightRadius: 0,
540
+ },
541
+ },
542
+ button: {
543
+ borderTopLeftRadius: 0,
544
+ borderBottomLeftRadius: 0,
545
+ alignSelf: 'stretch',
546
+ },
547
+ input: {
548
+ color: function (props) { return props.inputTextColor || 'inherit'; },
549
+ '&$focused fieldset': {
550
+ top: -4,
551
+ },
552
+ },
553
+ focused: {},
554
+ }); });
555
+
556
+ var useSwitchStyles = makeStyles$1(function (theme) { return ({
557
+ checked: {
558
+ '& $thumb': {
559
+ background: theme.palette.success.main,
560
+ },
561
+ '&& + $track': {
562
+ backgroundColor: theme.palette.success.main,
563
+ },
564
+ },
565
+ thumb: {},
566
+ track: {},
567
+ }); });
568
+
569
+ var Switch = forwardRef(function (props, ref) {
570
+ var label = props.label, disabled = props.disabled, LabelProps = props.LabelProps, muiProps = __rest$1(props, ["label", "disabled", "LabelProps"]);
571
+ var classes = useSwitchStyles(props);
572
+ var control = React__default.createElement(MuiSwitch, __assign$1({ classes: classes, disabled: label ? undefined : disabled }, muiProps));
573
+ return label ? (React__default.createElement(FormControlLabel, __assign$1({ disabled: disabled, inputRef: ref, control: control, label: label }, LabelProps))) : (control);
574
+ });
575
+ Switch.displayName = 'Switch';
576
+
577
+ var useToggleButtonStyles = makeStyles$1(function (theme) { return ({
578
+ root: {
579
+ color: theme.palette.text.primary,
580
+ },
581
+ selected: {
582
+ '&&': {
583
+ '&:hover': {
584
+ backgroundColor: function (props) { return theme.palette[props.color || 'primary'].dark; },
585
+ },
586
+ backgroundColor: function (props) { return theme.palette[props.color || 'primary'].main; },
587
+ color: 'white',
588
+ },
589
+ },
590
+ }); });
591
+
592
+ var ToggleButton = forwardRef(function (props, ref) {
593
+ var children = props.children, muiProps = __rest$1(props, ["children"]);
594
+ var classes = useToggleButtonStyles(props);
595
+ return (React__default.createElement(MuiToggleButton, __assign$1({ ref: ref, classes: {
596
+ root: classes.root,
597
+ selected: classes.selected,
598
+ } }, muiProps), children));
599
+ });
600
+ ToggleButton.defaultProps = {
601
+ color: 'primary',
602
+ };
603
+ ToggleButton.displayName = 'ToggleButton';
604
+
605
+ var useToggleButtonGroupStyles = makeStyles$1(function (theme) { return ({
606
+ root: {
607
+ '&&': {
608
+ backgroundColor: theme.palette.grey[300],
609
+ },
610
+ },
611
+ }); });
612
+
613
+ var ToggleButtonGroup = forwardRef(function (props, ref) {
614
+ var children = props.children, _a = props.color, color = _a === void 0 ? 'primary' : _a, muiProps = __rest$1(props, ["children", "color"]);
615
+ var classes = useToggleButtonGroupStyles(props);
616
+ var childrenWithProps = React__default.Children.map(children, function (child) {
617
+ if (!React__default.isValidElement(child)) {
618
+ return null;
619
+ }
620
+ return React__default.cloneElement(child, { color: color });
621
+ });
622
+ return (React__default.createElement(MuiToggleButtonGroup, __assign$1({ ref: ref, classes: { root: classes.root } }, muiProps), childrenWithProps));
623
+ });
624
+ ToggleButtonGroup.displayName = 'ToggleButtonGroup';
625
+
626
+ var useTooltipStyles = makeStyles$1(function (_a) {
627
+ var typography = _a.typography;
628
+ return ({
629
+ tooltip: {
630
+ fontSize: typography.pxToRem(16),
631
+ },
632
+ });
633
+ });
634
+
635
+ var Tooltip = forwardRef(function (props, ref) {
636
+ var classes = useTooltipStyles(props);
637
+ return React__default.createElement(MuiTooltip, __assign$1({ ref: ref, classes: classes }, props));
638
+ });
639
+ Tooltip.displayName = 'Tooltip';
640
+
641
+ makeStyles(function () { return ({
642
+ root: {
643
+ height: 56,
644
+ },
645
+ }); });
646
+ makeStyles(function (theme) { return ({
647
+ root: {
648
+ height: '100%',
649
+ width: 'min-content',
650
+ borderRadius: theme.spacing(1),
651
+ },
652
+ input: {
653
+ '&::-webkit-clear-button, &::-webkit-outer-spin-button, &::-webkit-inner-spin-button': {
654
+ display: 'none',
655
+ },
656
+ '-moz-appearance': 'textfield',
657
+ minWidth: 40,
658
+ padding: 0,
659
+ textAlign: 'center',
660
+ },
661
+ adornedStart: {
662
+ padding: 0,
663
+ },
664
+ adornedEnd: {
665
+ padding: 0,
666
+ },
667
+ }); });
668
+
669
+ var _g$w;
670
+
671
+ function _extends$18() { _extends$18 = 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$18.apply(this, arguments); }
672
+
673
+ function SvgTrend(props) {
674
+ return /*#__PURE__*/React.createElement("svg", _extends$18({
675
+ viewBox: "0 0 16 16",
676
+ fill: "none",
677
+ strokeLinecap: "round",
678
+ strokeLinejoin: "round",
679
+ width: "1em",
680
+ height: "1em"
681
+ }, props), _g$w || (_g$w = /*#__PURE__*/React.createElement("g", {
682
+ stroke: "currentColor"
683
+ }, /*#__PURE__*/React.createElement("path", {
684
+ d: "M15.333 4L9 10.333 5.667 7l-5 5"
685
+ }), /*#__PURE__*/React.createElement("path", {
686
+ d: "M11.333 4h4v4"
687
+ }))));
688
+ }
689
+
690
+ var _g$v;
691
+
692
+ function _extends$17() { _extends$17 = 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$17.apply(this, arguments); }
693
+
694
+ function SvgTrendDown(props) {
695
+ return /*#__PURE__*/React.createElement("svg", _extends$17({
696
+ viewBox: "0 0 16 16",
697
+ fill: "none",
698
+ strokeLinecap: "round",
699
+ strokeLinejoin: "round",
700
+ width: "1em",
701
+ height: "1em"
702
+ }, props), _g$v || (_g$v = /*#__PURE__*/React.createElement("g", {
703
+ stroke: "currentColor"
704
+ }, /*#__PURE__*/React.createElement("path", {
705
+ d: "M15.333 12L9 5.667 5.667 9l-5-5"
706
+ }), /*#__PURE__*/React.createElement("path", {
707
+ d: "M11.333 12h4V8"
708
+ }))));
709
+ }
710
+
711
+ var useKpiMetricStyles = makeStyles(function (theme) { return ({
712
+ trendIcon: {
713
+ '&&': {
714
+ paddingInlineEnd: theme.spacing(1),
715
+ },
716
+ },
717
+ }); });
718
+
719
+ var defaultProps = {
720
+ trendStatus: 'natural',
721
+ trendMessage: 'data unavailable',
722
+ };
723
+ var KpiMetric = function (props) {
724
+ var KpiIcon = props.Icon, metric = props.metric, value = props.value, trend = props.trend, trendMessage = props.trendMessage, trendStatus = props.trendStatus;
725
+ var classes = useKpiMetricStyles(props);
726
+ var trendColors = trendStatus === 'natural' ? ['success', 'warning'] : ['warning', 'success'];
727
+ var trendColorMap = { up: 0, down: 1, level: 1 };
728
+ return (React__default.createElement(Box, { display: "flex", flexDirection: "column", alignItems: "center", fontSize: '0.75rem' },
729
+ KpiIcon && (React__default.createElement(Box, { fontSize: 24, display: "flex", bgcolor: "grey.100", borderRadius: "50%", padding: 2, mb: 2 },
730
+ React__default.createElement(Icon, { icon: KpiIcon, size: "inherit" }))),
731
+ React__default.createElement(Typography, { color: "secondary.light", variant: "body2" }, metric),
732
+ React__default.createElement(Typography, { color: "secondary", variant: "h4" }, value ? value : '-'),
733
+ React__default.createElement(Typography, { style: { fontSize: 'inherit' }, variant: "body2", color: trend ? trendColors[trendColorMap[trend]] : 'grey.500' },
734
+ trend === 'up' && React__default.createElement(Icon, { className: classes.trendIcon, icon: SvgTrend, size: "inherit" }),
735
+ trend === 'down' && React__default.createElement(Icon, { className: classes.trendIcon, icon: SvgTrendDown, size: "inherit" }),
736
+ trendMessage)));
737
+ };
738
+ KpiMetric.defaultProps = defaultProps;
739
+
740
+ /*! *****************************************************************************
741
+ Copyright (c) Microsoft Corporation.
742
+
743
+ Permission to use, copy, modify, and/or distribute this software for any
744
+ purpose with or without fee is hereby granted.
745
+
746
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
747
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
748
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
749
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
750
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
751
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
752
+ PERFORMANCE OF THIS SOFTWARE.
753
+ ***************************************************************************** */
754
+
755
+ var __assign = function() {
756
+ __assign = Object.assign || function __assign(t) {
757
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
758
+ s = arguments[i];
759
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
760
+ }
761
+ return t;
762
+ };
763
+ return __assign.apply(this, arguments);
764
+ };
765
+
766
+ function __rest(s, e) {
767
+ var t = {};
768
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
769
+ t[p] = s[p];
770
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
771
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
772
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
773
+ t[p[i]] = s[p[i]];
774
+ }
775
+ return t;
776
+ }
777
+
778
+ var useTileStyles = makeStyles(function (theme) { return ({
779
+ root: {
780
+ borderRadius: theme.spacing(1),
781
+ },
782
+ content: {
783
+ padding: theme.spacing(3),
784
+ },
785
+ }); });
786
+
787
+ var Tile = function (props) {
788
+ var children = props.children, CardContentProps = props.CardContentProps, restProps = __rest(props, ["children", "CardContentProps"]);
789
+ var classes = useTileStyles(props);
790
+ return (React__default.createElement(Card, __assign({ classes: { root: classes.root } }, restProps),
791
+ React__default.createElement(CardContent, __assign({ classes: { root: classes.content } }, CardContentProps), children)));
792
+ };
793
+
794
+ var KpiMetricTile = function (props) {
795
+ var TileProps = props.TileProps, restProps = __rest(props, ["TileProps"]);
796
+ return (React__default.createElement(Tile, __assign({}, TileProps),
797
+ React__default.createElement(KpiMetric, __assign({}, restProps))));
798
+ };
799
+
800
+ export { KpiMetric, KpiMetricTile, Tile };
801
+ //# sourceMappingURL=index.es.js.map