@ebay/ui-core-react 5.11.0 → 5.11.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,4 +1,4 @@
|
|
|
1
|
-
import { ComponentProps
|
|
1
|
+
import React, { ComponentProps } from 'react';
|
|
2
2
|
import { EbayChangeEventHandler } from '../common/event-utils/types';
|
|
3
3
|
type SelectValue = string | ReadonlyArray<string> | number;
|
|
4
4
|
export type ChangeEventProps = {
|
|
@@ -10,9 +10,10 @@ export type EbaySelectProps = Omit<ComponentProps<'select'>, 'onChange'> & {
|
|
|
10
10
|
defaultValue?: SelectValue;
|
|
11
11
|
onChange?: EbayChangeEventHandler<HTMLSelectElement, ChangeEventProps>;
|
|
12
12
|
floatingLabel?: string;
|
|
13
|
+
forwardedRef?: React.Ref<HTMLSelectElement>;
|
|
13
14
|
inputSize?: 'default' | 'large';
|
|
14
15
|
invalid?: boolean;
|
|
15
16
|
};
|
|
16
|
-
declare const
|
|
17
|
-
export default
|
|
17
|
+
declare const _default: React.ForwardRefExoticComponent<Pick<EbaySelectProps, "form" | "slot" | "style" | "title" | "forwardedRef" | "invalid" | "key" | "value" | "className" | "disabled" | "inputSize" | "placeholder" | "children" | "multiple" | "name" | "required" | "size" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "autoComplete" | "autoFocus" | "borderless" | "floatingLabel"> & React.RefAttributes<React.FC<EbaySelectProps>>>;
|
|
18
|
+
export default _default;
|
|
18
19
|
//# sourceMappingURL=ebay-select.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ebay-select.d.ts","sourceRoot":"","sources":["../../src/ebay-select/ebay-select.tsx"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"ebay-select.d.ts","sourceRoot":"","sources":["../../src/ebay-select/ebay-select.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAA6B,cAAc,EAA4B,MAAM,OAAO,CAAA;AAMlG,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AAIpE,KAAK,WAAW,GAAG,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;AAC3D,MAAM,MAAM,gBAAgB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CAAA;AACpE,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,UAAU,CAAC,GAAG;IACvE,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,YAAY,CAAC,EAAE,WAAW,CAAC;IAC3B,QAAQ,CAAC,EAAE,sBAAsB,CAAC,iBAAiB,EAAE,gBAAgB,CAAC,CAAC;IACvE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IAC5C,SAAS,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC;IAChC,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;;AAqFF,wBAA0D"}
|
|
@@ -56,12 +56,11 @@ var component_utils_1 = require("../common/component-utils");
|
|
|
56
56
|
var hooks_1 = require("../common/floating-label-utils/hooks");
|
|
57
57
|
var isControlled = function (value) { return typeof value !== 'undefined'; };
|
|
58
58
|
var EbaySelect = function (_a) {
|
|
59
|
-
var controlledValue = _a.value, defaultValue = _a.defaultValue, className = _a.className, borderless = _a.borderless, name = _a.name, disabled = _a.disabled, _b = _a.onChange, onChange = _b === void 0 ? function () { } : _b, _c = _a.onBlur, onBlur = _c === void 0 ? function () { } : _c, _d = _a.onFocus, onFocus = _d === void 0 ? function () { } : _d, floatingLabel = _a.floatingLabel, children = _a.children, inputSize = _a.inputSize, invalid = _a.invalid, rest = __rest(_a, ["value", "defaultValue", "className", "borderless", "name", "disabled", "onChange", "onBlur", "onFocus", "floatingLabel", "children", "inputSize", "invalid"]);
|
|
59
|
+
var controlledValue = _a.value, defaultValue = _a.defaultValue, className = _a.className, borderless = _a.borderless, name = _a.name, disabled = _a.disabled, _b = _a.onChange, onChange = _b === void 0 ? function () { } : _b, _c = _a.onBlur, onBlur = _c === void 0 ? function () { } : _c, _d = _a.onFocus, onFocus = _d === void 0 ? function () { } : _d, floatingLabel = _a.floatingLabel, forwardedRef = _a.forwardedRef, children = _a.children, inputSize = _a.inputSize, invalid = _a.invalid, rest = __rest(_a, ["value", "defaultValue", "className", "borderless", "name", "disabled", "onChange", "onBlur", "onFocus", "floatingLabel", "forwardedRef", "children", "inputSize", "invalid"]);
|
|
60
60
|
var isFieldInvalid = invalid || rest['aria-invalid'] === 'true';
|
|
61
61
|
var _e = (0, react_1.useState)(defaultValue), value = _e[0], setValue = _e[1];
|
|
62
|
-
var selectRef = (0, react_1.useRef)(null);
|
|
63
62
|
var _f = (0, hooks_1.useFloatingLabel)({
|
|
64
|
-
ref:
|
|
63
|
+
ref: forwardedRef,
|
|
65
64
|
inputId: rest.id,
|
|
66
65
|
className: className,
|
|
67
66
|
disabled: disabled,
|
|
@@ -95,7 +94,7 @@ var EbaySelect = function (_a) {
|
|
|
95
94
|
react_1.default.createElement("select", __assign({}, rest, { name: name, value: isControlled(controlledValue) ? controlledValue : value, disabled: disabled, onChange: handleSelectChange, onBlur: handleBlur, onFocus: handleFocus, ref: ref }), options(children)),
|
|
96
95
|
react_1.default.createElement(ebay_icon_1.EbayIcon, { name: "chevronDown12", height: "8", width: "8" }))));
|
|
97
96
|
};
|
|
98
|
-
exports.default = EbaySelect;
|
|
97
|
+
exports.default = (0, component_utils_1.withForwardRef)(EbaySelect);
|
|
99
98
|
function optionGroups(data) {
|
|
100
99
|
var optGroups = {};
|
|
101
100
|
data.forEach(function (opt) {
|