@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.
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ import { ChipProps } from './ChipProps';
3
+ export declare const Chip: {
4
+ (props: ChipProps): JSX.Element;
5
+ displayName: string;
6
+ };
@@ -0,0 +1,4 @@
1
+ import { ChipProps as MuiChipProps } from '@material-ui/core/Chip';
2
+ export interface ChipProps extends MuiChipProps {
3
+ severity?: 'success' | 'info' | 'warning' | 'error';
4
+ }
@@ -0,0 +1,2 @@
1
+ import { ChipProps } from './ChipProps';
2
+ export declare const useChipStyles: (props: ChipProps) => import("@material-ui/styles").ClassNameMap<string>;
@@ -1 +1,2 @@
1
- export { default, ChipProps } from '@material-ui/core/Chip';
1
+ export { Chip as default } from './Chip';
2
+ export { ChipProps } from './ChipProps';
package/build/index.es.js CHANGED
@@ -21,7 +21,7 @@ export { default as CardMedia } from '@material-ui/core/CardMedia';
21
21
  import MuiCheckbox from '@material-ui/core/Checkbox';
22
22
  import FormControlLabel from '@material-ui/core/FormControlLabel';
23
23
  export { default as FormControlLabel } from '@material-ui/core/FormControlLabel';
24
- export { default as Chip } from '@material-ui/core/Chip';
24
+ import MuiChip from '@material-ui/core/Chip';
25
25
  import Collapse from '@material-ui/core/Collapse';
26
26
  export { default as Dialog } from '@material-ui/core/Dialog';
27
27
  export { default as DialogActions } from '@material-ui/core/DialogActions';
@@ -90,60 +90,169 @@ function __rest(s, e) {
90
90
  return t;
91
91
  }
92
92
 
93
- var _path$V;
93
+ var _g$17, _defs$I;
94
94
 
95
- 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); }
95
+ 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); }
96
+
97
+ function SvgCheckCircle(props) {
98
+ return /*#__PURE__*/React.createElement("svg", _extends$25({
99
+ viewBox: "0 0 16 16",
100
+ fill: "none",
101
+ strokeLinecap: "round",
102
+ strokeLinejoin: "round",
103
+ width: "1em",
104
+ height: "1em"
105
+ }, props), _g$17 || (_g$17 = /*#__PURE__*/React.createElement("g", {
106
+ clipPath: "url(#check-circle_svg__clip0_8_5831)",
107
+ stroke: "currentColor"
108
+ }, /*#__PURE__*/React.createElement("path", {
109
+ d: "M14.667 7.387V8a6.667 6.667 0 11-3.954-6.093"
110
+ }), /*#__PURE__*/React.createElement("path", {
111
+ d: "M14.667 2.667L8 9.34l-2-2"
112
+ }))), _defs$I || (_defs$I = /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("clipPath", {
113
+ id: "check-circle_svg__clip0_8_5831"
114
+ }, /*#__PURE__*/React.createElement("path", {
115
+ fill: "currentColor",
116
+ d: "M0 0h16v16H0z"
117
+ })))));
118
+ }
119
+
120
+ var _g$Z, _defs$A;
121
+
122
+ 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); }
123
+
124
+ function SvgInfo(props) {
125
+ return /*#__PURE__*/React.createElement("svg", _extends$1T({
126
+ viewBox: "0 0 16 16",
127
+ fill: "none",
128
+ strokeLinecap: "round",
129
+ strokeLinejoin: "round",
130
+ width: "1em",
131
+ height: "1em"
132
+ }, props), _g$Z || (_g$Z = /*#__PURE__*/React.createElement("g", {
133
+ clipPath: "url(#info_svg__clip0_8_5377)",
134
+ stroke: "currentColor"
135
+ }, /*#__PURE__*/React.createElement("path", {
136
+ d: "M8 14.667A6.667 6.667 0 108 1.334a6.667 6.667 0 000 13.333zm0-4V8m0-2.667h.007"
137
+ }))), _defs$A || (_defs$A = /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("clipPath", {
138
+ id: "info_svg__clip0_8_5377"
139
+ }, /*#__PURE__*/React.createElement("path", {
140
+ fill: "currentColor",
141
+ d: "M0 0h16v16H0z"
142
+ })))));
143
+ }
144
+
145
+ var _g$V, _defs$z;
146
+
147
+ 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); }
96
148
 
