@popmenu/table 0.28.0 → 0.31.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,21 +137,21 @@ function __rest(s, e) {
137
137
  return t;
138
138
  }
139
139
 
140
- var _path$2Q;
140
+ var _path$D;
141
141
 
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); }
142
+ 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); }
143
143
 
144
144
  function SvgUser(props) {
145
- return /*#__PURE__*/React.createElement("svg", _extends$35({
145
+ return /*#__PURE__*/React.createElement("svg", _extends$16({
146
146
  viewBox: "0 0 16 16",
147
+ fill: "none",
147
148
  strokeLinecap: "round",
148
149
  strokeLinejoin: "round",
149
- stroke: "currentColor",
150
150
  width: "1em",
151
- height: "1em",
152
- fill: "none"
153
- }, props), _path$2Q || (_path$2Q = /*#__PURE__*/React.createElement("path", {
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"
151
+ height: "1em"
152
+ }, props), _path$D || (_path$D = /*#__PURE__*/React.createElement("path", {
153
+ 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",
154
+ stroke: "currentColor"
155
155
  })));
156
156
  }
157
157
 
@@ -382,48 +382,35 @@ var Checkbox = forwardRef(function (props, ref) {
382
382
  });
383
383
  Checkbox.displayName = 'Checkbox';
384
384
 
385
+ var defaultTypographyProps = {
386
+ variant: 'body1',
387
+ };
388
+
385
389
  var weights = {
386
390
  regular: 400,
391
+ medium: 500,
387
392
  'semi-bold': 600,
388
393
  bold: 700,
389
394
  };
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];
395
+ var getCustomColor = function (theme, color) {
396
+ var isCommonColor = color && ['white', 'black'].includes(color);
397
+ var isGreyColor = color && color.match(/^grey\.\d{3}/);
398
+ var isSemanticColor = color && color.match(/(primary|secondary|info|success|error|warning).?(light|dark)?/);
399
+ var isTextColor = color && ['textPrimary', 'textSecondary'].includes(color);
400
+ switch (true) {
401
+ case isCommonColor:
402
+ return theme.palette.common[color];
403
+ case Boolean(isGreyColor):
404
+ var scale = color.split('.')[1];
405
+ return theme.palette.grey[scale] || theme.palette.grey[900];
406
+ case Boolean(isSemanticColor):
407
+ var _a = color.split('.'), paletteKey = _a[0], _b = _a[1], variant = _b === void 0 ? 'main' : _b;
408
+ return theme.palette[paletteKey][variant];
409
+ case isTextColor:
410
+ return theme.palette.text[color.slice(4).toLowerCase()];
411
+ default:
412
+ return undefined;
419
413
  }
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
414
  };
428
415
  var useTypographyStyles = makeStyles$1(function (theme) {
429
416
  var _a;
@@ -438,21 +425,24 @@ var useTypographyStyles = makeStyles$1(function (theme) {
438
425
  _a.fontFamily = theme.typography.fontFamily,
439
426
  _a.fontWeight = function (_a) {
440
427
  var variant = _a.variant, weight = _a.weight;
441
- return (weight ? weights[weight] : theme.typography[variant || 'body1'].fontWeight);
428
+ return (weight ? weights[weight] : theme.typography[variant].fontWeight);
442
429
  },
443
430
  _a.fontSize = function (_a) {
444
431
  var variant = _a.variant;
445
- return theme.typography[variant || 'body1'].fontSize;
432
+ return theme.typography[variant].fontSize;
446
433
  },
447
434
  _a.lineHeight = function (_a) {
448
435
  var variant = _a.variant;
449
- return theme.typography[variant || 'body1'].lineHeight;
436
+ return theme.typography[variant].lineHeight;
450
437
  },
451
438
  _a.textTransform = function (_a) {
452
439
  var variant = _a.variant;
453
- return theme.typography[variant || 'body1'].textTransform;
440
+ return theme.typography[variant].textTransform;
441
+ },
442
+ _a.color = function (_a) {
443
+ var color = _a.color, variant = _a.variant;
444
+ return (color && getCustomColor(theme, color)) || theme.typography[variant].color;
454
445
  },
455
- _a.color = function (props) { return getColor(theme, props); },
456
446
  _a),
457
447
  caption: {
458
448
  display: 'inline',
@@ -463,29 +453,14 @@ var useTypographyStyles = makeStyles$1(function (theme) {
463
453
  });
464
454
  });
465
455
 
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
- };
481
-
482
456
  var Typography = forwardRef(function (props, ref) {
483
- props.weight; var _a = props.variant, variant = _a === void 0 ? 'body1' : _a; props.color; var restProps = __rest(props, ["weight", "variant", "color"]);
484
- var classes = useTypographyStyles(props);
485
- var component = variantMap[variant];
486
- return React__default.createElement(Typography$1, __assign({ component: component, ref: ref, classes: classes }, restProps, { variant: "inherit" }));
457
+ props.weight; props.color; var restProps = __rest(props, ["weight", "color"]);
458
+ var classes = useTypographyStyles(__assign({}, props));
459
+ var variantMapping = { subtitle1: 'p' };
460
+ return React__default.createElement(Typography$1, __assign({ ref: ref, classes: classes, variantMapping: variantMapping }, restProps));
487
461
  });
488
- Typography.displayName = 'Typography';
462
+ Typography.displayName = 'Typography';
463
+ Typography.defaultProps = defaultTypographyProps;
489
464
 
490
465
  var getFadeStop = function (_a, typographyVariant) {
491
466
  var typography = _a.typography;
@@ -753,75 +728,75 @@ var TableHeader = function (props) {
753
728
  return React__default.createElement("thead", __assign$1({}, restProps), children);
754
729
  };
755
730
 
756
- var _path$4y;
731
+ var _path$1h;
757
732
 
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); }
733
+ function _extends$24() { _extends$24 = 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$24.apply(this, arguments); }
759
734
 
760
735
  function SvgChevronDown(props) {
761
- return /*#__PURE__*/React.createElement("svg", _extends$4P({
736
+ return /*#__PURE__*/React.createElement("svg", _extends$24({
762
737
  viewBox: "0 0 16 16",
738
+ fill: "none",
763
739
  strokeLinecap: "round",
764
740
  strokeLinejoin: "round",
765
- stroke: "currentColor",
766
741
  width: "1em",
767
- height: "1em",
768
- fill: "none"
769
- }, props), _path$4y || (_path$4y = /*#__PURE__*/React.createElement("path", {
770
- d: "M4 6l4 4 4-4"
742
+ height: "1em"
743
+ }, props), _path$1h || (_path$1h = /*#__PURE__*/React.createElement("path", {
744
+ d: "M4 6l4 4 4-4",
745
+ stroke: "currentColor"
771
746
  })));
772
747
  }
773
748
 
774
- var _path$4x;
749
+ var _path$1g;
775
750
 
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); }
751
+ function _extends$23() { _extends$23 = 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$23.apply(this, arguments); }
777
752
 
778
753
  function SvgChevronUp(props) {
779
- return /*#__PURE__*/React.createElement("svg", _extends$4O({
754
+ return /*#__PURE__*/React.createElement("svg", _extends$23({
780
755
  viewBox: "0 0 16 16",
756
+ fill: "none",
781
757
  strokeLinecap: "round",
782
758
  strokeLinejoin: "round",
783
- stroke: "currentColor",
784
759
  width: "1em",
785
- height: "1em",
786
- fill: "none"
787
- }, props), _path$4x || (_path$4x = /*#__PURE__*/React.createElement("path", {
788
- d: "M12 10L8 6l-4 4"
760
+ height: "1em"
761
+ }, props), _path$1g || (_path$1g = /*#__PURE__*/React.createElement("path", {
762
+ d: "M12 10L8 6l-4 4",
763
+ stroke: "currentColor"
789
764
  })));
790
765
  }
791
766
 
792
- var _path$3e;
767
+ var _path$P;
793
768
 
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); }
769
+ 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); }
795
770
 
796
771
  function SvgMore(props) {
797
- return /*#__PURE__*/React.createElement("svg", _extends$3v({
772
+ return /*#__PURE__*/React.createElement("svg", _extends$1m({
798
773
  viewBox: "0 0 16 16",
774
+ fill: "none",
799
775
  strokeLinecap: "round",
800
776
  strokeLinejoin: "round",
801
- stroke: "currentColor",
802
777
  width: "1em",
803
- height: "1em",
804
- fill: "none"
805
- }, props), _path$3e || (_path$3e = /*#__PURE__*/React.createElement("path", {
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"
778
+ height: "1em"
779
+ }, props), _path$P || (_path$P = /*#__PURE__*/React.createElement("path", {
780
+ 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",
781
+ stroke: "currentColor"
807
782
  })));
808
783
  }
809
784
 
810
- var _path$34;
785
+ var _path$L;
811
786
 
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); }
787
+ function _extends$1h() { _extends$1h = 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$1h.apply(this, arguments); }
813
788
 
814
789
  function SvgSearch(props) {
815
- return /*#__PURE__*/React.createElement("svg", _extends$3l({
790
+ return /*#__PURE__*/React.createElement("svg", _extends$1h({
816
791
  viewBox: "0 0 16 16",
792
+ fill: "none",
817
793
  strokeLinecap: "round",
818
794
  strokeLinejoin: "round",
819
- stroke: "currentColor",
820
795
  width: "1em",
821
- height: "1em",
822
- fill: "none"
823
- }, props), _path$34 || (_path$34 = /*#__PURE__*/React.createElement("path", {
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"
796
+ height: "1em"
797
+ }, props), _path$L || (_path$L = /*#__PURE__*/React.createElement("path", {
798
+ d: "M7.333 12.667A5.333 5.333 0 107.333 2a5.333 5.333 0 000 10.667zM14 14l-2.9-2.9",
799
+ stroke: "currentColor"
825
800
  })));
826
801
  }
827
802