@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.js CHANGED
@@ -178,21 +178,21 @@ function __rest(s, e) {
178
178
  return t;
179
179
  }
180
180
 
181
- var _path$2Q;
181
+ var _path$D;
182
182
 
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); }
183
+ 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); }
184
184
 
185
185
  function SvgUser(props) {
186
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$35({
186
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$16({
187
187
  viewBox: "0 0 16 16",
188
+ fill: "none",
188
189
  strokeLinecap: "round",
189
190
  strokeLinejoin: "round",
190
- stroke: "currentColor",
191
191
  width: "1em",
192
- height: "1em",
193
- fill: "none"
194
- }, props), _path$2Q || (_path$2Q = /*#__PURE__*/React__namespace.createElement("path", {
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"
192
+ height: "1em"
193
+ }, props), _path$D || (_path$D = /*#__PURE__*/React__namespace.createElement("path", {
194
+ 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",
195
+ stroke: "currentColor"
196
196
  })));
197
197
  }
198
198
 
@@ -423,48 +423,35 @@ var Checkbox = React.forwardRef(function (props, ref) {
423
423
  });
424
424
  Checkbox.displayName = 'Checkbox';
425
425
 
426
+ var defaultTypographyProps = {
427
+ variant: 'body1',
428
+ };
429
+
426
430
  var weights = {
427
431
  regular: 400,
432
+ medium: 500,
428
433
  'semi-bold': 600,
429
434
  bold: 700,
430
435
  };
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];
436
+ var getCustomColor = function (theme, color) {
437
+ var isCommonColor = color && ['white', 'black'].includes(color);
438
+ var isGreyColor = color && color.match(/^grey\.\d{3}/);
439
+ var isSemanticColor = color && color.match(/(primary|secondary|info|success|error|warning).?(light|dark)?/);
440
+ var isTextColor = color && ['textPrimary', 'textSecondary'].includes(color);
441
+ switch (true) {
442
+ case isCommonColor:
443
+ return theme.palette.common[color];
444
+ case Boolean(isGreyColor):
445
+ var scale = color.split('.')[1];
446
+ return theme.palette.grey[scale] || theme.palette.grey[900];
447
+ case Boolean(isSemanticColor):
448
+ var _a = color.split('.'), paletteKey = _a[0], _b = _a[1], variant = _b === void 0 ? 'main' : _b;
449
+ return theme.palette[paletteKey][variant];
450
+ case isTextColor:
451
+ return theme.palette.text[color.slice(4).toLowerCase()];
452
+ default:
453
+ return undefined;
460
454
  }
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
455
  };
469
456
  var useTypographyStyles = styles.makeStyles(function (theme) {
470
457
  var _a;
@@ -479,21 +466,24 @@ var useTypographyStyles = styles.makeStyles(function (theme) {
479
466
  _a.fontFamily = theme.typography.fontFamily,
480
467
  _a.fontWeight = function (_a) {
481
468
  var variant = _a.variant, weight = _a.weight;
482
- return (weight ? weights[weight] : theme.typography[variant || 'body1'].fontWeight);
469
+ return (weight ? weights[weight] : theme.typography[variant].fontWeight);
483
470
  },
484
471
  _a.fontSize = function (_a) {
485
472
  var variant = _a.variant;
486
- return theme.typography[variant || 'body1'].fontSize;
473
+ return theme.typography[variant].fontSize;
487
474
  },
488
475
  _a.lineHeight = function (_a) {
489
476
  var variant = _a.variant;
490
- return theme.typography[variant || 'body1'].lineHeight;
477
+ return theme.typography[variant].lineHeight;
491
478
  },
492
479
  _a.textTransform = function (_a) {
493
480
  var variant = _a.variant;
494
- return theme.typography[variant || 'body1'].textTransform;
481
+ return theme.typography[variant].textTransform;
482
+ },
483
+ _a.color = function (_a) {
484
+ var color = _a.color, variant = _a.variant;
485
+ return (color && getCustomColor(theme, color)) || theme.typography[variant].color;
495
486
  },
496
- _a.color = function (props) { return getColor(theme, props); },
497
487
  _a),
498
488
  caption: {
499
489
  display: 'inline',
@@ -504,29 +494,14 @@ var useTypographyStyles = styles.makeStyles(function (theme) {
504
494
  });
505
495
  });
506
496
 
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
- };
522
-
523
497
  var Typography = React.forwardRef(function (props, ref) {
524
- props.weight; var _a = props.variant, variant = _a === void 0 ? 'body1' : _a; props.color; var restProps = __rest(props, ["weight", "variant", "color"]);
525
- var classes = useTypographyStyles(props);
526
- var component = variantMap[variant];
527
- return React__default['default'].createElement(core.Typography, __assign({ component: component, ref: ref, classes: classes }, restProps, { variant: "inherit" }));
498
+ props.weight; props.color; var restProps = __rest(props, ["weight", "color"]);
499
+ var classes = useTypographyStyles(__assign({}, props));
500
+ var variantMapping = { subtitle1: 'p' };
501
+ return React__default['default'].createElement(core.Typography, __assign({ ref: ref, classes: classes, variantMapping: variantMapping }, restProps));
528
502
  });
529
- Typography.displayName = 'Typography';
503
+ Typography.displayName = 'Typography';
504
+ Typography.defaultProps = defaultTypographyProps;
530
505
 
531
506
  var getFadeStop = function (_a, typographyVariant) {
532
507
  var typography = _a.typography;
@@ -794,75 +769,75 @@ var TableHeader = function (props) {
794
769
  return React__default['default'].createElement("thead", __assign$1({}, restProps), children);
795
770
  };
796
771
 
797
- var _path$4y;
772
+ var _path$1h;
798
773
 
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); }
774
+ 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); }
800
775
 
