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.d.ts
CHANGED
|
@@ -1588,7 +1588,7 @@ declare function ModalDrawer({ open, height, onClose, children, widthPercent }:
|
|
|
1588
1588
|
widthPercent?: number;
|
|
1589
1589
|
}): react_jsx_runtime.JSX.Element;
|
|
1590
1590
|
|
|
1591
|
-
declare function OverlayDropdown({ data, value, onSelectClick, label, labelEmptyValue, showLabelOnTop, labelColor, placeHolder, placeHolderColor, required, disabled, isDarkerBackground, editableDigitalCoupon, customDisplayText, selectedColor, hoverColor, width, minWidth, dropdownWidth, dropdownMaxHeight, height, margin, ...props }: {
|
|
1591
|
+
declare function OverlayDropdown({ data, value, onSelectClick, label, labelEmptyValue, showLabelOnTop, labelColor, placeHolder, placeHolderColor, required, disabled, isDarkerBackground, editableDigitalCoupon, customDisplayText, appliedCouponsCount, selectedColor, hoverColor, width, minWidth, dropdownWidth, dropdownMaxHeight, height, margin, ...props }: {
|
|
1592
1592
|
[x: string]: any;
|
|
1593
1593
|
data?: any[];
|
|
1594
1594
|
value: any;
|
|
@@ -1604,6 +1604,7 @@ declare function OverlayDropdown({ data, value, onSelectClick, label, labelEmpty
|
|
|
1604
1604
|
isDarkerBackground?: boolean;
|
|
1605
1605
|
editableDigitalCoupon?: boolean;
|
|
1606
1606
|
customDisplayText?: any;
|
|
1607
|
+
appliedCouponsCount?: number;
|
|
1607
1608
|
selectedColor?: string;
|
|
1608
1609
|
hoverColor?: string;
|
|
1609
1610
|
width?: string;
|
package/dist/index.esm.js
CHANGED
|
@@ -57892,6 +57892,7 @@ const OverlayDropdown = _ref => {
|
|
|
57892
57892
|
isDarkerBackground = false,
|
|
57893
57893
|
editableDigitalCoupon = false,
|
|
57894
57894
|
customDisplayText = null,
|
|
57895
|
+
appliedCouponsCount = 0,
|
|
57895
57896
|
selectedColor = "#066768",
|
|
57896
57897
|
hoverColor = "#E6F0F0",
|
|
57897
57898
|
width = "100%",
|
|
@@ -58043,7 +58044,7 @@ const OverlayDropdown = _ref => {
|
|
|
58043
58044
|
if (!showLabelOnTop && open) {
|
|
58044
58045
|
return "";
|
|
58045
58046
|
}
|
|
58046
|
-
if (hasValue) {
|
|
58047
|
+
if (hasValue || customDisplayText) {
|
|
58047
58048
|
return label;
|
|
58048
58049
|
}
|
|
58049
58050
|
return labelEmptyValue;
|
|
@@ -58065,15 +58066,15 @@ const OverlayDropdown = _ref => {
|
|
|
58065
58066
|
return "";
|
|
58066
58067
|
};
|
|
58067
58068
|
const getDisplayText = () => {
|
|
58069
|
+
if (open) {
|
|
58070
|
+
return placeHolder;
|
|
58071
|
+
}
|
|
58068
58072
|
if (customDisplayText) {
|
|
58069
58073
|
return customDisplayText;
|
|
58070
58074
|
}
|
|
58071
58075
|
if (selected) {
|
|
58072
58076
|
return selected.label;
|
|
58073
58077
|
}
|
|
58074
|
-
if (open) {
|
|
58075
|
-
return placeHolder;
|
|
58076
|
-
}
|
|
58077
58078
|
return '';
|
|
58078
58079
|
};
|
|
58079
58080
|
return /*#__PURE__*/React$1.createElement(DropdownContainer, {
|
|
@@ -58084,7 +58085,7 @@ const OverlayDropdown = _ref => {
|
|
|
58084
58085
|
className: "Label",
|
|
58085
58086
|
isFocused: open,
|
|
58086
58087
|
labelColor: labelColor,
|
|
58087
|
-
hasValue: hasValue,
|
|
58088
|
+
hasValue: hasValue || !!customDisplayText,
|
|
58088
58089
|
disabled: disabled,
|
|
58089
58090
|
showLabelOnTop: showLabelOnTop,
|
|
58090
58091
|
isDarkerBackground: isDarkerBackground
|
|
@@ -58103,7 +58104,7 @@ const OverlayDropdown = _ref => {
|
|
|
58103
58104
|
className: "selected",
|
|
58104
58105
|
onMouseEnter: () => setHoveredText(customDisplayText || selected?.label),
|
|
58105
58106
|
onMouseLeave: () => setHoveredText(null),
|
|
58106
|
-
color: !
|
|
58107
|
+
color: !hasValue && !customDisplayText && open ? placeHolderColor : "inherit"
|
|
58107
58108
|
}, getDisplayText()), open ? /*#__PURE__*/React$1.createElement(MenuItemUpIcon, {
|
|
58108
58109
|
width: "12px",
|
|
58109
58110
|
height: "12px",
|
|
@@ -58122,52 +58123,66 @@ const OverlayDropdown = _ref => {
|
|
|
58122
58123
|
$showBorder: group.overlayName,
|
|
58123
58124
|
margin: margin,
|
|
58124
58125
|
key: group.overlayCode
|
|
58125
|
-
}, ["Template Offer", "Last defined by you"].includes(group.overlayName) && /*#__PURE__*/React$1.createElement(SectionTitle, null, group.overlayName), group.items.map(item =>
|
|
58126
|
-
|
|
58127
|
-
|
|
58128
|
-
|
|
58129
|
-
|
|
58130
|
-
|
|
58131
|
-
|
|
58132
|
-
|
|
58133
|
-
|
|
58134
|
-
|
|
58135
|
-
|
|
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
|
-
|
|
58126
|
+
}, ["Template Offer", "Last defined by you"].includes(group.overlayName) && /*#__PURE__*/React$1.createElement(SectionTitle, null, group.overlayName), group.items.map(item => {
|
|
58127
|
+
const isDigitalCoupon = group.templateType === 3 && editableDigitalCoupon;
|
|
58128
|
+
const hasAppliedCoupons = appliedCouponsCount > 0;
|
|
58129
|
+
const penColor = isDigitalCoupon && hasAppliedCoupons ? "#FF8C00" : item.value === value ? "#fff" : "#212121";
|
|
58130
|
+
|
|
58131
|
+
// Update label to show count for digital coupons
|
|
58132
|
+
let displayText = item.label;
|
|
58133
|
+
if (isDigitalCoupon && appliedCouponsCount > 0) {
|
|
58134
|
+
displayText = `Digital Coupon/s (${appliedCouponsCount})`;
|
|
58135
|
+
}
|
|
58136
|
+
return /*#__PURE__*/React$1.createElement(DropdownItem, {
|
|
58137
|
+
key: item.value,
|
|
58138
|
+
selected: item.value === value,
|
|
58139
|
+
selectedColor: selectedColor,
|
|
58140
|
+
hoverColor: hoverColor,
|
|
58141
|
+
onClick: () => {
|
|
58142
|
+
if (onSelectClick && !disabled) {
|
|
58143
|
+
setOpen(false);
|
|
58144
|
+
if (group.templateType === 3 && editableDigitalCoupon) {
|
|
58145
|
+
const result = {
|
|
58146
|
+
...item,
|
|
58147
|
+
label: item.displayLabel || item.label,
|
|
58148
|
+
overlayCode: group.overlayCode,
|
|
58149
|
+
overlayName: group.overlayName,
|
|
58150
|
+
templateType: group.templateType,
|
|
58151
|
+
isEditableDigitalCoupon: true
|
|
58152
|
+
};
|
|
58153
|
+
onSelectClick(result);
|
|
58154
|
+
} else if (group.templateType === 2) {
|
|
58155
|
+
setTemplateDialog({
|
|
58156
|
+
item,
|
|
58157
|
+
group,
|
|
58158
|
+
params: getTemplateParams(item.displayLabel || item.label)
|
|
58159
|
+
});
|
|
58160
|
+
} else {
|
|
58161
|
+
const result = {
|
|
58162
|
+
...item,
|
|
58163
|
+
overlayCode: group.overlayCode,
|
|
58164
|
+
overlayName: group.overlayName,
|
|
58165
|
+
templateType: group.templateType
|
|
58166
|
+
};
|
|
58167
|
+
onSelectClick(result);
|
|
58168
|
+
}
|
|
58169
|
+
}
|
|
58170
|
+
}
|
|
58171
|
+
}, /*#__PURE__*/React$1.createElement(TruncatedText, {
|
|
58172
|
+
onMouseEnter: () => setHoveredText(displayText),
|
|
58173
|
+
onMouseLeave: () => setHoveredText(null)
|
|
58174
|
+
}, displayText), group.templateType === 2 ? /*#__PURE__*/React$1.createElement(ChervronRightIcon, {
|
|
58175
|
+
fill: item.value === value ? "#fff" : "#212121"
|
|
58176
|
+
}) : isDigitalCoupon ? /*#__PURE__*/React$1.createElement(PenIcon, {
|
|
58177
|
+
color: penColor,
|
|
58178
|
+
width: "16",
|
|
58179
|
+
height: "16"
|
|
58180
|
+
}) : item.value === value && /*#__PURE__*/React$1.createElement(OkIcon, {
|
|
58181
|
+
width: "22px",
|
|
58182
|
+
height: "22px",
|
|
58183
|
+
color: "#fff"
|
|
58184
|
+
}));
|
|
58185
|
+
})))), templateDialog && /*#__PURE__*/React$1.createElement(OverlayTemplateDialog, {
|
|
58171
58186
|
open: true,
|
|
58172
58187
|
onClose: () => setTemplateDialog(null),
|
|
58173
58188
|
onApply: handleTemplateApply,
|