@popmenu/dashboard 0.125.0 → 0.126.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.
Files changed (52) hide show
  1. package/build/{components → esm/components}/ClickableTile/ClickableTile.d.ts +8 -8
  2. package/build/esm/components/ClickableTile/ClickableTile.js +18 -0
  3. package/build/esm/components/ClickableTile/ClickableTile.js.map +1 -0
  4. package/build/{components → esm/components}/ClickableTile/ClickableTileProps.d.ts +8 -8
  5. package/build/{components → esm/components}/ClickableTile/ClickableTileStyles.d.ts +1 -1
  6. package/build/esm/components/ClickableTile/ClickableTileStyles.js +16 -0
  7. package/build/esm/components/ClickableTile/ClickableTileStyles.js.map +1 -0
  8. package/build/{components → esm/components}/DashboardContainer/DashboardContainer.d.ts +3 -3
  9. package/build/{components → esm/components}/DashboardContainer/index.d.ts +1 -1
  10. package/build/{components → esm/components}/KpiMetric/KpiMetric.d.ts +12 -12
  11. package/build/esm/components/KpiMetric/KpiMetric.js +28 -0
  12. package/build/esm/components/KpiMetric/KpiMetric.js.map +1 -0
  13. package/build/{components → esm/components}/KpiMetric/KpiMetricProps.d.ts +15 -15
  14. package/build/{components → esm/components}/KpiMetric/KpiMetricStyles.d.ts +2 -2
  15. package/build/esm/components/KpiMetric/KpiMetricStyles.js +30 -0
  16. package/build/esm/components/KpiMetric/KpiMetricStyles.js.map +1 -0
  17. package/build/{components → esm/components}/KpiMetric/index.d.ts +2 -2
  18. package/build/{components → esm/components}/KpiMetricTile/KpiMetricTile.d.ts +3 -3
  19. package/build/esm/components/KpiMetricTile/KpiMetricTile.js +15 -0
  20. package/build/esm/components/KpiMetricTile/KpiMetricTile.js.map +1 -0
  21. package/build/{components → esm/components}/KpiMetricTile/KpiMetricTileProps.d.ts +6 -6
  22. package/build/{components → esm/components}/KpiMetricTile/index.d.ts +2 -2
  23. package/build/{components → esm/components}/Leaderboard/Leaderboard.d.ts +3 -3
  24. package/build/esm/components/Leaderboard/Leaderboard.js +78 -0
  25. package/build/esm/components/Leaderboard/Leaderboard.js.map +1 -0
  26. package/build/{components → esm/components}/Leaderboard/LeaderboardProps.d.ts +56 -56
  27. package/build/{components → esm/components}/Leaderboard/LeaderboardStyles.d.ts +5 -5
  28. package/build/esm/components/Leaderboard/LeaderboardStyles.js +44 -0
  29. package/build/esm/components/Leaderboard/LeaderboardStyles.js.map +1 -0
  30. package/build/{components → esm/components}/Leaderboard/index.d.ts +2 -2
  31. package/build/{components → esm/components}/LeaderboardTile/LeaderboardTile.d.ts +3 -3
  32. package/build/esm/components/LeaderboardTile/LeaderboardTile.js +13 -0
  33. package/build/esm/components/LeaderboardTile/LeaderboardTile.js.map +1 -0
  34. package/build/{components → esm/components}/LeaderboardTile/LeaderboardTileProps.d.ts +5 -5
  35. package/build/{components → esm/components}/LeaderboardTile/index.d.ts +2 -2
  36. package/build/{components → esm/components}/Tile/Tile.d.ts +3 -3
  37. package/build/esm/components/Tile/Tile.js +14 -0
  38. package/build/esm/components/Tile/Tile.js.map +1 -0
  39. package/build/{components → esm/components}/Tile/TileProps.d.ts +8 -8
  40. package/build/{components → esm/components}/Tile/TileStyles.d.ts +1 -1
  41. package/build/esm/components/Tile/TileStyles.js +15 -0
  42. package/build/esm/components/Tile/TileStyles.js.map +1 -0
  43. package/build/{components → esm/components}/Tile/index.d.ts +2 -2
  44. package/build/{components → esm/components}/index.d.ts +5 -5
  45. package/build/{index.d.ts → esm/index.d.ts} +1 -1
  46. package/build/esm/index.js +6 -0
  47. package/build/esm/index.js.map +1 -0
  48. package/build/index.js +197 -1158
  49. package/build/index.js.map +1 -1
  50. package/package.json +7 -4
  51. package/build/index.es.js +0 -1138
  52. package/build/index.es.js.map +0 -1