801
776
  function SvgChevronDown(props) {
802
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$4P({
777
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$24({
803
778
  viewBox: "0 0 16 16",
779
+ fill: "none",
804
780
  strokeLinecap: "round",
805
781
  strokeLinejoin: "round",
806
- stroke: "currentColor",
807
782
  width: "1em",
808
- height: "1em",
809
- fill: "none"
810
- }, props), _path$4y || (_path$4y = /*#__PURE__*/React__namespace.createElement("path", {
811
- d: "M4 6l4 4 4-4"
783
+ height: "1em"
784
+ }, props), _path$1h || (_path$1h = /*#__PURE__*/React__namespace.createElement("path", {
785
+ d: "M4 6l4 4 4-4",
786
+ stroke: "currentColor"
812
787
  })));
813
788
  }
814
789
 
815
- var _path$4x;
790
+ var _path$1g;
816
791
 
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); }
792
+ 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); }
818
793
 
819
794
  function SvgChevronUp(props) {
820
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$4O({
795
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$23({
821
796
  viewBox: "0 0 16 16",
797
+ fill: "none",
822
798
  strokeLinecap: "round",
823
799
  strokeLinejoin: "round",
824
- stroke: "currentColor",
825
800
  width: "1em",
826
- height: "1em",
827
- fill: "none"
828
- }, props), _path$4x || (_path$4x = /*#__PURE__*/React__namespace.createElement("path", {
829
- d: "M12 10L8 6l-4 4"
801
+ height: "1em"
802
+ }, props), _path$1g || (_path$1g = /*#__PURE__*/React__namespace.createElement("path", {
803
+ d: "M12 10L8 6l-4 4",
804
+ stroke: "currentColor"
830
805
  })));
831
806
  }
832
807
 
833
- var _path$3e;
808
+ var _path$P;
834
809
 
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); }
810
+ 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); }
836
811
 
837
812
  function SvgMore(props) {
838
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$3v({
813
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$1m({
839
814
  viewBox: "0 0 16 16",
815
+ fill: "none",
840
816
  strokeLinecap: "round",
841
817
  strokeLinejoin: "round",
842
- stroke: "currentColor",
843
818
  width: "1em",
844
- height: "1em",
845
- fill: "none"
846
- }, props), _path$3e || (_path$3e = /*#__PURE__*/React__namespace.createElement("path", {
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"
819
+ height: "1em"
820
+ }, props), _path$P || (_path$P = /*#__PURE__*/React__namespace.createElement("path", {
821
+ 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",
822
+ stroke: "currentColor"
848
823
  })));
849
824
  }
850
825
 
851
- var _path$34;
826
+ var _path$L;
852
827
 
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); }
828
+ 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); }
854
829
 
855
830
  function SvgSearch(props) {
856
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$3l({
831
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$1h({
857
832
  viewBox: "0 0 16 16",
833
+ fill: "none",
858
834
  strokeLinecap: "round",
859
835
  strokeLinejoin: "round",
860
- stroke: "currentColor",
861
836
  width: "1em",
862
- height: "1em",
863
- fill: "none"
864
- }, props), _path$34 || (_path$34 = /*#__PURE__*/React__namespace.createElement("path", {
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"
837
+ height: "1em"
838
+ }, props), _path$L || (_path$L = /*#__PURE__*/React__namespace.createElement("path", {
839
+ d: "M7.333 12.667A5.333 5.333 0 107.333 2a5.333 5.333 0 000 10.667zM14 14l-2.9-2.9",
840
+ stroke: "currentColor"
866
841
  })));
867
842
  }
868
843