97
149
  function SvgMinusCircle(props) {
98
- return /*#__PURE__*/React.createElement("svg", _extends$1D({
150
+ return /*#__PURE__*/React.createElement("svg", _extends$1J({
99
151
  viewBox: "0 0 16 16",
100
152
  fill: "none",
101
153
  strokeLinecap: "round",
102
154
  strokeLinejoin: "round",
103
155
  width: "1em",
104
156
  height: "1em"
105
- }, props), _path$V || (_path$V = /*#__PURE__*/React.createElement("path", {
106
- d: "M8 14.667A6.667 6.667 0 108 1.334a6.667 6.667 0 000 13.333zM5.333 8h5.334",
157
+ }, props), _g$V || (_g$V = /*#__PURE__*/React.createElement("g", {
158
+ clipPath: "url(#minus-circle_svg__clip0_8_5970)",
107
159
  stroke: "currentColor"
108
- })));
160
+ }, /*#__PURE__*/React.createElement("path", {
161
+ d: "M8 14.667A6.667 6.667 0 108 1.334a6.667 6.667 0 000 13.333zM5.333 8h5.334"
162
+ }))), _defs$z || (_defs$z = /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("clipPath", {
163
+ id: "minus-circle_svg__clip0_8_5970"
164
+ }, /*#__PURE__*/React.createElement("path", {
165
+ fill: "currentColor",
166
+ d: "M0 0h16v16H0z"
167
+ })))));
109
168
  }
110
169
 
111
- var _path$R;
170
+ var _g$U, _defs$y;
112
171
 
113
- 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); }
172
+ 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); }
114
173
 
115
174
  function SvgPlusCircle(props) {
116
- return /*#__PURE__*/React.createElement("svg", _extends$1z({
175
+ return /*#__PURE__*/React.createElement("svg", _extends$1F({
117
176
  viewBox: "0 0 16 16",
118
177
  fill: "none",
119
178
  strokeLinecap: "round",
120
179
  strokeLinejoin: "round",
121
180
  width: "1em",
122
181
  height: "1em"
123
- }, props), _path$R || (_path$R = /*#__PURE__*/React.createElement("path", {
124
- d: "M8 14.667A6.667 6.667 0 108 1.334a6.667 6.667 0 000 13.333zm0-9.334v5.334M5.333 8h5.334",
182
+ }, props), _g$U || (_g$U = /*#__PURE__*/React.createElement("g", {
183
+ clipPath: "url(#plus-circle_svg__clip0_8_5870)",
125
184
  stroke: "currentColor"
126
- })));
185
+ }, /*#__PURE__*/React.createElement("path", {
186
+ d: "M8 14.667A6.667 6.667 0 108 1.334a6.667 6.667 0 000 13.333zm0-9.334v5.334M5.333 8h5.334"
187
+ }))), _defs$y || (_defs$y = /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("clipPath", {
188
+ id: "plus-circle_svg__clip0_8_5870"
189
+ }, /*#__PURE__*/React.createElement("path", {
190
+ fill: "currentColor",
191
+ d: "M0 0h16v16H0z"
192
+ })))));
127
193
  }
128
194
 
129
- var _path$I;
195
+ var _path$F;
130
196
 
131
- 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); }
197
+ 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); }
132
198
 
