@popmenu/ordering-ui 0.89.1 → 0.90.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.
@@ -21,4 +21,6 @@ export interface DishCheckoutCardProps {
21
21
  onQuantityChange: (id: number, value: number) => void;
22
22
  /** Special instructions text */
23
23
  specialInstructions?: string | null;
24
+ /** If item is in cart but is not unavailable */
25
+ warningMessage?: string;
24
26
  }
@@ -1,6 +1,7 @@
1
1
  export declare type MenuDropdownOption = {
2
2
  id: number | string;
3
3
  name: string;
4
+ isUnavailable?: boolean;
4
5
  };
5
6
  export interface MenuDropdownProps {
6
7
  /** Callback for selecting active menu */
package/build/index.es.js CHANGED
@@ -1,14 +1,14 @@
1
- import { Button as Button$2, makeStyles as makeStyles$1, Box, Typography as Typography$1, Link as Link$1, Paper as Paper$1, Avatar as Avatar$1, Card, CardActionArea, FormControl, Select, InputAdornment, MenuItem as MenuItem$1, FormControlLabel as FormControlLabel$1, Checkbox as Checkbox$2, Radio as Radio$2, Menu, TextField, Tabs, Chip, DialogTitle as DialogTitle$1, IconButton as IconButton$1, withStyles, Switch as Switch$2 } from '@material-ui/core';
1
+ import { Button as Button$1, makeStyles as makeStyles$1, Box, Typography as Typography$1, Link as Link$1, Paper as Paper$1, Avatar as Avatar$1, Card, CardActionArea, FormControl, Select, InputAdornment, MenuItem as MenuItem$1, FormControlLabel as FormControlLabel$1, Checkbox as Checkbox$2, Radio as Radio$2, Menu, TextField, Tabs, Chip, DialogTitle as DialogTitle$1, IconButton as IconButton$1, withStyles, Switch as Switch$2 } from '@material-ui/core';
2
2
  export * from '@material-ui/core';
3
3
  import * as React from 'react';
4
4
  import React__default, { forwardRef, createElement, createContext, useContext, useState } from 'react';
5
- import { makeStyles, useTheme, lighten } from '@material-ui/core/styles';
5
+ import { makeStyles, lighten } from '@material-ui/core/styles';
6
6
  import '@material-ui/lab/Alert';
7
7
  import '@material-ui/core/AppBar';
8
8
  import MuiAvatar from '@material-ui/core/Avatar';
9
9
  import '@material-ui/core/Badge';
10
- import MuiButton from '@material-ui/core/Button';
11
- import CircularProgress from '@material-ui/core/CircularProgress';
10
+ import '@material-ui/core/Button';
11
+ import '@material-ui/core/CircularProgress';
12
12
  import '@material-ui/core/ButtonGroup';
13
13
  import Card$1 from '@material-ui/core/Card';
14
14
  import CardActionArea$1 from '@material-ui/core/CardActionArea';
@@ -88,7 +88,7 @@ function __rest$1(s, e) {
88
88
  return t;
89
89
  }
90
90
 
91
- var Button$1 = forwardRef(function (props, ref) {
91
+ var Button = forwardRef(function (props, ref) {
92
92
  var _a = props.variation, variation = _a === void 0 ? 'primary' : _a, muiProps = __rest$1(props, ["variation"]);
93
93
  var variationProps = {};
94
94
  switch (variation) {
@@ -101,9 +101,9 @@ var Button$1 = forwardRef(function (props, ref) {
101
101
  variationProps.color = 'primary';
102
102
  break;
103
103
  }
104
- return React__default.createElement(Button$2, __assign$1({}, variationProps, muiProps, { ref: ref }));
104
+ return React__default.createElement(Button$1, __assign$1({}, variationProps, muiProps, { ref: ref }));
105
105
  });
106
- Button$1.displayName = 'Button';
106
+ Button.displayName = 'Button';
107
107
 
108
108
  var useDishCardStyles = makeStyles(function (theme) {
109
109
  var _a, _b;
@@ -431,6 +431,24 @@ function SvgTag(props) {
431
431
  })));
432
432
  }
433
433
 
434
+ var _path$K;
435
+
436
+ function _extends$1I() { _extends$1I = 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$1I.apply(this, arguments); }
437
+
438
+ function SvgWarning(props) {
439
+ return /*#__PURE__*/React.createElement("svg", _extends$1I({
440
+ viewBox: "0 0 16 16",
441
+ fill: "none",
442
+ strokeLinecap: "round",
443
+ strokeLinejoin: "round",
444
+ width: "1em",
445
+ height: "1em"
446
+ }, props), _path$K || (_path$K = /*#__PURE__*/React.createElement("path", {
447
+ d: "M6.86 2.573L1.213 12a1.334 1.334 0 001.14 2h11.294a1.332 1.332 0 001.14-2L9.14 2.573a1.333 1.333 0 00-2.28 0v0zM8 6v2.667m0 2.667h.007",
448
+ stroke: "currentColor"
449
+ })));
450
+ }
451
+
434
452
  var _path$z;
435
453
 
436
454
  function _extends$1o() { _extends$1o = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1o.apply(this, arguments); }
@@ -746,7 +764,7 @@ makeStyles(function (theme) { return ({
746
764
  },
747
765
  }); });
748
766
 
749
- var useButtonStyles = makeStyles(function () { return ({
767
+ makeStyles(function () { return ({
750
768
  root: {
751
769
  minWidth: 'unset',
752
770
  },
@@ -758,19 +776,6 @@ var useButtonStyles = makeStyles(function () { return ({
758
776
  },
759
777
  }); });
760
778
 
761
- var Button = forwardRef(function (props, ref) {
762
- props.textTransform; var loading = props.loading, classesOverride = props.classes, className = props.className, muiProps = __rest(props, ["textTransform", "loading", "classes", "className"]);
763
- props.classes; var styleProps = __rest(props, ["classes"]);
764
- var classes = useButtonStyles(styleProps);
765
- var typography = useTheme().typography;
766
- var loadingIndicator = {
767
- startIcon: React__default.createElement(CircularProgress, { color: "inherit", size: typography.button.fontSize }),
768
- disabled: true,
769
- };
770
- return (React__default.createElement(MuiButton, __assign({ ref: ref, classes: __assign(__assign({}, classes), classesOverride), className: classNames$1([className, 'pm-button']) }, muiProps, (loading && loadingIndicator))));
771
- });
772
- Button.displayName = 'Button';
773
-
774
779
  var Checkbox$1 = forwardRef(function (props, ref) {
775
780
  var label = props.label, disabled = props.disabled, LabelProps = props.LabelProps, muiProps = __rest(props, ["label", "disabled", "LabelProps"]);
776
781
  var control = React__default.createElement(MuiCheckbox, __assign({ disabled: label ? undefined : disabled }, muiProps));
@@ -925,12 +930,12 @@ var useTypographyStyles = makeStyles(function (theme) {
925
930
  });
926
931
  });
927
932
 
928
- var Typography = forwardRef(function (props, ref) {
933
+ var Typography = function (props) {
929
934
  props.weight; props.color; var restProps = __rest(props, ["weight", "color"]);
930
935
  var classes = useTypographyStyles(__assign({}, props));
931
936
  var variantMapping = { subtitle1: 'p' };
932
- return React__default.createElement(Typography$1, __assign({ ref: ref, classes: classes, variantMapping: variantMapping }, restProps));
933
- });
937
+ return React__default.createElement(Typography$1, __assign({ classes: classes, variantMapping: variantMapping }, restProps));
938
+ };
934
939
  Typography.displayName = 'Typography';
935
940
  Typography.defaultProps = defaultTypographyProps;
936
941
 
@@ -1457,6 +1462,11 @@ var useDishCheckoutCardStyles = makeStyles(function (theme) { return ({
1457
1462
  selectPaper: {
1458
1463
  maxHeight: theme.spacing(37),
1459
1464
  },
1465
+ warning: {
1466
+ color: theme.palette.error.main,
1467
+ display: 'flex',
1468
+ gridGap: theme.spacing(0.825),
1469
+ },
1460
1470
  }); });
1461
1471
 
1462
1472
  var OrderingAppContext = createContext(null);
@@ -1474,7 +1484,7 @@ var OrderingAppContextProvider = function (props) {
1474
1484
 
1475
1485
  var DishCheckoutCard = function (props) {
1476
1486
  var _a;
1477
- var id = props.id, name = props.name, quantity = props.quantity, modifiers = props.modifiers, onDelete = props.onDelete, onEdit = props.onEdit, onQuantityChange = props.onQuantityChange, price = props.price, specialInstructions = props.specialInstructions, disabled = props.disabled;
1487
+ var id = props.id, name = props.name, quantity = props.quantity, modifiers = props.modifiers, onDelete = props.onDelete, onEdit = props.onEdit, onQuantityChange = props.onQuantityChange, price = props.price, specialInstructions = props.specialInstructions, disabled = props.disabled, warningMessage = props.warningMessage;
1478
1488
  var classes = useDishCheckoutCardStyles(props);
1479
1489
  var appContext = useOrderingAppContext()[0];
1480
1490
  var _b = useState(false), open = _b[0], setOpen = _b[1];
@@ -1496,7 +1506,7 @@ var DishCheckoutCard = function (props) {
1496
1506
  specialInstructions,
1497
1507
  "\"")),
1498
1508
  React__default.createElement(Box, { display: "flex", gridGap: 1, height: "100%", alignItems: "center" },
1499
- React__default.createElement(Button$1, { disabled: disabled, className: classes.editButton, variant: "text", onClick: onEdit }, "Edit"),
1509
+ React__default.createElement(Button, { disabled: disabled, className: classes.editButton, variant: "text", onClick: onEdit }, "Edit"),
1500
1510
  React__default.createElement(IconButton, { disabled: disabled, onClick: onDelete, classes: { root: classes.deleteButton } },
1501
1511
  React__default.createElement(Icon, { icon: SvgTrash, size: "large" })))),
1502
1512
  React__default.createElement(Box, { display: "flex", gridGap: 16, alignItems: "center" },
@@ -1515,7 +1525,11 @@ var DishCheckoutCard = function (props) {
1515
1525
  getContentAnchorEl: null,
1516
1526
  classes: { paper: classes.selectPaper },
1517
1527
  }, className: classes.select }, Array.from({ length: 99 }, function (_, index) { return (React__default.createElement(MenuItem$1, { key: index + 1, value: index + 1 }, index + 1)); }))),
1518
- React__default.createElement(Typography, { className: classes.price }, formattedPrice))));
1528
+ React__default.createElement(Typography, { className: classes.price }, formattedPrice)),
1529
+ warningMessage && (React__default.createElement(Box, { className: classes.warning },
1530
+ React__default.createElement(Box, { paddingTop: 0.25 },
1531
+ React__default.createElement(Icon, { icon: SvgWarning, size: "medium" })),
1532
+ React__default.createElement(Typography, { variant: "body2" }, warningMessage)))));
1519
1533
  };
