@popmenu/ordering-ui 0.67.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/components/ItemTag/ItemTag.d.ts +3 -0
- package/build/components/ItemTag/ItemTagProps.d.ts +8 -0
- package/build/components/ItemTag/index.d.ts +2 -0
- package/build/components/ItemTag/itemTag.styles.d.ts +2 -0
- package/build/components/ItemTagGroup/ItemTagGroup.d.ts +2 -0
- package/build/components/ItemTagGroup/index.d.ts +1 -0
- package/build/components/ReactionCounter/ReactionCounter.d.ts +3 -0
- package/build/components/ReactionCounter/ReactionCounterProps.d.ts +5 -0
- package/build/components/ReactionCounter/index.d.ts +2 -0
- package/build/components/ReactionCounterGroup/ReactionCounterGroup.d.ts +4 -0
- package/build/components/ReactionCounterGroup/index.d.ts +1 -0
- package/build/components/index.d.ts +4 -0
- package/build/index.d.ts +1 -0
- package/build/index.es.js +828 -0
- package/build/index.es.js.map +1 -0
- package/build/index.js +870 -0
- package/build/index.js.map +1 -0
- package/package.json +36 -0
|
@@ -0,0 +1,828 @@
|
|
|
1
|
+
import * as React__default from 'react';
|
|
2
|
+
import React__default__default, { forwardRef, createElement } from 'react';
|
|
3
|
+
import { Avatar as Avatar$1, Box, makeStyles as makeStyles$1, Typography as Typography$1, Link as Link$1, Paper as Paper$1 } from '@material-ui/core';
|
|
4
|
+
import { makeStyles, useTheme } from '@material-ui/core/styles';
|
|
5
|
+
import '@material-ui/lab/Alert';
|
|
6
|
+
import '@material-ui/core/AppBar';
|
|
7
|
+
import MuiAvatar from '@material-ui/core/Avatar';
|
|
8
|
+
import '@material-ui/core/Badge';
|
|
9
|
+
import MuiButton from '@material-ui/core/Button';
|
|
10
|
+
import CircularProgress from '@material-ui/core/CircularProgress';
|
|
11
|
+
import '@material-ui/core/ButtonGroup';
|
|
12
|
+
import '@material-ui/core/Card';
|
|
13
|
+
import '@material-ui/core/CardActionArea';
|
|
14
|
+
import '@material-ui/core/CardActions';
|
|
15
|
+
import '@material-ui/core/CardContent';
|
|
16
|
+
import '@material-ui/core/CardHeader';
|
|
17
|
+
import '@material-ui/core/CardMedia';
|
|
18
|
+
import MuiCheckbox from '@material-ui/core/Checkbox';
|
|
19
|
+
import FormControlLabel from '@material-ui/core/FormControlLabel';
|
|
20
|
+
import '@material-ui/core/Chip';
|
|
21
|
+
import '@material-ui/core/Collapse';
|
|
22
|
+
import '@material-ui/core/Dialog';
|
|
23
|
+
import '@material-ui/core/DialogActions';
|
|
24
|
+
import '@material-ui/core/DialogContent';
|
|
25
|
+
import '@material-ui/core/DialogTitle';
|
|
26
|
+
import '@material-ui/core/Drawer';
|
|
27
|
+
import '@material-ui/core/FormControl';
|
|
28
|
+
import '@material-ui/core/Grid';
|
|
29
|
+
import MuiIconButton from '@material-ui/core/IconButton';
|
|
30
|
+
import '@material-ui/core/InputAdornment';
|
|
31
|
+
import '@material-ui/core/LinearProgress';
|
|
32
|
+
import '@material-ui/core/List';
|
|
33
|
+
import '@material-ui/core/ListItem';
|
|
34
|
+
import '@material-ui/core/ListItemAvatar';
|
|
35
|
+
import '@material-ui/core/ListItemIcon';
|
|
36
|
+
import '@material-ui/core/ListItemSecondaryAction';
|
|
37
|
+
import '@material-ui/core/ListItemText';
|
|
38
|
+
import '@material-ui/core/Menu';
|
|
39
|
+
import '@material-ui/core/MenuItem';
|
|
40
|
+
import '@material-ui/core/MenuList';
|
|
41
|
+
import MuiRadio from '@material-ui/core/Radio';
|
|
42
|
+
import '@material-ui/core/TextField';
|
|
43
|
+
import MuiSwitch from '@material-ui/core/Switch';
|
|
44
|
+
import '@material-ui/core/Tab';
|
|
45
|
+
import '@material-ui/core/Tabs';
|
|
46
|
+
import MuiToggleButton from '@material-ui/lab/ToggleButton';
|
|
47
|
+
import MuiToggleButtonGroup from '@material-ui/lab/ToggleButtonGroup';
|
|
48
|
+
import MuiTooltip from '@material-ui/core/Tooltip';
|
|
49
|
+
|
|
50
|
+
var useItemtagStyles = makeStyles(function (theme) { return ({
|
|
51
|
+
root: function (_a) {
|
|
52
|
+
var _b, _c;
|
|
53
|
+
var _d = _a.color, color = _d === void 0 ? '' : _d;
|
|
54
|
+
var _e = color.split('.'), colorGroup = _e[0], colorVariant = _e[1];
|
|
55
|
+
return {
|
|
56
|
+
color: ((_b = theme.palette[colorGroup]) === null || _b === void 0 ? void 0 : _b[colorVariant]) || color,
|
|
57
|
+
borderColor: ((_c = theme.palette[colorGroup]) === null || _c === void 0 ? void 0 : _c[colorVariant]) || color,
|
|
58
|
+
border: '2px solid',
|
|
59
|
+
background: 'none',
|
|
60
|
+
};
|
|
61
|
+
},
|
|
62
|
+
}); });
|
|
63
|
+
|
|
64
|
+
var presets = {
|
|
65
|
+
dairyFree: {
|
|
66
|
+
abbreviation: 'DF',
|
|
67
|
+
color: 'green.dark',
|
|
68
|
+
},
|
|
69
|
+
glutenFree: {
|
|
70
|
+
abbreviation: 'GF',
|
|
71
|
+
color: 'yellow.dark',
|
|
72
|
+
},
|
|
73
|
+
shellfishFree: {
|
|
74
|
+
abbreviation: 'SF',
|
|
75
|
+
color: 'blue.main',
|
|
76
|
+
},
|
|
77
|
+
vegan: {
|
|
78
|
+
abbreviation: 'V',
|
|
79
|
+
color: 'green.dark',
|
|
80
|
+
},
|
|
81
|
+
vegetarian: {
|
|
82
|
+
abbreviation: 'VG',
|
|
83
|
+
color: 'yellow.dark',
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
var ItemTag = forwardRef(function (props, ref) {
|
|
87
|
+
var _a, _b;
|
|
88
|
+
var _c = props.preset, preset = _c === void 0 ? '' : _c, _d = props.color, color = _d === void 0 ? 'gray.dark' : _d, children = props.children;
|
|
89
|
+
var classes = useItemtagStyles({ color: ((_a = presets[preset]) === null || _a === void 0 ? void 0 : _a.color) || color });
|
|
90
|
+
return (React__default__default.createElement(Avatar$1, { ref: ref, alt: preset, classes: { root: classes.root } }, ((_b = presets[preset]) === null || _b === void 0 ? void 0 : _b.abbreviation) || children));
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
var ItemTagGroup = function (props) {
|
|
94
|
+
var children = props.children;
|
|
95
|
+
return (React__default__default.createElement(Box, { display: "flex", gridGap: 6 }, children));
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
/*! *****************************************************************************
|
|
99
|
+
Copyright (c) Microsoft Corporation.
|
|
100
|
+
|
|
101
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
102
|
+
purpose with or without fee is hereby granted.
|
|
103
|
+
|
|
104
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
105
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
106
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
107
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
108
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
109
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
110
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
111
|
+
***************************************************************************** */
|
|
112
|
+
|
|
113
|
+
var __assign = function() {
|
|
114
|
+
__assign = Object.assign || function __assign(t) {
|
|
115
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
116
|
+
s = arguments[i];
|
|
117
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
118
|
+
}
|
|
119
|
+
return t;
|
|
120
|
+
};
|
|
121
|
+
return __assign.apply(this, arguments);
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
function __rest(s, e) {
|
|
125
|
+
var t = {};
|
|
126
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
127
|
+
t[p] = s[p];
|
|
128
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
129
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
130
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
131
|
+
t[p[i]] = s[p[i]];
|
|
132
|
+
}
|
|
133
|
+
return t;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
var _path$I;
|
|
137
|
+
|
|
138
|
+
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); }
|
|
139
|
+
|
|
140
|
+
function SvgUser(props) {
|
|
141
|
+
return /*#__PURE__*/React__default.createElement("svg", _extends$1D({
|
|
142
|
+
viewBox: "0 0 16 16",
|
|
143
|
+
fill: "none",
|
|
144
|
+
strokeLinecap: "round",
|
|
145
|
+
strokeLinejoin: "round",
|
|
146
|
+
width: "1em",
|
|
147
|
+
height: "1em"
|
|
148
|
+
}, props), _path$I || (_path$I = /*#__PURE__*/React__default.createElement("path", {
|
|
149
|
+
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",
|
|
150
|
+
stroke: "currentColor"
|
|
151
|
+
})));
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
var useIconStyles = makeStyles$1(function (_a) {
|
|
155
|
+
var spacing = _a.spacing, palette = _a.palette;
|
|
156
|
+
var getFontSize = function (_a) {
|
|
157
|
+
var size = _a.size;
|
|
158
|
+
var sizes = {
|
|
159
|
+
inherit: 'inherit',
|
|
160
|
+
small: spacing(1.5),
|
|
161
|
+
medium: spacing(2),
|
|
162
|
+
large: spacing(2.5),
|
|
163
|
+
'extra-large': spacing(3),
|
|
164
|
+
};
|
|
165
|
+
return size ? sizes[size] : 'inherit';
|
|
166
|
+
};
|
|
167
|
+
var getColor = function (props) {
|
|
168
|
+
var semanticColors = ['primary', 'secondary', 'info', 'success', 'warning', 'error'];
|
|
169
|
+
var value = 'inherit';
|
|
170
|
+
if (props.color) {
|
|
171
|
+
if (semanticColors.includes(props.color.split('.')[0])) {
|
|
172
|
+
var _a = props.color.split('.'), color = _a[0], _b = _a[1], variant = _b === void 0 ? 'main' : _b;
|
|
173
|
+
value = palette[color][variant];
|
|
174
|
+
}
|
|
175
|
+
else if (props.color.search(/^(rgb|hsla|#)/) !== -1) {
|
|
176
|
+
value = props.color;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
return value;
|
|
180
|
+
};
|
|
181
|
+
return {
|
|
182
|
+
root: {
|
|
183
|
+
color: getColor,
|
|
184
|
+
fontSize: getFontSize,
|
|
185
|
+
strokeWidth: '1.3px',
|
|
186
|
+
},
|
|
187
|
+
};
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
var classnames = {exports: {}};
|
|
191
|
+
|
|
192
|
+
/*!
|
|
193
|
+
Copyright (c) 2018 Jed Watson.
|
|
194
|
+
Licensed under the MIT License (MIT), see
|
|
195
|
+
http://jedwatson.github.io/classnames
|
|
196
|
+
*/
|
|
197
|
+
|
|
198
|
+
(function (module) {
|
|
199
|
+
/* global define */
|
|
200
|
+
|
|
201
|
+
(function () {
|
|
202
|
+
|
|
203
|
+
var hasOwn = {}.hasOwnProperty;
|
|
204
|
+
|
|
205
|
+
function classNames() {
|
|
206
|
+
var classes = [];
|
|
207
|
+
|
|
208
|
+
for (var i = 0; i < arguments.length; i++) {
|
|
209
|
+
var arg = arguments[i];
|
|
210
|
+
if (!arg) continue;
|
|
211
|
+
|
|
212
|
+
var argType = typeof arg;
|
|
213
|
+
|
|
214
|
+
if (argType === 'string' || argType === 'number') {
|
|
215
|
+
classes.push(arg);
|
|
216
|
+
} else if (Array.isArray(arg)) {
|
|
217
|
+
if (arg.length) {
|
|
218
|
+
var inner = classNames.apply(null, arg);
|
|
219
|
+
if (inner) {
|
|
220
|
+
classes.push(inner);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
} else if (argType === 'object') {
|
|
224
|
+
if (arg.toString === Object.prototype.toString) {
|
|
225
|
+
for (var key in arg) {
|
|
226
|
+
if (hasOwn.call(arg, key) && arg[key]) {
|
|
227
|
+
classes.push(key);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
} else {
|
|
231
|
+
classes.push(arg.toString());
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
return classes.join(' ');
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
if (module.exports) {
|
|
240
|
+
classNames.default = classNames;
|
|
241
|
+
module.exports = classNames;
|
|
242
|
+
} else {
|
|
243
|
+
window.classNames = classNames;
|
|
244
|
+
}
|
|
245
|
+
}());
|
|
246
|
+
}(classnames));
|
|
247
|
+
|
|
248
|
+
var classNames = classnames.exports;
|
|
249
|
+
|
|
250
|
+
var iconStaticClassName = 'pop-icon';
|
|
251
|
+
var Icon = function (props) {
|
|
252
|
+
var icon = props.icon, className = props.className, restProps = __rest(props, ["icon", "className"]);
|
|
253
|
+
var classes = useIconStyles(props);
|
|
254
|
+
var isValid = true;
|
|
255
|
+
if (!icon || (typeof icon === 'function' && icon({}) === undefined)) {
|
|
256
|
+
isValid = false;
|
|
257
|
+
}
|
|
258
|
+
return isValid
|
|
259
|
+
? createElement(icon, __assign({ className: classNames([classes.root, iconStaticClassName, className]) }, restProps))
|
|
260
|
+
: null;
|
|
261
|
+
};
|
|
262
|
+
Icon.defaultProps = {
|
|
263
|
+
size: 'inherit',
|
|
264
|
+
color: 'inherit',
|
|
265
|
+
};
|
|
266
|
+
Icon.displayName = 'Icon';
|
|
267
|
+
|
|
268
|
+
var LoadingStatus;
|
|
269
|
+
(function (LoadingStatus) {
|
|
270
|
+
LoadingStatus["ERROR"] = "ERROR";
|
|
271
|
+
LoadingStatus["LOADED"] = "LOADED";
|
|
272
|
+
LoadingStatus["PENDING"] = "PENDING";
|
|
273
|
+
})(LoadingStatus || (LoadingStatus = {}));
|
|
274
|
+
var useImgProps = function (avatarProps) {
|
|
275
|
+
var _a = React__default__default.useState(LoadingStatus.PENDING), loaded = _a[0], setLoaded = _a[1];
|
|
276
|
+
var imgProps = __assign(__assign({}, avatarProps.imgProps), { onLoad: function (event) {
|
|
277
|
+
var _a, _b;
|
|
278
|
+
setLoaded(LoadingStatus.LOADED);
|
|
279
|
+
(_b = (_a = avatarProps.imgProps) === null || _a === void 0 ? void 0 : _a.onLoad) === null || _b === void 0 ? void 0 : _b.call(_a, event);
|
|
280
|
+
} });
|
|
281
|
+
return { imgProps: imgProps, loaded: loaded };
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
var getAvatarDimensions = function (theme, props) {
|
|
285
|
+
var factors = {
|
|
286
|
+
'extra-small': 3,
|
|
287
|
+
small: 4,
|
|
288
|
+
medium: 5,
|
|
289
|
+
large: 6,
|
|
290
|
+
'extra-large': 12.5,
|
|
291
|
+
};
|
|
292
|
+
var sizeFactor = factors[props.size || 'medium'];
|
|
293
|
+
return theme.spacing(sizeFactor);
|
|
294
|
+
};
|
|
295
|
+
var getAvatarFontSize = function (props) {
|
|
296
|
+
var fontSizes = {
|
|
297
|
+
'extra-small': '0.75rem',
|
|
298
|
+
small: '1rem',
|
|
299
|
+
medium: '1rem',
|
|
300
|
+
large: '1.25rem',
|
|
301
|
+
'extra-large': '3.5rem',
|
|
302
|
+
};
|
|
303
|
+
return fontSizes[props.size];
|
|
304
|
+
};
|
|
305
|
+
var useAvatarStyles = makeStyles(function (theme) { return ({
|
|
306
|
+
root: function (props) { return ({
|
|
307
|
+
width: getAvatarDimensions(theme, props),
|
|
308
|
+
height: getAvatarDimensions(theme, props),
|
|
309
|
+
fontSize: getAvatarFontSize(props),
|
|
310
|
+
backgroundColor: props.loaded === LoadingStatus.LOADED ? 'transparent' : props.background,
|
|
311
|
+
color: theme.palette.getContrastText(props.background),
|
|
312
|
+
objectFit: props.fit,
|
|
313
|
+
}); },
|
|
314
|
+
fallback: function (props) { return ({
|
|
315
|
+
fontSize: getAvatarDimensions(theme, props),
|
|
316
|
+
strokeWidth: 1,
|
|
317
|
+
}); },
|
|
318
|
+
}); });
|
|
319
|
+
|
|
320
|
+
var Avatar = forwardRef(function (props, ref) {
|
|
321
|
+
var children = props.children, src = props.src, alt = props.alt, fallback = props.fallback, muiProps = __rest(props, ["children", "src", "alt", "fallback"]);
|
|
322
|
+
var _a = useImgProps(props), imgProps = _a.imgProps, loaded = _a.loaded;
|
|
323
|
+
var classes = useAvatarStyles(__assign(__assign({}, props), { loaded: loaded }));
|
|
324
|
+
var displayAltTextFallback = src && alt;
|
|
325
|
+
var displayNoFallback = fallback === 'none';
|
|
326
|
+
var displayCustomFallback = fallback !== 'none' && typeof fallback !== 'undefined';
|
|
327
|
+
var Fallback;
|
|
328
|
+
if (displayAltTextFallback) {
|
|
329
|
+
Fallback = null;
|
|
330
|
+
}
|
|
331
|
+
else if (displayNoFallback) {
|
|
332
|
+
Fallback = ' ';
|
|
333
|
+
}
|
|
334
|
+
else if (displayCustomFallback) {
|
|
335
|
+
Fallback = fallback;
|
|
336
|
+
}
|
|
337
|
+
else {
|
|
338
|
+
Fallback = React__default__default.createElement(Icon, { icon: SvgUser, className: classes.fallback });
|
|
339
|
+
}
|
|
340
|
+
return (React__default__default.createElement(MuiAvatar, __assign({ ref: ref, classes: { root: classes.root }, src: src, alt: alt }, muiProps, { imgProps: imgProps }), children || Fallback));
|
|
341
|
+
});
|
|
342
|
+
Avatar.defaultProps = {
|
|
343
|
+
size: 'medium',
|
|
344
|
+
fit: 'cover',
|
|
345
|
+
background: '#E0E0E0',
|
|
346
|
+
};
|
|
347
|
+
Avatar.displayName = 'Avatar';
|
|
348
|
+
|
|
349
|
+
makeStyles(function (theme) { return ({
|
|
350
|
+
circle: {
|
|
351
|
+
backgroundColor: theme.palette.grey[300],
|
|
352
|
+
borderRadius: '50%',
|
|
353
|
+
height: theme.spacing(0.65),
|
|
354
|
+
width: theme.spacing(0.65),
|
|
355
|
+
margin: theme.spacing(1) + "px 0 " + theme.spacing(1) + "px " + theme.spacing(1) + "px",
|
|
356
|
+
},
|
|
357
|
+
container: {
|
|
358
|
+
border: "1px solid " + theme.palette.secondary.light,
|
|
359
|
+
borderRadius: theme.spacing(0.5),
|
|
360
|
+
flexGrow: 1,
|
|
361
|
+
},
|
|
362
|
+
titleBar: {
|
|
363
|
+
display: 'flex',
|
|
364
|
+
flexDirection: 'row',
|
|
365
|
+
borderBottom: "1px solid " + theme.palette.secondary.light,
|
|
366
|
+
width: '100%',
|
|
367
|
+
},
|
|
368
|
+
}); });
|
|
369
|
+
|
|
370
|
+
var useButtonStyles = makeStyles(function () { return ({
|
|
371
|
+
root: {
|
|
372
|
+
minWidth: 'unset',
|
|
373
|
+
},
|
|
374
|
+
label: {
|
|
375
|
+
textTransform: function (_a) {
|
|
376
|
+
var textTransform = _a.textTransform;
|
|
377
|
+
return textTransform;
|
|
378
|
+
},
|
|
379
|
+
},
|
|
380
|
+
}); });
|
|
381
|
+
|
|
382
|
+
var Button = forwardRef(function (props, ref) {
|
|
383
|
+
props.textTransform; var loading = props.loading, classesOverride = props.classes, className = props.className, muiProps = __rest(props, ["textTransform", "loading", "classes", "className"]);
|
|
384
|
+
props.classes; var styleProps = __rest(props, ["classes"]);
|
|
385
|
+
var classes = useButtonStyles(styleProps);
|
|
386
|
+
var typography = useTheme().typography;
|
|
387
|
+
var loadingIndicator = {
|
|
388
|
+
startIcon: React__default__default.createElement(CircularProgress, { color: "inherit", size: typography.button.fontSize }),
|
|
389
|
+
disabled: true,
|
|
390
|
+
};
|
|
391
|
+
return (React__default__default.createElement(MuiButton, __assign({ ref: ref, classes: __assign(__assign({}, classes), classesOverride), className: classNames([className, 'pm-button']) }, muiProps, (loading && loadingIndicator))));
|
|
392
|
+
});
|
|
393
|
+
Button.displayName = 'Button';
|
|
394
|
+
|
|
395
|
+
var Checkbox = forwardRef(function (props, ref) {
|
|
396
|
+
var label = props.label, disabled = props.disabled, LabelProps = props.LabelProps, muiProps = __rest(props, ["label", "disabled", "LabelProps"]);
|
|
397
|
+
var control = React__default__default.createElement(MuiCheckbox, __assign({ disabled: label ? undefined : disabled }, muiProps));
|
|
398
|
+
return label ? (React__default__default.createElement(FormControlLabel, __assign({ disabled: disabled, inputRef: ref, control: control, label: label }, LabelProps))) : (control);
|
|
399
|
+
});
|
|
400
|
+
Checkbox.displayName = 'Checkbox';
|
|
401
|
+
|
|
402
|
+
var getBackground = function (theme) { return function (props) {
|
|
403
|
+
var variant = props.variant, severity = props.severity;
|
|
404
|
+
var background = theme.palette.grey[100];
|
|
405
|
+
var backgrounds = {
|
|
406
|
+
outlined: 'none',
|
|
407
|
+
error: 'error.main',
|
|
408
|
+
warning: 'warning.main',
|
|
409
|
+
info: 'info.light',
|
|
410
|
+
success: 'success.light',
|
|
411
|
+
};
|
|
412
|
+
if (variant === 'outlined') {
|
|
413
|
+
background = backgrounds[variant];
|
|
414
|
+
}
|
|
415
|
+
else if (severity) {
|
|
416
|
+
var _a = backgrounds[severity].split('.'), color = _a[0], colorVariant = _a[1];
|
|
417
|
+
background = theme.palette[color][colorVariant];
|
|
418
|
+
}
|
|
419
|
+
return background;
|
|
420
|
+
}; };
|
|
421
|
+
var getColor = function (theme) { return function (props) {
|
|
422
|
+
var variant = props.variant, severity = props.severity;
|
|
423
|
+
var textColor;
|
|
424
|
+
if (variant === 'outlined' && severity) {
|
|
425
|
+
var textColors = {
|
|
426
|
+
error: theme.palette.error.main,
|
|
427
|
+
info: theme.palette.info.main,
|
|
428
|
+
warning: theme.palette.warning.dark,
|
|
429
|
+
success: theme.palette.success.dark,
|
|
430
|
+
};
|
|
431
|
+
textColor = textColors[severity];
|
|
432
|
+
}
|
|
433
|
+
else if (variant === 'outlined' && !severity) {
|
|
434
|
+
textColor = theme.palette.grey[700];
|
|
435
|
+
}
|
|
436
|
+
else if ((variant === 'default' || variant === undefined) && severity) {
|
|
437
|
+
var textColors = {
|
|
438
|
+
error: theme.palette.common.white,
|
|
439
|
+
info: theme.palette.secondary.main,
|
|
440
|
+
warning: theme.palette.secondary.main,
|
|
441
|
+
success: theme.palette.secondary.main,
|
|
442
|
+
};
|
|
443
|
+
textColor = textColors[severity];
|
|
444
|
+
}
|
|
445
|
+
return textColor;
|
|
446
|
+
}; };
|
|
447
|
+
var getBorder = function (theme) { return function (props) {
|
|
448
|
+
var variant = props.variant, severity = props.severity;
|
|
449
|
+
var borderColor;
|
|
450
|
+
if (variant === 'outlined' && severity) {
|
|
451
|
+
var borderColors = {
|
|
452
|
+
error: theme.palette.error.main,
|
|
453
|
+
info: theme.palette.info.main,
|
|
454
|
+
warning: theme.palette.warning.dark,
|
|
455
|
+
success: theme.palette.success.dark,
|
|
456
|
+
};
|
|
457
|
+
borderColor = borderColors[severity];
|
|
458
|
+
}
|
|
459
|
+
return borderColor;
|
|
460
|
+
}; };
|
|
461
|
+
makeStyles(function (theme) { return ({
|
|
462
|
+
root: {
|
|
463
|
+
background: getBackground(theme),
|
|
464
|
+
color: getColor(theme),
|
|
465
|
+
borderColor: getBorder(theme),
|
|
466
|
+
borderRadius: theme.spacing(0.5),
|
|
467
|
+
},
|
|
468
|
+
icon: {
|
|
469
|
+
color: 'inherit',
|
|
470
|
+
height: theme.spacing(2),
|
|
471
|
+
width: theme.spacing(2),
|
|
472
|
+
},
|
|
473
|
+
deleteIcon: {
|
|
474
|
+
color: theme.palette.grey[500],
|
|
475
|
+
},
|
|
476
|
+
}); });
|
|
477
|
+
|
|
478
|
+
var defaultTypographyProps = {
|
|
479
|
+
variant: 'body1',
|
|
480
|
+
};
|
|
481
|
+
|
|
482
|
+
var weights = {
|
|
483
|
+
regular: 400,
|
|
484
|
+
medium: 500,
|
|
485
|
+
'semi-bold': 600,
|
|
486
|
+
bold: 700,
|
|
487
|
+
};
|
|
488
|
+
var getCustomColor = function (theme, color) {
|
|
489
|
+
var isCommonColor = color && ['white', 'black'].includes(color);
|
|
490
|
+
var isGreyColor = color && color.match(/^grey\.\d{3}/);
|
|
491
|
+
var isSemanticColor = color && color.match(/(primary|secondary|info|success|error|warning).?(light|dark)?/);
|
|
492
|
+
var isTextColor = color && ['textPrimary', 'textSecondary'].includes(color);
|
|
493
|
+
switch (true) {
|
|
494
|
+
case isCommonColor:
|
|
495
|
+
return theme.palette.common[color];
|
|
496
|
+
case Boolean(isGreyColor):
|
|
497
|
+
var scale = color.split('.')[1];
|
|
498
|
+
return theme.palette.grey[scale] || theme.palette.grey[900];
|
|
499
|
+
case Boolean(isSemanticColor):
|
|
500
|
+
var _a = color.split('.'), paletteKey = _a[0], _b = _a[1], variant = _b === void 0 ? 'main' : _b;
|
|
501
|
+
return theme.palette[paletteKey][variant];
|
|
502
|
+
case isTextColor:
|
|
503
|
+
return theme.palette.text[color.slice(4).toLowerCase()];
|
|
504
|
+
default:
|
|
505
|
+
return undefined;
|
|
506
|
+
}
|
|
507
|
+
};
|
|
508
|
+
var useTypographyStyles = makeStyles(function (theme) {
|
|
509
|
+
var _a;
|
|
510
|
+
return ({
|
|
511
|
+
root: (_a = {},
|
|
512
|
+
_a["& ." + iconStaticClassName] = {
|
|
513
|
+
position: 'relative',
|
|
514
|
+
top: '0.125em',
|
|
515
|
+
padding: '0 0.125em',
|
|
516
|
+
boxSizing: 'content-box',
|
|
517
|
+
},
|
|
518
|
+
_a.fontFamily = theme.typography.fontFamily,
|
|
519
|
+
_a.fontWeight = function (_a) {
|
|
520
|
+
var variant = _a.variant, weight = _a.weight;
|
|
521
|
+
return (weight ? weights[weight] : theme.typography[variant].fontWeight);
|
|
522
|
+
},
|
|
523
|
+
_a.fontSize = function (_a) {
|
|
524
|
+
var variant = _a.variant;
|
|
525
|
+
return theme.typography[variant].fontSize;
|
|
526
|
+
},
|
|
527
|
+
_a.lineHeight = function (_a) {
|
|
528
|
+
var variant = _a.variant;
|
|
529
|
+
return theme.typography[variant].lineHeight;
|
|
530
|
+
},
|
|
531
|
+
_a.textTransform = function (_a) {
|
|
532
|
+
var variant = _a.variant;
|
|
533
|
+
return theme.typography[variant].textTransform;
|
|
534
|
+
},
|
|
535
|
+
_a.color = function (_a) {
|
|
536
|
+
var color = _a.color, variant = _a.variant;
|
|
537
|
+
return (color && getCustomColor(theme, color)) || theme.typography[variant].color;
|
|
538
|
+
},
|
|
539
|
+
_a),
|
|
540
|
+
caption: {
|
|
541
|
+
display: 'inline',
|
|
542
|
+
},
|
|
543
|
+
overline: {
|
|
544
|
+
display: 'inline',
|
|
545
|
+
},
|
|
546
|
+
});
|
|
547
|
+
});
|
|
548
|
+
|
|
549
|
+
var Typography = forwardRef(function (props, ref) {
|
|
550
|
+
props.weight; props.color; var restProps = __rest(props, ["weight", "color"]);
|
|
551
|
+
var classes = useTypographyStyles(__assign({}, props));
|
|
552
|
+
var variantMapping = { subtitle1: 'p' };
|
|
553
|
+
return React__default__default.createElement(Typography$1, __assign({ ref: ref, classes: classes, variantMapping: variantMapping }, restProps));
|
|
554
|
+
});
|
|
555
|
+
Typography.displayName = 'Typography';
|
|
556
|
+
Typography.defaultProps = defaultTypographyProps;
|
|
557
|
+
|
|
558
|
+
var getFadeStop = function (_a, typographyVariant) {
|
|
559
|
+
var typography = _a.typography;
|
|
560
|
+
return !isNaN(Number(typography[typographyVariant].lineHeight))
|
|
561
|
+
? typography[typographyVariant].lineHeight + "rem"
|
|
562
|
+
: typography[typographyVariant].lineHeight;
|
|
563
|
+
};
|
|
564
|
+
makeStyles$1(function (theme) { return ({
|
|
565
|
+
overlay: {
|
|
566
|
+
position: 'absolute',
|
|
567
|
+
top: 0,
|
|
568
|
+
left: 0,
|
|
569
|
+
height: '100%',
|
|
570
|
+
width: '100%',
|
|
571
|
+
background: function (props) { return "linear-gradient(to top, white, #FFF0 " + getFadeStop(theme, props.typographyVariant) + ")"; },
|
|
572
|
+
},
|
|
573
|
+
}); });
|
|
574
|
+
|
|
575
|
+
var SemanticColors;
|
|
576
|
+
(function (SemanticColors) {
|
|
577
|
+
SemanticColors["PRIMARY_MAIN"] = "primary.main";
|
|
578
|
+
SemanticColors["PRIMARY_DARK"] = "primary.dark";
|
|
579
|
+
SemanticColors["PRIMARY_LIGHT"] = "primary.light";
|
|
580
|
+
SemanticColors["SECONDARY_MAIN"] = "secondary.main";
|
|
581
|
+
SemanticColors["SECONDARY_DARK"] = "secondary.dark";
|
|
582
|
+
SemanticColors["SECONDARY_LIGHT"] = "secondary.light";
|
|
583
|
+
})(SemanticColors || (SemanticColors = {}));
|
|
584
|
+
makeStyles$1(function (theme) { return ({
|
|
585
|
+
dividerRoot: {
|
|
586
|
+
gap: theme.spacing(2),
|
|
587
|
+
},
|
|
588
|
+
textRoot: {
|
|
589
|
+
color: function (props) {
|
|
590
|
+
var textColor = props.textColor;
|
|
591
|
+
if (Object.values(SemanticColors).includes(textColor)) {
|
|
592
|
+
var _a = textColor.split('.'), semanticColor = _a[0], shade = _a[1];
|
|
593
|
+
return theme.palette[semanticColor][shade];
|
|
594
|
+
}
|
|
595
|
+
else if (textColor) {
|
|
596
|
+
return textColor;
|
|
597
|
+
}
|
|
598
|
+
else {
|
|
599
|
+
return 'black';
|
|
600
|
+
}
|
|
601
|
+
},
|
|
602
|
+
textTransform: function (props) { return props.textTransform; },
|
|
603
|
+
},
|
|
604
|
+
dividerLine: {
|
|
605
|
+
backgroundColor: function (props) {
|
|
606
|
+
var dividerColor = props.dividerColor;
|
|
607
|
+
if (Object.values(SemanticColors).includes(dividerColor)) {
|
|
608
|
+
var _a = dividerColor.split('.'), semanticColor = _a[0], shade = _a[1];
|
|
609
|
+
return theme.palette[semanticColor][shade];
|
|
610
|
+
}
|
|
611
|
+
else if (dividerColor) {
|
|
612
|
+
return dividerColor;
|
|
613
|
+
}
|
|
614
|
+
else {
|
|
615
|
+
return theme.palette.grey[500];
|
|
616
|
+
}
|
|
617
|
+
},
|
|
618
|
+
},
|
|
619
|
+
}); });
|
|
620
|
+
|
|
621
|
+
var IconButton = forwardRef(function (props, ref) {
|
|
622
|
+
return React__default__default.createElement(MuiIconButton, __assign({ ref: ref }, props));
|
|
623
|
+
});
|
|
624
|
+
IconButton.displayName = 'IconButton';
|
|
625
|
+
IconButton.defaultProps = {
|
|
626
|
+
color: 'secondary',
|
|
627
|
+
};
|
|
628
|
+
|
|
629
|
+
var useLinkStyles = makeStyles(function (theme) { return ({
|
|
630
|
+
root: function (props) {
|
|
631
|
+
var _a;
|
|
632
|
+
return (__assign(__assign({ display: 'flex' }, (props.color === undefined && { color: theme.palette.info.main })), (_a = {}, _a["& ." + iconStaticClassName] = {
|
|
633
|
+
alignSelf: 'center',
|
|
634
|
+
}, _a)));
|
|
635
|
+
},
|
|
636
|
+
}); });
|
|
637
|
+
|
|
638
|
+
var Link = forwardRef(function (props, ref) {
|
|
639
|
+
var children = props.children, muiProps = __rest(props, ["children"]);
|
|
640
|
+
var classes = useLinkStyles(props);
|
|
641
|
+
return (React__default__default.createElement(Link$1, __assign({ ref: ref, classes: { root: classes.root } }, muiProps), children));
|
|
642
|
+
});
|
|
643
|
+
Link.defaultProps = {
|
|
644
|
+
variant: 'body1',
|
|
645
|
+
};
|
|
646
|
+
Link.displayName = 'Link';
|
|
647
|
+
|
|
648
|
+
var useStyles = makeStyles$1(function (_a) {
|
|
649
|
+
var spacing = _a.spacing;
|
|
650
|
+
return ({
|
|
651
|
+
root: {
|
|
652
|
+
'&:last-child': {
|
|
653
|
+
marginBottom: 0,
|
|
654
|
+
},
|
|
655
|
+
marginBottom: spacing(4),
|
|
656
|
+
padding: spacing(4),
|
|
657
|
+
},
|
|
658
|
+
});
|
|
659
|
+
});
|
|
660
|
+
var Paper = forwardRef(function (props, ref) {
|
|
661
|
+
var legacyStyles = props.legacyStyles, restProps = __rest(props, ["legacyStyles"]);
|
|
662
|
+
var classes = useStyles(props);
|
|
663
|
+
return React__default__default.createElement(Paper$1, __assign({}, ref, { classes: __assign({}, (legacyStyles && classes)) }, restProps));
|
|
664
|
+
});
|
|
665
|
+
Paper.displayName = 'Paper';
|
|
666
|
+
Paper.defaultProps = {
|
|
667
|
+
legacyStyles: false,
|
|
668
|
+
};
|
|
669
|
+
|
|
670
|
+
var Radio = forwardRef(function (props, ref) {
|
|
671
|
+
var label = props.label, disabled = props.disabled, LabelProps = props.LabelProps, muiProps = __rest(props, ["label", "disabled", "LabelProps"]);
|
|
672
|
+
var control = React__default__default.createElement(MuiRadio, __assign({ disabled: label ? undefined : disabled }, muiProps));
|
|
673
|
+
return label ? (React__default__default.createElement(FormControlLabel, __assign({ disabled: disabled, inputRef: ref, control: control, label: label }, LabelProps))) : (control);
|
|
674
|
+
});
|
|
675
|
+
Radio.displayName = 'Radio';
|
|
676
|
+
|
|
677
|
+
makeStyles(function () { return ({
|
|
678
|
+
textfield: {
|
|
679
|
+
background: function (props) { return (props.backgroundTransparency ? '#FFFFFF44' : 'none'); },
|
|
680
|
+
borderTopLeftRadius: 4,
|
|
681
|
+
borderBottomLeftRadius: 4,
|
|
682
|
+
'& fieldset': {
|
|
683
|
+
borderRight: 'none',
|
|
684
|
+
borderTopRightRadius: 0,
|
|
685
|
+
borderBottomRightRadius: 0,
|
|
686
|
+
},
|
|
687
|
+
},
|
|
688
|
+
button: {
|
|
689
|
+
borderTopLeftRadius: 0,
|
|
690
|
+
borderBottomLeftRadius: 0,
|
|
691
|
+
alignSelf: 'stretch',
|
|
692
|
+
},
|
|
693
|
+
input: {
|
|
694
|
+
color: function (props) { return props.inputTextColor || 'inherit'; },
|
|
695
|
+
'&$focused fieldset': {
|
|
696
|
+
top: -4,
|
|
697
|
+
},
|
|
698
|
+
},
|
|
699
|
+
focused: {},
|
|
700
|
+
}); });
|
|
701
|
+
|
|
702
|
+
var useSwitchStyles = makeStyles(function (theme) { return ({
|
|
703
|
+
checked: {
|
|
704
|
+
'& $thumb': {
|
|
705
|
+
background: theme.palette.success.main,
|
|
706
|
+
},
|
|
707
|
+
'&& + $track': {
|
|
708
|
+
backgroundColor: theme.palette.success.main,
|
|
709
|
+
},
|
|
710
|
+
},
|
|
711
|
+
thumb: {},
|
|
712
|
+
track: {},
|
|
713
|
+
}); });
|
|
714
|
+
|
|
715
|
+
var Switch = forwardRef(function (props, ref) {
|
|
716
|
+
var label = props.label, disabled = props.disabled, LabelProps = props.LabelProps, muiProps = __rest(props, ["label", "disabled", "LabelProps"]);
|
|
717
|
+
var classes = useSwitchStyles(props);
|
|
718
|
+
var control = React__default__default.createElement(MuiSwitch, __assign({ classes: classes, disabled: label ? undefined : disabled }, muiProps));
|
|
719
|
+
return label ? (React__default__default.createElement(FormControlLabel, __assign({ disabled: disabled, inputRef: ref, control: control, label: label }, LabelProps))) : (control);
|
|
720
|
+
});
|
|
721
|
+
Switch.displayName = 'Switch';
|
|
722
|
+
|
|
723
|
+
var useToggleButtonStyles = makeStyles(function (theme) { return ({
|
|
724
|
+
root: {
|
|
725
|
+
color: theme.palette.text.primary,
|
|
726
|
+
},
|
|
727
|
+
selected: {
|
|
728
|
+
'&&': {
|
|
729
|
+
'&:hover': {
|
|
730
|
+
backgroundColor: function (props) { return theme.palette[props.color || 'primary'].dark; },
|
|
731
|
+
},
|
|
732
|
+
backgroundColor: function (props) { return theme.palette[props.color || 'primary'].main; },
|
|
733
|
+
color: 'white',
|
|
734
|
+
},
|
|
735
|
+
},
|
|
736
|
+
}); });
|
|
737
|
+
|
|
738
|
+
var ToggleButton = forwardRef(function (props, ref) {
|
|
739
|
+
var children = props.children, muiProps = __rest(props, ["children"]);
|
|
740
|
+
var classes = useToggleButtonStyles(props);
|
|
741
|
+
return (React__default__default.createElement(MuiToggleButton, __assign({ ref: ref, classes: {
|
|
742
|
+
root: classes.root,
|
|
743
|
+
selected: classes.selected,
|
|
744
|
+
} }, muiProps), children));
|
|
745
|
+
});
|
|
746
|
+
ToggleButton.defaultProps = {
|
|
747
|
+
color: 'primary',
|
|
748
|
+
};
|
|
749
|
+
ToggleButton.displayName = 'ToggleButton';
|
|
750
|
+
|
|
751
|
+
var useToggleButtonGroupStyles = makeStyles(function (theme) { return ({
|
|
752
|
+
root: {
|
|
753
|
+
'&&': {
|
|
754
|
+
backgroundColor: theme.palette.grey[300],
|
|
755
|
+
},
|
|
756
|
+
},
|
|
757
|
+
}); });
|
|
758
|
+
|
|
759
|
+
var ToggleButtonGroup = forwardRef(function (props, ref) {
|
|
760
|
+
var children = props.children, _a = props.color, color = _a === void 0 ? 'primary' : _a, muiProps = __rest(props, ["children", "color"]);
|
|
761
|
+
var classes = useToggleButtonGroupStyles(props);
|
|
762
|
+
var childrenWithProps = React__default__default.Children.map(children, function (child) {
|
|
763
|
+
if (!React__default__default.isValidElement(child)) {
|
|
764
|
+
return null;
|
|
765
|
+
}
|
|
766
|
+
return React__default__default.cloneElement(child, { color: color });
|
|
767
|
+
});
|
|
768
|
+
return (React__default__default.createElement(MuiToggleButtonGroup, __assign({ ref: ref, classes: { root: classes.root } }, muiProps), childrenWithProps));
|
|
769
|
+
});
|
|
770
|
+
ToggleButtonGroup.displayName = 'ToggleButtonGroup';
|
|
771
|
+
|
|
772
|
+
var useTooltipStyles = makeStyles(function (_a) {
|
|
773
|
+
var typography = _a.typography;
|
|
774
|
+
return ({
|
|
775
|
+
tooltip: {
|
|
776
|
+
fontSize: typography.pxToRem(16),
|
|
777
|
+
},
|
|
778
|
+
});
|
|
779
|
+
});
|
|
780
|
+
|
|
781
|
+
var Tooltip = forwardRef(function (props, ref) {
|
|
782
|
+
var classes = useTooltipStyles(props);
|
|
783
|
+
return React__default__default.createElement(MuiTooltip, __assign({ ref: ref, classes: classes }, props));
|
|
784
|
+
});
|
|
785
|
+
Tooltip.displayName = 'Tooltip';
|
|
786
|
+
|
|
787
|
+
makeStyles$1(function () { return ({
|
|
788
|
+
root: {
|
|
789
|
+
height: 56,
|
|
790
|
+
},
|
|
791
|
+
}); });
|
|
792
|
+
makeStyles$1(function (theme) { return ({
|
|
793
|
+
root: {
|
|
794
|
+
height: '100%',
|
|
795
|
+
width: 'min-content',
|
|
796
|
+
borderRadius: theme.spacing(1),
|
|
797
|
+
},
|
|
798
|
+
input: {
|
|
799
|
+
'&::-webkit-clear-button, &::-webkit-outer-spin-button, &::-webkit-inner-spin-button': {
|
|
800
|
+
display: 'none',
|
|
801
|
+
},
|
|
802
|
+
'-moz-appearance': 'textfield',
|
|
803
|
+
minWidth: 40,
|
|
804
|
+
padding: 0,
|
|
805
|
+
textAlign: 'center',
|
|
806
|
+
},
|
|
807
|
+
adornedStart: {
|
|
808
|
+
padding: 0,
|
|
809
|
+
},
|
|
810
|
+
adornedEnd: {
|
|
811
|
+
padding: 0,
|
|
812
|
+
},
|
|
813
|
+
}); });
|
|
814
|
+
|
|
815
|
+
var ReactionCounter = function (props) {
|
|
816
|
+
var count = props.count, icon = props.icon;
|
|
817
|
+
return (React__default__default.createElement(Box, { display: "flex", alignItems: "center", gridGap: 6 },
|
|
818
|
+
React__default__default.createElement(Icon, { icon: icon, size: "large" }),
|
|
819
|
+
React__default__default.createElement(Typography, null, count)));
|
|
820
|
+
};
|
|
821
|
+
|
|
822
|
+
var ReactionCounterGroup = function (props) {
|
|
823
|
+
var children = props.children;
|
|
824
|
+
return (React__default__default.createElement(Box, { display: "flex", gridGap: 16 }, children));
|
|
825
|
+
};
|
|
826
|
+
|
|
827
|
+
export { ItemTag, ItemTagGroup, ReactionCounter, ReactionCounterGroup };
|
|
828
|
+
//# sourceMappingURL=index.es.js.map
|