@popmenu/table 0.27.0 → 0.28.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.
package/build/index.es.js CHANGED
@@ -137,12 +137,12 @@ function __rest(s, e) {
137
137
  return t;
138
138
  }
139
139
 
140
- var _path$2P;
140
+ var _path$2Q;
141
141
 
142
- function _extends$33() { _extends$33 = 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$33.apply(this, arguments); }
142
+ function _extends$35() { _extends$35 = 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$35.apply(this, arguments); }
143
143
 
144
144
  function SvgUser(props) {
145
- return /*#__PURE__*/React.createElement("svg", _extends$33({
145
+ return /*#__PURE__*/React.createElement("svg", _extends$35({
146
146
  viewBox: "0 0 16 16",
147
147
  strokeLinecap: "round",
148
148
  strokeLinejoin: "round",
@@ -150,7 +150,7 @@ function SvgUser(props) {
150
150
  width: "1em",
151
151
  height: "1em",
152
152
  fill: "none"
153
- }, props), _path$2P || (_path$2P = /*#__PURE__*/React.createElement("path", {
153
+ }, props), _path$2Q || (_path$2Q = /*#__PURE__*/React.createElement("path", {
154
154
  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"
155
155
  })));
156
156
  }
@@ -382,29 +382,108 @@ var Checkbox = forwardRef(function (props, ref) {
382
382
  });
383
383
  Checkbox.displayName = 'Checkbox';
384
384
 
385
- var useTypographyStyles = makeStyles$1(function () { return ({
386
- root: function (_a) {
387
- var _b;
388
- var weight = _a.weight;
389
- return (__assign((_b = {}, _b["& ." + iconStaticClassName] = {
390
- position: 'relative',
391
- top: '0.125em',
392
- padding: '0 0.125em',
393
- boxSizing: 'content-box',
394
- }, _b), (weight && { fontWeight: (weight === 'semi-bold' && 600) || (weight === 'bold' && 700) || 400 })));
395
- },
396
- caption: {
397
- display: 'inline',
398
- },
399
- overline: {
400
- display: 'inline',
401
- },
402
- }); });
385
+ var weights = {
386
+ regular: 400,
387
+ 'semi-bold': 600,
388
+ bold: 700,
389
+ };
390
+ var getColor = function (theme, props) {
391
+ var color = props.color;
392
+ if (color === undefined) {
393
+ return undefined;
394
+ }
395
+ if (['white', 'black'].includes(color)) {
396
+ return theme.palette.common[color];
397
+ }
398
+ if (color.match(/^grey\.\d{3}/)) {
399
+ var scale = color.split('.')[1];
400
+ return theme.palette.grey[scale] || theme.palette.grey[900];
401
+ }
402
+ if ([
403
+ 'primary.light',
404
+ 'primary.dark',
405
+ 'secondary.light',
406
+ 'secondary',
407
+ 'secondary.dark',
408
+ 'info.light',
409
+ 'info.dark',
410
+ 'success.light',
411
+ 'success.dark',
412
+ 'error.light',
413
+ 'error.dark',
414
+ 'warning.light',
415
+ 'warning.dark',
416
+ ].includes(color)) {
417
+ var _a = color.split('.'), paletteKey = _a[0], variant = _a[1];
418
+ return theme.palette[paletteKey][variant];
419
+ }
420
+ if (['success', 'info', 'error', 'warning', 'primary', 'secondary'].includes(color)) {
421
+ return theme.palette[color].main;
422
+ }
423
+ if (['textPrimary', 'textSecondary'].includes(color)) {
424
+ return theme.palette.text[color.slice(4).toLowerCase()];
425
+ }
426
+ return undefined;
427
+ };
428
+ var useTypographyStyles = makeStyles$1(function (theme) {
429
+ var _a;
430
+ return ({
431
+ root: (_a = {},
432
+ _a["& ." + iconStaticClassName] = {
433
+ position: 'relative',
434
+ top: '0.125em',
435
+ padding: '0 0.125em',
436
+ boxSizing: 'content-box',
437
+ },
438
+ _a.fontFamily = theme.typography.fontFamily,
439
+ _a.fontWeight = function (_a) {
440
+ var variant = _a.variant, weight = _a.weight;
441
+ return (weight ? weights[weight] : theme.typography[variant || 'body1'].fontWeight);
442
+ },
443
+ _a.fontSize = function (_a) {
444
+ var variant = _a.variant;
445
+ return theme.typography[variant || 'body1'].fontSize;
446
+ },
447
+ _a.lineHeight = function (_a) {
448
+ var variant = _a.variant;
449
+ return theme.typography[variant || 'body1'].lineHeight;
450
+ },
451
+ _a.textTransform = function (_a) {
452
+ var variant = _a.variant;
453
+ return theme.typography[variant || 'body1'].textTransform;
454
+ },
455
+ _a.color = function (props) { return getColor(theme, props); },
456
+ _a),
457
+ caption: {
458
+ display: 'inline',
459
+ },
460
+ overline: {
461
+ display: 'inline',
462
+ },
463
+ });
464
+ });
465
+
466
+ var variantMap = {
467
+ h1: 'h1',
468
+ h2: 'h2',
469
+ h3: 'h3',
470
+ h4: 'h4',
471
+ h5: 'h5',
472
+ h6: 'h6',
473
+ h7: 'h6',
474
+ body1: 'p',
475
+ body2: 'p',
476
+ subtitle1: 'h6',
477
+ subtitle2: 'h6',
478
+ caption: 'span',
479
+ overline: 'span',
480
+ };
403
481
 
404
482
  var Typography = forwardRef(function (props, ref) {
405
- props.weight; var restProps = __rest(props, ["weight"]);
483
+ props.weight; var _a = props.variant, variant = _a === void 0 ? 'body1' : _a; props.color; var restProps = __rest(props, ["weight", "variant", "color"]);
406
484
  var classes = useTypographyStyles(props);
407
- return React__default.createElement(Typography$1, __assign({ ref: ref, classes: classes }, restProps));
485
+ var component = variantMap[variant];
486
+ return React__default.createElement(Typography$1, __assign({ component: component, ref: ref, classes: classes }, restProps, { variant: "inherit" }));
408
487
  });
409
488
  Typography.displayName = 'Typography';
410
489
 
@@ -674,12 +753,12 @@ var TableHeader = function (props) {
674
753
  return React__default.createElement("thead", __assign$1({}, restProps), children);
675
754
  };
676
755
 
677
- var _path$4x;
756
+ var _path$4y;
678
757
 
679
- function _extends$4N() { _extends$4N = 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$4N.apply(this, arguments); }
758
+ function _extends$4P() { _extends$4P = 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$4P.apply(this, arguments); }
680
759
 
681
760
  function SvgChevronDown(props) {
682
- return /*#__PURE__*/React.createElement("svg", _extends$4N({
761
+ return /*#__PURE__*/React.createElement("svg", _extends$4P({
683
762
  viewBox: "0 0 16 16",
684
763
  strokeLinecap: "round",
685
764
  strokeLinejoin: "round",
@@ -687,17 +766,17 @@ function SvgChevronDown(props) {
687
766
  width: "1em",
688
767
  height: "1em",
689
768
  fill: "none"
690
- }, props), _path$4x || (_path$4x = /*#__PURE__*/React.createElement("path", {
769
+ }, props), _path$4y || (_path$4y = /*#__PURE__*/React.createElement("path", {
691
770
  d: "M4 6l4 4 4-4"
692
771
  })));
693
772
  }
694
773
 
695
- var _path$4w;
774
+ var _path$4x;
696
775
 
697
- function _extends$4M() { _extends$4M = 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$4M.apply(this, arguments); }
776
+ function _extends$4O() { _extends$4O = 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$4O.apply(this, arguments); }
698
777
 
699
778
  function SvgChevronUp(props) {
700
- return /*#__PURE__*/React.createElement("svg", _extends$4M({
779
+ return /*#__PURE__*/React.createElement("svg", _extends$4O({
701
780
  viewBox: "0 0 16 16",
702
781
  strokeLinecap: "round",
703
782
  strokeLinejoin: "round",
@@ -705,17 +784,17 @@ function SvgChevronUp(props) {
705
784
  width: "1em",
706
785
  height: "1em",
707
786
  fill: "none"
708
- }, props), _path$4w || (_path$4w = /*#__PURE__*/React.createElement("path", {
787
+ }, props), _path$4x || (_path$4x = /*#__PURE__*/React.createElement("path", {
709
788
  d: "M12 10L8 6l-4 4"
710
789
  })));
711
790
  }
712
791
 
713
- var _path$3d;
792
+ var _path$3e;
714
793
 
715
- function _extends$3t() { _extends$3t = 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$3t.apply(this, arguments); }
794
+ function _extends$3v() { _extends$3v = 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$3v.apply(this, arguments); }
716
795
 
717
796
  function SvgMore(props) {
718
- return /*#__PURE__*/React.createElement("svg", _extends$3t({
797
+ return /*#__PURE__*/React.createElement("svg", _extends$3v({
719
798
  viewBox: "0 0 16 16",
720
799
  strokeLinecap: "round",
721
800
  strokeLinejoin: "round",
@@ -723,17 +802,17 @@ function SvgMore(props) {
723
802
  width: "1em",
724
803
  height: "1em",
725
804
  fill: "none"
726
- }, props), _path$3d || (_path$3d = /*#__PURE__*/React.createElement("path", {
805
+ }, props), _path$3e || (_path$3e = /*#__PURE__*/React.createElement("path", {
727
806
  d: "M8 8.667a.667.667 0 100-1.334.667.667 0 000 1.334zM8 4a.667.667 0 100-1.334A.667.667 0 008 4zm0 9.333A.667.667 0 108 12a.667.667 0 000 1.333z"
728
807
  })));
729
808
  }
730
809
 
731
- var _path$33;
810
+ var _path$34;
732
811
 
733
- 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); }
812
+ 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); }
734
813
 
735
814
  function SvgSearch(props) {
736
- return /*#__PURE__*/React.createElement("svg", _extends$3j({
815
+ return /*#__PURE__*/React.createElement("svg", _extends$3l({
737
816
  viewBox: "0 0 16 16",
738
817
  strokeLinecap: "round",
739
818
  strokeLinejoin: "round",
@@ -741,7 +820,7 @@ function SvgSearch(props) {
741
820
  width: "1em",
742
821
  height: "1em",
743
822
  fill: "none"
744
- }, props), _path$33 || (_path$33 = /*#__PURE__*/React.createElement("path", {
823
+ }, props), _path$34 || (_path$34 = /*#__PURE__*/React.createElement("path", {
745
824
  d: "M7.333 12.667A5.333 5.333 0 107.333 2a5.333 5.333 0 000 10.667zM14 14l-2.9-2.9"
746
825
  })));
747
826
  }