@deque/cauldron-react 7.1.0-canary.186c088f → 7.1.0-canary.2ada12a9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,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,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,
|
|
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
|
-
|
|
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;
|
package/lib/index.js
CHANGED
|
@@ -672,6 +672,7 @@ var TopBar$1 = /** @class */ (function (_super) {
|
|
|
672
672
|
tslib.__extends(TopBar, _super);
|
|
673
673
|
function TopBar(props) {
|
|
674
674
|
var _this = _super.call(this, props) || this;
|
|
675
|
+
_this.menuBarRef = React__default["default"].createRef();
|
|
675
676
|
_this.onResize = function () {
|
|
676
677
|
var wide = isWide();
|
|
677
678
|
if (wide === _this.state.wide) {
|
|
@@ -720,10 +721,10 @@ var TopBar$1 = /** @class */ (function (_super) {
|
|
|
720
721
|
};
|
|
721
722
|
TopBar.prototype.onKeyDown = function (e) {
|
|
722
723
|
var key = keyname__default["default"](e.which);
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
724
|
+
var menuBarElement = this.menuBarRef.current;
|
|
725
|
+
if (!menuBarElement) {
|
|
726
|
+
return;
|
|
727
|
+
}
|
|
727
728
|
var menuItems = Array.from(menuBarElement.children);
|
|
728
729
|
// account for hidden side bar trigger (hamburger)
|
|
729
730
|
if (this.state.wide && this.props.hasTrigger) {
|
|
@@ -750,7 +751,7 @@ var TopBar$1 = /** @class */ (function (_super) {
|
|
|
750
751
|
// disabling no-unused-vars to prevent thin/hasTrigger from being passed through to div
|
|
751
752
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
752
753
|
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)));
|
|
754
|
+
return (React__default["default"].createElement("ul", { role: "menubar", onKeyDown: this.onKeyDown, className: className, ref: this.menuBarRef }, React.Children.map(children, this.renderChild)));
|
|
754
755
|
};
|
|
755
756
|
TopBar.defaultProps = {
|
|
756
757
|
thin: false,
|
|
@@ -808,7 +809,7 @@ function resolveElement(elementOrRef) {
|
|
|
808
809
|
|
|
809
810
|
function ClickOutsideListener(_a, ref) {
|
|
810
811
|
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();
|
|
812
|
+
var childElementRef = React.useRef(null);
|
|
812
813
|
var handleEvent = function (event) {
|
|
813
814
|
if (event.defaultPrevented) {
|
|
814
815
|
return;
|
|
@@ -1342,7 +1343,7 @@ var AriaIsolate = /** @class */ (function () {
|
|
|
1342
1343
|
|
|
1343
1344
|
/**
|
|
1344
1345
|
* 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
|
|
1346
|
+
* forwarded ref, useSharedRef will return a MutableRefObject<T | null> that will
|
|
1346
1347
|
* correctly invoke the parent ref as well providing an internal ref.
|
|
1347
1348
|
*
|
|
1348
1349
|
* @example
|
|
@@ -1355,7 +1356,7 @@ var AriaIsolate = /** @class */ (function () {
|
|
|
1355
1356
|
* })
|
|
1356
1357
|
*/
|
|
1357
1358
|
function useSharedRef(ref) {
|
|
1358
|
-
var internalRef = React.useRef();
|
|
1359
|
+
var internalRef = React.useRef(null);
|
|
1359
1360
|
React.useEffect(function () {
|
|
1360
1361
|
setRef(ref, internalRef.current);
|
|
1361
1362
|
return function () { return setRef(ref, null); };
|
|
@@ -1488,7 +1489,7 @@ function useFocusTrap(target, options) {
|
|
|
1488
1489
|
if (options === void 0) { options = {}; }
|
|
1489
1490
|
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
1491
|
var focusTrap = React.useRef(null);
|
|
1491
|
-
var returnFocusElementRef = React.useRef();
|
|
1492
|
+
var returnFocusElementRef = React.useRef(null);
|
|
1492
1493
|
function restoreFocusToReturnFocusElement() {
|
|
1493
1494
|
var _a;
|
|
1494
1495
|
var resolvedReturnFocusElement = resolveElement(returnFocusElement);
|
|
@@ -1538,7 +1539,7 @@ var Dialog = React.forwardRef(function (_a, ref) {
|
|
|
1538
1539
|
var dialogRef = useSharedRef(dialogRefProp || ref);
|
|
1539
1540
|
var _g = tslib.__read(nextId.useId(1, 'dialog-title-'), 1), headingId = _g[0];
|
|
1540
1541
|
var headingRef = React.useRef(null);
|
|
1541
|
-
var isolatorRef = React.useRef();
|
|
1542
|
+
var isolatorRef = React.useRef(null);
|
|
1542
1543
|
var headingLevel = typeof heading === 'object' && 'level' in heading && heading.level
|
|
1543
1544
|
? heading.level
|
|
1544
1545
|
: 2;
|
|
@@ -2133,7 +2134,7 @@ var looksLikeLink = function (props) {
|
|
|
2133
2134
|
};
|
|
2134
2135
|
var IconButton = React.forwardRef(function (_a, ref) {
|
|
2135
2136
|
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();
|
|
2137
|
+
var internalRef = React.useRef(null);
|
|
2137
2138
|
React.useImperativeHandle(ref, function () { return internalRef.current; });
|
|
2138
2139
|
// Configure additional properties based on the type of the Component
|
|
2139
2140
|
// for accessibility
|
|
@@ -2695,7 +2696,7 @@ Checkbox.displayName = 'Checkbox';
|
|
|
2695
2696
|
*/
|
|
2696
2697
|
function TooltipTabstop(_a) {
|
|
2697
2698
|
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();
|
|
2699
|
+
var buttonRef = React.useRef(null);
|
|
2699
2700
|
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
2700
2701
|
React__default["default"].createElement("button", tslib.__assign({ type: "button", ref: buttonRef, "aria-disabled": "true", className: classNames__default["default"]('TooltipTabstop', className) }, buttonProps), children),
|
|
2701
2702
|
React__default["default"].createElement(Tooltip, { target: buttonRef, variant: variant, association: association, show: show, placement: placement, portal: portal, hideElementOnHidden: hideElementOnHidden }, tooltip)));
|
|
@@ -3949,10 +3950,10 @@ var ListboxOption = React.forwardRef(function (_a, ref) {
|
|
|
3949
3950
|
var element = listboxOptionRef.current;
|
|
3950
3951
|
setOptions(function (options) {
|
|
3951
3952
|
var e_1, _a;
|
|
3952
|
-
var option = { element: element, value: optionValue };
|
|
3953
3953
|
// istanbul ignore next
|
|
3954
3954
|
if (!element)
|
|
3955
3955
|
return options;
|
|
3956
|
+
var option = { element: element, value: optionValue };
|
|
3956
3957
|
// Elements are frequently appended, so check to see if the newly rendered
|
|
3957
3958
|
// element follows the last element first before any other checks
|
|
3958
3959
|
if (!options.length ||
|
|
@@ -3989,7 +3990,7 @@ var ListboxOption = React.forwardRef(function (_a, ref) {
|
|
|
3989
3990
|
if (disabled) {
|
|
3990
3991
|
return;
|
|
3991
3992
|
}
|
|
3992
|
-
onSelect({ element:
|
|
3993
|
+
onSelect({ element: event.target, value: optionValue });
|
|
3993
3994
|
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
|
3994
3995
|
}, [optionValue, onSelect, onClick, disabled]);
|
|
3995
3996
|
return (React__default["default"].createElement(Component, tslib.__assign({ id: id, className: classNames__default["default"](className, (_b = {},
|
|
@@ -4139,7 +4140,7 @@ var ComboboxOption = React.forwardRef(function (_a, ref) {
|
|
|
4139
4140
|
// istanbul ignore next
|
|
4140
4141
|
React.useLayoutEffect(function () {
|
|
4141
4142
|
var intersectionEntry = intersectionRef.current;
|
|
4142
|
-
if (!intersectionEntry || !isActive) {
|
|
4143
|
+
if (!intersectionEntry || !isActive || !comboboxOptionRef.current) {
|
|
4143
4144
|
return;
|
|
4144
4145
|
}
|
|
4145
4146
|
var rect = comboboxOptionRef.current.getBoundingClientRect();
|
|
@@ -4183,6 +4184,8 @@ var ComboboxOption = React.forwardRef(function (_a, ref) {
|
|
|
4183
4184
|
? propValue
|
|
4184
4185
|
: (_a = comboboxOptionRef.current) === null || _a === void 0 ? void 0 : _a.innerText;
|
|
4185
4186
|
setMatchingOptions(function (options) {
|
|
4187
|
+
if (!comboboxOptionRef.current)
|
|
4188
|
+
return options;
|
|
4186
4189
|
return new Map(options.set(comboboxOptionRef.current, {
|
|
4187
4190
|
value: comboboxValue_1,
|
|
4188
4191
|
displayValue: children,
|
|
@@ -4322,6 +4325,17 @@ var Combobox = React.forwardRef(function (_a, ref) {
|
|
|
4322
4325
|
return value === lastSelectedValue;
|
|
4323
4326
|
}) || [], 2), element = _a[0], option = _a[1];
|
|
4324
4327
|
if (autocomplete === 'manual') {
|
|
4328
|
+
// In multiselect, the listbox manages its own active option via
|
|
4329
|
+
// keyboard navigation. When the last-selected value no longer
|
|
4330
|
+
// matches any option (e.g. after deselecting the only selected
|
|
4331
|
+
// option), preserve the existing active descendant so the next
|
|
4332
|
+
// Enter keypress can re-toggle the highlighted option.
|
|
4333
|
+
if (multiselect &&
|
|
4334
|
+
!element &&
|
|
4335
|
+
activeDescendant &&
|
|
4336
|
+
matchingOptions.has(activeDescendant.element)) {
|
|
4337
|
+
return;
|
|
4338
|
+
}
|
|
4325
4339
|
setActiveDescendant(!element ? null : tslib.__assign({ element: element }, option));
|
|
4326
4340
|
}
|
|
4327
4341
|
else if (autocomplete === 'automatic' &&
|
|
@@ -4501,6 +4515,7 @@ var Combobox = React.forwardRef(function (_a, ref) {
|
|
|
4501
4515
|
});
|
|
4502
4516
|
}, [disabled, selectedValues, onSelectionChange]);
|
|
4503
4517
|
var handlePillKeyDown = React.useCallback(function (event) {
|
|
4518
|
+
var _a, _b;
|
|
4504
4519
|
if (!PillKeys.includes(event.key)) {
|
|
4505
4520
|
return;
|
|
4506
4521
|
}
|
|
@@ -4518,7 +4533,7 @@ var Combobox = React.forwardRef(function (_a, ref) {
|
|
|
4518
4533
|
handleRemovePill(pillsRef.current[focusedIndex], selectedValues[focusedIndex]);
|
|
4519
4534
|
var nextIndex = focusedIndex + 1;
|
|
4520
4535
|
if (nextIndex == pillsLength) {
|
|
4521
|
-
inputRef.current.focus();
|
|
4536
|
+
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
4522
4537
|
}
|
|
4523
4538
|
else {
|
|
4524
4539
|
pillsRef.current[nextIndex].focus();
|
|
@@ -4527,7 +4542,7 @@ var Combobox = React.forwardRef(function (_a, ref) {
|
|
|
4527
4542
|
else if (isArrowLeft || isArrowRight) {
|
|
4528
4543
|
var nextIndex = Math.max(focusedIndex + (isArrowLeft ? -1 : 1), 0);
|
|
4529
4544
|
if (isArrowRight && nextIndex === pillsLength) {
|
|
4530
|
-
inputRef.current.focus();
|
|
4545
|
+
(_b = inputRef.current) === null || _b === void 0 ? void 0 : _b.focus();
|
|
4531
4546
|
}
|
|
4532
4547
|
else {
|
|
4533
4548
|
pillsRef.current[nextIndex].focus();
|
|
@@ -4815,10 +4830,12 @@ var TextEllipsis = React__default["default"].forwardRef(function (_a, ref) {
|
|
|
4815
4830
|
: overflowElement.clientWidth < overflowElement.scrollWidth);
|
|
4816
4831
|
});
|
|
4817
4832
|
};
|
|
4833
|
+
if (!sharedRef.current)
|
|
4834
|
+
return;
|
|
4818
4835
|
var observer = new ResizeObserver(listener);
|
|
4819
4836
|
observer.observe(sharedRef.current);
|
|
4820
4837
|
return function () {
|
|
4821
|
-
observer
|
|
4838
|
+
observer.disconnect();
|
|
4822
4839
|
};
|
|
4823
4840
|
}, []);
|
|
4824
4841
|
React.useEffect(function () {
|
|
@@ -4863,7 +4880,7 @@ var Drawer = React.forwardRef(function (_a, ref) {
|
|
|
4863
4880
|
openRef.current = open;
|
|
4864
4881
|
}, [open, setIsTransitioning]);
|
|
4865
4882
|
React.useEffect(function () {
|
|
4866
|
-
if (!isModal) {
|
|
4883
|
+
if (!isModal || !drawerRef.current) {
|
|
4867
4884
|
return;
|
|
4868
4885
|
}
|
|
4869
4886
|
var isolator = new AriaIsolate(drawerRef.current);
|
|
@@ -5044,7 +5061,7 @@ function getActiveElement(root) {
|
|
|
5044
5061
|
*/
|
|
5045
5062
|
function useMnemonics(_a) {
|
|
5046
5063
|
var elementOrRef = _a.elementOrRef, matchingElementsSelector = _a.matchingElementsSelector, onMatch = _a.onMatch, _b = _a.enabled, enabled = _b === void 0 ? true : _b;
|
|
5047
|
-
var containerRef = React.useRef();
|
|
5064
|
+
var containerRef = React.useRef(null);
|
|
5048
5065
|
React.useEffect(function () {
|
|
5049
5066
|
if (elementOrRef instanceof HTMLElement) {
|
|
5050
5067
|
containerRef.current = elementOrRef;
|
|
@@ -5054,7 +5071,8 @@ function useMnemonics(_a) {
|
|
|
5054
5071
|
}
|
|
5055
5072
|
}, [elementOrRef]);
|
|
5056
5073
|
React.useEffect(function () {
|
|
5057
|
-
|
|
5074
|
+
var listenerTarget = containerRef.current;
|
|
5075
|
+
if (!enabled || !listenerTarget) {
|
|
5058
5076
|
return;
|
|
5059
5077
|
}
|
|
5060
5078
|
var keyboardHandler = function (event) {
|
|
@@ -5067,14 +5085,14 @@ function useMnemonics(_a) {
|
|
|
5067
5085
|
if (event.key.length !== 1 || !/[a-z\d]/i.test(event.key)) {
|
|
5068
5086
|
return;
|
|
5069
5087
|
}
|
|
5070
|
-
var
|
|
5071
|
-
if (!
|
|
5088
|
+
var currentContainer = containerRef.current;
|
|
5089
|
+
if (!currentContainer) {
|
|
5072
5090
|
return;
|
|
5073
5091
|
}
|
|
5074
5092
|
// Prevent default behavior and stop propagation for mnemonic keys
|
|
5075
5093
|
event.preventDefault();
|
|
5076
5094
|
event.stopPropagation();
|
|
5077
|
-
var elements = Array.from(
|
|
5095
|
+
var elements = Array.from(currentContainer.querySelectorAll(matchingElementsSelector !== null && matchingElementsSelector !== void 0 ? matchingElementsSelector : focusable__default["default"]));
|
|
5078
5096
|
var matchingElements = elements.filter(function (element) {
|
|
5079
5097
|
return getAccessibleLabel(element).toLowerCase()[0] ===
|
|
5080
5098
|
event.key.toLowerCase();
|
|
@@ -5082,7 +5100,7 @@ function useMnemonics(_a) {
|
|
|
5082
5100
|
if (!matchingElements.length) {
|
|
5083
5101
|
return;
|
|
5084
5102
|
}
|
|
5085
|
-
var currentActiveElement = getActiveElement(
|
|
5103
|
+
var currentActiveElement = getActiveElement(currentContainer);
|
|
5086
5104
|
var nextActiveElement = null;
|
|
5087
5105
|
if (currentActiveElement) {
|
|
5088
5106
|
nextActiveElement = matchingElements.find(function (element) {
|
|
@@ -5096,17 +5114,15 @@ function useMnemonics(_a) {
|
|
|
5096
5114
|
onMatch(nextActiveElement !== null && nextActiveElement !== void 0 ? nextActiveElement : matchingElements[0]);
|
|
5097
5115
|
}
|
|
5098
5116
|
};
|
|
5099
|
-
|
|
5100
|
-
|
|
5101
|
-
return function () { return container.removeEventListener('keydown', keyboardHandler); };
|
|
5117
|
+
listenerTarget.addEventListener('keydown', keyboardHandler);
|
|
5118
|
+
return function () { return listenerTarget.removeEventListener('keydown', keyboardHandler); };
|
|
5102
5119
|
}, [enabled, containerRef, matchingElementsSelector, onMatch]);
|
|
5103
5120
|
return containerRef;
|
|
5104
5121
|
}
|
|
5105
5122
|
|
|
5106
5123
|
var ActionList = React.forwardRef(function (_a, ref) {
|
|
5107
5124
|
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
|
|
5109
|
-
var activeElement = React.useRef();
|
|
5125
|
+
var activeElement = React.useRef(null);
|
|
5110
5126
|
var _c = tslib.__read(React.useState(), 2), activeOption = _c[0], setActiveOption = _c[1];
|
|
5111
5127
|
var handleActiveChange = React.useCallback(function (value) {
|
|
5112
5128
|
activeElement.current = value === null || value === void 0 ? void 0 : value.element;
|
|
@@ -5127,12 +5143,7 @@ var ActionList = React.forwardRef(function (_a, ref) {
|
|
|
5127
5143
|
? '[role=menuitem],[role=menuitemcheckbox],[role=menuitemradio]'
|
|
5128
5144
|
: '[role=option]'
|
|
5129
5145
|
});
|
|
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) {
|
|
5146
|
+
return (React__default["default"].createElement(Listbox, tslib.__assign({ ref: function (element) {
|
|
5136
5147
|
if (ref) {
|
|
5137
5148
|
setRef(ref, element);
|
|
5138
5149
|
}
|
|
@@ -5141,7 +5152,7 @@ var ActionList = React.forwardRef(function (_a, ref) {
|
|
|
5141
5152
|
/* Listbox comes with an explicit role of "listbox", but we want to either
|
|
5142
5153
|
* use the role from props, or default to the intrinsic role */
|
|
5143
5154
|
// eslint-disable-next-line jsx-a11y/aria-role
|
|
5144
|
-
role: undefined, "aria-multiselectable":
|
|
5155
|
+
role: undefined, "aria-multiselectable": undefined, className: classNames__default["default"]('ActionList', className), activeOption: activeOption }, props, { onActiveChange: handleActiveChange, navigation: "bound" }),
|
|
5145
5156
|
React__default["default"].createElement(ActionListProvider, { role: props.role || 'list', onAction: handleAction, selectionType: selectionType }, children)));
|
|
5146
5157
|
});
|
|
5147
5158
|
ActionList.displayName = 'ActionList';
|
|
@@ -5196,7 +5207,7 @@ var ActionListItem = React.forwardRef(function (_a, ref) {
|
|
|
5196
5207
|
// istanbul ignore next
|
|
5197
5208
|
React.useLayoutEffect(function () {
|
|
5198
5209
|
var intersectionEntry = intersectionRef.current;
|
|
5199
|
-
if (!intersectionEntry || !isActive) {
|
|
5210
|
+
if (!intersectionEntry || !isActive || !actionListItemRef.current) {
|
|
5200
5211
|
return;
|
|
5201
5212
|
}
|
|
5202
5213
|
var rect = actionListItemRef.current.getBoundingClientRect();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
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> =
|
|
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
1
|
import { MutableRefObject, 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 MutableRefObject<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>): MutableRefObject<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.2ada12a9",
|
|
4
4
|
"license": "MPL-2.0",
|
|
5
5
|
"description": "Fully accessible react components library for Deque Cauldron",
|
|
6
6
|
"homepage": "https://cauldron.dequelabs.com/",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"@babel/preset-env": "^7.22.10",
|
|
42
42
|
"@babel/preset-react": "^7.22.5",
|
|
43
43
|
"@babel/preset-typescript": "^7.22.5",
|
|
44
|
-
"@figma/code-connect": "^1.4.
|
|
44
|
+
"@figma/code-connect": "^1.4.5",
|
|
45
45
|
"@rollup/plugin-commonjs": "^14.0.0",
|
|
46
46
|
"@rollup/plugin-dynamic-import-vars": "^1.4.2",
|
|
47
47
|
"@rollup/plugin-typescript": "^11.1.2",
|