@popmenu/common-ui 0.40.3 → 0.43.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
@@ -20,7 +20,7 @@ var CardHeader = require('@material-ui/core/CardHeader');
20
20
  var CardMedia = require('@material-ui/core/CardMedia');
21
21
  var MuiCheckbox = require('@material-ui/core/Checkbox');
22
22
  var FormControlLabel = require('@material-ui/core/FormControlLabel');
23
- var Chip = require('@material-ui/core/Chip');
23
+ var MuiChip = require('@material-ui/core/Chip');
24
24
  var Collapse = require('@material-ui/core/Collapse');
25
25
  var Dialog = require('@material-ui/core/Dialog');
26
26
  var DialogActions = require('@material-ui/core/DialogActions');
@@ -89,7 +89,7 @@ var CardHeader__default = /*#__PURE__*/_interopDefaultLegacy(CardHeader);
89
89
  var CardMedia__default = /*#__PURE__*/_interopDefaultLegacy(CardMedia);
90
90
  var MuiCheckbox__default = /*#__PURE__*/_interopDefaultLegacy(MuiCheckbox);
91
91
  var FormControlLabel__default = /*#__PURE__*/_interopDefaultLegacy(FormControlLabel);
92
- var Chip__default = /*#__PURE__*/_interopDefaultLegacy(Chip);
92
+ var MuiChip__default = /*#__PURE__*/_interopDefaultLegacy(MuiChip);
93
93
  var Collapse__default = /*#__PURE__*/_interopDefaultLegacy(Collapse);
94
94
  var Dialog__default = /*#__PURE__*/_interopDefaultLegacy(Dialog);
95
95
  var DialogActions__default = /*#__PURE__*/_interopDefaultLegacy(DialogActions);
@@ -157,60 +157,169 @@ function __rest(s, e) {
157
157
  return t;
158
158
  }
159
159
 
160
- var _path$V;
160
+ var _g$17, _defs$I;
161
161
 
162
- function _extends$1D() { _extends$1D = 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$1D.apply(this, arguments); }
162
+ function _extends$25() { _extends$25 = 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$25.apply(this, arguments); }
163
+
164
+ function SvgCheckCircle(props) {
165
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$25({
166
+ viewBox: "0 0 16 16",
167
+ fill: "none",
168
+ strokeLinecap: "round",
169
+ strokeLinejoin: "round",
170
+ width: "1em",
171
+ height: "1em"
172
+ }, props), _g$17 || (_g$17 = /*#__PURE__*/React__namespace.createElement("g", {
173
+ clipPath: "url(#check-circle_svg__clip0_8_5831)",
174
+ stroke: "currentColor"
175
+ }, /*#__PURE__*/React__namespace.createElement("path", {
176
+ d: "M14.667 7.387V8a6.667 6.667 0 11-3.954-6.093"
177
+ }), /*#__PURE__*/React__namespace.createElement("path", {
178
+ d: "M14.667 2.667L8 9.34l-2-2"
179
+ }))), _defs$I || (_defs$I = /*#__PURE__*/React__namespace.createElement("defs", null, /*#__PURE__*/React__namespace.createElement("clipPath", {
180
+ id: "check-circle_svg__clip0_8_5831"
181
+ }, /*#__PURE__*/React__namespace.createElement("path", {
182
+ fill: "currentColor",
183
+ d: "M0 0h16v16H0z"
184
+ })))));
185
+ }
186
+
187
+ var _g$Z, _defs$A;
188
+
189
+ function _extends$1T() { _extends$1T = 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$1T.apply(this, arguments); }
190
+
191
+ function SvgInfo(props) {
192
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$1T({
193
+ viewBox: "0 0 16 16",
194
+ fill: "none",
195
+ strokeLinecap: "round",
196
+ strokeLinejoin: "round",
197
+ width: "1em",
198
+ height: "1em"
199
+ }, props), _g$Z || (_g$Z = /*#__PURE__*/React__namespace.createElement("g", {
200
+ clipPath: "url(#info_svg__clip0_8_5377)",
201
+ stroke: "currentColor"
202
+ }, /*#__PURE__*/React__namespace.createElement("path", {
203
+ d: "M8 14.667A6.667 6.667 0 108 1.334a6.667 6.667 0 000 13.333zm0-4V8m0-2.667h.007"
204
+ }))), _defs$A || (_defs$A = /*#__PURE__*/React__namespace.createElement("defs", null, /*#__PURE__*/React__namespace.createElement("clipPath", {
205
+ id: "info_svg__clip0_8_5377"
206
+ }, /*#__PURE__*/React__namespace.createElement("path", {
207
+ fill: "currentColor",
208
+ d: "M0 0h16v16H0z"
209
+ })))));
210
+ }
211
+
212
+ var _g$V, _defs$z;
213
+
214
+ function _extends$1J() { _extends$1J = 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$1J.apply(this, arguments); }
163
215
 
