@deque/cauldron-react 5.11.0 → 5.12.0-canary.a304da9a

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.
@@ -26,6 +26,7 @@ interface ComboboxProps extends React.InputHTMLAttributes<Omit<HTMLInputElement,
26
26
  onActiveChange?: (option: ListboxOption) => void;
27
27
  renderNoResults?: (() => JSX.Element) | React.ReactElement;
28
28
  portal?: React.RefObject<HTMLElement> | HTMLElement;
29
+ inputRef?: React.Ref<HTMLInputElement>;
29
30
  }
30
31
  declare const Combobox: React.ForwardRefExoticComponent<ComboboxProps & React.RefAttributes<HTMLInputElement>>;
31
32
  export default Combobox;
@@ -38,6 +38,7 @@ export default class Dialog extends React.Component<DialogProps, DialogState> {
38
38
  };
39
39
  private element;
40
40
  private heading;
41
+ private headingId;
41
42
  constructor(props: DialogProps);
42
43
  componentDidMount(): void;
43
44
  componentWillUnmount(): void;
@@ -2,6 +2,6 @@
2
2
  * GENERATED CODE. DO NOT EDIT DIRECTLY!
3
3
  */
4
4
  /** IconType represents each valid icon type. */
5
- export type IconType = 'add-user' | 'arrow-circle-up' | 'arrow-circle-down' | 'arrow-circle-left' | 'arrow-circle-right' | 'arrow-up' | 'arrow-down' | 'arrow-left' | 'arrow-right' | 'arrows-alt' | 'bolt' | 'caution' | 'check-circle' | 'check-shield' | 'check-solid' | 'check' | 'checkbox-checked' | 'checkbox-unchecked' | 'chevron-double-up' | 'chevron-double-down' | 'chevron-double-left' | 'chevron-double-right' | 'chevron-up' | 'chevron-down' | 'chevron-left' | 'chevron-right' | 'clipboard' | 'clock' | 'close' | 'code' | 'copy' | 'download' | 'dropper' | 'exchange' | 'export-solid' | 'external-link' | 'eye' | 'filter-solid' | 'filter' | 'flag' | 'gears' | 'github' | 'grid' | 'hamburger-menu' | 'hashtag' | 'highlight' | 'info-circle-alt' | 'info-circle' | 'info-square' | 'kabob' | 'link' | 'linkedin' | 'list' | 'lock' | 'magnifying-glass' | 'menu' | 'minus' | 'new-releases' | 'new' | 'no' | 'pencil' | 'person-running' | 'play' | 'plus' | 'question-circle-alt' | 'question-circle' | 'radio-checked' | 'radio-unchecked' | 'recycle-square' | 'recycle' | 'resend' | 'robot' | 'run-again' | 'save' | 'share-nodes' | 'share' | 'sort-triangle' | 'sort' | 'star' | 'sun' | 'table-sort-ascending' | 'table-sort-descending' | 'tag' | 'target' | 'trash' | 'triangle-up' | 'triangle-down' | 'triangle-left' | 'triangle-right' | 'twitter' | 'upload';
5
+ export type IconType = 'add-user' | 'arrow-circle-up' | 'arrow-circle-down' | 'arrow-circle-left' | 'arrow-circle-right' | 'arrow-up' | 'arrow-down' | 'arrow-left' | 'arrow-right' | 'arrows-alt' | 'bolt' | 'caution' | 'check-circle' | 'check-shield' | 'check-solid' | 'check' | 'checkbox-checked' | 'checkbox-unchecked' | 'chevron-double-up' | 'chevron-double-down' | 'chevron-double-left' | 'chevron-double-right' | 'chevron-up' | 'chevron-down' | 'chevron-left' | 'chevron-right' | 'clipboard' | 'clock' | 'close' | 'code' | 'copy' | 'download' | 'dropper' | 'exchange' | 'export-solid' | 'external-link' | 'eye' | 'filter-solid' | 'filter' | 'flag' | 'gears' | 'github' | 'grid' | 'hamburger-menu' | 'hashtag' | 'highlight' | 'info-circle-alt' | 'info-circle' | 'info-square' | 'kabob' | 'link' | 'linkedin' | 'list' | 'lock' | 'magnifying-glass' | 'menu' | 'minus' | 'new-releases' | 'new' | 'no' | 'pencil' | 'person-running' | 'play' | 'plus' | 'question-circle-alt' | 'question-circle' | 'radio-checked' | 'radio-unchecked' | 'recycle-square' | 'recycle' | 'resend' | 'robot' | 'run-again' | 'save' | 'share-nodes' | 'share' | 'sort-triangle' | 'sort' | 'star' | 'step-back' | 'step-forward' | 'sun' | 'table-sort-ascending' | 'table-sort-descending' | 'tag' | 'target' | 'trash' | 'triangle-up' | 'triangle-down' | 'triangle-left' | 'triangle-right' | 'twitter' | 'upload';
6
6
  /** iconTypes holds each valid icon type. */
