@deque/cauldron-react 7.1.0-canary.b7d2a9c6 → 7.1.0-canary.b914451f

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.
@@ -10,7 +10,7 @@ declare const AccordionTrigger: {
10
10
  ({ children, ...triggerProps }: AccordionTriggerProps): React.JSX.Element;
11
11
  displayName: string;
12
12
  };
13
- interface AccordionContentProps extends React.HTMLAttributes<HTMLDivElement> {
13
+ interface AccordionContentProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onToggle'> {
14
14
  children: React.ReactNode | React.ReactNode[];
15
15
  className?: string;
16
16
  }
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { type ActionListSelectionType, type onActionCallbackFunction } from './ActionListContext';
3
- interface ActionListProps extends React.HTMLAttributes<HTMLUListElement> {
3
+ interface ActionListProps extends Omit<React.HTMLAttributes<HTMLUListElement>, 'defaultValue' | 'onSelect'> {
4
4
  children: React.ReactNode;
5
5
  /** Limits the amount of selections that can be made within an action list */
6
6
  selectionType?: ActionListSelectionType | null;
@@ -1,13 +1,19 @@
1
1
  import React from 'react';
2
+ import type { onActionCallbackFunction } from '../ActionList/ActionListContext';
3
+ interface ActionMenuListProps {
4
+ ref?: React.Ref<HTMLElement>;
5
+ onAction?: onActionCallbackFunction;
6
+ [key: string]: unknown;
7
+ }
2
8
  type ActionMenuTriggerProps = Pick<React.HTMLAttributes<HTMLButtonElement>, 'children' | 'onClick' | 'onKeyDown' | 'aria-expanded' | 'aria-haspopup' | 'aria-controls'> & {
3
- ref: React.RefObject<HTMLButtonElement>;
9
+ ref: React.RefObject<HTMLButtonElement | null>;
4
10
  };
5
11
  type ActionMenuTriggerFunction = (props: ActionMenuTriggerProps, open: boolean) => React.ReactElement;
6
12
  declare const ActionMenu: React.ForwardRefExoticComponent<{
7
- children: React.ReactElement;
13
+ children: React.ReactElement<ActionMenuListProps>;
8
14
  trigger: React.ReactElement | ActionMenuTriggerFunction;
9
15
  /** Render the action menu in a different location in the dom. */
10
- portal?: HTMLElement | React.RefObject<HTMLElement> | undefined;
16
+ portal?: HTMLElement | React.RefObject<HTMLElement | null> | undefined;
11
17
  /**
12
18
  * Controls whether the menu should render as a child of the trigger, as opposed to
13
19
  * rendering as a sibling. Intended for use with nested menu patterns, for example
@@ -17,7 +23,7 @@ declare const ActionMenu: React.ForwardRefExoticComponent<{
17
23
  */
18
24
  renderInTrigger?: boolean | undefined;
19
25
  } & Pick<{
20
- target: HTMLElement | React.RefObject<HTMLElement> | React.MutableRefObject<HTMLElement>;
26
+ target: HTMLElement | React.RefObject<HTMLElement | null> | React.MutableRefObject<HTMLElement | null>;
21
27
  placement?: "auto" | import("@floating-ui/utils").Placement | "auto-start" | "auto-end" | undefined;
22
28
  open?: boolean | undefined;
23
29
  onOpenChange?: ((open: boolean) => void) | undefined;
@@ -31,7 +37,7 @@ declare const ActionMenu: React.ForwardRefExoticComponent<{
31
37
  returnFocus?: boolean | undefined;
32
38
  returnFocusElement?: import("../../types").ElementOrRef<HTMLElement> | undefined;
33
39
  } | undefined;
34
- portal?: HTMLElement | React.RefObject<HTMLElement> | undefined;
40
+ portal?: HTMLElement | React.RefObject<HTMLElement | null> | undefined;
35
41
  children?: React.ReactNode;
36
42
  } & React.HTMLAttributes<HTMLElement> & {
37
43
  as?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined;
@@ -3,7 +3,7 @@ import React from 'react';
3
3
  import useFocusTrap from '../../utils/useFocusTrap';
4
4
  declare const AnchoredOverlay: React.ForwardRefExoticComponent<{
5
5
  /** A target element or ref to attach the overlay anchor element. */
6
- target: HTMLElement | React.RefObject<HTMLElement> | React.MutableRefObject<HTMLElement>;
6
+ target: HTMLElement | React.RefObject<HTMLElement | null> | React.MutableRefObject<HTMLElement | null>;
7
7
  /** Positional placement value to anchor the overlay element relative to its anchored target. */
8
8
  placement?: "auto" | Placement | "auto-start" | "auto-end" | undefined;
9
9
  /** Determines if the overlay anchor is currently visible. */
@@ -21,7 +21,7 @@ declare const AnchoredOverlay: React.ForwardRefExoticComponent<{
21
21
  /** When `focusTrap` is true, optional arguments to configure the focus trap. */
22
22
  focusTrapOptions?: Parameters<typeof useFocusTrap>[1];
23
23
  /** Render the anchored overlay in a different location in the dom. */
24
- portal?: HTMLElement | React.RefObject<HTMLElement> | undefined;
24
+ portal?: HTMLElement | React.RefObject<HTMLElement | null> | undefined;
25
25
  children?: React.ReactNode;
26
26
  } & React.HTMLAttributes<HTMLElement> & {
27
27
  as?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined;
@@ -4,7 +4,7 @@ export interface ClickOutsideListenerProps<T extends HTMLElement = HTMLElement>
4
4
  onClickOutside: (e: MouseEvent | TouchEvent) => void;
5
5
  mouseEvent?: 'mousedown' | 'click' | 'mouseup' | false;
6
6
  touchEvent?: 'touchstart' | 'touchend' | false;
7
- target?: T | React.RefObject<T> | React.MutableRefObject<T>;
7
+ target?: T | React.RefObject<T | null> | React.MutableRefObject<T | null>;
8
8
  }
9
9
  declare const _default: React.ForwardRefExoticComponent<ClickOutsideListenerProps<HTMLElement> & React.RefAttributes<HTMLElement>>;
10
10
  export default _default;
@@ -19,7 +19,7 @@ interface BaseComboboxProps extends Omit<React.InputHTMLAttributes<HTMLInputElem
19
19
  autocomplete?: 'none' | 'manual' | 'automatic';
20
20
  onActiveChange?: (option: ListboxOption) => void;
21
21
  renderNoResults?: (() => React.JSX.Element) | React.ReactElement;
22
- portal?: React.RefObject<HTMLElement> | HTMLElement;
22
+ portal?: React.RefObject<HTMLElement | null> | HTMLElement;
23
23
  inputRef?: React.Ref<HTMLInputElement>;
24
24
  description?: React.ReactNode;
25
25
  }
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  interface DialogContextValue {
3
3
  headingId: string;
4
- headingRef: React.RefObject<HTMLHeadingElement>;
4
+ headingRef: React.RefObject<HTMLHeadingElement | null>;
5
5
  headingLevel: number;
6
6
  onClose: () => void;
7
7
  forceAction: boolean;
@@ -11,7 +11,7 @@ export interface DialogProps extends React.HTMLAttributes<HTMLDivElement> {
11
11
  level: number | undefined;
12
12
  };
13
13
  closeButtonText?: string;
14
- portal?: React.RefObject<HTMLElement> | HTMLElement;
14
+ portal?: React.RefObject<HTMLElement | null> | HTMLElement;
15
15
  scrollable?: boolean;
16
16
  }
17
17
  declare const Dialog: React.ForwardRefExoticComponent<DialogProps & React.RefAttributes<HTMLDivElement>>;
@@ -10,7 +10,7 @@ export interface DrawerProps<T extends HTMLElement = HTMLElement> extends React.
10
10
  returnFocus?: ElementOrRef<T>;
11
11
  };
12
12
  onClose?: () => void;
13
- portal?: React.RefObject<HTMLElement> | HTMLElement;
13
+ portal?: React.RefObject<HTMLElement | null> | HTMLElement;
14
14
  }
15
15
  declare const Drawer: React.ForwardRefExoticComponent<DrawerProps<HTMLElement> & React.RefAttributes<HTMLDivElement>>;
16
16
  export default Drawer;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- export interface ExpandCollapsePanelProps extends React.HTMLAttributes<HTMLDivElement> {
2
+ export interface ExpandCollapsePanelProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onToggle'> {
3
3
  open?: boolean;
4
4
  children: React.ReactNode;
5
5
  animationTiming?: number | boolean;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import type { ListboxOption } from './ListboxContext';
3
3
  import type { ListboxValue } from './ListboxOption';
4
- import type { PolymorphicProps, PolymorphicComponent } from '../../utils/polymorphicComponent';
4
+ import type { PolymorphicProps, PolymorphicComponentProps } from '../../utils/polymorphicComponent';
5
5
  interface BaseListboxProps extends PolymorphicProps<Omit<React.HTMLAttributes<HTMLElement>, 'onSelect' | 'defaultValue'>> {
6
6
  navigation?: 'cycle' | 'bound';
7
7
  focusStrategy?: 'lastSelected' | 'first' | 'last';
@@ -30,5 +30,10 @@ interface MultiSelectListboxProps extends BaseListboxProps {
30
30
  value: ListboxValue[];
31
31
  }) => void;
32
32
  }
33
- declare const Listbox: PolymorphicComponent<SingleSelectListboxProps | MultiSelectListboxProps>;
33
+ type ListboxComponent = Omit<React.ForwardRefExoticComponent<SingleSelectListboxProps | MultiSelectListboxProps>, keyof CallableFunction> & {
34
+ <T extends React.ElementType = React.ElementType>(props: PolymorphicComponentProps<MultiSelectListboxProps, T>): React.ReactElement | null;
35
+ <T extends React.ElementType = React.ElementType>(props: PolymorphicComponentProps<SingleSelectListboxProps, T>): React.ReactElement | null;
36
+ <T extends React.ElementType = React.ElementType>(props: PolymorphicComponentProps<SingleSelectListboxProps | MultiSelectListboxProps, T>): React.ReactElement | null;
37
+ };
38
+ declare const Listbox: ListboxComponent;
34
39
  export default Listbox;
@@ -12,6 +12,7 @@ export default class TopBar extends React.Component<MenuBarProps, MenuBarState>
12
12
  thin: boolean;
13
13
  hasTrigger: boolean;
14
14
  };
