@ebay/ui-core-react 7.4.0-alpha.8 → 7.4.0-alpha.9
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/ebay-listbox/index.js +1 -1
- package/ebay-listbox/listbox.d.ts +1 -0
- package/ebay-listbox/listbox.d.ts.map +1 -1
- package/ebay-listbox-button/index.js +2 -2
- package/ebay-listbox-button/listbox-button.d.ts.map +1 -1
- package/{listbox-DGbY99kq.js → listbox-DfOw_fJc.js} +4 -16
- package/package.json +1 -1
package/ebay-listbox/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const listbox = require("../listbox-
|
|
3
|
+
const listbox = require("../listbox-DfOw_fJc.js");
|
|
4
4
|
exports.EbayListbox = listbox.EbayListbox;
|
|
5
5
|
exports.EbayListboxOption = listbox.EbayListboxOption;
|
|
6
6
|
exports.EbayListboxOptionDescription = listbox.EbayListboxOptionDescription;
|
|
@@ -14,6 +14,7 @@ export type EbayListboxProps = Omit<ComponentProps<'div'>, 'onChange'> & {
|
|
|
14
14
|
typeaheadTimeoutLength?: number;
|
|
15
15
|
maxHeight?: string | number;
|
|
16
16
|
selectClassName?: string;
|
|
17
|
+
activeClassName?: string;
|
|
17
18
|
onChange?: EbayChangeEventHandler<HTMLSpanElement, ChangeEventProps>;
|
|
18
19
|
onEscape?: () => void;
|
|
19
20
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listbox.d.ts","sourceRoot":"","sources":["../../src/ebay-listbox/listbox.tsx"],"names":[],"mappings":"AAAA,OAAc,EAA6B,EAAE,EAA4B,MAAM,OAAO,CAAA;AAItF,OAAO,EAAE,cAAc,EAAE,SAAS,EAAoB,MAAM,OAAO,CAAA;AAInE,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAA;AAIlD,MAAM,MAAM,gB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,QAAQ,EAAE,SAAS,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;IAClC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,sBAAsB,CAAC,eAAe,EAAE,gBAAgB,CAAC,CAAC;IACrE,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;CACxB,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,CA2L5C,CAAA"}
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const React = require("react");
|
|
4
4
|
const index = require("../index-DcH7Tjjd.js");
|
|
5
5
|
const classNames = require("classnames");
|
|
6
|
-
const listbox = require("../listbox-
|
|
6
|
+
const listbox = require("../listbox-DfOw_fJc.js");
|
|
7
7
|
const common_componentUtils_utils = require("../common/component-utils/utils/index.js");
|
|
8
8
|
const icon = require("../icon-B17Di3YL.js");
|
|
9
9
|
function onKeyDown(e) {
|
|
@@ -144,7 +144,7 @@ const EbayListboxButton = ({ "aria-invalid": invalid, a11yIconPrefixText, border
|
|
|
144
144
|
React.createElement(icon.EbayIcon, { name: "chevronDown12" })
|
|
145
145
|
)
|
|
146
146
|
),
|
|
147
|
-
React.createElement(listbox.EbayListbox, { className: "listbox-button__listbox", selectClassName: "listbox-button__native", tabIndex: -1, listSelection, name, maxHeight, onChange: handleListboxChange, onEscape: handleListboxEscape }, options.map((option, index2) => React.createElement(listbox.EbayListboxOption, { key: option.props.value || index2, selected: index2 === selectedIndex, className: classNames("listbox-button__option", option.props.className)
|
|
147
|
+
React.createElement(listbox.EbayListbox, { className: "listbox-button__listbox listbox-button__options", selectClassName: "listbox-button__native", activeClassName: "listbox-button__option--active", tabIndex: -1, listSelection, name, maxHeight, onChange: handleListboxChange, onEscape: handleListboxEscape }, options.map((option, index2) => React.createElement(listbox.EbayListboxOption, { ...option.props, key: option.props.value || index2, selected: index2 === selectedIndex, className: classNames("listbox-button__option", option.props.className) })))
|
|
148
148
|
);
|
|
149
149
|
};
|
|
150
150
|
exports.EbayListboxButton = EbayListboxButton;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listbox-button.d.ts","sourceRoot":"","sources":["../../src/ebay-listbox-button/listbox-button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAEV,cAAc,EACd,EAAE,EAKL,MAAM,OAAO,CAAA;AAOd,OAAO,EAAe,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAChE,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAA;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAiDhD,MAAM,MAAM,gBAAgB,GAAG;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;CACvB,CAAA;AAED,MAAM,MAAM,sBAAsB,GAAG,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,UAAU,CAAC,GAAG;IAC9E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,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CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,gBAAgB,CAAC,eAAe,CAAC,CAAC;IAClD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC;IACjC,QAAQ,CAAC,EAAE,eAAe,CAAC,UAAU,CAAC,CAAC;IACvC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,sBAAsB,CAAC,eAAe,EAAE,gBAAgB,CAAC,CAAC;IACrE,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACzB,CAAA;AAED,eAAO,MAAM,uBAAuB,2EAAoB,CAAA;AAExD,eAAO,MAAM,iBAAiB,EAAE,EAAE,CAAC,sBAAsB,CA+LxD,CAAA"}
|
|
@@ -542,7 +542,7 @@ const EbayListboxOption = ({ className, icon: icon$1, text, children, disabled,
|
|
|
542
542
|
);
|
|
543
543
|
};
|
|
544
544
|
const TYPEAHEAD_TIMEOUT_LENGTH = 1300;
|
|
545
|
-
const EbayListbox = ({ name, className, disabled, children, tabIndex = 0, listSelection, maxHeight, typeaheadTimeoutLength, selectClassName, onChange = () => {
|
|
545
|
+
const EbayListbox = ({ name, className, disabled, children, tabIndex = 0, listSelection, maxHeight, typeaheadTimeoutLength, selectClassName, activeClassName, onChange = () => {
|
|
546
546
|
}, onEscape = () => {
|
|
547
547
|
}, ...rest }) => {
|
|
548
548
|
var _a;
|
|
@@ -589,20 +589,8 @@ const EbayListbox = ({ name, className, disabled, children, tabIndex = 0, listSe
|
|
|
589
589
|
const itemIndex = typeaheadRef.current.getIndex(containerRef.current.children, event.key, typeaheadTimeoutLength || TYPEAHEAD_TIMEOUT_LENGTH);
|
|
590
590
|
if (itemIndex !== -1) {
|
|
591
591
|
activeDescendantRef.current.index = itemIndex;
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
}
|
|
595
|
-
function scrollOptions(index2) {
|
|
596
|
-
const listboxOptionsContainerNode = containerRef.current;
|
|
597
|
-
const currentTarget = listboxOptionsContainerNode.querySelectorAll("[role=option]")[index2];
|
|
598
|
-
if (listboxOptionsContainerNode.scrollHeight > listboxOptionsContainerNode.clientHeight) {
|
|
599
|
-
const scrollBottom = listboxOptionsContainerNode.clientHeight + listboxOptionsContainerNode.scrollTop;
|
|
600
|
-
const elementBottom = currentTarget.offsetTop + currentTarget.offsetHeight;
|
|
601
|
-
if (elementBottom > scrollBottom) {
|
|
602
|
-
listboxOptionsContainerNode.scrollTop = elementBottom - listboxOptionsContainerNode.clientHeight;
|
|
603
|
-
} else if (currentTarget.offsetTop < listboxOptionsContainerNode.scrollTop) {
|
|
604
|
-
listboxOptionsContainerNode.scrollTop = currentTarget.offsetTop;
|
|
605
|
-
}
|
|
592
|
+
const selectedOption = containerRef.current.querySelectorAll("[role=option]")[itemIndex];
|
|
593
|
+
containerRef.current.scrollTop = selectedOption.offsetTop - containerRef.current.offsetHeight / 2;
|
|
606
594
|
}
|
|
607
595
|
}
|
|
608
596
|
function handleMouseDown() {
|
|
@@ -623,7 +611,7 @@ const EbayListbox = ({ name, className, disabled, children, tabIndex = 0, listSe
|
|
|
623
611
|
const container = containerRef.current;
|
|
624
612
|
const optionsContainer = containerRef.current;
|
|
625
613
|
activeDescendantRef.current = createLinear(container, optionsContainer, optionsContainer, ".listbox__option[role=option]", {
|
|
626
|
-
activeDescendantClassName: "listbox__option--active",
|
|
614
|
+
activeDescendantClassName: activeClassName || "listbox__option--active",
|
|
627
615
|
autoInit: selectedIndex,
|
|
628
616
|
autoReset: null,
|
|
629
617
|
autoScroll: listSelection !== "auto"
|