@popmenu/ordering-ui 0.104.0 → 0.106.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.
@@ -15,6 +15,10 @@ export interface LocationCardProps extends Omit<MuiCardProps, 'onClick'> {
15
15
  distance?: string;
16
16
  /** Callback for when the LocationCard is clicked */
17
17
  onClick: (value: number) => void;
18
+ /** Disables the card and adds out of range message */
19
+ outOfRange: boolean;
20
+ /** Message for out of range locations */
21
+ outOfRangeMessage: string;
18
22
  /** Sets card selection state */
19
23
  selected?: boolean;
20
24
  /** The value of a card in respects to selection state. */
package/build/index.es.js CHANGED
@@ -1,4 +1,4 @@
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, TextField, RadioGroup, FormControlLabel as FormControlLabel$1, Radio as Radio$2, FormGroup, Checkbox as Checkbox$2, useMediaQuery, Menu, 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, TextField, RadioGroup, FormControlLabel as FormControlLabel$1, Radio as Radio$2, FormGroup, Checkbox as Checkbox$2, CardContent, useMediaQuery, Menu, 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, createContext, createElement, useContext, useState } from 'react';
@@ -10,10 +10,10 @@ import '@material-ui/core/Badge';
10
10
  import '@material-ui/core/Button';
11
11
  import '@material-ui/core/CircularProgress';
12
12
  import '@material-ui/core/ButtonGroup';
13
- import Card$1 from '@material-ui/core/Card';
14
- import CardActionArea$1 from '@material-ui/core/CardActionArea';
13
+ import '@material-ui/core/Card';
14
+ import '@material-ui/core/CardActionArea';
15
15
  import '@material-ui/core/CardActions';
16
- import CardContent from '@material-ui/core/CardContent';
16
+ import '@material-ui/core/CardContent';
17
17
  import '@material-ui/core/CardHeader';
18
18
  import '@material-ui/core/CardMedia';
19
19
  import MuiCheckbox from '@material-ui/core/Checkbox';
@@ -352,6 +352,31 @@ function SvgHeart(props) {
352
352
  })));
353
353
  }
354
354
 
355
+ var _g$2l, _defs$1s;
356
+
357
+ function _extends$4l() { _extends$4l = 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$4l.apply(this, arguments); }
358
+
359
+ function SvgInfo(props) {
360
+ return /*#__PURE__*/React.createElement("svg", _extends$4l({
361
+ viewBox: "0 0 16 16",
362
+ fill: "none",
363
+ strokeLinecap: "round",
364
+ strokeLinejoin: "round",
365
+ width: "1em",
366
+ height: "1em"
367
+ }, props), _g$2l || (_g$2l = /*#__PURE__*/React.createElement("g", {
368
+ clipPath: "url(#info_svg__clip0_8_5377)",
369
+ stroke: "currentColor"
370
+ }, /*#__PURE__*/React.createElement("path", {
371
+ d: "M8 14.667A6.667 6.667 0 108 1.334a6.667 6.667 0 000 13.333zm0-4V8m0-2.667h.007"
372
+ }))), _defs$1s || (_defs$1s = /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("clipPath", {
373
+ id: "info_svg__clip0_8_5377"
374
+ }, /*#__PURE__*/React.createElement("path", {
375
+ fill: "currentColor",
376
+ d: "M0 0h16v16H0z"
377
+ })))));
378
+ }
379
+
355
380
  var _g$2k;
356
381
 
357
382
  function _extends$4k() { _extends$4k = 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$4k.apply(this, arguments); }
