@popmenu/ordering-ui 0.99.0 → 0.100.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.
@@ -1,4 +1,3 @@
1
- import { ReactNode } from 'react';
2
1
  import { CardActionAreaProps } from '@material-ui/core';
3
2
  import { CardProps as MuiCardProps } from '@material-ui/core/Card';
4
3
  export interface LocationCardProps extends Omit<MuiCardProps, 'onClick'> {
@@ -6,18 +5,20 @@ export interface LocationCardProps extends Omit<MuiCardProps, 'onClick'> {
6
5
  name: string;
7
6
  /** Renders the address of the restaurant location */
8
7
  address?: string;
9
- /** Renders the appropriate availability of the restaurant location */
10
- availability?: string | ReactNode;
8
+ /** Renders the general availability hours of the restaurant location. */
9
+ generalAvailability?: string;
10
+ /** Renders the pickup availability hours of the restaurant location */
11
+ pickupAvailability?: string;
12
+ /** Renders the delivery availability hours of the restaurant location */
13
+ deliveryAvailability?: string;
11
14
  /** Renders the distance of the restaurant location (if applicable) */
12
15
  distance?: string;
13
16
  /** Callback for when the LocationCard is clicked */
14
- onClick: (value: string) => void;
17
+ onClick: (value: number) => void;
15
18
  /** Sets card selection state */
16
19
  selected?: boolean;
17
20
  /** The value of a card in respects to selection state. */
18
- value: string;
21
+ value: number;
19
22
  /** Props passed to the CardActionArea rendered by SelectableCard. */
20
23
  CardActionAreaProps?: CardActionAreaProps;
21
- /** Unique label for the location card */
22
- labelId: string;
23
24
  }
@@ -32,4 +32,6 @@ export interface MenuItemProps {
32
32
  available: boolean;
33
33
  /** Renders out of stock tag */
34
34
  isOutOfStock?: Maybe<boolean>;
35
+ /** Renders the featured tag when true */
36
+ isFeatured?: Maybe<boolean>;
35
37
  }
@@ -4,7 +4,7 @@ export interface StatusTagProps {
4
4
  /** Renders the message of the tag */
5
5
  label: string;
6
6
  /** Renders the color of the tag */
7
- color: 'default' | 'error' | 'warning';
7
+ color: 'default' | 'error' | 'warning' | 'highlight';
8
8
  /** Changes the padding sizes */
9
9
  size?: 'md' | 'sm';
10
10
  }
package/build/index.es.js CHANGED
@@ -1374,6 +1374,10 @@ var useStatusTagStyles = makeStyles(function (theme) { return ({
1374
1374
  borderColor: theme.palette.error.main,
1375
1375
  color: theme.palette.error.main,
1376
1376
  },
1377
+ highlight: {
1378
+ backgroundColor: theme.palette.warning.light,
1379
+ color: theme.palette.grey[900],
1380
+ },
1377
1381
  }); });
1378
1382
 
1379
1383
  var classnames = {exports: {}};
