@ebay/ui-core-react 1.2.0 → 1.2.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,13 +1,15 @@
1
+ import { RefObject } from 'react';
1
2
  declare type UseTooltipArgs = {
2
3
  onExpand: () => void;
3
4
  onCollapse: () => void;
4
5
  initialExpanded?: boolean;
6
+ hostRef?: RefObject<HTMLElement>;
5
7
  };
6
8
  declare type UseTooltip = {
7
9
  isExpanded: boolean;
8
10
  expandTooltip: () => void;
9
11
  collapseTooltip: () => void;
10
12
  };
11
- export declare const useTooltip: ({ onExpand, onCollapse, initialExpanded }: UseTooltipArgs) => UseTooltip;
13
+ export declare const useTooltip: ({ onExpand, onCollapse, initialExpanded, hostRef }: UseTooltipArgs) => UseTooltip;
12
14
  export {};
13
15
  //# sourceMappingURL=use-tooltip.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-tooltip.d.ts","sourceRoot":"","sources":["../../../src/common/tooltip-utils/use-tooltip.ts"],"names":[],"mappings":"AAEA,aAAK,cAAc,GAAG;IAClB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC7B,CAAA;AAED,aAAK,UAAU,GAAG;IACd,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,eAAe,EAAE,MAAM,IAAI,CAAC;CAC/B,CAAA;AAED,eAAO,MAAM,UAAU,8CAAuD,cAAc,KAAG,UAqB9F,CAAA"}
1
+ {"version":3,"file":"use-tooltip.d.ts","sourceRoot":"","sources":["../../../src/common/tooltip-utils/use-tooltip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,SAAS,EAAE,MAAM,OAAO,CAAA;AAE3C,aAAK,cAAc,GAAG;IAClB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,OAAO,CAAC,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;CACpC,CAAC;AAEF,aAAK,UAAU,GAAG;IACd,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,eAAe,EAAE,MAAM,IAAI,CAAC;CAC/B,CAAC;AAEF,eAAO,MAAM,UAAU,uDAAgE,cAAc,KAAG,UAuBvG,CAAA"}
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useTooltip = void 0;
4
4
  var react_1 = require("react");
5
5
  exports.useTooltip = function (_a) {
6
- var onExpand = _a.onExpand, onCollapse = _a.onCollapse, _b = _a.initialExpanded, initialExpanded = _b === void 0 ? false : _b;
6
+ var onExpand = _a.onExpand, onCollapse = _a.onCollapse, _b = _a.initialExpanded, initialExpanded = _b === void 0 ? false : _b, hostRef = _a.hostRef;
7
7
  var _c = react_1.useState(initialExpanded), isExpanded = _c[0], setIsExpanded = _c[1];
8
8
  var expandTooltip = function () {
9
9
  setIsExpanded(true);
@@ -12,10 +12,12 @@ exports.useTooltip = function (_a) {
12
12
  }
13
13
  };
14
14
  var collapseTooltip = function () {
15
+ var _a;
15
16
  setIsExpanded(false);
16
17
  if (onCollapse) {
17
18
  onCollapse();
18
19
  }
20
+ (_a = hostRef === null || hostRef === void 0 ? void 0 : hostRef.current) === null || _a === void 0 ? void 0 : _a.focus();
19
21
  };
20
22
  return {
21
23
  isExpanded: isExpanded,
@@ -1 +1 @@
1
- {"version":3,"file":"ebay-infotip.d.ts","sourceRoot":"","sources":["../../src/ebay-infotip/ebay-infotip.tsx"],"names":[],"mappings":"AAAA,OAAc,EAA+B,aAAa,EAAE,EAAE,EAAU,SAAS,EAAE,MAAM,OAAO,CAAA;AAGhG,OAAO,EAAwC,gBAAgB,EAAc,MAAM,yBAAyB,CAAA;AAI5G,OAAO,EAAE,IAAI,EAAE,MAAM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,IAAI,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACxB,CAAC;AAEF,QAAA,MAAM,WAAW,EAAE,EAAE,CAAC,YAAY,CAuFjC,CAAA;AAED,eAAe,WAAW,CAAA"}
@@ -54,7 +54,8 @@ var ebay_infotip_host_1 = __importDefault(require("./ebay-infotip-host"));
54
54
  var index_1 = require("./index");
55
55
  var EbayInfotip = function (_a) {
56
56
  var _b = _a.variant, variant = _b === void 0 ? 'default' : _b, pointer = _a.pointer, overlayStyle = _a.overlayStyle, disabled = _a.disabled, onExpand = _a.onExpand, onCollapse = _a.onCollapse, children = _a.children, initialExpanded = _a.initialExpanded, _c = _a.icon, icon = _c === void 0 ? 'informationSmall' : _c, a11yCloseText = _a.a11yCloseText, ariaLabel = _a["aria-label"], className = _a.className;
57
- var _d = tooltip_utils_1.useTooltip({ onCollapse: onCollapse, onExpand: onExpand, initialExpanded: initialExpanded }), isExpanded = _d.isExpanded, expandTooltip = _d.expandTooltip, collapseTooltip = _d.collapseTooltip;
57
+ var buttonRef = react_1.useRef();
58
+ var _d = tooltip_utils_1.useTooltip({ onCollapse: onCollapse, onExpand: onExpand, initialExpanded: initialExpanded, hostRef: buttonRef }), isExpanded = _d.isExpanded, expandTooltip = _d.expandTooltip, collapseTooltip = _d.collapseTooltip;
58
59
  var isModal = variant === 'modal';
59
60
  var containerRef = react_1.useRef();
60
61
  var heading = component_utils_1.findComponent(children, index_1.EbayInfotipHeading);
@@ -73,7 +74,7 @@ var EbayInfotip = function (_a) {
73
74
  }
74
75
  var _e = content.props, contentChildren = _e.children, contentProps = __rest(_e, ["children"]);
75
76
  return (react_1.default.createElement(tooltip_utils_1.Tooltip, { type: "infotip", isExpanded: isExpanded, className: classnames_1.default(className, { 'dialog--mini': isModal }), ref: containerRef },
76
- react_1.default.createElement(tooltip_utils_1.TooltipHost, null, react_1.cloneElement(button, __assign({ onClick: toggleTooltip, disabled: disabled,
77
+ react_1.default.createElement(tooltip_utils_1.TooltipHost, null, react_1.cloneElement(button, __assign({ ref: buttonRef, onClick: toggleTooltip, disabled: disabled,
77
78
  variant: variant, 'aria-label': ariaLabel, 'aria-expanded': isExpanded, icon: icon }, button.props))),
78
79
  isModal ? (react_1.default.createElement(ebay_lightbox_dialog_1.EbayLightboxDialog, __assign({}, contentProps, { open: isExpanded, onClose: collapseTooltip, mode: "mini", a11yCloseText: a11yCloseText, className: "dialog--mini__overlay" }),
79
80
  react_1.default.createElement(ebay_dialog_base_1.EbayDialogHeader, null),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ebay/ui-core-react",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "Skin components build off React",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",