1520
1534
 
1521
1535
  var DishDetailsReview = forwardRef(function (props) {
@@ -1792,6 +1806,11 @@ var useMenuDropdownStyles = makeStyles(function (theme) {
1792
1806
  alignSelf: 'start',
1793
1807
  },
1794
1808
  _a),
1809
+ menuItem: {
1810
+ alignItems: 'center',
1811
+ display: 'flex',
1812
+ gridGap: theme.spacing(1),
1813
+ },
1795
1814
  select: {
1796
1815
  '& .MuiSelect-root': {
1797
1816
  color: '#212121',
@@ -1799,6 +1818,9 @@ var useMenuDropdownStyles = makeStyles(function (theme) {
1799
1818
  zIndex: 10,
1800
1819
  },
1801
1820
  },
1821
+ unavailable: {
1822
+ color: theme.palette.grey[700],
1823
+ },
1802
1824
  });
1803
1825
  });
1804
1826
 
@@ -1820,7 +1842,9 @@ var MenuDropdown = function (props) {
1820
1842
  horizontal: 'left',
1821
1843
  },
1822
1844
  getContentAnchorEl: null,
1823
- }, className: classes.select }, menuOptions.map(function (option, index) { return (React__default.createElement(MenuItem$1, { key: index, value: option.id }, option.name)); }))));
1845
+ }, className: classes.select, renderValue: function (selected) { var _a; return (_a = menuOptions.find(function (menuOption) { return menuOption.id === selected; })) === null || _a === void 0 ? void 0 : _a.name; } }, menuOptions.map(function (option, index) { return (React__default.createElement(MenuItem$1, { key: index, value: option.id, className: classNames(classes.menuItem, option.isUnavailable ? classes.unavailable : '') },
1846
+ option.name,
1847
+ option.isUnavailable && React__default.createElement(Icon, { icon: SvgClock, size: "large" }))); }))));
1824
1848
  };
