@carto/ps-react-ui 0.0.2-alpha.17
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/README.md +23 -0
- package/dist/ps-react-ui.es.js +1390 -0
- package/dist/ps-react-ui.umd.js +9 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/input-file/InputFile.d.ts +26 -0
- package/dist/types/input-file/types.d.ts +14 -0
- package/dist/types/styling/types.d.ts +4 -0
- package/package.json +74 -0
@@ -0,0 +1,1390 @@
|
|
1
|
+
var __defProp = Object.defineProperty;
|
2
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
3
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
4
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
6
|
+
var __spreadValues = (a, b) => {
|
7
|
+
for (var prop in b || (b = {}))
|
8
|
+
if (__hasOwnProp.call(b, prop))
|
9
|
+
__defNormalProp(a, prop, b[prop]);
|
10
|
+
if (__getOwnPropSymbols)
|
11
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
12
|
+
if (__propIsEnum.call(b, prop))
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
14
|
+
}
|
15
|
+
return a;
|
16
|
+
};
|
17
|
+
import * as React$2 from "react";
|
18
|
+
import React__default, { useRef, useState, useEffect } from "react";
|
19
|
+
import { makeStyles, Box, Typography, IconButton, Button } from "@material-ui/core";
|
20
|
+
import { withStyles as withStyles$1 } from "@material-ui/styles";
|
21
|
+
import * as ReactDOM from "react-dom";
|
22
|
+
function toVal(mix) {
|
23
|
+
var k, y, str = "";
|
24
|
+
if (typeof mix === "string" || typeof mix === "number") {
|
25
|
+
str += mix;
|
26
|
+
} else if (typeof mix === "object") {
|
27
|
+
if (Array.isArray(mix)) {
|
28
|
+
for (k = 0; k < mix.length; k++) {
|
29
|
+
if (mix[k]) {
|
30
|
+
if (y = toVal(mix[k])) {
|
31
|
+
str && (str += " ");
|
32
|
+
str += y;
|
33
|
+
}
|
34
|
+
}
|
35
|
+
}
|
36
|
+
} else {
|
37
|
+
for (k in mix) {
|
38
|
+
if (mix[k]) {
|
39
|
+
str && (str += " ");
|
40
|
+
str += k;
|
41
|
+
}
|
42
|
+
}
|
43
|
+
}
|
44
|
+
}
|
45
|
+
return str;
|
46
|
+
}
|
47
|
+
function clsx() {
|
48
|
+
var i = 0, tmp, x, str = "";
|
49
|
+
while (i < arguments.length) {
|
50
|
+
if (tmp = arguments[i++]) {
|
51
|
+
if (x = toVal(tmp)) {
|
52
|
+
str && (str += " ");
|
53
|
+
str += x;
|
54
|
+
}
|
55
|
+
}
|
56
|
+
}
|
57
|
+
return str;
|
58
|
+
}
|
59
|
+
function getAugmentedNamespace(n) {
|
60
|
+
if (n.__esModule)
|
61
|
+
return n;
|
62
|
+
var a = Object.defineProperty({}, "__esModule", { value: true });
|
63
|
+
Object.keys(n).forEach(function(k) {
|
64
|
+
var d = Object.getOwnPropertyDescriptor(n, k);
|
65
|
+
Object.defineProperty(a, k, d.get ? d : {
|
66
|
+
enumerable: true,
|
67
|
+
get: function() {
|
68
|
+
return n[k];
|
69
|
+
}
|
70
|
+
});
|
71
|
+
});
|
72
|
+
return a;
|
73
|
+
}
|
74
|
+
var DeleteOutline = {};
|
75
|
+
var interopRequireDefault = { exports: {} };
|
76
|
+
(function(module) {
|
77
|
+
function _interopRequireDefault2(obj) {
|
78
|
+
return obj && obj.__esModule ? obj : {
|
79
|
+
"default": obj
|
80
|
+
};
|
81
|
+
}
|
82
|
+
module.exports = _interopRequireDefault2, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
83
|
+
})(interopRequireDefault);
|
84
|
+
var interopRequireWildcard = { exports: {} };
|
85
|
+
var _typeof$1 = { exports: {} };
|
86
|
+
(function(module) {
|
87
|
+
function _typeof2(obj) {
|
88
|
+
"@babel/helpers - typeof";
|
89
|
+
return module.exports = _typeof2 = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(obj2) {
|
90
|
+
return typeof obj2;
|
91
|
+
} : function(obj2) {
|
92
|
+
return obj2 && typeof Symbol == "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
|
93
|
+
}, module.exports.__esModule = true, module.exports["default"] = module.exports, _typeof2(obj);
|
94
|
+
}
|
95
|
+
module.exports = _typeof2, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
96
|
+
})(_typeof$1);
|
97
|
+
(function(module) {
|
98
|
+
var _typeof2 = _typeof$1.exports["default"];
|
99
|
+
function _getRequireWildcardCache(nodeInterop) {
|
100
|
+
if (typeof WeakMap !== "function")
|
101
|
+
return null;
|
102
|
+
var cacheBabelInterop = /* @__PURE__ */ new WeakMap();
|
103
|
+
var cacheNodeInterop = /* @__PURE__ */ new WeakMap();
|
104
|
+
return (_getRequireWildcardCache = function _getRequireWildcardCache2(nodeInterop2) {
|
105
|
+
return nodeInterop2 ? cacheNodeInterop : cacheBabelInterop;
|
106
|
+
})(nodeInterop);
|
107
|
+
}
|
108
|
+
function _interopRequireWildcard2(obj, nodeInterop) {
|
109
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
110
|
+
return obj;
|
111
|
+
}
|
112
|
+
if (obj === null || _typeof2(obj) !== "object" && typeof obj !== "function") {
|
113
|
+
return {
|
114
|
+
"default": obj
|
115
|
+
};
|
116
|
+
}
|
117
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
118
|
+
if (cache && cache.has(obj)) {
|
119
|
+
return cache.get(obj);
|
120
|
+
}
|
121
|
+
var newObj = {};
|
122
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
123
|
+
for (var key in obj) {
|
124
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
125
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
126
|
+
if (desc && (desc.get || desc.set)) {
|
127
|
+
Object.defineProperty(newObj, key, desc);
|
128
|
+
} else {
|
129
|
+
newObj[key] = obj[key];
|
130
|
+
}
|
131
|
+
}
|
132
|
+
}
|
133
|
+
newObj["default"] = obj;
|
134
|
+
if (cache) {
|
135
|
+
cache.set(obj, newObj);
|
136
|
+
}
|
137
|
+
return newObj;
|
138
|
+
}
|
139
|
+
module.exports = _interopRequireWildcard2, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
140
|
+
})(interopRequireWildcard);
|
141
|
+
var createSvgIcon$1 = {};
|
142
|
+
function _extends() {
|
143
|
+
_extends = Object.assign || function(target) {
|
144
|
+
for (var i = 1; i < arguments.length; i++) {
|
145
|
+
var source = arguments[i];
|
146
|
+
for (var key in source) {
|
147
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
148
|
+
target[key] = source[key];
|
149
|
+
}
|
150
|
+
}
|
151
|
+
}
|
152
|
+
return target;
|
153
|
+
};
|
154
|
+
return _extends.apply(this, arguments);
|
155
|
+
}
|
156
|
+
function _typeof(obj) {
|
157
|
+
"@babel/helpers - typeof";
|
158
|
+
return _typeof = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(obj2) {
|
159
|
+
return typeof obj2;
|
160
|
+
} : function(obj2) {
|
161
|
+
return obj2 && typeof Symbol == "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
|
162
|
+
}, _typeof(obj);
|
163
|
+
}
|
164
|
+
function isPlainObject(item) {
|
165
|
+
return item && _typeof(item) === "object" && item.constructor === Object;
|
166
|
+
}
|
167
|
+
function deepmerge(target, source) {
|
168
|
+
var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {
|
169
|
+
clone: true
|
170
|
+
};
|
171
|
+
var output = options.clone ? _extends({}, target) : target;
|
172
|
+
if (isPlainObject(target) && isPlainObject(source)) {
|
173
|
+
Object.keys(source).forEach(function(key) {
|
174
|
+
if (key === "__proto__") {
|
175
|
+
return;
|
176
|
+
}
|
177
|
+
if (isPlainObject(source[key]) && key in target) {
|
178
|
+
output[key] = deepmerge(target[key], source[key], options);
|
179
|
+
} else {
|
180
|
+
output[key] = source[key];
|
181
|
+
}
|
182
|
+
});
|
183
|
+
}
|
184
|
+
return output;
|
185
|
+
}
|
186
|
+
function _defineProperty(obj, key, value) {
|
187
|
+
if (key in obj) {
|
188
|
+
Object.defineProperty(obj, key, {
|
189
|
+
value,
|
190
|
+
enumerable: true,
|
191
|
+
configurable: true,
|
192
|
+
writable: true
|
193
|
+
});
|
194
|
+
} else {
|
195
|
+
obj[key] = value;
|
196
|
+
}
|
197
|
+
return obj;
|
198
|
+
}
|
199
|
+
function formatMuiErrorMessage(code) {
|
200
|
+
var url = "https://material-ui.com/production-error/?code=" + code;
|
201
|
+
for (var i = 1; i < arguments.length; i += 1) {
|
202
|
+
url += "&args[]=" + encodeURIComponent(arguments[i]);
|
203
|
+
}
|
204
|
+
return "Minified Material-UI error #" + code + "; visit " + url + " for the full message.";
|
205
|
+
}
|
206
|
+
function capitalize(string) {
|
207
|
+
if (typeof string !== "string") {
|
208
|
+
throw new Error(formatMuiErrorMessage(7));
|
209
|
+
}
|
210
|
+
return string.charAt(0).toUpperCase() + string.slice(1);
|
211
|
+
}
|
212
|
+
function createChainedFunction() {
|
213
|
+
for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {
|
214
|
+
funcs[_key] = arguments[_key];
|
215
|
+
}
|
216
|
+
return funcs.reduce(function(acc, func) {
|
217
|
+
if (func == null) {
|
218
|
+
return acc;
|
219
|
+
}
|
220
|
+
return function chainedFunction() {
|
221
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
222
|
+
args[_key2] = arguments[_key2];
|
223
|
+
}
|
224
|
+
acc.apply(this, args);
|
225
|
+
func.apply(this, args);
|
226
|
+
};
|
227
|
+
}, function() {
|
228
|
+
});
|
229
|
+
}
|
230
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
231
|
+
if (source == null)
|
232
|
+
return {};
|
233
|
+
var target = {};
|
234
|
+
var sourceKeys = Object.keys(source);
|
235
|
+
var key, i;
|
236
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
237
|
+
key = sourceKeys[i];
|
238
|
+
if (excluded.indexOf(key) >= 0)
|
239
|
+
continue;
|
240
|
+
target[key] = source[key];
|
241
|
+
}
|
242
|
+
return target;
|
243
|
+
}
|
244
|
+
function _objectWithoutProperties(source, excluded) {
|
245
|
+
if (source == null)
|
246
|
+
return {};
|
247
|
+
var target = _objectWithoutPropertiesLoose(source, excluded);
|
248
|
+
var key, i;
|
249
|
+
if (Object.getOwnPropertySymbols) {
|
250
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
251
|
+
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
252
|
+
key = sourceSymbolKeys[i];
|
253
|
+
if (excluded.indexOf(key) >= 0)
|
254
|
+
continue;
|
255
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key))
|
256
|
+
continue;
|
257
|
+
target[key] = source[key];
|
258
|
+
}
|
259
|
+
}
|
260
|
+
return target;
|
261
|
+
}
|
262
|
+
var keys = ["xs", "sm", "md", "lg", "xl"];
|
263
|
+
function createBreakpoints(breakpoints) {
|
264
|
+
var _breakpoints$values = breakpoints.values, values = _breakpoints$values === void 0 ? {
|
265
|
+
xs: 0,
|
266
|
+
sm: 600,
|
267
|
+
md: 960,
|
268
|
+
lg: 1280,
|
269
|
+
xl: 1920
|
270
|
+
} : _breakpoints$values, _breakpoints$unit = breakpoints.unit, unit = _breakpoints$unit === void 0 ? "px" : _breakpoints$unit, _breakpoints$step = breakpoints.step, step = _breakpoints$step === void 0 ? 5 : _breakpoints$step, other = _objectWithoutProperties(breakpoints, ["values", "unit", "step"]);
|
271
|
+
function up(key) {
|
272
|
+
var value = typeof values[key] === "number" ? values[key] : key;
|
273
|
+
return "@media (min-width:".concat(value).concat(unit, ")");
|
274
|
+
}
|
275
|
+
function down(key) {
|
276
|
+
var endIndex = keys.indexOf(key) + 1;
|
277
|
+
var upperbound = values[keys[endIndex]];
|
278
|
+
if (endIndex === keys.length) {
|
279
|
+
return up("xs");
|
280
|
+
}
|
281
|
+
var value = typeof upperbound === "number" && endIndex > 0 ? upperbound : key;
|
282
|
+
return "@media (max-width:".concat(value - step / 100).concat(unit, ")");
|
283
|
+
}
|
284
|
+
function between(start, end) {
|
285
|
+
var endIndex = keys.indexOf(end);
|
286
|
+
if (endIndex === keys.length - 1) {
|
287
|
+
return up(start);
|
288
|
+
}
|
289
|
+
return "@media (min-width:".concat(typeof values[start] === "number" ? values[start] : start).concat(unit, ") and ") + "(max-width:".concat((endIndex !== -1 && typeof values[keys[endIndex + 1]] === "number" ? values[keys[endIndex + 1]] : end) - step / 100).concat(unit, ")");
|
290
|
+
}
|
291
|
+
function only(key) {
|
292
|
+
return between(key, key);
|
293
|
+
}
|
294
|
+
function width(key) {
|
295
|
+
return values[key];
|
296
|
+
}
|
297
|
+
return _extends({
|
298
|
+
keys,
|
299
|
+
values,
|
300
|
+
up,
|
301
|
+
down,
|
302
|
+
between,
|
303
|
+
only,
|
304
|
+
width
|
305
|
+
}, other);
|
306
|
+
}
|
307
|
+
function createMixins(breakpoints, spacing, mixins) {
|
308
|
+
var _toolbar;
|
309
|
+
return _extends({
|
310
|
+
gutters: function gutters() {
|
311
|
+
var styles3 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
312
|
+
console.warn(["Material-UI: theme.mixins.gutters() is deprecated.", "You can use the source of the mixin directly:", "\n paddingLeft: theme.spacing(2),\n paddingRight: theme.spacing(2),\n [theme.breakpoints.up('sm')]: {\n paddingLeft: theme.spacing(3),\n paddingRight: theme.spacing(3),\n },\n "].join("\n"));
|
313
|
+
return _extends({
|
314
|
+
paddingLeft: spacing(2),
|
315
|
+
paddingRight: spacing(2)
|
316
|
+
}, styles3, _defineProperty({}, breakpoints.up("sm"), _extends({
|
317
|
+
paddingLeft: spacing(3),
|
318
|
+
paddingRight: spacing(3)
|
319
|
+
}, styles3[breakpoints.up("sm")])));
|
320
|
+
},
|
321
|
+
toolbar: (_toolbar = {
|
322
|
+
minHeight: 56
|
323
|
+
}, _defineProperty(_toolbar, "".concat(breakpoints.up("xs"), " and (orientation: landscape)"), {
|
324
|
+
minHeight: 48
|
325
|
+
}), _defineProperty(_toolbar, breakpoints.up("sm"), {
|
326
|
+
minHeight: 64
|
327
|
+
}), _toolbar)
|
328
|
+
}, mixins);
|
329
|
+
}
|
330
|
+
var common = {
|
331
|
+
black: "#000",
|
332
|
+
white: "#fff"
|
333
|
+
};
|
334
|
+
var common$1 = common;
|
335
|
+
var grey = {
|
336
|
+
50: "#fafafa",
|
337
|
+
100: "#f5f5f5",
|
338
|
+
200: "#eeeeee",
|
339
|
+
300: "#e0e0e0",
|
340
|
+
400: "#bdbdbd",
|
341
|
+
500: "#9e9e9e",
|
342
|
+
600: "#757575",
|
343
|
+
700: "#616161",
|
344
|
+
800: "#424242",
|
345
|
+
900: "#212121",
|
346
|
+
A100: "#d5d5d5",
|
347
|
+
A200: "#aaaaaa",
|
348
|
+
A400: "#303030",
|
349
|
+
A700: "#616161"
|
350
|
+
};
|
351
|
+
var grey$1 = grey;
|
352
|
+
var indigo = {
|
353
|
+
50: "#e8eaf6",
|
354
|
+
100: "#c5cae9",
|
355
|
+
200: "#9fa8da",
|
356
|
+
300: "#7986cb",
|
357
|
+
400: "#5c6bc0",
|
358
|
+
500: "#3f51b5",
|
359
|
+
600: "#3949ab",
|
360
|
+
700: "#303f9f",
|
361
|
+
800: "#283593",
|
362
|
+
900: "#1a237e",
|
363
|
+
A100: "#8c9eff",
|
364
|
+
A200: "#536dfe",
|
365
|
+
A400: "#3d5afe",
|
366
|
+
A700: "#304ffe"
|
367
|
+
};
|
368
|
+
var indigo$1 = indigo;
|
369
|
+
var pink = {
|
370
|
+
50: "#fce4ec",
|
371
|
+
100: "#f8bbd0",
|
372
|
+
200: "#f48fb1",
|
373
|
+
300: "#f06292",
|
374
|
+
400: "#ec407a",
|
375
|
+
500: "#e91e63",
|
376
|
+
600: "#d81b60",
|
377
|
+
700: "#c2185b",
|
378
|
+
800: "#ad1457",
|
379
|
+
900: "#880e4f",
|
380
|
+
A100: "#ff80ab",
|
381
|
+
A200: "#ff4081",
|
382
|
+
A400: "#f50057",
|
383
|
+
A700: "#c51162"
|
384
|
+
};
|
385
|
+
var pink$1 = pink;
|
386
|
+
var red = {
|
387
|
+
50: "#ffebee",
|
388
|
+
100: "#ffcdd2",
|
389
|
+
200: "#ef9a9a",
|
390
|
+
300: "#e57373",
|
391
|
+
400: "#ef5350",
|
392
|
+
500: "#f44336",
|
393
|
+
600: "#e53935",
|
394
|
+
700: "#d32f2f",
|
395
|
+
800: "#c62828",
|
396
|
+
900: "#b71c1c",
|
397
|
+
A100: "#ff8a80",
|
398
|
+
A200: "#ff5252",
|
399
|
+
A400: "#ff1744",
|
400
|
+
A700: "#d50000"
|
401
|
+
};
|
402
|
+
var red$1 = red;
|
403
|
+
var orange = {
|
404
|
+
50: "#fff3e0",
|
405
|
+
100: "#ffe0b2",
|
406
|
+
200: "#ffcc80",
|
407
|
+
300: "#ffb74d",
|
408
|
+
400: "#ffa726",
|
409
|
+
500: "#ff9800",
|
410
|
+
600: "#fb8c00",
|
411
|
+
700: "#f57c00",
|
412
|
+
800: "#ef6c00",
|
413
|
+
900: "#e65100",
|
414
|
+
A100: "#ffd180",
|
415
|
+
A200: "#ffab40",
|
416
|
+
A400: "#ff9100",
|
417
|
+
A700: "#ff6d00"
|
418
|
+
};
|
419
|
+
var orange$1 = orange;
|
420
|
+
var blue = {
|
421
|
+
50: "#e3f2fd",
|
422
|
+
100: "#bbdefb",
|
423
|
+
200: "#90caf9",
|
424
|
+
300: "#64b5f6",
|
425
|
+
400: "#42a5f5",
|
426
|
+
500: "#2196f3",
|
427
|
+
600: "#1e88e5",
|
428
|
+
700: "#1976d2",
|
429
|
+
800: "#1565c0",
|
430
|
+
900: "#0d47a1",
|
431
|
+
A100: "#82b1ff",
|
432
|
+
A200: "#448aff",
|
433
|
+
A400: "#2979ff",
|
434
|
+
A700: "#2962ff"
|
435
|
+
};
|
436
|
+
var blue$1 = blue;
|
437
|
+
var green = {
|
438
|
+
50: "#e8f5e9",
|
439
|
+
100: "#c8e6c9",
|
440
|
+
200: "#a5d6a7",
|
441
|
+
300: "#81c784",
|
442
|
+
400: "#66bb6a",
|
443
|
+
500: "#4caf50",
|
444
|
+
600: "#43a047",
|
445
|
+
700: "#388e3c",
|
446
|
+
800: "#2e7d32",
|
447
|
+
900: "#1b5e20",
|
448
|
+
A100: "#b9f6ca",
|
449
|
+
A200: "#69f0ae",
|
450
|
+
A400: "#00e676",
|
451
|
+
A700: "#00c853"
|
452
|
+
};
|
453
|
+
var green$1 = green;
|
454
|
+
function clamp(value) {
|
455
|
+
var min = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
|
456
|
+
var max = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 1;
|
457
|
+
return Math.min(Math.max(min, value), max);
|
458
|
+
}
|
459
|
+
function hexToRgb(color) {
|
460
|
+
color = color.substr(1);
|
461
|
+
var re = new RegExp(".{1,".concat(color.length >= 6 ? 2 : 1, "}"), "g");
|
462
|
+
var colors = color.match(re);
|
463
|
+
if (colors && colors[0].length === 1) {
|
464
|
+
colors = colors.map(function(n) {
|
465
|
+
return n + n;
|
466
|
+
});
|
467
|
+
}
|
468
|
+
return colors ? "rgb".concat(colors.length === 4 ? "a" : "", "(").concat(colors.map(function(n, index) {
|
469
|
+
return index < 3 ? parseInt(n, 16) : Math.round(parseInt(n, 16) / 255 * 1e3) / 1e3;
|
470
|
+
}).join(", "), ")") : "";
|
471
|
+
}
|
472
|
+
function hslToRgb(color) {
|
473
|
+
color = decomposeColor(color);
|
474
|
+
var _color = color, values = _color.values;
|
475
|
+
var h = values[0];
|
476
|
+
var s = values[1] / 100;
|
477
|
+
var l = values[2] / 100;
|
478
|
+
var a = s * Math.min(l, 1 - l);
|
479
|
+
var f = function f2(n) {
|
480
|
+
var k = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : (n + h / 30) % 12;
|
481
|
+
return l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1);
|
482
|
+
};
|
483
|
+
var type = "rgb";
|
484
|
+
var rgb = [Math.round(f(0) * 255), Math.round(f(8) * 255), Math.round(f(4) * 255)];
|
485
|
+
if (color.type === "hsla") {
|
486
|
+
type += "a";
|
487
|
+
rgb.push(values[3]);
|
488
|
+
}
|
489
|
+
return recomposeColor({
|
490
|
+
type,
|
491
|
+
values: rgb
|
492
|
+
});
|
493
|
+
}
|
494
|
+
function decomposeColor(color) {
|
495
|
+
if (color.type) {
|
496
|
+
return color;
|
497
|
+
}
|
498
|
+
if (color.charAt(0) === "#") {
|
499
|
+
return decomposeColor(hexToRgb(color));
|
500
|
+
}
|
501
|
+
var marker = color.indexOf("(");
|
502
|
+
var type = color.substring(0, marker);
|
503
|
+
if (["rgb", "rgba", "hsl", "hsla"].indexOf(type) === -1) {
|
504
|
+
throw new Error(formatMuiErrorMessage(3, color));
|
505
|
+
}
|
506
|
+
var values = color.substring(marker + 1, color.length - 1).split(",");
|
507
|
+
values = values.map(function(value) {
|
508
|
+
return parseFloat(value);
|
509
|
+
});
|
510
|
+
return {
|
511
|
+
type,
|
512
|
+
values
|
513
|
+
};
|
514
|
+
}
|
515
|
+
function recomposeColor(color) {
|
516
|
+
var type = color.type;
|
517
|
+
var values = color.values;
|
518
|
+
if (type.indexOf("rgb") !== -1) {
|
519
|
+
values = values.map(function(n, i) {
|
520
|
+
return i < 3 ? parseInt(n, 10) : n;
|
521
|
+
});
|
522
|
+
} else if (type.indexOf("hsl") !== -1) {
|
523
|
+
values[1] = "".concat(values[1], "%");
|
524
|
+
values[2] = "".concat(values[2], "%");
|
525
|
+
}
|
526
|
+
return "".concat(type, "(").concat(values.join(", "), ")");
|
527
|
+
}
|
528
|
+
function getContrastRatio(foreground, background) {
|
529
|
+
var lumA = getLuminance(foreground);
|
530
|
+
var lumB = getLuminance(background);
|
531
|
+
return (Math.max(lumA, lumB) + 0.05) / (Math.min(lumA, lumB) + 0.05);
|
532
|
+
}
|
533
|
+
function getLuminance(color) {
|
534
|
+
color = decomposeColor(color);
|
535
|
+
var rgb = color.type === "hsl" ? decomposeColor(hslToRgb(color)).values : color.values;
|
536
|
+
rgb = rgb.map(function(val) {
|
537
|
+
val /= 255;
|
538
|
+
return val <= 0.03928 ? val / 12.92 : Math.pow((val + 0.055) / 1.055, 2.4);
|
539
|
+
});
|
540
|
+
return Number((0.2126 * rgb[0] + 0.7152 * rgb[1] + 0.0722 * rgb[2]).toFixed(3));
|
541
|
+
}
|
542
|
+
function darken(color, coefficient) {
|
543
|
+
color = decomposeColor(color);
|
544
|
+
coefficient = clamp(coefficient);
|
545
|
+
if (color.type.indexOf("hsl") !== -1) {
|
546
|
+
color.values[2] *= 1 - coefficient;
|
547
|
+
} else if (color.type.indexOf("rgb") !== -1) {
|
548
|
+
for (var i = 0; i < 3; i += 1) {
|
549
|
+
color.values[i] *= 1 - coefficient;
|
550
|
+
}
|
551
|
+
}
|
552
|
+
return recomposeColor(color);
|
553
|
+
}
|
554
|
+
function lighten(color, coefficient) {
|
555
|
+
color = decomposeColor(color);
|
556
|
+
coefficient = clamp(coefficient);
|
557
|
+
if (color.type.indexOf("hsl") !== -1) {
|
558
|
+
color.values[2] += (100 - color.values[2]) * coefficient;
|
559
|
+
} else if (color.type.indexOf("rgb") !== -1) {
|
560
|
+
for (var i = 0; i < 3; i += 1) {
|
561
|
+
color.values[i] += (255 - color.values[i]) * coefficient;
|
562
|
+
}
|
563
|
+
}
|
564
|
+
return recomposeColor(color);
|
565
|
+
}
|
566
|
+
var light = {
|
567
|
+
text: {
|
568
|
+
primary: "rgba(0, 0, 0, 0.87)",
|
569
|
+
secondary: "rgba(0, 0, 0, 0.54)",
|
570
|
+
disabled: "rgba(0, 0, 0, 0.38)",
|
571
|
+
hint: "rgba(0, 0, 0, 0.38)"
|
572
|
+
},
|
573
|
+
divider: "rgba(0, 0, 0, 0.12)",
|
574
|
+
background: {
|
575
|
+
paper: common$1.white,
|
576
|
+
default: grey$1[50]
|
577
|
+
},
|
578
|
+
action: {
|
579
|
+
active: "rgba(0, 0, 0, 0.54)",
|
580
|
+
hover: "rgba(0, 0, 0, 0.04)",
|
581
|
+
hoverOpacity: 0.04,
|
582
|
+
selected: "rgba(0, 0, 0, 0.08)",
|
583
|
+
selectedOpacity: 0.08,
|
584
|
+
disabled: "rgba(0, 0, 0, 0.26)",
|
585
|
+
disabledBackground: "rgba(0, 0, 0, 0.12)",
|
586
|
+
disabledOpacity: 0.38,
|
587
|
+
focus: "rgba(0, 0, 0, 0.12)",
|
588
|
+
focusOpacity: 0.12,
|
589
|
+
activatedOpacity: 0.12
|
590
|
+
}
|
591
|
+
};
|
592
|
+
var dark = {
|
593
|
+
text: {
|
594
|
+
primary: common$1.white,
|
595
|
+
secondary: "rgba(255, 255, 255, 0.7)",
|
596
|
+
disabled: "rgba(255, 255, 255, 0.5)",
|
597
|
+
hint: "rgba(255, 255, 255, 0.5)",
|
598
|
+
icon: "rgba(255, 255, 255, 0.5)"
|
599
|
+
},
|
600
|
+
divider: "rgba(255, 255, 255, 0.12)",
|
601
|
+
background: {
|
602
|
+
paper: grey$1[800],
|
603
|
+
default: "#303030"
|
604
|
+
},
|
605
|
+
action: {
|
606
|
+
active: common$1.white,
|
607
|
+
hover: "rgba(255, 255, 255, 0.08)",
|
608
|
+
hoverOpacity: 0.08,
|
609
|
+
selected: "rgba(255, 255, 255, 0.16)",
|
610
|
+
selectedOpacity: 0.16,
|
611
|
+
disabled: "rgba(255, 255, 255, 0.3)",
|
612
|
+
disabledBackground: "rgba(255, 255, 255, 0.12)",
|
613
|
+
disabledOpacity: 0.38,
|
614
|
+
focus: "rgba(255, 255, 255, 0.12)",
|
615
|
+
focusOpacity: 0.12,
|
616
|
+
activatedOpacity: 0.24
|
617
|
+
}
|
618
|
+
};
|
619
|
+
function addLightOrDark(intent, direction, shade, tonalOffset) {
|
620
|
+
var tonalOffsetLight = tonalOffset.light || tonalOffset;
|
621
|
+
var tonalOffsetDark = tonalOffset.dark || tonalOffset * 1.5;
|
622
|
+
if (!intent[direction]) {
|
623
|
+
if (intent.hasOwnProperty(shade)) {
|
624
|
+
intent[direction] = intent[shade];
|
625
|
+
} else if (direction === "light") {
|
626
|
+
intent.light = lighten(intent.main, tonalOffsetLight);
|
627
|
+
} else if (direction === "dark") {
|
628
|
+
intent.dark = darken(intent.main, tonalOffsetDark);
|
629
|
+
}
|
630
|
+
}
|
631
|
+
}
|
632
|
+
function createPalette(palette) {
|
633
|
+
var _palette$primary = palette.primary, primary = _palette$primary === void 0 ? {
|
634
|
+
light: indigo$1[300],
|
635
|
+
main: indigo$1[500],
|
636
|
+
dark: indigo$1[700]
|
637
|
+
} : _palette$primary, _palette$secondary = palette.secondary, secondary = _palette$secondary === void 0 ? {
|
638
|
+
light: pink$1.A200,
|
639
|
+
main: pink$1.A400,
|
640
|
+
dark: pink$1.A700
|
641
|
+
} : _palette$secondary, _palette$error = palette.error, error = _palette$error === void 0 ? {
|
642
|
+
light: red$1[300],
|
643
|
+
main: red$1[500],
|
644
|
+
dark: red$1[700]
|
645
|
+
} : _palette$error, _palette$warning = palette.warning, warning = _palette$warning === void 0 ? {
|
646
|
+
light: orange$1[300],
|
647
|
+
main: orange$1[500],
|
648
|
+
dark: orange$1[700]
|
649
|
+
} : _palette$warning, _palette$info = palette.info, info = _palette$info === void 0 ? {
|
650
|
+
light: blue$1[300],
|
651
|
+
main: blue$1[500],
|
652
|
+
dark: blue$1[700]
|
653
|
+
} : _palette$info, _palette$success = palette.success, success = _palette$success === void 0 ? {
|
654
|
+
light: green$1[300],
|
655
|
+
main: green$1[500],
|
656
|
+
dark: green$1[700]
|
657
|
+
} : _palette$success, _palette$type = palette.type, type = _palette$type === void 0 ? "light" : _palette$type, _palette$contrastThre = palette.contrastThreshold, contrastThreshold = _palette$contrastThre === void 0 ? 3 : _palette$contrastThre, _palette$tonalOffset = palette.tonalOffset, tonalOffset = _palette$tonalOffset === void 0 ? 0.2 : _palette$tonalOffset, other = _objectWithoutProperties(palette, ["primary", "secondary", "error", "warning", "info", "success", "type", "contrastThreshold", "tonalOffset"]);
|
658
|
+
function getContrastText(background) {
|
659
|
+
var contrastText = getContrastRatio(background, dark.text.primary) >= contrastThreshold ? dark.text.primary : light.text.primary;
|
660
|
+
return contrastText;
|
661
|
+
}
|
662
|
+
var augmentColor = function augmentColor2(color) {
|
663
|
+
var mainShade = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 500;
|
664
|
+
var lightShade = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 300;
|
665
|
+
var darkShade = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 700;
|
666
|
+
color = _extends({}, color);
|
667
|
+
if (!color.main && color[mainShade]) {
|
668
|
+
color.main = color[mainShade];
|
669
|
+
}
|
670
|
+
if (!color.main) {
|
671
|
+
throw new Error(formatMuiErrorMessage(4, mainShade));
|
672
|
+
}
|
673
|
+
if (typeof color.main !== "string") {
|
674
|
+
throw new Error(formatMuiErrorMessage(5, JSON.stringify(color.main)));
|
675
|
+
}
|
676
|
+
addLightOrDark(color, "light", lightShade, tonalOffset);
|
677
|
+
addLightOrDark(color, "dark", darkShade, tonalOffset);
|
678
|
+
if (!color.contrastText) {
|
679
|
+
color.contrastText = getContrastText(color.main);
|
680
|
+
}
|
681
|
+
return color;
|
682
|
+
};
|
683
|
+
var types = {
|
684
|
+
dark,
|
685
|
+
light
|
686
|
+
};
|
687
|
+
var paletteOutput = deepmerge(_extends({
|
688
|
+
common: common$1,
|
689
|
+
type,
|
690
|
+
primary: augmentColor(primary),
|
691
|
+
secondary: augmentColor(secondary, "A400", "A200", "A700"),
|
692
|
+
error: augmentColor(error),
|
693
|
+
warning: augmentColor(warning),
|
694
|
+
info: augmentColor(info),
|
695
|
+
success: augmentColor(success),
|
696
|
+
grey: grey$1,
|
697
|
+
contrastThreshold,
|
698
|
+
getContrastText,
|
699
|
+
augmentColor,
|
700
|
+
tonalOffset
|
701
|
+
}, types[type]), other);
|
702
|
+
return paletteOutput;
|
703
|
+
}
|
704
|
+
function round(value) {
|
705
|
+
return Math.round(value * 1e5) / 1e5;
|
706
|
+
}
|
707
|
+
function roundWithDeprecationWarning(value) {
|
708
|
+
return round(value);
|
709
|
+
}
|
710
|
+
var caseAllCaps = {
|
711
|
+
textTransform: "uppercase"
|
712
|
+
};
|
713
|
+
var defaultFontFamily = '"Roboto", "Helvetica", "Arial", sans-serif';
|
714
|
+
function createTypography(palette, typography) {
|
715
|
+
var _ref = typeof typography === "function" ? typography(palette) : typography, _ref$fontFamily = _ref.fontFamily, fontFamily = _ref$fontFamily === void 0 ? defaultFontFamily : _ref$fontFamily, _ref$fontSize = _ref.fontSize, fontSize = _ref$fontSize === void 0 ? 14 : _ref$fontSize, _ref$fontWeightLight = _ref.fontWeightLight, fontWeightLight = _ref$fontWeightLight === void 0 ? 300 : _ref$fontWeightLight, _ref$fontWeightRegula = _ref.fontWeightRegular, fontWeightRegular = _ref$fontWeightRegula === void 0 ? 400 : _ref$fontWeightRegula, _ref$fontWeightMedium = _ref.fontWeightMedium, fontWeightMedium = _ref$fontWeightMedium === void 0 ? 500 : _ref$fontWeightMedium, _ref$fontWeightBold = _ref.fontWeightBold, fontWeightBold = _ref$fontWeightBold === void 0 ? 700 : _ref$fontWeightBold, _ref$htmlFontSize = _ref.htmlFontSize, htmlFontSize = _ref$htmlFontSize === void 0 ? 16 : _ref$htmlFontSize, allVariants = _ref.allVariants, pxToRem2 = _ref.pxToRem, other = _objectWithoutProperties(_ref, ["fontFamily", "fontSize", "fontWeightLight", "fontWeightRegular", "fontWeightMedium", "fontWeightBold", "htmlFontSize", "allVariants", "pxToRem"]);
|
716
|
+
var coef = fontSize / 14;
|
717
|
+
var pxToRem = pxToRem2 || function(size) {
|
718
|
+
return "".concat(size / htmlFontSize * coef, "rem");
|
719
|
+
};
|
720
|
+
var buildVariant = function buildVariant2(fontWeight, size, lineHeight, letterSpacing, casing) {
|
721
|
+
return _extends({
|
722
|
+
fontFamily,
|
723
|
+
fontWeight,
|
724
|
+
fontSize: pxToRem(size),
|
725
|
+
lineHeight
|
726
|
+
}, fontFamily === defaultFontFamily ? {
|
727
|
+
letterSpacing: "".concat(round(letterSpacing / size), "em")
|
728
|
+
} : {}, casing, allVariants);
|
729
|
+
};
|
730
|
+
var variants = {
|
731
|
+
h1: buildVariant(fontWeightLight, 96, 1.167, -1.5),
|
732
|
+
h2: buildVariant(fontWeightLight, 60, 1.2, -0.5),
|
733
|
+
h3: buildVariant(fontWeightRegular, 48, 1.167, 0),
|
734
|
+
h4: buildVariant(fontWeightRegular, 34, 1.235, 0.25),
|
735
|
+
h5: buildVariant(fontWeightRegular, 24, 1.334, 0),
|
736
|
+
h6: buildVariant(fontWeightMedium, 20, 1.6, 0.15),
|
737
|
+
subtitle1: buildVariant(fontWeightRegular, 16, 1.75, 0.15),
|
738
|
+
subtitle2: buildVariant(fontWeightMedium, 14, 1.57, 0.1),
|
739
|
+
body1: buildVariant(fontWeightRegular, 16, 1.5, 0.15),
|
740
|
+
body2: buildVariant(fontWeightRegular, 14, 1.43, 0.15),
|
741
|
+
button: buildVariant(fontWeightMedium, 14, 1.75, 0.4, caseAllCaps),
|
742
|
+
caption: buildVariant(fontWeightRegular, 12, 1.66, 0.4),
|
743
|
+
overline: buildVariant(fontWeightRegular, 12, 2.66, 1, caseAllCaps)
|
744
|
+
};
|
745
|
+
return deepmerge(_extends({
|
746
|
+
htmlFontSize,
|
747
|
+
pxToRem,
|
748
|
+
round: roundWithDeprecationWarning,
|
749
|
+
fontFamily,
|
750
|
+
fontSize,
|
751
|
+
fontWeightLight,
|
752
|
+
fontWeightRegular,
|
753
|
+
fontWeightMedium,
|
754
|
+
fontWeightBold
|
755
|
+
}, variants), other, {
|
756
|
+
clone: false
|
757
|
+
});
|
758
|
+
}
|
759
|
+
var shadowKeyUmbraOpacity = 0.2;
|
760
|
+
var shadowKeyPenumbraOpacity = 0.14;
|
761
|
+
var shadowAmbientShadowOpacity = 0.12;
|
762
|
+
function createShadow() {
|
763
|
+
return ["".concat(arguments.length <= 0 ? void 0 : arguments[0], "px ").concat(arguments.length <= 1 ? void 0 : arguments[1], "px ").concat(arguments.length <= 2 ? void 0 : arguments[2], "px ").concat(arguments.length <= 3 ? void 0 : arguments[3], "px rgba(0,0,0,").concat(shadowKeyUmbraOpacity, ")"), "".concat(arguments.length <= 4 ? void 0 : arguments[4], "px ").concat(arguments.length <= 5 ? void 0 : arguments[5], "px ").concat(arguments.length <= 6 ? void 0 : arguments[6], "px ").concat(arguments.length <= 7 ? void 0 : arguments[7], "px rgba(0,0,0,").concat(shadowKeyPenumbraOpacity, ")"), "".concat(arguments.length <= 8 ? void 0 : arguments[8], "px ").concat(arguments.length <= 9 ? void 0 : arguments[9], "px ").concat(arguments.length <= 10 ? void 0 : arguments[10], "px ").concat(arguments.length <= 11 ? void 0 : arguments[11], "px rgba(0,0,0,").concat(shadowAmbientShadowOpacity, ")")].join(",");
|
764
|
+
}
|
765
|
+
var shadows = ["none", createShadow(0, 2, 1, -1, 0, 1, 1, 0, 0, 1, 3, 0), createShadow(0, 3, 1, -2, 0, 2, 2, 0, 0, 1, 5, 0), createShadow(0, 3, 3, -2, 0, 3, 4, 0, 0, 1, 8, 0), createShadow(0, 2, 4, -1, 0, 4, 5, 0, 0, 1, 10, 0), createShadow(0, 3, 5, -1, 0, 5, 8, 0, 0, 1, 14, 0), createShadow(0, 3, 5, -1, 0, 6, 10, 0, 0, 1, 18, 0), createShadow(0, 4, 5, -2, 0, 7, 10, 1, 0, 2, 16, 1), createShadow(0, 5, 5, -3, 0, 8, 10, 1, 0, 3, 14, 2), createShadow(0, 5, 6, -3, 0, 9, 12, 1, 0, 3, 16, 2), createShadow(0, 6, 6, -3, 0, 10, 14, 1, 0, 4, 18, 3), createShadow(0, 6, 7, -4, 0, 11, 15, 1, 0, 4, 20, 3), createShadow(0, 7, 8, -4, 0, 12, 17, 2, 0, 5, 22, 4), createShadow(0, 7, 8, -4, 0, 13, 19, 2, 0, 5, 24, 4), createShadow(0, 7, 9, -4, 0, 14, 21, 2, 0, 5, 26, 4), createShadow(0, 8, 9, -5, 0, 15, 22, 2, 0, 6, 28, 5), createShadow(0, 8, 10, -5, 0, 16, 24, 2, 0, 6, 30, 5), createShadow(0, 8, 11, -5, 0, 17, 26, 2, 0, 6, 32, 5), createShadow(0, 9, 11, -5, 0, 18, 28, 2, 0, 7, 34, 6), createShadow(0, 9, 12, -6, 0, 19, 29, 2, 0, 7, 36, 6), createShadow(0, 10, 13, -6, 0, 20, 31, 3, 0, 8, 38, 7), createShadow(0, 10, 13, -6, 0, 21, 33, 3, 0, 8, 40, 7), createShadow(0, 10, 14, -6, 0, 22, 35, 3, 0, 8, 42, 7), createShadow(0, 11, 14, -7, 0, 23, 36, 3, 0, 9, 44, 8), createShadow(0, 11, 15, -7, 0, 24, 38, 3, 0, 9, 46, 8)];
|
766
|
+
var shadows$1 = shadows;
|
767
|
+
var shape = {
|
768
|
+
borderRadius: 4
|
769
|
+
};
|
770
|
+
var shape$1 = shape;
|
771
|
+
function createUnarySpacing(theme) {
|
772
|
+
var themeSpacing = theme.spacing || 8;
|
773
|
+
if (typeof themeSpacing === "number") {
|
774
|
+
return function(abs) {
|
775
|
+
return themeSpacing * abs;
|
776
|
+
};
|
777
|
+
}
|
778
|
+
if (Array.isArray(themeSpacing)) {
|
779
|
+
return function(abs) {
|
780
|
+
return themeSpacing[abs];
|
781
|
+
};
|
782
|
+
}
|
783
|
+
if (typeof themeSpacing === "function") {
|
784
|
+
return themeSpacing;
|
785
|
+
}
|
786
|
+
return function() {
|
787
|
+
return void 0;
|
788
|
+
};
|
789
|
+
}
|
790
|
+
function createSpacing() {
|
791
|
+
var spacingInput = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 8;
|
792
|
+
if (spacingInput.mui) {
|
793
|
+
return spacingInput;
|
794
|
+
}
|
795
|
+
var transform = createUnarySpacing({
|
796
|
+
spacing: spacingInput
|
797
|
+
});
|
798
|
+
var spacing = function spacing2() {
|
799
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
800
|
+
args[_key] = arguments[_key];
|
801
|
+
}
|
802
|
+
if (args.length === 0) {
|
803
|
+
return transform(1);
|
804
|
+
}
|
805
|
+
if (args.length === 1) {
|
806
|
+
return transform(args[0]);
|
807
|
+
}
|
808
|
+
return args.map(function(argument) {
|
809
|
+
if (typeof argument === "string") {
|
810
|
+
return argument;
|
811
|
+
}
|
812
|
+
var output = transform(argument);
|
813
|
+
return typeof output === "number" ? "".concat(output, "px") : output;
|
814
|
+
}).join(" ");
|
815
|
+
};
|
816
|
+
Object.defineProperty(spacing, "unit", {
|
817
|
+
get: function get() {
|
818
|
+
return spacingInput;
|
819
|
+
}
|
820
|
+
});
|
821
|
+
spacing.mui = true;
|
822
|
+
return spacing;
|
823
|
+
}
|
824
|
+
var easing = {
|
825
|
+
easeInOut: "cubic-bezier(0.4, 0, 0.2, 1)",
|
826
|
+
easeOut: "cubic-bezier(0.0, 0, 0.2, 1)",
|
827
|
+
easeIn: "cubic-bezier(0.4, 0, 1, 1)",
|
828
|
+
sharp: "cubic-bezier(0.4, 0, 0.6, 1)"
|
829
|
+
};
|
830
|
+
var duration = {
|
831
|
+
shortest: 150,
|
832
|
+
shorter: 200,
|
833
|
+
short: 250,
|
834
|
+
standard: 300,
|
835
|
+
complex: 375,
|
836
|
+
enteringScreen: 225,
|
837
|
+
leavingScreen: 195
|
838
|
+
};
|
839
|
+
function formatMs(milliseconds) {
|
840
|
+
return "".concat(Math.round(milliseconds), "ms");
|
841
|
+
}
|
842
|
+
var transitions = {
|
843
|
+
easing,
|
844
|
+
duration,
|
845
|
+
create: function create() {
|
846
|
+
var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : ["all"];
|
847
|
+
var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
848
|
+
var _options$duration = options.duration, durationOption = _options$duration === void 0 ? duration.standard : _options$duration, _options$easing = options.easing, easingOption = _options$easing === void 0 ? easing.easeInOut : _options$easing, _options$delay = options.delay, delay = _options$delay === void 0 ? 0 : _options$delay;
|
849
|
+
_objectWithoutProperties(options, ["duration", "easing", "delay"]);
|
850
|
+
return (Array.isArray(props) ? props : [props]).map(function(animatedProp) {
|
851
|
+
return "".concat(animatedProp, " ").concat(typeof durationOption === "string" ? durationOption : formatMs(durationOption), " ").concat(easingOption, " ").concat(typeof delay === "string" ? delay : formatMs(delay));
|
852
|
+
}).join(",");
|
853
|
+
},
|
854
|
+
getAutoHeightDuration: function getAutoHeightDuration(height) {
|
855
|
+
if (!height) {
|
856
|
+
return 0;
|
857
|
+
}
|
858
|
+
var constant = height / 36;
|
859
|
+
return Math.round((4 + 15 * Math.pow(constant, 0.25) + constant / 5) * 10);
|
860
|
+
}
|
861
|
+
};
|
862
|
+
var zIndex = {
|
863
|
+
mobileStepper: 1e3,
|
864
|
+
speedDial: 1050,
|
865
|
+
appBar: 1100,
|
866
|
+
drawer: 1200,
|
867
|
+
modal: 1300,
|
868
|
+
snackbar: 1400,
|
869
|
+
tooltip: 1500
|
870
|
+
};
|
871
|
+
var zIndex$1 = zIndex;
|
872
|
+
function createTheme() {
|
873
|
+
var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
874
|
+
var _options$breakpoints = options.breakpoints, breakpointsInput = _options$breakpoints === void 0 ? {} : _options$breakpoints, _options$mixins = options.mixins, mixinsInput = _options$mixins === void 0 ? {} : _options$mixins, _options$palette = options.palette, paletteInput = _options$palette === void 0 ? {} : _options$palette, spacingInput = options.spacing, _options$typography = options.typography, typographyInput = _options$typography === void 0 ? {} : _options$typography, other = _objectWithoutProperties(options, ["breakpoints", "mixins", "palette", "spacing", "typography"]);
|
875
|
+
var palette = createPalette(paletteInput);
|
876
|
+
var breakpoints = createBreakpoints(breakpointsInput);
|
877
|
+
var spacing = createSpacing(spacingInput);
|
878
|
+
var muiTheme = deepmerge({
|
879
|
+
breakpoints,
|
880
|
+
direction: "ltr",
|
881
|
+
mixins: createMixins(breakpoints, spacing, mixinsInput),
|
882
|
+
overrides: {},
|
883
|
+
palette,
|
884
|
+
props: {},
|
885
|
+
shadows: shadows$1,
|
886
|
+
typography: createTypography(palette, typographyInput),
|
887
|
+
spacing,
|
888
|
+
shape: shape$1,
|
889
|
+
transitions,
|
890
|
+
zIndex: zIndex$1
|
891
|
+
}, other);
|
892
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
893
|
+
args[_key - 1] = arguments[_key];
|
894
|
+
}
|
895
|
+
muiTheme = args.reduce(function(acc, argument) {
|
896
|
+
return deepmerge(acc, argument);
|
897
|
+
}, muiTheme);
|
898
|
+
return muiTheme;
|
899
|
+
}
|
900
|
+
var defaultTheme = createTheme();
|
901
|
+
var defaultTheme$1 = defaultTheme;
|
902
|
+
function withStyles(stylesOrCreator, options) {
|
903
|
+
return withStyles$1(stylesOrCreator, _extends({
|
904
|
+
defaultTheme: defaultTheme$1
|
905
|
+
}, options));
|
906
|
+
}
|
907
|
+
var styles = function styles2(theme) {
|
908
|
+
return {
|
909
|
+
root: {
|
910
|
+
userSelect: "none",
|
911
|
+
width: "1em",
|
912
|
+
height: "1em",
|
913
|
+
display: "inline-block",
|
914
|
+
fill: "currentColor",
|
915
|
+
flexShrink: 0,
|
916
|
+
fontSize: theme.typography.pxToRem(24),
|
917
|
+
transition: theme.transitions.create("fill", {
|
918
|
+
duration: theme.transitions.duration.shorter
|
919
|
+
})
|
920
|
+
},
|
921
|
+
colorPrimary: {
|
922
|
+
color: theme.palette.primary.main
|
923
|
+
},
|
924
|
+
colorSecondary: {
|
925
|
+
color: theme.palette.secondary.main
|
926
|
+
},
|
927
|
+
colorAction: {
|
928
|
+
color: theme.palette.action.active
|
929
|
+
},
|
930
|
+
colorError: {
|
931
|
+
color: theme.palette.error.main
|
932
|
+
},
|
933
|
+
colorDisabled: {
|
934
|
+
color: theme.palette.action.disabled
|
935
|
+
},
|
936
|
+
fontSizeInherit: {
|
937
|
+
fontSize: "inherit"
|
938
|
+
},
|
939
|
+
fontSizeSmall: {
|
940
|
+
fontSize: theme.typography.pxToRem(20)
|
941
|
+
},
|
942
|
+
fontSizeLarge: {
|
943
|
+
fontSize: theme.typography.pxToRem(35)
|
944
|
+
}
|
945
|
+
};
|
946
|
+
};
|
947
|
+
var SvgIcon = /* @__PURE__ */ React$2.forwardRef(function SvgIcon2(props, ref) {
|
948
|
+
var children = props.children, classes = props.classes, className = props.className, _props$color = props.color, color = _props$color === void 0 ? "inherit" : _props$color, _props$component = props.component, Component = _props$component === void 0 ? "svg" : _props$component, _props$fontSize = props.fontSize, fontSize = _props$fontSize === void 0 ? "medium" : _props$fontSize, htmlColor = props.htmlColor, titleAccess = props.titleAccess, _props$viewBox = props.viewBox, viewBox = _props$viewBox === void 0 ? "0 0 24 24" : _props$viewBox, other = _objectWithoutProperties(props, ["children", "classes", "className", "color", "component", "fontSize", "htmlColor", "titleAccess", "viewBox"]);
|
949
|
+
return /* @__PURE__ */ React$2.createElement(Component, _extends({
|
950
|
+
className: clsx(classes.root, className, color !== "inherit" && classes["color".concat(capitalize(color))], fontSize !== "default" && fontSize !== "medium" && classes["fontSize".concat(capitalize(fontSize))]),
|
951
|
+
focusable: "false",
|
952
|
+
viewBox,
|
953
|
+
color: htmlColor,
|
954
|
+
"aria-hidden": titleAccess ? void 0 : true,
|
955
|
+
role: titleAccess ? "img" : void 0,
|
956
|
+
ref
|
957
|
+
}, other), children, titleAccess ? /* @__PURE__ */ React$2.createElement("title", null, titleAccess) : null);
|
958
|
+
});
|
959
|
+
SvgIcon.muiName = "SvgIcon";
|
960
|
+
var SvgIcon$1 = withStyles(styles, {
|
961
|
+
name: "MuiSvgIcon"
|
962
|
+
})(SvgIcon);
|
963
|
+
function createSvgIcon(path, displayName) {
|
964
|
+
var Component = function Component2(props, ref) {
|
965
|
+
return /* @__PURE__ */ React__default.createElement(SvgIcon$1, _extends({
|
966
|
+
ref
|
967
|
+
}, props), path);
|
968
|
+
};
|
969
|
+
Component.muiName = SvgIcon$1.muiName;
|
970
|
+
return /* @__PURE__ */ React__default.memo(/* @__PURE__ */ React__default.forwardRef(Component));
|
971
|
+
}
|
972
|
+
function debounce(func) {
|
973
|
+
var wait = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 166;
|
974
|
+
var timeout;
|
975
|
+
function debounced() {
|
976
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
977
|
+
args[_key] = arguments[_key];
|
978
|
+
}
|
979
|
+
var that = this;
|
980
|
+
var later = function later2() {
|
981
|
+
func.apply(that, args);
|
982
|
+
};
|
983
|
+
clearTimeout(timeout);
|
984
|
+
timeout = setTimeout(later, wait);
|
985
|
+
}
|
986
|
+
debounced.clear = function() {
|
987
|
+
clearTimeout(timeout);
|
988
|
+
};
|
989
|
+
return debounced;
|
990
|
+
}
|
991
|
+
function deprecatedPropType(validator, reason) {
|
992
|
+
{
|
993
|
+
return function() {
|
994
|
+
return null;
|
995
|
+
};
|
996
|
+
}
|
997
|
+
}
|
998
|
+
function isMuiElement(element, muiNames) {
|
999
|
+
return /* @__PURE__ */ React$2.isValidElement(element) && muiNames.indexOf(element.type.muiName) !== -1;
|
1000
|
+
}
|
1001
|
+
function ownerDocument(node) {
|
1002
|
+
return node && node.ownerDocument || document;
|
1003
|
+
}
|
1004
|
+
function ownerWindow(node) {
|
1005
|
+
var doc = ownerDocument(node);
|
1006
|
+
return doc.defaultView || window;
|
1007
|
+
}
|
1008
|
+
function requirePropFactory(componentNameInError) {
|
1009
|
+
{
|
1010
|
+
return function() {
|
1011
|
+
return null;
|
1012
|
+
};
|
1013
|
+
}
|
1014
|
+
}
|
1015
|
+
function setRef(ref, value) {
|
1016
|
+
if (typeof ref === "function") {
|
1017
|
+
ref(value);
|
1018
|
+
} else if (ref) {
|
1019
|
+
ref.current = value;
|
1020
|
+
}
|
1021
|
+
}
|
1022
|
+
function unsupportedProp(props, propName, componentName, location, propFullName) {
|
1023
|
+
{
|
1024
|
+
return null;
|
1025
|
+
}
|
1026
|
+
}
|
1027
|
+
function useControlled(_ref) {
|
1028
|
+
var controlled = _ref.controlled, defaultProp = _ref.default;
|
1029
|
+
_ref.name;
|
1030
|
+
_ref.state;
|
1031
|
+
var _React$useRef = React$2.useRef(controlled !== void 0), isControlled = _React$useRef.current;
|
1032
|
+
var _React$useState = React$2.useState(defaultProp), valueState = _React$useState[0], setValue = _React$useState[1];
|
1033
|
+
var value = isControlled ? controlled : valueState;
|
1034
|
+
var setValueIfUncontrolled = React$2.useCallback(function(newValue) {
|
1035
|
+
if (!isControlled) {
|
1036
|
+
setValue(newValue);
|
1037
|
+
}
|
1038
|
+
}, []);
|
1039
|
+
return [value, setValueIfUncontrolled];
|
1040
|
+
}
|
1041
|
+
var useEnhancedEffect = typeof window !== "undefined" ? React$2.useLayoutEffect : React$2.useEffect;
|
1042
|
+
function useEventCallback(fn) {
|
1043
|
+
var ref = React$2.useRef(fn);
|
1044
|
+
useEnhancedEffect(function() {
|
1045
|
+
ref.current = fn;
|
1046
|
+
});
|
1047
|
+
return React$2.useCallback(function() {
|
1048
|
+
return ref.current.apply(void 0, arguments);
|
1049
|
+
}, []);
|
1050
|
+
}
|
1051
|
+
function useForkRef(refA, refB) {
|
1052
|
+
return React$2.useMemo(function() {
|
1053
|
+
if (refA == null && refB == null) {
|
1054
|
+
return null;
|
1055
|
+
}
|
1056
|
+
return function(refValue) {
|
1057
|
+
setRef(refA, refValue);
|
1058
|
+
setRef(refB, refValue);
|
1059
|
+
};
|
1060
|
+
}, [refA, refB]);
|
1061
|
+
}
|
1062
|
+
function useId(idOverride) {
|
1063
|
+
var _React$useState = React$2.useState(idOverride), defaultId = _React$useState[0], setDefaultId = _React$useState[1];
|
1064
|
+
var id = idOverride || defaultId;
|
1065
|
+
React$2.useEffect(function() {
|
1066
|
+
if (defaultId == null) {
|
1067
|
+
setDefaultId("mui-".concat(Math.round(Math.random() * 1e5)));
|
1068
|
+
}
|
1069
|
+
}, [defaultId]);
|
1070
|
+
return id;
|
1071
|
+
}
|
1072
|
+
var hadKeyboardEvent = true;
|
1073
|
+
var hadFocusVisibleRecently = false;
|
1074
|
+
var hadFocusVisibleRecentlyTimeout = null;
|
1075
|
+
var inputTypesWhitelist = {
|
1076
|
+
text: true,
|
1077
|
+
search: true,
|
1078
|
+
url: true,
|
1079
|
+
tel: true,
|
1080
|
+
email: true,
|
1081
|
+
password: true,
|
1082
|
+
number: true,
|
1083
|
+
date: true,
|
1084
|
+
month: true,
|
1085
|
+
week: true,
|
1086
|
+
time: true,
|
1087
|
+
datetime: true,
|
1088
|
+
"datetime-local": true
|
1089
|
+
};
|
1090
|
+
function focusTriggersKeyboardModality(node) {
|
1091
|
+
var type = node.type, tagName = node.tagName;
|
1092
|
+
if (tagName === "INPUT" && inputTypesWhitelist[type] && !node.readOnly) {
|
1093
|
+
return true;
|
1094
|
+
}
|
1095
|
+
if (tagName === "TEXTAREA" && !node.readOnly) {
|
1096
|
+
return true;
|
1097
|
+
}
|
1098
|
+
if (node.isContentEditable) {
|
1099
|
+
return true;
|
1100
|
+
}
|
1101
|
+
return false;
|
1102
|
+
}
|
1103
|
+
function handleKeyDown(event) {
|
1104
|
+
if (event.metaKey || event.altKey || event.ctrlKey) {
|
1105
|
+
return;
|
1106
|
+
}
|
1107
|
+
hadKeyboardEvent = true;
|
1108
|
+
}
|
1109
|
+
function handlePointerDown() {
|
1110
|
+
hadKeyboardEvent = false;
|
1111
|
+
}
|
1112
|
+
function handleVisibilityChange() {
|
1113
|
+
if (this.visibilityState === "hidden") {
|
1114
|
+
if (hadFocusVisibleRecently) {
|
1115
|
+
hadKeyboardEvent = true;
|
1116
|
+
}
|
1117
|
+
}
|
1118
|
+
}
|
1119
|
+
function prepare(doc) {
|
1120
|
+
doc.addEventListener("keydown", handleKeyDown, true);
|
1121
|
+
doc.addEventListener("mousedown", handlePointerDown, true);
|
1122
|
+
doc.addEventListener("pointerdown", handlePointerDown, true);
|
1123
|
+
doc.addEventListener("touchstart", handlePointerDown, true);
|
1124
|
+
doc.addEventListener("visibilitychange", handleVisibilityChange, true);
|
1125
|
+
}
|
1126
|
+
function isFocusVisible(event) {
|
1127
|
+
var target = event.target;
|
1128
|
+
try {
|
1129
|
+
return target.matches(":focus-visible");
|
1130
|
+
} catch (error) {
|
1131
|
+
}
|
1132
|
+
return hadKeyboardEvent || focusTriggersKeyboardModality(target);
|
1133
|
+
}
|
1134
|
+
function handleBlurVisible() {
|
1135
|
+
hadFocusVisibleRecently = true;
|
1136
|
+
window.clearTimeout(hadFocusVisibleRecentlyTimeout);
|
1137
|
+
hadFocusVisibleRecentlyTimeout = window.setTimeout(function() {
|
1138
|
+
hadFocusVisibleRecently = false;
|
1139
|
+
}, 100);
|
1140
|
+
}
|
1141
|
+
function useIsFocusVisible() {
|
1142
|
+
var ref = React$2.useCallback(function(instance) {
|
1143
|
+
var node = ReactDOM.findDOMNode(instance);
|
1144
|
+
if (node != null) {
|
1145
|
+
prepare(node.ownerDocument);
|
1146
|
+
}
|
1147
|
+
}, []);
|
1148
|
+
return {
|
1149
|
+
isFocusVisible,
|
1150
|
+
onBlurVisible: handleBlurVisible,
|
1151
|
+
ref
|
1152
|
+
};
|
1153
|
+
}
|
1154
|
+
var utils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
1155
|
+
__proto__: null,
|
1156
|
+
capitalize,
|
1157
|
+
createChainedFunction,
|
1158
|
+
createSvgIcon,
|
1159
|
+
debounce,
|
1160
|
+
deprecatedPropType,
|
1161
|
+
isMuiElement,
|
1162
|
+
ownerDocument,
|
1163
|
+
ownerWindow,
|
1164
|
+
requirePropFactory,
|
1165
|
+
setRef,
|
1166
|
+
unsupportedProp,
|
1167
|
+
useControlled,
|
1168
|
+
useEventCallback,
|
1169
|
+
useForkRef,
|
1170
|
+
unstable_useId: useId,
|
1171
|
+
useIsFocusVisible
|
1172
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
1173
|
+
var require$$0 = /* @__PURE__ */ getAugmentedNamespace(utils);
|
1174
|
+
(function(exports) {
|
1175
|
+
Object.defineProperty(exports, "__esModule", {
|
1176
|
+
value: true
|
1177
|
+
});
|
1178
|
+
Object.defineProperty(exports, "default", {
|
1179
|
+
enumerable: true,
|
1180
|
+
get: function get() {
|
1181
|
+
return _utils.createSvgIcon;
|
1182
|
+
}
|
1183
|
+
});
|
1184
|
+
var _utils = require$$0;
|
1185
|
+
})(createSvgIcon$1);
|
1186
|
+
var _interopRequireDefault = interopRequireDefault.exports;
|
1187
|
+
var _interopRequireWildcard = interopRequireWildcard.exports;
|
1188
|
+
Object.defineProperty(DeleteOutline, "__esModule", {
|
1189
|
+
value: true
|
1190
|
+
});
|
1191
|
+
var default_1 = DeleteOutline.default = void 0;
|
1192
|
+
var React$1 = _interopRequireWildcard(React__default);
|
1193
|
+
var _createSvgIcon = _interopRequireDefault(createSvgIcon$1);
|
1194
|
+
var _default = (0, _createSvgIcon.default)(/* @__PURE__ */ React$1.createElement("path", {
|
1195
|
+
d: "M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM8 9h8v10H8V9zm7.5-5l-1-1h-5l-1 1H5v2h14V4z"
|
1196
|
+
}), "DeleteOutline");
|
1197
|
+
default_1 = DeleteOutline.default = _default;
|
1198
|
+
const useStyles = makeStyles(({ palette, spacing, typography }) => ({
|
1199
|
+
inputFile: {
|
1200
|
+
display: "flex",
|
1201
|
+
flexDirection: "row",
|
1202
|
+
alignItems: "center",
|
1203
|
+
justifyContent: "space-between",
|
1204
|
+
flex: 1,
|
1205
|
+
height: spacing(7),
|
1206
|
+
minHeight: spacing(7),
|
1207
|
+
padding: spacing(0, 1, 0, 2),
|
1208
|
+
backgroundColor: ({ variant }) => variant === "filled" ? palette.action.hover : palette.common.white,
|
1209
|
+
border: "2px solid",
|
1210
|
+
borderColor: ({ variant }) => variant === "filled" ? "transparent" : palette.action.disabled,
|
1211
|
+
borderRadius: spacing(0.5),
|
1212
|
+
color: palette.text.secondary,
|
1213
|
+
transition: "border-color 0.25s ease, background-color 0.25s ease",
|
1214
|
+
"&:hover": {
|
1215
|
+
backgroundColor: ({ variant }) => variant === "filled" ? palette.action.selected : palette.common.white,
|
1216
|
+
borderColor: ({ variant }) => variant === "filled" ? "transparent" : palette.text.primary
|
1217
|
+
}
|
1218
|
+
},
|
1219
|
+
over: {
|
1220
|
+
borderColor: () => palette.primary.main
|
1221
|
+
},
|
1222
|
+
files: {
|
1223
|
+
borderColor: ({ variant }) => variant === "filled" ? "transparent" : palette.action.disabled
|
1224
|
+
},
|
1225
|
+
textWrapper: {
|
1226
|
+
display: "flex",
|
1227
|
+
flexDirection: "column",
|
1228
|
+
position: "relative",
|
1229
|
+
maxWidth: "calc(100% - 110px)",
|
1230
|
+
height: "100%",
|
1231
|
+
color: "inherit"
|
1232
|
+
},
|
1233
|
+
placeholder: {
|
1234
|
+
position: "absolute",
|
1235
|
+
top: "50%",
|
1236
|
+
transform: "translateY(-50%)",
|
1237
|
+
transition: "all 0.2s ease-in-out"
|
1238
|
+
},
|
1239
|
+
placeholderFiles: __spreadValues({
|
1240
|
+
top: spacing(1),
|
1241
|
+
transform: "translateY(0)",
|
1242
|
+
opacity: 1
|
1243
|
+
}, typography.caption),
|
1244
|
+
filesText: {
|
1245
|
+
position: "absolute",
|
1246
|
+
top: spacing(4),
|
1247
|
+
opacity: 0,
|
1248
|
+
transition: "all 0.2s ease-in-out"
|
1249
|
+
},
|
1250
|
+
filesTextFiles: {
|
1251
|
+
top: spacing(3),
|
1252
|
+
opacity: 1
|
1253
|
+
},
|
1254
|
+
helperText: {
|
1255
|
+
fontWeight: typography.body1.fontWeight
|
1256
|
+
},
|
1257
|
+
clearButton: {
|
1258
|
+
marginTop: spacing(2),
|
1259
|
+
marginRight: spacing(0.5),
|
1260
|
+
color: palette.error.main
|
1261
|
+
},
|
1262
|
+
disabled: {
|
1263
|
+
"& $inputFile": {
|
1264
|
+
color: palette.text.disabled,
|
1265
|
+
borderColor: () => palette.text.disabled,
|
1266
|
+
backgroundColor: () => palette.action.hover,
|
1267
|
+
pointerEvents: "none"
|
1268
|
+
},
|
1269
|
+
"& $helperText": {
|
1270
|
+
color: palette.action.disabled
|
1271
|
+
}
|
1272
|
+
},
|
1273
|
+
error: {
|
1274
|
+
"& $inputFile": {
|
1275
|
+
borderColor: () => palette.error.main
|
1276
|
+
},
|
1277
|
+
"& $files": {
|
1278
|
+
color: palette.error.main
|
1279
|
+
},
|
1280
|
+
"& $helperText": {
|
1281
|
+
color: palette.error.main
|
1282
|
+
}
|
1283
|
+
}
|
1284
|
+
}));
|
1285
|
+
function InputFile({
|
1286
|
+
placeholder = "Upload file",
|
1287
|
+
buttonText = "Browse",
|
1288
|
+
multipleSummaryText = "files selected",
|
1289
|
+
helperText,
|
1290
|
+
accept = "application/JSON",
|
1291
|
+
multiple = false,
|
1292
|
+
disabled = false,
|
1293
|
+
error = false,
|
1294
|
+
variant = "outlined",
|
1295
|
+
files = [],
|
1296
|
+
onChange
|
1297
|
+
}) {
|
1298
|
+
const classes = useStyles({ variant });
|
1299
|
+
const uploadInputRef = useRef(null);
|
1300
|
+
const [filesText, setFilesText] = useState("");
|
1301
|
+
const [over, setOver] = useState(false);
|
1302
|
+
useEffect(() => {
|
1303
|
+
let txt = "";
|
1304
|
+
if (files.length === 1) {
|
1305
|
+
txt = files[0].name;
|
1306
|
+
} else if (files.length > 1) {
|
1307
|
+
txt = `${files.length} ${multipleSummaryText}`;
|
1308
|
+
}
|
1309
|
+
setFilesText(txt);
|
1310
|
+
}, [files, multipleSummaryText]);
|
1311
|
+
const handleBrowse = () => {
|
1312
|
+
var _a;
|
1313
|
+
(_a = uploadInputRef.current) == null ? void 0 : _a.click();
|
1314
|
+
};
|
1315
|
+
const handleDragOver = (event) => {
|
1316
|
+
event.preventDefault();
|
1317
|
+
setOver(true);
|
1318
|
+
};
|
1319
|
+
const handleDragLeave = (event) => {
|
1320
|
+
event.preventDefault();
|
1321
|
+
setOver(false);
|
1322
|
+
};
|
1323
|
+
const handleDrop = (event) => {
|
1324
|
+
event.preventDefault();
|
1325
|
+
const newFiles = [];
|
1326
|
+
const items = event.dataTransfer.items;
|
1327
|
+
for (let i = 0; i < items.length; i++) {
|
1328
|
+
const file = items[i].getAsFile();
|
1329
|
+
newFiles.push(file);
|
1330
|
+
}
|
1331
|
+
setOver(false);
|
1332
|
+
onChange(newFiles);
|
1333
|
+
};
|
1334
|
+
const handleFiles = (event) => {
|
1335
|
+
const newFiles = Array.from(event.target.files);
|
1336
|
+
onChange(newFiles);
|
1337
|
+
};
|
1338
|
+
const clear = () => {
|
1339
|
+
onChange([]);
|
1340
|
+
};
|
1341
|
+
return /* @__PURE__ */ React.createElement(Box, {
|
1342
|
+
className: clsx({ [classes.error]: error }, { [classes.disabled]: disabled })
|
1343
|
+
}, /* @__PURE__ */ React.createElement(Box, {
|
1344
|
+
className: clsx(classes.inputFile, { [classes.over]: over }, { [classes.files]: filesText }),
|
1345
|
+
onDragOver: handleDragOver,
|
1346
|
+
onDragLeave: handleDragLeave,
|
1347
|
+
onDrop: handleDrop
|
1348
|
+
}, /* @__PURE__ */ React.createElement(Box, {
|
1349
|
+
className: classes.textWrapper
|
1350
|
+
}, /* @__PURE__ */ React.createElement(Typography, {
|
1351
|
+
variant: "body1",
|
1352
|
+
color: "inherit",
|
1353
|
+
noWrap: true,
|
1354
|
+
className: clsx(classes.placeholder, {
|
1355
|
+
[classes.placeholderFiles]: filesText
|
1356
|
+
})
|
1357
|
+
}, placeholder), /* @__PURE__ */ React.createElement(Typography, {
|
1358
|
+
variant: "body1",
|
1359
|
+
color: "textPrimary",
|
1360
|
+
noWrap: true,
|
1361
|
+
className: clsx(classes.filesText, {
|
1362
|
+
[classes.filesTextFiles]: filesText
|
1363
|
+
})
|
1364
|
+
}, filesText)), files.length ? /* @__PURE__ */ React.createElement(IconButton, {
|
1365
|
+
size: "small",
|
1366
|
+
className: classes.clearButton,
|
1367
|
+
onClick: clear
|
1368
|
+
}, /* @__PURE__ */ React.createElement(default_1, null)) : /* @__PURE__ */ React.createElement(Button, {
|
1369
|
+
variant: "text",
|
1370
|
+
color: "primary",
|
1371
|
+
disabled,
|
1372
|
+
onClick: handleBrowse
|
1373
|
+
}, buttonText), /* @__PURE__ */ React.createElement("input", {
|
1374
|
+
ref: uploadInputRef,
|
1375
|
+
style: { display: "none" },
|
1376
|
+
type: "file",
|
1377
|
+
accept,
|
1378
|
+
multiple,
|
1379
|
+
disabled,
|
1380
|
+
onChange: handleFiles
|
1381
|
+
})), helperText && /* @__PURE__ */ React.createElement(Box, {
|
1382
|
+
mt: 0.5,
|
1383
|
+
ml: 2
|
1384
|
+
}, /* @__PURE__ */ React.createElement(Typography, {
|
1385
|
+
variant: "caption",
|
1386
|
+
color: "textSecondary",
|
1387
|
+
className: classes.helperText
|
1388
|
+
}, helperText)));
|
1389
|
+
}
|
1390
|
+
export { InputFile };
|