@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.js CHANGED
@@ -178,12 +178,12 @@ function __rest(s, e) {
178
178
  return t;
179
179
  }
180
180
 
181
- var _path$2P;
181
+ var _path$2Q;
182
182
 
183
- 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); }
183
+ 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); }
184
184
 
185
185
  function SvgUser(props) {
186
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$33({
186
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$35({
187
187
  viewBox: "0 0 16 16",
188
188
  strokeLinecap: "round",
189
189
  strokeLinejoin: "round",
@@ -191,7 +191,7 @@ function SvgUser(props) {
191
191
  width: "1em",
192
192
  height: "1em",
193
193
  fill: "none"
194
- }, props), _path$2P || (_path$2P = /*#__PURE__*/React__namespace.createElement("path", {
194
+ }, props), _path$2Q || (_path$2Q = /*#__PURE__*/React__namespace.createElement("path", {
195
195
  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"
196
196
  })));
197
197
  }
@@ -423,29 +423,108 @@ var Checkbox = React.forwardRef(function (props, ref) {
423
423
  });
424
424
  Checkbox.displayName = 'Checkbox';
425
425
 
426
- var useTypographyStyles = styles.makeStyles(function () { return ({
427
- root: function (_a) {
428
- var _b;
429
- var weight = _a.weight;
430
- return (__assign((_b = {}, _b["& ." + iconStaticClassName] = {
431
- position: 'relative',
432
- top: '0.125em',
433
- padding: '0 0.125em',
434
- boxSizing: 'content-box',
435
- }, _b), (weight && { fontWeight: (weight === 'semi-bold' && 600) || (weight === 'bold' && 700) || 400 })));
436
- },
437
- caption: {
438
- display: 'inline',
439
- },
440
- overline: {
441
- display: 'inline',
442
- },
443
- }); });
426
+ var weights = {
427
+ regular: 400,
428
+ 'semi-bold': 600,
429
+ bold: 700,
430
+ };
431
+ var getColor = function (theme, props) {
432
+ var color = props.color;
433
+ if (color === undefined) {
434
+ return undefined;
435
+ }
436
+ if (['white', 'black'].includes(color)) {
437
+ return theme.palette.common[color];
438
+ }
439
+ if (color.match(/^grey\.\d{3}/)) {
440
+ var scale = color.split('.')[1];
441
+ return theme.palette.grey[scale] || theme.palette.grey[900];
442
+ }
443
+ if ([
444
+ 'primary.light',
445
+ 'primary.dark',
446
+ 'secondary.light',
447
+ 'secondary',
448
+ 'secondary.dark',
449
+ 'info.light',
450
+ 'info.dark',
451
+ 'success.light',
452
+ 'success.dark',
453
+ 'error.light',
454
+ 'error.dark',
455
+ 'warning.light',
456
+ 'warning.dark',
457
+ ].includes(color)) {
458
+ var _a = color.split('.'), paletteKey = _a[0], variant = _a[1];
459
+ return theme.palette[paletteKey][variant];
460
+ }
461
+ if (['success', 'info', 'error', 'warning', 'primary', 'secondary'].includes(color)) {
462
+ return theme.palette[color].main;
463
+ }
464
+ if (['textPrimary', 'textSecondary'].includes(color)) {
465
+ return theme.palette.text[color.slice(4).toLowerCase()];
466
+ }
467
+ return undefined;
468
+ };
469
+ var useTypographyStyles = styles.makeStyles(function (theme) {
470
+ var _a;
471
+ return ({
472
+ root: (_a = {},
473
+ _a["& ." + iconStaticClassName] = {
474
+ position: 'relative',
475
+ top: '0.125em',
476
+ padding: '0 0.125em',
477
+ boxSizing: 'content-box',
478
+ },
479
+ _a.fontFamily = theme.typography.fontFamily,
480
+ _a.fontWeight = function (_a) {
481
+ var variant = _a.variant, weight = _a.weight;
482
+ return (weight ? weights[weight] : theme.typography[variant || 'body1'].fontWeight);
483
+ },
484
+ _a.fontSize = function (_a) {
485
+ var variant = _a.variant;
486
+ return theme.typography[variant || 'body1'].fontSize;
487
+ },
488
+ _a.lineHeight = function (_a) {
489
+ var variant = _a.variant;
490
+ return theme.typography[variant || 'body1'].lineHeight;
491
+ },
492
+ _a.textTransform = function (_a) {
493
+ var variant = _a.variant;
494
+ return theme.typography[variant || 'body1'].textTransform;
495
+ },
496
+ _a.color = function (props) { return getColor(theme, props); },
497
+ _a),
498
+ caption: {
499
+ display: 'inline',
500
+ },
501
+ overline: {
502
+ display: 'inline',
503
+ },
504
+ });
505
+ });
506
+
507
+ var variantMap = {
508
+ h1: 'h1',
509
+ h2: 'h2',
510
+ h3: 'h3',
511
+ h4: 'h4',
512
+ h5: 'h5',
513
+ h6: 'h6',
514
+ h7: 'h6',
515
+ body1: 'p',
516
+ body2: 'p',
517
+ subtitle1: 'h6',
518
+ subtitle2: 'h6',
519
+ caption: 'span',
520
+ overline: 'span',
521
+ };
444
522
 
445
523
  var Typography = React.forwardRef(function (props, ref) {
446
- props.weight; var restProps = __rest(props, ["weight"]);
524
+ props.weight; var _a = props.variant, variant = _a === void 0 ? 'body1' : _a; props.color; var restProps = __rest(props, ["weight", "variant", "color"]);
447
525
  var classes = useTypographyStyles(props);
448
- return React__default['default'].createElement(core.Typography, __assign({ ref: ref, classes: classes }, restProps));
526
+ var component = variantMap[variant];
527
+ return React__default['default'].createElement(core.Typography, __assign({ component: component, ref: ref, classes: classes }, restProps, { variant: "inherit" }));
449
528
  });
450
529
  Typography.displayName = 'Typography';
451
530
 
@@ -715,12 +794,12 @@ var TableHeader = function (props) {
715
794
  return React__default['default'].createElement("thead", __assign$1({}, restProps), children);
716
795
  };
717
796
 
718
- var _path$4x;
797
+ var _path$4y;
719
798
 
720
- 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); }
799
+ 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); }
721
800
 