@@ -1896,23 +1921,26 @@ var DishModifierCard = function (props) {
1896
1921
  DishModifierCard.displayName = 'DishModifierCard';
1897
1922
 
1898
1923
  var useLocationCardStyles = makeStyles(function (theme) {
1899
- var _a = theme.palette, info = _a.info, grey = _a.grey, secondary = _a.secondary, spacing = theme.spacing;
1900
- var selectedBackgroundColor = lighten(theme.palette.info.light, 0.9);
1901
- var backgroundColor = theme.palette.background.default;
1924
+ var _a = theme.palette, info = _a.info, grey = _a.grey, secondary = _a.secondary, background = _a.background, spacing = theme.spacing;
1925
+ var selectedBackgroundColor = lighten(info.light, 0.9);
1926
+ var backgroundColor = background.default;
1902
1927
  return {
1903
1928
  root: {
1904
- background: '#FFF',
1905
1929
  border: function (_a) {
1906
1930
  var selected = _a.selected;
1907
1931
  return selected ? "1px solid " + info.light : '1px solid var(--surfaces-card-stroke, #E0E0E0)';
1908
1932
  },
1909
1933
  display: 'flex',
1910
- cursor: 'pointer',
1911
1934
  borderRadius: '10px',
1912
1935
  color: grey[900],
1913
1936
  backgroundColor: function (_a) {
1914
- var selected = _a.selected;
1915
- return (selected ? selectedBackgroundColor : backgroundColor);
1937
+ var selected = _a.selected, outOfRange = _a.outOfRange;
1938
+ return selected ? selectedBackgroundColor : outOfRange ? grey[200] : backgroundColor;
1939
+ },
1940
+ },
1941
+ actionAreaFocusHighlight: {
1942
+ '&:disabled': {
1943
+ backgroundColor: 'inherit',
1916
1944
  },
1917
1945
  },
1918
1946
  availability: {
@@ -1946,30 +1974,36 @@ var useLocationCardStyles = makeStyles(function (theme) {
1946
1974
  fontSize: '1.125rem',
1947
1975
  fontWeight: 500,
1948
1976
  },
1977
+ greyText: {
1978
+ color: grey[800],
1979
+ },
1949
1980
  };
1950
1981
  });
1951
1982
 
1952
1983
  var LocationCard = function (props) {
1953
- 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"]);
1984
+ 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, outOfRange = props.outOfRange, outOfRangeMessage = props.outOfRangeMessage, CardActionAreaProps = props.CardActionAreaProps, muiProps = __rest$1(props, ["name", "address", "distance", "generalAvailability", "pickupAvailability", "deliveryAvailability", "onClick", "selected", "value", "outOfRange", "outOfRangeMessage", "CardActionAreaProps"]);
1954
1985
  var classes = useLocationCardStyles(props);
1955
1986
  var anyAvailability = generalAvailability || pickupAvailability || deliveryAvailability;
1956
1987
  var handleClick = function () {
1957
1988
  onClick(value);
1958
1989
  };
1959
- return (React__default.createElement(Card$1, __assign$1({ className: classes.root }, muiProps),
1960
- React__default.createElement(CardActionArea$1, __assign$1({ onClick: handleClick, role: "checkbox", "aria-checked": selected }, CardActionAreaProps),
1990
+ return (React__default.createElement(Card, __assign$1({ className: classes.root }, muiProps),
1991
+ React__default.createElement(CardActionArea, __assign$1({ onClick: handleClick, role: "checkbox", "aria-checked": selected, disabled: outOfRange, classes: { focusHighlight: classes.actionAreaFocusHighlight } }, CardActionAreaProps),
1961
1992
  React__default.createElement(CardContent, { className: classes.content },
1962
1993
  React__default.createElement(Box, { className: classes.locationInfo },
1963
1994
  React__default.createElement(Box, { display: "flex", justifyContent: "space-between" },
1964
- React__default.createElement(Typography, { className: classes.name }, name),
1995
+ React__default.createElement(Typography$1, { className: classes.name }, name),
1965
1996
  selected && React__default.createElement(Icon, { icon: SvgCheck, size: "extra-large", className: classes.checkIcon })),
1966
- address && (React__default.createElement(Typography, { color: "grey.800", variant: "body2" }, address)),
1967
- React__default.createElement(Typography, { className: classes.distance }, distance)),
1997
+ address && (React__default.createElement(Typography$1, { className: classes.greyText, variant: "body2" }, address)),
1998
+ !outOfRange && React__default.createElement(Typography$1, { className: classes.distance }, distance)),
1968
1999
  anyAvailability && (React__default.createElement(Box, { className: classes.availability },
1969
2000
  React__default.createElement(Icon, { icon: SvgClock, size: "large" }),
1970
- generalAvailability && (React__default.createElement(Typography, { className: classes.availabilityMessage, variant: "body2" }, generalAvailability)),
1971
- pickupAvailability && (React__default.createElement(Typography, { className: classes.availabilityMessage, variant: "body2" }, pickupAvailability)),
1972
- deliveryAvailability && (React__default.createElement(Typography, { className: classes.availabilityMessage, variant: "body2" }, deliveryAvailability))))))));
2001
+ generalAvailability && (React__default.createElement(Typography$1, { className: classes.availabilityMessage, variant: "body2" }, generalAvailability)),
2002
+ pickupAvailability && (React__default.createElement(Typography$1, { className: classes.availabilityMessage, variant: "body2" }, pickupAvailability)),
2003
+ deliveryAvailability && (React__default.createElement(Typography$1, { className: classes.availabilityMessage, variant: "body2" }, deliveryAvailability)))),
2004
+ outOfRange && (React__default.createElement(Box, { display: "flex", gridGap: 8, alignItems: "center", color: "grey.800" },
2005
+ React__default.createElement(Icon, { icon: SvgInfo, size: "large", color: "inherit" }),
2006
+ React__default.createElement(Typography$1, { variant: "body2", className: classes.greyText }, outOfRangeMessage)))))));
1973
2007
  };
1974
2008
 
1975
2009
  var useMenuDropdownStyles = makeStyles(function (theme) {