@popmenu/admin-ui 0.29.0 → 0.32.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.
@@ -16,7 +16,7 @@ export { DialogContent, DialogContentProps } from './DialogContent';
16
16
  export { Page } from './Page';
17
17
  export { PageBody } from './PageBody';
18
18
  export { PageSection } from './PageSection';
19
- export { SettingsIndexCardGroup } from './SettingsIndexCardGroup';
20
- export { SettingsIndexCard, SettingsIndexCardProps } from './SettingsIndexCard';
21
19
  export { PageSections } from './PageSections';
22
20
  export { PageSectionTitle } from './PageSectionTitle';
21
+ export { SettingsIndexCardGroup } from './SettingsIndexCardGroup';
22
+ export { SettingsIndexCard, SettingsIndexCardProps } from './SettingsIndexCard';
package/build/index.es.js CHANGED
@@ -175,19 +175,19 @@ function __rest(s, e) {
175
175
  return t;
176
176
  }
177
177
 
178
- var _path$1W;
178
+ var _path$D;
179
179
 
180
- function _extends$31() { _extends$31 = 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$31.apply(this, arguments); }
180
+ 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); }
181
181
 
182
182
  function SvgUser(props) {
183
- return /*#__PURE__*/React.createElement("svg", _extends$31({
183
+ return /*#__PURE__*/React.createElement("svg", _extends$16({
184
184
  viewBox: "0 0 16 16",
185
185
  fill: "none",
186
186
  strokeLinecap: "round",
187
187
  strokeLinejoin: "round",
188
188
  width: "1em",
189
189
  height: "1em"
190
- }, props), _path$1W || (_path$1W = /*#__PURE__*/React.createElement("path", {
190
+ }, props), _path$D || (_path$D = /*#__PURE__*/React.createElement("path", {
191
191
  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",
192
192
  stroke: "currentColor"
193
193
  })));
@@ -420,48 +420,35 @@ var Checkbox = forwardRef(function (props, ref) {
420
420
  });
421
421
  Checkbox.displayName = 'Checkbox';
422
422
 
423
+ var defaultTypographyProps = {
424
+ variant: 'body1',
425
+ };
426
+
423
427
  var weights = {
424
428
  regular: 400,
429
+ medium: 500,
425
430
  'semi-bold': 600,
426
431
  bold: 700,
427
432
  };
428
- var getColor$1 = function (theme, props) {
429
- var color = props.color;
430
- if (color === undefined) {
431
- return undefined;
432
- }
433
- if (['white', 'black'].includes(color)) {
434
- return theme.palette.common[color];
435
- }
436
- if (color.match(/^grey\.\d{3}/)) {
437
- var scale = color.split('.')[1];
438
- return theme.palette.grey[scale] || theme.palette.grey[900];
439
- }
440
- if ([
441
- 'primary.light',
442
- 'primary.dark',
443
- 'secondary.light',
444
- 'secondary',
445
- 'secondary.dark',
446
- 'info.light',
447
- 'info.dark',
448
- 'success.light',
449
- 'success.dark',
450
- 'error.light',
451
- 'error.dark',
452
- 'warning.light',
453
- 'warning.dark',
454
- ].includes(color)) {
455
- var _a = color.split('.'), paletteKey = _a[0], variant = _a[1];
456
- return theme.palette[paletteKey][variant];
457
- }
458
- if (['success', 'info', 'error', 'warning', 'primary', 'secondary'].includes(color)) {
459
- return theme.palette[color].main;
460
- }
461
- if (['textPrimary', 'textSecondary'].includes(color)) {
462
- return theme.palette.text[color.slice(4).toLowerCase()];
433
+ var getCustomColor = function (theme, color) {
434
+ var isCommonColor = color && ['white', 'black'].includes(color);
435
+ var isGreyColor = color && color.match(/^grey\.\d{3}/);
436
+ var isSemanticColor = color && color.match(/(primary|secondary|info|success|error|warning).?(light|dark)?/);
437
+ var isTextColor = color && ['textPrimary', 'textSecondary'].includes(color);
438
+ switch (true) {
439
+ case isCommonColor:
440
+ return theme.palette.common[color];
441
+ case Boolean(isGreyColor):
442
+ var scale = color.split('.')[1];
443
+ return theme.palette.grey[scale] || theme.palette.grey[900];
444
+ case Boolean(isSemanticColor):
445
+ var _a = color.split('.'), paletteKey = _a[0], _b = _a[1], variant = _b === void 0 ? 'main' : _b;
446
+ return theme.palette[paletteKey][variant];
447
+ case isTextColor:
448
+ return theme.palette.text[color.slice(4).toLowerCase()];
449
+ default:
450
+ return undefined;
463
451
  }
464
- return undefined;
465
452
  };
466
453
  var useTypographyStyles = makeStyles$1(function (theme) {
467
454
  var _a;
@@ -476,21 +463,24 @@ var useTypographyStyles = makeStyles$1(function (theme) {
476
463
  _a.fontFamily = theme.typography.fontFamily,
477
464
  _a.fontWeight = function (_a) {
478
465
  var variant = _a.variant, weight = _a.weight;
479
- return (weight ? weights[weight] : theme.typography[variant || 'body1'].fontWeight);
466
+ return (weight ? weights[weight] : theme.typography[variant].fontWeight);
480
467
  },
481
468
  _a.fontSize = function (_a) {
482
469
  var variant = _a.variant;
483
- return theme.typography[variant || 'body1'].fontSize;
470
+ return theme.typography[variant].fontSize;
484
471
  },
485
472
  _a.lineHeight = function (_a) {
486
473
  var variant = _a.variant;
487
- return theme.typography[variant || 'body1'].lineHeight;
474
+ return theme.typography[variant].lineHeight;
488
475
  },
489
476
  _a.textTransform = function (_a) {
490
477
  var variant = _a.variant;
491
- return theme.typography[variant || 'body1'].textTransform;
478
+ return theme.typography[variant].textTransform;
479
+ },
480
+ _a.color = function (_a) {
481
+ var color = _a.color, variant = _a.variant;
482
+ return (color && getCustomColor(theme, color)) || theme.typography[variant].color;
492
483
  },
493
- _a.color = function (props) { return getColor$1(theme, props); },
494
484
  _a),
495
485
  caption: {
496
486
  display: 'inline',
@@ -501,30 +491,14 @@ var useTypographyStyles = makeStyles$1(function (theme) {
501
491
  });
502
492
  });
503
493
 
504
- var variantMap = {
505
- h1: 'h1',
506
- h2: 'h2',
507
- h3: 'h3',
508
- h4: 'h4',
509
- h5: 'h5',
510
- h6: 'h6',
511
- h7: 'h6',
512
- body1: 'p',
513
- body2: 'p',
514
- subtitle1: 'h6',
515
- subtitle2: 'h6',
516
- caption: 'span',
517
- overline: 'span',
518
- };
519
-
520
494
  var Typography = forwardRef(function (props, ref) {
521
- props.weight; var _a = props.variant, variant = _a === void 0 ? 'body1' : _a; props.color; var restProps = __rest(props, ["weight", "variant", "color"]);
522
- var validatedVariant = Object.keys(variantMap).includes(variant) ? variant : 'body1';
523
- var classes = useTypographyStyles(__assign(__assign({}, props), { variant: validatedVariant }));
524
- var component = variantMap[validatedVariant];
525
- return React__default.createElement(Typography$1, __assign({ component: component, ref: ref, classes: classes }, restProps, { variant: "inherit" }));
495
+ props.weight; props.color; var restProps = __rest(props, ["weight", "color"]);
496
+ var classes = useTypographyStyles(__assign({}, props));
497
+ var variantMapping = { subtitle1: 'p' };
498
+ return React__default.createElement(Typography$1, __assign({ ref: ref, classes: classes, variantMapping: variantMapping }, restProps));
526
499
  });
527
- Typography.displayName = 'Typography';
500
+ Typography.displayName = 'Typography';
501
+ Typography.defaultProps = defaultTypographyProps;
528
502
 
529
503
  var getFadeStop = function (_a, typographyVariant) {
530
504
  var typography = _a.typography;
@@ -783,19 +757,19 @@ makeStyles(function (theme) { return ({
783
757
  },
784
758
  }); });
785
759
 
786
- var _g$1r;
760
+ var _g$J;
787
761
 
788
- function _extends$44() { _extends$44 = 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$44.apply(this, arguments); }
762
+ function _extends$1O() { _extends$1O = 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$1O.apply(this, arguments); }
789
763
 
790
764
  function SvgCheckCircle(props) {
791
- return /*#__PURE__*/React.createElement("svg", _extends$44({
765
+ return /*#__PURE__*/React.createElement("svg", _extends$1O({
792
766
  viewBox: "0 0 16 16",
793
767
  fill: "none",
794
768
  strokeLinecap: "round",
795
769
  strokeLinejoin: "round",
796
770
  width: "1em",
797
771
  height: "1em"
798
- }, props), _g$1r || (_g$1r = /*#__PURE__*/React.createElement("g", {
772
+ }, props), _g$J || (_g$J = /*#__PURE__*/React.createElement("g", {
799
773
  stroke: "currentColor"
800
774
  }, /*#__PURE__*/React.createElement("path", {
801
775
  d: "M14.667 7.387V8a6.667 6.667 0 11-3.954-6.093"
@@ -804,37 +778,37 @@ function SvgCheckCircle(props) {
804
778
  }))));
805
779
  }
806
780
 
807
- var _path$2E;
781
+ var _path$14;
808
782
 
809
- function _extends$41() { _extends$41 = 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$41.apply(this, arguments); }
783
+ function _extends$1M() { _extends$1M = 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$1M.apply(this, arguments); }
810
784
 
811
785
  function SvgX(props) {
812
- return /*#__PURE__*/React.createElement("svg", _extends$41({
786
+ return /*#__PURE__*/React.createElement("svg", _extends$1M({
813
787
  viewBox: "0 0 16 16",
814
788
  fill: "none",
815
789
  strokeLinecap: "round",
816
790
  strokeLinejoin: "round",
817
791
  width: "1em",
818
792
  height: "1em"
819
- }, props), _path$2E || (_path$2E = /*#__PURE__*/React.createElement("path", {
793
+ }, props), _path$14 || (_path$14 = /*#__PURE__*/React.createElement("path", {
820
794
  d: "M12 4l-8 8m0-8l8 8",
821
795
  stroke: "currentColor"
822
796
  })));
823
797
  }
824
798
 
825
- var _g$1i;
799
+ var _g$E;
826
800
 
827
- function _extends$3L() { _extends$3L = 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$3L.apply(this, arguments); }
801
+ 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); }
828
802
 
829
803
  function SvgHelp(props) {
830
- return /*#__PURE__*/React.createElement("svg", _extends$3L({
804
+ return /*#__PURE__*/React.createElement("svg", _extends$1C({
831
805
  viewBox: "0 0 16 16",
832
806
  fill: "none",
833
807
  strokeLinecap: "round",
834
808
  strokeLinejoin: "round",
835
809
  width: "1em",
836
810
  height: "1em"
837
- }, props), _g$1i || (_g$1i = /*#__PURE__*/React.createElement("g", {
811
+ }, props), _g$E || (_g$E = /*#__PURE__*/React.createElement("g", {
838
812
  stroke: "currentColor"
839
813
  }, /*#__PURE__*/React.createElement("path", {
840
814
  d: "M8 14.667A6.667 6.667 0 108 1.334a6.667 6.667 0 000 13.333z"
@@ -843,73 +817,73 @@ function SvgHelp(props) {
843
817
  }))));
844
818
  }
845
819
 
846
- var _path$2s;
820
+ var _path$Z;
847
821
 
848
- 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); }
822
+ 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); }
849
823
 
850
824
  function SvgInfo(props) {
851
- return /*#__PURE__*/React.createElement("svg", _extends$3I({
825
+ return /*#__PURE__*/React.createElement("svg", _extends$1A({
852
826
  viewBox: "0 0 16 16",
853
827
  fill: "none",
854
828
  strokeLinecap: "round",
855
829
  strokeLinejoin: "round",
856
830
  width: "1em",
857
831
  height: "1em"
858
- }, props), _path$2s || (_path$2s = /*#__PURE__*/React.createElement("path", {
832
+ }, props), _path$Z || (_path$Z = /*#__PURE__*/React.createElement("path", {
859
833
  d: "M8 14.667A6.667 6.667 0 108 1.334a6.667 6.667 0 000 13.333zm0-4V8m0-2.667h.007",
860
834
  stroke: "currentColor"
861
835
  })));
862
836
  }
863
837
 
864
- var _path$1M;
838
+ var _path$C;
865
839
 
866
- function _extends$2S() { _extends$2S = 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$2S.apply(this, arguments); }
840
+ function _extends$15() { _extends$15 = 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$15.apply(this, arguments); }
867
841
 
868
842
  function SvgError(props) {
869
- return /*#__PURE__*/React.createElement("svg", _extends$2S({
843
+ return /*#__PURE__*/React.createElement("svg", _extends$15({
870
844
  viewBox: "0 0 16 16",
871
845
  fill: "none",
872
846
  strokeLinecap: "round",
873
847
  strokeLinejoin: "round",
874
848
  width: "1em",
875
849
  height: "1em"
876
- }, props), _path$1M || (_path$1M = /*#__PURE__*/React.createElement("path", {
850
+ }, props), _path$C || (_path$C = /*#__PURE__*/React.createElement("path", {
877
851
  d: "M5.24 1.333h5.52l3.907 3.907v5.52l-3.907 3.907H5.24L1.333 10.76V5.24L5.24 1.333zm2.76 4V8m0 2.666h.008",
878
852
  stroke: "currentColor"
879
853
  })));
880
854
  }
881
855
 
882
- var _path$1L;
856
+ var _path$B;
883
857
 
884
- function _extends$2R() { _extends$2R = 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$2R.apply(this, arguments); }
858
+ function _extends$14() { _extends$14 = 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$14.apply(this, arguments); }
885
859
 
886
860
  function SvgWarning(props) {
887
- return /*#__PURE__*/React.createElement("svg", _extends$2R({
861
+ return /*#__PURE__*/React.createElement("svg", _extends$14({
888
862
  viewBox: "0 0 16 16",
889
863
  fill: "none",
890
864
  strokeLinecap: "round",
891
865
  strokeLinejoin: "round",
892
866
  width: "1em",
893
867
  height: "1em"
894
- }, props), _path$1L || (_path$1L = /*#__PURE__*/React.createElement("path", {
868
+ }, props), _path$B || (_path$B = /*#__PURE__*/React.createElement("path", {
895
869
  d: "M6.86 2.573L1.213 12a1.334 1.334 0 001.14 2h11.294a1.332 1.332 0 001.14-2L9.14 2.573a1.333 1.333 0 00-2.28 0v0zM8 6v2.667m0 2.667h.007",
896
870
  stroke: "currentColor"
897
871
  })));
898
872
  }
899
873
 
900
- var _path$C;
874
+ var _path$b;
901
875
 
902
- function _extends$U() { _extends$U = 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$U.apply(this, arguments); }
876
+ function _extends$p() { _extends$p = 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$p.apply(this, arguments); }
903
877
 
904
878
  function SvgCircle(props) {
905
- return /*#__PURE__*/React.createElement("svg", _extends$U({
879
+ return /*#__PURE__*/React.createElement("svg", _extends$p({
906
880
  viewBox: "0 0 16 16",
907
881
  fill: "none",
908
882
  strokeLinecap: "round",
909
883
  strokeLinejoin: "round",
910
884
  width: "1em",
911
885
  height: "1em"
912
- }, props), _path$C || (_path$C = /*#__PURE__*/React.createElement("path", {
886
+ }, props), _path$b || (_path$b = /*#__PURE__*/React.createElement("path", {
913
887
  d: "M8 14.667A6.667 6.667 0 108 1.334a6.667 6.667 0 000 13.333z",
914
888
  stroke: "currentColor"
915
889
  })));
@@ -1639,6 +1613,17 @@ var PageSection = function (props) {
1639
1613
  React__default.createElement(CardContent, null, children)));
1640
1614
  };
1641
1615
 
1616
+ var PageSections = function (props) {
1617
+ var children = props.children, restProps = __rest$1(props, ["children"]);
1618
+ return (React__default.createElement(Box, __assign$1({ display: "flex", flexDirection: "column", gridGap: 16 }, restProps), children));
1619
+ };
1620
+
1621
+ var PageSectionTitle = function (props) {
1622
+ var children = props.children, restProps = __rest$1(props, ["children"]);
1623
+ return (React__default.createElement(Box, __assign$1({}, restProps),
1624
+ React__default.createElement(Typography, { gutterBottom: true, variant: "h4" }, children)));
1625
+ };
1626
+
1642
1627
  var SettingsIndexCardGroup = function (props) {
1643
1628
  var children = props.children, restProps = __rest$1(props, ["children"]);
1644
1629
  return (React__default.createElement(Box, __assign$1({ display: "grid", gridGap: 16, gridTemplateColumns: "repeat(auto-fit, minmax(250px, 1fr))" }, restProps), children));
@@ -1670,22 +1655,11 @@ var SettingsIndexCard = forwardRef(function (props, ref) {
1670
1655
  React__default.createElement(Box, { fontSize: "32px", display: "flex", justifyContent: 'space-between', alignItems: "center", paddingBottom: 2 },
1671
1656
  React__default.createElement(Icon, { icon: Icon$1 || SvgHelp, size: "inherit" }),
1672
1657
  showStatusLabel && (React__default.createElement(Typography, { weight: "semi-bold", variant: "body2", color: statusLabel === null || statusLabel === void 0 ? void 0 : statusLabel.color }, statusLabel === null || statusLabel === void 0 ? void 0 : statusLabel.text))),
1673
- React__default.createElement(Typography, { align: "left", variant: "h7", gutterBottom: true }, title),
1658
+ React__default.createElement(Typography, { align: "left", variant: "h6", gutterBottom: true }, title),
1674
1659
  description && (React__default.createElement(Typography, { align: "left", variant: "body2", color: "grey.700" }, description))))));
1675
1660
  });
1676
1661
  SettingsIndexCard.displayName = 'SettingsIndexCard';
1677
1662
 
1678
- var PageSections = function (props) {
1679
- var children = props.children, restProps = __rest$1(props, ["children"]);
1680
- return (React__default.createElement(Box, __assign$1({ display: "flex", flexDirection: "column", gridGap: 16 }, restProps), children));
1681
- };
1682
-
1683
- var PageSectionTitle = function (props) {
1684
- var children = props.children, restProps = __rest$1(props, ["children"]);
1685
- return (React__default.createElement(Box, __assign$1({}, restProps),
1686
- React__default.createElement(Typography, { gutterBottom: true, variant: "h4" }, children)));
1687
- };
1688
-
1689
1663
  var useFullScreenStepperContext = function () { return useContext(FullScreenStepperContext); };
1690
1664
 
1691
1665
  /**
@@ -1782,6 +1756,12 @@ var adminThemeTypography = {
1782
1756
  fontSize: '0.875rem',
1783
1757
  lineHeight: '1.25rem',
1784
1758
  },
1759
+ subtitle1: {
1760
+ fontWeight: 400,
1761
+ fontSize: '0.75rem',
1762
+ lineHeight: '1.125rem',
1763
+ color: '#9E9E9E',
1764
+ },
1785
1765
  button: {
1786
1766
  fontWeight: 500,
1787
1767
  fontSize: '0.875rem',