@popmenu/dashboard 0.32.0 → 0.35.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,3 @@
1
+ /// <reference types="react" />
2
+ import { BoxProps as DashboardContainerProps } from '@popmenu/common-ui';
3
+ export declare const DashboardContainer: (props: DashboardContainerProps) => JSX.Element;
@@ -0,0 +1 @@
1
+ export { DashboardContainer } from './DashboardContainer';
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { LeaderboardProps } from './LeaderboardProps';
3
+ export declare const Leaderboard: (props: LeaderboardProps) => JSX.Element;
@@ -0,0 +1,41 @@
1
+ /// <reference types="react" />
2
+ export interface LeaderboardListItemProps {
3
+ /** The icon to be displayed. Should be an icon component from popmenu/web-icons */
4
+ Icon?: string | React.FC<React.SVGProps<SVGSVGElement>>;
5
+ /** The image to be displayed. */
6
+ image?: {
7
+ /** alt attribute for the html img. */
8
+ alt: string;
9
+ /** src attribute for the html img. */
10
+ src: string;
11
+ };
12
+ /** Index used for styling */
13
+ index: number;
14
+ /** The subtitle to be displayed */
15
+ subtitle?: string;
16
+ /** The title to be displayed */
17
+ title: string;
18
+ /** Optional link to be attached to the list item */
19
+ to?: string;
20
+ }
21
+ export interface LeaderboardProps {
22
+ /** Data to be shown for each leaderboard list item */
23
+ data: LeaderboardListItemProps[];
24
+ /** Component to display when no data is present */
25
+ EmptyState: React.ReactNode;
26
+ /** Optional link at bottom to redirect to another page. Intended as a link to more data within the leaderboard. */
27
+ moreLink?: {
28
+ /** Path to route to. */
29
+ to: string;
30
+ /** Text the link will have. */
31
+ text: string;
32
+ };
33
+ /** Subtitle to be displayed */
34
+ subtitle: string;
35
+ /** The title to be displayed */
36
+ title: string;
37
+ }
38
+ export interface MoreLinkProps {
39
+ text: string;
40
+ to: string;
41
+ }
@@ -0,0 +1,4 @@
1
+ import { LeaderboardProps, LeaderboardListItemProps, MoreLinkProps } from './LeaderboardProps';
2
+ export declare const useLeaderboardStyles: (props: LeaderboardProps) => import("@material-ui/styles").ClassNameMap<string>;
3
+ export declare const useLeaderboardListItemStyles: (props: LeaderboardListItemProps) => import("@material-ui/styles").ClassNameMap<string>;
4
+ export declare const useMoreLinkStyles: (props: MoreLinkProps) => import("@material-ui/styles").ClassNameMap<string>;
@@ -0,0 +1,2 @@
1
+ export { Leaderboard } from './Leaderboard';
2
+ export { LeaderboardProps } from './LeaderboardProps';
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { LeaderboardTileProps } from './LeaderboardTileProps';
3
+ export declare const LeaderboardTile: (props: LeaderboardTileProps) => JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { TileProps } from '../Tile/TileProps';
2
+ import { LeaderboardProps } from '../Leaderboard/LeaderboardProps';
3
+ export interface LeaderboardTileProps extends LeaderboardProps {
4
+ TileProps: TileProps;
5
+ }
@@ -0,0 +1,2 @@
1
+ export { LeaderboardTile } from './LeaderboardTile';
2
+ export { LeaderboardTileProps } from './LeaderboardTileProps';
@@ -1,3 +1,5 @@
1
+ export { Leaderboard, LeaderboardProps } from './Leaderboard';
2
+ export { LeaderboardTile, LeaderboardTileProps } from './LeaderboardTile';
1
3
  export { KpiMetric, KpiMetricProps } from './KpiMetric';
2
4
  export { KpiMetricTile, KpiMetricTileProps } from './KpiMetricTile';
3
5
  export { Tile, TileProps } from './Tile';
package/build/index.es.js CHANGED
@@ -29,11 +29,12 @@ import '@material-ui/core/Grid';
29
29
  import MuiIconButton from '@material-ui/core/IconButton';
30
30
  import '@material-ui/core/InputAdornment';
31
31
  import '@material-ui/core/LinearProgress';