@@ -1449,7 +1453,7 @@ StatusTag.defaultProps = {
1449
1453
  StatusTag.displayName = 'StatusTag';
1450
1454
 
1451
1455
  var MenuItem = forwardRef(function (props, ref) {
1452
- var onClick = props.onClick, id = props.id, description = props.description, isOutOfStock = props.isOutOfStock, title = props.title, loading = props.loading;
1456
+ var onClick = props.onClick, id = props.id, description = props.description, isOutOfStock = props.isOutOfStock, title = props.title, loading = props.loading, isFeatured = props.isFeatured;
1453
1457
  var classes = useMenuItemStyles(props);
1454
1458
  var handleClick = function (event) {
1455
1459
  onClick(id, event);
@@ -1457,6 +1461,7 @@ var MenuItem = forwardRef(function (props, ref) {
1457
1461
  return (React__default.createElement(Card, { className: classes.card, ref: ref, elevation: 0, "data-component-type": "menu-item" },
1458
1462
  React__default.createElement(CardActionArea, { className: classes.cardActionArea, onClick: handleClick, disabled: loading },
1459
1463
  React__default.createElement(MenuItemInfo, null,
1464
+ isFeatured && React__default.createElement(StatusTag, { color: "highlight", label: "Featured", variant: "outlined", size: "sm" }),
1460
1465
  React__default.createElement(Box, { display: "flex", gridGap: 8, alignItems: "center" },
1461
1466
  React__default.createElement(Typography$1, { className: classes.cardTitle }, loading ? React__default.createElement(Skeleton, null) : title),
1462
1467
  isOutOfStock && React__default.createElement(StatusTag, { color: "warning", label: "Out of stock", variant: "outlined", size: "sm" })),
@@ -1878,8 +1883,12 @@ var useLocationCardStyles = makeStyles(function (theme) {
1878
1883
  },
1879
1884
  availability: {
1880
1885
  color: secondary.light,
1881
- display: 'flex',
1886
+ display: 'grid',
1882
1887
  gridGap: spacing(0.5),
1888
+ gridTemplateColumns: 'auto 1fr',
1889
+ },
1890
+ availabilityMessage: {
1891
+ gridColumn: '2 / 3',
1883
1892
  },
1884
1893
  checkIcon: {
1885
1894
  color: info.main,
@@ -1910,13 +1919,14 @@ var useLocationCardStyles = makeStyles(function (theme) {
1910
1919
  });
1911
1920
 
1912
1921
  var LocationCard = function (props) {
1913
- var name = props.name, address = props.address, distance = props.distance, availability = props.availability, onClick = props.onClick, selected = props.selected, value = props.value, labelId = props.labelId, CardActionAreaProps = props.CardActionAreaProps, muiProps = __rest$1(props, ["name", "address", "distance", "availability", "onClick", "selected", "value", "labelId", "CardActionAreaProps"]);
1922
+ var name = props.name, address = props.address, distance = props.distance, generalAvailability = props.generalAvailability, pickupAvailability = props.pickupAvailability, deliveryAvailability = props.deliveryAvailability, onClick = props.onClick, selected = props.selected, value = props.value, CardActionAreaProps = props.CardActionAreaProps, muiProps = __rest$1(props, ["name", "address", "distance", "generalAvailability", "pickupAvailability", "deliveryAvailability", "onClick", "selected", "value", "CardActionAreaProps"]);
1914
1923
  var classes = useLocationCardStyles(props);
1924
+ var anyAvailability = generalAvailability || pickupAvailability || deliveryAvailability;
1915
1925
  var handleClick = function () {
1916
1926
  onClick(value);
1917
1927
  };
1918
1928
  return (React__default.createElement(Card$1, __assign$1({ className: classes.root }, muiProps),
1919
- React__default.createElement(CardActionArea$1, __assign$1({ onClick: handleClick, classes: { focusHighlight: classes.focusHighlight }, role: "checkbox", "aria-checked": selected, "aria-labelledby": labelId }, CardActionAreaProps),
1929
+ React__default.createElement(CardActionArea$1, __assign$1({ onClick: handleClick, classes: { focusHighlight: classes.focusHighlight }, role: "checkbox", "aria-checked": selected }, CardActionAreaProps),
1920
1930
  React__default.createElement(CardContent, { className: classes.content },
1921
1931
  React__default.createElement(Box, { className: classes.locationInfo },
1922
1932
  React__default.createElement(Box, { display: "flex", justifyContent: "space-between" },
@@ -1924,9 +1934,11 @@ var LocationCard = function (props) {
1924
1934
  selected && React__default.createElement(Icon, { icon: SvgCheck, size: "extra-large", className: classes.checkIcon })),
1925
1935
  address && (React__default.createElement(Typography, { className: classes.address, variant: "body2" }, address)),
1926
1936
  React__default.createElement(Typography, { className: classes.distance }, distance)),
1927
- availability && (React__default.createElement(Box, { className: classes.availability },
1937
+ anyAvailability && (React__default.createElement(Box, { className: classes.availability },
1928
1938
  React__default.createElement(Icon, { icon: SvgClock, size: "large" }),
1929
- React__default.createElement(Typography, { variant: "body2" }, availability)))))));
1939
+ generalAvailability && (React__default.createElement(Typography, { className: classes.availabilityMessage, variant: "body2" }, generalAvailability)),
1940
+ pickupAvailability && (React__default.createElement(Typography, { className: classes.availabilityMessage, variant: "body2" }, pickupAvailability)),
1941
+ deliveryAvailability && (React__default.createElement(Typography, { className: classes.availabilityMessage, variant: "body2" }, deliveryAvailability))))))));
1930
1942
  };
1931
1943
 
1932
1944
  var useMenuDropdownStyles = makeStyles(function (theme) {