@deque/cauldron-react 6.20.2-canary.69d3e215 → 6.20.2-canary.82effd86
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 +29 -18
- 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
|
@@ -1781,7 +1781,9 @@ var AnchoredOverlay = React.forwardRef(function (_a, refProp) {
|
|
|
1781
1781
|
? reactDom$1.autoPlacement({
|
|
1782
1782
|
alignment: getAutoAlignment(initialPlacement)
|
|
1783
1783
|
})
|
|
1784
|
-
: reactDom$1.flip(
|
|
1784
|
+
: reactDom$1.flip({
|
|
1785
|
+
fallbackAxisSideDirection: 'start'
|
|
1786
|
+
}),
|
|
1785
1787
|
reactDom$1.shift({ crossAxis: false })
|
|
1786
1788
|
].filter(Boolean),
|
|
1787
1789
|
elements: {
|
|
@@ -4158,7 +4160,7 @@ var ComboboxNoResults = function (_a) {
|
|
|
4158
4160
|
return (React__default["default"].createElement("div", { className: "ComboboxListbox__empty", role: "alert", "aria-live": "polite" }, children || 'No results found.'));
|
|
4159
4161
|
};
|
|
4160
4162
|
var Combobox = React.forwardRef(function (_a, ref) {
|
|
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, 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"]);
|
|
4163
|
+
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"]);
|
|
4162
4164
|
var _h = tslib.__read(React.useState(new Map()), 2), matchingOptions = _h[0], setMatchingOptions = _h[1];
|
|
4163
4165
|
var _j = tslib.__read(React.useState(function () {
|
|
4164
4166
|
var value = defaultValue || propValue;
|
|
@@ -4502,9 +4504,15 @@ var Combobox = React.forwardRef(function (_a, ref) {
|
|
|
4502
4504
|
comboboxOptions,
|
|
4503
4505
|
noMatchingOptions));
|
|
4504
4506
|
var errorId = "".concat(id, "-error");
|
|
4505
|
-
var
|
|
4506
|
-
|
|
4507
|
-
|
|
4507
|
+
var descriptionId = "".concat(id, "-description");
|
|
4508
|
+
var describedby = ariaDescribedby;
|
|
4509
|
+
if (description) {
|
|
4510
|
+
describedby = addIdRef(describedby, descriptionId);
|
|
4511
|
+
}
|
|
4512
|
+
if (error) {
|
|
4513
|
+
describedby = addIdRef(describedby, errorId);
|
|
4514
|
+
}
|
|
4515
|
+
var inputProps = tslib.__assign(tslib.__assign({}, props), { 'aria-describedby': describedby });
|
|
4508
4516
|
return (React__default["default"].createElement("div", { id: id, className: classNames__default["default"]('Combobox', { 'Combobox--multiselect': multiselect }, className), ref: comboboxRef },
|
|
4509
4517
|
name &&
|
|
4510
4518
|
formValues.map(function (formValue, index) { return (React__default["default"].createElement("input", { type: "hidden", key: index, name: name, value: formValue })); }),
|
|
@@ -4514,6 +4522,10 @@ var Combobox = React.forwardRef(function (_a, ref) {
|
|
|
4514
4522
|
}), id: "".concat(id, "-label"), htmlFor: "".concat(id, "-input") },
|
|
4515
4523
|
React__default["default"].createElement("span", null, label),
|
|
4516
4524
|
isRequired && (React__default["default"].createElement("span", { className: "Field__required-text", "aria-hidden": "true" }, requiredText))),
|
|
4525
|
+
description && (React__default["default"].createElement("span", { className: "Field__description", id: descriptionId }, description)),
|
|
4526
|
+
hasError && (React__default["default"].createElement("div", { className: "Field__error", id: errorId },
|
|
4527
|
+
React__default["default"].createElement(Icon, { type: "caution" }),
|
|
4528
|
+
error)),
|
|
4517
4529
|
React__default["default"].createElement(TextFieldWrapper, { className: classNames__default["default"]({ 'TextFieldWrapper--error': hasError }),
|
|
4518
4530
|
// We're handling click here to open the listbox when the wrapping element is clicked,
|
|
4519
4531
|
// there's already keyboard handlers to open the listbox on the input element
|
|
@@ -4543,8 +4555,7 @@ var Combobox = React.forwardRef(function (_a, ref) {
|
|
|
4543
4555
|
: portal.current ||
|
|
4544
4556
|
// eslint-disable-next-line ssr-friendly/no-dom-globals-in-react-fc
|
|
4545
4557
|
/* istanbul ignore next: default fallback value */ document.body)
|
|
4546
|
-
: comboboxListbox)
|
|
4547
|
-
hasError && (React__default["default"].createElement("div", { className: "Error", id: errorId }, error))));
|
|
4558
|
+
: comboboxListbox)));
|
|
4548
4559
|
});
|
|
4549
4560
|
Combobox.displayName = 'Combobox';
|
|
4550
4561
|
|
|
@@ -4623,25 +4634,25 @@ var Popover = React.forwardRef(function (_a, ref) {
|
|
|
4623
4634
|
targetElement === null || targetElement === void 0 ? void 0 : targetElement.setAttribute('aria-haspopup', 'true');
|
|
4624
4635
|
}
|
|
4625
4636
|
}, [targetElement, id, show]);
|
|
4626
|
-
var
|
|
4637
|
+
var handleClosePopover = function () {
|
|
4638
|
+
isolator === null || isolator === void 0 ? void 0 : isolator.deactivate();
|
|
4639
|
+
if (show) {
|
|
4640
|
+
onClose();
|
|
4641
|
+
}
|
|
4642
|
+
};
|
|
4643
|
+
var handleClickOutside = React.useCallback(function (e) {
|
|
4627
4644
|
if (e.target === targetElement) {
|
|
4628
4645
|
return;
|
|
4629
4646
|
}
|
|
4630
4647
|
if (show) {
|
|
4631
4648
|
handleClosePopover();
|
|
4632
4649
|
}
|
|
4633
|
-
};
|
|
4650
|
+
}, [show, targetElement, handleClosePopover]);
|
|
4634
4651
|
var attachIsolator = function () {
|
|
4635
4652
|
if (popoverRef === null || popoverRef === void 0 ? void 0 : popoverRef.current) {
|
|
4636
4653
|
setIsolator(new AriaIsolate(popoverRef === null || popoverRef === void 0 ? void 0 : popoverRef.current));
|
|
4637
4654
|
}
|
|
4638
4655
|
};
|
|
4639
|
-
var handleClosePopover = function () {
|
|
4640
|
-
isolator === null || isolator === void 0 ? void 0 : isolator.deactivate();
|
|
4641
|
-
if (show) {
|
|
4642
|
-
onClose();
|
|
4643
|
-
}
|
|
4644
|
-
};
|
|
4645
4656
|
useEscapeKey({
|
|
4646
4657
|
callback: handleClosePopover,
|
|
4647
4658
|
active: show
|
|
@@ -5056,10 +5067,10 @@ var ActionListSeparator = React.forwardRef(function (_a, ref) {
|
|
|
5056
5067
|
ActionListSeparator.displayName = 'ActionListSeparator';
|
|
5057
5068
|
|
|
5058
5069
|
var ActionListLinkItem = React.forwardRef(function (_a, ref) {
|
|
5059
|
-
var
|
|
5070
|
+
var className = _a.className;
|
|
5060
5071
|
// ActionListLinkItem should not be able to be "selected"
|
|
5061
5072
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
5062
|
-
_a.selected; var props = tslib.__rest(_a, ["
|
|
5073
|
+
_a.selected; var props = tslib.__rest(_a, ["className", "selected"]);
|
|
5063
5074
|
var contextRole = useActionListContext().role;
|
|
5064
5075
|
var listItemRole = React.useMemo(function () {
|
|
5065
5076
|
if (contextRole === 'menu') {
|
|
@@ -5071,7 +5082,7 @@ var ActionListLinkItem = React.forwardRef(function (_a, ref) {
|
|
|
5071
5082
|
}
|
|
5072
5083
|
return undefined;
|
|
5073
5084
|
}, [contextRole]);
|
|
5074
|
-
return (React__default["default"].createElement(ActionListItem, tslib.__assign({
|
|
5085
|
+
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)));
|
|
5075
5086
|
});
|
|
5076
5087
|
ActionListLinkItem.displayName = 'ActionListLinkItem';
|
|
5077
5088
|
|
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.82effd86",
|
|
4
4
|
"license": "MPL-2.0",
|
|
5
5
|
"description": "Fully accessible react components library for Deque Cauldron",
|
|
6
6
|
"homepage": "https://cauldron.dequelabs.com/",
|