7
7
  export declare const iconTypes: string[];
package/lib/index.js CHANGED
@@ -216,6 +216,8 @@ var iconTypes = [
216
216
  'sort-triangle',
217
217
  'sort',
218
218
  'star',
219
+ 'step-back',
220
+ 'step-forward',
219
221
  'sun',
220
222
  'table-sort-ascending',
221
223
  'table-sort-descending',
@@ -299,6 +301,8 @@ function __variableDynamicImportRuntime0__(path) {
299
301
  case './icons/sort-triangle.svg': return Promise.resolve().then(function () { return require('./sort-triangle.js'); });
300
302
  case './icons/sort.svg': return Promise.resolve().then(function () { return require('./sort.js'); });
301
303
  case './icons/star.svg': return Promise.resolve().then(function () { return require('./star.js'); });
304
+ case './icons/step-back.svg': return Promise.resolve().then(function () { return require('./step-back.js'); });
305
+ case './icons/step-forward.svg': return Promise.resolve().then(function () { return require('./step-forward.js'); });
302
306
  case './icons/sun.svg': return Promise.resolve().then(function () { return require('./sun.js'); });
303
307
  case './icons/table-sort-ascending.svg': return Promise.resolve().then(function () { return require('./table-sort-ascending.js'); });
304
308
  case './icons/table-sort-descending.svg': return Promise.resolve().then(function () { return require('./table-sort-descending.js'); });
@@ -1557,6 +1561,7 @@ var Dialog = /** @class */ (function (_super) {
1557
1561
  tslib.__extends(Dialog, _super);
1558
1562
  function Dialog(props) {
1559
1563
  var _this = _super.call(this, props) || this;
1564
+ _this.headingId = nextId__default["default"]('dialog-title-');
1560
1565
  _this.close = _this.close.bind(_this);
1561
1566
  _this.focusHeading = _this.focusHeading.bind(_this);
1562
1567
  _this.handleClickOutside = _this.handleClickOutside.bind(_this);
@@ -1613,10 +1618,10 @@ var Dialog = /** @class */ (function (_super) {
1613
1618
  return;
1614
1619
  }
1615
1620
  setRef(dialogRef, el);
1616
- } }, other),
1621
+ }, "aria-labelledby": this.headingId }, other),
1617
1622
  React__default["default"].createElement("div", { className: "Dialog__inner" },
1618
1623
  React__default["default"].createElement("div", { className: "Dialog__header" },
1619
- React__default["default"].createElement(Heading, { className: "Dialog__heading", ref: function (el) { return (_this.heading = el); }, tabIndex: -1 }, typeof heading === 'object' && 'text' in heading
1624
+ React__default["default"].createElement(Heading, { className: "Dialog__heading", ref: function (el) { return (_this.heading = el); }, tabIndex: -1, id: this.headingId }, typeof heading === 'object' && 'text' in heading
1620
1625
  ? heading.text
1621
1626
  : heading),
1622
1627
  close),
@@ -4378,16 +4383,16 @@ var ComboboxNoResults = function (_a) {
4378
4383
  return (React__default["default"].createElement("div", { className: "ComboboxListbox__empty", role: "alert", "aria-live": "polite" }, children || 'No results found.'));
4379
4384
  };
4380
4385
  var Combobox = React.forwardRef(function (_a, ref) {
4381
- 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, _c = _a.requiredText, requiredText = _c === void 0 ? 'Required' : _c, error = _a.error, _d = _a.autocomplete, autocomplete = _d === void 0 ? 'manual' : _d, 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, props = tslib.__rest(_a, ["id", "className", "label", "children", "options", "value", "defaultValue", "requiredText", "error", "autocomplete", "onSelectionChange", "onActiveChange", "onChange", "onKeyDown", "onFocus", "onBlur", "name", "renderNoResults", "portal"]);
4382
- var _e = tslib.__read(React.useState(defaultValue || propValue || ''), 2), value = _e[0], setValue = _e[1];
4383
- var _f = tslib.__read(React.useState(new Map()), 2), matchingOptions = _f[0], setMatchingOptions = _f[1];
4384
- var _g = tslib.__read(React.useState(value || ''), 2), selectedValue = _g[0], setSelectedValue = _g[1];
4385
- var _h = tslib.__read(React.useState(''), 2), formValue = _h[0], setFormValue = _h[1];
4386
- var _j = tslib.__read(React.useState(false), 2), open = _j[0], setOpen = _j[1];
4387
- var _k = tslib.__read(React.useState(null), 2), activeDescendant = _k[0], setActiveDescendant = _k[1];
4388
- var _l = tslib.__read(propId ? [propId] : nextId.useId(1, 'combobox'), 1), id = _l[0];
4386
+ 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, _c = _a.requiredText, requiredText = _c === void 0 ? 'Required' : _c, error = _a.error, _d = _a.autocomplete, autocomplete = _d === void 0 ? 'manual' : _d, 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, _e = _a.inputRef, propInputRef = _e === void 0 ? null : _e, ariaDescribedby = _a["aria-describedby"], props = tslib.__rest(_a, ["id", "className", "label", "children", "options", "value", "defaultValue", "requiredText", "error", "autocomplete", "onSelectionChange", "onActiveChange", "onChange", "onKeyDown", "onFocus", "onBlur", "name", "renderNoResults", "portal", "inputRef", 'aria-describedby']);
4387
+ var _f = tslib.__read(React.useState(defaultValue || propValue || ''), 2), value = _f[0], setValue = _f[1];
4388
+ var _g = tslib.__read(React.useState(new Map()), 2), matchingOptions = _g[0], setMatchingOptions = _g[1];
4389
+ var _h = tslib.__read(React.useState(value || ''), 2), selectedValue = _h[0], setSelectedValue = _h[1];
4390
+ var _j = tslib.__read(React.useState(''), 2), formValue = _j[0], setFormValue = _j[1];
4391
+ var _k = tslib.__read(React.useState(false), 2), open = _k[0], setOpen = _k[1];
4392
+ var _l = tslib.__read(React.useState(null), 2), activeDescendant = _l[0], setActiveDescendant = _l[1];
4393
+ var _m = tslib.__read(propId ? [propId] : nextId.useId(1, 'combobox'), 1), id = _m[0];
4389
4394
  var comboboxRef = useSharedRef(ref);
4390
- var inputRef = React.useRef(null);
4395
+ var inputRef = useSharedRef(propInputRef);
4391
4396
  var listboxRef = React.useRef(null);
4392
4397
  var isControlled = typeof propValue !== 'undefined';
4393
4398
  var isRequired = !!props.required;
@@ -4558,6 +4563,10 @@ var Combobox = React.forwardRef(function (_a, ref) {
4558
4563
  }), role: "listbox", "aria-labelledby": "".concat(id, "-label"), id: "".concat(id, "-listbox"), value: selectedValue, onMouseDown: handleComboboxOptionMouseDown, onClick: handleComboboxOptionClick, onSelectionChange: handleSelectionChange, onActiveChange: handleActiveChange, ref: listboxRef, tabIndex: undefined, "aria-activedescendant": undefined },
4559
4564
  comboboxOptions,
4560
4565
  noMatchingOptions));
4566
+ var errorId = "".concat(id, "-error");
4567
+ var inputProps = tslib.__assign(tslib.__assign({}, props), { 'aria-describedby': error
4568
+ ? tokenList(errorId, ariaDescribedby)
4569
+ : ariaDescribedby });
4561
4570
  return (React__default["default"].createElement("div", { id: id, className: classNames__default["default"]('Combobox', className), ref: comboboxRef },
4562
4571
  name && React__default["default"].createElement("input", { type: "hidden", name: name, value: formValue }),
4563
4572
  React__default["default"].createElement("label", { className: classNames__default["default"]('Field__label', {
@@ -4572,7 +4581,7 @@ var Combobox = React.forwardRef(function (_a, ref) {
4572
4581
  // We're handling click here to open the listbox when the wrapping element is clicked,
4573
4582
  // there's already keyboard handlers to open the listbox on the input element
4574
4583
  onClick: handleInputClick },
4575
- React__default["default"].createElement("input", tslib.__assign({ type: "text", id: "".concat(id, "-input"), ref: inputRef, value: value, role: "combobox", "aria-autocomplete": !isAutoComplete ? 'none' : 'list', "aria-controls": "".concat(id, "-listbox"), "aria-expanded": open, "aria-haspopup": "listbox", "aria-activedescendant": open && activeDescendant ? activeDescendant.element.id : undefined }, props, { onChange: handleChange, onKeyDown: handleKeyDown, onFocus: handleFocus, onBlur: handleBlur })),
4584
+ React__default["default"].createElement("input", tslib.__assign({ type: "text", id: "".concat(id, "-input"), ref: inputRef, value: value, role: "combobox", "aria-autocomplete": !isAutoComplete ? 'none' : 'list', "aria-controls": "".concat(id, "-listbox"), "aria-expanded": open, "aria-haspopup": "listbox", "aria-activedescendant": open && activeDescendant ? activeDescendant.element.id : undefined }, inputProps, { onChange: handleChange, onKeyDown: handleKeyDown, onFocus: handleFocus, onBlur: handleBlur })),
4576
4585
  React__default["default"].createElement("span", { className: "Combobox__arrow" })),
4577
4586
  React__default["default"].createElement(ComboboxProvider, { autocomplete: autocomplete, inputValue: value, formValue: formValue, selectedValue: selectedValue, matches: !isAutoComplete || defaultAutoCompleteMatches, matchingOptions: matchingOptions, setMatchingOptions: setMatchingOptions, setFormValue: setFormValue }, portal
4578
4587
  ? reactDom.createPortal(comboboxListbox, portal instanceof HTMLElement
@@ -4580,7 +4589,7 @@ var Combobox = React.forwardRef(function (_a, ref) {
4580
4589
  : portal.current ||
4581
4590
  /* istanbul ignore next: default fallback value */ document.body)
4582
4591
  : comboboxListbox),
4583
- hasError && (React__default["default"].createElement("div", { className: "Error", id: "".concat(id, "-error") }, error))));
4592
+ hasError && (React__default["default"].createElement("div", { className: "Error", id: errorId }, error))));
4584
4593
  });
4585
4594
  Combobox.displayName = 'Combobox';
4586
4595
 
@@ -4628,7 +4637,9 @@ var Popover = React.forwardRef(function (_a, ref) {
4628
4637
  var placement = (attributes.popper &&
4629
4638
  attributes.popper['data-popper-placement']) ||
4630
4639
  initialPlacement;
4631
- var additionalProps = variant === 'prompt' ? { 'aria-labelledby': "".concat(id, "-label") } : {};
4640
+ var additionalProps = variant === 'prompt' && !props['aria-label']
4641
+ ? { 'aria-labelledby': "".concat(id, "-label") }
4642
+ : {};
4632
4643
  // Keep targetElement in sync with target prop
4633
4644
  React.useEffect(function () {
4634
4645
  var targetElement = target && 'current' in target ? target.current : target;
@@ -4720,7 +4731,7 @@ var Popover = React.forwardRef(function (_a, ref) {
4720
4731
  React__default["default"].createElement("div", tslib.__assign({ id: id, className: classNames__default["default"]('Popover', "Popover--".concat(placement), className, {
4721
4732
  'Popover--hidden': !show,
4722
4733
  'Popover--prompt': variant === 'prompt'
4723
- }), ref: popoverRef, role: "dialog", style: styles.popper }, attributes.popper, props, additionalProps),
4734
+ }), ref: popoverRef, role: "dialog", style: styles.popper }, attributes.popper, additionalProps, props),
4724
4735
  React__default["default"].createElement("div", { className: "Popover__popoverArrow", ref: setArrowElement, style: styles.arrow }),
4725
4736
  React__default["default"].createElement("div", { className: "Popover__borderLeft" }),
4726
4737
  variant === 'prompt' ? (React__default["default"].createElement(PromptPopoverContent, { applyButtonText: applyButtonText, onApply: onApply, closeButtonText: closeButtonText, infoText: infoText || '', onClose: handleClosePopover, infoTextId: "".concat(id, "-label") })) : (children)))), (portal && 'current' in portal ? portal.current : portal) || document.body);
@@ -0,0 +1,45 @@
1
+ 'use strict';
2
+
3
+ var React = require('react');
4
+
5
+ function _interopNamespace(e) {
6
+ if (e && e.__esModule) return e;
7
+ var n = Object.create(null);
8
+ if (e) {
9
+ Object.keys(e).forEach(function (k) {
10
+ if (k !== 'default') {
11
+ var d = Object.getOwnPropertyDescriptor(e, k);
12
+ Object.defineProperty(n, k, d.get ? d : {
13
+ enumerable: true,
14
+ get: function () { return e[k]; }
15
+ });
16
+ }
17
+ });
18
+ }
19
+ n["default"] = e;
20
+ return Object.freeze(n);
21
+ }
22
+
23
+ var React__namespace = /*#__PURE__*/_interopNamespace(React);
24
+
25
+ var _path;
26
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
27
+ const SvgStepBack = props => /*#__PURE__*/React__namespace.createElement("svg", _extends({
28
+ xmlns: "http://www.w3.org/2000/svg",
29
+ overflow: "visible",
30
+ preserveAspectRatio: "none",
31
+ viewBox: "0 0 26 26",
32
+ style: {
33
+ transform: "scaleX(-1) rotate(90deg)"
34
+ },
35
+ height: 24,
36
+ width: 24
37
+ }, props), _path || (_path = /*#__PURE__*/React__namespace.createElement("path", {
38
+ fillRule: "evenodd",
39
+ clipRule: "evenodd",
40
+ d: "M18 3h-6l6 6H7a7 7 0 1 0 0 14v-4a3 3 0 1 1 0-6h11l-6 6h6l8-8-8-8z",
41
+ fill: "currentColor",
42
+ vectorEffect: "non-scaling-stroke"
43
+ })));
44
+
45
+ exports["default"] = SvgStepBack;
@@ -0,0 +1,45 @@
1
+ 'use strict';
2
+
3
+ var React = require('react');
4
+
5
+ function _interopNamespace(e) {
6
+ if (e && e.__esModule) return e;
7
+ var n = Object.create(null);
8
+ if (e) {
9
+ Object.keys(e).forEach(function (k) {
10
+ if (k !== 'default') {
11
+ var d = Object.getOwnPropertyDescriptor(e, k);
12
+ Object.defineProperty(n, k, d.get ? d : {
13
+ enumerable: true,
14
+ get: function () { return e[k]; }
15
+ });
16
+ }
17
+ });
18
+ }
19
+ n["default"] = e;
20
+ return Object.freeze(n);
21
+ }
22
+
23
+ var React__namespace = /*#__PURE__*/_interopNamespace(React);
24
+
25
+ var _path;
26
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
27
+ const SvgStepForward = props => /*#__PURE__*/React__namespace.createElement("svg", _extends({
28
+ xmlns: "http://www.w3.org/2000/svg",
29
+ overflow: "visible",
30
+ preserveAspectRatio: "none",
31
+ viewBox: "0 0 26 26",
32
+ style: {
33
+ transform: "rotate(90deg)"
34
+ },
35
+ height: 24,
36
+ width: 24
37
+ }, props), _path || (_path = /*#__PURE__*/React__namespace.createElement("path", {
38
+ fillRule: "evenodd",
39
+ clipRule: "evenodd",
40
+ d: "M18 3h-6l6 6H7a7 7 0 1 0 0 14v-4a3 3 0 1 1 0-6h11l-6 6h6l8-8-8-8z",
41
+ fill: "currentColor",
42
+ vectorEffect: "non-scaling-stroke"
43
+ })));
44
+
45
+ exports["default"] = SvgStepForward;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deque/cauldron-react",
3
- "version": "5.11.0",
3
+ "version": "5.12.0-canary.a304da9a",
4
4
  "license": "MPL-2.0",
5
5
  "description": "Fully accessible react components library for Deque Cauldron",
6
6
  "homepage": "https://cauldron.dequelabs.com/",
@@ -57,7 +57,7 @@
57
57
  "enzyme": "^3.11.0",
58
58
  "enzyme-adapter-react-16": "^1.15.2",
59
59
  "jest": "^24.7.1",
60
- "jest-axe": "^3.4.0",
60
+ "jest-axe": "^8.0.0",
61
61
  "nyc": "^15.0.1",
62
62
  "postcss-cli": "^7.1.1",
63
63
  "postcss-import": "^12.0.1",