@deque/cauldron-react 7.1.0-canary.63bb41ac → 7.1.0-canary.653d9fda

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;
@@ -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));
@@ -807,9 +810,16 @@ function resolveElement(elementOrRef) {
807
810
  return null;
808
811
  }
809
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
+
810
820
  function ClickOutsideListener(_a, ref) {
811
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;
812
- var childElementRef = React.useRef();
822
+ var childElementRef = React.useRef(null);
813
823
  var handleEvent = function (event) {
814
824
  if (event.defaultPrevented) {
815
825
  return;
@@ -832,9 +842,8 @@ function ClickOutsideListener(_a, ref) {
832
842
  childElementRef.current = node;
833
843
  // Ref for this component should pass-through to the child node
834
844
  setRef(ref, node);
835
- // If child has its own ref, we want to update
836
- // its ref with the newly cloned node
837
- 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);
838
847
  setRef(childRef, node);
839
848
  };
840
849
  React.useEffect(function () {
@@ -1343,7 +1352,7 @@ var AriaIsolate = /** @class */ (function () {
1343
1352
 
1344
1353
  /**
1345
1354
  * When a component needs to track an internal ref on a component that has a
1346
- * forwarded ref, useSharedRef will return a MutableRefObject<T> that will
1355
+ * forwarded ref, useSharedRef will return a RefObject<T | null> that will
1347
1356
  * correctly invoke the parent ref as well providing an internal ref.
1348
1357
  *
1349
1358
  * @example
@@ -1356,7 +1365,7 @@ var AriaIsolate = /** @class */ (function () {
1356
1365
  * })
1357
1366
  */
1358
1367
  function useSharedRef(ref) {
1359
- var internalRef = React.useRef();
1368
+ var internalRef = React.useRef(null);
1360
1369
  React.useEffect(function () {
1361
1370
  setRef(ref, internalRef.current);
1362
1371
  return function () { return setRef(ref, null); };
@@ -1489,7 +1498,7 @@ function useFocusTrap(target, options) {
1489
1498
  if (options === void 0) { options = {}; }
1490
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;
1491
1500
  var focusTrap = React.useRef(null);
1492
- var returnFocusElementRef = React.useRef();
1501
+ var returnFocusElementRef = React.useRef(null);
1493
1502
  function restoreFocusToReturnFocusElement() {
1494
1503
  var _a;
1495
1504
  var resolvedReturnFocusElement = resolveElement(returnFocusElement);
@@ -1539,7 +1548,7 @@ var Dialog = React.forwardRef(function (_a, ref) {
1539
1548
  var dialogRef = useSharedRef(dialogRefProp || ref);
1540
1549
  var _g = tslib.__read(nextId.useId(1, 'dialog-title-'), 1), headingId = _g[0];
1541
1550
  var headingRef = React.useRef(null);
1542
- var isolatorRef = React.useRef();
1551
+ var isolatorRef = React.useRef(null);
1543
1552
  var headingLevel = typeof heading === 'object' && 'level' in heading && heading.level
1544
1553
  ? heading.level
1545
1554
  : 2;
@@ -2134,7 +2143,7 @@ var looksLikeLink = function (props) {
2134
2143
  };
2135
2144
  var IconButton = React.forwardRef(function (_a, ref) {
2136
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"]);
2137
- var internalRef = React.useRef();
2146
+ var internalRef = React.useRef(null);
2138
2147
  React.useImperativeHandle(ref, function () { return internalRef.current; });
2139
2148
  // Configure additional properties based on the type of the Component
2140
2149
  // for accessibility
@@ -2696,7 +2705,7 @@ Checkbox.displayName = 'Checkbox';
2696
2705
  */
2697
2706
  function TooltipTabstop(_a) {
2698
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"]);
2699
- var buttonRef = React.useRef();
2708
+ var buttonRef = React.useRef(null);
2700
2709
  return (React__default["default"].createElement(React__default["default"].Fragment, null,
2701
2710
  React__default["default"].createElement("button", tslib.__assign({ type: "button", ref: buttonRef, "aria-disabled": "true", className: classNames__default["default"]('TooltipTabstop', className) }, buttonProps), children),
2702
2711
  React__default["default"].createElement(Tooltip, { target: buttonRef, variant: variant, association: association, show: show, placement: placement, portal: portal, hideElementOnHidden: hideElementOnHidden }, tooltip)));
@@ -3540,7 +3549,7 @@ var TwoColumnPanel = React.forwardRef(function (_a, ref) {
3540
3549
  var closeButtonRef = React.useRef(null);
3541
3550
  var columnLeftRef = React.useRef(null);
3542
3551
  var columnRightRef = React.useRef(null);
3543
- 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; });
3544
3553
  var togglePanel = function () {
3545
3554
  var prefersReducedMotion = 'matchMedia' in window &&
3546
3555
  typeof matchMedia === 'function' &&
@@ -3573,16 +3582,17 @@ var TwoColumnPanel = React.forwardRef(function (_a, ref) {
3573
3582
  var ColumnLeftComponent;
3574
3583
  var columnLeftId;
3575
3584
  if (React.isValidElement(columnLeft)) {
3576
- var ref_1 = columnLeft.props.ref || columnLeftRef;
3585
+ var columnLeftProps = columnLeft.props;
3586
+ var ref_1 = columnLeftProps.ref || columnLeftRef;
3577
3587
  var id = (columnLeftId =
3578
- columnLeft.props.id || nextId.useId(undefined, 'sidebar-')[0]);
3588
+ columnLeftProps.id || nextId.useId(undefined, 'sidebar-')[0]);
3579
3589
  var CloseButton = (React__default["default"].createElement("div", { className: "TwoColumnPanel__Close" },
3580
3590
  React__default["default"].createElement("button", { type: "button", onClick: togglePanel, ref: closeButtonRef, "aria-label": hideCollapsedPanelLabel },
3581
3591
  React__default["default"].createElement(Icon, { type: "close" })),
3582
3592
  React__default["default"].createElement(Tooltip, { target: closeButtonRef, association: "aria-labelledby", hideElementOnHidden: true }, hideCollapsedPanelLabel)));
3583
3593
  var children_1 = tslib.__spreadArray([
3584
3594
  CloseButton
3585
- ], tslib.__read(React__default["default"].Children.toArray(columnLeft.props.children)), false);
3595
+ ], tslib.__read(React__default["default"].Children.toArray(columnLeftProps.children)), false);
3586
3596
  ColumnLeftComponent = React.cloneElement(columnLeft, { id: id, ref: ref_1, tabIndex: -1 }, children_1.map(function (child, index) {
3587
3597
  return React.cloneElement(child, {
3588
3598
  key: child.key
@@ -3591,17 +3601,18 @@ var TwoColumnPanel = React.forwardRef(function (_a, ref) {
3591
3601
  });
3592
3602
  }));
3593
3603
  }
3594
- 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; });
3595
3605
  var ColumnRightComponent;
3596
3606
  if (React.isValidElement(columnRight)) {
3597
- var ref_2 = columnRight.props.ref || columnRightRef;
3607
+ var columnRightProps = columnRight.props;
3608
+ var ref_2 = columnRightProps.ref || columnRightRef;
3598
3609
  var ToggleButton = (React__default["default"].createElement("div", { className: "TwoColumnPanel__ButtonToggle" },
3599
3610
  React__default["default"].createElement("button", { type: "button", onClick: togglePanel, ref: toggleButtonRef, "aria-label": !isCollapsed ? hideCollapsedPanelLabel : showCollapsedPanelLabel, "aria-expanded": !isCollapsed, "aria-controls": columnLeftId },
3600
3611
  React__default["default"].createElement(Icon, { type: !isCollapsed ? 'chevron-double-left' : 'chevron-double-right' })),
3601
3612
  React__default["default"].createElement(Tooltip, { target: toggleButtonRef, association: "aria-labelledby", hideElementOnHidden: true }, !isCollapsed ? hideCollapsedPanelLabel : showCollapsedPanelLabel)));
3602
3613
  var children_2 = tslib.__spreadArray([
3603
3614
  ToggleButton
3604
- ], tslib.__read(React__default["default"].Children.toArray(columnRight.props.children)), false);
3615
+ ], tslib.__read(React__default["default"].Children.toArray(columnRightProps.children)), false);
3605
3616
  ColumnRightComponent = React.cloneElement(columnRight, { ref: ref_2, tabIndex: -1 }, children_2.map(function (child, index) {
3606
3617
  return React.cloneElement(child, {
3607
3618
  key: child.key
@@ -3933,11 +3944,11 @@ function isElementPreceding(a, b) {
3933
3944
  }
3934
3945
  var ListboxOption = React.forwardRef(function (_a, ref) {
3935
3946
  var _b;
3936
- var _c;
3937
- 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"]);
3938
- var _f = useListboxContext(), active = _f.active, selected = _f.selected, setOptions = _f.setOptions, onSelect = _f.onSelect;
3947
+ var _c, _d;
3948
+ 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"]);
3949
+ var _g = useListboxContext(), active = _g.active, selected = _g.selected, setOptions = _g.setOptions, onSelect = _g.onSelect;
3939
3950
  var listboxOptionRef = useSharedRef(ref);
3940
- var _g = tslib.__read(propId ? [propId] : nextId.useId(1, 'listbox-option'), 1), id = _g[0];
3951
+ var _h = tslib.__read(propId ? [propId] : nextId.useId(1, 'listbox-option'), 1), id = _h[0];
3941
3952
  var isActive = (active === null || active === void 0 ? void 0 : active.element) === listboxOptionRef.current;
3942
3953
  var isSelected = typeof selectedProp === 'boolean'
3943
3954
  ? selectedProp
@@ -3945,15 +3956,15 @@ var ListboxOption = React.forwardRef(function (_a, ref) {
3945
3956
  !!selected.find(function (option) { return option.element === listboxOptionRef.current; });
3946
3957
  var optionValue = typeof value !== 'undefined'
3947
3958
  ? value
3948
- : (_c = listboxOptionRef.current) === null || _c === void 0 ? void 0 : _c.innerText;
3959
+ : ((_d = (_c = listboxOptionRef.current) === null || _c === void 0 ? void 0 : _c.textContent) !== null && _d !== void 0 ? _d : undefined);
3949
3960
  React.useEffect(function () {
3950
3961
  var element = listboxOptionRef.current;
3951
3962
  setOptions(function (options) {
3952
3963
  var e_1, _a;
3953
- var option = { element: element, value: optionValue };
3954
3964
  // istanbul ignore next
3955
3965
  if (!element)
3956
3966
  return options;
3967
+ var option = { element: element, value: optionValue };
3957
3968
  // Elements are frequently appended, so check to see if the newly rendered
3958
3969
  // element follows the last element first before any other checks
3959
3970
  if (!options.length ||
@@ -3990,7 +4001,7 @@ var ListboxOption = React.forwardRef(function (_a, ref) {
3990
4001
  if (disabled) {
3991
4002
  return;
3992
4003
  }
3993
- onSelect({ element: listboxOptionRef.current, value: optionValue });
4004
+ onSelect({ element: event.target, value: optionValue });
3994
4005
  onClick === null || onClick === void 0 ? void 0 : onClick(event);
3995
4006
  }, [optionValue, onSelect, onClick, disabled]);
3996
4007
  return (React__default["default"].createElement(Component, tslib.__assign({ id: id, className: classNames__default["default"](className, (_b = {},
@@ -4140,7 +4151,7 @@ var ComboboxOption = React.forwardRef(function (_a, ref) {
4140
4151
  // istanbul ignore next
4141
4152
  React.useLayoutEffect(function () {
4142
4153
  var intersectionEntry = intersectionRef.current;
4143
- if (!intersectionEntry || !isActive) {
4154
+ if (!intersectionEntry || !isActive || !comboboxOptionRef.current) {
4144
4155
  return;
4145
4156
  }
4146
4157
  var rect = comboboxOptionRef.current.getBoundingClientRect();
@@ -4156,10 +4167,10 @@ var ComboboxOption = React.forwardRef(function (_a, ref) {
4156
4167
  }
4157
4168
  }, [isActive]);
4158
4169
  React.useEffect(function () {
4159
- var _a;
4170
+ var _a, _b;
4160
4171
  var comboboxValue = typeof propValue !== 'undefined'
4161
4172
  ? propValue
4162
- : (_a = comboboxOptionRef.current) === null || _a === void 0 ? void 0 : _a.innerText;
4173
+ : ((_b = (_a = comboboxOptionRef.current) === null || _a === void 0 ? void 0 : _a.textContent) !== null && _b !== void 0 ? _b : undefined);
4163
4174
  var value = typeof formValue === 'undefined' ? comboboxValue : formValue;
4164
4175
  setFormValues(function (prev) {
4165
4176
  var formValues = prev.filter(function (fv) { return fv !== value; });
@@ -4178,12 +4189,14 @@ var ComboboxOption = React.forwardRef(function (_a, ref) {
4178
4189
  });
4179
4190
  }, [selectedValues, formValue]);
4180
4191
  React.useEffect(function () {
4181
- var _a;
4192
+ var _a, _b;
4182
4193
  if (isMatching) {
4183
4194
  var comboboxValue_1 = typeof propValue !== 'undefined'
4184
4195
  ? propValue
4185
- : (_a = comboboxOptionRef.current) === null || _a === void 0 ? void 0 : _a.innerText;
4196
+ : ((_b = (_a = comboboxOptionRef.current) === null || _a === void 0 ? void 0 : _a.textContent) !== null && _b !== void 0 ? _b : undefined);
4186
4197
  setMatchingOptions(function (options) {
4198
+ if (!comboboxOptionRef.current)
4199
+ return options;
4187
4200
  return new Map(options.set(comboboxOptionRef.current, {
4188
4201
  value: comboboxValue_1,
4189
4202
  displayValue: children,
@@ -4513,6 +4526,7 @@ var Combobox = React.forwardRef(function (_a, ref) {
4513
4526
  });
4514
4527
  }, [disabled, selectedValues, onSelectionChange]);
4515
4528
  var handlePillKeyDown = React.useCallback(function (event) {
4529
+ var _a, _b;
4516
4530
  if (!PillKeys.includes(event.key)) {
4517
4531
  return;
4518
4532
  }
@@ -4530,7 +4544,7 @@ var Combobox = React.forwardRef(function (_a, ref) {
4530
4544
  handleRemovePill(pillsRef.current[focusedIndex], selectedValues[focusedIndex]);
4531
4545
  var nextIndex = focusedIndex + 1;
4532
4546
  if (nextIndex == pillsLength) {
4533
- inputRef.current.focus();
4547
+ (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
4534
4548
  }
4535
4549
  else {
4536
4550
  pillsRef.current[nextIndex].focus();
@@ -4539,7 +4553,7 @@ var Combobox = React.forwardRef(function (_a, ref) {
4539
4553
  else if (isArrowLeft || isArrowRight) {
4540
4554
  var nextIndex = Math.max(focusedIndex + (isArrowLeft ? -1 : 1), 0);
4541
4555
  if (isArrowRight && nextIndex === pillsLength) {
4542
- inputRef.current.focus();
4556
+ (_b = inputRef.current) === null || _b === void 0 ? void 0 : _b.focus();
4543
4557
  }
4544
4558
  else {
4545
4559
  pillsRef.current[nextIndex].focus();
@@ -4827,10 +4841,12 @@ var TextEllipsis = React__default["default"].forwardRef(function (_a, ref) {
4827
4841
  : overflowElement.clientWidth < overflowElement.scrollWidth);
4828
4842
  });
4829
4843
  };
4844
+ if (!sharedRef.current)
4845
+ return;
4830
4846
  var observer = new ResizeObserver(listener);
4831
4847
  observer.observe(sharedRef.current);
4832
4848
  return function () {
4833
- observer === null || observer === void 0 ? void 0 : observer.disconnect();
4849
+ observer.disconnect();
4834
4850
  };
4835
4851
  }, []);
4836
4852
  React.useEffect(function () {
@@ -4875,7 +4891,7 @@ var Drawer = React.forwardRef(function (_a, ref) {
4875
4891
  openRef.current = open;
4876
4892
  }, [open, setIsTransitioning]);
4877
4893
  React.useEffect(function () {
4878
- if (!isModal) {
4894
+ if (!isModal || !drawerRef.current) {
4879
4895
  return;
4880
4896
  }
4881
4897
  var isolator = new AriaIsolate(drawerRef.current);
@@ -5056,7 +5072,7 @@ function getActiveElement(root) {
5056
5072
  */
5057
5073
  function useMnemonics(_a) {
5058
5074
  var elementOrRef = _a.elementOrRef, matchingElementsSelector = _a.matchingElementsSelector, onMatch = _a.onMatch, _b = _a.enabled, enabled = _b === void 0 ? true : _b;
5059
- var containerRef = React.useRef();
5075
+ var containerRef = React.useRef(null);
5060
5076
  React.useEffect(function () {
5061
5077
  if (elementOrRef instanceof HTMLElement) {
5062
5078
  containerRef.current = elementOrRef;
@@ -5066,7 +5082,8 @@ function useMnemonics(_a) {
5066
5082
  }
5067
5083
  }, [elementOrRef]);
5068
5084
  React.useEffect(function () {
5069
- if (!enabled || !containerRef.current) {
5085
+ var listenerTarget = containerRef.current;
5086
+ if (!enabled || !listenerTarget) {
5070
5087
  return;
5071
5088
  }
5072
5089
  var keyboardHandler = function (event) {
@@ -5079,14 +5096,14 @@ function useMnemonics(_a) {
5079
5096
  if (event.key.length !== 1 || !/[a-z\d]/i.test(event.key)) {
5080
5097
  return;
5081
5098
  }
5082
- var container = containerRef.current;
5083
- if (!container) {
5099
+ var currentContainer = containerRef.current;
5100
+ if (!currentContainer) {
5084
5101
  return;
5085
5102
  }
5086
5103
  // Prevent default behavior and stop propagation for mnemonic keys
5087
5104
  event.preventDefault();
5088
5105
  event.stopPropagation();
5089
- var elements = Array.from(container.querySelectorAll(matchingElementsSelector !== null && matchingElementsSelector !== void 0 ? matchingElementsSelector : focusable__default["default"]));
5106
+ var elements = Array.from(currentContainer.querySelectorAll(matchingElementsSelector !== null && matchingElementsSelector !== void 0 ? matchingElementsSelector : focusable__default["default"]));
5090
5107
  var matchingElements = elements.filter(function (element) {
5091
5108
  return getAccessibleLabel(element).toLowerCase()[0] ===
5092
5109
  event.key.toLowerCase();
@@ -5094,7 +5111,7 @@ function useMnemonics(_a) {
5094
5111
  if (!matchingElements.length) {
5095
5112
  return;
5096
5113
  }
5097
- var currentActiveElement = getActiveElement(containerRef.current);
5114
+ var currentActiveElement = getActiveElement(currentContainer);
5098
5115
  var nextActiveElement = null;
5099
5116
  if (currentActiveElement) {
5100
5117
  nextActiveElement = matchingElements.find(function (element) {
@@ -5108,17 +5125,15 @@ function useMnemonics(_a) {
5108
5125
  onMatch(nextActiveElement !== null && nextActiveElement !== void 0 ? nextActiveElement : matchingElements[0]);
5109
5126
  }
5110
5127
  };
5111
- var container = containerRef.current;
5112
- container.addEventListener('keydown', keyboardHandler);
5113
- return function () { return container.removeEventListener('keydown', keyboardHandler); };
5128
+ listenerTarget.addEventListener('keydown', keyboardHandler);
5129
+ return function () { return listenerTarget.removeEventListener('keydown', keyboardHandler); };
5114
5130
  }, [enabled, containerRef, matchingElementsSelector, onMatch]);
5115
5131
  return containerRef;
5116
5132
  }
5117
5133
 
5118
5134
  var ActionList = React.forwardRef(function (_a, ref) {
5119
5135
  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"]);
5120
- var actionListContext = useActionListContext();
5121
- var activeElement = React.useRef();
5136
+ var activeElement = React.useRef(null);
5122
5137
  var _c = tslib.__read(React.useState(), 2), activeOption = _c[0], setActiveOption = _c[1];
5123
5138
  var handleActiveChange = React.useCallback(function (value) {
5124
5139
  activeElement.current = value === null || value === void 0 ? void 0 : value.element;
@@ -5139,12 +5154,7 @@ var ActionList = React.forwardRef(function (_a, ref) {
5139
5154
  ? '[role=menuitem],[role=menuitemcheckbox],[role=menuitemradio]'
5140
5155
  : '[role=option]'
5141
5156
  });
5142
- return (
5143
- // Note: we should be able to use listbox without passing a prop
5144
- // value for "multiselect"
5145
- // see: https://github.com/dequelabs/cauldron/issues/1890
5146
- // @ts-expect-error this should be allowed
5147
- React__default["default"].createElement(Listbox, tslib.__assign({ ref: function (element) {
5157
+ return (React__default["default"].createElement(Listbox, tslib.__assign({ ref: function (element) {
5148
5158
  if (ref) {
5149
5159
  setRef(ref, element);
5150
5160
  }
@@ -5153,7 +5163,7 @@ var ActionList = React.forwardRef(function (_a, ref) {
5153
5163
  /* Listbox comes with an explicit role of "listbox", but we want to either
5154
5164
  * use the role from props, or default to the intrinsic role */
5155
5165
  // eslint-disable-next-line jsx-a11y/aria-role
5156
- role: undefined, "aria-multiselectable": actionListContext.role === 'listbox' ? undefined : null, className: classNames__default["default"]('ActionList', className), activeOption: activeOption }, props, { onActiveChange: handleActiveChange, navigation: "bound" }),
5166
+ role: undefined, "aria-multiselectable": undefined, className: classNames__default["default"]('ActionList', className), activeOption: activeOption }, props, { onActiveChange: handleActiveChange, navigation: "bound" }),
5157
5167
  React__default["default"].createElement(ActionListProvider, { role: props.role || 'list', onAction: handleAction, selectionType: selectionType }, children)));
5158
5168
  });
5159
5169
  ActionList.displayName = 'ActionList';
@@ -5171,7 +5181,7 @@ var ActionListItem = React.forwardRef(function (_a, ref) {
5171
5181
  });
5172
5182
  var isActive = !!(active === null || active === void 0 ? void 0 : active.element) && active.element === actionListItemRef.current;
5173
5183
  var handleAction = React.useCallback(function (event) {
5174
- var _a;
5184
+ var _a, _b;
5175
5185
  if (event.defaultPrevented) {
5176
5186
  return;
5177
5187
  }
@@ -5184,7 +5194,7 @@ var ActionListItem = React.forwardRef(function (_a, ref) {
5184
5194
  }
5185
5195
  // istanbul ignore else
5186
5196
  if (typeof onActionListAction === 'function') {
5187
- onActionListAction(actionKey || ((_a = labelRef === null || labelRef === void 0 ? void 0 : labelRef.current) === null || _a === void 0 ? void 0 : _a.innerText.trim()) || '', event);
5197
+ onActionListAction(actionKey || ((_b = (_a = labelRef.current) === null || _a === void 0 ? void 0 : _a.textContent) === null || _b === void 0 ? void 0 : _b.trim()) || '', event);
5188
5198
  }
5189
5199
  }, [onAction, onActionListAction, selectionType, actionKey]);
5190
5200
  var listItemRole = undefined;
@@ -5208,7 +5218,7 @@ var ActionListItem = React.forwardRef(function (_a, ref) {
5208
5218
  // istanbul ignore next
5209
5219
  React.useLayoutEffect(function () {
5210
5220
  var intersectionEntry = intersectionRef.current;
5211
- if (!intersectionEntry || !isActive) {
5221
+ if (!intersectionEntry || !isActive || !actionListItemRef.current) {
5212
5222
  return;
5213
5223
  }
5214
5224
  var rect = actionListItemRef.current.getBoundingClientRect();
@@ -5307,9 +5317,10 @@ var ActionMenu = React.forwardRef(function (_a, ref) {
5307
5317
  var _e = tslib.__read(React.useState('first'), 2), focusStrategy = _e[0], setFocusStrategy = _e[1];
5308
5318
  var triggerRef = React.useRef(null);
5309
5319
  var actionMenuRef = useSharedRef(ref);
5310
- var actionMenuListRef = useSharedRef(actionMenuList.props.ref);
5311
- var _f = tslib.__read(nextId.useId(1, 'menu-trigger'), 1), triggerId = _f[0];
5312
- var _g = tslib.__read(nextId.useId(1, 'menu'), 1), menuId = _g[0];
5320
+ var _f = actionMenuList.props, actionListRef = _f.ref, actionListOnAction = _f.onAction;
5321
+ var actionMenuListRef = useSharedRef(actionListRef !== null && actionListRef !== void 0 ? actionListRef : null);
5322
+ var _g = tslib.__read(nextId.useId(1, 'menu-trigger'), 1), triggerId = _g[0];
5323
+ var _h = tslib.__read(nextId.useId(1, 'menu'), 1), menuId = _h[0];
5313
5324
  var handleTriggerClick = React.useCallback(function (event) {
5314
5325
  // istanbul ignore else
5315
5326
  if (!event.defaultPrevented) {
@@ -5356,11 +5367,10 @@ var ActionMenu = React.forwardRef(function (_a, ref) {
5356
5367
  if (!event.defaultPrevented) {
5357
5368
  setOpen(false);
5358
5369
  }
5359
- var onAction = actionMenuList.props.onAction;
5360
- if (typeof onAction === 'function') {
5361
- onAction(key, event);
5370
+ if (typeof actionListOnAction === 'function') {
5371
+ actionListOnAction(key, event);
5362
5372
  }
5363
- }, [actionMenuList.props.onAction]);
5373
+ }, [actionListOnAction]);
5364
5374
  React.useEffect(function () {
5365
5375
  var _a, _b;
5366
5376
  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.63bb41ac",
3
+ "version": "7.1.0-canary.653d9fda",
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",
@@ -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
  }