@deque/cauldron-react 6.20.2-canary.961bd7ca → 6.20.2-canary.993cc789
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/Combobox/Combobox.d.ts +1 -0
- package/lib/index.js +32 -21
- package/package.json +1 -1
|
@@ -21,6 +21,7 @@ interface BaseComboboxProps extends Omit<React.InputHTMLAttributes<HTMLInputElem
|
|
|
21
21
|
renderNoResults?: (() => React.JSX.Element) | React.ReactElement;
|
|
22
22
|
portal?: React.RefObject<HTMLElement> | HTMLElement;
|
|
23
23
|
inputRef?: React.Ref<HTMLInputElement>;
|
|
24
|
+
description?: React.ReactNode;
|
|
24
25
|
}
|
|
25
26
|
interface SingleSelectComboboxProps extends BaseComboboxProps {
|
|
26
27
|
value?: ComboboxValue;
|
package/lib/index.js
CHANGED
|
@@ -1785,11 +1785,10 @@ var AnchoredOverlay = React.forwardRef(function (_a, refProp) {
|
|
|
1785
1785
|
reactDom$1.shift({ crossAxis: false })
|
|
1786
1786
|
].filter(Boolean),
|
|
1787
1787
|
elements: {
|
|
1788
|
-
reference: resolveElement(target)
|
|
1789
|
-
floating: ref.current
|
|
1788
|
+
reference: resolveElement(target)
|
|
1790
1789
|
},
|
|
1791
1790
|
whileElementsMounted: dom.autoUpdate
|
|
1792
|
-
}), floatingStyles = _f.floatingStyles, placement = _f.placement, middlewareData = _f.middlewareData;
|
|
1791
|
+
}), refs = _f.refs, floatingStyles = _f.floatingStyles, placement = _f.placement, middlewareData = _f.middlewareData;
|
|
1793
1792
|
useEscapeKey({
|
|
1794
1793
|
active: open,
|
|
1795
1794
|
capture: true,
|
|
@@ -1819,7 +1818,10 @@ var AnchoredOverlay = React.forwardRef(function (_a, refProp) {
|
|
|
1819
1818
|
});
|
|
1820
1819
|
}
|
|
1821
1820
|
}, [onShiftChange, (_b = middlewareData.shift) === null || _b === void 0 ? void 0 : _b.x, (_c = middlewareData.shift) === null || _c === void 0 ? void 0 : _c.y]);
|
|
1822
|
-
var AnchoredOverlayComponent = (React__default["default"].createElement(Component, tslib.__assign({ ref:
|
|
1821
|
+
var AnchoredOverlayComponent = (React__default["default"].createElement(Component, tslib.__assign({ ref: function (element) {
|
|
1822
|
+
refs.setFloating(element);
|
|
1823
|
+
ref.current = element;
|
|
1824
|
+
} }, props, { style: tslib.__assign(tslib.__assign({}, floatingStyles), style) }), children));
|
|
1823
1825
|
if (portal && !isBrowser()) {
|
|
1824
1826
|
return null;
|
|
1825
1827
|
}
|
|
@@ -4156,7 +4158,7 @@ var ComboboxNoResults = function (_a) {
|
|
|
4156
4158
|
return (React__default["default"].createElement("div", { className: "ComboboxListbox__empty", role: "alert", "aria-live": "polite" }, children || 'No results found.'));
|
|
4157
4159
|
};
|
|
4158
4160
|
var Combobox = React.forwardRef(function (_a, ref) {
|
|
4159
|
-
var propId = _a.id, className = _a.className, label = _a.label, children = _a.children, _b = _a.options, options = _b === void 0 ? [] : _b, propValue = _a.value, defaultValue = _a.defaultValue, propInputValue = _a.inputValue, defaultInputValue = _a.defaultInputValue, _c = _a.multiselect, multiselect = _c === void 0 ? false : _c, _d = _a.requiredText, requiredText = _d === void 0 ? 'Required' : _d, error = _a.error, _e = _a.autocomplete, autocomplete = _e === void 0 ? 'manual' : _e, onSelectionChange = _a.onSelectionChange, onActiveChange = _a.onActiveChange, onChange = _a.onChange, onKeyDown = _a.onKeyDown, onFocus = _a.onFocus, onBlur = _a.onBlur, name = _a.name, renderNoResults = _a.renderNoResults, portal = _a.portal, _f = _a.inputRef, propInputRef = _f === void 0 ? null : _f, ariaDescribedby = _a["aria-describedby"], _g = _a.disabled, disabled = _g === void 0 ? false : _g, props = tslib.__rest(_a, ["id", "className", "label", "children", "options", "value", "defaultValue", "inputValue", "defaultInputValue", "multiselect", "requiredText", "error", "autocomplete", "onSelectionChange", "onActiveChange", "onChange", "onKeyDown", "onFocus", "onBlur", "name", "renderNoResults", "portal", "inputRef", 'aria-describedby', "disabled"]);
|
|
4161
|
+
var propId = _a.id, className = _a.className, label = _a.label, children = _a.children, _b = _a.options, options = _b === void 0 ? [] : _b, propValue = _a.value, defaultValue = _a.defaultValue, propInputValue = _a.inputValue, defaultInputValue = _a.defaultInputValue, _c = _a.multiselect, multiselect = _c === void 0 ? false : _c, _d = _a.requiredText, requiredText = _d === void 0 ? 'Required' : _d, error = _a.error, _e = _a.autocomplete, autocomplete = _e === void 0 ? 'manual' : _e, onSelectionChange = _a.onSelectionChange, onActiveChange = _a.onActiveChange, onChange = _a.onChange, onKeyDown = _a.onKeyDown, onFocus = _a.onFocus, onBlur = _a.onBlur, name = _a.name, renderNoResults = _a.renderNoResults, portal = _a.portal, _f = _a.inputRef, propInputRef = _f === void 0 ? null : _f, description = _a.description, ariaDescribedby = _a["aria-describedby"], _g = _a.disabled, disabled = _g === void 0 ? false : _g, props = tslib.__rest(_a, ["id", "className", "label", "children", "options", "value", "defaultValue", "inputValue", "defaultInputValue", "multiselect", "requiredText", "error", "autocomplete", "onSelectionChange", "onActiveChange", "onChange", "onKeyDown", "onFocus", "onBlur", "name", "renderNoResults", "portal", "inputRef", "description", 'aria-describedby', "disabled"]);
|
|
4160
4162
|
var _h = tslib.__read(React.useState(new Map()), 2), matchingOptions = _h[0], setMatchingOptions = _h[1];
|
|
4161
4163
|
var _j = tslib.__read(React.useState(function () {
|
|
4162
4164
|
var value = defaultValue || propValue;
|
|
@@ -4500,9 +4502,15 @@ var Combobox = React.forwardRef(function (_a, ref) {
|
|
|
4500
4502
|
comboboxOptions,
|
|
4501
4503
|
noMatchingOptions));
|
|
4502
4504
|
var errorId = "".concat(id, "-error");
|
|
4503
|
-
var
|
|
4504
|
-
|
|
4505
|
-
|
|
4505
|
+
var descriptionId = "".concat(id, "-description");
|
|
4506
|
+
var describedby = ariaDescribedby;
|
|
4507
|
+
if (description) {
|
|
4508
|
+
describedby = addIdRef(describedby, descriptionId);
|
|
4509
|
+
}
|
|
4510
|
+
if (error) {
|
|
4511
|
+
describedby = addIdRef(describedby, errorId);
|
|
4512
|
+
}
|
|
4513
|
+
var inputProps = tslib.__assign(tslib.__assign({}, props), { 'aria-describedby': describedby });
|
|
4506
4514
|
return (React__default["default"].createElement("div", { id: id, className: classNames__default["default"]('Combobox', { 'Combobox--multiselect': multiselect }, className), ref: comboboxRef },
|
|
4507
4515
|
name &&
|
|
4508
4516
|
formValues.map(function (formValue, index) { return (React__default["default"].createElement("input", { type: "hidden", key: index, name: name, value: formValue })); }),
|
|
@@ -4512,6 +4520,10 @@ var Combobox = React.forwardRef(function (_a, ref) {
|
|
|
4512
4520
|
}), id: "".concat(id, "-label"), htmlFor: "".concat(id, "-input") },
|
|
4513
4521
|
React__default["default"].createElement("span", null, label),
|
|
4514
4522
|
isRequired && (React__default["default"].createElement("span", { className: "Field__required-text", "aria-hidden": "true" }, requiredText))),
|
|
4523
|
+
description && (React__default["default"].createElement("span", { className: "Field__description", id: descriptionId }, description)),
|
|
4524
|
+
hasError && (React__default["default"].createElement("div", { className: "Field__error", id: errorId },
|
|
4525
|
+
React__default["default"].createElement(Icon, { type: "caution" }),
|
|
4526
|
+
error)),
|
|
4515
4527
|
React__default["default"].createElement(TextFieldWrapper, { className: classNames__default["default"]({ 'TextFieldWrapper--error': hasError }),
|
|
4516
4528
|
// We're handling click here to open the listbox when the wrapping element is clicked,
|
|
4517
4529
|
// there's already keyboard handlers to open the listbox on the input element
|
|
@@ -4541,8 +4553,7 @@ var Combobox = React.forwardRef(function (_a, ref) {
|
|
|
4541
4553
|
: portal.current ||
|
|
4542
4554
|
// eslint-disable-next-line ssr-friendly/no-dom-globals-in-react-fc
|
|
4543
4555
|
/* istanbul ignore next: default fallback value */ document.body)
|
|
4544
|
-
: comboboxListbox)
|
|
4545
|
-
hasError && (React__default["default"].createElement("div", { className: "Error", id: errorId }, error))));
|
|
4556
|
+
: comboboxListbox)));
|
|
4546
4557
|
});
|
|
4547
4558
|
Combobox.displayName = 'Combobox';
|
|
4548
4559
|
|
|
@@ -4621,25 +4632,25 @@ var Popover = React.forwardRef(function (_a, ref) {
|
|
|
4621
4632
|
targetElement === null || targetElement === void 0 ? void 0 : targetElement.setAttribute('aria-haspopup', 'true');
|
|
4622
4633
|
}
|
|
4623
4634
|
}, [targetElement, id, show]);
|
|
4624
|
-
var
|
|
4635
|
+
var handleClosePopover = function () {
|
|
4636
|
+
isolator === null || isolator === void 0 ? void 0 : isolator.deactivate();
|
|
4637
|
+
if (show) {
|
|
4638
|
+
onClose();
|
|
4639
|
+
}
|
|
4640
|
+
};
|
|
4641
|
+
var handleClickOutside = React.useCallback(function (e) {
|
|
4625
4642
|
if (e.target === targetElement) {
|
|
4626
4643
|
return;
|
|
4627
4644
|
}
|
|
4628
4645
|
if (show) {
|
|
4629
4646
|
handleClosePopover();
|
|
4630
4647
|
}
|
|
4631
|
-
};
|
|
4648
|
+
}, [show, targetElement, handleClosePopover]);
|
|
4632
4649
|
var attachIsolator = function () {
|
|
4633
4650
|
if (popoverRef === null || popoverRef === void 0 ? void 0 : popoverRef.current) {
|
|
4634
4651
|
setIsolator(new AriaIsolate(popoverRef === null || popoverRef === void 0 ? void 0 : popoverRef.current));
|
|
4635
4652
|
}
|
|
4636
4653
|
};
|
|
4637
|
-
var handleClosePopover = function () {
|
|
4638
|
-
isolator === null || isolator === void 0 ? void 0 : isolator.deactivate();
|
|
4639
|
-
if (show) {
|
|
4640
|
-
onClose();
|
|
4641
|
-
}
|
|
4642
|
-
};
|
|
4643
4654
|
useEscapeKey({
|
|
4644
4655
|
callback: handleClosePopover,
|
|
4645
4656
|
active: show
|
|
@@ -5054,10 +5065,10 @@ var ActionListSeparator = React.forwardRef(function (_a, ref) {
|
|
|
5054
5065
|
ActionListSeparator.displayName = 'ActionListSeparator';
|
|
5055
5066
|
|
|
5056
5067
|
var ActionListLinkItem = React.forwardRef(function (_a, ref) {
|
|
5057
|
-
var
|
|
5068
|
+
var className = _a.className;
|
|
5058
5069
|
// ActionListLinkItem should not be able to be "selected"
|
|
5059
5070
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
5060
|
-
_a.selected; var props = tslib.__rest(_a, ["
|
|
5071
|
+
_a.selected; var props = tslib.__rest(_a, ["className", "selected"]);
|
|
5061
5072
|
var contextRole = useActionListContext().role;
|
|
5062
5073
|
var listItemRole = React.useMemo(function () {
|
|
5063
5074
|
if (contextRole === 'menu') {
|
|
@@ -5069,7 +5080,7 @@ var ActionListLinkItem = React.forwardRef(function (_a, ref) {
|
|
|
5069
5080
|
}
|
|
5070
5081
|
return undefined;
|
|
5071
5082
|
}, [contextRole]);
|
|
5072
|
-
return (React__default["default"].createElement(ActionListItem, tslib.__assign({
|
|
5083
|
+
return (React__default["default"].createElement(ActionListItem, tslib.__assign({ ref: ref, className: classNames__default["default"]('Link ActionListLinkItem', className), as: "a", role: listItemRole, tabIndex: listItemRole === 'menuitem' ? -1 : undefined }, props)));
|
|
5073
5084
|
});
|
|
5074
5085
|
ActionListLinkItem.displayName = 'ActionListLinkItem';
|
|
5075
5086
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deque/cauldron-react",
|
|
3
|
-
"version": "6.20.2-canary.
|
|
3
|
+
"version": "6.20.2-canary.993cc789",
|
|
4
4
|
"license": "MPL-2.0",
|
|
5
5
|
"description": "Fully accessible react components library for Deque Cauldron",
|
|
6
6
|
"homepage": "https://cauldron.dequelabs.com/",
|