@deque/cauldron-react 6.20.2-canary.72846ff6 → 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.
@@ -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 inputProps = tslib.__assign(tslib.__assign({}, props), { 'aria-describedby': error
4506
- ? addIdRef(ariaDescribedby, errorId)
4507
- : ariaDescribedby });
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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deque/cauldron-react",
3
- "version": "6.20.2-canary.72846ff6",
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/",