133
199
  function SvgUser(props) {
134
- return /*#__PURE__*/React.createElement("svg", _extends$1m({
200
+ return /*#__PURE__*/React.createElement("svg", _extends$1s({
135
201
  viewBox: "0 0 16 16",
136
202
  fill: "none",
137
203
  strokeLinecap: "round",
138
204
  strokeLinejoin: "round",
139
205
  width: "1em",
140
206
  height: "1em"
141
- }, props), _path$I || (_path$I = /*#__PURE__*/React.createElement("path", {
207
+ }, props), _path$F || (_path$F = /*#__PURE__*/React.createElement("path", {
142
208
  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",
143
209
  stroke: "currentColor"
144
210
  })));
145
211
  }
146
212
 
213
+ var _g$K, _defs$r;
214
+
215
+ 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); }
216
+
217
+ function SvgError(props) {
218
+ return /*#__PURE__*/React.createElement("svg", _extends$1o({
219
+ viewBox: "0 0 16 16",
220
+ fill: "none",
221
+ strokeLinecap: "round",
222
+ strokeLinejoin: "round",
223
+ width: "1em",
224
+ height: "1em"
225
+ }, props), _g$K || (_g$K = /*#__PURE__*/React.createElement("g", {
226
+ clipPath: "url(#error_svg__clip0_8_5411)",
227
+ stroke: "currentColor"
228
+ }, /*#__PURE__*/React.createElement("path", {
229
+ 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"
230
+ }))), _defs$r || (_defs$r = /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("clipPath", {
231
+ id: "error_svg__clip0_8_5411"
232
+ }, /*#__PURE__*/React.createElement("path", {
233
+ fill: "currentColor",
234
+ d: "M0 0h16v16H0z"
235
+ })))));
236
+ }
237
+
238
+ var _path$C;
239
+
240
+ 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); }
241
+
242
+ function SvgWarning(props) {
243
+ return /*#__PURE__*/React.createElement("svg", _extends$1n({
244
+ viewBox: "0 0 16 16",
245
+ fill: "none",
246
+ strokeLinecap: "round",
247
+ strokeLinejoin: "round",
248
+ width: "1em",
249
+ height: "1em"
250
+ }, props), _path$C || (_path$C = /*#__PURE__*/React.createElement("path", {
251
+ 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",
252
+ stroke: "currentColor"
253
+ })));
254
+ }
255
+
147
256
  var useIconStyles = makeStyles(function (_a) {
148
257
  var spacing = _a.spacing, palette = _a.palette;
149
258
  var getFontSize = function (_a) {
@@ -371,6 +480,93 @@ var Checkbox = forwardRef(function (props, ref) {
371
480
  });
372
481
  Checkbox.displayName = 'Checkbox';
373
482
 
483
+ var getBackground = function (theme) { return function (props) {
484
+ var variant = props.variant, severity = props.severity;
485
+ var background;
486
+ var backgrounds = {
487
+ outlined: 'none',
488
+ error: 'error.main',
489
+ warning: 'warning.main',
490
+ info: 'info.light',
491
+ success: 'success.light',
492
+ };
493
+ if (variant === 'outlined') {
494
+ background = backgrounds[variant];
495
+ }
496
+ else if (severity) {
497
+ var _a = backgrounds[severity].split('.'), color = _a[0], colorVariant = _a[1];
498
+ background = theme.palette[color][colorVariant];
499
+ }
500
+ return background;
501
+ }; };
502
+ var getColor = function (theme) { return function (props) {
503
+ var variant = props.variant, severity = props.severity;
504
+ var textColor;
505
+ if (variant === 'outlined' && severity) {
506
+ var textColors = {
507
+ error: theme.palette.error.main,
508
+ info: theme.palette.info.main,
509
+ warning: theme.palette.warning.dark,
510
+ success: theme.palette.success.dark,
511
+ };
512
+ textColor = textColors[severity];
513
+ }
514
+ else if (variant === 'outlined' && !severity) {
515
+ textColor = theme.palette.grey[700];
516
+ }
517
+ else if ((variant === 'default' || variant === undefined) && severity) {
518
+ var textColors = {
519
+ error: theme.palette.common.white,
520
+ info: theme.palette.secondary.main,
521
+ warning: theme.palette.secondary.main,
522
+ success: theme.palette.secondary.main,
523
+ };
524
+ textColor = textColors[severity];
525
+ }
526
+ return textColor;
527
+ }; };
528
+ var getBorder = function (theme) { return function (props) {
529
+ var variant = props.variant, severity = props.severity;
530
+ var borderColor;
531
+ if (variant === 'outlined' && severity) {
532
+ var borderColors = {
533
+ error: theme.palette.error.main,
534
+ info: theme.palette.info.main,
535
+ warning: theme.palette.warning.dark,
536
+ success: theme.palette.success.dark,
537
+ };
538
+ borderColor = borderColors[severity];
539
+ }
540
+ return borderColor;
541
+ }; };
542
+ var useChipStyles = makeStyles$1(function (theme) { return ({
543
+ root: {
544
+ background: getBackground(theme),
545
+ color: getColor(theme),
546
+ borderColor: getBorder(theme),
547
+ borderRadius: theme.spacing(0.5),
548
+ },
549
+ icon: {
550
+ color: 'inherit',
551
+ height: theme.spacing(2),
552
+ width: theme.spacing(2),
553
+ },
554
+ }); });
555
+
556
+ var IconDictionary = {
557
+ error: SvgError,
558
+ info: SvgInfo,
559
+ success: SvgCheckCircle,
560
+ warning: SvgWarning,
561
+ };
562
+ var Chip = function (props) {
563
+ var severity = props.severity, restProps = __rest(props, ["severity"]);
564
+ var classes = useChipStyles(props);
565
+ var icon = severity ? React__default.createElement(IconDictionary[severity]) : undefined;
566
+ return React__default.createElement(MuiChip, __assign({ classes: classes, icon: icon }, restProps));
567
+ };
568
+ Chip.displayName = 'Chip';
569
+
374
570
  var defaultTypographyProps = {
375
571
  variant: 'body1',
376
572
  };
@@ -831,5 +1027,5 @@ var useTabs = function (options) {
831
1027
  };
832
1028
  };
833
1029
 
834
- export { Avatar, Button, Checkbox, CollapsibleText, Divider, Icon, IconButton, Link, NumberField, Paper, PaperContent, Radio, SplitInput, Switch, TabPanel, ToggleButton, ToggleButtonGroup, Tooltip, Typography, useCollapsibleText, useTabs };
1030
+ export { Avatar, Button, Checkbox, Chip, CollapsibleText, Divider, Icon, IconButton, Link, NumberField, Paper, PaperContent, Radio, SplitInput, Switch, TabPanel, ToggleButton, ToggleButtonGroup, Tooltip, Typography, useCollapsibleText, useTabs };
835
1031
  //# sourceMappingURL=index.es.js.map