@deque/cauldron-react 4.0.0-canary.14027583 → 4.0.0-canary.26257ad7

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[];
@@ -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
 
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.14027583",
3
+ "version": "4.0.0-canary.26257ad7",
4
4
  "description": "Fully accessible react components library for Deque Cauldron",
5
5
  "publishConfig": {
6
6
  "access": "public"