@popmenu/ordering-ui 0.87.0 → 0.89.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.
@@ -2,7 +2,7 @@ import { ReactNode } from 'react';
2
2
  interface DialogTitleProps {
3
3
  title: string;
4
4
  Icon?: ReactNode;
5
- onClose: () => void;
5
+ onClose?: () => void;
6
6
  }
7
7
  export declare const DialogTitle: (props: DialogTitleProps) => JSX.Element;
8
8
  export {};
@@ -22,6 +22,8 @@ export interface MenuItemProps {
22
22
  }>;
23
23
  /** Number of likes */
24
24
  likeCount?: Maybe<number>;
25
+ /** when true, shows a skeleton in place of content */
26
+ loading?: boolean;
25
27
  /** Number of reviews */
26
28
  reviewCount?: Maybe<number>;
27
29
  /** Callback for when the DishCard is clicked */
@@ -1,5 +1,8 @@
1
1
  /// <reference types="react" />
2
2
  export interface MenuSectionProps {
3
+ /** when true, will render a skeleton in place of the section title */
4
+ loading?: boolean;
5
+ /** the name of a section, will render as the section's title */
3
6
  name: string;
4
7
  children: React.ReactNode;
5
8
  }
package/build/index.es.js CHANGED
@@ -47,6 +47,7 @@ import '@material-ui/core/Tabs';
47
47
  import MuiToggleButton from '@material-ui/lab/ToggleButton';
48
48
  import MuiToggleButtonGroup from '@material-ui/lab/ToggleButtonGroup';
49
49
  import MuiTooltip from '@material-ui/core/Tooltip';
50
+ import { Skeleton } from '@material-ui/lab';
50
51
  import MuiRadioGroup from '@material-ui/core/RadioGroup';
51
52
 
