@popmenu/ordering-ui 0.156.1 → 0.158.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.
- package/build/cjs/components/NestedModsV2DishModifierCard/DishModifierCardProps.d.ts +3 -1
- package/build/cjs/index.js +51 -23
- package/build/cjs/index.js.map +1 -1
- package/build/esm/components/ExpandableModifierGroup/ExpandableModifierGroup.js +5 -3
- package/build/esm/components/ExpandableModifierGroup/ExpandableModifierGroup.js.map +1 -1
- package/build/esm/components/NestedModsV2DishModifierCard/DishModifierCard.styles.js +15 -2
- package/build/esm/components/NestedModsV2DishModifierCard/DishModifierCard.styles.js.map +1 -1
- package/build/esm/components/NestedModsV2DishModifierCard/DishModifierCardProps.d.ts +3 -1
- package/build/esm/components/NestedModsV2DishModifierCard/ModifierControls.js +30 -17
- package/build/esm/components/NestedModsV2DishModifierCard/ModifierControls.js.map +1 -1
- package/build/esm/components/NestedModsV2DishModifierCard/NestedModsV2DishModifierCard.js +2 -2
- package/build/esm/components/NestedModsV2DishModifierCard/NestedModsV2DishModifierCard.js.map +1 -1
- package/package.json +2 -2
|
@@ -73,9 +73,11 @@ export type NestedModsV2DishModifierCardProps = {
|
|
|
73
73
|
}>;
|
|
74
74
|
/** Optional feature-gated options for nested modifier controls */
|
|
75
75
|
modifierControlsOptions?: ModifierControlsOptions;
|
|
76
|
+
/** Optional slot rendered directly after a modifier row, keyed by the parent modifier id */
|
|
77
|
+
renderAfterModifier?: (modifierId: number) => React.ReactNode;
|
|
76
78
|
/** Removes the card border and border-radius, for use inside a container that provides its own card styling */
|
|
77
79
|
disableCardStyle?: boolean;
|
|
78
80
|
/** Hides the group name heading, useful when the name is already shown by a parent container */
|
|
79
81
|
hideName?: boolean;
|
|
80
82
|
};
|
|
81
|
-
export type ModifierOptionsControlProps = Pick<NestedModsV2DishModifierCardProps, 'value' | 'modifiers' | 'isOutOfStock' | 'isRequired' | 'onChange' | 'disableNewSelections' | 'type' | 'messages' | 'handleOptionsClick' | 'aggregatePrice' | 'selectionQuantity' | 'name' | 'modifierControlsOptions'>;
|
|
83
|
+
export type ModifierOptionsControlProps = Pick<NestedModsV2DishModifierCardProps, 'value' | 'modifiers' | 'isOutOfStock' | 'isRequired' | 'onChange' | 'disableNewSelections' | 'type' | 'messages' | 'handleOptionsClick' | 'aggregatePrice' | 'selectionQuantity' | 'name' | 'modifierControlsOptions' | 'renderAfterModifier'>;
|
package/build/cjs/index.js
CHANGED
|
@@ -1683,14 +1683,16 @@ const useExpandableModifierGroupStyles = core.makeStyles((theme) => ({
|
|
|
1683
1683
|
const ExpandableModifierGroup = ({ name, children, defaultExpanded = true, selectedSummary, }) => {
|
|
1684
1684
|
const [expanded, setExpanded] = React.useState(defaultExpanded);
|
|
1685
1685
|
const classes = useExpandableModifierGroupStyles();
|
|
1686
|
+
const generatedContentId = React.useId();
|
|
1687
|
+
const contentId = `expandable-${generatedContentId}`;
|
|
1686
1688
|
return (React.createElement("div", { className: classes.root },
|
|
1687
|
-
React.createElement("button", { className: classNames(classes.header, { [classes.headerExpanded]: expanded }), onClick: () => setExpanded((prev) => !prev), type: "button", "aria-expanded": expanded },
|
|
1689
|
+
React.createElement("button", { className: classNames(classes.header, { [classes.headerExpanded]: expanded }), onClick: () => setExpanded((prev) => !prev), type: "button", "aria-expanded": expanded, "aria-controls": contentId },
|
|
1688
1690
|
React.createElement(core.Typography, { className: classes.name }, name),
|
|
1689
1691
|
React.createElement(commonUi.Icon, { icon: webIcons.ChevronRight, className: classNames(classes.chevron, { [classes.chevronExpanded]: expanded }) })),
|
|
1690
1692
|
!expanded && selectedSummary && (React.createElement("div", { className: classes.summary },
|
|
1691
1693
|
React.createElement(commonUi.Icon, { icon: webIcons.CheckCircle, size: "medium", className: classes.summaryIcon }),
|
|
1692
1694
|
React.createElement(core.Typography, { variant: "caption", className: classes.summaryText }, selectedSummary))),
|
|
1693
|
-
React.createElement("div", { hidden: !expanded }, children)));
|
|
1695
|
+
React.createElement("div", { id: contentId, hidden: !expanded }, children)));
|
|
1694
1696
|
};
|
|
1695
1697
|
ExpandableModifierGroup.displayName = 'ExpandableModifierGroup';
|
|
1696
1698
|
|
|
@@ -1700,6 +1702,7 @@ const useDishModifierCardStyles = core.makeStyles((theme) => ({
|
|
|
1700
1702
|
flexDirection: 'column',
|
|
1701
1703
|
padding: theme.spacing(2.5),
|
|
1702
1704
|
color: `${theme.palette.grey[900]} !important`,
|
|
1705
|
+
width: '100%',
|
|
1703
1706
|
},
|
|
1704
1707
|
card: {
|
|
1705
1708
|
borderRadius: '8px',
|
|
@@ -1785,9 +1788,11 @@ const useCheckboxModifierFormStyles = core.makeStyles((theme) => ({
|
|
|
1785
1788
|
const useLabelStyles = core.makeStyles((theme) => ({
|
|
1786
1789
|
label: {
|
|
1787
1790
|
margin: theme.spacing(0.5, 0),
|
|
1791
|
+
minWidth: 0,
|
|
1788
1792
|
},
|
|
1789
1793
|
selectedLabel: {
|
|
1790
1794
|
margin: theme.spacing(0.5, 0),
|
|
1795
|
+
minWidth: 0,
|
|
1791
1796
|
},
|
|
1792
1797
|
disabled: {
|
|
1793
1798
|
color: theme.palette.grey[500],
|
|
@@ -1797,6 +1802,10 @@ const useLabelStyles = core.makeStyles((theme) => ({
|
|
|
1797
1802
|
},
|
|
1798
1803
|
selectedSummary: {
|
|
1799
1804
|
color: theme.palette.grey[700],
|
|
1805
|
+
overflow: 'hidden',
|
|
1806
|
+
overflowWrap: 'anywhere',
|
|
1807
|
+
whiteSpace: 'normal',
|
|
1808
|
+
wordBreak: 'break-word',
|
|
1800
1809
|
},
|
|
1801
1810
|
selectedSummaryInlineRow: {
|
|
1802
1811
|
alignItems: 'center',
|
|
@@ -1821,11 +1830,16 @@ const useLabelStyles = core.makeStyles((theme) => ({
|
|
|
1821
1830
|
fontWeight: theme.typography.fontWeightRegular,
|
|
1822
1831
|
lineHeight: 1.2,
|
|
1823
1832
|
overflow: 'hidden',
|
|
1824
|
-
|
|
1825
|
-
whiteSpace: '
|
|
1833
|
+
overflowWrap: 'anywhere',
|
|
1834
|
+
whiteSpace: 'normal',
|
|
1835
|
+
wordBreak: 'break-word',
|
|
1836
|
+
},
|
|
1837
|
+
disabledText: {
|
|
1838
|
+
color: theme.palette.grey[500],
|
|
1826
1839
|
},
|
|
1827
1840
|
selectedSummaryIcon: {
|
|
1828
1841
|
color: theme.palette.success.main,
|
|
1842
|
+
flexShrink: 0,
|
|
1829
1843
|
},
|
|
1830
1844
|
}));
|
|
1831
1845
|
const useOptionsStyles = core.makeStyles((theme) => ({
|
|
@@ -1838,6 +1852,7 @@ const useOptionsStyles = core.makeStyles((theme) => ({
|
|
|
1838
1852
|
inlineOptions: {
|
|
1839
1853
|
alignItems: 'center',
|
|
1840
1854
|
display: 'inline-flex',
|
|
1855
|
+
flexShrink: 0,
|
|
1841
1856
|
justifyContent: 'center',
|
|
1842
1857
|
height: 'auto',
|
|
1843
1858
|
marginBottom: 0,
|
|
@@ -1859,13 +1874,13 @@ const Label = (props) => {
|
|
|
1859
1874
|
const numericPrice = price ? parseFloat(price.replace(/[^0-9.-]/g, '')) : NaN;
|
|
1860
1875
|
const shouldHidePrice = hidePrice || !price || numericPrice === 0 || isNaN(numericPrice);
|
|
1861
1876
|
const showSelectedSummary = Boolean(enableSelectedModifierStyles && isSelected && selectedSummary);
|
|
1862
|
-
return (React.createElement(core.Box, { display: "flex", flexDirection: "column", className: classNames({ [classes.label]: !showSelectedSummary, [classes.selectedLabel]: showSelectedSummary }) },
|
|
1877
|
+
return (React.createElement(core.Box, { display: "flex", flexDirection: "column", style: { flex: 1, minWidth: 0 }, className: classNames({ [classes.label]: !showSelectedSummary, [classes.selectedLabel]: showSelectedSummary }) },
|
|
1863
1878
|
React.createElement(core.Box, { display: "flex", alignItems: "center", gridGap: 8 },
|
|
1864
1879
|
React.createElement(core.Typography, { className: classNames({
|
|
1865
1880
|
[classes.disabled]: disabled,
|
|
1866
1881
|
}) }, name)),
|
|
1867
1882
|
!shouldHidePrice && (React.createElement(core.Typography, { className: classNames({ [classes.price]: !disabled }, { [classes.disabled]: disabled }) }, `+ ${price}`)),
|
|
1868
|
-
showSelectedSummary && React.createElement(core.Typography, { className: classes.selectedSummary }, selectedSummary)));
|
|
1883
|
+
showSelectedSummary && (React.createElement(core.Typography, { className: classNames(classes.selectedSummary, { [classes.disabledText]: disabled }) }, selectedSummary))));
|
|
1869
1884
|
};
|
|
1870
1885
|
const Options = (props) => {
|
|
1871
1886
|
const { handleOptionsClick, actionLabel, hidden = false, inline = false } = props;
|
|
@@ -1879,6 +1894,9 @@ const Options = (props) => {
|
|
|
1879
1894
|
!inline && React.createElement(commonUi.Icon, { icon: webIcons.ChevronRight }))));
|
|
1880
1895
|
};
|
|
1881
1896
|
const getIsSelected = (modifierId, value) => value.some((modifierValue) => modifierValue.modifierId === modifierId && modifierValue.quantity > 0);
|
|
1897
|
+
const getIsModifierDisabled = (modifier, props, isSelected) => Boolean(props.isOutOfStock ||
|
|
1898
|
+
modifier.outOfStock ||
|
|
1899
|
+
(!isSelected && props.disableNewSelections && props.type !== 'singleSelect'));
|
|
1882
1900
|
const getActionLabel = (isSelected, props) => props.modifierControlsOptions?.showUpdateButton && isSelected ? 'UPDATE' : 'OPTIONS';
|
|
1883
1901
|
const shouldHideNestedOptionsButton = (isSelected, props) => Boolean(props.modifierControlsOptions?.hideNestedOptionsButton ||
|
|
1884
1902
|
(props.modifierControlsOptions?.enableSelectedModifierStyles && !isSelected));
|
|
@@ -1893,7 +1911,7 @@ const getModifierActionState = (modifier, isSelected, props) => ({
|
|
|
1893
1911
|
selectedSummary: props.modifierControlsOptions?.selectedNestedSummaryByModifierId?.[modifier.id],
|
|
1894
1912
|
});
|
|
1895
1913
|
const NestedModifierActions = (props) => {
|
|
1896
|
-
const { modifier, handleOptionsClick, state, renderRegularButton = true } = props;
|
|
1914
|
+
const { modifier, handleOptionsClick, state, disabled = false, renderRegularButton = true } = props;
|
|
1897
1915
|
const labelClasses = useLabelStyles();
|
|
1898
1916
|
if (!modifier.hasModifiers || modifier.outOfStock)
|
|
1899
1917
|
return null;
|
|
@@ -1901,7 +1919,7 @@ const NestedModifierActions = (props) => {
|
|
|
1901
1919
|
state.showInlineAction && state.selectedSummary && (React.createElement(core.Box, { className: labelClasses.selectedSummaryInlineRow },
|
|
1902
1920
|
React.createElement(core.Box, { className: labelClasses.selectedSummaryPrimary },
|
|
1903
1921
|
React.createElement(commonUi.Icon, { icon: webIcons.CheckCircle, size: "medium", className: labelClasses.selectedSummaryIcon }),
|
|
1904
|
-
React.createElement(core.Typography, { variant: "caption", className: labelClasses.selectedSummaryPrimaryText }, state.selectedSummary)),
|
|
1922
|
+
React.createElement(core.Typography, { variant: "caption", className: classNames(labelClasses.selectedSummaryPrimaryText, { [labelClasses.disabledText]: disabled }) }, state.selectedSummary)),
|
|
1905
1923
|
React.createElement(Options, { handleOptionsClick: () => handleOptionsClick(modifier.id), actionLabel: state.actionLabel, inline: true, hidden: state.shouldHideNestedOptions }))),
|
|
1906
1924
|
renderRegularButton && (React.createElement(Options, { handleOptionsClick: () => handleOptionsClick(modifier.id), actionLabel: state.actionLabel, hidden: state.shouldHideNestedOptions || (state.showInlineAction && Boolean(state.selectedSummary)) }))));
|
|
1907
1925
|
};
|
|
@@ -1924,16 +1942,19 @@ const SingleSelectModifierControl = (props) => {
|
|
|
1924
1942
|
};
|
|
1925
1943
|
return (React.createElement(core.FormControl, { fullWidth: true },
|
|
1926
1944
|
React.createElement(core.RadioGroup, { className: radioClasses.radioGroup, "aria-label": name }, modifiers.map((modifier) => {
|
|
1927
|
-
const
|
|
1945
|
+
const isSelected = getIsSelected(modifier.id, value);
|
|
1946
|
+
const isModifierDisabled = getIsModifierDisabled(modifier, props, isSelected);
|
|
1947
|
+
const modifierActionState = getModifierActionState(modifier, isSelected, props);
|
|
1928
1948
|
return (React.createElement(core.Box, { key: modifier.id },
|
|
1929
1949
|
React.createElement(core.FormControlLabel, { key: modifier.id, value: modifier.id, className: radioClasses.root, control: React.createElement(core.Radio, { checked: value[0]?.modifierId === modifier.id, className: classNames({
|
|
1930
1950
|
[radioClasses.hideRadio]: modifier.outOfStock,
|
|
1931
1951
|
[radioClasses.radio]: !modifier.outOfStock,
|
|
1932
1952
|
}), disabled: isOutOfStock || modifier.outOfStock, onChange: makeHandleChange(modifier), required: isRequired }), label: React.createElement(core.Box, { className: radioClasses.label },
|
|
1933
|
-
React.createElement(Label, { name: modifier.name, price: aggregatePrice[modifier.id] || modifier.formattedPrice, disabled:
|
|
1953
|
+
React.createElement(Label, { name: modifier.name, price: aggregatePrice[modifier.id] || modifier.formattedPrice, disabled: isModifierDisabled, hidePrice: modifier.hidePrice, isSelected: modifierActionState.isSelected, enableSelectedModifierStyles: props.modifierControlsOptions?.enableSelectedModifierStyles, selectedSummary: modifierActionState.showInlineAction ? undefined : modifierActionState.selectedSummary }),
|
|
1934
1954
|
modifier.outOfStock && (React.createElement(core.Box, { minWidth: "90px", marginLeft: 2 },
|
|
1935
1955
|
React.createElement(StatusTag, { color: "warning", label: "Out of stock", variant: "outlined", size: "md" })))), labelPlacement: "start" }),
|
|
1936
|
-
React.createElement(NestedModifierActions, { modifier: modifier, handleOptionsClick: handleOptionsClick, state: modifierActionState })
|
|
1956
|
+
React.createElement(NestedModifierActions, { modifier: modifier, handleOptionsClick: handleOptionsClick, state: modifierActionState, disabled: isModifierDisabled }),
|
|
1957
|
+
props.renderAfterModifier?.(modifier.id)));
|
|
1937
1958
|
}))));
|
|
1938
1959
|
};
|
|
1939
1960
|
const QuantityButtonControl = (props) => {
|
|
@@ -1957,18 +1978,20 @@ const QuantityButtonControl = (props) => {
|
|
|
1957
1978
|
React.createElement(core.FormGroup, { className: radioClasses.radioGroup, "aria-label": name }, modifiers.map((modifier) => {
|
|
1958
1979
|
const selectedModifier = value.find((v) => v.modifierId === modifier.id && v.quantity > 0);
|
|
1959
1980
|
const isSelected = Boolean(selectedModifier);
|
|
1981
|
+
const isModifierDisabled = getIsModifierDisabled(modifier, props, isSelected);
|
|
1960
1982
|
const modifierActionState = getModifierActionState(modifier, isSelected, props);
|
|
1961
1983
|
return (React.createElement(core.Box, { key: modifier.id },
|
|
1962
1984
|
React.createElement(core.Box, { display: "flex", alignItems: "center", justifyContent: "space-between", width: "100%" },
|
|
1963
|
-
React.createElement(Label, { name: modifier.name, price: aggregatePrice[modifier.id] || modifier.formattedPrice, disabled:
|
|
1985
|
+
React.createElement(Label, { name: modifier.name, price: aggregatePrice[modifier.id] || modifier.formattedPrice, disabled: isModifierDisabled, hidePrice: modifier.hidePrice, isSelected: modifierActionState.isSelected, enableSelectedModifierStyles: props.modifierControlsOptions?.enableSelectedModifierStyles, selectedSummary: modifierActionState.showInlineAction ? undefined : modifierActionState.selectedSummary }),
|
|
1964
1986
|
modifier.outOfStock && (React.createElement(core.Box, { minWidth: "90px", marginLeft: 2 },
|
|
1965
1987
|
React.createElement(StatusTag, { color: "warning", label: props.messages.outOfStockText, variant: "outlined", size: "md" }))),
|
|
1966
1988
|
!modifier.outOfStock && (React.createElement(QuantityPicker, { incrementButtonTitle: `Add ${modifier.name}`, decrementButtonTitle: `Remove ${modifier.name}`, id: `${modifier.id}-quantity-picker`, variation: "modifierCount", value: selectedModifier?.quantity ?? 0, min: 0, max: isSingleSelect ? 1 : undefined, preventManualChange: true, disableIncrement: !isSingleSelect && disableNewSelections, onChange: makeHandleChange(modifier, isSelected), disabled: isOutOfStock || modifier.outOfStock, name: modifier.name }))),
|
|
1967
|
-
React.createElement(NestedModifierActions, { modifier: modifier, handleOptionsClick: handleOptionsClick, state: modifierActionState, renderRegularButton: false })
|
|
1989
|
+
React.createElement(NestedModifierActions, { modifier: modifier, handleOptionsClick: handleOptionsClick, state: modifierActionState, disabled: isModifierDisabled, renderRegularButton: false }),
|
|
1990
|
+
props.renderAfterModifier?.(modifier.id)));
|
|
1968
1991
|
}))));
|
|
1969
1992
|
};
|
|
1970
1993
|
const MultipleSelectControl = (props) => {
|
|
1971
|
-
const { modifiers, value,
|
|
1994
|
+
const { modifiers, value, onChange, handleOptionsClick, aggregatePrice } = props;
|
|
1972
1995
|
const classes = useCheckboxModifierFormStyles();
|
|
1973
1996
|
const makeHandleChange = (modifier) => () => {
|
|
1974
1997
|
const isModifierInValue = Boolean(value.find((v) => v.modifierId === modifier.id));
|
|
@@ -1986,13 +2009,16 @@ const MultipleSelectControl = (props) => {
|
|
|
1986
2009
|
};
|
|
1987
2010
|
return (React.createElement(core.FormControl, { fullWidth: true },
|
|
1988
2011
|
React.createElement(core.FormGroup, { className: classes.formGroup }, modifiers.map((modifier) => {
|
|
1989
|
-
const
|
|
2012
|
+
const isSelected = getIsSelected(modifier.id, value);
|
|
2013
|
+
const isModifierDisabled = getIsModifierDisabled(modifier, props, isSelected);
|
|
2014
|
+
const modifierActionState = getModifierActionState(modifier, isSelected, props);
|
|
1990
2015
|
return (React.createElement(core.Box, { key: modifier.id },
|
|
1991
|
-
React.createElement(core.FormControlLabel, { key: modifier.id, value: modifier.id, className: classes.root, checked: value.some((v) => v.modifierId === modifier.id), onChange: makeHandleChange(modifier), control: React.createElement(core.Checkbox, { className: classNames({ [classes.hideCheckbox]: modifier.outOfStock }, { [classes.checkbox]: !modifier.outOfStock }), disabled:
|
|
1992
|
-
React.createElement(Label, { name: modifier.name, price: aggregatePrice[modifier.id] || modifier.formattedPrice, disabled:
|
|
2016
|
+
React.createElement(core.FormControlLabel, { key: modifier.id, value: modifier.id, className: classes.root, checked: value.some((v) => v.modifierId === modifier.id), onChange: makeHandleChange(modifier), control: React.createElement(core.Checkbox, { className: classNames({ [classes.hideCheckbox]: modifier.outOfStock }, { [classes.checkbox]: !modifier.outOfStock }), disabled: isModifierDisabled }), label: React.createElement(core.Box, { className: classes.label },
|
|
2017
|
+
React.createElement(Label, { name: modifier.name, price: aggregatePrice[modifier.id] || modifier.formattedPrice, disabled: isModifierDisabled, hidePrice: modifier.hidePrice, isSelected: modifierActionState.isSelected, enableSelectedModifierStyles: props.modifierControlsOptions?.enableSelectedModifierStyles, selectedSummary: modifierActionState.showInlineAction ? undefined : modifierActionState.selectedSummary }),
|
|
1993
2018
|
modifier.outOfStock && (React.createElement(core.Box, { minWidth: "90px", marginLeft: 2 },
|
|
1994
2019
|
React.createElement(StatusTag, { color: "warning", label: "Out of stock", variant: "outlined", size: "md" })))), labelPlacement: "start" }),
|
|
1995
|
-
React.createElement(NestedModifierActions, { modifier: modifier, handleOptionsClick: handleOptionsClick, state: modifierActionState })
|
|
2020
|
+
React.createElement(NestedModifierActions, { modifier: modifier, handleOptionsClick: handleOptionsClick, state: modifierActionState, disabled: isModifierDisabled }),
|
|
2021
|
+
props.renderAfterModifier?.(modifier.id)));
|
|
1996
2022
|
}))));
|
|
1997
2023
|
};
|
|
1998
2024
|
const MultipleQuantitySelectControl = (props) => {
|
|
@@ -2010,13 +2036,14 @@ const MultipleQuantitySelectControl = (props) => {
|
|
|
2010
2036
|
return (React.createElement(core.FormControl, { fullWidth: true },
|
|
2011
2037
|
React.createElement(core.FormGroup, null, modifiers.map((modifier) => {
|
|
2012
2038
|
const modifierActionState = getModifierActionState(modifier, modifier.quantity > 0, props);
|
|
2039
|
+
const isModifierDisabled = getIsModifierDisabled(modifier, props, modifierActionState.isSelected);
|
|
2013
2040
|
return (React.createElement(core.Box, { key: modifier.id, style: { justifyContent: 'space-between', flexDirection: 'column' }, display: "flex" },
|
|
2014
2041
|
React.createElement(core.Box, { display: "flex", alignItems: "center", justifyContent: "space-between", width: "100%" },
|
|
2015
|
-
React.createElement(Label, { name: modifier.name, price: aggregatePrice[modifier.id] || modifier.formattedPrice, disabled:
|
|
2042
|
+
React.createElement(Label, { name: modifier.name, price: aggregatePrice[modifier.id] || modifier.formattedPrice, disabled: isModifierDisabled, hidePrice: modifier.hidePrice, isSelected: modifierActionState.isSelected, enableSelectedModifierStyles: props.modifierControlsOptions?.enableSelectedModifierStyles, selectedSummary: modifierActionState.showInlineAction ? undefined : modifierActionState.selectedSummary }),
|
|
2016
2043
|
modifier.outOfStock && (React.createElement(core.Box, { minWidth: "90px", marginLeft: 2 },
|
|
2017
2044
|
React.createElement(StatusTag, { color: "warning", label: "Out of stock", variant: "outlined", size: "md" }))),
|
|
2018
2045
|
!modifier.outOfStock && (React.createElement(QuantityPicker, { incrementButtonTitle: `Add ${modifier.name}`, decrementButtonTitle: `Remove ${modifier.name}`, id: `${modifier.id}-quantity-picker`, variation: "modifierCount", value: modifier.quantity, disableIncrement: disableNewSelections, preventManualChange: true, onChange: makeHandleChange(modifier), disabled: isOutOfStock || modifier.outOfStock, name: modifier.name }))),
|
|
2019
|
-
React.createElement(NestedModifierActions, { modifier: modifier, handleOptionsClick: handleOptionsClick, state: modifierActionState, renderRegularButton: false }),
|
|
2046
|
+
React.createElement(NestedModifierActions, { modifier: modifier, handleOptionsClick: handleOptionsClick, state: modifierActionState, disabled: isModifierDisabled, renderRegularButton: false }),
|
|
2020
2047
|
React.createElement(core.Box, { display: "flex", alignItems: "flex-start", gridGap: 4 },
|
|
2021
2048
|
modifier.hasModifiers && !modifier.outOfStock && (React.createElement(Options, { handleOptionsClick: () => handleOptionsClick(modifier.id), actionLabel: modifierActionState.actionLabel, hidden: modifierActionState.shouldHideNestedOptions ||
|
|
2022
2049
|
(modifierActionState.showInlineAction && Boolean(modifierActionState.selectedSummary)) })),
|
|
@@ -2027,7 +2054,8 @@ const MultipleQuantitySelectControl = (props) => {
|
|
|
2027
2054
|
selectionQuantity[modifier.id].currentSelectionCount,
|
|
2028
2055
|
"/",
|
|
2029
2056
|
selectionQuantity[modifier.id].requiredSelectionCount,
|
|
2030
|
-
" selected")))
|
|
2057
|
+
" selected"))),
|
|
2058
|
+
props.renderAfterModifier?.(modifier.id)));
|
|
2031
2059
|
}))));
|
|
2032
2060
|
};
|
|
2033
2061
|
const ModifierControls = (props) => {
|
|
@@ -2074,7 +2102,7 @@ const getStatusTagProps = (props) => {
|
|
|
2074
2102
|
return { color, label, variant };
|
|
2075
2103
|
};
|
|
2076
2104
|
const NestedModsV2DishModifierCard = (props) => {
|
|
2077
|
-
const { aggregatePrice, name, disableNewSelections, modifiers, value, messages, onChange, type, error, isOutOfStock, isRequired, handleOptionsClick, selectionQuantity, modifierControlsOptions, disableCardStyle = false, hideName = false, } = props;
|
|
2105
|
+
const { aggregatePrice, name, disableNewSelections, modifiers, value, messages, onChange, type, error, isOutOfStock, isRequired, handleOptionsClick, selectionQuantity, modifierControlsOptions, renderAfterModifier, disableCardStyle = false, hideName = false, } = props;
|
|
2078
2106
|
const classes = useDishModifierCardStyles();
|
|
2079
2107
|
return (React.createElement(commonUi.Box, { className: classNames(classes.root, { [classes.card]: !disableCardStyle }) },
|
|
2080
2108
|
React.createElement(commonUi.Box, { display: "flex", justifyContent: "space-between", width: "100%", alignItems: "center", height: "fit-content", marginBottom: 2 },
|
|
@@ -2083,7 +2111,7 @@ const NestedModsV2DishModifierCard = (props) => {
|
|
|
2083
2111
|
!isOutOfStock && (React.createElement(commonUi.Typography, { variant: "subtitle1", className: classNames({ [classes.error]: error, [classes.helperText]: !error }) }, messages.helperText))),
|
|
2084
2112
|
!hideName && (React.createElement(commonUi.Typography, { component: "h3", className: classes.name }, name)),
|
|
2085
2113
|
React.createElement(commonUi.Box, null,
|
|
2086
|
-
React.createElement(ModifierControls, { name: name, value: value, modifiers: modifiers, isOutOfStock: isOutOfStock, isRequired: isRequired, onChange: onChange, disableNewSelections: disableNewSelections, type: type, messages: messages, handleOptionsClick: handleOptionsClick, aggregatePrice: aggregatePrice, selectionQuantity: selectionQuantity, modifierControlsOptions: modifierControlsOptions }))));
|
|
2114
|
+
React.createElement(ModifierControls, { name: name, value: value, modifiers: modifiers, isOutOfStock: isOutOfStock, isRequired: isRequired, onChange: onChange, disableNewSelections: disableNewSelections, type: type, messages: messages, handleOptionsClick: handleOptionsClick, aggregatePrice: aggregatePrice, selectionQuantity: selectionQuantity, modifierControlsOptions: modifierControlsOptions, renderAfterModifier: renderAfterModifier }))));
|
|
2087
2115
|
};
|
|
2088
2116
|
NestedModsV2DishModifierCard.displayName = 'NestedModsV2DishModifierCard';
|
|
2089
2117
|
|