@ebay/ui-core-react 5.10.1 → 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, FC } from 'react';
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 EbaySelect: FC<EbaySelectProps>;
17
- export default EbaySelect;
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,OAAc,EAA6B,cAAc,EAAE,EAAE,EAAgC,MAAM,OAAO,CAAA;AAM1G,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,SAAS,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC;IAChC,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,QAAA,MAAM,UAAU,EAAE,EAAE,CAAC,eAAe,CAiFnC,CAAA;AAED,eAAe,UAAU,CAAA"}
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: selectRef,
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) {
@@ -1 +1 @@
1
- {"version":3,"file":"ebay-switch.d.ts","sourceRoot":"","sources":["../../src/ebay-switch/ebay-switch.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAuB,EAAE,EAAe,cAAc,EAAE,MAAM,OAAO,CAAA;AAEnF,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AAEpE,KAAK,KAAK,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,UAAU,CAAC,GAAG;IACrD,QAAQ,CAAC,EAAE,sBAAsB,CAAC,gBAAgB,EAAE;QAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;CACrG,CAAA;AAED,QAAA,MAAM,UAAU,EAAE,EAAE,CAAC,KAAK,CA0CzB,CAAA;AAED,eAAe,UAAU,CAAA"}
1
+ {"version":3,"file":"ebay-switch.d.ts","sourceRoot":"","sources":["../../src/ebay-switch/ebay-switch.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAuB,EAAE,EAAe,cAAc,EAAE,MAAM,OAAO,CAAA;AAEnF,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AAEpE,KAAK,KAAK,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,UAAU,CAAC,GAAG;IACrD,QAAQ,CAAC,EAAE,sBAAsB,CAAC,gBAAgB,EAAE;QAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;CACrG,CAAA;AAID,QAAA,MAAM,UAAU,EAAE,EAAE,CAAC,KAAK,CA2CzB,CAAA;AAED,eAAe,UAAU,CAAA"}
@@ -50,9 +50,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
50
50
  Object.defineProperty(exports, "__esModule", { value: true });
51
51
  var react_1 = __importStar(require("react"));
52
52
  var classnames_1 = __importDefault(require("classnames"));
53
+ var isControlled = function (checked) { return typeof checked !== 'undefined'; };
53
54
  var EbaySwitch = function (_a) {
54
- var id = _a.id, value = _a.value, name = _a.name, className = _a.className, checked = _a.checked, _b = _a.onChange, onChange = _b === void 0 ? function () { } : _b, rest = __rest(_a, ["id", "value", "name", "className", "checked", "onChange"]);
55
- var _c = (0, react_1.useState)(!!checked), isChecked = _c[0], setChecked = _c[1];
55
+ var id = _a.id, value = _a.value, name = _a.name, className = _a.className, checked = _a.checked, _b = _a.defaultChecked, defaultChecked = _b === void 0 ? false : _b, _c = _a.onChange, onChange = _c === void 0 ? function () { } : _c, rest = __rest(_a, ["id", "value", "name", "className", "checked", "defaultChecked", "onChange"]);
56
+ var _d = (0, react_1.useState)(defaultChecked), isChecked = _d[0], setChecked = _d[1];
56
57
  (0, react_1.useEffect)(function () {
57
58
  setChecked(!!checked);
58
59
  }, [checked]);
@@ -65,7 +66,7 @@ var EbaySwitch = function (_a) {
65
66
  setChecked(inputChecked);
66
67
  };
67
68
  return (react_1.default.createElement("span", { className: "switch" },
68
- react_1.default.createElement("input", __assign({}, rest, { className: (0, classnames_1.default)('switch__control', className), id: id, role: "switch", type: "checkbox", value: value, "aria-checked": isChecked, checked: isChecked, name: name, onChange: handleChange })),
69
+ react_1.default.createElement("input", __assign({}, rest, { className: (0, classnames_1.default)('switch__control', className), id: id, role: "switch", type: "checkbox", value: value, "aria-checked": isControlled(checked) ? checked : isChecked, checked: isControlled(checked) ? checked : isChecked, name: name, onChange: handleChange })),
69
70
  react_1.default.createElement("span", { className: "switch__button" })));
70
71
  };
71
72
  exports.default = EbaySwitch;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ebay/ui-core-react",
3
- "version": "5.10.1",
3
+ "version": "5.11.1",
4
4
  "description": "Skin components build off React",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org"