@deque/cauldron-react 4.7.0-canary.e34d0aa1 → 4.7.0-canary.e9f388bb

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.
@@ -8,6 +8,7 @@ export interface ClickOutsideListenerProps<T extends HTMLElement = HTMLElement>
8
8
  target?: T;
9
9
  }
10
10
  export default class ClickOutsideListener extends React.Component<ClickOutsideListenerProps> {
11
+ static displayName: string;
11
12
  static defaultProps: {
12
13
  mouseEvent: string;
13
14
  touchEvent: string;
@@ -5,7 +5,7 @@ export interface SideBarProps extends React.HTMLAttributes<HTMLUListElement> {
5
5
  onDismiss: () => void;
6
6
  className?: string;
7
7
  show: boolean;
8
- navProps: React.HTMLAttributes<HTMLElement>;
8
+ navProps?: React.HTMLAttributes<HTMLElement>;
9
9
  }
10
10
  interface SideBarState {
11
11
  wide: boolean;
package/lib/index.js CHANGED
@@ -899,6 +899,7 @@ var ClickOutsideListener = /** @class */ (function (_super) {
899
899
  ref: resolveRef
900
900
  });
901
901
  };
902
+ ClickOutsideListener.displayName = 'ClickOutsideListener';
902
903
  ClickOutsideListener.defaultProps = {
903
904
  mouseEvent: 'click',
904
905
  touchEvent: 'touchend'
@@ -1560,8 +1561,10 @@ var Dialog = /** @class */ (function (_super) {
1560
1561
  };
1561
1562
  Dialog.prototype.close = function () {
1562
1563
  var _a, _b, _c;
1563
- (_a = this.state.isolator) === null || _a === void 0 ? void 0 : _a.deactivate();
1564
- (_c = (_b = this.props).onClose) === null || _c === void 0 ? void 0 : _c.call(_b);
1564
+ if (this.props.show) {
1565
+ (_a = this.state.isolator) === null || _a === void 0 ? void 0 : _a.deactivate();
1566
+ (_c = (_b = this.props).onClose) === null || _c === void 0 ? void 0 : _c.call(_b);
1567
+ }
1565
1568
  };
1566
1569
  Dialog.prototype.handleClickOutside = function () {
1567
1570
  var _a = this.props, show = _a.show, forceAction = _a.forceAction;
@@ -8368,7 +8371,6 @@ var Tabs = function (_a) {
8368
8371
  var children = _a.children, thin = _a.thin, _b = _a.orientation, orientation = _b === void 0 ? 'horizontal' : _b, _c = _a.initialActiveIndex, initialActiveIndex = _c === void 0 ? 0 : _c, className = _a.className, onChange = _a.onChange, labelProp = tslib.__rest(_a, ["children", "thin", "orientation", "initialActiveIndex", "className", "onChange"]);
8369
8372
  var _d = tslib.__read(React.useState(initialActiveIndex), 2), activeIndex = _d[0], setActiveIndex = _d[1];
8370
8373
  var tabsRef = React.useRef(null);
8371
- var focusedTabRef = React.useRef(null);
8372
8374
  var tabs = React__default.Children.toArray(children).filter(function (child) { return child.type === Tab; });
8373
8375
  var tabCount = tabs.length;
8374
8376
  var handleClick = function (index) {
@@ -8441,14 +8443,15 @@ var Tabs = function (_a) {
8441
8443
  }, [activeIndex]);
8442
8444
  var config = tslib.__assign((_a = { id: id, className: classNames('Tab', {
8443
8445
  'Tab--active': selected
8444
- }), tabIndex: index === activeIndex ? 0 : -1 }, _a['aria-controls'] = (_b = target.current) === null || _b === void 0 ? void 0 : _b.id, _a['aria-selected'] = selected, _a.ref = index === activeIndex ? focusedTabRef : null, _a.onClick = function () { return handleClick(index); }, _a), other);
8446
+ }), tabIndex: index === activeIndex ? 0 : -1 }, _a['aria-controls'] = (_b = target.current) === null || _b === void 0 ? void 0 : _b.id, _a['aria-selected'] = selected, _a.onClick = function () { return handleClick(index); }, _a), other);
8445
8447
  return React__default.cloneElement(child, config);
8446
8448
  });
8447
8449
  useDidUpdate(function () {
8448
8450
  var _a;
8449
- (_a = focusedTabRef.current) === null || _a === void 0 ? void 0 : _a.focus();
8451
+ var activeTab = (_a = tabsRef.current) === null || _a === void 0 ? void 0 : _a.querySelector(':scope > [role="tablist"] > [aria-selected="true"]');
8452
+ activeTab === null || activeTab === void 0 ? void 0 : activeTab.focus();
8450
8453
  if (typeof onChange === 'function') {
8451
- onChange({ activeTabIndex: activeIndex, target: focusedTabRef.current });
8454
+ onChange({ activeTabIndex: activeIndex, target: activeTab });
8452
8455
  }
8453
8456
  }, [activeIndex]);
8454
8457
  return (React__default.createElement("div", { className: classNames('Tabs', className, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deque/cauldron-react",
3
- "version": "4.7.0-canary.e34d0aa1",
3
+ "version": "4.7.0-canary.e9f388bb",
4
4
  "description": "Fully accessible react components library for Deque Cauldron",
5
5
  "publishConfig": {
6
6
  "access": "public"