@popmenu/common-ui 0.7.6 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/index.es.js CHANGED
@@ -1,7 +1,7 @@
1
1
  export { default as Alert } from '@material-ui/lab/Alert';
2
2
  export { default as AppBar } from '@material-ui/core/AppBar';
3
3
  import * as React from 'react';
4
- import React__default, { forwardRef } from 'react';
4
+ import React__default, { forwardRef, createElement, useRef, useEffect, Fragment, useState } from 'react';
5
5
  import MuiAvatar from '@material-ui/core/Avatar';
6
6
  import { makeStyles, useTheme } from '@material-ui/core/styles';
7
7
  export { default as Badge } from '@material-ui/core/Badge';
@@ -21,6 +21,9 @@ import MuiCheckbox from '@material-ui/core/Checkbox';
21
21
  import FormControlLabel from '@material-ui/core/FormControlLabel';
22
22
  export { default as FormControlLabel } from '@material-ui/core/FormControlLabel';
23
23
  export { default as Chip } from '@material-ui/core/Chip';
24
+ import Collapse from '@material-ui/core/Collapse';
25
+ import { makeStyles as makeStyles$1, useTheme as useTheme$1 } from '@material-ui/core';
26
+ import MuiTypography from '@material-ui/core/Typography';
24
27
  export { default as Dialog } from '@material-ui/core/Dialog';
25
28
  export { default as DialogActions } from '@material-ui/core/DialogActions';
26
29
  export { default as DialogContent } from '@material-ui/core/DialogContent';
@@ -28,83 +31,6 @@ export { default as DialogTitle } from '@material-ui/core/DialogTitle';
28
31
  export { default as Drawer } from '@material-ui/core/Drawer';
29
32
  export { default as FormControl } from '@material-ui/core/FormControl';
30
33
  export { default as Grid } from '@material-ui/core/Grid';
31
- import makeStyles$1 from '@material-ui/core/styles/makeStyles';
32
- import AttachFileRoundedIcon from '@material-ui/icons/AttachFileRounded';
33
- import BlockIcon from '@material-ui/icons/Block';
34
- import ReplyIcon from '@material-ui/icons/Reply';
35
- import AccessTimeRoundedIcon from '@material-ui/icons/AccessTimeRounded';
36
- import AssessmentRoundedIcon from '@material-ui/icons/AssessmentRounded';
37
- import MailRoundedIcon from '@material-ui/icons/MailRounded';
38
- import ChatRoundedIcon from '@material-ui/icons/ChatRounded';
39
- import RestaurantMenuRoundedIcon from '@material-ui/icons/RestaurantMenuRounded';
40
- import ShoppingCartRoundedIcon from '@material-ui/icons/ShoppingCartRounded';
41
- import DesktopMacRoundedIcon from '@material-ui/icons/DesktopMacRounded';
42
- import LanguageRoundedIcon from '@material-ui/icons/LanguageRounded';
43
- import SettingsRoundedIcon from '@material-ui/icons/SettingsRounded';
44
- import LockRoundedIcon from '@material-ui/icons/LockRounded';
45
- import LockOpenRoundedIcon from '@material-ui/icons/LockOpenRounded';
46
- import PublicRoundedIcon from '@material-ui/icons/PublicRounded';
47
- import CommentRoundedIcon from '@material-ui/icons/CommentRounded';
48
- import CodeRoundedIcon from '@material-ui/icons/CodeRounded';
49
- import KeyboardArrowDownRoundedIcon from '@material-ui/icons/KeyboardArrowDownRounded';
50
- import KeyboardArrowUpRoundedIcon from '@material-ui/icons/KeyboardArrowUpRounded';
51
- import KeyboardArrowRightRoundedIcon from '@material-ui/icons/KeyboardArrowRightRounded';
52
- import KeyboardArrowLeftRoundedIcon from '@material-ui/icons/KeyboardArrowLeftRounded';
53
- import HelpRoundedIcon from '@material-ui/icons/HelpRounded';
54
- import CloseRoundedIcon from '@material-ui/icons/CloseRounded';
55
- import CancelRoundedIcon from '@material-ui/icons/CancelRounded';
56
- import CalendarTodayRoundedIcon from '@material-ui/icons/CalendarTodayRounded';
57
- import SaveRoundedIcon from '@material-ui/icons/SaveRounded';
58
- import SendRoundedIcon from '@material-ui/icons/SendRounded';
59
- import ArrowBackRoundedIcon from '@material-ui/icons/ArrowBackRounded';
60
- import ArrowDownwardRoundedIcon from '@material-ui/icons/ArrowDownwardRounded';
61
- import ArrowForwardRoundedIcon from '@material-ui/icons/ArrowForwardRounded';
62
- import ArrowUpwardRoundedIcon from '@material-ui/icons/ArrowUpwardRounded';
63
- import EditRoundedIcon from '@material-ui/icons/EditRounded';
64
- import DeleteRoundedIcon from '@material-ui/icons/DeleteRounded';
65
- import VisibilityRoundedIcon from '@material-ui/icons/VisibilityRounded';
66
- import VisibilityOffRoundedIcon from '@material-ui/icons/VisibilityOffRounded';
67
- import CompareArrowsRoundedIcon from '@material-ui/icons/CompareArrowsRounded';
68
- import AddAPhotoRoundedIcon from '@material-ui/icons/AddAPhotoRounded';
69
- import SearchRoundedIcon from '@material-ui/icons/SearchRounded';
70
- import AddCircleOutlineRoundedIcon from '@material-ui/icons/AddCircleOutlineRounded';
71
- import AddCircleRoundedIcon from '@material-ui/icons/AddCircleRounded';
72
- import RemoveCircleOutlineRoundedIcon from '@material-ui/icons/RemoveCircleOutlineRounded';
73
- import RemoveCircleRoundedIcon from '@material-ui/icons/RemoveCircleRounded';
74
- import DragIndicatorRoundedIcon from '@material-ui/icons/DragIndicatorRounded';
75
- import LocalMallOutlinedIcon from '@material-ui/icons/LocalMallOutlined';
76
- import LocalShippingOutlinedIcon from '@material-ui/icons/LocalShippingOutlined';
77
- import RoomOutlinedIcon from '@material-ui/icons/RoomOutlined';
78
- import PrintRoundedIcon from '@material-ui/icons/PrintRounded';
79
- import CloudDownloadRoundedIcon from '@material-ui/icons/CloudDownloadRounded';
80
- import FacebookIcon from '@material-ui/icons/Facebook';
81
- import TwitterIcon from '@material-ui/icons/Twitter';
82
- import NotificationsRoundedIcon from '@material-ui/icons/NotificationsRounded';
83
- import CheckCircleRoundedIcon from '@material-ui/icons/CheckCircleRounded';
84
- import RefreshRoundedIcon from '@material-ui/icons/RefreshRounded';
85
- import OpenInNewRoundedIcon from '@material-ui/icons/OpenInNewRounded';
86
- import CloudUploadRoundedIcon from '@material-ui/icons/CloudUploadRounded';
87
- import VoicemailRoundedIcon from '@material-ui/icons/VoicemailRounded';
88
- import AccountCircleOutlined from '@material-ui/icons/AccountCircleOutlined';
89
- import CardGiftcardOutlined from '@material-ui/icons/CardGiftcardOutlined';
90
- import CreditCardRounded from '@material-ui/icons/CreditCardRounded';
91
- import LoyaltyOutlined from '@material-ui/icons/LoyaltyOutlined';
92
- import StarBorderRounded from '@material-ui/icons/StarBorderRounded';
93
- import StarRounded from '@material-ui/icons/StarRounded';
94
- import ShuffleRounded from '@material-ui/icons/ShuffleRounded';
95
- import PhoneRounded from '@material-ui/icons/PhoneRounded';
96
- import PlayCircleFilledRounded from '@material-ui/icons/PlayCircleFilledRounded';
97
- import AccessAlarmRounded from '@material-ui/icons/AccessAlarmRounded';
98
- import FilterListRounded from '@material-ui/icons/FilterListRounded';
99
- import HistoryRounded from '@material-ui/icons/HistoryRounded';
100
- import HomeRounded from '@material-ui/icons/HomeRounded';
101
- import ListRounded from '@material-ui/icons/ListRounded';
102
- import MergeTypeRounded from '@material-ui/icons/MergeTypeRounded';
103
- import PhoneAndroidRounded from '@material-ui/icons/PhoneAndroidRounded';
104
- import PhotoCameraRounded from '@material-ui/icons/PhotoCameraRounded';
105
- import ReplayRounded from '@material-ui/icons/ReplayRounded';
106
- import TodayRounded from '@material-ui/icons/TodayRounded';
107
- import { FlagRounded } from '@material-ui/icons';
108
34
  import MuiIconButton from '@material-ui/core/IconButton';
