@popmenu/ordering-ui 0.80.0 → 0.81.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,5 +1,6 @@
1
1
  declare type ModifierValue = {
2
2
  id: number | string;
3
+ price?: number | null;
3
4
  quantity?: number;
4
5
  };
5
6
  declare type Modifier = {
package/build/index.es.js CHANGED
@@ -1511,7 +1511,15 @@ var CheckboxGroup = function (props) {
1511
1511
  var value = props.value, modifiers = props.modifiers, onChange = props.onChange, disableNewSelections = props.disableNewSelections;
1512
1512
  var classes = useCheckboxModifierFormStyles();
1513
1513
  var handleChange = function (event) {
1514
- onChange([{ id: parseInt(event.target.value), quantity: 1 }], event.target.checked);
1514
+ var _a;
1515
+ var price = (_a = modifiers.find(function (modifier) { return modifier.id === parseInt(event.target.value); })) === null || _a === void 0 ? void 0 : _a.price;
1516
+ onChange([
1517
+ {
1518
+ id: parseInt(event.target.value),
1519
+ price: (price && parseInt(price)) || 0,
1520
+ quantity: 1,
1521
+ },
1522
+ ], event.target.checked);
1515
1523
  };
1516
1524
  return (React.createElement(Box, { display: "flex", flexDirection: "column" }, modifiers.map(function (modifier, index) {
1517
1525
  var targetValue = value === null || value === void 0 ? void 0 : value.find(function (v) { return v.id == modifier.id; });
@@ -1522,7 +1530,15 @@ var RadioGroup = function (props) {
1522
1530
  var value = props.value, modifiers = props.modifiers, onChange = props.onChange;
1523
1531
  var classes = useRadioModifierFormStyles();
1524
1532
  var handleChange = function (event) {
1525
- onChange([{ id: parseInt(event.target.value), quantity: 1 }]);
1533
+ var _a;
1534
+ var price = (_a = modifiers.find(function (modifier) { return modifier.id === parseInt(event.target.value); })) === null || _a === void 0 ? void 0 : _a.price;
1535
+ onChange([
1536
+ {
1537
+ id: parseInt(event.target.value),
1538
+ price: (price && parseInt(price)) || 0,
1539
+ quantity: 1,
1540
+ },
1541
+ ]);
1526
1542
  };
1527
1543
  return (React.createElement(MuiRadioGroup, { name: "selectedModifiers", value: value ? value[0].id : '', onChange: handleChange }, modifiers.map(function (modifier, index) { return (React.createElement(FormControlLabel$1, { key: index, value: modifier.id, control: React.createElement(Radio$1, { className: classes.radio }), label: React.createElement(Label, { name: modifier.name, price: modifier.price }), className: classes.root })); })));
1528
1544
  };