164
216
  function SvgMinusCircle(props) {
165
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$1D({
217
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$1J({
166
218
  viewBox: "0 0 16 16",
167
219
  fill: "none",
168
220
  strokeLinecap: "round",
169
221
  strokeLinejoin: "round",
170
222
  width: "1em",
171
223
  height: "1em"
172
- }, props), _path$V || (_path$V = /*#__PURE__*/React__namespace.createElement("path", {
173
- d: "M8 14.667A6.667 6.667 0 108 1.334a6.667 6.667 0 000 13.333zM5.333 8h5.334",
224
+ }, props), _g$V || (_g$V = /*#__PURE__*/React__namespace.createElement("g", {
225
+ clipPath: "url(#minus-circle_svg__clip0_8_5970)",
174
226
  stroke: "currentColor"
175
- })));
227
+ }, /*#__PURE__*/React__namespace.createElement("path", {
228
+ d: "M8 14.667A6.667 6.667 0 108 1.334a6.667 6.667 0 000 13.333zM5.333 8h5.334"
229
+ }))), _defs$z || (_defs$z = /*#__PURE__*/React__namespace.createElement("defs", null, /*#__PURE__*/React__namespace.createElement("clipPath", {
230
+ id: "minus-circle_svg__clip0_8_5970"
231
+ }, /*#__PURE__*/React__namespace.createElement("path", {
232
+ fill: "currentColor",
233
+ d: "M0 0h16v16H0z"
234
+ })))));
176
235
  }
177
236
 
178
- var _path$R;
237
+ var _g$U, _defs$y;
179
238
 
180
- function _extends$1z() { _extends$1z = 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$1z.apply(this, arguments); }
239
+ function _extends$1F() { _extends$1F = 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$1F.apply(this, arguments); }
181
240
 
182
241
  function SvgPlusCircle(props) {
183
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$1z({
242
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$1F({
184
243
  viewBox: "0 0 16 16",
185
244
  fill: "none",
186
245
  strokeLinecap: "round",
187
246
  strokeLinejoin: "round",
188
247
  width: "1em",
189
248
  height: "1em"
190
- }, props), _path$R || (_path$R = /*#__PURE__*/React__namespace.createElement("path", {
191
- d: "M8 14.667A6.667 6.667 0 108 1.334a6.667 6.667 0 000 13.333zm0-9.334v5.334M5.333 8h5.334",
249
+ }, props), _g$U || (_g$U = /*#__PURE__*/React__namespace.createElement("g", {
250
+ clipPath: "url(#plus-circle_svg__clip0_8_5870)",
192
251
  stroke: "currentColor"
193
- })));
252
+ }, /*#__PURE__*/React__namespace.createElement("path", {
253
+ d: "M8 14.667A6.667 6.667 0 108 1.334a6.667 6.667 0 000 13.333zm0-9.334v5.334M5.333 8h5.334"
254
+ }))), _defs$y || (_defs$y = /*#__PURE__*/React__namespace.createElement("defs", null, /*#__PURE__*/React__namespace.createElement("clipPath", {
255
+ id: "plus-circle_svg__clip0_8_5870"
256
+ }, /*#__PURE__*/React__namespace.createElement("path", {
257
+ fill: "currentColor",
258
+ d: "M0 0h16v16H0z"
259
+ })))));
194
260
  }