1825
1849
 
1826
1850
  var useMenuFilterStyles = makeStyles(function (theme) { return ({
@@ -1869,7 +1893,7 @@ var MenuFilter = function (props) {
1869
1893
  setAnchorEl(null);
1870
1894
  };
1871
1895
  return (React__default.createElement(React__default.Fragment, null,
1872
- React__default.createElement(Button$2, { id: triggerId, "aria-controls": popoverId, "aria-haspopup": "true", "aria-expanded": open, onClick: handleTriggerClick, size: "small", startIcon: React__default.createElement(SvgLeafIcon, null), classes: { label: classes.triggerLabel } }, triggerLabel),
1896
+ React__default.createElement(Button$1, { id: triggerId, "aria-controls": popoverId, "aria-haspopup": "true", "aria-expanded": open, onClick: handleTriggerClick, size: "small", startIcon: React__default.createElement(SvgLeafIcon, null), classes: { label: classes.triggerLabel } }, triggerLabel),
1873
1897
  React__default.createElement(Menu, { id: popoverId, anchorEl: anchorEl, open: open, onClose: handleClose },
1874
1898
  availableFilters.map(function (option, index) {
1875
1899
  return (React__default.createElement(MenuItem$1, { key: index, value: option.id, onClick: function (event) { return handleChange(option, event); } },
@@ -2294,5 +2318,5 @@ var orderingTheme = {
2294
2318
  props: props,
2295
2319
  };
2296
2320
 
2297
- export { Button$1 as Button, Checkbox, DialogSection, DialogTitle, DishCheckoutCard, DishDetailsReview, DishModifierCard, ItemTag, ItemTagGroup, LocationCard, MenuDropdown, MenuFilter, MenuItem, MenuItemGroup, MenuSection, MenuSectionGroup, OrderingAppContext, OrderingAppContextProvider, PageSection, QuantityPicker, Radio, ReactionCounter, ReactionCounterGroup, SelectableChip, SelectableChipGroup, SelectedMenuFiltersList, StatusTag, Switch, orderingTheme, useOrderingAppContext };
2321
+ export { Button, Checkbox, DialogSection, DialogTitle, DishCheckoutCard, DishDetailsReview, DishModifierCard, ItemTag, ItemTagGroup, LocationCard, MenuDropdown, MenuFilter, MenuItem, MenuItemGroup, MenuSection, MenuSectionGroup, OrderingAppContext, OrderingAppContextProvider, PageSection, QuantityPicker, Radio, ReactionCounter, ReactionCounterGroup, SelectableChip, SelectableChipGroup, SelectedMenuFiltersList, StatusTag, Switch, orderingTheme, useOrderingAppContext };
2298
2322
  //# sourceMappingURL=index.es.js.map