52
53
  /*! *****************************************************************************
@@ -135,6 +136,7 @@ var useDishCardStyles = makeStyles(function (theme) {
135
136
  _b.overflow = 'visible',
136
137
  _b),
137
138
  cardTitle: {
139
+ flexGrow: 1,
138
140
  fontWeight: 500,
139
141
  fontSize: 18,
140
142
  lineHeight: '27px',
@@ -623,7 +625,8 @@ var classNames$1 = classnames$1.exports;
623
625
  var iconStaticClassName = 'pop-icon';
624
626
  var Icon = function (props) {
625
627
  var icon = props.icon, className = props.className, restProps = __rest(props, ["icon", "className"]);
626
- if (!restProps['aria-label'] && restProps['aria-hidden'] === undefined) {
628
+ var hasAccessibleAttr = Boolean(restProps['aria-describedby'] || restProps['aria-label']);
629
+ if (!hasAccessibleAttr && restProps['aria-hidden'] === undefined) {
627
630
  restProps['aria-hidden'] = true;
628
631
  }
629
632
  var classes = useIconStyles(props);
@@ -1373,23 +1376,24 @@ StatusTag.defaultProps = {
1373
1376
  StatusTag.displayName = 'StatusTag';
1374
1377
 
1375
1378
  var MenuItem = forwardRef(function (props, ref) {
1376
- var onClick = props.onClick, id = props.id, title = props.title, description = props.description, isOutOfStock = props.isOutOfStock;
1379
+ var onClick = props.onClick, id = props.id, description = props.description, isOutOfStock = props.isOutOfStock, title = props.title, loading = props.loading;
1377
1380
  var classes = useDishCardStyles(props);
1378
1381
  var handleClick = function (event) {
1379
1382
  onClick(id, event);
1380
1383
  };
1381
1384
  return (React__default.createElement(Card, { className: classes.card, ref: ref, elevation: 0, "data-component-type": "menu-item" },
1382
- React__default.createElement(CardActionArea, { className: classes.cardActionArea, onClick: handleClick },
1385
+ React__default.createElement(CardActionArea, { className: classes.cardActionArea, onClick: handleClick, disabled: loading },
1383
1386
  React__default.createElement(MenuItemInfo, null,
1384
1387
  React__default.createElement(Box, { display: "flex", gridGap: 8, alignItems: "center" },
1385
- React__default.createElement(Typography$1, { className: classes.cardTitle }, title),
1388
+ React__default.createElement(Typography$1, { className: classes.cardTitle }, loading ? React__default.createElement(Skeleton, null) : title),
1386
1389
  isOutOfStock && React__default.createElement(StatusTag, { color: "warning", label: "Out of stock", variant: "outlined", size: "sm" })),
1387
- React__default.createElement(Typography$1, { className: classes.cardDescription, paragraph: true }, description),
1388
- React__default.createElement(MenuItemReactions, { likeCount: props.likeCount, reviewCount: props.reviewCount }),
1389
- React__default.createElement(Box, { display: "flex", justifyContent: "space-between", alignItems: "end", flexGrow: 1 },
1390
+ React__default.createElement(Typography$1, { className: classes.cardDescription, paragraph: true }, loading ? React__default.createElement(Skeleton, null) : description),
1391
+ loading ? (React__default.createElement(Skeleton, null,
1392
+ React__default.createElement(MenuItemReactions, { likeCount: props.likeCount, reviewCount: props.reviewCount }))) : (React__default.createElement(MenuItemReactions, { likeCount: props.likeCount, reviewCount: props.reviewCount })),
1393
+ loading ? (React__default.createElement(Skeleton, { style: { flexGrow: 1 }, width: 100, height: 48 })) : (React__default.createElement(Box, { display: "flex", justifyContent: "space-between", alignItems: "end", flexGrow: 1 },
1390
1394
  React__default.createElement(MenuItemPrice, { price: props.price, available: props.available }),
1391
- React__default.createElement(MenuItemTags, { itemTags: props.itemTags }))),
1392
- React__default.createElement(MenuItemImg, { image: props.image }))));
1395
+ React__default.createElement(MenuItemTags, { itemTags: props.itemTags })))),
1396
+ loading ? React__default.createElement(Skeleton, { height: 100, width: 100 }) : React__default.createElement(MenuItemImg, { image: props.image }))));
1393
1397
  });
1394
1398
  MenuItem.displayName = 'MenuItem';
1395
1399
 
@@ -1955,6 +1959,7 @@ var useSelectableChipStyles = makeStyles(function (theme) { return ({
1955
1959
  minHeight: 'unset',
1956
1960
  opacity: 'unset',
1957
1961
  textTransform: 'none',
1962
+ textAlign: 'left',
1958
1963
  '&::-webkit-scrollbar': {
1959
1964
  display: 'none',
1960
1965
  },
@@ -2041,11 +2046,11 @@ var useStyles$2 = makeStyles$1(function () { return ({
2041
2046
  }); });
2042
2047
 
2043
2048
  var MenuSection = forwardRef(function (props, ref) {
2044
- var name = props.name, children = props.children, restProps = __rest$1(props, ["name", "children"]);
2049
+ var name = props.name, children = props.children, loading = props.loading, restProps = __rest$1(props, ["name", "children", "loading"]);
2045
2050
  var classes = useStyles$2();
2046
2051
  return (React__default.createElement(Box, __assign$1({}, restProps, { ref: ref, component: 'section' }, { "data-component-type": "menu-section" }),
2047
2052
  React__default.createElement(Box, { marginTop: 1, marginBottom: 4 },
2048
- React__default.createElement(Typography$1, { component: "h2", className: classes.title }, name)),
2053
+ React__default.createElement(Typography$1, { component: "h2", className: classes.title }, loading ? React__default.createElement(Skeleton, null) : name)),
2049
2054
  children));
2050
2055
  });
2051
2056
  MenuSection.displayName = 'MenuSection';
@@ -2087,8 +2092,8 @@ var DialogTitle = function (props) {
2087
2092
  React__default.createElement(Box, { display: "flex", alignItems: "center", gridGap: 16 },
2088
2093
  Icon && Icon,
2089
2094
  React__default.createElement(Typography$1, { component: "h1", variant: "h6" }, title)),
2090
- React__default.createElement(IconButton$1, { color: "inherit", className: classes.closeButton, "aria-label": "Close dialog", onClick: onClose },
2091
- React__default.createElement(SvgX, null))));
2095
+ onClose && (React__default.createElement(IconButton$1, { color: "inherit", className: classes.closeButton, "aria-label": "Close dialog", onClick: onClose },
2096
+ React__default.createElement(SvgX, null)))));
2092
2097
  };
2093
2098
 
2094
2099
  var DialogSection = function (props) {