@ebay/ui-core-react 5.3.0 → 5.3.1
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listbox-button.d.ts","sourceRoot":"","sources":["../../src/ebay-listbox-button/listbox-button.tsx"],"names":[],"mappings":"AAAA,OAAc,EAEV,cAAc,EAAE,EAAE,EACrB,MAAM,OAAO,CAAA;AAGd,OAAO,EAAE,sBAAsB,EAAO,MAAM,6BAA6B,CAAA;AAIzE,oBAAY,gBAAgB,GAAG;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;CACvB,CAAA;AAED,oBAAY,sBAAsB,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,UAAU,CAAC,GAAG;IAC7E,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,sBAAsB,CAAC,iBAAiB,EAAE,gBAAgB,CAAC,CAAC;IACvE,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACzB,CAAA;AAED,QAAA,MAAM,aAAa,EAAE,EAAE,CAAC,sBAAsB,
|
|
1
|
+
{"version":3,"file":"listbox-button.d.ts","sourceRoot":"","sources":["../../src/ebay-listbox-button/listbox-button.tsx"],"names":[],"mappings":"AAAA,OAAc,EAEV,cAAc,EAAE,EAAE,EACrB,MAAM,OAAO,CAAA;AAGd,OAAO,EAAE,sBAAsB,EAAO,MAAM,6BAA6B,CAAA;AAIzE,oBAAY,gBAAgB,GAAG;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;CACvB,CAAA;AAED,oBAAY,sBAAsB,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,UAAU,CAAC,GAAG;IAC7E,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,sBAAsB,CAAC,iBAAiB,EAAE,gBAAgB,CAAC,CAAC;IACvE,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACzB,CAAA;AAED,QAAA,MAAM,aAAa,EAAE,EAAE,CAAC,sBAAsB,CAoR7C,CAAA;AAED,eAAe,aAAa,CAAA"}
|
|
@@ -64,7 +64,7 @@ var ListboxButton = function (_a) {
|
|
|
64
64
|
var props = _a.props;
|
|
65
65
|
return props.value === value;
|
|
66
66
|
});
|
|
67
|
-
var index = selectedIndex > -1 ? selectedIndex : 0;
|
|
67
|
+
var index = selectedIndex > -1 || floatingLabel ? selectedIndex : 0;
|
|
68
68
|
return {
|
|
69
69
|
option: listBoxButtonOptions[index],
|
|
70
70
|
index: index
|
|
@@ -221,7 +221,7 @@ var ListboxButton = function (_a) {
|
|
|
221
221
|
.map(function (child, index) { return react_1.cloneElement(child, {
|
|
222
222
|
index: index,
|
|
223
223
|
key: index,
|
|
224
|
-
selected: child.props.value === selectedOption.props.value,
|
|
224
|
+
selected: selectedOption && child.props.value === selectedOption.props.value,
|
|
225
225
|
onClick: function (e, optionValue) { return onOptionsSelect(e, optionValue, index); },
|
|
226
226
|
innerRef: function (optionNode) { return !optionNode
|
|
227
227
|
? optionsByIndexRef.current.delete(index)
|
|
@@ -230,7 +230,7 @@ var ListboxButton = function (_a) {
|
|
|
230
230
|
var wrapperClassName = classnames_1.default('listbox-button', className, { 'listbox-button--fluid': fluid });
|
|
231
231
|
var buttonClassName = classnames_1.default('btn btn--form', {
|
|
232
232
|
'btn--borderless': borderless,
|
|
233
|
-
'btn--floating-label': floatingLabel
|
|
233
|
+
'btn--floating-label': floatingLabel && selectedOption
|
|
234
234
|
});
|
|
235
235
|
var expandBtnTextId = prefixId && 'expand-btn-text';
|
|
236
236
|
return (react_1.default.createElement("span", { className: wrapperClassName },
|
|
@@ -239,7 +239,8 @@ var ListboxButton = function (_a) {
|
|
|
239
239
|
onMouseDown: function (e) { return e.preventDefault(); }, onKeyUp: onButtonKeyup, ref: buttonRef }),
|
|
240
240
|
react_1.default.createElement("span", { className: "btn__cell" },
|
|
241
241
|
floatingLabel ? (react_1.default.createElement("span", { className: "btn__floating-label" }, floatingLabel)) : null,
|
|
242
|
-
|
|
242
|
+
selectedOption &&
|
|
243
|
+
react_1.default.createElement("span", { className: "btn__text", id: expandBtnTextId }, selectedOption.props.children),
|
|
243
244
|
react_1.default.createElement(ebay_icon_1.EbayIcon, { name: "chevronDown16" }))),
|
|
244
245
|
(expanded || optionsOpened) &&
|
|
245
246
|
react_1.default.createElement("div", { className: "listbox-button__listbox", ref: optionsParentContainerRef, style: { maxHeight: maxHeight } },
|
|
@@ -253,7 +254,7 @@ var ListboxButton = function (_a) {
|
|
|
253
254
|
collapseListbox();
|
|
254
255
|
setTimeout(function () { return buttonRef.current.focus(); }, 0);
|
|
255
256
|
} }, updatelistBoxButtonOptions)),
|
|
256
|
-
react_1.default.createElement("select", { hidden: true, className: "listbox-button__native", name: name, value: selectedOption.props.value }, updatelistBoxButtonOptions.map(function (option, i) {
|
|
257
|
+
react_1.default.createElement("select", { hidden: true, className: "listbox-button__native", name: name, value: selectedOption ? selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.props.value : '' }, updatelistBoxButtonOptions.map(function (option, i) {
|
|
257
258
|
return react_1.default.createElement("option", { value: option.props.value, key: i });
|
|
258
259
|
}))));
|
|
259
260
|
};
|