package/build/index.es.js DELETED
@@ -1,1138 +0,0 @@
1
- import * as React from 'react';
2
- import React__default, { createElement, forwardRef, createContext, useState } from 'react';
3
- import { makeStyles, Typography as Typography$1, Link as Link$1, Paper as Paper$1, Box, Menu, MenuItem, Card as Card$1, CardActionArea, CardContent as CardContent$1 } from '@material-ui/core';
4
- import '@material-ui/lab/Alert';
5
- import '@material-ui/core/AppBar';
6
- import MuiAvatar from '@material-ui/core/Avatar';
7
- import { makeStyles as makeStyles$1 } from '@material-ui/core/styles';
8
- import '@material-ui/core/Badge';
9
- import '@material-ui/core/Button';
10
- import '@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 List from '@material-ui/core/List';
33
- import ListItem from '@material-ui/core/ListItem';
34
- import ListItemAvatar from '@material-ui/core/ListItemAvatar';
35
- import '@material-ui/core/ListItemIcon';
36
- import '@material-ui/core/ListItemSecondaryAction';
37
- import ListItemText from '@material-ui/core/ListItemText';
38
- import '@material-ui/core/Menu';
39
- import '@material-ui/core/MenuItem';
40
- import '@material-ui/core/MenuList';
41
- import MuiRadio from '@material-ui/core/Radio';
42
- import '@material-ui/core/TextField';
43
- import MuiSwitch from '@material-ui/core/Switch';
44
- import '@material-ui/core/Tab';
45
- import '@material-ui/core/Tabs';
46
- import MuiToggleButton from '@material-ui/lab/ToggleButton';
47
- import MuiToggleButtonGroup from '@material-ui/lab/ToggleButtonGroup';
48
- import MuiTooltip from '@material-ui/core/Tooltip';
49
- import { Link as Link$2 } from 'react-router-dom';
50
-
51
- /*! *****************************************************************************
52
- Copyright (c) Microsoft Corporation.
53
-
54
- Permission to use, copy, modify, and/or distribute this software for any
55
- purpose with or without fee is hereby granted.
56
-
57
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
58
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
59
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
60
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
61
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
62
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
63
- PERFORMANCE OF THIS SOFTWARE.
64
- ***************************************************************************** */
65
-
66
- var __assign$1 = function() {
67
- __assign$1 = Object.assign || function __assign(t) {
68
- for (var s, i = 1, n = arguments.length; i < n; i++) {
69
- s = arguments[i];
70
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
71
- }
72
- return t;
73
- };
74
- return __assign$1.apply(this, arguments);
75
- };
76
-
77
- function __rest$1(s, e) {
78
- var t = {};
79
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
80
- t[p] = s[p];
81
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
82
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
83
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
84
- t[p[i]] = s[p[i]];
85
- }
86
- return t;
87
- }
88
-
89
- /*! *****************************************************************************
90
- Copyright (c) Microsoft Corporation.
91
-
92
- Permission to use, copy, modify, and/or distribute this software for any
93
- purpose with or without fee is hereby granted.
94
-
95
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
96
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
97
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
98
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
99
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
100
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
101
- PERFORMANCE OF THIS SOFTWARE.
102
- ***************************************************************************** */
103
-
104
- var __assign = function() {
105
- __assign = Object.assign || function __assign(t) {
106
- for (var s, i = 1, n = arguments.length; i < n; i++) {
107
- s = arguments[i];
108
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
109
- }
110
- return t;
111
- };
112
- return __assign.apply(this, arguments);
113
- };
114
-
115
- function __rest(s, e) {
116
- var t = {};
117
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
118
- t[p] = s[p];
119
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
120
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
121
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
122
- t[p[i]] = s[p[i]];
123
- }
124
- return t;
125
- }
126
-
127
- var _path$1D;
128
-
129
- function _extends$3H() { _extends$3H = 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$3H.apply(this, arguments); }
130
-
131
- function SvgUser(props) {
132
- return /*#__PURE__*/React.createElement("svg", _extends$3H({
133
- viewBox: "0 0 16 16",
134
- fill: "none",
135
- strokeLinecap: "round",
136
- strokeLinejoin: "round",
137
- width: "1em",
138
- height: "1em"
139
- }, props), _path$1D || (_path$1D = /*#__PURE__*/React.createElement("path", {
140
- 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",
141
- stroke: "currentColor"
142
- })));
143
- }
144
-
145
- var useIconStyles = makeStyles(function (_a) {
146
- var spacing = _a.spacing, palette = _a.palette;
147
- var getFontSize = function (_a) {
148
- var size = _a.size;
149
- var sizes = {
150
- inherit: 'inherit',
151
- small: spacing(1.5),
152
- medium: spacing(2),
153
- large: spacing(2.5),
154
- 'extra-large': spacing(3),
155
- };
156
- return size ? sizes[size] : 'inherit';
157
- };
158
- var getColor = function (props) {
159
- var semanticColors = ['primary', 'secondary', 'info', 'success', 'warning', 'error'];
160
- var value = 'inherit';
161
- if (props.color) {
162
- if (semanticColors.includes(props.color.split('.')[0])) {
163
- var _a = props.color.split('.'), color = _a[0], _b = _a[1], variant = _b === void 0 ? 'main' : _b;
164
- // @ts-expect-error - todo.
165
- value = palette[color][variant];
166
- }
167
- else if (props.color.search(/^(rgb|hsla|#)/) !== -1) {
168
- value = props.color;
169
- }
170
- }
171
- return value;
172
- };
173
- return {
174
- root: {
175
- color: getColor,
176
- fontSize: getFontSize,
177
- strokeWidth: '1.3px',
178
- },
179
- };
180
- });
181
-
182
- var classnames = {exports: {}};
183
-
184
- /*!
185
- Copyright (c) 2018 Jed Watson.
186
- Licensed under the MIT License (MIT), see
187
- http://jedwatson.github.io/classnames
188
- */
189
-
190
- (function (module) {
191
- /* global define */
192
-
193
- (function () {
194
-
195
- var hasOwn = {}.hasOwnProperty;
196
-
197
- function classNames() {
198
- var classes = [];
199
-
200
- for (var i = 0; i < arguments.length; i++) {
201
- var arg = arguments[i];
202
- if (!arg) continue;
203
-
204
- var argType = typeof arg;
205
-
206
- if (argType === 'string' || argType === 'number') {
207
- classes.push(arg);
208
- } else if (Array.isArray(arg)) {
209
- if (arg.length) {
210
- var inner = classNames.apply(null, arg);
211
- if (inner) {
212
- classes.push(inner);
213
- }
214
- }
215
- } else if (argType === 'object') {
216
- if (arg.toString === Object.prototype.toString) {
217
- for (var key in arg) {
218
- if (hasOwn.call(arg, key) && arg[key]) {
219
- classes.push(key);
220
- }
221
- }
222
- } else {
223
- classes.push(arg.toString());
224
- }
225
- }
226
- }
227
-
228
- return classes.join(' ');
229
- }
230
-
231
- if (module.exports) {
232
- classNames.default = classNames;
233
- module.exports = classNames;
234
- } else {
235
- window.classNames = classNames;
236
- }
237
- }());
238
- }(classnames));
239
-
240
- var classNames = classnames.exports;
241
-
242
- var iconStaticClassName = 'pop-icon';
243
- var Icon = function (props) {
244
- var icon = props.icon, className = props.className, restProps = __rest(props, ["icon", "className"]);
245
- var hasAccessibleAttr = Boolean(restProps['aria-describedby'] || restProps['aria-label']);
246
- if (!hasAccessibleAttr && restProps['aria-hidden'] === undefined) {
247
- restProps['aria-hidden'] = true;
248
- }
249
- var classes = useIconStyles(props);
250
- var isValid = true;
251
- if (!icon || (typeof icon === 'function' && icon({}) === undefined)) {
252
- isValid = false;
253
- }
254
- return isValid
255
- ? createElement(icon, __assign({ className: classNames([classes.root, iconStaticClassName, className]) }, restProps))
256
- : null;
257
- };
258
- Icon.defaultProps = {
259
- size: 'inherit',
260
- color: 'inherit',
261
- };
262
- Icon.displayName = 'Icon';
263
-
264
- var LoadingStatus;
265
- (function (LoadingStatus) {
266
- LoadingStatus["ERROR"] = "ERROR";
267
- LoadingStatus["LOADED"] = "LOADED";
268
- LoadingStatus["PENDING"] = "PENDING";
269
- })(LoadingStatus || (LoadingStatus = {}));
270
- var useImgProps = function (avatarProps) {
271
- var _a = React__default.useState(LoadingStatus.PENDING), loaded = _a[0], setLoaded = _a[1];
272
- var imgProps = __assign(__assign({}, avatarProps.imgProps), { onLoad: function (event) {
273
- var _a, _b;
274
- setLoaded(LoadingStatus.LOADED);
275
- (_b = (_a = avatarProps.imgProps) === null || _a === void 0 ? void 0 : _a.onLoad) === null || _b === void 0 ? void 0 : _b.call(_a, event);
276
- } });
277
- return { imgProps: imgProps, loaded: loaded };
278
- };
279
-
280
- var getAvatarDimensions = function (theme, props) {
281
- var factors = {
282
- 'extra-small': 3,
283
- small: 4,
284
- medium: 5,
285
- large: 6,
286
- 'extra-large': 12.5,
287
- };
288
- var sizeFactor = factors[props.size || 'medium'];
289
- return theme.spacing(sizeFactor);
290
- };
291
- var getAvatarFontSize = function (props) {
292
- var fontSizes = {
293
- 'extra-small': '0.75rem',
294
- small: '1rem',
295
- medium: '1rem',
296
- large: '1.25rem',
297
- 'extra-large': '3.5rem',
298
- };
299
- return fontSizes[props.size];
300
- };
301
- var useAvatarStyles = makeStyles$1(function (theme) { return ({
302
- root: function (props) { return ({
303
- width: getAvatarDimensions(theme, props),
304
- height: getAvatarDimensions(theme, props),
305
- fontSize: getAvatarFontSize(props),
306
- backgroundColor: props.loaded === LoadingStatus.LOADED ? 'transparent' : props.background,
307
- color: theme.palette.getContrastText(props.background),
308
- objectFit: props.fit,
309
- }); },
310
- fallback: function (props) { return ({
311
- fontSize: getAvatarDimensions(theme, props),
312
- strokeWidth: 1,
313
- }); },
314
- }); });
315
-
316
- var Avatar = forwardRef(function (props, ref) {
317
- var children = props.children, src = props.src, alt = props.alt, fallback = props.fallback, muiProps = __rest(props, ["children", "src", "alt", "fallback"]);
318
- var _a = useImgProps(props), imgProps = _a.imgProps, loaded = _a.loaded;
319
- var classes = useAvatarStyles(__assign(__assign({}, props), { loaded: loaded }));
320
- var displayAltTextFallback = src && alt;
321
- var displayNoFallback = fallback === 'none';
322
- var displayCustomFallback = fallback !== 'none' && typeof fallback !== 'undefined';
323
- var Fallback;
324
- if (displayAltTextFallback) {
325
- Fallback = null;
326
- }
327
- else if (displayNoFallback) {
328
- Fallback = ' ';
329
- }
330
- else if (displayCustomFallback) {
331
- Fallback = fallback;
332
- }
333
- else {
334
- Fallback = React__default.createElement(Icon, { icon: SvgUser, className: classes.fallback });
335
- }
336
- return (React__default.createElement(MuiAvatar, __assign({ ref: ref, classes: { root: classes.root }, src: src, alt: alt }, muiProps, { imgProps: imgProps }), children || Fallback));
337
- });
338
- Avatar.defaultProps = {
339
- size: 'medium',
340
- fit: 'cover',
341
- background: '#E0E0E0',
342
- };
343
- Avatar.displayName = 'Avatar';
344
-
345
- makeStyles$1(function (theme) { return ({
346
- circle: {
347
- backgroundColor: theme.palette.grey[300],
348
- borderRadius: '50%',
349
- height: theme.spacing(0.65),
350
- width: theme.spacing(0.65),
351
- margin: theme.spacing(1) + "px 0 " + theme.spacing(1) + "px " + theme.spacing(1) + "px",
352
- },
353
- container: {
354
- border: "1px solid " + theme.palette.secondary.light,
355
- borderRadius: theme.spacing(0.5),
356
- flexGrow: 1,
357
- },
358
- titleBar: {
359
- display: 'flex',
360
- flexDirection: 'row',
361
- borderBottom: "1px solid " + theme.palette.secondary.light,
362
- width: '100%',
363
- },
364
- }); });
365
-
366
- makeStyles$1(function () { return ({
367
- root: {
368
- minWidth: 'unset',
369
- },
370
- label: {
371
- textTransform: function (_a) {
372
- var textTransform = _a.textTransform;
373
- return textTransform;
374
- },
375
- },
376
- }); });
377
-
378
- var Checkbox = forwardRef(function (props, ref) {
379
- var label = props.label, disabled = props.disabled, LabelProps = props.LabelProps, muiProps = __rest(props, ["label", "disabled", "LabelProps"]);
380
- var control = React__default.createElement(MuiCheckbox, __assign({ disabled: label ? undefined : disabled }, muiProps));
381
- return label ? (React__default.createElement(FormControlLabel, __assign({ disabled: disabled, inputRef: ref, control: control, label: label }, LabelProps))) : (control);
382
- });
383
- Checkbox.displayName = 'Checkbox';
384
-
385
- var getBackground = function (theme) { return function (props) {
386
- var variant = props.variant, severity = props.severity;
387
- var background = theme.palette.grey[100];
388
- var backgrounds = {
389
- outlined: 'none',
390
- error: 'error.main',
391
- warning: 'warning.main',
392
- info: 'info.light',
393
- success: 'success.light',
394
- };
395
- if (variant === 'outlined') {
396
- background = backgrounds[variant];
397
- }
398
- else if (severity) {
399
- var _a = backgrounds[severity].split('.'), color = _a[0], colorVariant = _a[1];
400
- // @ts-expect-error - todo.
401
- background = theme.palette[color][colorVariant];
402
- }
403
- return background;
404
- }; };
405
- var getColor = function (theme) { return function (props) {
406
- var variant = props.variant, severity = props.severity;
407
- var textColor;
408
- if (variant === 'outlined' && severity) {
409
- var textColors = {
410
- error: theme.palette.error.main,
411
- info: theme.palette.info.main,
412
- warning: theme.palette.warning.dark,
413
- success: theme.palette.success.dark,
414
- };
415
- textColor = textColors[severity];
416
- }
417
- else if (variant === 'outlined' && !severity) {
418
- textColor = theme.palette.grey[700];
419
- }
420
- else if ((variant === 'default' || variant === undefined) && severity) {
421
- var textColors = {
422
- error: theme.palette.common.white,
423
- info: theme.palette.secondary.main,
424
- warning: theme.palette.secondary.main,
425
- success: theme.palette.secondary.main,
426
- };
427
- textColor = textColors[severity];
428
- }
429
- return textColor;
430
- }; };
431
- var getBorder = function (theme) { return function (props) {
432
- var variant = props.variant, severity = props.severity;
433
- var borderColor;
434
- if (variant === 'outlined' && severity) {
435
- var borderColors = {
436
- error: theme.palette.error.main,
437
- info: theme.palette.info.main,
438
- warning: theme.palette.warning.dark,
439
- success: theme.palette.success.dark,
440
- };
441
- borderColor = borderColors[severity];
442
- }
443
- return borderColor;
444
- }; };
445
- // using `any` here is a bit of cheating but it doesn't matter since this doesn't depend on
446
- // any component-specific props
447
- makeStyles$1(function (theme) { return ({
448
- root: {
449
- background: getBackground(theme),
450
- color: getColor(theme),
451
- borderColor: getBorder(theme),
452
- borderRadius: theme.spacing(0.5),
453
- },
454
- icon: {
455
- color: 'inherit',
456
- height: theme.spacing(2),
457
- width: theme.spacing(2),
458
- },
459
- deleteIcon: {
460
- color: theme.palette.grey[500],
461
- },
462
- }); });
463
-
464
- var defaultTypographyProps = {
465
- variant: 'body1',
466
- };
467
-
468
- var weights = {
469
- regular: 400,
470
- medium: 500,
471
- 'semi-bold': 600,
472
- bold: 700,
473
- };
474
- var getCustomColor = function (theme, color) {
475
- var isCommonColor = color && ['white', 'black'].includes(color);
476
- var isGreyColor = color && color.match(/^grey\.\d{3}/);
477
- var isSemanticColor = color && color.match(/(primary|secondary|info|success|error|warning).?(light|dark)?/);
478
- var isTextColor = color && ['textPrimary', 'textSecondary'].includes(color);
479
- switch (true) {
480
- case isCommonColor:
481
- // @ts-expect-error - todo.
482
- return theme.palette.common[color];
483
- case Boolean(isGreyColor):
484
- var scale = color.split('.')[1];
485
- // @ts-expect-error - todo.
486
- return theme.palette.grey[scale] || theme.palette.grey[900];
487
- case Boolean(isSemanticColor):
488
- var _a = color.split('.'), paletteKey = _a[0], _b = _a[1], variant = _b === void 0 ? 'main' : _b;
489
- // @ts-expect-error - todo.
490
- return theme.palette[paletteKey][variant];
491
- case isTextColor:
492
- // @ts-expect-error - todo.
493
- return theme.palette.text[color.slice(4).toLowerCase()];
494
- default:
495
- return undefined;
496
- }
497
- };
498
- var useTypographyStyles = makeStyles$1(function (theme) {
499
- var _a;
500
- return ({
501
- root: (_a = {},
502
- _a["& ." + iconStaticClassName] = {
503
- position: 'relative',
504
- top: '0.125em',
505
- padding: '0 0.125em',
506
- boxSizing: 'content-box',
507
- },
508
- _a.fontFamily = theme.typography.fontFamily,
509
- _a.fontWeight = function (_a) {
510
- var variant = _a.variant, weight = _a.weight;
511
- return (weight ? weights[weight] : theme.typography[variant].fontWeight);
512
- },
513
- _a.fontSize = function (_a) {
514
- var variant = _a.variant;
515
- return theme.typography[variant].fontSize;
516
- },
517
- _a.lineHeight = function (_a) {
518
- var variant = _a.variant;
519
- return theme.typography[variant].lineHeight;
520
- },
521
- _a.textTransform = function (_a) {
522
- var variant = _a.variant;
523
- return theme.typography[variant].textTransform;
524
- },
525
- _a.color = function (_a) {
526
- var color = _a.color, variant = _a.variant;
527
- return (color && getCustomColor(theme, color)) || theme.typography[variant].color;
528
- },
529
- _a),
530
- caption: {
531
- display: 'inline',
532
- },
533
- overline: {
534
- display: 'inline',
535
- },
536
- });
537
- });
538
-
539
- var Typography = function (props) {
540
- props.weight; props.color; var TypographyRef = props.TypographyRef, restProps = __rest(props, ["weight", "color", "TypographyRef"]);
541
- var classes = useTypographyStyles(__assign({}, props));
542
- var variantMapping = { subtitle1: 'p' };
543
- return React__default.createElement(Typography$1, __assign({ classes: classes, variantMapping: variantMapping, ref: TypographyRef }, restProps));
544
- };
545
- Typography.displayName = 'Typography';
546
- Typography.defaultProps = defaultTypographyProps;
547
-
548
- var getFadeStop = function (_a, typographyVariant) {
549
- var typography = _a.typography;
550
- // @ts-expect-error - todo.
551
- return !isNaN(Number(typography[typographyVariant].lineHeight))
552
- ? // @ts-expect-error - todo.
553
- typography[typographyVariant].lineHeight + "rem"
554
- : // @ts-expect-error - todo.
555
- typography[typographyVariant].lineHeight;
556
- };
557
- makeStyles(function (theme) { return ({
558
- overlay: {
559
- position: 'absolute',
560
- top: 0,
561
- left: 0,
562
- height: '100%',
563
- width: '100%',
564
- background: function (props) { return "linear-gradient(to top, white, #FFF0 " + getFadeStop(theme, props.typographyVariant) + ")"; },
565
- },
566
- }); });
567
-
568
- var SemanticColors;
569
- (function (SemanticColors) {
570
- SemanticColors["PRIMARY_MAIN"] = "primary.main";
571
- SemanticColors["PRIMARY_DARK"] = "primary.dark";
572
- SemanticColors["PRIMARY_LIGHT"] = "primary.light";
573
- SemanticColors["SECONDARY_MAIN"] = "secondary.main";
574
- SemanticColors["SECONDARY_DARK"] = "secondary.dark";
575
- SemanticColors["SECONDARY_LIGHT"] = "secondary.light";
576
- })(SemanticColors || (SemanticColors = {}));
577
- makeStyles(function (theme) { return ({
578
- dividerRoot: {
579
- gap: theme.spacing(2),
580
- },
581
- textRoot: {
582
- color: function (props) {
583
- var textColor = props.textColor;
584
- if (Object.values(SemanticColors).includes(textColor)) {
585
- var _a = textColor.split('.'), semanticColor = _a[0], shade = _a[1];
586
- // @ts-expect-error - todo.
587
- return theme.palette[semanticColor][shade];
588
- }
589
- else if (textColor) {
590
- return textColor;
591
- }
592
- else {
593
- return 'black';
594
- }
595
- },
596
- textTransform: function (props) { return props.textTransform; },
597
- },
598
- dividerLine: {
599
- backgroundColor: function (props) {
600
- var dividerColor = props.dividerColor;
601
- if (Object.values(SemanticColors).includes(dividerColor)) {
602
- var _a = dividerColor.split('.'), semanticColor = _a[0], shade = _a[1];
603
- // @ts-expect-error - todo.
604
- return theme.palette[semanticColor][shade];
605
- }
606
- else if (dividerColor) {
607
- return dividerColor;
608
- }
609
- else {
610
- return theme.palette.grey[500];
611
- }
612
- },
613
- },
614
- }); });
615
-
616
- var IconButton = forwardRef(function (props, ref) {
617
- return React__default.createElement(MuiIconButton, __assign({ ref: ref }, props));
618
- });
619
- IconButton.displayName = 'IconButton';
620
- IconButton.defaultProps = {
621
- color: 'secondary',
622
- };
623
-
624
- var useLinkStyles = makeStyles$1(function (theme) { return ({
625
- root: function (props) {
626
- var _a;
627
- return (__assign(__assign({ display: 'flex' }, (props.color === undefined && { color: theme.palette.info.main })), (_a = {}, _a["& ." + iconStaticClassName] = {
628
- alignSelf: 'center',
629
- }, _a)));
630
- },
631
- }); });
632
-
633
- // eslint-disable-next-line react/display-name -- false positive
634
- var Link = forwardRef(function (props, ref) {
635
- var children = props.children, muiProps = __rest(props, ["children"]);
636
- var classes = useLinkStyles(props);
637
- return (React__default.createElement(Link$1, __assign({ ref: ref, classes: { root: classes.root } }, muiProps), children));
638
- });
639
- Link.defaultProps = {
640
- variant: 'body1',
641
- };
642
- Link.displayName = 'Link';
643
-
644
- var useStyles$4 = makeStyles(function (_a) {
645
- var spacing = _a.spacing;
646
- return ({
647
- root: {
648
- '&:last-child': {
649
- marginBottom: 0,
650
- },
651
- marginBottom: spacing(4),
652
- padding: spacing(4),
653
- },
654
- });
655
- });
656
- var Paper = forwardRef(function (props, ref) {
657
- var legacyStyles = props.legacyStyles, restProps = __rest(props, ["legacyStyles"]);
658
- var classes = useStyles$4(props);
659
- return React__default.createElement(Paper$1, __assign({}, ref, { classes: __assign({}, (legacyStyles && classes)) }, restProps));
660
- });
661
- Paper.displayName = 'Paper';
662
- Paper.defaultProps = {
663
- legacyStyles: false,
664
- };
665
-
666
- var Radio = forwardRef(function (props, ref) {
667
- var label = props.label, disabled = props.disabled, LabelProps = props.LabelProps, muiProps = __rest(props, ["label", "disabled", "LabelProps"]);
668
- var control = React__default.createElement(MuiRadio, __assign({ disabled: label ? undefined : disabled }, muiProps));
669
- return label ? (React__default.createElement(FormControlLabel, __assign({ disabled: disabled, inputRef: ref, control: control, label: label }, LabelProps))) : (control);
670
- });
671
- Radio.displayName = 'Radio';
672
-
673
- makeStyles$1(function () { return ({
674
- textfield: {
675
- background: function (props) { return (props.backgroundTransparency ? '#FFFFFF44' : 'none'); },
676
- borderTopLeftRadius: 4,
677
- borderBottomLeftRadius: 4,
678
- '& fieldset': {
679
- borderRight: 'none',
680
- borderTopRightRadius: 0,
681
- borderBottomRightRadius: 0,
682
- },
683
- },
684
- button: {
685
- borderTopLeftRadius: 0,
686
- borderBottomLeftRadius: 0,
687
- alignSelf: 'stretch',
688
- },
689
- input: {
690
- color: function (props) { return props.inputTextColor || 'inherit'; },
691
- '&$focused fieldset': {
692
- top: -4,
693
- },
694
- },
695
- focused: {},
696
- }); });
697
-
698
- var useSwitchStyles = makeStyles$1(function (theme) { return ({
699
- checked: {
700
- '& $thumb': {
701
- background: theme.palette.success.main,
702
- },
703
- '&& + $track': {
704
- backgroundColor: theme.palette.success.main,
705
- },
706
- },
707
- thumb: {},
708
- track: {},
709
- }); });
710
-
711
- var Switch = forwardRef(function (props, ref) {
712
- var label = props.label, disabled = props.disabled, LabelProps = props.LabelProps, muiProps = __rest(props, ["label", "disabled", "LabelProps"]);
713
- var classes = useSwitchStyles(props);
714
- var control = React__default.createElement(MuiSwitch, __assign({ classes: classes, disabled: label ? undefined : disabled }, muiProps));
715
- return label ? (React__default.createElement(FormControlLabel, __assign({ disabled: disabled, inputRef: ref, control: control, label: label }, LabelProps))) : (control);
716
- });
717
- Switch.displayName = 'Switch';
718
-
719
- var useToggleButtonStyles = makeStyles$1(function (theme) { return ({
720
- root: {
721
- color: theme.palette.text.primary,
722
- },
723
- selected: {
724
- '&&': {
725
- '&:hover': {
726
- backgroundColor: function (props) { return theme.palette[props.color || 'primary'].dark; },
727
- },
728
- backgroundColor: function (props) { return theme.palette[props.color || 'primary'].main; },
729
- color: 'white',
730
- },
731
- },
732
- }); });
733
-
734
- var ToggleButton = forwardRef(function (props, ref) {
735
- var children = props.children, muiProps = __rest(props, ["children"]);
736
- var classes = useToggleButtonStyles(props);
737
- return (React__default.createElement(MuiToggleButton, __assign({ ref: ref, classes: {
738
- root: classes.root,
739
- selected: classes.selected,
740
- } }, muiProps), children));
741
- });
742
- ToggleButton.defaultProps = {
743
- color: 'primary',
744
- };
745
- ToggleButton.displayName = 'ToggleButton';
746
-
747
- var useToggleButtonGroupStyles = makeStyles$1(function (theme) { return ({
748
- root: {
749
- '&&': {
750
- backgroundColor: theme.palette.grey[300],
751
- },
752
- },
753
- }); });
754
-
755
- var ToggleButtonGroup = forwardRef(function (props, ref) {
756
- var children = props.children, _a = props.color, color = _a === void 0 ? 'primary' : _a, muiProps = __rest(props, ["children", "color"]);
757
- var classes = useToggleButtonGroupStyles(props);
758
- var childrenWithProps = React__default.Children.map(children, function (child) {
759
- if (!React__default.isValidElement(child)) {
760
- return null;
761
- }
762
- return React__default.cloneElement(child, { color: color });
763
- });
764
- return (React__default.createElement(MuiToggleButtonGroup, __assign({ ref: ref, classes: { root: classes.root } }, muiProps), childrenWithProps));
765
- });
766
- ToggleButtonGroup.displayName = 'ToggleButtonGroup';
767
-
768
- var useTooltipStyles = makeStyles$1(function (_a) {
769
- var typography = _a.typography;
770
- return ({
771
- tooltip: {
772
- fontSize: typography.pxToRem(16),
773
- },
774
- });
775
- });
776
-
777
- var Tooltip = forwardRef(function (props, ref) {
778
- var classes = useTooltipStyles(props);
779
- return React__default.createElement(MuiTooltip, __assign({ ref: ref, classes: classes }, props));
780
- });
781
- Tooltip.displayName = 'Tooltip';
782
-
783
- makeStyles(function () { return ({
784
- root: {
785
- height: 56,
786
- },
787
- }); });
788
- makeStyles(function (theme) { return ({
789
- root: {
790
- height: '100%',
791
- width: 'min-content',
792
- borderRadius: theme.spacing(1),
793
- },
794
- input: {
795
- '&::-webkit-clear-button, &::-webkit-outer-spin-button, &::-webkit-inner-spin-button': {
796
- display: 'none',
797
- },
798
- '-moz-appearance': 'textfield',
799
- minWidth: 40,
800
- padding: 0,
801
- textAlign: 'center',
802
- },
803
- adornedStart: {
804
- padding: 0,
805
- },
806
- adornedEnd: {
807
- padding: 0,
808
- },
809
- }); });
810
-
811
- makeStyles(function () { return ({
812
- root: {
813
- display: 'flex',
814
- flexDirection: 'column',
815
- alignItems: 'center',
816
- gridGap: 16,
817
- },
818
- }); });
819
-
820
- var FollowerAuthenticationDialogContext = createContext(null);
821
- FollowerAuthenticationDialogContext.Provider;
822
-
823
- makeStyles(function () { return ({
824
- form: {
825
- display: 'flex',
826
- flexDirection: 'column',
827
- alignItems: 'center',
828
- width: '100%',
829
- gridGap: 16,
830
- },
831
- }); });
832
-
833
- makeStyles(function () { return ({
834
- main: {
835
- width: '100%',
836
- display: 'flex',
837
- flexDirection: 'column',
838
- gridGap: 16,
839
- },
840
- }); });
841
-
842
- makeStyles(function () { return ({
843
- root: {
844
- position: 'absolute',
845
- top: 0,
846
- right: 0,
847
- },
848
- }); });
849
-
850
- var _path$2p;
851
-
852
- function _extends$5q() { _extends$5q = 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$5q.apply(this, arguments); }
853
-
854
- function SvgChevronDown(props) {
855
- return /*#__PURE__*/React.createElement("svg", _extends$5q({
856
- viewBox: "0 0 16 16",
857
- fill: "none",
858
- strokeLinecap: "round",
859
- strokeLinejoin: "round",
860
- width: "1em",
861
- height: "1em"
862
- }, props), _path$2p || (_path$2p = /*#__PURE__*/React.createElement("path", {
863
- d: "M4 6l4 4 4-4",
864
- stroke: "currentColor"
865
- })));
866
- }
867
-
868
- var _g$24;
869
-
870
- function _extends$3J() { _extends$3J = 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$3J.apply(this, arguments); }
871
-
872
- function SvgTrend(props) {
873
- return /*#__PURE__*/React.createElement("svg", _extends$3J({
874
- viewBox: "0 0 16 16",
875
- fill: "none",
876
- strokeLinecap: "round",
877
- strokeLinejoin: "round",
878
- width: "1em",
879
- height: "1em"
880
- }, props), _g$24 || (_g$24 = /*#__PURE__*/React.createElement("g", {
881
- stroke: "currentColor"
882
- }, /*#__PURE__*/React.createElement("path", {
883
- d: "M15.333 4L9 10.333 5.667 7l-5 5"
884
- }), /*#__PURE__*/React.createElement("path", {
885
- d: "M11.333 4h4v4"
886
- }))));
887
- }
888
-
889
- var _g$23;
890
-
891
- function _extends$3I() { _extends$3I = 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$3I.apply(this, arguments); }
892
-
893
- function SvgTrendDown(props) {
894
- return /*#__PURE__*/React.createElement("svg", _extends$3I({
895
- viewBox: "0 0 16 16",
896
- fill: "none",
897
- strokeLinecap: "round",
898
- strokeLinejoin: "round",
899
- width: "1em",
900
- height: "1em"
901
- }, props), _g$23 || (_g$23 = /*#__PURE__*/React.createElement("g", {
902
- stroke: "currentColor"
903
- }, /*#__PURE__*/React.createElement("path", {
904
- d: "M15.333 12L9 5.667 5.667 9l-5-5"
905
- }), /*#__PURE__*/React.createElement("path", {
906
- d: "M11.333 12h4V8"
907
- }))));
908
- }
909
-
910
- var _path$w;
911
-
912
- function _extends$1p() { _extends$1p = 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$1p.apply(this, arguments); }
913
-
914
- function SvgGitCommit(props) {
915
- return /*#__PURE__*/React.createElement("svg", _extends$1p({
916
- viewBox: "0 0 16 16",
917
- fill: "none",
918
- strokeLinecap: "round",
919
- strokeLinejoin: "round",
920
- width: "1em",
921
- height: "1em"
922
- }, props), _path$w || (_path$w = /*#__PURE__*/React.createElement("path", {
923
- d: "M8 10.667a2.667 2.667 0 100-5.334 2.667 2.667 0 000 5.334zM.7 8h3.967m6.673 0h3.966",
924
- stroke: "currentColor"
925
- })));
926
- }
927
-
928
- var useLeaderboardStyles = makeStyles(function (theme) { return ({
929
- root: {
930
- '& >:nth-child(even) > li': {
931
- background: theme.palette.grey[100],
932
- },
933
- },
934
- }); });
935
- var useLeaderboardListItemStyles = makeStyles(function (theme) { return ({
936
- fallbackIcon: {
937
- background: 'white',
938
- border: "1px solid " + theme.palette.grey[300],
939
- color: theme.palette.grey[500],
940
- },
941
- link: {
942
- color: theme.palette.info.main,
943
- textDecoration: 'none',
944
- },
945
- subtitle: {
946
- color: theme.palette.secondary.light,
947
- },
948
- }); });
949
- var useLeaderboardFilterStyles = makeStyles(function (theme) { return ({
950
- filterWrapper: {
951
- alignItems: 'center',
952
- cursor: 'pointer',
953
- display: 'flex',
954
- },
955
- text: {
956
- color: theme.palette.secondary.main,
957
- fontSize: '.75rem',
958
- paddingRight: theme.spacing(1),
959
- },
960
- }); });
961
- var useMoreLinkStyles = makeStyles(function (theme) { return ({
962
- link: {
963
- color: theme.palette.info.main,
964
- textDecoration: 'none',
965
- },
966
- }); });
967
-
968
- var Leaderboard = function (props) {
969
- var data = props.data, EmptyState = props.EmptyState, filterProps = props.filterProps, title = props.title, moreLink = props.moreLink, subtitle = props.subtitle;
970
- var classes = useLeaderboardStyles(props);
971
- var isEmpty = data.length === 0;
972
- var slicedData = data.slice(0, 5);
973
- var isOverflow = data.length > 5;
974
- var showMoreButton = !isEmpty && ((moreLink === null || moreLink === void 0 ? void 0 : moreLink.show) || isOverflow);
975
- return (React__default.createElement(Box, { display: "flex", flexDirection: "column" },
976
- React__default.createElement(Box, { alignItems: "left" },
977
- React__default.createElement(Typography, { variant: "h5" }, title),
978
- React__default.createElement(Typography, { className: classes.text }, subtitle),
979
- filterProps && React__default.createElement(LeaderboardFilter, __assign$1({}, filterProps))),
980
- !isEmpty ? (React__default.createElement(List, { classes: classes }, slicedData.map(function (itemProps, index) { return (React__default.createElement(LeaderboardListItem, __assign$1({ key: "tile-list-item-" + index }, itemProps))); }))) : (EmptyState),
981
- moreLink && showMoreButton && React__default.createElement(MoreLink, { text: moreLink.text, to: moreLink.to })));
982
- };
983
- var LeaderboardListItem = function (props) {
984
- var ItemIcon = props.Icon, image = props.image, to = props.to, subtitle = props.subtitle, title = props.title;
985
- var classes = useLeaderboardListItemStyles(props);
986
- var routeProps = { component: Link$2, to: to };
987
- var showListItemAvatar = image || ItemIcon;
988
- return (React__default.createElement(Box, __assign$1({}, (to && routeProps), { className: to && routeProps ? classes.link : '' }),
989
- React__default.createElement(ListItem, null,
990
- showListItemAvatar && (React__default.createElement(ListItemAvatar, null,
991
- React__default.createElement(Avatar, __assign$1({ classes: { colorDefault: classes.fallbackIcon } }, image), ItemIcon && React__default.createElement(Icon, { icon: ItemIcon })))),
992
- React__default.createElement(ListItemText, { classes: { secondary: classes.subtitle }, primary: title, primaryTypographyProps: {
993
- noWrap: true,
994
- }, secondary: subtitle }))));
995
- };
996
- var LeaderboardFilter = function (props) {
997
- var onChange = props.onChange, options = props.options, text = props.text;
998
- var classes = useLeaderboardFilterStyles(props);
999
- var _a = useState(false), open = _a[0], setOpen = _a[1];
1000
- var _b = useState(null), menuAnchor = _b[0], setMenuAnchor = _b[1];
1001
- var _c = useState(null), selection = _c[0], setSelection = _c[1];
1002
- var handleOpen = function (event) {
1003
- setMenuAnchor(event.currentTarget);
1004
- setOpen(true);
1005
- };
1006
- var handleClose = function () {
1007
- setMenuAnchor(null);
1008
- setOpen(false);
1009
- };
1010
- var handleSelection = function (label, value) {
1011
- if (typeof onChange === 'function') {
1012
- onChange(value);
1013
- }
1014
- setSelection(label);
1015
- handleClose();
1016
- };
1017
- if (options.length < 1)
1018
- return null;
1019
- return (React__default.createElement(React__default.Fragment, null,
1020
- React__default.createElement(Box, { className: classes.filterWrapper, pt: 1, onClick: handleOpen },
1021
- React__default.createElement(Typography, { className: classes.text }, selection || text),
1022
- React__default.createElement(Icon, { icon: SvgChevronDown })),
1023
- React__default.createElement(Menu, { anchorEl: menuAnchor, onClose: handleClose, open: open }, options.map(function (_a) {
1024
- var label = _a.label, value = _a.value;
1025
- return (React__default.createElement(MenuItem, { key: value, onClick: function () { return handleSelection(label, value); } }, label));
1026
- }))));
1027
- };
1028
- var MoreLink = function (props) {
1029
- var text = props.text, to = props.to;
1030
- var classes = useMoreLinkStyles(props);
1031
- var routeProps = { component: Link$2, to: to };
1032
- return (React__default.createElement(Box, __assign$1({ display: "flex", justifyContent: "center" }, routeProps, { className: classes.link }),
1033
- React__default.createElement(Typography, { variant: "body2" }, text)));
1034
- };
1035
-
1036
- var useTileStyles = makeStyles(function (theme) { return ({
1037
- root: {
1038
- borderRadius: theme.spacing(1),
1039
- width: '100%',
1040
- },
1041
- content: {
1042
- padding: theme.spacing(3),
1043
- height: '100%',
1044
- },
1045
- }); });
1046
-
1047
- var Tile = function (props) {
1048
- var children = props.children, CardContentProps = props.CardContentProps, restProps = __rest$1(props, ["children", "CardContentProps"]);
1049
- var classes = useTileStyles(props);
1050
- return (React__default.createElement(Card, __assign$1({ classes: { root: classes.root } }, restProps),
1051
- React__default.createElement(CardContent, __assign$1({ classes: { root: classes.content } }, CardContentProps), children)));
1052
- };
1053
-
1054
- var LeaderboardTile = function (props) {
1055
- var TileProps = props.TileProps, restProps = __rest$1(props, ["TileProps"]);
1056
- return (React__default.createElement(Tile, __assign$1({}, TileProps),
1057
- React__default.createElement(Leaderboard, __assign$1({}, restProps))));
1058
- };
1059
-
1060
- var useKpiMetricStyles = makeStyles(function (theme) { return ({
1061
- iconContainer: {
1062
- fontSize: theme.spacing(3),
1063
- display: 'flex',
1064
- backgroundColor: theme.palette.grey[100],
1065
- color: theme.palette.secondary.light,
1066
- borderRadius: '50%',
1067
- padding: theme.spacing(2),
1068
- marginBottom: theme.spacing(2),
1069
- },
1070
- root: {
1071
- display: 'flex',
1072
- flexDirection: 'column',
1073
- alignItems: 'center',
1074
- height: '100%',
1075
- justifyContent: 'space-between',
1076
- textAlign: 'center',
1077
- fontSize: '0.75rem',
1078
- },
1079
- trendIcon: {
1080
- '&&': {
1081
- paddingInlineEnd: theme.spacing(1),
1082
- },
1083
- },
1084
- }); });
1085
-
1086
- var defaultProps = {
1087
- trendStatus: 'natural',
1088
- };
1089
- var KpiMetric = function (props) {
1090
- var KpiIcon = props.Icon, metric = props.metric, value = props.value, trend = props.trend, trendMessage = props.trendMessage, trendStatus = props.trendStatus;
1091
- var classes = useKpiMetricStyles(props);
1092
- var trendColors = trendStatus === 'natural' ? ['success', 'warning', 'grey.500'] : ['warning', 'success', 'grey.500'];
1093
- var trendColorMap = { up: 0, down: 1, level: 2 };
1094
- return (React__default.createElement(Box, { className: classes.root },
1095
- KpiIcon && (React__default.createElement(Box, { className: classes.iconContainer },
1096
- React__default.createElement(Icon, { icon: KpiIcon, size: "inherit" }))),
1097
- React__default.createElement(Typography, { color: "secondary.light", variant: "body2" }, metric),
1098
- React__default.createElement(Typography, { color: "secondary", variant: "h4" }, value ? value : '-'),
1099
- trendMessage && (React__default.createElement(Typography, { style: { fontSize: 'inherit' }, variant: "body2", color: trend ? trendColors[trendColorMap[trend]] : 'grey.500' },
1100
- trend === 'up' && React__default.createElement(Icon, { className: classes.trendIcon, icon: SvgTrend, size: "inherit" }),
1101
- trend === 'down' && React__default.createElement(Icon, { className: classes.trendIcon, icon: SvgTrendDown, size: "inherit" }),
1102
- trend === 'level' && React__default.createElement(Icon, { className: classes.trendIcon, icon: SvgGitCommit, size: "inherit" }),
1103
- trendMessage))));
1104
- };
1105
- KpiMetric.defaultProps = defaultProps;
1106
-
1107
- var useClickableTileStyles = makeStyles(function (theme) { return ({
1108
- root: {
1109
- textDecoration: 'none',
1110
- borderRadius: theme.spacing(1),
1111
- width: '100%',
1112
- },
1113
- content: {
1114
- padding: theme.spacing(3),
1115
- height: '100%',
1116
- },
1117
- }); });
1118
-
1119
- var ClickableTile = function (props) {
1120
- var children = props.children, CardContentProps = props.CardContentProps, link = props.link, restProps = __rest$1(props, ["children", "CardContentProps", "link"]);
1121
- var classes = useClickableTileStyles(props);
1122
- return (React__default.createElement(Card$1, __assign$1({ classes: { root: classes.root } }, restProps),
1123
- React__default.createElement(CardActionArea, { component: link ? 'a' : 'div' },
1124
- React__default.createElement(CardContent$1, __assign$1({ classes: { root: classes.content } }, CardContentProps), children))));
1125
- };
1126
- ClickableTile.defaultProps = {
1127
- link: false,
1128
- };
1129
-
1130
- var KpiMetricTile = function (props) {
1131
- var TileProps = props.TileProps, restProps = __rest$1(props, ["TileProps"]);
1132
- var DynamicTile = typeof (TileProps === null || TileProps === void 0 ? void 0 : TileProps.onClick) === 'function' ? ClickableTile : Tile;
1133
- return (React__default.createElement(DynamicTile, __assign$1({}, TileProps),
1134
- React__default.createElement(KpiMetric, __assign$1({}, restProps))));
1135
- };
1136
-
1137
- export { KpiMetric, KpiMetricTile, Leaderboard, LeaderboardTile, Tile };
1138
- //# sourceMappingURL=index.es.js.map