@deque/cauldron-react 4.0.0-canary.debe968f → 4.1.0-canary.ab3e71e6

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.
@@ -2,6 +2,7 @@ import React, { InputHTMLAttributes, Ref } from 'react';
2
2
  export interface CheckboxProps extends InputHTMLAttributes<HTMLInputElement> {
3
3
  id: string;
4
4
  label: React.ReactNode;
5
+ labelDescription?: string;
5
6
  error?: React.ReactNode;
6
7
  customIcon?: React.ReactNode;
7
8
  checkboxRef?: Ref<HTMLInputElement>;
@@ -2,6 +2,6 @@
2
2
  * GENERATED CODE. DO NOT EDIT DIRECTLY!
3
3
  */
4
4
  /** IconType represents each valid icon type. */
5
- export declare 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' | 'close' | 'code' | 'copy' | 'download' | 'exchange' | 'external-link' | 'eye' | 'filter' | 'flag' | 'gears' | 'grid' | 'hamburger-menu' | 'highlight' | 'info-circle-alt' | 'info-circle' | 'info-square' | 'kabob' | 'list' | 'lock' | 'magnifying-glass' | 'menu' | 'new-releases' | 'new' | 'no' | 'pencil' | 'plus' | 'question-circle' | 'radio-checked' | 'radio-unchecked' | 'recycle' | 'robot' | 'run-again' | 'save' | 'share' | 'sort-triangle' | 'sort' | 'star' | 'sun' | 'tag' | 'target' | 'trash' | 'triangle-up' | 'triangle-down' | 'triangle-left' | 'triangle-right' | 'upload';
5
+ export declare 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' | 'close' | 'code' | 'copy' | 'download' | 'exchange' | 'external-link' | 'eye' | 'filter' | 'flag' | 'gears' | 'grid' | 'hamburger-menu' | 'highlight' | 'info-circle-alt' | 'info-circle' | 'info-square' | 'kabob' | 'list' | 'lock' | 'magnifying-glass' | 'menu' | 'new-releases' | 'new' | 'no' | 'pencil' | 'plus' | 'question-circle' | 'radio-checked' | 'radio-unchecked' | 'recycle' | 'resend' | 'robot' | 'run-again' | 'save' | 'share' | 'sort-triangle' | 'sort' | 'star' | 'sun' | 'tag' | 'target' | 'trash' | 'triangle-up' | 'triangle-down' | 'triangle-left' | 'triangle-right' | 'upload';
6
6
  /** iconTypes holds each valid icon type. */
7
7
  export declare const iconTypes: string[];
@@ -2,7 +2,7 @@ import { HTMLAttributes, ReactElement, ReactNode } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  interface PanelProps extends HTMLAttributes<HTMLElement> {
4
4
  children: ReactNode;
5
- heading: ReactElement<any> | {
5
+ heading?: ReactElement<any> | {
6
6
  id?: string;
7
7
  text: ReactElement<any>;
8
8
  level: number | undefined;
@@ -15,7 +15,7 @@ declare const Panel: {
15
15
  displayName: string;
16
16
  propTypes: {
17
17
  children: PropTypes.Validator<string | number | boolean | {} | PropTypes.ReactElementLike | PropTypes.ReactNodeArray>;
18
- heading: PropTypes.Validator<string | number | boolean | {} | PropTypes.ReactElementLike | PropTypes.ReactNodeArray>;
18
+ heading: PropTypes.Requireable<string | number | boolean | {} | PropTypes.ReactElementLike | PropTypes.ReactNodeArray>;
19
19
  className: PropTypes.Requireable<string>;
20
20
  };
21
21
  };
@@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
3
3
  export interface RadioItem extends React.InputHTMLAttributes<HTMLInputElement> {
4
4
  label: string;
5
5
  value?: string;
6
+ labelDescription?: string;
6
7
  }
7
8
  export interface RadioGroupProps {
8
9
  name?: string;
@@ -20,6 +21,7 @@ declare const RadioGroup: {
20
21
  value: PropTypes.Validator<string>;
21
22
  id: PropTypes.Validator<string>;
22
23
  label: PropTypes.Validator<string>;
24
+ labelDescription: PropTypes.Requireable<string>;
23
25
  }> | null | undefined)[]>;
24
26
  hasLabel: (props: {
25
27
  [key: string]: string;
package/lib/index.js CHANGED
@@ -173,6 +173,7 @@ var iconTypes = [
173
173
  'radio-checked',
174
174
  'radio-unchecked',
175
175
  'recycle',
176
+ 'resend',
176
177
  'robot',
177
178
  'run-again',
178
179
  'save',
@@ -237,6 +238,7 @@ function __variableDynamicImportRuntime0__(path) {
237
238
  case './icons/radio-checked.svg': return Promise.resolve().then(function () { return require('./radio-checked.js'); });
238
239
  case './icons/radio-unchecked.svg': return Promise.resolve().then(function () { return require('./radio-unchecked.js'); });
239
240
  case './icons/recycle.svg': return Promise.resolve().then(function () { return require('./recycle.js'); });
241
+ case './icons/resend.svg': return Promise.resolve().then(function () { return require('./resend.js'); });
240
242
  case './icons/robot.svg': return Promise.resolve().then(function () { return require('./robot.js'); });
241
243
  case './icons/run-again.svg': return Promise.resolve().then(function () { return require('./run-again.js'); });
242
244
  case './icons/save.svg': return Promise.resolve().then(function () { return require('./save.js'); });
@@ -2328,7 +2330,7 @@ var RadioGroup = function (_a) {
2328
2330
  setCurrentValue(value);
2329
2331
  }, [value]);
2330
2332
  var radioButtons = radios.map(function (radio, index) {
2331
- var label = radio.label, disabled = radio.disabled, radioValue = radio.value, id = radio.id, className = radio.className, other = tslib.__rest(radio, ["label", "disabled", "value", "id", "className"]);
2333
+ var label = radio.label, disabled = radio.disabled, radioValue = radio.value, labelDescription = radio.labelDescription, id = radio.id, className = radio.className, other = tslib.__rest(radio, ["label", "disabled", "value", "labelDescription", "id", "className"]);
2332
2334
  var isChecked = currentValue === radioValue;
2333
2335
  var isFocused = focusIndex === index;
2334
2336
  return (React__default.createElement("div", { className: classNames('Radio is--flex-row', className), key: id },
@@ -2341,14 +2343,17 @@ var RadioGroup = function (_a) {
2341
2343
  var _a;
2342
2344
  handleChange(radioValue);
2343
2345
  onChange(radio, (_a = inputs.current) === null || _a === void 0 ? void 0 : _a[index]);
2344
- }, disabled: disabled, checked: isChecked }, other)),
2346
+ }, disabled: disabled, checked: isChecked, "aria-describedby": labelDescription && id + "Desc" }, other)),
2345
2347
  React__default.createElement("label", { htmlFor: id, className: classNames('Field__label', {
2346
2348
  'Field__label--disabled': disabled
2347
2349
  }) }, label),
2348
2350
  React__default.createElement(Icon, { className: classNames('Radio__overlay', {
2349
2351
  'Radio__overlay--focused': isFocused,
2350
2352
  'Radio__overlay--disabled': disabled
2351
- }), type: isChecked ? 'radio-checked' : 'radio-unchecked', "aria-hidden": "true", onClick: function () { return onRadioClick(index); } })));
2353
+ }), type: isChecked ? 'radio-checked' : 'radio-unchecked', "aria-hidden": "true", onClick: function () { return onRadioClick(index); } }),
2354
+ labelDescription && (React__default.createElement("span", { id: id + "Desc", className: classNames('Field__labelDescription', {
2355
+ 'Field__labelDescription--disabled': disabled
2356
+ }) }, labelDescription))));
2352
2357
  });