32
- import '@material-ui/core/List';
33
- import '@material-ui/core/ListItem';
32
+ import List from '@material-ui/core/List';
33
+ import ListItem from '@material-ui/core/ListItem';
34
+ import ListItemAvatar from '@material-ui/core/ListItemAvatar';
34
35
  import '@material-ui/core/ListItemIcon';
35
36
  import '@material-ui/core/ListItemSecondaryAction';
36
- import '@material-ui/core/ListItemText';
37
+ import ListItemText from '@material-ui/core/ListItemText';
37
38
  import '@material-ui/core/Menu';
38
39
  import '@material-ui/core/MenuItem';
39
40
  import '@material-ui/core/MenuList';
@@ -45,6 +46,7 @@ import '@material-ui/core/Tabs';
45
46
  import MuiToggleButton from '@material-ui/lab/ToggleButton';
46
47
  import MuiToggleButtonGroup from '@material-ui/lab/ToggleButtonGroup';
47
48
  import MuiTooltip from '@material-ui/core/Tooltip';
49
+ import { Link as Link$2 } from 'react-router-dom';
48
50
 
49
51
  /*! *****************************************************************************
50
52
  Copyright (c) Microsoft Corporation.
@@ -84,12 +86,50 @@ function __rest$1(s, e) {
84
86
  return t;
85
87
  }
86
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
+
87
127
  var _path$F;
88
128
 
89
- function _extends$19() { _extends$19 = 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$19.apply(this, arguments); }
129
+ function _extends$1c() { _extends$1c = 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$1c.apply(this, arguments); }
90
130
 
91
131
  function SvgUser(props) {
92
- return /*#__PURE__*/React.createElement("svg", _extends$19({
132
+ return /*#__PURE__*/React.createElement("svg", _extends$1c({
93
133
  viewBox: "0 0 16 16",
94
134
  fill: "none",
95
135
  strokeLinecap: "round",
@@ -200,14 +240,14 @@ var classNames = classnames.exports;
200
240
 
201
241
  var iconStaticClassName = 'pop-icon';
202
242
  var Icon = function (props) {
203
- var icon = props.icon, className = props.className, restProps = __rest$1(props, ["icon", "className"]);
243
+ var icon = props.icon, className = props.className, restProps = __rest(props, ["icon", "className"]);
204
244
  var classes = useIconStyles(props);
205
245
  var isValid = true;
206
246
  if (!icon || (typeof icon === 'function' && icon({}) === undefined)) {
207
247
  isValid = false;
208
248
  }
209
249
  return isValid
210
- ? createElement(icon, __assign$1({ className: classNames([classes.root, iconStaticClassName, className]) }, restProps))
250
+ ? createElement(icon, __assign({ className: classNames([classes.root, iconStaticClassName, className]) }, restProps))
211
251
  : null;
212
252
  };
213
253
  Icon.defaultProps = {
@@ -224,7 +264,7 @@ var LoadingStatus;
224
264
  })(LoadingStatus || (LoadingStatus = {}));
225
265
  var useImgProps = function (avatarProps) {
226
266
  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) {
267
+ var imgProps = __assign(__assign({}, avatarProps.imgProps), { onLoad: function (event) {
228
268
  var _a, _b;
229
269
  setLoaded(LoadingStatus.LOADED);
230
270
  (_b = (_a = avatarProps.imgProps) === null || _a === void 0 ? void 0 : _a.onLoad) === null || _b === void 0 ? void 0 : _b.call(_a, event);
@@ -269,9 +309,9 @@ var useAvatarStyles = makeStyles$1(function (theme) { return ({
269
309
  }); });
270
310
 
271
311
  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"]);
312
+ var children = props.children, src = props.src, alt = props.alt, fallback = props.fallback, muiProps = __rest(props, ["children", "src", "alt", "fallback"]);
273
313
  var _a = useImgProps(props), imgProps = _a.imgProps, loaded = _a.loaded;
274
- var classes = useAvatarStyles(__assign$1(__assign$1({}, props), { loaded: loaded }));
314
+ var classes = useAvatarStyles(__assign(__assign({}, props), { loaded: loaded }));
275
315
  var displayAltTextFallback = src && alt;
276
316
  var displayNoFallback = fallback === 'none';
277
317
  var displayCustomFallback = fallback !== 'none' && typeof fallback !== 'undefined';
@@ -288,7 +328,7 @@ var Avatar = forwardRef(function (props, ref) {
288
328
  else {
289
329
  Fallback = React__default.createElement(Icon, { icon: SvgUser, className: classes.fallback });
290
330
  }
291
- return (React__default.createElement(MuiAvatar, __assign$1({ ref: ref, classes: { root: classes.root }, src: src, alt: alt }, muiProps, { imgProps: imgProps }), children || Fallback));
331
+ return (React__default.createElement(MuiAvatar, __assign({ ref: ref, classes: { root: classes.root }, src: src, alt: alt }, muiProps, { imgProps: imgProps }), children || Fallback));
292
332
  });
293
333
  Avatar.defaultProps = {
294
334
  size: 'medium',
@@ -310,22 +350,22 @@ var useButtonStyles = makeStyles$1(function () { return ({
310
350
  }); });
311
351
 
312
352
  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"]);
353
+ props.textTransform; var loading = props.loading, classesOverride = props.classes, className = props.className, muiProps = __rest(props, ["textTransform", "loading", "classes", "className"]);
354
+ props.classes; var styleProps = __rest(props, ["classes"]);
315
355
  var classes = useButtonStyles(styleProps);
316
356
  var typography = useTheme().typography;
317
357
  var loadingIndicator = {
318
358
  startIcon: React__default.createElement(CircularProgress, { color: "inherit", size: typography.button.fontSize }),
319
359
  disabled: true,
320
360
  };
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))));
361
+ return (React__default.createElement(MuiButton, __assign({ ref: ref, classes: __assign(__assign({}, classes), classesOverride), className: classNames([className, 'pm-button']) }, muiProps, (loading && loadingIndicator))));
322
362
  });
323
363
  Button.displayName = 'Button';
324
364
 
325
365
  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);
366
+ var label = props.label, disabled = props.disabled, LabelProps = props.LabelProps, muiProps = __rest(props, ["label", "disabled", "LabelProps"]);
367
+ var control = React__default.createElement(MuiCheckbox, __assign({ disabled: label ? undefined : disabled }, muiProps));
368
+ return label ? (React__default.createElement(FormControlLabel, __assign({ disabled: disabled, inputRef: ref, control: control, label: label }, LabelProps))) : (control);
329
369
  });
330
370
  Checkbox.displayName = 'Checkbox';
331
371
 
@@ -401,10 +441,10 @@ var useTypographyStyles = makeStyles$1(function (theme) {
401
441
  });
402
442
 
403
443
  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));
