sag_components 2.0.0-beta290 → 2.0.0-beta292
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/dist/index.d.ts +2 -1
- package/dist/index.esm.js +67 -52
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +67 -52
- package/dist/index.js.map +1 -1
- package/dist/types/components/OverlayDropdown/OverlayDropdown.d.ts +2 -1
- package/dist/types/components/OverlayDropdown/OverlayDropdown.stories.d.ts +81 -126
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -57902,6 +57902,7 @@ const OverlayDropdown = _ref => {
|
|
|
57902
57902
|
isDarkerBackground = false,
|
|
57903
57903
|
editableDigitalCoupon = false,
|
|
57904
57904
|
customDisplayText = null,
|
|
57905
|
+
appliedCouponsCount = 0,
|
|
57905
57906
|
selectedColor = "#066768",
|
|
57906
57907
|
hoverColor = "#E6F0F0",
|
|
57907
57908
|
width = "100%",
|
|
@@ -58053,7 +58054,7 @@ const OverlayDropdown = _ref => {
|
|
|
58053
58054
|
if (!showLabelOnTop && open) {
|
|
58054
58055
|
return "";
|
|
58055
58056
|
}
|
|
58056
|
-
if (hasValue) {
|
|
58057
|
+
if (hasValue || customDisplayText) {
|
|
58057
58058
|
return label;
|
|
58058
58059
|
}
|
|
58059
58060
|
return labelEmptyValue;
|
|
@@ -58075,15 +58076,15 @@ const OverlayDropdown = _ref => {
|
|
|
58075
58076
|
return "";
|
|
58076
58077
|
};
|
|
58077
58078
|
const getDisplayText = () => {
|
|
58079
|
+
if (open) {
|
|
58080
|
+
return placeHolder;
|
|
58081
|
+
}
|
|
58078
58082
|
if (customDisplayText) {
|
|
58079
58083
|
return customDisplayText;
|
|
58080
58084
|
}
|
|
58081
58085
|
if (selected) {
|
|
58082
58086
|
return selected.label;
|
|
58083
58087
|
}
|
|
58084
|
-
if (open) {
|
|
58085
|
-
return placeHolder;
|
|
58086
|
-
}
|
|
58087
58088
|
return '';
|
|
58088
58089
|
};
|
|
58089
58090
|
return /*#__PURE__*/React__default["default"].createElement(DropdownContainer, {
|
|
@@ -58094,7 +58095,7 @@ const OverlayDropdown = _ref => {
|
|
|
58094
58095
|
className: "Label",
|
|
58095
58096
|
isFocused: open,
|
|
58096
58097
|
labelColor: labelColor,
|
|
58097
|
-
hasValue: hasValue,
|
|
58098
|
+
hasValue: hasValue || !!customDisplayText,
|
|
58098
58099
|
disabled: disabled,
|
|
58099
58100
|
showLabelOnTop: showLabelOnTop,
|
|
58100
58101
|
isDarkerBackground: isDarkerBackground
|
|
@@ -58113,7 +58114,7 @@ const OverlayDropdown = _ref => {
|
|
|
58113
58114
|
className: "selected",
|
|
58114
58115
|
onMouseEnter: () => setHoveredText(customDisplayText || selected?.label),
|
|
58115
58116
|
onMouseLeave: () => setHoveredText(null),
|
|
58116
|
-
color: !
|
|
58117
|
+
color: !hasValue && !customDisplayText && open ? placeHolderColor : "inherit"
|
|
58117
58118
|
}, getDisplayText()), open ? /*#__PURE__*/React__default["default"].createElement(MenuItemUpIcon, {
|
|
58118
58119
|
width: "12px",
|
|
58119
58120
|
height: "12px",
|
|
@@ -58132,52 +58133,66 @@ const OverlayDropdown = _ref => {
|
|
|
58132
58133
|
$showBorder: group.overlayName,
|
|
58133
58134
|
margin: margin,
|
|
58134
58135
|
key: group.overlayCode
|
|
58135
|
-
}, ["Template Offer", "Last defined by you"].includes(group.overlayName) && /*#__PURE__*/React__default["default"].createElement(SectionTitle, null, group.overlayName), group.items.map(item =>
|
|
58136
|
-
|
|
58137
|
-
|
|
58138
|
-
|
|
58139
|
-
|
|
58140
|
-
|
|
58141
|
-
|
|
58142
|
-
|
|
58143
|
-
|
|
58144
|
-
|
|
58145
|
-
|
|
58146
|
-
|
|
58147
|
-
|
|
58148
|
-
|
|
58149
|
-
|
|
58150
|
-
|
|
58151
|
-
|
|
58152
|
-
|
|
58153
|
-
|
|
58154
|
-
|
|
58155
|
-
|
|
58156
|
-
|
|
58157
|
-
|
|
58158
|
-
|
|
58159
|
-
|
|
58160
|
-
|
|
58161
|
-
|
|
58162
|
-
|
|
58163
|
-
|
|
58164
|
-
|
|
58165
|
-
|
|
58166
|
-
|
|
58167
|
-
|
|
58168
|
-
|
|
58169
|
-
|
|
58170
|
-
|
|
58171
|
-
|
|
58172
|
-
|
|
58173
|
-
|
|
58174
|
-
|
|
58175
|
-
|
|
58176
|
-
|
|
58177
|
-
|
|
58178
|
-
|
|
58179
|
-
|
|
58180
|
-
|
|
58136
|
+
}, ["Template Offer", "Last defined by you"].includes(group.overlayName) && /*#__PURE__*/React__default["default"].createElement(SectionTitle, null, group.overlayName), group.items.map(item => {
|
|
58137
|
+
const isDigitalCoupon = group.templateType === 3 && editableDigitalCoupon;
|
|
58138
|
+
const hasAppliedCoupons = appliedCouponsCount > 0;
|
|
58139
|
+
const penColor = isDigitalCoupon && hasAppliedCoupons ? "#FF8C00" : item.value === value ? "#fff" : "#212121";
|
|
58140
|
+
|
|
58141
|
+
// Update label to show count for digital coupons
|
|
58142
|
+
let displayText = item.label;
|
|
58143
|
+
if (isDigitalCoupon && appliedCouponsCount > 0) {
|
|
58144
|
+
displayText = `Digital Coupon/s (${appliedCouponsCount})`;
|
|
58145
|
+
}
|
|
58146
|
+
return /*#__PURE__*/React__default["default"].createElement(DropdownItem, {
|
|
58147
|
+
key: item.value,
|
|
58148
|
+
selected: item.value === value,
|
|
58149
|
+
selectedColor: selectedColor,
|
|
58150
|
+
hoverColor: hoverColor,
|
|
58151
|
+
onClick: () => {
|
|
58152
|
+
if (onSelectClick && !disabled) {
|
|
58153
|
+
setOpen(false);
|
|
58154
|
+
if (group.templateType === 3 && editableDigitalCoupon) {
|
|
58155
|
+
const result = {
|
|
58156
|
+
...item,
|
|
58157
|
+
label: item.displayLabel || item.label,
|
|
58158
|
+
overlayCode: group.overlayCode,
|
|
58159
|
+
overlayName: group.overlayName,
|
|
58160
|
+
templateType: group.templateType,
|
|
58161
|
+
isEditableDigitalCoupon: true
|
|
58162
|
+
};
|
|
58163
|
+
onSelectClick(result);
|
|
58164
|
+
} else if (group.templateType === 2) {
|
|
58165
|
+
setTemplateDialog({
|
|
58166
|
+
item,
|
|
58167
|
+
group,
|
|
58168
|
+
params: getTemplateParams(item.displayLabel || item.label)
|
|
58169
|
+
});
|
|
58170
|
+
} else {
|
|
58171
|
+
const result = {
|
|
58172
|
+
...item,
|
|
58173
|
+
overlayCode: group.overlayCode,
|
|
58174
|
+
overlayName: group.overlayName,
|
|
58175
|
+
templateType: group.templateType
|
|
58176
|
+
};
|
|
58177
|
+
onSelectClick(result);
|
|
58178
|
+
}
|
|
58179
|
+
}
|
|
58180
|
+
}
|
|
58181
|
+
}, /*#__PURE__*/React__default["default"].createElement(TruncatedText, {
|
|
58182
|
+
onMouseEnter: () => setHoveredText(displayText),
|
|
58183
|
+
onMouseLeave: () => setHoveredText(null)
|
|
58184
|
+
}, displayText), group.templateType === 2 ? /*#__PURE__*/React__default["default"].createElement(ChervronRightIcon, {
|
|
58185
|
+
fill: item.value === value ? "#fff" : "#212121"
|
|
58186
|
+
}) : isDigitalCoupon ? /*#__PURE__*/React__default["default"].createElement(PenIcon, {
|
|
58187
|
+
color: penColor,
|
|
58188
|
+
width: "16",
|
|
58189
|
+
height: "16"
|
|
58190
|
+
}) : item.value === value && /*#__PURE__*/React__default["default"].createElement(OkIcon, {
|
|
58191
|
+
width: "22px",
|
|
58192
|
+
height: "22px",
|
|
58193
|
+
color: "#fff"
|
|
58194
|
+
}));
|
|
58195
|
+
})))), templateDialog && /*#__PURE__*/React__default["default"].createElement(OverlayTemplateDialog, {
|
|
58181
58196
|
open: true,
|
|
58182
58197
|
onClose: () => setTemplateDialog(null),
|
|
58183
58198
|
onApply: handleTemplateApply,
|