@popmenu/ordering-ui 0.116.1 → 0.117.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.
|
@@ -57,10 +57,15 @@ export declare type DishModifierCardProps = {
|
|
|
57
57
|
};
|
|
58
58
|
/** Handles the dialog change for nested modifiers */
|
|
59
59
|
handleOptionsClick: (id: number) => void;
|
|
60
|
+
/** Used by parent modifier quantity tracking: parent modifier quantity denotes requiredSelectionCount and currentSelectionCount is the total quantity of the child modifier */
|
|
61
|
+
selectionQuantity: Record<number, {
|
|
62
|
+
requiredSelectionCount: number;
|
|
63
|
+
currentSelectionCount: number;
|
|
64
|
+
}>;
|
|
60
65
|
};
|
|
61
66
|
export declare type RadioModifierFormProps = Base;
|
|
62
67
|
export declare type CheckboxModifierFormProps = Base & {
|
|
63
68
|
disableNewSelections?: boolean;
|
|
64
69
|
};
|
|
65
|
-
export declare type ModifierOptionsControlProps = Pick<DishModifierCardProps, 'value' | 'modifiers' | 'isOutOfStock' | 'onChange' | 'disableNewSelections' | 'type' | 'messages' | 'handleOptionsClick' | 'aggregatePrice'>;
|
|
70
|
+
export declare type ModifierOptionsControlProps = Pick<DishModifierCardProps, 'value' | 'modifiers' | 'isOutOfStock' | 'onChange' | 'disableNewSelections' | 'type' | 'messages' | 'handleOptionsClick' | 'aggregatePrice' | 'selectionQuantity'>;
|
|
66
71
|
export {};
|
package/build/index.es.js
CHANGED
|
@@ -1910,7 +1910,7 @@ var MultipleSelectControl = function (props) {
|
|
|
1910
1910
|
}))));
|
|
1911
1911
|
};
|
|
1912
1912
|
var MultipleQuantitySelectControl = function (props) {
|
|
1913
|
-
var modifiers = props.modifiers, isOutOfStock = props.isOutOfStock, onChange = props.onChange, disableNewSelections = props.disableNewSelections;
|
|
1913
|
+
var modifiers = props.modifiers, isOutOfStock = props.isOutOfStock, onChange = props.onChange, disableNewSelections = props.disableNewSelections, handleOptionsClick = props.handleOptionsClick, selectionQuantity = props.selectionQuantity;
|
|
1914
1914
|
var makeHandleChange = function (modifier) { return function (_e, customEvent) {
|
|
1915
1915
|
onChange({
|
|
1916
1916
|
isRadio: false,
|
|
@@ -1922,12 +1922,22 @@ var MultipleQuantitySelectControl = function (props) {
|
|
|
1922
1922
|
});
|
|
1923
1923
|
}; };
|
|
1924
1924
|
return (React__default.createElement(FormControl, { fullWidth: true },
|
|
1925
|
-
React__default.createElement(FormGroup, null, modifiers.map(function (modifier) { return (React__default.createElement(Box, { key: modifier.id, style: { justifyContent: 'space-between',
|
|
1925
|
+
React__default.createElement(FormGroup, null, modifiers.map(function (modifier) { return (React__default.createElement(Box, { key: modifier.id, style: { justifyContent: 'space-between', flexDirection: 'column' }, display: "flex" },
|
|
1926
1926
|
React__default.createElement(Box, { display: "flex", alignItems: "center", justifyContent: "space-between", width: "100%" },
|
|
1927
1927
|
React__default.createElement(Label, { name: modifier.name, price: modifier.formattedPrice, disabled: isOutOfStock || modifier.outOfStock }),
|
|
1928
1928
|
modifier.outOfStock && (React__default.createElement(Box, { minWidth: "90px", marginLeft: 2 },
|
|
1929
1929
|
React__default.createElement(StatusTag, { color: "warning", label: "Out of stock", variant: "outlined", size: "md" }))),
|
|
1930
|
-
!modifier.outOfStock && (React__default.createElement(QuantityPicker, { variation: "modifierCount", value: modifier.quantity, disableIncrement: disableNewSelections, preventManualChange: true, onChange: makeHandleChange(modifier), disabled: isOutOfStock || modifier.outOfStock })))
|
|
1930
|
+
!modifier.outOfStock && (React__default.createElement(QuantityPicker, { variation: "modifierCount", value: modifier.quantity, disableIncrement: disableNewSelections, preventManualChange: true, onChange: makeHandleChange(modifier), disabled: isOutOfStock || modifier.outOfStock }))),
|
|
1931
|
+
React__default.createElement(Box, { display: "flex", alignItems: "flex-start", gridGap: 4 },
|
|
1932
|
+
modifier.hasModifiers && !modifier.outOfStock && (React__default.createElement(Options, { handleOptionsClick: function () { return handleOptionsClick(modifier.id); } })),
|
|
1933
|
+
selectionQuantity[modifier.id] &&
|
|
1934
|
+
selectionQuantity[modifier.id].requiredSelectionCount > 0 &&
|
|
1935
|
+
selectionQuantity[modifier.id].requiredSelectionCount !==
|
|
1936
|
+
selectionQuantity[modifier.id].currentSelectionCount && (React__default.createElement(Typography$1, { variant: "caption", color: "error" },
|
|
1937
|
+
selectionQuantity[modifier.id].currentSelectionCount,
|
|
1938
|
+
"/",
|
|
1939
|
+
selectionQuantity[modifier.id].requiredSelectionCount,
|
|
1940
|
+
" selected"))))); }))));
|
|
1931
1941
|
};
|
|
1932
1942
|
var ModifierControls = function (props) {
|
|
1933
1943
|
switch (props.type) {
|
|
@@ -1965,7 +1975,7 @@ var getStatusTagProps = function (props) {
|
|
|
1965
1975
|
return { color: color, label: label, variant: variant };
|
|
1966
1976
|
};
|
|
1967
1977
|
var DishModifierCard = function (props) {
|
|
1968
|
-
var aggregatePrice = props.aggregatePrice, 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, handleOptionsClick = props.handleOptionsClick;
|
|
1978
|
+
var aggregatePrice = props.aggregatePrice, 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, handleOptionsClick = props.handleOptionsClick, selectionQuantity = props.selectionQuantity;
|
|
1969
1979
|
var classes = useDishModifierCardStyles();
|
|
1970
1980
|
return (React__default.createElement(Box, { className: classes.root },
|
|
1971
1981
|
React__default.createElement(Box, { display: "flex", justifyContent: "space-between", width: "100%", alignItems: "center", height: "fit-content", marginBottom: 2 },
|
|
@@ -1973,7 +1983,7 @@ var DishModifierCard = function (props) {
|
|
|
1973
1983
|
!isOutOfStock && (React__default.createElement(Typography, { variant: "subtitle1", className: error ? classes.error : undefined }, messages.helperText))),
|
|
1974
1984
|
React__default.createElement(Typography, { className: classes.name }, name),
|
|
1975
1985
|
React__default.createElement(Box, null,
|
|
1976
|
-
React__default.createElement(ModifierControls, { value: value, modifiers: modifiers, isOutOfStock: isOutOfStock, onChange: onChange, disableNewSelections: disableNewSelections, type: type, messages: messages, handleOptionsClick: handleOptionsClick, aggregatePrice: aggregatePrice }))));
|
|
1986
|
+
React__default.createElement(ModifierControls, { value: value, modifiers: modifiers, isOutOfStock: isOutOfStock, onChange: onChange, disableNewSelections: disableNewSelections, type: type, messages: messages, handleOptionsClick: handleOptionsClick, aggregatePrice: aggregatePrice, selectionQuantity: selectionQuantity }))));
|
|
1977
1987
|
};
|
|
1978
1988
|
DishModifierCard.displayName = 'DishModifierCard';
|
|
1979
1989
|
|