@popmenu/ordering-ui 0.84.0 → 0.84.2
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.
- package/build/components/DishCheckoutCard/DishCheckoutCardProps.d.ts +3 -3
- package/build/components/DishModifierCard/DishModifierCard.styles.d.ts +1 -0
- package/build/components/DishModifierCard/DishModifierCardProps.d.ts +1 -0
- package/build/index.es.js +30 -32
- package/build/index.es.js.map +1 -1
- package/build/index.js +30 -32
- package/build/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -9,14 +9,14 @@ export interface DishCheckoutCardProps {
|
|
|
9
9
|
name: string;
|
|
10
10
|
/** Quantity of dish selected */
|
|
11
11
|
quantity: number;
|
|
12
|
-
/** Price of
|
|
12
|
+
/** Price of an item. numbers will be prepended with the currencySymbol from OrderingAppContext. */
|
|
13
13
|
price: number | string;
|
|
14
14
|
/** Callback for edit button */
|
|
15
15
|
onEdit: () => void;
|
|
16
16
|
/** Callback for delete button */
|
|
17
17
|
onDelete: () => void;
|
|
18
|
-
/** Callback
|
|
19
|
-
|
|
18
|
+
/** Callback for change of select element */
|
|
19
|
+
onQuantityChange: (id: number, value: number) => void;
|
|
20
20
|
/** Special instructions text */
|
|
21
21
|
specialInstructions?: string | null;
|
|
22
22
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export declare const useDishModifierCardStyles: (props?: any) => import("@material-ui/styles").ClassNameMap<string>;
|
|
2
2
|
export declare const useRadioModifierFormStyles: (props?: any) => import("@material-ui/styles").ClassNameMap<string>;
|
|
3
3
|
export declare const useCheckboxModifierFormStyles: (props?: any) => import("@material-ui/styles").ClassNameMap<string>;
|
|
4
|
+
export declare const useLabelStyles: (props?: any) => import("@material-ui/styles").ClassNameMap<string>;
|
package/build/index.es.js
CHANGED
|
@@ -1297,11 +1297,14 @@ var OrderingAppContextProvider = function (props) {
|
|
|
1297
1297
|
|
|
1298
1298
|
var DishCheckoutCard = function (props) {
|
|
1299
1299
|
var _a;
|
|
1300
|
-
var id = props.id, name = props.name, quantity = props.quantity, modifiers = props.modifiers, onDelete = props.onDelete, onEdit = props.onEdit,
|
|
1300
|
+
var id = props.id, name = props.name, quantity = props.quantity, modifiers = props.modifiers, onDelete = props.onDelete, onEdit = props.onEdit, onQuantityChange = props.onQuantityChange, price = props.price, specialInstructions = props.specialInstructions, disabled = props.disabled;
|
|
1301
1301
|
var classes = useDishCheckoutCardStyles(props);
|
|
1302
1302
|
var appContext = useOrderingAppContext()[0];
|
|
1303
1303
|
var _b = useState(false), open = _b[0], setOpen = _b[1];
|
|
1304
1304
|
var formattedPrice = typeof price === 'number' ? "" + ((_a = appContext.currencySymbol) !== null && _a !== void 0 ? _a : '') + price.toFixed(2) : price;
|
|
1305
|
+
var handleQuantityChange = function (event) {
|
|
1306
|
+
return onQuantityChange(id, parseInt(event.target.value, 10));
|
|
1307
|
+
};
|
|
1305
1308
|
return (React__default.createElement(Box, { className: classes.root },
|
|
1306
1309
|
React__default.createElement(Box, { display: "flex", justifyContent: "space-between", gridGap: 3 },
|
|
1307
1310
|
React__default.createElement(Box, null,
|
|
@@ -1321,7 +1324,7 @@ var DishCheckoutCard = function (props) {
|
|
|
1321
1324
|
React__default.createElement(Icon, { icon: SvgTrash, size: "large" })))),
|
|
1322
1325
|
React__default.createElement(Box, { display: "flex", gridGap: 16, alignItems: "center" },
|
|
1323
1326
|
React__default.createElement(FormControl, { variant: "outlined", hiddenLabel: true },
|
|
1324
|
-
React__default.createElement(Select, { disabled: disabled, open: open, value: quantity, labelId: "select-label-" + id, onClick: function () { return setOpen(!open); }, disableUnderline: true, onChange:
|
|
1327
|
+
React__default.createElement(Select, { disabled: disabled, open: open, value: quantity, labelId: "select-label-" + id, onClick: function () { return setOpen(!open); }, disableUnderline: true, onChange: handleQuantityChange, fullWidth: true, startAdornment: React__default.createElement(InputAdornment, { position: "start" },
|
|
1325
1328
|
React__default.createElement(Icon, { icon: open ? SvgChevronUp : SvgChevronDown, size: "large" })), inputProps: { shrink: false }, MenuProps: {
|
|
1326
1329
|
disablePortal: true,
|
|
1327
1330
|
anchorOrigin: {
|
|
@@ -1376,14 +1379,6 @@ var useDishModifierCardStyles = makeStyles(function (theme) { return ({
|
|
|
1376
1379
|
},
|
|
1377
1380
|
}); });
|
|
1378
1381
|
var useRadioModifierFormStyles = makeStyles(function (theme) { return ({
|
|
1379
|
-
root: {
|
|
1380
|
-
'& .MuiFormControlLabel-label': {
|
|
1381
|
-
margin: theme.spacing(0.5, 0),
|
|
1382
|
-
'& div p:nth-child(2)': {
|
|
1383
|
-
color: theme.palette.grey[700],
|
|
1384
|
-
},
|
|
1385
|
-
},
|
|
1386
|
-
},
|
|
1387
1382
|
radio: {
|
|
1388
1383
|
fontSize: theme.spacing(2),
|
|
1389
1384
|
padding: 'unset',
|
|
@@ -1394,14 +1389,6 @@ var useRadioModifierFormStyles = makeStyles(function (theme) { return ({
|
|
|
1394
1389
|
},
|
|
1395
1390
|
}); });
|
|
1396
1391
|
var useCheckboxModifierFormStyles = makeStyles(function (theme) { return ({
|
|
1397
|
-
root: {
|
|
1398
|
-
'& .MuiFormControlLabel-label': {
|
|
1399
|
-
margin: theme.spacing(0.5, 0),
|
|
1400
|
-
},
|
|
1401
|
-
'&:not(.Mui-disabled) div p:nth-child(2)': {
|
|
1402
|
-
color: theme.palette.grey[700],
|
|
1403
|
-
},
|
|
1404
|
-
},
|
|
1405
1392
|
radio: {
|
|
1406
1393
|
color: '#616161',
|
|
1407
1394
|
fontSize: theme.spacing(2),
|
|
@@ -1411,6 +1398,14 @@ var useCheckboxModifierFormStyles = makeStyles(function (theme) { return ({
|
|
|
1411
1398
|
color: theme.palette.info.main,
|
|
1412
1399
|
},
|
|
1413
1400
|
},
|
|
1401
|
+
}); });
|
|
1402
|
+
var useLabelStyles = makeStyles(function (theme) { return ({
|
|
1403
|
+
label: {
|
|
1404
|
+
margin: theme.spacing(0.5, 0),
|
|
1405
|
+
},
|
|
1406
|
+
price: {
|
|
1407
|
+
color: theme.palette.grey[700],
|
|
1408
|
+
},
|
|
1414
1409
|
}); });
|
|
1415
1410
|
|
|
1416
1411
|
var useStatusTagStyles = makeStyles(function (theme) { return ({
|
|
@@ -1515,15 +1510,16 @@ StatusTag.defaultProps = {
|
|
|
1515
1510
|
StatusTag.displayName = 'StatusTag';
|
|
1516
1511
|
|
|
1517
1512
|
var Label = function (props) {
|
|
1518
|
-
var name = props.name, price = props.price;
|
|
1519
|
-
|
|
1513
|
+
var name = props.name, price = props.price, disabled = props.disabled;
|
|
1514
|
+
var classes = useLabelStyles();
|
|
1515
|
+
return (React__default.createElement(Box, { display: "flex", flexDirection: "column", className: classes.label },
|
|
1520
1516
|
React__default.createElement(Typography$1, null, name),
|
|
1521
|
-
price && React__default.createElement(Typography$1,
|
|
1517
|
+
price && React__default.createElement(Typography$1, { className: !disabled ? classes.price : '' },
|
|
1522
1518
|
"+ ",
|
|
1523
1519
|
price)));
|
|
1524
1520
|
};
|
|
1525
1521
|
var CheckboxGroup = function (props) {
|
|
1526
|
-
var value = props.value, modifiers = props.modifiers, onChange = props.onChange, disableNewSelections = props.disableNewSelections;
|
|
1522
|
+
var value = props.value, modifiers = props.modifiers, onChange = props.onChange, disableNewSelections = props.disableNewSelections, isOutOfStock = props.isOutOfStock;
|
|
1527
1523
|
var classes = useCheckboxModifierFormStyles();
|
|
1528
1524
|
var appContext = useOrderingAppContext()[0];
|
|
1529
1525
|
var handleChange = function (event) {
|
|
@@ -1539,13 +1535,13 @@ var CheckboxGroup = function (props) {
|
|
|
1539
1535
|
};
|
|
1540
1536
|
return (React__default.createElement(Box, { display: "flex", flexDirection: "column" }, modifiers.map(function (modifier, index) {
|
|
1541
1537
|
var targetValue = value === null || value === void 0 ? void 0 : value.find(function (v) { return v.id == modifier.id; });
|
|
1542
|
-
return (React__default.createElement(FormControlLabel$1, { key: index, value: modifier.id, control: React__default.createElement(Checkbox$1, { className: classes.radio, disabled: !targetValue && disableNewSelections }), label: React__default.createElement(Label, { name: modifier.name, price: modifier.price
|
|
1538
|
+
return (React__default.createElement(FormControlLabel$1, { key: index, value: modifier.id, control: React__default.createElement(Checkbox$1, { className: classes.radio, disabled: (!targetValue && disableNewSelections) || isOutOfStock }), label: React__default.createElement(Label, { name: modifier.name, price: modifier.price
|
|
1543
1539
|
? "" + (appContext && appContext.currencySymbol) + Number(modifier.price).toFixed(2)
|
|
1544
|
-
: null }), className: classes.root, checked: !!targetValue, onChange: handleChange }));
|
|
1540
|
+
: null, disabled: isOutOfStock }), className: classes.root, checked: !!targetValue, onChange: handleChange }));
|
|
1545
1541
|
})));
|
|
1546
1542
|
};
|
|
1547
1543
|
var RadioGroup = function (props) {
|
|
1548
|
-
var value = props.value, modifiers = props.modifiers, onChange = props.onChange;
|
|
1544
|
+
var value = props.value, modifiers = props.modifiers, onChange = props.onChange, isOutOfStock = props.isOutOfStock;
|
|
1549
1545
|
var classes = useRadioModifierFormStyles();
|
|
1550
1546
|
var appContext = useOrderingAppContext()[0];
|
|
1551
1547
|
var handleChange = function (event) {
|
|
@@ -1559,16 +1555,16 @@ var RadioGroup = function (props) {
|
|
|
1559
1555
|
},
|
|
1560
1556
|
]);
|
|
1561
1557
|
};
|
|
1562
|
-
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$1, { className: classes.radio }), label: React__default.createElement(Label, { name: modifier.name, price: modifier.price ? "" + (appContext && appContext.currencySymbol) + Number(modifier.price).toFixed(2) : null
|
|
1558
|
+
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$1, { className: classes.radio, disabled: isOutOfStock }), label: React__default.createElement(Label, { name: modifier.name, price: modifier.price ? "" + (appContext && appContext.currencySymbol) + Number(modifier.price).toFixed(2) : null, disabled: isOutOfStock }) })); })));
|
|
1563
1559
|
};
|
|
1564
1560
|
|
|
1565
1561
|
var ModifierOptionsControl = function (props) {
|
|
1566
|
-
var type = props.type, modifiers = props.modifiers, value = props.value, onChange = props.onChange, disableNewSelections = props.disableNewSelections;
|
|
1562
|
+
var type = props.type, modifiers = props.modifiers, value = props.value, onChange = props.onChange, disableNewSelections = props.disableNewSelections, isOutOfStock = props.isOutOfStock;
|
|
1567
1563
|
switch (type) {
|
|
1568
1564
|
case 'singleSelect':
|
|
1569
|
-
return React__default.createElement(RadioGroup, { modifiers: modifiers, value: value, onChange: onChange });
|
|
1565
|
+
return React__default.createElement(RadioGroup, { modifiers: modifiers, value: value, onChange: onChange, isOutOfStock: isOutOfStock });
|
|
1570
1566
|
case 'multipleSelect':
|
|
1571
|
-
return (React__default.createElement(CheckboxGroup, { modifiers: modifiers, value: value, onChange: onChange, disableNewSelections: disableNewSelections }));
|
|
1567
|
+
return (React__default.createElement(CheckboxGroup, { modifiers: modifiers, value: value, onChange: onChange, disableNewSelections: disableNewSelections, isOutOfStock: isOutOfStock }));
|
|
1572
1568
|
default:
|
|
1573
1569
|
return null;
|
|
1574
1570
|
}
|
|
@@ -1587,10 +1583,12 @@ var DishModifierCard = function (props) {
|
|
|
1587
1583
|
}
|
|
1588
1584
|
var label = optionalText;
|
|
1589
1585
|
switch (true) {
|
|
1590
|
-
case isRequired:
|
|
1591
|
-
label = requiredText;
|
|
1592
1586
|
case isOutOfStock:
|
|
1593
1587
|
label = outOfStockText;
|
|
1588
|
+
break;
|
|
1589
|
+
case isRequired:
|
|
1590
|
+
label = requiredText;
|
|
1591
|
+
break;
|
|
1594
1592
|
}
|
|
1595
1593
|
return (React__default.createElement(Box, { className: classes.root },
|
|
1596
1594
|
React__default.createElement(Box, { display: "flex", justifyContent: "space-between", width: "100%", alignItems: "center", height: "fit-content" },
|
|
@@ -1601,7 +1599,7 @@ var DishModifierCard = function (props) {
|
|
|
1601
1599
|
React__default.createElement(Typography, { variant: "subtitle1", className: error ? classes.error : undefined }, helperText)),
|
|
1602
1600
|
React__default.createElement(Box, null,
|
|
1603
1601
|
React__default.createElement(FormControl, null,
|
|
1604
|
-
React__default.createElement(ModifierOptionsControl, { type: type, modifiers: modifiers, value: value, onChange: onChange, disableNewSelections: disableNewSelections })))));
|
|
1602
|
+
React__default.createElement(ModifierOptionsControl, { type: type, modifiers: modifiers, value: value, onChange: onChange, disableNewSelections: disableNewSelections, isOutOfStock: isOutOfStock })))));
|
|
1605
1603
|
};
|
|
1606
1604
|
DishModifierCard.displayName = 'DishModifierCard';
|
|
1607
1605
|
|