109
35
  export { default as InputAdornment } from '@material-ui/core/InputAdornment';
110
36
  export { default as LinearProgress } from '@material-ui/core/LinearProgress';
@@ -127,7 +53,6 @@ export { default as Tabs } from '@material-ui/core/Tabs';
127
53
  import MuiToggleButton from '@material-ui/lab/ToggleButton';
128
54
  import MuiToggleButtonGroup from '@material-ui/lab/ToggleButtonGroup';
129
55
  import MuiTooltip from '@material-ui/core/Tooltip';
130
- import MuiTypography from '@material-ui/core/Typography';
131
56
 
132
57
  /*! *****************************************************************************
133
58
  Copyright (c) Microsoft Corporation.
@@ -237,46 +162,46 @@ var useAvatarStyles = makeStyles(function (theme) { return ({
237
162
  },
238
163
  }); });
239
164
 
240
- var _path$a;
165
+ var _path$2;
241
166
 
242
- function _extends$b() { _extends$b = 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$b.apply(this, arguments); }
167
+ function _extends$2() { _extends$2 = 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$2.apply(this, arguments); }
243
168
 
244
169
  function SvgSilhouetteFemale(props) {
245
- return /*#__PURE__*/React.createElement("svg", _extends$b({
170
+ return /*#__PURE__*/React.createElement("svg", _extends$2({
246
171
  viewBox: "0 0 300 300",
247
172
  fill: "none",
248
173
  xmlns: "http://www.w3.org/2000/svg"
249
- }, props), _path$a || (_path$a = /*#__PURE__*/React.createElement("path", {
174
+ }, props), _path$2 || (_path$2 = /*#__PURE__*/React.createElement("path", {
250
175
  d: "M179.417 182.917a3.362 3.362 0 00-2.951 1.076 3.461 3.461 0 00-.875 3.021c1.916 10.069 8.368 23.889 28.173 32.493 2.347 1.014 5.972 1.805 10.57 2.799 17.208 3.722 45.986 9.958 53.055 36.333a3.488 3.488 0 001.622 2.11 3.491 3.491 0 002.639.345 3.488 3.488 0 002.109-1.622 3.473 3.473 0 00.345-2.639c-8.173-30.465-40.777-37.527-58.298-41.319-4.056-.882-7.563-1.639-9.278-2.389-11.903-5.167-19.59-12.833-22.924-22.819 33.07 2.458 48.042-10.716 48.702-11.313a3.469 3.469 0 001.121-2.951 3.478 3.478 0 00-1.732-2.639c-19.084-10.903-19.084-48.577-19.084-62.764 0-39.674-26.722-71.125-60.979-71.618-.326-.011-.652-.018-.979-.021h-.007c-34.757.194-63.035 31.68-63.035 70.194 0 14.188 0 51.868-19.083 62.764a3.5 3.5 0 00-1.73 2.769 3.494 3.494 0 001.313 2.988c.959.743 22.14 16.952 48.202 12.028-3.486 9.569-11.07 16.931-22.625 21.951-1.674.73-5.007 1.528-8.868 2.445-17.64 4.194-50.48 12.007-58.702 42.687a3.481 3.481 0 00.348 2.638 3.475 3.475 0 006.368-.839c7.145-26.694 36.229-33.604 53.597-37.743 4.354-1.035 7.791-1.854 10.028-2.82 19.805-8.604 26.25-22.423 28.173-32.493a3.45 3.45 0 00-1.104-3.243 3.457 3.457 0 00-3.347-.722c-18.799 5.917-36.167-2.222-43.757-6.736 18.132-15.181 18.132-50.118 18.132-65.674 0-34.7 25.18-63.076 56.389-63.263l.736.041c30.778.438 53.986 28.236 53.986 64.667 0 15.562 0 50.576 18.208 65.757-6.271 3.583-20.569 9.382-44.458 6.521z",
251
176
  fill: "#2E3042"
252
177
  })));
253
178
  }
254
179
 
255
- var _path$9;
180
+ var _path$1;
256
181
 
257
- function _extends$a() { _extends$a = 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$a.apply(this, arguments); }
182
+ function _extends$1() { _extends$1 = 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$1.apply(this, arguments); }
258
183
 
259
184
  function SvgSilhouetteMale(props) {
260
- return /*#__PURE__*/React.createElement("svg", _extends$a({
185
+ return /*#__PURE__*/React.createElement("svg", _extends$1({
261
186
  viewBox: "0 0 300 300",
262
187
  fill: "none",
263
188
  xmlns: "http://www.w3.org/2000/svg"
264
- }, props), _path$9 || (_path$9 = /*#__PURE__*/React.createElement("path", {
189
+ }, props), _path$1 || (_path$1 = /*#__PURE__*/React.createElement("path", {
265
190
  d: "M27.594 261.886a3.513 3.513 0 004.281-2.478c7.204-26.904 36.484-33.877 53.984-38.05 4.386-1.043 7.848-1.869 10.1-2.842 19.935-8.66 26.433-22.592 28.377-32.757a3.493 3.493 0 00-.133-1.81 3.492 3.492 0 00-1.021-1.501c-10.38-8.968-19.137-22.431-24.663-37.917a3.447 3.447 0 00-.72-1.197c-7.31-7.953-11.506-16.361-11.506-23.06 0-3.914 1.475-6.539 4.798-8.52a3.5 3.5 0 001.7-2.857c1.545-35.662 26.922-63.735 58.047-63.917l.749.049c31.279.434 56.495 29.11 57.397 65.275a3.487 3.487 0 001.245 2.584c2.189 1.855 3.211 4.207 3.211 7.4 0 5.607-2.987 12.503-8.401 19.406a3.633 3.633 0 00-.587 1.106c-5.596 17.754-15.64 33.429-27.545 43.02a3.517 3.517 0 00-1.245 3.381c1.945 10.159 8.442 24.083 28.377 32.757 2.357 1.022 6.015 1.821 10.653 2.822 17.325 3.752 46.318 10.046 53.431 36.628a3.503 3.503 0 002.926 2.562 3.494 3.494 0 003.922-3.019 3.52 3.52 0 00-.091-1.363c-8.219-30.713-41.065-37.833-58.705-41.655-4.092-.889-7.625-1.652-9.345-2.408-13.01-5.657-21.026-14.275-23.859-25.658 12.08-10.383 22.187-26.401 27.965-44.365 6.134-7.981 9.505-16.2 9.505-23.221 0-4.684-1.511-8.59-4.504-11.643-1.665-39.232-29.636-70.127-64.35-70.624L150.545 38c-34.085.182-62.175 30.264-64.63 68.818-4.379 3.22-6.603 7.736-6.603 13.47 0 8.282 4.68 18.188 12.87 27.275 5.659 15.563 14.43 29.235 24.873 38.805-2.819 11.426-10.842 20.072-23.88 25.735-1.685.735-5.043 1.541-8.932 2.465-17.773 4.228-50.843 12.104-59.125 43.034a3.501 3.501 0 002.476 4.284z",
266
191
  fill: "#2E3042"
267
192
  })));
268
193
  }
269
194
 
270
- var _path$8;
195
+ var _path;
271
196
 
272
- function _extends$9() { _extends$9 = 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$9.apply(this, arguments); }
197
+ function _extends() { _extends = 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.apply(this, arguments); }
273
198
 
274
199
  function SvgSilhouetteNeutral(props) {
275
- return /*#__PURE__*/React.createElement("svg", _extends$9({
200
+ return /*#__PURE__*/React.createElement("svg", _extends({
276
201
  viewBox: "0 0 300 300",
277
202
  fill: "none",
278
203
  xmlns: "http://www.w3.org/2000/svg"
279
- }, props), _path$8 || (_path$8 = /*#__PURE__*/React.createElement("path", {
204
+ }, props), _path || (_path = /*#__PURE__*/React.createElement("path", {
280
205
  fillRule: "evenodd",
281
206
  clipRule: "evenodd",
282
207
  d: "M209 121c0 32.585-26.415 59-59 59s-59-26.415-59-59 26.415-59 59-59 59 26.415 59 59zm8 0c0 37.003-29.997 67-67 67s-67-29.997-67-67 29.997-67 67-67 67 29.997 67 67zm35 137.333V284h8v-25.667c0-13.614-5.821-26.671-16.182-36.298C233.456 212.408 219.403 207 204.75 207H94.25c-14.653 0-28.706 5.408-39.068 15.035C44.821 231.662 39 244.719 39 258.333V284h8v-25.667c0-11.295 4.824-22.257 13.628-30.437C69.45 219.698 81.537 215 94.25 215h110.5c12.714 0 24.799 4.698 33.622 12.896 8.804 8.18 13.628 19.142 13.628 30.437z",
@@ -397,339 +322,199 @@ var Checkbox = forwardRef(function (props, ref) {
397
322
  });
398
323
  Checkbox.displayName = 'Checkbox';
399
324
 
400
- var getIconSize = function (theme, props) {
401
- var size = 'inherit';
402
- var sizes = {
403
- large: theme.typography.pxToRem(36),
404
- medium: theme.typography.pxToRem(24),
405
- small: theme.typography.pxToRem(20),
325
+ var useIconStyles = makeStyles$1(function (_a) {
326
+ var spacing = _a.spacing, palette = _a.palette;
327
+ var getFontSize = function (_a) {
328
+ var size = _a.size;
329
+ var sizes = {
330
+ inherit: 'inherit',
331
+ small: spacing(1.5),
332
+ medium: spacing(2),
333
+ large: spacing(2.5),
334
+ 'extra-large': spacing(3),
335
+ };
336
+ return size ? sizes[size] : 'inherit';
406
337
  };
407
- if (props.size) {
408
- size = sizes[props.size];
409
- }
410
- return size;
411
- };
412
- var getIconColor = function (theme, props) {
413
- var color = 'inherit';
414
- if (props.color) {
415
- var _a = props.color.split('.'), colorKey = _a[0], _b = _a[1], variantKey = _b === void 0 ? 'main' : _b;
416
- color = theme.palette[colorKey][variantKey];
417
- }
418
- return color;
419
- };
420
- var getFill = function (props) {
421
- var fill;
422
- var filledIcons = ['menu'];
423
- if (filledIcons.includes(props.name)) {
424
- fill = 'currentColor';
338
+ var getColor = function (props) {
339
+ var semanticColors = ['primary', 'secondary', 'info', 'success', 'warning', 'error'];
340
+ var value = 'inherit';
341
+ if (props.color) {
342
+ if (semanticColors.includes(props.color.split('.')[0])) {
343
+ var _a = props.color.split('.'), color = _a[0], _b = _a[1], variant = _b === void 0 ? 'main' : _b;
344
+ value = palette[color][variant];
345
+ }
346
+ else if (props.color.search(/^(rgb|hsla|#)/) !== -1) {
347
+ value = props.color;
348
+ }
349
+ }
350
+ return value;
351
+ };
352
+ return {
353
+ root: {
354
+ color: getColor,
355
+ fontSize: getFontSize,
356
+ strokeWidth: '1.3px',
357
+ },
358
+ };
359
+ });
360
+
361
+ var iconStaticClassName = 'pop-icon';
362
+ var Icon = function (props) {
363
+ var icon = props.icon, className = props.className, restProps = __rest(props, ["icon", "className"]);
364
+ var classes = useIconStyles(props);
365
+ var isValid = true;
366
+ if (!icon || (typeof icon === 'function' && icon({}) === undefined)) {
367
+ isValid = false;
425
368
  }
426
- return fill;
369
+ return isValid
370
+ ? createElement(icon, __assign({ className: classNames([classes.root, iconStaticClassName, className]) }, restProps))
371
+ : null;
427
372
  };
428
- var getStroke = function (props) {
429
- var stroke;
430
- var strokeIcons = ['copy'];
431
- if (strokeIcons.includes(props.name)) {
432
- stroke = 'currentColor';
433
- }
434
- return stroke;
373
+ Icon.defaultProps = {
374
+ size: 'inherit',
375
+ color: 'inherit',
435
376
  };
436
- var useIconStyles = makeStyles$1(function (theme) { return ({
437
- root: {
438
- width: '1em',
439
- height: '1em',
440
- color: function (props) { return getIconColor(theme, props); },
441
- fill: function (props) { return getFill(props); },
442
- stroke: function (props) { return getStroke(props); },
443
- fontSize: function (props) { return getIconSize(theme, props); },
444
- userSelect: 'none',
445
- },
446
- }); });
447
-
448
- var _path$7, _path2$2, _path3;
449
-
450
- function _extends$8() { _extends$8 = 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$8.apply(this, arguments); }
451
-
452
- function SvgPopmenuLogo(props) {
453
- return /*#__PURE__*/React.createElement("svg", _extends$8({
454
- viewBox: "0 0 35 35",
455
- xmlns: "http://www.w3.org/2000/svg",
456
- "aria-hidden": "true"
457
- }, props), _path$7 || (_path$7 = /*#__PURE__*/React.createElement("path", {
458
- d: "M23.061 13.613H9.363a.875.875 0 000 1.743H23.06a.873.873 0 00.875-1.223.874.874 0 00-.875-.52zM9.363 11.125H23.06a.875.875 0 100-1.744H9.363a.875.875 0 000 1.744zm13.698 6.723H9.363a.874.874 0 00-.36 1.7.875.875 0 00.36.042H23.06a.875.875 0 100-1.742z"
459
- })), _path2$2 || (_path2$2 = /*#__PURE__*/React.createElement("path", {
460
- d: "M28.44 15.141c-.59-.01-1.117.465-1.594 1.125-.524.77-.966 1.594-1.317 2.457-.325.75-.5 1.317-.517 1.808-.025.448.108.89.375 1.25-.228.295-.47.58-.727.85-.347.37-.719.715-1.113 1.034-.107.088-.357.291-.75.564a11.311 11.311 0 01-4.875 1.871c-.625.085-1.255.118-1.886.099l-1.094 1.25-.692.793V26a11.493 11.493 0 01-1.356-.346c-.525-.17-1.036-.38-1.53-.625A11.375 11.375 0 1124.606 6.963a11.368 11.368 0 011.431 1.84c-.256.36-.418.779-.47 1.218-.059.441-.008.89.147 1.306a9.935 9.935 0 01.625 3.5h.625c0-1.268-.226-2.525-.67-3.713a1.951 1.951 0 01-.056-1.209 1.499 1.499 0 01.688-.93 1.242 1.242 0 011.178 0c.446.236.787.63.955 1.106.568 1.52.858 3.128.857 4.75h.625c.001-1.697-.303-3.38-.899-4.968a2.965 2.965 0 00-1.087-1.425 1.929 1.929 0 00-1.401-.345 12.69 12.69 0 00-.875-1.23A12.71 12.71 0 1010.316 25.99c.817.446 1.681.8 2.576 1.054v4.82l3.78-4.337a12.699 12.699 0 009.756-4.926c.415.16.89.157 1.417-.16.527-.318 1.108-.956 1.581-2.053.277-.64.452-1.32.517-2.014a5.042 5.042 0 00-.126-1.707c-.257-.97-.797-1.518-1.377-1.527z"
461
- })), _path3 || (_path3 = /*#__PURE__*/React.createElement("path", {
462
- d: "M29.26 14.822a12.834 12.834 0 00-.75-4.33l-.586.21c.471 1.323.712 2.719.71 4.124l.626-.004zm-2.414-3.734c.428 1.198.646 2.462.644 3.735h.625a11.72 11.72 0 00-.681-3.948l-.588.213z"
463
- })));
464
- }
465
-
466
- var _path$6;
467
-
468
- function _extends$7() { _extends$7 = 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$7.apply(this, arguments); }
469
-
470
- function SvgMenuIcon(props) {
471
- return /*#__PURE__*/React.createElement("svg", _extends$7({
472
- viewBox: "0 0 35 35",
473
- fill: "none",
474
- xmlns: "http://www.w3.org/2000/svg",
475
- "aria-hidden": "true"
476
- }, props), _path$6 || (_path$6 = /*#__PURE__*/React.createElement("path", {
477
- d: "M29.167 16.042H5.833c-.802 0-1.458.656-1.458 1.458 0 .802.656 1.458 1.458 1.458h23.334c.802 0 1.458-.656 1.458-1.458 0-.802-.656-1.458-1.458-1.458zM5.833 26.25h14.584c.802 0 1.458-.656 1.458-1.458 0-.802-.656-1.459-1.458-1.459H5.833c-.802 0-1.458.657-1.458 1.459s.656 1.458 1.458 1.458zm23.334-17.5H5.833c-.802 0-1.458.656-1.458 1.458v.015c0 .802.656 1.458 1.458 1.458h23.334c.802 0 1.458-.656 1.458-1.458v-.015c0-.802-.656-1.458-1.458-1.458z"
478
- })));
479
- }
480
-
481
- var _path$5, _path2$1;
482
-
483
- function _extends$6() { _extends$6 = 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$6.apply(this, arguments); }
484
-
485
- function SvgCheckCircle(props) {
486
- return /*#__PURE__*/React.createElement("svg", _extends$6({
487
- xmlns: "http://www.w3.org/2000/svg",
488
- viewBox: "0 0 24 24",
489
- fill: "none",
490
- stroke: "currentColor",
491
- strokeWidth: 2,
492
- strokeLinecap: "round",
493
- strokeLinejoin: "round",
494
- className: "CheckCircle_svg__feather CheckCircle_svg__feather-check-circle"
495
- }, props), _path$5 || (_path$5 = /*#__PURE__*/React.createElement("path", {
496
- d: "M22 11.08V12a10 10 0 11-5.93-9.14"
497
- })), _path2$1 || (_path2$1 = /*#__PURE__*/React.createElement("path", {
498
- d: "M22 4L12 14.01l-3-3"
499
- })));
500
- }
501
-
502
- var _path$4, _path2;
503
-
504
- function _extends$5() { _extends$5 = 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$5.apply(this, arguments); }
505
-
506
- function SvgCopy(props) {
507
- return /*#__PURE__*/React.createElement("svg", _extends$5({
508
- viewBox: "0 0 35 35",
509
- fill: "none",
510
- strokeWidth: 2,
511
- strokeLinecap: "round",
512
- strokeLinejoin: "round",
513
- xmlns: "http://www.w3.org/2000/svg"
514
- }, props), _path$4 || (_path$4 = /*#__PURE__*/React.createElement("path", {
515
- d: "M29.167 13.125H16.042a2.917 2.917 0 00-2.917 2.917v13.125a2.917 2.917 0 002.917 2.916h13.125a2.917 2.917 0 002.916-2.916V16.042a2.917 2.917 0 00-2.916-2.917z"
516
- })), _path2 || (_path2 = /*#__PURE__*/React.createElement("path", {
517
- d: "M7.292 21.875H5.833a2.917 2.917 0 01-2.916-2.917V5.833a2.917 2.917 0 012.916-2.916h13.125a2.916 2.916 0 012.917 2.916v1.459"
518
- })));
519
- }
520
-
521
- var _path$3;
522
-
523
- function _extends$4() { _extends$4 = 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$4.apply(this, arguments); }
524
-
525
- function SvgCheckmark(props) {
526
- return /*#__PURE__*/React.createElement("svg", _extends$4({
527
- xmlns: "http://www.w3.org/2000/svg",
528
- viewBox: "0 0 24 24",
529
- fill: "none",
530
- stroke: "currentColor",
531
- strokeWidth: 2,
532
- strokeLinecap: "round",
533
- strokeLinejoin: "round",
534
- className: "Checkmark_svg__feather Checkmark_svg__feather-check"
535
- }, props), _path$3 || (_path$3 = /*#__PURE__*/React.createElement("path", {
536
- d: "M20 6L9 17l-5-5"
537
- })));
538
- }
539
-
540
- var _circle$1;
541
-
542
- function _extends$3() { _extends$3 = 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$3.apply(this, arguments); }
543
-
544
- function SvgUnchecked(props) {
545
- return /*#__PURE__*/React.createElement("svg", _extends$3({
546
- xmlns: "http://www.w3.org/2000/svg",
547
- viewBox: "0 0 24 24",
548
- fill: "none",
549
- stroke: "currentColor",
550
- strokeWidth: 2,
551
- strokeLinecap: "round",
552
- strokeLinejoin: "round",
553
- className: "Unchecked_svg__feather Unchecked_svg__feather-circle"
554
- }, props), _circle$1 || (_circle$1 = /*#__PURE__*/React.createElement("circle", {
555
- cx: 12,
556
- cy: 12,
557
- r: 10
558
- })));
559
- }
560
-
561
- var _path$2;
562
-
563
- function _extends$2() { _extends$2 = 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$2.apply(this, arguments); }
564
-
565
- function SvgAlertOctagon(props) {
566
- return /*#__PURE__*/React.createElement("svg", _extends$2({
567
- xmlns: "http://www.w3.org/2000/svg",
568
- viewBox: "0 0 24 24",
569
- fill: "none",
570
- stroke: "currentColor",
571
- strokeWidth: 2,
572
- strokeLinecap: "round",
573
- strokeLinejoin: "round"
574
- }, props), _path$2 || (_path$2 = /*#__PURE__*/React.createElement("path", {
575
- d: "M7.86 2h8.28L22 7.86v8.28L16.14 22H7.86L2 16.14V7.86L7.86 2zM12 8v4M12 16h.01"
576
- })));
577
- }
578
-
579
- var _path$1;
580
-
581
- function _extends$1() { _extends$1 = 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$1.apply(this, arguments); }
582
-
583
- function SvgAlertTriangle(props) {
584
- return /*#__PURE__*/React.createElement("svg", _extends$1({
585
- xmlns: "http://www.w3.org/2000/svg",
586
- viewBox: "0 0 24 24",
587
- fill: "none",
588
- stroke: "currentColor",
589
- strokeWidth: 2,
590
- strokeLinecap: "round",
591
- strokeLinejoin: "round",
592
- className: "AlertTriangle_svg__feather AlertTriangle_svg__feather-alert-triangle"
593
- }, props), _path$1 || (_path$1 = /*#__PURE__*/React.createElement("path", {
594
- d: "M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0zM12 9v4M12 17h.01"
595
- })));
596
- }
377
+ Icon.displayName = 'Icon';
597
378
 
598
- var _circle, _path;
379
+ var useTypographyStyles = makeStyles(function () {
380
+ var _a;
381
+ return ({
382
+ root: (_a = {},
383
+ _a["& ." + iconStaticClassName] = {
384
+ position: 'relative',
385
+ top: '0.125em',
386
+ padding: '0 0.125em',
387
+ },
388
+ _a),
389
+ caption: {
390
+ display: 'inline',
391
+ },
392
+ overline: {
393
+ display: 'inline',
394
+ },
395
+ });
396
+ });
599
397
 
600
- function _extends() { _extends = 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.apply(this, arguments); }
398
+ var Typography = forwardRef(function (props, ref) {
399
+ var classes = useTypographyStyles(props);
400
+ return React__default.createElement(MuiTypography, __assign({ ref: ref, classes: classes }, props));
401
+ });
402
+ Typography.displayName = 'Typography';
601
403
 
602
- function SvgInfo(props) {
603
- return /*#__PURE__*/React.createElement("svg", _extends({
604
- xmlns: "http://www.w3.org/2000/svg",
605
- viewBox: "0 0 24 24",
606
- fill: "none",
607
- stroke: "currentColor",
608
- strokeWidth: 2,
609
- strokeLinecap: "round",
610
- strokeLinejoin: "round",
611
- className: "Info_svg__feather Info_svg__feather-info"
612
- }, props), _circle || (_circle = /*#__PURE__*/React.createElement("circle", {
613
- cx: 12,
614
- cy: 12,
615
- r: 10
616
- })), _path || (_path = /*#__PURE__*/React.createElement("path", {
617
- d: "M12 16v-4M12 8h.01"
618
- })));
619
- }
404
+ var getFadeStop = function (_a, typographyVariant) {
405
+ var typography = _a.typography;
406
+ return !isNaN(Number(typography[typographyVariant].lineHeight))
407
+ ? typography[typographyVariant].lineHeight + "rem"
408
+ : typography[typographyVariant].lineHeight;
409
+ };
410
+ var useCollapsibleTextStyles = makeStyles$1(function (theme) { return ({
411
+ overlay: {
412
+ position: 'absolute',
413
+ top: 0,
414
+ left: 0,
415
+ height: '100%',
416
+ width: '100%',
417
+ background: function (props) { return "linear-gradient(to top, white, #FFF0 " + getFadeStop(theme, props.typographyVariant) + ")"; },
418
+ },
419
+ }); });
620
420
 
621
- var iconDictionary = {
622
- add: AddCircleRoundedIcon,
623
- 'add-outlined': AddCircleOutlineRoundedIcon,
624
- 'add-photo': AddAPhotoRoundedIcon,
625
- alarm: AccessAlarmRounded,
626
- 'arrow-back': ArrowBackRoundedIcon,
627
- 'arrow-down': ArrowDownwardRoundedIcon,
628
- 'arrow-forward': ArrowForwardRoundedIcon,
629
- 'arrow-up': ArrowUpwardRoundedIcon,
630
- attach: AttachFileRoundedIcon,
631
- 'bar-chart': AssessmentRoundedIcon,
632
- block: BlockIcon,
633
- calendar: CalendarTodayRoundedIcon,
634
- 'calendar-today': TodayRounded,
635
- cancel: CloseRoundedIcon,
636
- 'cancel-filled': CancelRoundedIcon,
637
- cart: ShoppingCartRoundedIcon,
638
- chat: ChatRoundedIcon,
639
- 'check-circle': CheckCircleRoundedIcon,
640
- checked: SvgCheckCircle,
641
- checkmark: SvgCheckmark,
642
- 'chevron-down': KeyboardArrowDownRoundedIcon,
643
- 'chevron-left': KeyboardArrowLeftRoundedIcon,
644
- 'chevron-right': KeyboardArrowRightRoundedIcon,
645
- 'chevron-up': KeyboardArrowUpRoundedIcon,
646
- clock: AccessTimeRoundedIcon,
647
- code: CodeRoundedIcon,
648
- comment: CommentRoundedIcon,
649
- compare: CompareArrowsRoundedIcon,
650
- copy: SvgCopy,
651
- 'credit-card': CreditCardRounded,
652
- delete: DeleteRoundedIcon,
653
- desktop: DesktopMacRoundedIcon,
654
- 'dining-menu': RestaurantMenuRoundedIcon,
655
- download: CloudDownloadRoundedIcon,
656
- 'drag-handle': DragIndicatorRoundedIcon,
657
- edit: EditRoundedIcon,
658
- error: SvgAlertOctagon,
659
- 'external-link': OpenInNewRoundedIcon,
660
- facebook: FacebookIcon,
661
- 'filter-list': FilterListRounded,
662
- 'gift-card': CardGiftcardOutlined,
663
- globe: PublicRoundedIcon,
664
- help: HelpRoundedIcon,
665
- history: HistoryRounded,
666
- home: HomeRounded,
667
- info: SvgInfo,
668
- list: ListRounded,
669
- 'location-pin': RoomOutlinedIcon,
670
- lock: LockRoundedIcon,
671
- 'lock-open': LockOpenRoundedIcon,
672
- loyalty: LoyaltyOutlined,
673
- mail: MailRoundedIcon,
674
- menu: SvgMenuIcon,
675
- merge: MergeTypeRounded,
676
- 'mobile-device': PhoneAndroidRounded,
677
- notification: NotificationsRoundedIcon,
678
- 'photo-camera': PhotoCameraRounded,
679
- play: PlayCircleFilledRounded,
680
- popmenu: SvgPopmenuLogo,
681
- print: PrintRoundedIcon,
682
- refresh: RefreshRoundedIcon,
683
- phone: PhoneRounded,
684
- profile: AccountCircleOutlined,
685
- remove: RemoveCircleRoundedIcon,
686
- 'remove-outlined': RemoveCircleOutlineRoundedIcon,
687
- replay: ReplayRounded,
688
- reply: ReplyIcon,
689
- save: SaveRoundedIcon,
690
- search: SearchRoundedIcon,
691
- send: SendRoundedIcon,
692
- settings: SettingsRoundedIcon,
693
- 'shopping-bag': LocalMallOutlinedIcon,
694
- shuffle: ShuffleRounded,
695
- star: StarBorderRounded,
696
- 'star-filled': StarRounded,
697
- success: SvgCheckCircle,
698
- truck: LocalShippingOutlinedIcon,
699
- twitter: TwitterIcon,
700
- unchecked: SvgUnchecked,
701
- upload: CloudUploadRoundedIcon,
702
- visibility: VisibilityRoundedIcon,
703
- 'visibility-off': VisibilityOffRoundedIcon,
704
- voicemail: VoicemailRoundedIcon,
705
- warning: SvgAlertTriangle,
706
- website: LanguageRoundedIcon,
421
+ var CollapsibleText = function (props) {
422
+ var _a = props, text = _a.text, open = _a.open, previewLines = _a.previewLines, _b = _a.typographyVariant, typographyVariant = _b === void 0 ? 'body1' : _b, collapsible = _a.collapsible, setCollapsible = _a.setCollapsible;
423
+ var classes = useCollapsibleTextStyles(props);
424
+ var typographyRef = useRef(null);
425
+ var typography = useTheme$1().typography;
426
+ var collapsedSize = previewLines * parseFloat(typography[typographyVariant].lineHeight);
427
+ useEffect(function () {
428
+ var typographyNode = typographyRef.current;
429
+ var observer = new ResizeObserver(function (entries) {
430
+ var typographyHeight = entries[0].contentRect.height;
431
+ var collapsedPxSize = collapsedSize * 16;
432
+ var collapsible = typographyHeight > collapsedPxSize;
433
+ setCollapsible(collapsible);
434
+ });
435
+ observer.observe(typographyNode);
436
+ return function () {
437
+ observer.unobserve(typographyNode);
438
+ };
439
+ }, []);
440
+ return (React__default.createElement(Fragment, null,
441
+ React__default.createElement(Box, { position: "relative", overflow: "hidden" },
442
+ React__default.createElement(Collapse, { in: open, collapsedSize: collapsedSize + 'rem' },
443
+ React__default.createElement(Typography, { ref: typographyRef, variant: typographyVariant }, text)),
444
+ collapsible && !open && React__default.createElement(Box, { className: classes.overlay }))));
445
+ };
446
+ CollapsibleText.defaultProps = {
447
+ previewLines: 2,
448
+ typographyVariant: 'body1',
707
449
  };
708
450
 
709
- /**
710
- * Adding new icons.
711
- * 1. If not part of the material-ui library, put the svg file in app/javascript/admin/common/assets/
712
- * 2. Update the iconDictionary at ./iconDictionary
713
- * 3. Add the icon name to Icon.propTypes
714
- */
715
- var IconStaticClassName = 'mep-icon-svg';
716
- var Icon = forwardRef(function (props, ref) {
717
- var className = props.className, name = props.name; props.color; var restProps = __rest(props, ["className", "name", "color"]);
718
- var classes = useIconStyles(props);
719
- var IconComponent = iconDictionary[name] || FlagRounded;
720
- if (!iconDictionary[name]) {
721
- console.warn("Invalid name prop provided to Icon component. \"" + name + "\" was not found in the iconDictionary.");
722
- }
723
- return (React__default.createElement(IconComponent, __assign({ ref: ref, className: classNames([classes.root, className, IconStaticClassName]) }, restProps)));
724
- });
725
- Icon.displayName = 'Icon';
451
+ var SemanticColors;
452
+ (function (SemanticColors) {
453
+ SemanticColors["PRIMARY_MAIN"] = "primary.main";
454
+ SemanticColors["PRIMARY_DARK"] = "primary.dark";
455
+ SemanticColors["PRIMARY_LIGHT"] = "primary.light";
456
+ SemanticColors["SECONDARY_MAIN"] = "secondary.main";
457
+ SemanticColors["SECONDARY_DARK"] = "secondary.dark";
458
+ SemanticColors["SECONDARY_LIGHT"] = "secondary.light";
459
+ })(SemanticColors || (SemanticColors = {}));
460
+ var useStyles = makeStyles$1(function (theme) { return ({
461
+ dividerRoot: {
462
+ gap: theme.spacing(2),
463
+ },
464
+ textRoot: {
465
+ color: function (props) {
466
+ var textColor = props.textColor;
467
+ if (Object.values(SemanticColors).includes(textColor)) {
468
+ var _a = textColor.split('.'), semanticColor = _a[0], shade = _a[1];
469
+ return theme.palette[semanticColor][shade];
470
+ }
471
+ else if (textColor) {
472
+ return textColor;
473
+ }
474
+ else {
475
+ return 'black';
476
+ }
477
+ },
478
+ textTransform: function (props) { return props.textTransform; },
479
+ },
480
+ dividerLine: {
481
+ backgroundColor: function (props) {
482
+ var dividerColor = props.dividerColor;
483
+ if (Object.values(SemanticColors).includes(dividerColor)) {
484
+ var _a = dividerColor.split('.'), semanticColor = _a[0], shade = _a[1];
485
+ return theme.palette[semanticColor][shade];
486
+ }
487
+ else if (dividerColor) {
488
+ return dividerColor;
489
+ }
490
+ else {
491
+ return theme.palette.grey[500];
492
+ }
493
+ },
494
+ },
495
+ }); });
496
+ var Divider = function (props) {
497
+ var className = props.className, text = props.text, textTransform = props.textTransform, TypographyProps = props.TypographyProps;
498
+ var classes = useStyles(props);
499
+ var casingOffset = textTransform === 'lowercase' ? '.25rem' : 'unset';
500
+ return (React__default.createElement(Box, { className: classNames([classes.dividerRoot, className]), display: "flex", alignItems: "center" },
501
+ React__default.createElement(Box, { className: classes.dividerLine, display: "flex", flexGrow: 1, height: "1px", marginTop: casingOffset }),
502
+ text && (React__default.createElement(React__default.Fragment, null,
503
+ React__default.createElement(Typography, __assign({ className: classes.textRoot }, TypographyProps), text),
504
+ React__default.createElement(Box, { className: classes.dividerLine, display: "flex", flexGrow: 1, height: "1px", marginTop: casingOffset })))));
505
+ };
506
+ Divider.displayName = 'Divider';
507
+ Divider.defaultProps = {
508
+ textTransform: 'lowercase',
509
+ };
726
510
 
727
511
  var IconButton = forwardRef(function (props, ref) {
728
- props.children; var icon = props.icon, muiProps = __rest(props, ["children", "icon"]);
729
- return (React__default.createElement(MuiIconButton, __assign({ ref: ref }, muiProps),
730
- React__default.createElement(Icon, { name: icon })));
512
+ return React__default.createElement(MuiIconButton, __assign({ ref: ref }, props));
731
513
  });
732
- IconButton.displayName = 'IconButton';
514
+ IconButton.displayName = 'IconButton';
515
+ IconButton.defaultProps = {
516
+ color: 'secondary',
517
+ };
733
518
 
734
519
  var getLinkColor = function (_a, _b) {
735
520
  var palette = _a.palette;
@@ -753,7 +538,7 @@ var useLinkStyles = makeStyles(function (theme) {
753
538
  display: 'flex',
754
539
  color: function (props) { return getLinkColor(theme, props); }
755
540
  },
756
- _a["& ." + IconStaticClassName] = {
541
+ _a["& ." + iconStaticClassName] = {
757
542
  alignSelf: 'center',
758
543
  },
759
544
  _a),
@@ -902,30 +687,19 @@ var Tooltip = forwardRef(function (props, ref) {
902
687
  });
903
688
  Tooltip.displayName = 'Tooltip';
904
689
 
905
- var useTypographyStyles = makeStyles(function () {
906
- var _a;
907
- return ({
908
- root: (_a = {
909
- display: 'flex'
910
- },
911
- _a["& ." + IconStaticClassName] = {
912
- alignSelf: 'center',
913
- },
914
- _a),
915
- caption: {
916
- display: 'inline',
690
+ var useCollapsibleText = function () {
691
+ var _a = useState(false), open = _a[0], setOpen = _a[1];
692
+ var _b = useState(false), collapsible = _b[0], setCollapsible = _b[1];
693
+ var toggle = function () { return collapsible && setOpen(!open); };
694
+ return {
695
+ collapsibleText: {
696
+ open: open,
697
+ collapsible: collapsible,
698
+ setCollapsible: setCollapsible,
917
699
  },
918
- overline: {
919
- display: 'inline',
920
- },
921
- });
922
- });
923
-
924
- var Typography = forwardRef(function (props, ref) {
925
- var classes = useTypographyStyles(props);
926
- return React__default.createElement(MuiTypography, __assign({ ref: ref, classes: classes }, props));
927
- });
928
- Typography.displayName = 'Typography';
700
+ toggle: toggle,
701
+ };
702
+ };
929
703
 
930
- export { Avatar, Button, Checkbox, Icon, IconButton, Link, Radio, SplitInput, Switch, ToggleButton, ToggleButtonGroup, Tooltip, Typography, iconDictionary };
704
+ export { Avatar, Button, Checkbox, CollapsibleText, Divider, Icon, IconButton, Link, Radio, SplitInput, Switch, ToggleButton, ToggleButtonGroup, Tooltip, Typography, useCollapsibleText };
931
705
  //# sourceMappingURL=index.es.js.map