195
261
 
196
- var _path$I;
262
+ var _path$F;
197
263
 
198
- 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); }
264
+ function _extends$1s() { _extends$1s = 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$1s.apply(this, arguments); }
199
265
 
200
266
  function SvgUser(props) {
201
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$1m({
267
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$1s({
202
268
  viewBox: "0 0 16 16",
203
269
  fill: "none",
204
270
  strokeLinecap: "round",
205
271
  strokeLinejoin: "round",
206
272
  width: "1em",
207
273
  height: "1em"
208
- }, props), _path$I || (_path$I = /*#__PURE__*/React__namespace.createElement("path", {
274
+ }, props), _path$F || (_path$F = /*#__PURE__*/React__namespace.createElement("path", {
209
275
  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",
210
276
  stroke: "currentColor"
211
277
  })));
212
278
  }
213
279
 
280
+ var _g$K, _defs$r;
281
+
282
+ 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); }
283
+
284
+ function SvgError(props) {
285
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$1o({
286
+ viewBox: "0 0 16 16",
287
+ fill: "none",
288
+ strokeLinecap: "round",
289
+ strokeLinejoin: "round",
290
+ width: "1em",
291
+ height: "1em"
292
+ }, props), _g$K || (_g$K = /*#__PURE__*/React__namespace.createElement("g", {
293
+ clipPath: "url(#error_svg__clip0_8_5411)",
294
+ stroke: "currentColor"
295
+ }, /*#__PURE__*/React__namespace.createElement("path", {
296
+ 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"
297
+ }))), _defs$r || (_defs$r = /*#__PURE__*/React__namespace.createElement("defs", null, /*#__PURE__*/React__namespace.createElement("clipPath", {
298
+ id: "error_svg__clip0_8_5411"
299
+ }, /*#__PURE__*/React__namespace.createElement("path", {
300
+ fill: "currentColor",
301
+ d: "M0 0h16v16H0z"
302
+ })))));
303
+ }
304
+
305
+ var _path$C;
306
+
307
+ function _extends$1n() { _extends$1n = 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$1n.apply(this, arguments); }
308
+
309
+ function SvgWarning(props) {
310
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$1n({
311
+ viewBox: "0 0 16 16",
312
+ fill: "none",
313
+ strokeLinecap: "round",
314
+ strokeLinejoin: "round",
315
+ width: "1em",
316
+ height: "1em"
317
+ }, props), _path$C || (_path$C = /*#__PURE__*/React__namespace.createElement("path", {
318
+ 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",
319
+ stroke: "currentColor"
320
+ })));
321
+ }
322
+
214
323
  var useIconStyles = core.makeStyles(function (_a) {
215
324
  var spacing = _a.spacing, palette = _a.palette;
216
325
  var getFontSize = function (_a) {
@@ -438,6 +547,93 @@ var Checkbox = React.forwardRef(function (props, ref) {
438
547
  });
439
548
  Checkbox.displayName = 'Checkbox';
440
549
 
550
+ var getBackground = function (theme) { return function (props) {
551
+ var variant = props.variant, severity = props.severity;
552
+ var background;
553
+ var backgrounds = {
554
+ outlined: 'none',
555
+ error: 'error.main',
556
+ warning: 'warning.main',
557
+ info: 'info.light',
558
+ success: 'success.light',
559
+ };
560
+ if (variant === 'outlined') {
561
+ background = backgrounds[variant];
562
+ }
563
+ else if (severity) {
564
+ var _a = backgrounds[severity].split('.'), color = _a[0], colorVariant = _a[1];
565
+ background = theme.palette[color][colorVariant];
566
+ }
567
+ return background;
568
+ }; };
569
+ var getColor = function (theme) { return function (props) {
570
+ var variant = props.variant, severity = props.severity;
571
+ var textColor;
572
+ if (variant === 'outlined' && severity) {
573
+ var textColors = {
574
+ error: theme.palette.error.main,
575
+ info: theme.palette.info.main,
576
+ warning: theme.palette.warning.dark,
577
+ success: theme.palette.success.dark,
578
+ };
579
+ textColor = textColors[severity];
580
+ }
581
+ else if (variant === 'outlined' && !severity) {
582
+ textColor = theme.palette.grey[700];
583
+ }
584
+ else if ((variant === 'default' || variant === undefined) && severity) {
585
+ var textColors = {
586
+ error: theme.palette.common.white,
587
+ info: theme.palette.secondary.main,
588
+ warning: theme.palette.secondary.main,
589
+ success: theme.palette.secondary.main,
590
+ };
591
+ textColor = textColors[severity];
592
+ }
593
+ return textColor;
594
+ }; };
595
+ var getBorder = function (theme) { return function (props) {
596
+ var variant = props.variant, severity = props.severity;
597
+ var borderColor;
598
+ if (variant === 'outlined' && severity) {
599
+ var borderColors = {
600
+ error: theme.palette.error.main,
601
+ info: theme.palette.info.main,
602
+ warning: theme.palette.warning.dark,
603
+ success: theme.palette.success.dark,
604
+ };
605
+ borderColor = borderColors[severity];
606
+ }
607
+ return borderColor;
608
+ }; };
609
+ var useChipStyles = styles.makeStyles(function (theme) { return ({
610
+ root: {
611
+ background: getBackground(theme),
612
+ color: getColor(theme),
613
+ borderColor: getBorder(theme),
614
+ borderRadius: theme.spacing(0.5),
615
+ },
616
+ icon: {
617
+ color: 'inherit',
618
+ height: theme.spacing(2),
619
+ width: theme.spacing(2),
620
+ },
621
+ }); });
622
+
623
+ var IconDictionary = {
624
+ error: SvgError,
625
+ info: SvgInfo,
626
+ success: SvgCheckCircle,
627
+ warning: SvgWarning,
628
+ };
629
+ var Chip = function (props) {
630
+ var severity = props.severity, restProps = __rest(props, ["severity"]);
631
+ var classes = useChipStyles(props);
632
+ var icon = severity ? React__default['default'].createElement(IconDictionary[severity]) : undefined;
633
+ return React__default['default'].createElement(MuiChip__default['default'], __assign({ classes: classes, icon: icon }, restProps));
634
+ };
635
+ Chip.displayName = 'Chip';
636
+
441
637
  var defaultTypographyProps = {
442
638
  variant: 'body1',
443
639
  };
@@ -1174,12 +1370,6 @@ Object.defineProperty(exports, 'FormControlLabel', {
1174
1370
  return FormControlLabel__default['default'];
1175
1371
  }
1176
1372
  });
1177
- Object.defineProperty(exports, 'Chip', {
1178
- enumerable: true,
1179
- get: function () {
1180
- return Chip__default['default'];
1181
- }
1182
- });
1183
1373
  Object.defineProperty(exports, 'Dialog', {
1184
1374
  enumerable: true,
1185
1375
  get: function () {
@@ -1309,6 +1499,7 @@ Object.defineProperty(exports, 'Tabs', {
1309
1499
  exports.Avatar = Avatar;
1310
1500
  exports.Button = Button;
1311
1501
  exports.Checkbox = Checkbox;
1502
+ exports.Chip = Chip;
1312
1503
  exports.CollapsibleText = CollapsibleText;
1313
1504
  exports.Divider = Divider;
1314
1505
  exports.Icon = Icon;