722
801
  function SvgChevronDown(props) {
723
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$4N({
802
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$4P({
724
803
  viewBox: "0 0 16 16",
725
804
  strokeLinecap: "round",
726
805
  strokeLinejoin: "round",
@@ -728,17 +807,17 @@ function SvgChevronDown(props) {
728
807
  width: "1em",
729
808
  height: "1em",
730
809
  fill: "none"
731
- }, props), _path$4x || (_path$4x = /*#__PURE__*/React__namespace.createElement("path", {
810
+ }, props), _path$4y || (_path$4y = /*#__PURE__*/React__namespace.createElement("path", {
732
811
  d: "M4 6l4 4 4-4"
733
812
  })));
734
813
  }
735
814
 
736
- var _path$4w;
815
+ var _path$4x;
737
816
 
738
- 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); }
817
+ 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); }
739
818
 
740
819
  function SvgChevronUp(props) {
741
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$4M({
820
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$4O({
742
821
  viewBox: "0 0 16 16",
743
822
  strokeLinecap: "round",
744
823
  strokeLinejoin: "round",
@@ -746,17 +825,17 @@ function SvgChevronUp(props) {
746
825
  width: "1em",
747
826
  height: "1em",
748
827
  fill: "none"
749
- }, props), _path$4w || (_path$4w = /*#__PURE__*/React__namespace.createElement("path", {
828
+ }, props), _path$4x || (_path$4x = /*#__PURE__*/React__namespace.createElement("path", {
750
829
  d: "M12 10L8 6l-4 4"
751
830
  })));
752
831
  }
753
832
 
754
- var _path$3d;
833
+ var _path$3e;
755
834
 
756
- 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); }
835
+ 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); }
757
836
 
758
837
  function SvgMore(props) {
759
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$3t({
838
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$3v({
760
839
  viewBox: "0 0 16 16",
761
840
  strokeLinecap: "round",
762
841
  strokeLinejoin: "round",
@@ -764,17 +843,17 @@ function SvgMore(props) {
764
843
  width: "1em",
765
844
  height: "1em",
766
845
  fill: "none"
767
- }, props), _path$3d || (_path$3d = /*#__PURE__*/React__namespace.createElement("path", {
846
+ }, props), _path$3e || (_path$3e = /*#__PURE__*/React__namespace.createElement("path", {
768
847
  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"
769
848
  })));
770
849
  }
771
850
 
772
- var _path$33;
851
+ var _path$34;
773
852
 
774
- 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); }
853
+ 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); }
775
854
 
776
855
  function SvgSearch(props) {
777
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$3j({
856
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$3l({
778
857
  viewBox: "0 0 16 16",
779
858
  strokeLinecap: "round",
780
859
  strokeLinejoin: "round",
@@ -782,7 +861,7 @@ function SvgSearch(props) {
782
861
  width: "1em",
783
862
  height: "1em",
784
863
  fill: "none"
785
- }, props), _path$33 || (_path$33 = /*#__PURE__*/React__namespace.createElement("path", {
864
+ }, props), _path$34 || (_path$34 = /*#__PURE__*/React__namespace.createElement("path", {
786
865
  d: "M7.333 12.667A5.333 5.333 0 107.333 2a5.333 5.333 0 000 10.667zM14 14l-2.9-2.9"
787
866
  })));
788
867
  }