444
+ props.weight; props.color; var restProps = __rest(props, ["weight", "color"]);
445
+ var classes = useTypographyStyles(__assign({}, props));
406
446
  var variantMapping = { subtitle1: 'p' };
407
- return React__default.createElement(Typography$1, __assign$1({ ref: ref, classes: classes, variantMapping: variantMapping }, restProps));
447
+ return React__default.createElement(Typography$1, __assign({ ref: ref, classes: classes, variantMapping: variantMapping }, restProps));
408
448
  });
409
449
  Typography.displayName = 'Typography';
410
450
  Typography.defaultProps = defaultTypographyProps;
@@ -473,7 +513,7 @@ makeStyles(function (theme) { return ({
473
513
  }); });
474
514
 
475
515
  var IconButton = forwardRef(function (props, ref) {
476
- return React__default.createElement(MuiIconButton, __assign$1({ ref: ref }, props));
516
+ return React__default.createElement(MuiIconButton, __assign({ ref: ref }, props));
477
517
  });
478
518
  IconButton.displayName = 'IconButton';
479
519
  IconButton.defaultProps = {
@@ -483,16 +523,16 @@ IconButton.defaultProps = {
483
523
  var useLinkStyles = makeStyles$1(function (theme) { return ({
484
524
  root: function (props) {
485
525
  var _a;
486
- return (__assign$1(__assign$1({ display: 'flex' }, (props.color === undefined && { color: theme.palette.info.main })), (_a = {}, _a["& ." + iconStaticClassName] = {
526
+ return (__assign(__assign({ display: 'flex' }, (props.color === undefined && { color: theme.palette.info.main })), (_a = {}, _a["& ." + iconStaticClassName] = {
487
527
  alignSelf: 'center',
488
528
  }, _a)));
489
529
  },
490
530
  }); });
491
531
 
492
532
  var Link = forwardRef(function (props, ref) {
493
- var children = props.children, muiProps = __rest$1(props, ["children"]);
533
+ var children = props.children, muiProps = __rest(props, ["children"]);
494
534
  var classes = useLinkStyles(props);
495
- return (React__default.createElement(Link$1, __assign$1({ ref: ref, classes: { root: classes.root } }, muiProps), children));
535
+ return (React__default.createElement(Link$1, __assign({ ref: ref, classes: { root: classes.root } }, muiProps), children));
496
536
  });
497
537
  Link.defaultProps = {
498
538
  variant: 'body1',
@@ -512,9 +552,9 @@ var useStyles = makeStyles(function (_a) {
512
552
  });
513
553
  });
514
554
  var Paper = forwardRef(function (props, ref) {
515
- var legacyStyles = props.legacyStyles, restProps = __rest$1(props, ["legacyStyles"]);
555
+ var legacyStyles = props.legacyStyles, restProps = __rest(props, ["legacyStyles"]);
516
556
  var classes = useStyles(props);
517
- return React__default.createElement(Paper$1, __assign$1({}, ref, { classes: __assign$1({}, (legacyStyles && classes)) }, restProps));
557
+ return React__default.createElement(Paper$1, __assign({}, ref, { classes: __assign({}, (legacyStyles && classes)) }, restProps));
518
558
  });
519
559
  Paper.displayName = 'Paper';
520
560
  Paper.defaultProps = {
@@ -522,9 +562,9 @@ Paper.defaultProps = {
522
562
  };
523
563
 
524
564
  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);
565
+ var label = props.label, disabled = props.disabled, LabelProps = props.LabelProps, muiProps = __rest(props, ["label", "disabled", "LabelProps"]);
566
+ var control = React__default.createElement(MuiRadio, __assign({ disabled: label ? undefined : disabled }, muiProps));
567
+ return label ? (React__default.createElement(FormControlLabel, __assign({ disabled: disabled, inputRef: ref, control: control, label: label }, LabelProps))) : (control);
528
568
  });
529
569
  Radio.displayName = 'Radio';
530
570
 
@@ -567,10 +607,10 @@ var useSwitchStyles = makeStyles$1(function (theme) { return ({
567
607
  }); });
568
608
 
569
609
  var Switch = forwardRef(function (props, ref) {
570
- var label = props.label, disabled = props.disabled, LabelProps = props.LabelProps, muiProps = __rest$1(props, ["label", "disabled", "LabelProps"]);
610
+ var label = props.label, disabled = props.disabled, LabelProps = props.LabelProps, muiProps = __rest(props, ["label", "disabled", "LabelProps"]);
571
611
  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);
612
+ var control = React__default.createElement(MuiSwitch, __assign({ classes: classes, disabled: label ? undefined : disabled }, muiProps));
613
+ return label ? (React__default.createElement(FormControlLabel, __assign({ disabled: disabled, inputRef: ref, control: control, label: label }, LabelProps))) : (control);
574
614
  });
575
615
  Switch.displayName = 'Switch';
576
616
 
@@ -590,9 +630,9 @@ var useToggleButtonStyles = makeStyles$1(function (theme) { return ({
590
630
  }); });
591
631
 
592
632
  var ToggleButton = forwardRef(function (props, ref) {
593
- var children = props.children, muiProps = __rest$1(props, ["children"]);
633
+ var children = props.children, muiProps = __rest(props, ["children"]);
594
634
  var classes = useToggleButtonStyles(props);
595
- return (React__default.createElement(MuiToggleButton, __assign$1({ ref: ref, classes: {
635
+ return (React__default.createElement(MuiToggleButton, __assign({ ref: ref, classes: {
596
636
  root: classes.root,
597
637
  selected: classes.selected,
598
638
  } }, muiProps), children));
@@ -611,7 +651,7 @@ var useToggleButtonGroupStyles = makeStyles$1(function (theme) { return ({
611
651
  }); });
612
652
 
613
653
  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"]);
654
+ var children = props.children, _a = props.color, color = _a === void 0 ? 'primary' : _a, muiProps = __rest(props, ["children", "color"]);
615
655
  var classes = useToggleButtonGroupStyles(props);
616
656
  var childrenWithProps = React__default.Children.map(children, function (child) {
617
657
  if (!React__default.isValidElement(child)) {
@@ -619,7 +659,7 @@ var ToggleButtonGroup = forwardRef(function (props, ref) {
619
659
  }
620
660
  return React__default.cloneElement(child, { color: color });
621
661
  });
622
- return (React__default.createElement(MuiToggleButtonGroup, __assign$1({ ref: ref, classes: { root: classes.root } }, muiProps), childrenWithProps));
662
+ return (React__default.createElement(MuiToggleButtonGroup, __assign({ ref: ref, classes: { root: classes.root } }, muiProps), childrenWithProps));
623
663
  });
624
664
  ToggleButtonGroup.displayName = 'ToggleButtonGroup';
625
665
 
@@ -634,7 +674,7 @@ var useTooltipStyles = makeStyles$1(function (_a) {
634
674
 
635
675
  var Tooltip = forwardRef(function (props, ref) {
636
676
  var classes = useTooltipStyles(props);
637
- return React__default.createElement(MuiTooltip, __assign$1({ ref: ref, classes: classes }, props));
677
+ return React__default.createElement(MuiTooltip, __assign({ ref: ref, classes: classes }, props));
638
678
  });
639
679
  Tooltip.displayName = 'Tooltip';
640
680
 
@@ -666,19 +706,94 @@ makeStyles(function (theme) { return ({
666
706
  },
667
707
  }); });
668
708
 
669
- var _g$x;
709
+ var useLeaderboardStyles = makeStyles(function (theme) { return ({
710
+ root: {
711
+ '& >:nth-child(even) > li': {
712
+ background: theme.palette.grey[100],
713
+ },
714
+ },
715
+ }); });
716
+ var useLeaderboardListItemStyles = makeStyles(function (theme) { return ({
717
+ link: {
718
+ color: theme.palette.info.main,
719
+ textDecoration: 'none',
720
+ },
721
+ }); });
722
+ var useMoreLinkStyles = makeStyles(function (theme) { return ({
723
+ link: {
724
+ color: theme.palette.info.main,
725
+ textDecoration: 'none',
726
+ },
727
+ }); });
670
728
 
671
- function _extends$1b() { _extends$1b = 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$1b.apply(this, arguments); }
729
+ var Leaderboard = function (props) {
730
+ var data = props.data, EmptyState = props.EmptyState, title = props.title, moreLink = props.moreLink, subtitle = props.subtitle;
731
+ var classes = useLeaderboardStyles(props);
732
+ var isEmpty = data.length === 0;
733
+ var slicedData = data.slice(0, 5);
734
+ var isOverflow = data.length > 5;
735
+ var showMoreButton = !isEmpty && isOverflow;
736
+ return (React__default.createElement(Box, { display: "flex", flexDirection: "column" },
737
+ React__default.createElement(Box, { alignItems: "left" },
738
+ React__default.createElement(Typography, { variant: "h4" }, title),
739
+ React__default.createElement(Typography, { variant: "body2" }, subtitle)),
740
+ !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),
741
+ moreLink && showMoreButton && React__default.createElement(MoreLink, { text: moreLink.text, to: moreLink.to })));
742
+ };
743
+ var LeaderboardListItem = function (props) {
744
+ var ItemIcon = props.Icon, image = props.image, to = props.to, subtitle = props.subtitle, title = props.title;
745
+ var classes = useLeaderboardListItemStyles(props);
746
+ var routeProps = { component: Link$2, to: to };
747
+ var showListItemAvatar = image || ItemIcon;
748
+ return (React__default.createElement(Box, __assign$1({}, (to && routeProps), { className: to && routeProps ? classes.link : '' }),
749
+ React__default.createElement(ListItem, null,
750
+ showListItemAvatar && (React__default.createElement(ListItemAvatar, null,
751
+ React__default.createElement(Avatar, __assign$1({}, image), ItemIcon && React__default.createElement(Icon, { icon: ItemIcon })))),
752
+ React__default.createElement(ListItemText, { primary: title, secondary: subtitle }))));
753
+ };
754
+ var MoreLink = function (props) {
755
+ var text = props.text, to = props.to;
756
+ var classes = useMoreLinkStyles(props);
757
+ var routeProps = { component: Link$2, to: to };
758
+ return (React__default.createElement(Box, __assign$1({ display: "flex", justifyContent: "center" }, routeProps, { className: classes.link }),
759
+ React__default.createElement(Typography, { variant: "body2" }, text)));
760
+ };
761
+
762
+ var useTileStyles = makeStyles(function (theme) { return ({
763
+ root: {
764
+ borderRadius: theme.spacing(1),
765
+ },
766
+ content: {
767
+ padding: theme.spacing(3),
768
+ },
769
+ }); });
770
+
771
+ var Tile = function (props) {
772
+ var children = props.children, CardContentProps = props.CardContentProps, restProps = __rest$1(props, ["children", "CardContentProps"]);
773
+ var classes = useTileStyles(props);
774
+ return (React__default.createElement(Card, __assign$1({ classes: { root: classes.root } }, restProps),
775
+ React__default.createElement(CardContent, __assign$1({ classes: { root: classes.content } }, CardContentProps), children)));
776
+ };
777
+
778
+ var LeaderboardTile = function (props) {
779
+ var TileProps = props.TileProps, restProps = __rest$1(props, ["TileProps"]);
780
+ return (React__default.createElement(Tile, __assign$1({}, TileProps),
781
+ React__default.createElement(Leaderboard, __assign$1({}, restProps))));
782
+ };
783
+
784
+ var _g$A;
785
+
786
+ function _extends$1e() { _extends$1e = 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$1e.apply(this, arguments); }
672
787
 
673
788
  function SvgTrend(props) {
674
- return /*#__PURE__*/React.createElement("svg", _extends$1b({
789
+ return /*#__PURE__*/React.createElement("svg", _extends$1e({
675
790
  viewBox: "0 0 16 16",
676
791
  fill: "none",
677
792
  strokeLinecap: "round",
678
793
  strokeLinejoin: "round",
679
794
  width: "1em",
680
795
  height: "1em"
681
- }, props), _g$x || (_g$x = /*#__PURE__*/React.createElement("g", {
796
+ }, props), _g$A || (_g$A = /*#__PURE__*/React.createElement("g", {
682
797
  stroke: "currentColor"
683
798
  }, /*#__PURE__*/React.createElement("path", {
684
799
  d: "M15.333 4L9 10.333 5.667 7l-5 5"
@@ -687,19 +802,19 @@ function SvgTrend(props) {
687
802
  }))));
688
803
  }
689
804
 
690
- var _g$w;
805
+ var _g$z;
691
806
 
692
- function _extends$1a() { _extends$1a = 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$1a.apply(this, arguments); }
807
+ function _extends$1d() { _extends$1d = 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$1d.apply(this, arguments); }
693
808
 
694
809
  function SvgTrendDown(props) {
695
- return /*#__PURE__*/React.createElement("svg", _extends$1a({
810
+ return /*#__PURE__*/React.createElement("svg", _extends$1d({
696
811
  viewBox: "0 0 16 16",
697
812
  fill: "none",
698
813
  strokeLinecap: "round",
699
814
  strokeLinejoin: "round",
700
815
  width: "1em",
701
816
  height: "1em"
702
- }, props), _g$w || (_g$w = /*#__PURE__*/React.createElement("g", {
817
+ }, props), _g$z || (_g$z = /*#__PURE__*/React.createElement("g", {
703
818
  stroke: "currentColor"
704
819
  }, /*#__PURE__*/React.createElement("path", {
705
820
  d: "M15.333 12L9 5.667 5.667 9l-5-5"
@@ -737,65 +852,11 @@ var KpiMetric = function (props) {
737
852
  };
738
853
  KpiMetric.defaultProps = defaultProps;
739
854
 
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
855
  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))));
856
+ var TileProps = props.TileProps, restProps = __rest$1(props, ["TileProps"]);
857
+ return (React__default.createElement(Tile, __assign$1({}, TileProps),
858
+ React__default.createElement(KpiMetric, __assign$1({}, restProps))));
798
859
  };
799
860
 
800
- export { KpiMetric, KpiMetricTile, Tile };
861
+ export { KpiMetric, KpiMetricTile, Leaderboard, LeaderboardTile, Tile };
801
862
  //# sourceMappingURL=index.es.js.map