@deque/cauldron-react 7.1.0-canary.3a2e35e4 → 7.1.0-canary.3e2a4099
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.
- package/lib/components/Accordion/Accordion.d.ts +1 -1
- package/lib/components/ActionMenu/ActionMenu.d.ts +11 -5
- package/lib/components/AnchoredOverlay/index.d.ts +2 -2
- package/lib/components/ClickOutsideListener/index.d.ts +1 -1
- package/lib/components/Combobox/Combobox.d.ts +1 -1
- package/lib/components/Dialog/DialogContext.d.ts +1 -1
- package/lib/components/Dialog/index.d.ts +1 -1
- package/lib/components/Drawer/index.d.ts +1 -1
- package/lib/components/ExpandCollapsePanel/ExpandCollapsePanel.d.ts +1 -1
- package/lib/components/Popover/index.d.ts +2 -2
- package/lib/components/Table/TableContext.d.ts +1 -1
- package/lib/components/Tabs/Tab.d.ts +1 -1
- package/lib/components/Tooltip/index.d.ts +2 -2
- package/lib/index.js +39 -34
- package/lib/types.d.ts +1 -1
- package/lib/utils/useFocusTrap.d.ts +1 -1
- package/lib/utils/useSharedRef.d.ts +3 -3
- package/package.json +7 -7
|
@@ -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,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
|
}
|
|
@@ -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;
|
|
@@ -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 };
|
|
@@ -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
|
-
|
|
505
|
-
|
|
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:
|
|
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:
|
|
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":
|
|
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) {
|
|
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));
|
|
@@ -1349,7 +1352,7 @@ var AriaIsolate = /** @class */ (function () {
|
|
|
1349
1352
|
|
|
1350
1353
|
/**
|
|
1351
1354
|
* When a component needs to track an internal ref on a component that has a
|
|
1352
|
-
* forwarded ref, useSharedRef will return a
|
|
1355
|
+
* forwarded ref, useSharedRef will return a RefObject<T | null> that will
|
|
1353
1356
|
* correctly invoke the parent ref as well providing an internal ref.
|
|
1354
1357
|
*
|
|
1355
1358
|
* @example
|
|
@@ -3546,7 +3549,7 @@ var TwoColumnPanel = React.forwardRef(function (_a, ref) {
|
|
|
3546
3549
|
var closeButtonRef = React.useRef(null);
|
|
3547
3550
|
var columnLeftRef = React.useRef(null);
|
|
3548
3551
|
var columnRightRef = React.useRef(null);
|
|
3549
|
-
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; });
|
|
3550
3553
|
var togglePanel = function () {
|
|
3551
3554
|
var prefersReducedMotion = 'matchMedia' in window &&
|
|
3552
3555
|
typeof matchMedia === 'function' &&
|
|
@@ -3579,16 +3582,17 @@ var TwoColumnPanel = React.forwardRef(function (_a, ref) {
|
|
|
3579
3582
|
var ColumnLeftComponent;
|
|
3580
3583
|
var columnLeftId;
|
|
3581
3584
|
if (React.isValidElement(columnLeft)) {
|
|
3582
|
-
var
|
|
3585
|
+
var columnLeftProps = columnLeft.props;
|
|
3586
|
+
var ref_1 = columnLeftProps.ref || columnLeftRef;
|
|
3583
3587
|
var id = (columnLeftId =
|
|
3584
|
-
|
|
3588
|
+
columnLeftProps.id || nextId.useId(undefined, 'sidebar-')[0]);
|
|
3585
3589
|
var CloseButton = (React__default["default"].createElement("div", { className: "TwoColumnPanel__Close" },
|
|
3586
3590
|
React__default["default"].createElement("button", { type: "button", onClick: togglePanel, ref: closeButtonRef, "aria-label": hideCollapsedPanelLabel },
|
|
3587
3591
|
React__default["default"].createElement(Icon, { type: "close" })),
|
|
3588
3592
|
React__default["default"].createElement(Tooltip, { target: closeButtonRef, association: "aria-labelledby", hideElementOnHidden: true }, hideCollapsedPanelLabel)));
|
|
3589
3593
|
var children_1 = tslib.__spreadArray([
|
|
3590
3594
|
CloseButton
|
|
3591
|
-
], tslib.__read(React__default["default"].Children.toArray(
|
|
3595
|
+
], tslib.__read(React__default["default"].Children.toArray(columnLeftProps.children)), false);
|
|
3592
3596
|
ColumnLeftComponent = React.cloneElement(columnLeft, { id: id, ref: ref_1, tabIndex: -1 }, children_1.map(function (child, index) {
|
|
3593
3597
|
return React.cloneElement(child, {
|
|
3594
3598
|
key: child.key
|
|
@@ -3597,17 +3601,18 @@ var TwoColumnPanel = React.forwardRef(function (_a, ref) {
|
|
|
3597
3601
|
});
|
|
3598
3602
|
}));
|
|
3599
3603
|
}
|
|
3600
|
-
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; });
|
|
3601
3605
|
var ColumnRightComponent;
|
|
3602
3606
|
if (React.isValidElement(columnRight)) {
|
|
3603
|
-
var
|
|
3607
|
+
var columnRightProps = columnRight.props;
|
|
3608
|
+
var ref_2 = columnRightProps.ref || columnRightRef;
|
|
3604
3609
|
var ToggleButton = (React__default["default"].createElement("div", { className: "TwoColumnPanel__ButtonToggle" },
|
|
3605
3610
|
React__default["default"].createElement("button", { type: "button", onClick: togglePanel, ref: toggleButtonRef, "aria-label": !isCollapsed ? hideCollapsedPanelLabel : showCollapsedPanelLabel, "aria-expanded": !isCollapsed, "aria-controls": columnLeftId },
|
|
3606
3611
|
React__default["default"].createElement(Icon, { type: !isCollapsed ? 'chevron-double-left' : 'chevron-double-right' })),
|
|
3607
3612
|
React__default["default"].createElement(Tooltip, { target: toggleButtonRef, association: "aria-labelledby", hideElementOnHidden: true }, !isCollapsed ? hideCollapsedPanelLabel : showCollapsedPanelLabel)));
|
|
3608
3613
|
var children_2 = tslib.__spreadArray([
|
|
3609
3614
|
ToggleButton
|
|
3610
|
-
], tslib.__read(React__default["default"].Children.toArray(
|
|
3615
|
+
], tslib.__read(React__default["default"].Children.toArray(columnRightProps.children)), false);
|
|
3611
3616
|
ColumnRightComponent = React.cloneElement(columnRight, { ref: ref_2, tabIndex: -1 }, children_2.map(function (child, index) {
|
|
3612
3617
|
return React.cloneElement(child, {
|
|
3613
3618
|
key: child.key
|
|
@@ -3939,11 +3944,11 @@ function isElementPreceding(a, b) {
|
|
|
3939
3944
|
}
|
|
3940
3945
|
var ListboxOption = React.forwardRef(function (_a, ref) {
|
|
3941
3946
|
var _b;
|
|
3942
|
-
var _c;
|
|
3943
|
-
var propId = _a.id, className = _a.className,
|
|
3944
|
-
var
|
|
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;
|
|
3945
3950
|
var listboxOptionRef = useSharedRef(ref);
|
|
3946
|
-
var
|
|
3951
|
+
var _h = tslib.__read(propId ? [propId] : nextId.useId(1, 'listbox-option'), 1), id = _h[0];
|
|
3947
3952
|
var isActive = (active === null || active === void 0 ? void 0 : active.element) === listboxOptionRef.current;
|
|
3948
3953
|
var isSelected = typeof selectedProp === 'boolean'
|
|
3949
3954
|
? selectedProp
|
|
@@ -3951,7 +3956,7 @@ var ListboxOption = React.forwardRef(function (_a, ref) {
|
|
|
3951
3956
|
!!selected.find(function (option) { return option.element === listboxOptionRef.current; });
|
|
3952
3957
|
var optionValue = typeof value !== 'undefined'
|
|
3953
3958
|
? value
|
|
3954
|
-
: (_c = listboxOptionRef.current) === null || _c === void 0 ? void 0 : _c.
|
|
3959
|
+
: ((_d = (_c = listboxOptionRef.current) === null || _c === void 0 ? void 0 : _c.textContent) !== null && _d !== void 0 ? _d : undefined);
|
|
3955
3960
|
React.useEffect(function () {
|
|
3956
3961
|
var element = listboxOptionRef.current;
|
|
3957
3962
|
setOptions(function (options) {
|
|
@@ -4162,10 +4167,10 @@ var ComboboxOption = React.forwardRef(function (_a, ref) {
|
|
|
4162
4167
|
}
|
|
4163
4168
|
}, [isActive]);
|
|
4164
4169
|
React.useEffect(function () {
|
|
4165
|
-
var _a;
|
|
4170
|
+
var _a, _b;
|
|
4166
4171
|
var comboboxValue = typeof propValue !== 'undefined'
|
|
4167
4172
|
? propValue
|
|
4168
|
-
: (_a = comboboxOptionRef.current) === null || _a === void 0 ? void 0 : _a.
|
|
4173
|
+
: ((_b = (_a = comboboxOptionRef.current) === null || _a === void 0 ? void 0 : _a.textContent) !== null && _b !== void 0 ? _b : undefined);
|
|
4169
4174
|
var value = typeof formValue === 'undefined' ? comboboxValue : formValue;
|
|
4170
4175
|
setFormValues(function (prev) {
|
|
4171
4176
|
var formValues = prev.filter(function (fv) { return fv !== value; });
|
|
@@ -4184,11 +4189,11 @@ var ComboboxOption = React.forwardRef(function (_a, ref) {
|
|
|
4184
4189
|
});
|
|
4185
4190
|
}, [selectedValues, formValue]);
|
|
4186
4191
|
React.useEffect(function () {
|
|
4187
|
-
var _a;
|
|
4192
|
+
var _a, _b;
|
|
4188
4193
|
if (isMatching) {
|
|
4189
4194
|
var comboboxValue_1 = typeof propValue !== 'undefined'
|
|
4190
4195
|
? propValue
|
|
4191
|
-
: (_a = comboboxOptionRef.current) === null || _a === void 0 ? void 0 : _a.
|
|
4196
|
+
: ((_b = (_a = comboboxOptionRef.current) === null || _a === void 0 ? void 0 : _a.textContent) !== null && _b !== void 0 ? _b : undefined);
|
|
4192
4197
|
setMatchingOptions(function (options) {
|
|
4193
4198
|
if (!comboboxOptionRef.current)
|
|
4194
4199
|
return options;
|
|
@@ -5176,7 +5181,7 @@ var ActionListItem = React.forwardRef(function (_a, ref) {
|
|
|
5176
5181
|
});
|
|
5177
5182
|
var isActive = !!(active === null || active === void 0 ? void 0 : active.element) && active.element === actionListItemRef.current;
|
|
5178
5183
|
var handleAction = React.useCallback(function (event) {
|
|
5179
|
-
var _a;
|
|
5184
|
+
var _a, _b;
|
|
5180
5185
|
if (event.defaultPrevented) {
|
|
5181
5186
|
return;
|
|
5182
5187
|
}
|
|
@@ -5189,7 +5194,7 @@ var ActionListItem = React.forwardRef(function (_a, ref) {
|
|
|
5189
5194
|
}
|
|
5190
5195
|
// istanbul ignore else
|
|
5191
5196
|
if (typeof onActionListAction === 'function') {
|
|
5192
|
-
onActionListAction(actionKey || ((_a = labelRef === null ||
|
|
5197
|
+
onActionListAction(actionKey || ((_b = (_a = labelRef.current) === null || _a === void 0 ? void 0 : _a.textContent) === null || _b === void 0 ? void 0 : _b.trim()) || '', event);
|
|
5193
5198
|
}
|
|
5194
5199
|
}, [onAction, onActionListAction, selectionType, actionKey]);
|
|
5195
5200
|
var listItemRole = undefined;
|
|
@@ -5312,9 +5317,10 @@ var ActionMenu = React.forwardRef(function (_a, ref) {
|
|
|
5312
5317
|
var _e = tslib.__read(React.useState('first'), 2), focusStrategy = _e[0], setFocusStrategy = _e[1];
|
|
5313
5318
|
var triggerRef = React.useRef(null);
|
|
5314
5319
|
var actionMenuRef = useSharedRef(ref);
|
|
5315
|
-
var
|
|
5316
|
-
var
|
|
5317
|
-
var _g = tslib.__read(nextId.useId(1, 'menu'), 1),
|
|
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];
|
|
5318
5324
|
var handleTriggerClick = React.useCallback(function (event) {
|
|
5319
5325
|
// istanbul ignore else
|
|
5320
5326
|
if (!event.defaultPrevented) {
|
|
@@ -5361,11 +5367,10 @@ var ActionMenu = React.forwardRef(function (_a, ref) {
|
|
|
5361
5367
|
if (!event.defaultPrevented) {
|
|
5362
5368
|
setOpen(false);
|
|
5363
5369
|
}
|
|
5364
|
-
|
|
5365
|
-
|
|
5366
|
-
onAction(key, event);
|
|
5370
|
+
if (typeof actionListOnAction === 'function') {
|
|
5371
|
+
actionListOnAction(key, event);
|
|
5367
5372
|
}
|
|
5368
|
-
}, [
|
|
5373
|
+
}, [actionListOnAction]);
|
|
5369
5374
|
React.useEffect(function () {
|
|
5370
5375
|
var _a, _b;
|
|
5371
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>;
|
|
@@ -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,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
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
|
|
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>):
|
|
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.
|
|
3
|
+
"version": "7.1.0-canary.3e2a4099",
|
|
4
4
|
"license": "MPL-2.0",
|
|
5
5
|
"description": "Fully accessible react components library for Deque Cauldron",
|
|
6
6
|
"homepage": "https://cauldron.dequelabs.com/",
|
|
@@ -54,8 +54,8 @@
|
|
|
54
54
|
"@types/jest": "^29.5.11",
|
|
55
55
|
"@types/jest-axe": "^3.5.4",
|
|
56
56
|
"@types/node": "^17.0.42",
|
|
57
|
-
"@types/react": "^
|
|
58
|
-
"@types/react-dom": "^
|
|
57
|
+
"@types/react": "^19.0.0",
|
|
58
|
+
"@types/react-dom": "^19.0.0",
|
|
59
59
|
"@types/react-syntax-highlighter": "^15.5.13",
|
|
60
60
|
"@types/sinon": "^10",
|
|
61
61
|
"autoprefixer": "^9.7.6",
|
|
@@ -70,8 +70,8 @@
|
|
|
70
70
|
"postcss-import": "^12.0.1",
|
|
71
71
|
"postcss-loader": "^3.0.0",
|
|
72
72
|
"prop-types": "^15.8.1",
|
|
73
|
-
"react": "^
|
|
74
|
-
"react-dom": "^
|
|
73
|
+
"react": "^19",
|
|
74
|
+
"react-dom": "^19",
|
|
75
75
|
"rollup": "^2.23.0",
|
|
76
76
|
"sinon": "^10.0.0",
|
|
77
77
|
"ts-node": "^10.9.2",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"url": "git+https://github.com/dequelabs/cauldron.git"
|
|
83
83
|
},
|
|
84
84
|
"peerDependencies": {
|
|
85
|
-
"react": ">=16.6
|
|
86
|
-
"react-dom": ">=16.6
|
|
85
|
+
"react": ">=16.6 <20",
|
|
86
|
+
"react-dom": ">=16.6 <20"
|
|
87
87
|
}
|
|
88
88
|
}
|