@open-tender/utils 0.1.168 → 0.1.170
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.
|
@@ -27,11 +27,7 @@ const useOrderItem = (orderItem, favorite = null, allergenAlerts = [], cartCount
|
|
|
27
27
|
const nonSizeGroups = groups.filter(i => !i.isSize);
|
|
28
28
|
const currentOptions = (0, utils_1.getItemOptions)(Object.assign(Object.assign({}, orderItem), { groups: nonSizeGroups }));
|
|
29
29
|
const hasSelections = currentOptions.length > 0;
|
|
30
|
-
const desc = showDesc === '
|
|
31
|
-
? ''
|
|
32
|
-
: showDesc === 'SHORT'
|
|
33
|
-
? shortDescription
|
|
34
|
-
: description;
|
|
30
|
+
const desc = showDesc === 'SHORT' ? shortDescription : description;
|
|
35
31
|
const optionNames = favorite
|
|
36
32
|
? groups
|
|
37
33
|
.reduce((arr, group) => {
|
|
@@ -42,7 +38,7 @@ const useOrderItem = (orderItem, favorite = null, allergenAlerts = [], cartCount
|
|
|
42
38
|
}, [])
|
|
43
39
|
.join(', ')
|
|
44
40
|
: null;
|
|
45
|
-
const displayDesc = optionNames || desc;
|
|
41
|
+
const displayDesc = showDesc === 'HIDE' ? '' : optionNames || desc;
|
|
46
42
|
return Object.assign(Object.assign({}, orderItem), { displayDesc,
|
|
47
43
|
displayTags,
|
|
48
44
|
displayAllergens,
|
package/dist/cjs/utils/theme.js
CHANGED
|
@@ -187,6 +187,10 @@ const makeMenuItems = (menuItems, lineHeight) => {
|
|
|
187
187
|
title: Object.assign(Object.assign({}, title), { fontSize: (0, exports.remsToPixels)(title.fontSize), fontSizeMobile: (0, exports.remsToPixels)(title.fontSizeMobile), lineHeight: fontSizeToLineHeight(lineHeight, title.fontSizeMobile), padding: boxRemsToPixels(title.padding), paddingMobile: boxRemsToPixels(title.paddingMobile) })
|
|
188
188
|
};
|
|
189
189
|
};
|
|
190
|
+
const makeModifiers = (modifiers, lineHeight) => {
|
|
191
|
+
const { box, calories, content, image, price, text, title } = modifiers;
|
|
192
|
+
return Object.assign(Object.assign({}, modifiers), { box: Object.assign(Object.assign({}, box), { border: boxRemsToPixels(box.border), borderMobile: boxRemsToPixels(box.borderMobile), borderRadius: (0, exports.remsToPixels)(box.borderRadius), gap: (0, exports.remsToPixels)(box.gap), gapHalf: (0, exports.remsToPixels)(box.gapHalf), margin: boxRemsToPixels(box.margin), marginMobile: boxRemsToPixels(box.marginMobile), minHeight: (0, exports.remsToPixels)(box.minHeight), minHeightWithGap: (0, exports.remsToPixels)(box.minHeightWithGap), minWidth: (0, exports.remsToPixels)(box.minWidth), padding: boxRemsToPixels(box.padding), paddingMobile: boxRemsToPixels(box.paddingMobile) }), calories: Object.assign(Object.assign({}, calories), { fontSize: (0, exports.remsToPixels)(calories.fontSize), lineHeight: fontSizeToLineHeight(calories.fontSize, lineHeight) }), content: Object.assign(Object.assign({}, content), { padding: boxRemsToPixels(content.padding) }), image: Object.assign(Object.assign({}, image), { border: boxRemsToPixels(image.border), borderRadius: (0, exports.remsToPixels)(image.borderRadius), height: (0, exports.remsToPixels)(image.height), margin: boxRemsToPixels(image.margin), padding: boxRemsToPixels(image.padding), width: (0, exports.remsToPixels)(image.width) }), price: Object.assign(Object.assign({}, price), { fontSize: (0, exports.remsToPixels)(price.fontSize), lineHeight: fontSizeToLineHeight(price.fontSize, lineHeight) }), text: Object.assign(Object.assign({}, text), { fontSize: (0, exports.remsToPixels)(text.fontSize), lineHeight: fontSizeToLineHeight(text.fontSize, lineHeight) }), title: Object.assign(Object.assign({}, title), { fontSize: (0, exports.remsToPixels)(title.fontSize), lineHeight: fontSizeToLineHeight(title.fontSize, lineHeight) }) });
|
|
193
|
+
};
|
|
190
194
|
const makeLogo = (logo) => {
|
|
191
195
|
return {
|
|
192
196
|
marginTop: (0, exports.remsToPixels)(logo.marginTop),
|
|
@@ -210,10 +214,12 @@ const decorateTheme = (theme) => {
|
|
|
210
214
|
const item = makeItem(theme.item);
|
|
211
215
|
const categories = makeCategories(theme.categories);
|
|
212
216
|
const menuItems = makeMenuItems(theme.menuItems, theme.lineHeight);
|
|
217
|
+
const modifiers = makeModifiers(theme.modifiers, theme.lineHeight);
|
|
213
218
|
return Object.assign(Object.assign({}, theme), { logo,
|
|
214
219
|
logoFooter, fonts: fonts, lineHeight, layout: layout, buttons: buttons, border, inputs: inputs, counts,
|
|
215
220
|
cards, welcome: welcome, item: item, categories,
|
|
216
|
-
menuItems
|
|
221
|
+
menuItems,
|
|
222
|
+
modifiers });
|
|
217
223
|
};
|
|
218
224
|
exports.decorateTheme = decorateTheme;
|
|
219
225
|
const hexToRgbA = (hex, opacity) => {
|
|
@@ -24,11 +24,7 @@ export const useOrderItem = (orderItem, favorite = null, allergenAlerts = [], ca
|
|
|
24
24
|
const nonSizeGroups = groups.filter(i => !i.isSize);
|
|
25
25
|
const currentOptions = getItemOptions(Object.assign(Object.assign({}, orderItem), { groups: nonSizeGroups }));
|
|
26
26
|
const hasSelections = currentOptions.length > 0;
|
|
27
|
-
const desc = showDesc === '
|
|
28
|
-
? ''
|
|
29
|
-
: showDesc === 'SHORT'
|
|
30
|
-
? shortDescription
|
|
31
|
-
: description;
|
|
27
|
+
const desc = showDesc === 'SHORT' ? shortDescription : description;
|
|
32
28
|
const optionNames = favorite
|
|
33
29
|
? groups
|
|
34
30
|
.reduce((arr, group) => {
|
|
@@ -39,7 +35,7 @@ export const useOrderItem = (orderItem, favorite = null, allergenAlerts = [], ca
|
|
|
39
35
|
}, [])
|
|
40
36
|
.join(', ')
|
|
41
37
|
: null;
|
|
42
|
-
const displayDesc = optionNames || desc;
|
|
38
|
+
const displayDesc = showDesc === 'HIDE' ? '' : optionNames || desc;
|
|
43
39
|
return Object.assign(Object.assign({}, orderItem), { displayDesc,
|
|
44
40
|
displayTags,
|
|
45
41
|
displayAllergens,
|
package/dist/esm/utils/theme.js
CHANGED
|
@@ -178,6 +178,10 @@ const makeMenuItems = (menuItems, lineHeight) => {
|
|
|
178
178
|
title: Object.assign(Object.assign({}, title), { fontSize: remsToPixels(title.fontSize), fontSizeMobile: remsToPixels(title.fontSizeMobile), lineHeight: fontSizeToLineHeight(lineHeight, title.fontSizeMobile), padding: boxRemsToPixels(title.padding), paddingMobile: boxRemsToPixels(title.paddingMobile) })
|
|
179
179
|
};
|
|
180
180
|
};
|
|
181
|
+
const makeModifiers = (modifiers, lineHeight) => {
|
|
182
|
+
const { box, calories, content, image, price, text, title } = modifiers;
|
|
183
|
+
return Object.assign(Object.assign({}, modifiers), { box: Object.assign(Object.assign({}, box), { border: boxRemsToPixels(box.border), borderMobile: boxRemsToPixels(box.borderMobile), borderRadius: remsToPixels(box.borderRadius), gap: remsToPixels(box.gap), gapHalf: remsToPixels(box.gapHalf), margin: boxRemsToPixels(box.margin), marginMobile: boxRemsToPixels(box.marginMobile), minHeight: remsToPixels(box.minHeight), minHeightWithGap: remsToPixels(box.minHeightWithGap), minWidth: remsToPixels(box.minWidth), padding: boxRemsToPixels(box.padding), paddingMobile: boxRemsToPixels(box.paddingMobile) }), calories: Object.assign(Object.assign({}, calories), { fontSize: remsToPixels(calories.fontSize), lineHeight: fontSizeToLineHeight(calories.fontSize, lineHeight) }), content: Object.assign(Object.assign({}, content), { padding: boxRemsToPixels(content.padding) }), image: Object.assign(Object.assign({}, image), { border: boxRemsToPixels(image.border), borderRadius: remsToPixels(image.borderRadius), height: remsToPixels(image.height), margin: boxRemsToPixels(image.margin), padding: boxRemsToPixels(image.padding), width: remsToPixels(image.width) }), price: Object.assign(Object.assign({}, price), { fontSize: remsToPixels(price.fontSize), lineHeight: fontSizeToLineHeight(price.fontSize, lineHeight) }), text: Object.assign(Object.assign({}, text), { fontSize: remsToPixels(text.fontSize), lineHeight: fontSizeToLineHeight(text.fontSize, lineHeight) }), title: Object.assign(Object.assign({}, title), { fontSize: remsToPixels(title.fontSize), lineHeight: fontSizeToLineHeight(title.fontSize, lineHeight) }) });
|
|
184
|
+
};
|
|
181
185
|
const makeLogo = (logo) => {
|
|
182
186
|
return {
|
|
183
187
|
marginTop: remsToPixels(logo.marginTop),
|
|
@@ -201,10 +205,12 @@ export const decorateTheme = (theme) => {
|
|
|
201
205
|
const item = makeItem(theme.item);
|
|
202
206
|
const categories = makeCategories(theme.categories);
|
|
203
207
|
const menuItems = makeMenuItems(theme.menuItems, theme.lineHeight);
|
|
208
|
+
const modifiers = makeModifiers(theme.modifiers, theme.lineHeight);
|
|
204
209
|
return Object.assign(Object.assign({}, theme), { logo,
|
|
205
210
|
logoFooter, fonts: fonts, lineHeight, layout: layout, buttons: buttons, border, inputs: inputs, counts,
|
|
206
211
|
cards, welcome: welcome, item: item, categories,
|
|
207
|
-
menuItems
|
|
212
|
+
menuItems,
|
|
213
|
+
modifiers });
|
|
208
214
|
};
|
|
209
215
|
export const hexToRgbA = (hex, opacity) => {
|
|
210
216
|
let c;
|
package/package.json
CHANGED