15
+ private menuBarRef;
15
16
  constructor(props: MenuBarProps);
16
17
  componentDidMount(): void;
17
18
  componentWillUnmount(): void;
@@ -3,13 +3,13 @@ import { Cauldron } from '../../types';
3
3
  import AnchoredOverlay from '../AnchoredOverlay';
4
4
  export type PopoverVariant = 'prompt' | 'custom';
5
5
  type BaseProps = React.HTMLAttributes<HTMLDivElement> & {
6
- target: React.RefObject<HTMLElement> | HTMLElement;
6
+ target: React.RefObject<HTMLElement | null> | HTMLElement;
7
7
  variant?: PopoverVariant;
8
8
  show: boolean;
9
9
  onClose: () => void;
10
10
  placement?: React.ComponentProps<typeof AnchoredOverlay>['placement'];
11
11
  /** Render the popover in a different location in the dom. */
12
- portal?: React.RefObject<HTMLElement> | HTMLElement;
12
+ portal?: React.RefObject<HTMLElement | null> | HTMLElement;
13
13
  };
14
14
  type CustomProps = BaseProps & {
15
15
  variant: 'custom';
@@ -10,6 +10,6 @@ type TableProvider = {
10
10
  columns: Array<Column>;
11
11
  };
12
12
  declare const TableContext: React.Context<TableContext>;
13
- declare function TableProvider({ children, layout, columns }: TableProvider): JSX.Element;
13
+ declare function TableProvider({ children, layout, columns }: TableProvider): React.JSX.Element;
14
14
  declare function useTable(): TableContext;
15
15
  export { TableProvider, useTable };
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  interface TabProps extends React.HTMLAttributes<HTMLLIElement> {
3
- target: React.RefObject<HTMLDivElement> | HTMLElement;
3
+ target: React.RefObject<HTMLDivElement | null> | HTMLElement;
4
4
  id?: string;
5
5
  children?: React.ReactNode;
6
6
  }
@@ -3,14 +3,14 @@ import AnchoredOverlay from '../AnchoredOverlay';
3
3
  export interface TooltipProps extends React.HTMLAttributes<HTMLDivElement> {
4
4
  children: React.ReactNode;
5
5
  className?: string;
6
- target: React.RefObject<HTMLElement> | HTMLElement;
6
+ target: React.RefObject<HTMLElement | null> | HTMLElement;
7
7
  variant?: 'text' | 'info' | 'big';
8
8
  association?: 'aria-labelledby' | 'aria-describedby' | 'none';
9
9
  show?: boolean | undefined;
10
10
  defaultShow?: boolean;
11
11
  placement?: React.ComponentProps<typeof AnchoredOverlay>['placement'];
12
12
  /** Render the tooltip in a different location in the dom. */
13
- portal?: React.RefObject<HTMLElement> | HTMLElement;
13
+ portal?: React.RefObject<HTMLElement | null> | HTMLElement;
14
14
  hideElementOnHidden?: boolean;
15
15
  }
16
16
  declare function Tooltip({ id: propId, placement: initialPlacement, children, portal, target, association, variant, show: showProp, defaultShow, hideElementOnHidden, className, ...props }: TooltipProps): React.JSX.Element;
package/lib/index.js CHANGED
@@ -495,24 +495,25 @@ var Accordion = function (_a) {
495
495
  var childrenArray = React__default["default"].Children.toArray(children);
496
496
  var trigger = childrenArray.find(function (child) {
497
497
  return typeof child === 'string' ||
498
- child.type === AccordionTrigger;
498
+ (React__default["default"].isValidElement(child) && child.type === AccordionTrigger);
499
499
  });
500
500
  var panelElement = childrenArray.find(function (child) {
501
501
  return typeof child === 'string' ||
502
- child.type === AccordionContent;
502
+ (React__default["default"].isValidElement(child) && child.type === AccordionContent);
503
503
  });
504
- var isValid = !!(React__default["default"].isValidElement(trigger) && React__default["default"].isValidElement(panelElement));
505
- if (!isValid) {
504
+ if (!React__default["default"].isValidElement(trigger) ||
505
+ !React__default["default"].isValidElement(panelElement)) {
506
506
  console.warn('Must provide <AccordionTrigger /> and <AccordionContent /> element(s). You provided:', {
507
507
  trigger: trigger,
508
508
  panelElement: panelElement,
509
- isValid: isValid
509
+ isValid: false
510
510
  });
511
511
  return null;
512
512
  }
513
+ var panelProps = panelElement.props;
513
514
  return (React__default["default"].createElement("div", tslib.__assign({ className: "Accordion" }, props),
514
- React__default["default"].createElement(ExpandCollapsePanel, tslib.__assign({ id: panelElement.props.id || "".concat(elementId, "-panel"), open: open, onToggle: onToggle, animationTiming: animationTiming }, panelElement.props),
515
- React__default["default"].createElement(PanelTrigger$1, tslib.__assign({ iconCollapsed: "triangle-right", iconExpanded: "triangle-down", className: classNames__default["default"]('Accordion__trigger', trigger.props.className), "aria-controls": panelElement.props.id || "".concat(elementId, "-panel"), heading: trigger.props.heading }, trigger.props), trigger),
515
+ React__default["default"].createElement(ExpandCollapsePanel, tslib.__assign({ id: panelProps.id || "".concat(elementId, "-panel"), open: open, onToggle: onToggle, animationTiming: animationTiming }, panelProps),
516
+ React__default["default"].createElement(PanelTrigger$1, tslib.__assign({ iconCollapsed: "triangle-right", iconExpanded: "triangle-down", className: classNames__default["default"]('Accordion__trigger', trigger.props.className), "aria-controls": panelProps.id || "".concat(elementId, "-panel"), heading: trigger.props.heading }, trigger.props), trigger),
516
517
  panelElement)));
517
518
  };
518
519
  Accordion.displayName = 'Accordion';
@@ -578,7 +579,9 @@ var Scrim = /** @class */ (function (_super) {
578
579
  if (destroy) {
579
580
  return null;
580
581
  }
581
- return (React__default["default"].createElement("div", { ref: function (el) { return (_this.el = el); }, className: "Scrim ".concat(animationClass) }));
582
+ return (React__default["default"].createElement("div", { ref: function (el) {
583
+ _this.el = el;
584
+ }, className: "Scrim ".concat(animationClass) }));
582
585
  };
583
586
  return Scrim;
584
587
  }(React__default["default"].Component));
@@ -672,6 +675,7 @@ var TopBar$1 = /** @class */ (function (_super) {
672
675
  tslib.__extends(TopBar, _super);
673
676
  function TopBar(props) {
674
677
  var _this = _super.call(this, props) || this;
678
+ _this.menuBarRef = React__default["default"].createRef();
675
679
  _this.onResize = function () {
676
680
  var wide = isWide();
677
681
  if (wide === _this.state.wide) {
@@ -720,10 +724,10 @@ var TopBar$1 = /** @class */ (function (_super) {
720
724
  };
721
725
  TopBar.prototype.onKeyDown = function (e) {
722
726
  var key = keyname__default["default"](e.which);
723
- // This is a temporary workaround until have an opportunity to refactor or replace menubar
724
- // see: https://github.com/dequelabs/cauldron/issues/1934
725
- // eslint-disable-next-line react/no-find-dom-node
726
- var menuBarElement = reactDom.findDOMNode(this);
727
+ var menuBarElement = this.menuBarRef.current;
728
+ if (!menuBarElement) {
729
+ return;
730
+ }
727
731
  var menuItems = Array.from(menuBarElement.children);
728
732
  // account for hidden side bar trigger (hamburger)
729
733
  if (this.state.wide && this.props.hasTrigger) {
@@ -750,7 +754,7 @@ var TopBar$1 = /** @class */ (function (_super) {
750
754
  // disabling no-unused-vars to prevent thin/hasTrigger from being passed through to div
751
755
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
752
756
  var _a = this.props, children = _a.children, className = _a.className; _a.thin; _a.hasTrigger; tslib.__rest(_a, ["children", "className", "thin", "hasTrigger"]);
753
- return (React__default["default"].createElement("ul", { role: "menubar", onKeyDown: this.onKeyDown, className: className }, React.Children.map(children, this.renderChild)));
757
+ return (React__default["default"].createElement("ul", { role: "menubar", onKeyDown: this.onKeyDown, className: className, ref: this.menuBarRef }, React.Children.map(children, this.renderChild)));
754
758
  };
755
759
  TopBar.defaultProps = {
756
760
  thin: false,
@@ -806,9 +810,16 @@ function resolveElement(elementOrRef) {
806
810
  return null;
807
811
  }
808
812
 
813
+ function getChildRef(child, version) {
814
+ if (version === void 0) { version = React__default["default"].version; }
815
+ return parseInt(version, 10) >= 19
816
+ ? child.props.ref
817
+ : child.ref;
818
+ }
819
+
809
820
  function ClickOutsideListener(_a, ref) {
810
821
  var children = _a.children, _b = _a.mouseEvent, mouseEvent = _b === void 0 ? 'click' : _b, _c = _a.touchEvent, touchEvent = _c === void 0 ? 'touchend' : _c, target = _a.target, _d = _a.onClickOutside, onClickOutside = _d === void 0 ? function () { return null; } : _d;
811
- var childElementRef = React.useRef();
822
+ var childElementRef = React.useRef(null);
812
823
  var handleEvent = function (event) {
813
824
  if (event.defaultPrevented) {
814
825
  return;
@@ -831,9 +842,8 @@ function ClickOutsideListener(_a, ref) {
831
842
  childElementRef.current = node;
832
843
  // Ref for this component should pass-through to the child node
833
844
  setRef(ref, node);
834
- // If child has its own ref, we want to update
835
- // its ref with the newly cloned node
836
- var childRef = children.ref;
845
+ // Forward the child's own ref. In React 19 ref lives in props; in 16–18 it's element.ref.
846
+ var childRef = getChildRef(children);
837
847
  setRef(childRef, node);
838
848
  };
839
849
  React.useEffect(function () {
@@ -1342,7 +1352,7 @@ var AriaIsolate = /** @class */ (function () {
1342
1352
 
1343
1353
  /**
1344
1354
  * When a component needs to track an internal ref on a component that has a
1345
- * forwarded ref, useSharedRef will return a MutableRefObject<T> that will
1355
+ * forwarded ref, useSharedRef will return a RefObject<T | null> that will
1346
1356
  * correctly invoke the parent ref as well providing an internal ref.
1347
1357
  *
1348
1358
  * @example
@@ -1355,7 +1365,7 @@ var AriaIsolate = /** @class */ (function () {
1355
1365
  * })
1356
1366
  */
1357
1367
  function useSharedRef(ref) {
1358
- var internalRef = React.useRef();
1368
+ var internalRef = React.useRef(null);
1359
1369
  React.useEffect(function () {
1360
1370
  setRef(ref, internalRef.current);
1361
1371
  return function () { return setRef(ref, null); };
@@ -1488,7 +1498,7 @@ function useFocusTrap(target, options) {
1488
1498
  if (options === void 0) { options = {}; }
1489
1499
  var _a = options.disabled, disabled = _a === void 0 ? false : _a, _b = options.returnFocus, returnFocus = _b === void 0 ? true : _b, initialFocusElementOrRef = options.initialFocusElement, returnFocusElement = options.returnFocusElement;
1490
1500
  var focusTrap = React.useRef(null);
1491
- var returnFocusElementRef = React.useRef();
1501
+ var returnFocusElementRef = React.useRef(null);
1492
1502
  function restoreFocusToReturnFocusElement() {
1493
1503
  var _a;
1494
1504
  var resolvedReturnFocusElement = resolveElement(returnFocusElement);
@@ -1538,7 +1548,7 @@ var Dialog = React.forwardRef(function (_a, ref) {
1538
1548
  var dialogRef = useSharedRef(dialogRefProp || ref);
1539
1549
  var _g = tslib.__read(nextId.useId(1, 'dialog-title-'), 1), headingId = _g[0];
1540
1550
  var headingRef = React.useRef(null);
1541
- var isolatorRef = React.useRef();
1551
+ var isolatorRef = React.useRef(null);
1542
1552
  var headingLevel = typeof heading === 'object' && 'level' in heading && heading.level
1543
1553
  ? heading.level
1544
1554
  : 2;
@@ -2133,7 +2143,7 @@ var looksLikeLink = function (props) {
2133
2143
  };
2134
2144
  var IconButton = React.forwardRef(function (_a, ref) {
2135
2145
  var _b = _a.as, Component = _b === void 0 ? 'button' : _b, icon = _a.icon, label = _a.label, _c = _a.tooltipProps, tooltipPropsProp = _c === void 0 ? {} : _c, className = _a.className, _d = _a.variant, variant = _d === void 0 ? 'secondary' : _d, disabled = _a.disabled, _e = _a.tabIndex, tabIndex = _e === void 0 ? 0 : _e, large = _a.large, other = tslib.__rest(_a, ["as", "icon", "label", "tooltipProps", "className", "variant", "disabled", "tabIndex", "large"]);
2136
- var internalRef = React.useRef();
2146
+ var internalRef = React.useRef(null);
2137
2147
  React.useImperativeHandle(ref, function () { return internalRef.current; });
2138
2148
  // Configure additional properties based on the type of the Component
2139
2149
  // for accessibility
@@ -2695,7 +2705,7 @@ Checkbox.displayName = 'Checkbox';
2695
2705
  */
2696
2706
  function TooltipTabstop(_a) {
2697
2707
  var children = _a.children, className = _a.className, tooltip = _a.tooltip, variant = _a.variant, association = _a.association, show = _a.show, placement = _a.placement, portal = _a.portal, hideElementOnHidden = _a.hideElementOnHidden, buttonProps = tslib.__rest(_a, ["children", "className", "tooltip", "variant", "association", "show", "placement", "portal", "hideElementOnHidden"]);
2698
- var buttonRef = React.useRef();
2708
+ var buttonRef = React.useRef(null);
2699
2709
  return (React__default["default"].createElement(React__default["default"].Fragment, null,
2700
2710
  React__default["default"].createElement("button", tslib.__assign({ type: "button", ref: buttonRef, "aria-disabled": "true", className: classNames__default["default"]('TooltipTabstop', className) }, buttonProps), children),
2701
2711
  React__default["default"].createElement(Tooltip, { target: buttonRef, variant: variant, association: association, show: show, placement: placement, portal: portal, hideElementOnHidden: hideElementOnHidden }, tooltip)));
@@ -3539,7 +3549,7 @@ var TwoColumnPanel = React.forwardRef(function (_a, ref) {
3539
3549
  var closeButtonRef = React.useRef(null);
3540
3550
  var columnLeftRef = React.useRef(null);
3541
3551
  var columnRightRef = React.useRef(null);
3542
- var columnLeft = React__default["default"].Children.toArray(children).find(function (child) { return child.type === ColumnLeft; });
3552
+ var columnLeft = React__default["default"].Children.toArray(children).find(function (child) { return React__default["default"].isValidElement(child) && child.type === ColumnLeft; });
3543
3553
  var togglePanel = function () {
3544
3554
  var prefersReducedMotion = 'matchMedia' in window &&
3545
3555
  typeof matchMedia === 'function' &&
@@ -3572,16 +3582,17 @@ var TwoColumnPanel = React.forwardRef(function (_a, ref) {
3572
3582
  var ColumnLeftComponent;
3573
3583
  var columnLeftId;
3574
3584
  if (React.isValidElement(columnLeft)) {
3575
- var ref_1 = columnLeft.props.ref || columnLeftRef;
3585
+ var columnLeftProps = columnLeft.props;
3586
+ var ref_1 = columnLeftProps.ref || columnLeftRef;
3576
3587
  var id = (columnLeftId =
3577
- columnLeft.props.id || nextId.useId(undefined, 'sidebar-')[0]);
3588
+ columnLeftProps.id || nextId.useId(undefined, 'sidebar-')[0]);
3578
3589
  var CloseButton = (React__default["default"].createElement("div", { className: "TwoColumnPanel__Close" },
3579
3590
  React__default["default"].createElement("button", { type: "button", onClick: togglePanel, ref: closeButtonRef, "aria-label": hideCollapsedPanelLabel },
3580
3591
  React__default["default"].createElement(Icon, { type: "close" })),
3581
3592
  React__default["default"].createElement(Tooltip, { target: closeButtonRef, association: "aria-labelledby", hideElementOnHidden: true }, hideCollapsedPanelLabel)));
3582
3593
  var children_1 = tslib.__spreadArray([
3583
3594
  CloseButton
3584
- ], tslib.__read(React__default["default"].Children.toArray(columnLeft.props.children)), false);
3595
+ ], tslib.__read(React__default["default"].Children.toArray(columnLeftProps.children)), false);
3585
3596
  ColumnLeftComponent = React.cloneElement(columnLeft, { id: id, ref: ref_1, tabIndex: -1 }, children_1.map(function (child, index) {
3586
3597
  return React.cloneElement(child, {
3587
3598
  key: child.key
@@ -3590,17 +3601,18 @@ var TwoColumnPanel = React.forwardRef(function (_a, ref) {
3590
3601
  });
3591
3602
  }));
3592
3603
  }
3593
- var columnRight = React__default["default"].Children.toArray(children).find(function (child) { return child.type === ColumnRight; });
3604
+ var columnRight = React__default["default"].Children.toArray(children).find(function (child) { return React__default["default"].isValidElement(child) && child.type === ColumnRight; });
3594
3605
  var ColumnRightComponent;
3595
3606
  if (React.isValidElement(columnRight)) {
3596
- var ref_2 = columnRight.props.ref || columnRightRef;
3607
+ var columnRightProps = columnRight.props;
3608
+ var ref_2 = columnRightProps.ref || columnRightRef;
3597
3609
  var ToggleButton = (React__default["default"].createElement("div", { className: "TwoColumnPanel__ButtonToggle" },
3598
3610
  React__default["default"].createElement("button", { type: "button", onClick: togglePanel, ref: toggleButtonRef, "aria-label": !isCollapsed ? hideCollapsedPanelLabel : showCollapsedPanelLabel, "aria-expanded": !isCollapsed, "aria-controls": columnLeftId },
3599
3611
  React__default["default"].createElement(Icon, { type: !isCollapsed ? 'chevron-double-left' : 'chevron-double-right' })),
3600
3612
  React__default["default"].createElement(Tooltip, { target: toggleButtonRef, association: "aria-labelledby", hideElementOnHidden: true }, !isCollapsed ? hideCollapsedPanelLabel : showCollapsedPanelLabel)));
3601
3613
  var children_2 = tslib.__spreadArray([
3602
3614
  ToggleButton
3603
- ], tslib.__read(React__default["default"].Children.toArray(columnRight.props.children)), false);
3615
+ ], tslib.__read(React__default["default"].Children.toArray(columnRightProps.children)), false);
3604
3616
  ColumnRightComponent = React.cloneElement(columnRight, { ref: ref_2, tabIndex: -1 }, children_2.map(function (child, index) {
3605
3617
  return React.cloneElement(child, {
3606
3618
  key: child.key
@@ -3786,7 +3798,8 @@ var Listbox = React.forwardRef(function (_a, ref) {
3786
3798
  }
3787
3799
  }, [activeOption]);
3788
3800
  React.useEffect(function () {
3789
- if (isActiveControlled && controlledActiveOption !== activeOption) {
3801
+ if (isActiveControlled &&
3802
+ (controlledActiveOption === null || controlledActiveOption === void 0 ? void 0 : controlledActiveOption.element) !== (activeOption === null || activeOption === void 0 ? void 0 : activeOption.element)) {
3790
3803
  setActiveOption(controlledActiveOption || null);
3791
3804
  }
3792
3805
  }, [isActiveControlled, controlledActiveOption]);
@@ -3932,11 +3945,11 @@ function isElementPreceding(a, b) {
3932
3945
  }
3933
3946
  var ListboxOption = React.forwardRef(function (_a, ref) {
3934
3947
  var _b;
3935
- var _c;
3936
- var propId = _a.id, className = _a.className, _d = _a.as, Component = _d === void 0 ? 'li' : _d, children = _a.children, value = _a.value, disabled = _a.disabled, selectedProp = _a.selected, _e = _a.activeClass, activeClass = _e === void 0 ? 'ListboxOption--active' : _e, onClick = _a.onClick, props = tslib.__rest(_a, ["id", "className", "as", "children", "value", "disabled", "selected", "activeClass", "onClick"]);
3937
- var _f = useListboxContext(), active = _f.active, selected = _f.selected, setOptions = _f.setOptions, onSelect = _f.onSelect;
3948
+ var _c, _d;
3949
+ var propId = _a.id, className = _a.className, _e = _a.as, Component = _e === void 0 ? 'li' : _e, children = _a.children, value = _a.value, disabled = _a.disabled, selectedProp = _a.selected, _f = _a.activeClass, activeClass = _f === void 0 ? 'ListboxOption--active' : _f, onClick = _a.onClick, props = tslib.__rest(_a, ["id", "className", "as", "children", "value", "disabled", "selected", "activeClass", "onClick"]);
3950
+ var _g = useListboxContext(), active = _g.active, selected = _g.selected, setOptions = _g.setOptions, onSelect = _g.onSelect;
3938
3951
  var listboxOptionRef = useSharedRef(ref);
3939
- var _g = tslib.__read(propId ? [propId] : nextId.useId(1, 'listbox-option'), 1), id = _g[0];
3952
+ var _h = tslib.__read(propId ? [propId] : nextId.useId(1, 'listbox-option'), 1), id = _h[0];
3940
3953
  var isActive = (active === null || active === void 0 ? void 0 : active.element) === listboxOptionRef.current;
3941
3954
  var isSelected = typeof selectedProp === 'boolean'
3942
3955
  ? selectedProp
@@ -3944,15 +3957,15 @@ var ListboxOption = React.forwardRef(function (_a, ref) {
3944
3957
  !!selected.find(function (option) { return option.element === listboxOptionRef.current; });
3945
3958
  var optionValue = typeof value !== 'undefined'
3946
3959
  ? value
3947
- : (_c = listboxOptionRef.current) === null || _c === void 0 ? void 0 : _c.innerText;
3960
+ : ((_d = (_c = listboxOptionRef.current) === null || _c === void 0 ? void 0 : _c.textContent) !== null && _d !== void 0 ? _d : undefined);
3948
3961
  React.useEffect(function () {
3949
3962
  var element = listboxOptionRef.current;
3950
3963
  setOptions(function (options) {
3951
3964
  var e_1, _a;
3952
- var option = { element: element, value: optionValue };
3953
3965
  // istanbul ignore next
3954
3966
  if (!element)
3955
3967
  return options;
3968
+ var option = { element: element, value: optionValue };
3956
3969
  // Elements are frequently appended, so check to see if the newly rendered
3957
3970
  // element follows the last element first before any other checks
3958
3971
  if (!options.length ||
@@ -4139,7 +4152,7 @@ var ComboboxOption = React.forwardRef(function (_a, ref) {
4139
4152
  // istanbul ignore next
4140
4153
  React.useLayoutEffect(function () {
4141
4154
  var intersectionEntry = intersectionRef.current;
4142
- if (!intersectionEntry || !isActive) {
4155
+ if (!intersectionEntry || !isActive || !comboboxOptionRef.current) {
4143
4156
  return;
4144
4157
  }
4145
4158
  var rect = comboboxOptionRef.current.getBoundingClientRect();
@@ -4155,10 +4168,10 @@ var ComboboxOption = React.forwardRef(function (_a, ref) {
4155
4168
  }
4156
4169
  }, [isActive]);
4157
4170
  React.useEffect(function () {
4158
- var _a;
4171
+ var _a, _b;
4159
4172
  var comboboxValue = typeof propValue !== 'undefined'
4160
4173
  ? propValue
4161
- : (_a = comboboxOptionRef.current) === null || _a === void 0 ? void 0 : _a.innerText;
4174
+ : ((_b = (_a = comboboxOptionRef.current) === null || _a === void 0 ? void 0 : _a.textContent) !== null && _b !== void 0 ? _b : undefined);
4162
4175
  var value = typeof formValue === 'undefined' ? comboboxValue : formValue;
4163
4176
  setFormValues(function (prev) {
4164
4177
  var formValues = prev.filter(function (fv) { return fv !== value; });
@@ -4177,12 +4190,14 @@ var ComboboxOption = React.forwardRef(function (_a, ref) {
4177
4190
  });
4178
4191
  }, [selectedValues, formValue]);
4179
4192
  React.useEffect(function () {
4180
- var _a;
4193
+ var _a, _b;
4181
4194
  if (isMatching) {
4182
4195
  var comboboxValue_1 = typeof propValue !== 'undefined'
4183
4196
  ? propValue
4184
- : (_a = comboboxOptionRef.current) === null || _a === void 0 ? void 0 : _a.innerText;
4197
+ : ((_b = (_a = comboboxOptionRef.current) === null || _a === void 0 ? void 0 : _a.textContent) !== null && _b !== void 0 ? _b : undefined);
4185
4198
  setMatchingOptions(function (options) {
4199
+ if (!comboboxOptionRef.current)
4200
+ return options;
4186
4201
  return new Map(options.set(comboboxOptionRef.current, {
4187
4202
  value: comboboxValue_1,
4188
4203
  displayValue: children,
@@ -4322,6 +4337,17 @@ var Combobox = React.forwardRef(function (_a, ref) {
4322
4337
  return value === lastSelectedValue;
4323
4338
  }) || [], 2), element = _a[0], option = _a[1];
4324
4339
  if (autocomplete === 'manual') {
4340
+ // In multiselect, the listbox manages its own active option via
4341
+ // keyboard navigation. When the last-selected value no longer
4342
+ // matches any option (e.g. after deselecting the only selected
4343
+ // option), preserve the existing active descendant so the next
4344
+ // Enter keypress can re-toggle the highlighted option.
4345
+ if (multiselect &&
4346
+ !element &&
4347
+ activeDescendant &&
4348
+ matchingOptions.has(activeDescendant.element)) {
4349
+ return;
4350
+ }
4325
4351
  setActiveDescendant(!element ? null : tslib.__assign({ element: element }, option));
4326
4352
  }
4327
4353
  else if (autocomplete === 'automatic' &&
@@ -4501,6 +4527,7 @@ var Combobox = React.forwardRef(function (_a, ref) {
4501
4527
  });
4502
4528
  }, [disabled, selectedValues, onSelectionChange]);
4503
4529
  var handlePillKeyDown = React.useCallback(function (event) {
4530
+ var _a, _b;
4504
4531
  if (!PillKeys.includes(event.key)) {
4505
4532
  return;
4506
4533
  }
@@ -4518,7 +4545,7 @@ var Combobox = React.forwardRef(function (_a, ref) {
4518
4545
  handleRemovePill(pillsRef.current[focusedIndex], selectedValues[focusedIndex]);
4519
4546
  var nextIndex = focusedIndex + 1;
4520
4547
  if (nextIndex == pillsLength) {
4521
- inputRef.current.focus();
4548
+ (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
4522
4549
  }
4523
4550
  else {
4524
4551
  pillsRef.current[nextIndex].focus();
@@ -4527,7 +4554,7 @@ var Combobox = React.forwardRef(function (_a, ref) {
4527
4554
  else if (isArrowLeft || isArrowRight) {
4528
4555
  var nextIndex = Math.max(focusedIndex + (isArrowLeft ? -1 : 1), 0);
4529
4556
  if (isArrowRight && nextIndex === pillsLength) {
4530
- inputRef.current.focus();
4557
+ (_b = inputRef.current) === null || _b === void 0 ? void 0 : _b.focus();
4531
4558
  }
4532
4559
  else {
4533
4560
  pillsRef.current[nextIndex].focus();
@@ -4815,10 +4842,12 @@ var TextEllipsis = React__default["default"].forwardRef(function (_a, ref) {
4815
4842
  : overflowElement.clientWidth < overflowElement.scrollWidth);
4816
4843
  });
4817
4844
  };
4845
+ if (!sharedRef.current)
4846
+ return;
4818
4847
  var observer = new ResizeObserver(listener);
4819
4848
  observer.observe(sharedRef.current);
4820
4849
  return function () {
4821
- observer === null || observer === void 0 ? void 0 : observer.disconnect();
4850
+ observer.disconnect();
4822
4851
  };
4823
4852
  }, []);
4824
4853
  React.useEffect(function () {
@@ -4863,7 +4892,7 @@ var Drawer = React.forwardRef(function (_a, ref) {
4863
4892
  openRef.current = open;
4864
4893
  }, [open, setIsTransitioning]);
4865
4894
  React.useEffect(function () {
4866
- if (!isModal) {
4895
+ if (!isModal || !drawerRef.current) {
4867
4896
  return;
4868
4897
  }
4869
4898
  var isolator = new AriaIsolate(drawerRef.current);
@@ -5044,7 +5073,7 @@ function getActiveElement(root) {
5044
5073
  */
5045
5074
  function useMnemonics(_a) {
5046
5075
  var elementOrRef = _a.elementOrRef, matchingElementsSelector = _a.matchingElementsSelector, onMatch = _a.onMatch, _b = _a.enabled, enabled = _b === void 0 ? true : _b;
5047
- var containerRef = React.useRef();
5076
+ var containerRef = React.useRef(null);
5048
5077
  React.useEffect(function () {
5049
5078
  if (elementOrRef instanceof HTMLElement) {
5050
5079
  containerRef.current = elementOrRef;
@@ -5054,7 +5083,8 @@ function useMnemonics(_a) {
5054
5083
  }
5055
5084
  }, [elementOrRef]);
5056
5085
  React.useEffect(function () {
5057
- if (!enabled || !containerRef.current) {
5086
+ var listenerTarget = containerRef.current;
5087
+ if (!enabled || !listenerTarget) {
5058
5088
  return;
5059
5089
  }
5060
5090
  var keyboardHandler = function (event) {
@@ -5067,14 +5097,14 @@ function useMnemonics(_a) {
5067
5097
  if (event.key.length !== 1 || !/[a-z\d]/i.test(event.key)) {
5068
5098
  return;
5069
5099
  }
5070
- var container = containerRef.current;
5071
- if (!container) {
5100
+ var currentContainer = containerRef.current;
5101
+ if (!currentContainer) {
5072
5102
  return;
5073
5103
  }
5074
5104
  // Prevent default behavior and stop propagation for mnemonic keys
5075
5105
  event.preventDefault();
5076
5106
  event.stopPropagation();
5077
- var elements = Array.from(container.querySelectorAll(matchingElementsSelector !== null && matchingElementsSelector !== void 0 ? matchingElementsSelector : focusable__default["default"]));
5107
+ var elements = Array.from(currentContainer.querySelectorAll(matchingElementsSelector !== null && matchingElementsSelector !== void 0 ? matchingElementsSelector : focusable__default["default"]));
5078
5108
  var matchingElements = elements.filter(function (element) {
5079
5109
  return getAccessibleLabel(element).toLowerCase()[0] ===
5080
5110
  event.key.toLowerCase();
@@ -5082,7 +5112,7 @@ function useMnemonics(_a) {
5082
5112
  if (!matchingElements.length) {
5083
5113
  return;
5084
5114
  }
5085
- var currentActiveElement = getActiveElement(containerRef.current);
5115
+ var currentActiveElement = getActiveElement(currentContainer);
5086
5116
  var nextActiveElement = null;
5087
5117
  if (currentActiveElement) {
5088
5118
  nextActiveElement = matchingElements.find(function (element) {
@@ -5096,17 +5126,15 @@ function useMnemonics(_a) {
5096
5126
  onMatch(nextActiveElement !== null && nextActiveElement !== void 0 ? nextActiveElement : matchingElements[0]);
5097
5127
  }
5098
5128
  };
5099
- var container = containerRef.current;
5100
- container.addEventListener('keydown', keyboardHandler);
5101
- return function () { return container.removeEventListener('keydown', keyboardHandler); };
5129
+ listenerTarget.addEventListener('keydown', keyboardHandler);
5130
+ return function () { return listenerTarget.removeEventListener('keydown', keyboardHandler); };
5102
5131
  }, [enabled, containerRef, matchingElementsSelector, onMatch]);
5103
5132
  return containerRef;
5104
5133
  }
5105
5134
 
5106
5135
  var ActionList = React.forwardRef(function (_a, ref) {
5107
5136
  var _b = _a.selectionType, selectionType = _b === void 0 ? null : _b, onAction = _a.onAction, className = _a.className, children = _a.children, props = tslib.__rest(_a, ["selectionType", "onAction", "className", "children"]);
5108
- var actionListContext = useActionListContext();
5109
- var activeElement = React.useRef();
5137
+ var activeElement = React.useRef(null);
5110
5138
  var _c = tslib.__read(React.useState(), 2), activeOption = _c[0], setActiveOption = _c[1];
5111
5139
  var handleActiveChange = React.useCallback(function (value) {
5112
5140
  activeElement.current = value === null || value === void 0 ? void 0 : value.element;
@@ -5117,22 +5145,18 @@ var ActionList = React.forwardRef(function (_a, ref) {
5117
5145
  onAction(key, event);
5118
5146
  }
5119
5147
  }, [onAction]);
5148
+ var handleMnemonicMatch = React.useCallback(function (element) {
5149
+ setActiveOption(function (prev) {
5150
+ return (prev === null || prev === void 0 ? void 0 : prev.element) === element ? prev : { element: element };
5151
+ });
5152
+ }, []);
5120
5153
  var containerRef = useMnemonics({
5121
- onMatch: function (element) {
5122
- setActiveOption({
5123
- element: element
5124
- });
5125
- },
5154
+ onMatch: handleMnemonicMatch,
5126
5155
  matchingElementsSelector: props.role === 'menu'
5127
5156
  ? '[role=menuitem],[role=menuitemcheckbox],[role=menuitemradio]'
5128
5157
  : '[role=option]'
5129
5158
  });
5130
- return (
5131
- // Note: we should be able to use listbox without passing a prop
5132
- // value for "multiselect"
5133
- // see: https://github.com/dequelabs/cauldron/issues/1890
5134
- // @ts-expect-error this should be allowed
5135
- React__default["default"].createElement(Listbox, tslib.__assign({ ref: function (element) {
5159
+ return (React__default["default"].createElement(Listbox, tslib.__assign({ ref: function (element) {
5136
5160
  if (ref) {
5137
5161
  setRef(ref, element);
5138
5162
  }
@@ -5141,7 +5165,7 @@ var ActionList = React.forwardRef(function (_a, ref) {
5141
5165
  /* Listbox comes with an explicit role of "listbox", but we want to either
5142
5166
  * use the role from props, or default to the intrinsic role */
5143
5167
  // eslint-disable-next-line jsx-a11y/aria-role
5144
- role: undefined, "aria-multiselectable": actionListContext.role === 'listbox' ? undefined : null, className: classNames__default["default"]('ActionList', className), activeOption: activeOption }, props, { onActiveChange: handleActiveChange, navigation: "bound" }),
5168
+ role: undefined, "aria-multiselectable": undefined, className: classNames__default["default"]('ActionList', className), activeOption: activeOption }, props, { onActiveChange: handleActiveChange, navigation: "bound" }),
5145
5169
  React__default["default"].createElement(ActionListProvider, { role: props.role || 'list', onAction: handleAction, selectionType: selectionType }, children)));
5146
5170
  });
5147
5171
  ActionList.displayName = 'ActionList';
@@ -5159,7 +5183,7 @@ var ActionListItem = React.forwardRef(function (_a, ref) {
5159
5183
  });
5160
5184
  var isActive = !!(active === null || active === void 0 ? void 0 : active.element) && active.element === actionListItemRef.current;
5161
5185
  var handleAction = React.useCallback(function (event) {
5162
- var _a;
5186
+ var _a, _b;
5163
5187
  if (event.defaultPrevented) {
5164
5188
  return;
5165
5189
  }
@@ -5172,7 +5196,7 @@ var ActionListItem = React.forwardRef(function (_a, ref) {
5172
5196
  }
5173
5197
  // istanbul ignore else
5174
5198
  if (typeof onActionListAction === 'function') {
5175
- onActionListAction(actionKey || ((_a = labelRef === null || labelRef === void 0 ? void 0 : labelRef.current) === null || _a === void 0 ? void 0 : _a.innerText.trim()) || '', event);
5199
+ onActionListAction(actionKey || ((_b = (_a = labelRef.current) === null || _a === void 0 ? void 0 : _a.textContent) === null || _b === void 0 ? void 0 : _b.trim()) || '', event);
5176
5200
  }
5177
5201
  }, [onAction, onActionListAction, selectionType, actionKey]);
5178
5202
  var listItemRole = undefined;
@@ -5196,7 +5220,7 @@ var ActionListItem = React.forwardRef(function (_a, ref) {
5196
5220
  // istanbul ignore next
5197
5221
  React.useLayoutEffect(function () {
5198
5222
  var intersectionEntry = intersectionRef.current;
5199
- if (!intersectionEntry || !isActive) {
5223
+ if (!intersectionEntry || !isActive || !actionListItemRef.current) {
5200
5224
  return;
5201
5225
  }
5202
5226
  var rect = actionListItemRef.current.getBoundingClientRect();
@@ -5295,9 +5319,10 @@ var ActionMenu = React.forwardRef(function (_a, ref) {
5295
5319
  var _e = tslib.__read(React.useState('first'), 2), focusStrategy = _e[0], setFocusStrategy = _e[1];
5296
5320
  var triggerRef = React.useRef(null);
5297
5321
  var actionMenuRef = useSharedRef(ref);
5298
- var actionMenuListRef = useSharedRef(actionMenuList.props.ref);
5299
- var _f = tslib.__read(nextId.useId(1, 'menu-trigger'), 1), triggerId = _f[0];
5300
- var _g = tslib.__read(nextId.useId(1, 'menu'), 1), menuId = _g[0];
5322
+ var _f = actionMenuList.props, actionListRef = _f.ref, actionListOnAction = _f.onAction;
5323
+ var actionMenuListRef = useSharedRef(actionListRef !== null && actionListRef !== void 0 ? actionListRef : null);
5324
+ var _g = tslib.__read(nextId.useId(1, 'menu-trigger'), 1), triggerId = _g[0];
5325
+ var _h = tslib.__read(nextId.useId(1, 'menu'), 1), menuId = _h[0];
5301
5326
  var handleTriggerClick = React.useCallback(function (event) {
5302
5327
  // istanbul ignore else
5303
5328
  if (!event.defaultPrevented) {
@@ -5344,11 +5369,10 @@ var ActionMenu = React.forwardRef(function (_a, ref) {
5344
5369
  if (!event.defaultPrevented) {
5345
5370
  setOpen(false);
5346
5371
  }
5347
- var onAction = actionMenuList.props.onAction;
5348
- if (typeof onAction === 'function') {
5349
- onAction(key, event);
5372
+ if (typeof actionListOnAction === 'function') {
5373
+ actionListOnAction(key, event);
5350
5374
  }
5351
- }, [actionMenuList.props.onAction]);
5375
+ }, [actionListOnAction]);
5352
5376
  React.useEffect(function () {
5353
5377
  var _a, _b;
5354
5378
  if (open) {
package/lib/types.d.ts CHANGED
@@ -11,4 +11,4 @@ export declare namespace Cauldron {
11
11
  * Explicit equivalent of Exclude<ReactNode, boolean | null | undefined>
12
12
  */
13
13
  export type ContentNode = string | number | ReactPortal | ReactElement;
14
- export type ElementOrRef<E extends Element> = E | React.RefObject<E> | React.MutableRefObject<E>;
14
+ export type ElementOrRef<E extends Element> = E | React.RefObject<E | null> | React.MutableRefObject<E | null>;
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare function getChildRef(child: React.ReactElement, version?: string): React.Ref<HTMLElement> | null | undefined;
@@ -3,7 +3,7 @@ type Merge<P1 = {}, P2 = {}> = Omit<P1, keyof P2> & P2;
3
3
  export type PolymorphicProps<Props = {}, ElementType extends React.ElementType = React.ElementType> = Props & {
4
4
  as?: ElementType;
5
5
  };
6
- export type PolymorphicComponentProps<Props = {}, ElementType extends React.ElementType = React.ElementType> = Merge<ElementType extends keyof JSX.IntrinsicElements ? React.PropsWithRef<JSX.IntrinsicElements[ElementType]> : ElementType extends React.ElementType ? React.ComponentPropsWithRef<ElementType> : never, PolymorphicProps<Props, ElementType>>;
6
+ export type PolymorphicComponentProps<Props = {}, ElementType extends React.ElementType = React.ElementType> = Merge<ElementType extends keyof React.JSX.IntrinsicElements ? React.PropsWithRef<React.JSX.IntrinsicElements[ElementType]> : ElementType extends React.ElementType ? React.ComponentPropsWithRef<ElementType> : never, PolymorphicProps<Props, ElementType>>;
7
7
  export type PolymorphicComponent<Props = {}, ElementType extends React.ElementType = React.ElementType> = Merge<React.ForwardRefExoticComponent<Props>, {
8
8
  <T extends React.ElementType = ElementType>(props: PolymorphicComponentProps<Props, T>): React.ReactElement | null;
9
9
  }>;
@@ -30,5 +30,5 @@ export default function useFocusTrap<TargetElement extends Element = Element, Fo
30
30
  * can be provided to override the default active element behavior.
31
31
  */
32
32
  returnFocusElement?: ElementOrRef<FocusElement>;
33
- }): React.RefObject<Readonly<FocusTrap>>;
33
+ }): React.RefObject<Readonly<FocusTrap> | null>;
34
34
  export {};
@@ -1,4 +1,4 @@
1
- import type { RefObject } from 'react';
1
+ import type { MutableRefObject } from 'react';
2
2
  import type { ElementOrRef } from '../types';
3
3
  type useMnemonicsOptions = {
4
4
  /**
@@ -19,7 +19,7 @@ type useMnemonicsOptions = {
19
19
  */
20
20
  enabled?: boolean;
21
21
  };
22
- type useMnemonicsResults<T extends HTMLElement> = RefObject<T>;
22
+ type useMnemonicsResults<T extends HTMLElement> = MutableRefObject<T | null>;
23
23
  /**
24
24
  * A hook that provides mnemonic navigation for keyboard users.
25
25
  *
@@ -1,7 +1,7 @@
1
- import { MutableRefObject, Ref } from 'react';
1
+ import { RefObject, Ref } from 'react';
2
2
  /**
3
3
  * When a component needs to track an internal ref on a component that has a
4
- * forwarded ref, useSharedRef will return a MutableRefObject<T> that will
4
+ * forwarded ref, useSharedRef will return a RefObject<T | null> that will
5
5
  * correctly invoke the parent ref as well providing an internal ref.
6
6
  *
7
7
  * @example
@@ -13,4 +13,4 @@ import { MutableRefObject, Ref } from 'react';
13
13
  * return (<div ref={internalRef}>...</div>)
14
14
  * })
15
15
  */
16
- export default function useSharedRef<T>(ref: Ref<T>): MutableRefObject<T>;
16
+ export default function useSharedRef<T>(ref: Ref<T>): RefObject<T | null>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deque/cauldron-react",
3
- "version": "7.1.0-canary.b7d2a9c6",
3
+ "version": "7.1.0-canary.b914451f",
4
4
  "license": "MPL-2.0",
5
5
  "description": "Fully accessible react components library for Deque Cauldron",
6
6
  "homepage": "https://cauldron.dequelabs.com/",
@@ -18,6 +18,7 @@
18
18
  "prebuild:lib": "node scripts/buildIconTypes.js",
19
19
  "build:lib": "rollup -c",
20
20
  "build:css": "postcss --output=lib/cauldron.css src/index.css",
21
+ "typecheck": "tsc --noEmit --skipLibCheck",
21
22
  "dev": "concurrently 'yarn build:css --watch' 'rollup -c --watch'",
22
23
  "prepublishOnly": "NODE_ENV=production yarn build",
23
24
  "test": "jest --maxWorkers=1 --coverage",
@@ -26,6 +27,7 @@
26
27
  "figma:publish:dry-run": "figma connect publish --dry-run"
27
28
  },
28
29
  "dependencies": {
30
+ "@floating-ui/dom": "^1.0.0",
29
31
  "@floating-ui/react-dom": "^2.1.2",
30
32
  "classnames": "^2.2.6",
31
33
  "focusable": "^2.3.0",
@@ -41,7 +43,7 @@
41
43
  "@babel/preset-env": "^7.22.10",
42
44
  "@babel/preset-react": "^7.22.5",
43
45
  "@babel/preset-typescript": "^7.22.5",
44
- "@figma/code-connect": "^1.4.4",
46
+ "@figma/code-connect": "^1.4.5",
45
47
  "@rollup/plugin-commonjs": "^14.0.0",
46
48
  "@rollup/plugin-dynamic-import-vars": "^1.4.2",
47
49
  "@rollup/plugin-typescript": "^11.1.2",
@@ -54,8 +56,8 @@
54
56
  "@types/jest": "^29.5.11",
55
57
  "@types/jest-axe": "^3.5.4",
56
58
  "@types/node": "^17.0.42",
57
- "@types/react": "^18.0.12",
58
- "@types/react-dom": "^18.0.5",
59
+ "@types/react": "^19.0.0",
60
+ "@types/react-dom": "^19.0.0",
59
61
  "@types/react-syntax-highlighter": "^15.5.13",
60
62
  "@types/sinon": "^10",
61
63
  "autoprefixer": "^9.7.6",
@@ -70,8 +72,8 @@
70
72
  "postcss-import": "^12.0.1",
71
73
  "postcss-loader": "^3.0.0",
72
74
  "prop-types": "^15.8.1",
73
- "react": "^18",
74
- "react-dom": "^18",
75
+ "react": "^19",
76
+ "react-dom": "^19",
75
77
  "rollup": "^2.23.0",
76
78
  "sinon": "^10.0.0",
77
79
  "ts-node": "^10.9.2",
@@ -82,7 +84,7 @@
82
84
  "url": "git+https://github.com/dequelabs/cauldron.git"
83
85
  },
84
86
  "peerDependencies": {
85
- "react": ">=16.6 <= 18",
86
- "react-dom": ">=16.6 <= 18"
87
+ "react": ">=16.6 <20",
88
+ "react-dom": ">=16.6 <20"
87
89
  }
88
90
  }