@popmenu/ordering-ui 0.90.0 → 0.91.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,25 +1,30 @@
1
- declare type ModifierValue = {
2
- id: number;
3
- price?: number;
4
- quantity?: number;
1
+ export declare type ModifierValue = Pick<Modifier, 'id' | 'price'> & {
2
+ quantity: number;
5
3
  };
6
- declare type Modifier = {
4
+ export declare type Modifier = {
7
5
  id: number;
8
6
  name: string;
9
7
  outOfStock: boolean;
10
- price?: string;
8
+ price: number;
9
+ formattedPrice: string;
10
+ quantity: number;
11
11
  };
12
- declare type OnChange = (value: Array<ModifierValue>, checked?: boolean) => void;
13
12
  interface Base {
14
13
  /** Modifier options */
15
14
  modifiers: Array<Modifier>;
16
15
  /** The values of the modifier form */
17
- value: Array<ModifierValue> | undefined;
16
+ value: Array<ModifierValue>;
18
17
  /** Handles the change event */
19
- onChange: OnChange;
18
+ onChange: (value: Array<ModifierValue>) => void;
20
19
  isOutOfStock: boolean;
21
20
  }
22
- export declare type DishModifierCardProps = Base & {
21
+ export declare type DishModifierCardProps = {
22
+ /** Modifier options */
23
+ modifiers: Array<Modifier>;
24
+ /** The values of the modifier form */
25
+ value: Array<ModifierValue>;
26
+ /** Handles the change event */
27
+ onChange: (value: Array<ModifierValue>) => void;
23
28
  /** Name of the modifier */
24
29
  name: string;
25
30
  /** Denotes the max amount of selections have been reached */
@@ -30,7 +35,8 @@ export declare type DishModifierCardProps = Base & {
30
35
  isRequired: boolean;
31
36
  /** Denotes if modifier is out of stock */
32
37
  isOutOfStock: boolean;
33
- type: 'singleSelect' | 'multipleSelect';
38
+ /** Selection type for modifier group */
39
+ type: 'singleSelect' | 'multipleSelect' | 'multipleQuantitySelect';
34
40
  /** Renders the text of the dish modifiers */
35
41
  messages: {
36
42
  optionalText: string;
@@ -43,8 +49,5 @@ export declare type RadioModifierFormProps = Base;
43
49
  export declare type CheckboxModifierFormProps = Base & {
44
50
  disableNewSelections?: boolean;
45
51
  };
46
- export declare type ModifierOptionsControlProps = Base & {
47
- disableNewSelections?: boolean;
48
- type: 'singleSelect' | 'multipleSelect';
49
- };
52
+ export declare type ModifierOptionsControlProps = Pick<DishModifierCardProps, 'value' | 'modifiers' | 'isOutOfStock' | 'onChange' | 'disableNewSelections' | 'type' | 'messages'>;
50
53
  export {};
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { ModifierOptionsControlProps } from './DishModifierCardProps';
3
+ export declare const ModifierControls: (props: ModifierOptionsControlProps) => JSX.Element | null;
@@ -1,2 +1,5 @@
1
+ import { QuantityPickerProps } from './QuantityPickerProps';
1
2
  export declare const useQuantityPickerStyles: (props?: any) => import("@material-ui/styles").ClassNameMap<"root">;
2
- export declare const useQuantityInputStyles: (props?: any) => import("@material-ui/styles").ClassNameMap<"root" | "input" | "adornedStart" | "adornedEnd">;
3
+ export declare const useQuantityInputStyles: (props: QuantityPickerProps) => import("@material-ui/styles").ClassNameMap<string>;
4
+ export declare const useStartAdornmentStyles: (props: QuantityPickerProps) => import("@material-ui/styles").ClassNameMap<string>;
5
+ export declare const useEndAdornmentStyles: (props: QuantityPickerProps) => import("@material-ui/styles").ClassNameMap<string>;
@@ -1,13 +1,19 @@
1
+ import React, { ChangeEvent } from 'react';
1
2
  export declare type QuantityChangeEvent = {
2
- target: {
3
- value: number;
4
- };
3
+ quantity: number;
4
+ reason: string;
5
5
  };
6
6
  export interface QuantityPickerProps {
7
7
  /** Callback for when the quantity is increased or decreased for the parent form */
8
- onChange: (event: QuantityChangeEvent, reason: string) => void;
8
+ onChange: (event: ChangeEvent<HTMLInputElement> | React.MouseEvent<HTMLButtonElement, MouseEvent>, customEvent: QuantityChangeEvent) => void;
9
9
  /** the quantity represented by the picker */
10
10
  value: number;
11
11
  /** determines if picker is active */
12
12
  disabled?: boolean;
13
+ /** limits the quantity picker from increasing the value */
14
+ disableIncrement?: boolean;
15
+ /** prevents a uer from typing a new value, forcing them to use the increment/decrement buttons */
16
+ preventManualChange?: boolean;
17
+ /** indicates how the quantity picker will be used and changes styles accordingly */
18
+ variation: 'itemCount' | 'modifierCount';
13
19
  }
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, 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, TextField, RadioGroup, FormControlLabel as FormControlLabel$1, Radio as Radio$2, FormGroup, Checkbox as Checkbox$2, 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, createElement, createContext, useContext, useState } from 'react';
@@ -48,7 +48,6 @@ 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
50
  import { Skeleton } from '@material-ui/lab';
51
- import MuiRadioGroup from '@material-ui/core/RadioGroup';
52
51
 
53
52
  /*! *****************************************************************************
54
53
  Copyright (c) Microsoft Corporation.
@@ -86,6 +85,16 @@ function __rest$1(s, e) {
86
85
  t[p[i]] = s[p[i]];
87
86
  }
88
87
  return t;
88
+ }
89
+
90
+ function __spreadArray(to, from, pack) {
91
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
92
+ if (ar || !(i in from)) {
93
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
94
+ ar[i] = from[i];
95
+ }
96
+ }
97
+ return to.concat(ar || from);
89
98
  }
90
99
 
91
100
  var Button = forwardRef(function (props, ref) {
@@ -931,10 +940,10 @@ var useTypographyStyles = makeStyles(function (theme) {
931
940
  });
932
941
 
933
942
  var Typography = function (props) {
934
- props.weight; props.color; var restProps = __rest(props, ["weight", "color"]);
943
+ props.weight; props.color; var TypographyRef = props.TypographyRef, restProps = __rest(props, ["weight", "color", "TypographyRef"]);
935
944
  var classes = useTypographyStyles(__assign({}, props));
936
945
  var variantMapping = { subtitle1: 'p' };
937
- return React__default.createElement(Typography$1, __assign({ classes: classes, variantMapping: variantMapping }, restProps));
946
+ return React__default.createElement(Typography$1, __assign({ classes: classes, variantMapping: variantMapping, ref: TypographyRef }, restProps));
938
947
  };
939
948
  Typography.displayName = 'Typography';
940
949
  Typography.defaultProps = defaultTypographyProps;
@@ -1595,98 +1604,190 @@ var useLabelStyles = makeStyles(function (theme) { return ({
1595
1604
  },
1596
1605
  }); });
1597
1606
 
1607
+ var useQuantityPickerStyles = makeStyles(function (theme) { return ({
1608
+ root: {
1609
+ height: theme.spacing(7),
1610
+ backgroundColor: 'none',
1611
+ },
1612
+ }); });
1613
+ var useQuantityInputStyles = makeStyles(function (theme) { return ({
1614
+ root: {
1615
+ height: '100%',
1616
+ width: 'min-content',
1617
+ borderRadius: theme.spacing(12.5),
1618
+ background: function (props) { return (props.variation === 'modifierCount' ? 'unset' : theme.palette.grey[100]); },
1619
+ },
1620
+ input: {
1621
+ '&::-webkit-clear-button, &::-webkit-outer-spin-button, &::-webkit-inner-spin-button': {
1622
+ display: 'none',
1623
+ },
1624
+ '-moz-appearance': 'textfield',
1625
+ fontWeight: 600,
1626
+ padding: 0,
1627
+ textAlign: 'center',
1628
+ zIndex: function (props) { return (props.value === 0 && props.variation === 'modifierCount' ? -1 : 1); },
1629
+ backgroundColor: function (props) { return (props.variation === 'modifierCount' ? theme.palette.grey[100] : 'unset'); },
1630
+ alignSelf: function (props) { return (props.variation === 'modifierCount' ? 'stretch' : 'unset'); },
1631
+ height: function (props) { return (props.variation === 'modifierCount' ? 'auto' : 'unset'); },
1632
+ minWidth: function (props) { return (props.variation === 'modifierCount' ? theme.spacing(5) : theme.spacing(2.75)); },
1633
+ borderRadius: function (props) { return (props.variation === 'modifierCount' ? theme.spacing(1) : 'unset'); },
1634
+ margin: function (props) { return (props.variation === 'modifierCount' ? theme.spacing(0.5, 0) : 0); },
1635
+ },
1636
+ }); });
1637
+ var useStartAdornmentStyles = makeStyles(function (theme) { return ({
1638
+ root: {
1639
+ color: theme.palette.text.primary,
1640
+ zIndex: function (props) { return (props.value === 0 && props.variation === 'modifierCount' ? -1 : 1); },
1641
+ },
1642
+ }); });
1643
+ var useEndAdornmentStyles = makeStyles(function (theme) { return ({
1644
+ root: {
1645
+ color: theme.palette.text.primary,
1646
+ },
1647
+ }); });
1648
+
1649
+ var QuantityPicker = function (props) {
1650
+ var value = props.value, onChange = props.onChange, disabled = props.disabled, disableIncrement = props.disableIncrement, preventManualChange = props.preventManualChange, variation = props.variation;
1651
+ var fieldClasses = useQuantityPickerStyles();
1652
+ var inputClasses = useQuantityInputStyles(props);
1653
+ var startAdornmentClasses = useStartAdornmentStyles(props);
1654
+ var endAdornmentClasses = useEndAdornmentStyles(props);
1655
+ var onIncrement = function (event) {
1656
+ onChange(event, { quantity: value + 1, reason: 'increment' });
1657
+ };
1658
+ var onDecrement = function (event) {
1659
+ onChange(event, { quantity: value - 1, reason: 'decrement' });
1660
+ };
1661
+ var handleChange = function (event) {
1662
+ if (preventManualChange) {
1663
+ event.preventDefault();
1664
+ }
1665
+ if (!preventManualChange) {
1666
+ onChange(event, { quantity: parseInt(event.target.value), reason: 'change' });
1667
+ }
1668
+ };
1669
+ return (React__default.createElement(TextField, { classes: fieldClasses, type: "number", variant: variation === 'itemCount' ? 'filled' : 'standard', defaultValue: value, value: value, disabled: disabled, onChange: handleChange, InputProps: {
1670
+ classes: inputClasses,
1671
+ disableUnderline: true,
1672
+ endAdornment: (React__default.createElement(IconButton, { className: endAdornmentClasses.root, color: "default", tabIndex: -1, onClick: onIncrement, disabled: disabled || disableIncrement },
1673
+ React__default.createElement(Icon, { icon: SvgPlusCircle }))),
1674
+ startAdornment: (React__default.createElement(IconButton, { className: startAdornmentClasses.root, color: "default", tabIndex: -1, onClick: onDecrement, disabled: disabled || value <= 0 },
1675
+ React__default.createElement(Icon, { icon: SvgMinusCircle }))),
1676
+ } }));
1677
+ };
1678
+
1598
1679
  var Label = function (props) {
1599
- var name = props.name, price = props.price, disabled = props.disabled, isOutOfStock = props.isOutOfStock;
1680
+ var name = props.name, price = props.price, outOfStock = props.outOfStock, messages = props.messages;
1600
1681
  var classes = useLabelStyles();
1601
1682
  return (React__default.createElement(Box, { display: "flex", flexDirection: "column", className: classes.label },
1602
1683
  React__default.createElement(Box, { display: "flex", alignItems: "center", gridGap: 8 },
1603
1684
  React__default.createElement(Typography$1, null, name),
1604
- !isOutOfStock && disabled && (React__default.createElement(Typography$1, { variant: "caption", className: classes.outOfStock }, "Out of stock"))),
1605
- price && React__default.createElement(Typography$1, { className: !disabled ? classes.price : '' },
1685
+ outOfStock && (React__default.createElement(Typography$1, { variant: "caption", className: classes.outOfStock }, messages.outOfStockText))),
1686
+ price && React__default.createElement(Typography$1, null,
1606
1687
  "+ ",
1607
1688
  price)));
1608
1689
  };
1609
- var CheckboxGroup = function (props) {
1610
- var value = props.value, modifiers = props.modifiers, onChange = props.onChange, disableNewSelections = props.disableNewSelections, isOutOfStock = props.isOutOfStock;
1611
- var classes = useCheckboxModifierFormStyles();
1612
- var appContext = useOrderingAppContext()[0];
1613
- var handleChange = function (event) {
1614
- var _a;
1615
- var price = (_a = modifiers.find(function (modifier) { return modifier.id === parseInt(event.target.value); })) === null || _a === void 0 ? void 0 : _a.price;
1690
+ var SingleSelectModifierControl = function (props) {
1691
+ var modifiers = props.modifiers, isOutOfStock = props.isOutOfStock, onChange = props.onChange, value = props.value, messages = props.messages;
1692
+ var radioClasses = useRadioModifierFormStyles();
1693
+ var makeHandleChange = function (modifier) { return function (e) {
1616
1694
  onChange([
1617
1695
  {
1618
- id: parseInt(event.target.value),
1619
- price: (price && parseInt(price)) || 0,
1620
- quantity: 1,
1621
- },
1622
- ], event.target.checked);
1623
- };
1624
- return (React__default.createElement(Box, { display: "flex", flexDirection: "column" }, modifiers.map(function (modifier, index) {
1625
- var targetValue = value === null || value === void 0 ? void 0 : value.find(function (v) { return v.id == modifier.id; });
1626
- return (React__default.createElement(FormControlLabel$1, { key: index, value: modifier.id, control: React__default.createElement(Checkbox$2, { className: classes.radio, disabled: (!targetValue && disableNewSelections) || isOutOfStock || modifier.outOfStock }), label: React__default.createElement(Label, { name: modifier.name, price: modifier.price
1627
- ? "" + (appContext && appContext.currencySymbol) + Number(modifier.price).toFixed(2)
1628
- : null, disabled: isOutOfStock || modifier.outOfStock, isOutOfStock: isOutOfStock }), className: classes.root, checked: !!targetValue, onChange: handleChange }));
1629
- })));
1630
- };
1631
- var RadioGroup = function (props) {
1632
- var value = props.value, modifiers = props.modifiers, onChange = props.onChange, isOutOfStock = props.isOutOfStock;
1633
- var classes = useRadioModifierFormStyles();
1634
- var appContext = useOrderingAppContext()[0];
1635
- var handleChange = function (event) {
1636
- var _a;
1637
- var price = (_a = modifiers.find(function (modifier) { return modifier.id === parseInt(event.target.value); })) === null || _a === void 0 ? void 0 : _a.price;
1638
- onChange([
1639
- {
1640
- id: parseInt(event.target.value),
1641
- price: (price && parseInt(price)) || 0,
1696
+ id: Number(e.target.value),
1697
+ price: modifier.price,
1642
1698
  quantity: 1,
1643
1699
  },
1644
1700
  ]);
1645
- };
1646
- return (React__default.createElement(MuiRadioGroup, { name: "selectedModifiers", value: value ? value[0].id : '', onChange: handleChange }, modifiers.map(function (modifier, index) { return (React__default.createElement(FormControlLabel$1, { key: index, value: modifier.id, control: React__default.createElement(Radio$2, { className: classes.radio, disabled: isOutOfStock || modifier.outOfStock }), label: React__default.createElement(Label, { name: modifier.name, price: modifier.price ? "" + (appContext && appContext.currencySymbol) + Number(modifier.price).toFixed(2) : null, disabled: isOutOfStock || modifier.outOfStock, isOutOfStock: isOutOfStock }) })); })));
1647
- };
1648
-
1649
- var ModifierOptionsControl = function (props) {
1650
- var type = props.type, modifiers = props.modifiers, value = props.value, onChange = props.onChange, disableNewSelections = props.disableNewSelections, isOutOfStock = props.isOutOfStock;
1651
- switch (type) {
1701
+ }; };
1702
+ return (React__default.createElement(FormControl, { fullWidth: true },
1703
+ React__default.createElement(RadioGroup, null, modifiers.map(function (modifier) {
1704
+ var _a;
1705
+ return (React__default.createElement(FormControlLabel$1, { key: modifier.id, value: modifier.id, control: React__default.createElement(Radio$2, { checked: ((_a = value[0]) === null || _a === void 0 ? void 0 : _a.id) === modifier.id, className: radioClasses.radio, disabled: isOutOfStock || modifier.outOfStock, onChange: makeHandleChange(modifier) }), label: React__default.createElement(Label, { messages: messages, name: modifier.name, price: modifier.formattedPrice, disabled: isOutOfStock || modifier.outOfStock, outOfStock: isOutOfStock }) }));
1706
+ }))));
1707
+ };
1708
+ var MultipleSelectControl = function (props) {
1709
+ var modifiers = props.modifiers, value = props.value, isOutOfStock = props.isOutOfStock, onChange = props.onChange, messages = props.messages, disableNewSelections = props.disableNewSelections;
1710
+ var classes = useCheckboxModifierFormStyles();
1711
+ var makeHandleChange = function (modifier) { return function () {
1712
+ var isModifierInValue = Boolean(value.find(function (v) { return v.id === modifier.id; }));
1713
+ if (isModifierInValue) {
1714
+ onChange(value.filter(function (v) { return v.id !== modifier.id; }));
1715
+ }
1716
+ else {
1717
+ onChange(__spreadArray(__spreadArray([], value), [{ id: modifier.id, price: modifier.price || 0, quantity: 1 }]));
1718
+ }
1719
+ }; };
1720
+ return (React__default.createElement(FormControl, { fullWidth: true },
1721
+ React__default.createElement(FormGroup, null, modifiers.map(function (modifier) { return (React__default.createElement(FormControlLabel$1, { key: modifier.id, value: modifier.id, className: classes.root, checked: value.some(function (v) { return v.id === modifier.id; }), onChange: makeHandleChange(modifier), control: React__default.createElement(Checkbox$2, { className: classes.radio, disabled: isOutOfStock || modifier.outOfStock || (!modifier.quantity && disableNewSelections) }), label: React__default.createElement(Label, { messages: messages, name: modifier.name, price: modifier.formattedPrice, disabled: isOutOfStock || modifier.outOfStock, outOfStock: isOutOfStock }) })); }))));
1722
+ };
1723
+ var MultipleQuantitySelectControl = function (props) {
1724
+ var modifiers = props.modifiers, value = props.value, isOutOfStock = props.isOutOfStock, onChange = props.onChange, messages = props.messages, disableNewSelections = props.disableNewSelections;
1725
+ var makeHandleChange = function (modifier) { return function (_e, customEvent) {
1726
+ var isModifierInValue = Boolean(value.find(function (v) { return v.id === modifier.id; }));
1727
+ var isQuantityZero = customEvent.quantity === 0;
1728
+ var shouldRemoveModifierFromValue = isModifierInValue && isQuantityZero;
1729
+ var shouldAddModifierToValue = !isModifierInValue && !isQuantityZero;
1730
+ var shouldUpdateModifierInValue = isModifierInValue && !isQuantityZero;
1731
+ if (shouldRemoveModifierFromValue) {
1732
+ onChange(value.filter(function (v) { return v.id !== modifier.id; }));
1733
+ }
1734
+ if (shouldAddModifierToValue) {
1735
+ onChange(__spreadArray(__spreadArray([], value), [{ id: modifier.id, price: modifier.price, quantity: customEvent.quantity }]));
1736
+ }
1737
+ if (shouldUpdateModifierInValue) {
1738
+ onChange(value.map(function (val) { return (val.id === modifier.id ? __assign$1(__assign$1({}, val), { quantity: customEvent.quantity }) : val); }));
1739
+ }
1740
+ }; };
1741
+ return (React__default.createElement(FormControl, { fullWidth: true },
1742
+ React__default.createElement(FormGroup, null, modifiers.map(function (modifier) { return (React__default.createElement(Box, { key: modifier.id, style: { justifyContent: 'space-between' }, display: "flex" },
1743
+ React__default.createElement(Label, { messages: messages, name: modifier.name, price: modifier.formattedPrice, disabled: isOutOfStock || modifier.outOfStock, outOfStock: isOutOfStock }),
1744
+ React__default.createElement(QuantityPicker, { variation: "modifierCount", value: modifier.quantity, disableIncrement: disableNewSelections, preventManualChange: true, onChange: makeHandleChange(modifier) }))); }))));
1745
+ };
1746
+ var ModifierControls = function (props) {
1747
+ switch (props.type) {
1652
1748
  case 'singleSelect':
1653
- return React__default.createElement(RadioGroup, { modifiers: modifiers, value: value, onChange: onChange, isOutOfStock: isOutOfStock });
1749
+ return React__default.createElement(SingleSelectModifierControl, __assign$1({}, props));
1654
1750
  case 'multipleSelect':
1655
- return (React__default.createElement(CheckboxGroup, { modifiers: modifiers, value: value, onChange: onChange, disableNewSelections: disableNewSelections, isOutOfStock: isOutOfStock }));
1751
+ return React__default.createElement(MultipleSelectControl, __assign$1({}, props));
1752
+ case 'multipleQuantitySelect':
1753
+ return React__default.createElement(MultipleQuantitySelectControl, __assign$1({}, props));
1656
1754
  default:
1657
1755
  return null;
1658
1756
  }
1659
1757
  };
1660
1758
 
1661
- var DishModifierCard = function (props) {
1662
- var name = props.name, disableNewSelections = props.disableNewSelections, modifiers = props.modifiers, value = props.value, messages = props.messages, onChange = props.onChange, type = props.type, error = props.error, isRequired = props.isRequired, isOutOfStock = props.isOutOfStock;
1663
- var optionalText = messages.optionalText, outOfStockText = messages.outOfStockText, requiredText = messages.requiredText, helperText = messages.helperText;
1664
- var isFullyOutOfStock = isOutOfStock || !modifiers.some(function (modifier) { return !modifier.outOfStock; });
1665
- var classes = useDishModifierCardStyles();
1759
+ var getStatusTagProps = function (props) {
1760
+ var messages = props.messages, error = props.error, isRequired = props.isRequired, isOutOfStock = props.isOutOfStock;
1761
+ var optionalText = messages.optionalText, outOfStockText = messages.outOfStockText, requiredText = messages.requiredText;
1666
1762
  var color = 'default';
1667
1763
  switch (true) {
1668
1764
  case error:
1669
1765
  color = 'error';
1670
- case isFullyOutOfStock:
1766
+ case isOutOfStock:
1671
1767
  color = 'warning';
1672
1768
  }
1673
1769
  var label = optionalText;
1674
1770
  switch (true) {
1675
- case isFullyOutOfStock:
1771
+ case isOutOfStock:
1676
1772
  label = outOfStockText;
1677
1773
  break;
1678
1774
  case isRequired:
1679
1775
  label = requiredText;
1680
1776
  break;
1681
1777
  }
1778
+ var variant = isRequired || isOutOfStock ? 'outlined' : 'filled';
1779
+ return { color: color, label: label, variant: variant };
1780
+ };
1781
+ var DishModifierCard = function (props) {
1782
+ var name = props.name, disableNewSelections = props.disableNewSelections, modifiers = props.modifiers, value = props.value, messages = props.messages, onChange = props.onChange, type = props.type, error = props.error, isOutOfStock = props.isOutOfStock;
1783
+ var classes = useDishModifierCardStyles();
1682
1784
  return (React__default.createElement(Box, { className: classes.root },
1683
1785
  React__default.createElement(Box, { display: "flex", justifyContent: "space-between", width: "100%", alignItems: "center", height: "fit-content", marginBottom: 2 },
1684
- React__default.createElement(StatusTag, { variant: isRequired || isFullyOutOfStock ? 'outlined' : 'filled', label: label, color: color }),
1685
- !isFullyOutOfStock && (React__default.createElement(Typography, { variant: "subtitle1", className: error ? classes.error : undefined }, helperText))),
1786
+ React__default.createElement(StatusTag, __assign$1({}, getStatusTagProps(props))),
1787
+ !isOutOfStock && (React__default.createElement(Typography, { variant: "subtitle1", className: error ? classes.error : undefined }, messages.helperText))),
1686
1788
  React__default.createElement(Typography, { className: classes.name }, name),
1687
1789
  React__default.createElement(Box, null,
1688
- React__default.createElement(FormControl, null,
1689
- React__default.createElement(ModifierOptionsControl, { type: type, modifiers: modifiers, value: value, onChange: onChange, disableNewSelections: disableNewSelections, isOutOfStock: isFullyOutOfStock })))));
1790
+ React__default.createElement(ModifierControls, { value: value, modifiers: modifiers, isOutOfStock: isOutOfStock, onChange: onChange, disableNewSelections: disableNewSelections, type: type, messages: messages }))));
1690
1791
  };
1691
1792
  DishModifierCard.displayName = 'DishModifierCard';
1692
1793
 
@@ -1906,61 +2007,6 @@ var MenuFilter = function (props) {
1906
2007
  React__default.createElement(Typography, { variant: "body1", color: "grey.500" }, noOptionsLabel)))))));
1907
2008
  };
1908
2009
 
1909
- var useQuantityPickerStyles = makeStyles(function (theme) { return ({
1910
- root: {
1911
- height: theme.spacing(7),
1912
- },
1913
- }); });
1914
- var useQuantityInputStyles = makeStyles(function (theme) { return ({
1915
- root: {
1916
- height: '100%',
1917
- width: 'min-content',
1918
- borderRadius: theme.spacing(12.5),
1919
- background: theme.palette.grey[100],
1920
- },
1921
- input: {
1922
- '&::-webkit-clear-button, &::-webkit-outer-spin-button, &::-webkit-inner-spin-button': {
1923
- display: 'none',
1924
- },
1925
- '-moz-appearance': 'textfield',
1926
- fontWeight: 600,
1927
- minWidth: theme.spacing(2.75),
1928
- padding: 0,
1929
- textAlign: 'center',
1930
- position: 'relative',
1931
- left: 1,
1932
- },
1933
- adornedStart: {
1934
- padding: theme.spacing(0.25),
1935
- },
1936
- adornedEnd: {
1937
- padding: theme.spacing(0.5),
1938
- },
1939
- }); });
1940
-
1941
- var QuantityPicker = function (props) {
1942
- var value = props.value, onChange = props.onChange, disabled = props.disabled;
1943
- var fieldClasses = useQuantityPickerStyles();
1944
- var inputClasses = useQuantityInputStyles();
1945
- var onIncrement = function () {
1946
- onChange({ target: { value: value + 1 } }, 'increment');
1947
- };
1948
- var onDecrement = function () {
1949
- onChange({ target: { value: value - 1 } }, 'decrement');
1950
- };
1951
- var handleChange = function (event) {
1952
- onChange({ target: { value: parseInt(event.target.value) } }, 'change');
1953
- };
1954
- return (React__default.createElement(TextField, { classes: __assign$1({}, fieldClasses), variant: "filled", type: "number", defaultValue: value, value: value, disabled: disabled, onChange: handleChange, InputProps: {
1955
- classes: __assign$1({}, inputClasses),
1956
- disableUnderline: true,
1957
- endAdornment: (React__default.createElement(IconButton, { color: "default", tabIndex: -1, onClick: onIncrement, disabled: disabled },
1958
- React__default.createElement(Icon, { icon: SvgPlusCircle }))),
1959
- startAdornment: (React__default.createElement(IconButton, { color: "default", tabIndex: -1, onClick: onDecrement, disabled: disabled },
1960
- React__default.createElement(Icon, { icon: SvgMinusCircle }))),
1961
- } }));
1962
- };
1963
-
1964
2010
  var useSelectableChipStyles = makeStyles(function (theme) { return ({
1965
2011
  root: {
1966
2012
  border: '2px solid',