2353
2358
  // reset the input refs array
2354
2359
  // refs get clobbered every re-render anyway and this supports "dynamic" radios
@@ -2361,7 +2366,8 @@ RadioGroup.propTypes = {
2361
2366
  radios: PropTypes.arrayOf(PropTypes.shape({
2362
2367
  value: PropTypes.string.isRequired,
2363
2368
  id: PropTypes.string.isRequired,
2364
- label: PropTypes.string.isRequired
2369
+ label: PropTypes.string.isRequired,
2370
+ labelDescription: PropTypes.string
2365
2371
  })).isRequired,
2366
2372
  hasLabel: function (props, propName, componentName) {
2367
2373
  if (!props['aria-label'] && !props['aria-labelledby']) {
@@ -2375,7 +2381,7 @@ RadioGroup.propTypes = {
2375
2381
  RadioGroup.displayName = 'RadioGroup';
2376
2382
 
2377
2383
  var Checkbox = React.forwardRef(function (_a, ref) {
2378
- var id = _a.id, label = _a.label, error = _a.error, checkboxRef = _a.checkboxRef, className = _a.className, onChange = _a.onChange, ariaDescribedby = _a["aria-describedby"], _b = _a.disabled, disabled = _b === void 0 ? false : _b, _c = _a.checked, checked = _c === void 0 ? false : _c, other = tslib.__rest(_a, ["id", "label", "error", "checkboxRef", "className", "onChange", 'aria-describedby', "disabled", "checked"]);
2384
+ var id = _a.id, label = _a.label, labelDescription = _a.labelDescription, error = _a.error, checkboxRef = _a.checkboxRef, className = _a.className, onChange = _a.onChange, ariaDescribedby = _a["aria-describedby"], _b = _a.disabled, disabled = _b === void 0 ? false : _b, _c = _a.checked, checked = _c === void 0 ? false : _c, other = tslib.__rest(_a, ["id", "label", "labelDescription", "error", "checkboxRef", "className", "onChange", 'aria-describedby', "disabled", "checked"]);
2379
2385
  var _d = tslib.__read(React.useState(checked), 2), isChecked = _d[0], setIsChecked = _d[1];
2380
2386
  var _e = tslib.__read(React.useState(false), 2), focused = _e[0], setFocused = _e[1];
2381
2387
  var checkRef = React.useRef(null);
@@ -2386,10 +2392,19 @@ var Checkbox = React.forwardRef(function (_a, ref) {
2386
2392
  if (typeof refProp === 'function') {
2387
2393
  refProp(checkRef.current);
2388
2394
  }
2389
- var errorId = React.useMemo(function () { return nextId__default(); }, []);
2390
- var ariaDescribedbyId = error
2391
- ? tokenList(errorId, ariaDescribedby)
2392
- : ariaDescribedby;
2395
+ var _f = React.useMemo(function () {
2396
+ return {
2397
+ labelDescriptionId: nextId__default(),
2398
+ errorId: nextId__default()
2399
+ };
2400
+ }, []), errorId = _f.errorId, labelDescriptionId = _f.labelDescriptionId;
2401
+ var ariaDescribedbyId = ariaDescribedby;
2402
+ if (error) {
2403
+ ariaDescribedbyId = tokenList(errorId, ariaDescribedbyId);
2404
+ }
2405
+ if (labelDescription) {
2406
+ ariaDescribedbyId = tokenList(labelDescriptionId, ariaDescribedbyId);
2407
+ }
2393
2408
  return (React__default.createElement(React__default.Fragment, null,
2394
2409
  React__default.createElement("div", { className: classNames('Checkbox is--flex-row', className) },
2395
2410
  React__default.createElement("input", tslib.__assign({ id: id, ref: typeof refProp === 'function' || !refProp ? checkRef : refProp, type: "checkbox", checked: isChecked, disabled: disabled, onFocus: function () { return setFocused(true); }, onBlur: function () { return setFocused(false); }, "aria-describedby": ariaDescribedbyId, onChange: function (e) {
@@ -2413,8 +2428,9 @@ var Checkbox = React.forwardRef(function (_a, ref) {
2413
2428
  else {
2414
2429
  (_b = checkRef.current) === null || _b === void 0 ? void 0 : _b.click();
2415
2430
  }
2416
- } })),
2417
- error && (React__default.createElement("div", { id: errorId, className: "Error" }, error))));
2431
+ } }),
2432
+ labelDescription && (React__default.createElement("span", { id: labelDescriptionId, className: "Field__labelDescription" }, labelDescription)),
2433
+ error && (React__default.createElement("div", { id: errorId, className: "Error" }, error)))));
2418
2434
  });
2419
2435
  Checkbox.displayName = 'Checkbox';
2420
2436
 
@@ -8297,22 +8313,32 @@ Stepper.propTypes = {
8297
8313
  var Panel = function (_a) {
8298
8314
  var _b;
8299
8315
  var children = _a.children, collapsed = _a.collapsed, className = _a.className, heading = _a.heading, other = tslib.__rest(_a, ["children", "collapsed", "className", "heading"]);
8300
- var Heading = "h" + (typeof heading === 'object' && 'level' in heading && !!heading.level
8301
- ? heading.level
8302
- : 2);
8303
- var headingId = typeof heading === 'object' && 'id' in heading ? heading.id : randomId();
8316
+ var headingId = !heading
8317
+ ? undefined
8318
+ : typeof heading === 'object' && 'id' in heading
8319
+ ? heading.id
8320
+ : randomId();
8321
+ var Heading = function () {
8322
+ if (!headingId) {
8323
+ return null;
8324
+ }
8325
+ var HeadingComponent = "h" + (typeof heading === 'object' && 'level' in heading && !!heading.level
8326
+ ? heading.level
8327
+ : 2);
8328
+ return (React__default.createElement(HeadingComponent, { id: headingId, className: "Panel__Heading" }, typeof heading === 'object' && 'text' in heading
8329
+ ? heading.text
8330
+ : heading));
8331
+ };
8304
8332
  return (React__default.createElement("section", tslib.__assign({ "aria-labelledby": headingId, className: classNames('Panel', className, (_b = {},
8305
8333
  _b['Panel--collapsed'] = collapsed,
8306
8334
  _b)) }, other),
8307
- React__default.createElement(Heading, { id: headingId, className: "Panel__Heading" }, typeof heading === 'object' && 'text' in heading
8308
- ? heading.text
8309
- : heading),
8335
+ React__default.createElement(Heading, null),
8310
8336
  children));
8311
8337
  };
8312
8338
  Panel.displayName = 'Panel';
8313
8339
  Panel.propTypes = {
8314
8340
  children: PropTypes.node.isRequired,
8315
- heading: PropTypes.oneOfType([PropTypes.object, PropTypes.node]).isRequired,
8341
+ heading: PropTypes.oneOfType([PropTypes.object, PropTypes.node]),
8316
8342
  className: PropTypes.string
8317
8343
  };
8318
8344
 
@@ -8386,7 +8412,7 @@ var Pagination = React__default.forwardRef(function (_a, ref) {
8386
8412
  React__default.createElement("span", { role: "log", "aria-atomic": "true" }, statusLabel || (React__default.createElement("span", null,
8387
8413
  "Showing ",
8388
8414
  React__default.createElement("strong", null, itemStart),
8389
- " of",
8415
+ " to",
8390
8416
  ' ',
8391
8417
  React__default.createElement("strong", null, itemEnd),
8392
8418
  " of ",
package/lib/resend.js ADDED
@@ -0,0 +1,24 @@
1
+ 'use strict';
2
+
3
+ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
4
+
5
+ var React = require('react');
6
+ var React__default = _interopDefault(React);
7
+
8
+ var _path;
9
+
10
+ function _extends() { _extends = Object.assign || 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); }
11
+
12
+ const SvgResend = props => /*#__PURE__*/React.createElement("svg", _extends({
13
+ overflow: "visible",
14
+ preserveAspectRatio: "none",
15
+ viewBox: "0 0 24 24",
16
+ height: 24,
17
+ width: 24
18
+ }, props), _path || (_path = /*#__PURE__*/React.createElement("path", {
19
+ d: "M5.19 10.13a.649.649 0 0 1-.02-.92c.01 0 .01-.01.02-.02l4.13-4.14v-.72a.616.616 0 0 0-.41-.61.612.612 0 0 0-.73.15L2.86 9.19c-.26.25-.27.66-.02.92l.02.02 5.33 5.33c.12.13.29.2.47.2.09 0 .18-.02.26-.05.26-.1.42-.35.4-.62v-.72l-4.13-4.14zm16.13 4.53c.14-1.93-.49-3.84-1.76-5.3-1.33-1.33-3.41-2.1-6.24-2.3V4.33a.616.616 0 0 0-.41-.61.598.598 0 0 0-.73.15L6.86 9.19c-.26.25-.27.66-.02.92l.02.02 5.33 5.33c.12.13.29.2.47.2.09 0 .18-.02.26-.05.26-.1.42-.35.4-.62v-2.61c.95.06 1.89.24 2.79.55.68.23 1.29.63 1.78 1.15 1.03 1.15 1.39 3.12 1.1 5.91-.02.16.08.31.24.35h.09c.12.01.24-.07.29-.18l.21-.42c.1-.19.24-.51.42-.94.18-.43.35-.87.5-1.3.16-.47.29-.95.4-1.44.11-.45.17-.92.18-1.4z",
20
+ fill: "currentColor",
21
+ vectorEffect: "non-scaling-stroke"
22
+ })));
23
+
24
+ exports.default = SvgResend;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deque/cauldron-react",
3
- "version": "4.0.0-canary.debe968f",
3
+ "version": "4.1.0-canary.ab3e71e6",
4
4
  "description": "Fully accessible react components library for Deque Cauldron",
5
5
  "publishConfig": {
6
6
  "access": "public"