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

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/cauldron.css CHANGED
@@ -34,7 +34,8 @@
34
34
  --expandcollapse-panel-color: var(--accent-light);
35
35
  }
36
36
 
37
- a.Button--primary {
37
+ a.Button--primary,
38
+ a.Button--secondary {
38
39
  text-decoration: none;
39
40
  padding: 9px 18px;
40
41
  }
@@ -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 React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  export interface LinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
4
4
  linkRef?: React.Ref<HTMLAnchorElement>;
5
- variant?: 'button';
5
+ variant?: 'button' | 'button-secondary';
6
6
  }
7
7
  declare const Link: {
8
8
  ({ children, linkRef, className, variant, ...other }: LinkProps): JSX.Element;
@@ -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;
@@ -1,8 +1,7 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- interface BaseStepProps {
3
+ interface BaseStepProps extends React.LiHTMLAttributes<HTMLLIElement> {
4
4
  status: 'current' | 'complete' | 'future';
5
- className?: string;
6
5
  }
7
6
  interface StepWithChildren extends BaseStepProps {
8
7
  children: React.ReactNode;
@@ -11,7 +11,7 @@ export interface TooltipProps extends React.HTMLAttributes<HTMLDivElement> {
11
11
  portal?: React.RefObject<HTMLElement> | HTMLElement;
12
12
  hideElementOnHidden?: boolean;
13
13
  }
14
- declare function Tooltip({ id: propId, placement: initialPlacement, children, portal, target, association, variant, show: showProp, hideElementOnHidden, className, ...props }: TooltipProps): React.ReactPortal | null;
14
+ declare function Tooltip({ id: propId, placement: initialPlacement, children, portal, target, association, variant, show: initialShow, hideElementOnHidden, className, ...props }: TooltipProps): React.ReactPortal | null;
15
15
  declare namespace Tooltip {
16
16
  var displayName: string;
17
17
  var propTypes: {
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'); });
@@ -1473,15 +1475,14 @@ var fireCustomEvent = function (show, button) {
1473
1475
  };
1474
1476
  function Tooltip(_a) {
1475
1477
  var _this = this;
1476
- var propId = _a.id, _b = _a.placement, initialPlacement = _b === void 0 ? 'auto' : _b, children = _a.children, portal = _a.portal, target = _a.target, _c = _a.association, association = _c === void 0 ? 'aria-describedby' : _c, _d = _a.variant, variant = _d === void 0 ? 'text' : _d, _e = _a.show, showProp = _e === void 0 ? false : _e, _f = _a.hideElementOnHidden, hideElementOnHidden = _f === void 0 ? false : _f, className = _a.className, props = tslib.__rest(_a, ["id", "placement", "children", "portal", "target", "association", "variant", "show", "hideElementOnHidden", "className"]);
1478
+ var propId = _a.id, _b = _a.placement, initialPlacement = _b === void 0 ? 'auto' : _b, children = _a.children, portal = _a.portal, target = _a.target, _c = _a.association, association = _c === void 0 ? 'aria-describedby' : _c, _d = _a.variant, variant = _d === void 0 ? 'text' : _d, _e = _a.show, initialShow = _e === void 0 ? false : _e, _f = _a.hideElementOnHidden, hideElementOnHidden = _f === void 0 ? false : _f, className = _a.className, props = tslib.__rest(_a, ["id", "placement", "children", "portal", "target", "association", "variant", "show", "hideElementOnHidden", "className"]);
1477
1479
  var _g = tslib.__read(propId ? [propId] : nextId.useId(1, 'tooltip'), 1), id = _g[0];
1478
- var hovering = React.useRef(false);
1479
- var _h = tslib.__read(React.useState(initialPlacement), 2), placement = _h[0], setPlacement = _h[1];
1480
- var _j = tslib.__read(React.useState(!!showProp), 2), showTooltip = _j[0], setShowTooltip = _j[1];
1481
- var _k = tslib.__read(React.useState(null), 2), targetElement = _k[0], setTargetElement = _k[1];
1482
- var _l = tslib.__read(React.useState(null), 2), tooltipElement = _l[0], setTooltipElement = _l[1];
1483
- var _m = tslib.__read(React.useState(null), 2), arrowElement = _m[0], setArrowElement = _m[1];
1484
- var _o = reactPopper.usePopper(targetElement, tooltipElement, {
1480
+ var hideTimeoutRef = React.useRef(null);
1481
+ var _h = tslib.__read(React.useState(!!initialShow), 2), showTooltip = _h[0], setShowTooltip = _h[1];
1482
+ var _j = tslib.__read(React.useState(null), 2), targetElement = _j[0], setTargetElement = _j[1];
1483
+ var _k = tslib.__read(React.useState(null), 2), tooltipElement = _k[0], setTooltipElement = _k[1];
1484
+ var _l = tslib.__read(React.useState(null), 2), arrowElement = _l[0], setArrowElement = _l[1];
1485
+ var _m = reactPopper.usePopper(targetElement, tooltipElement, {
1485
1486
  placement: initialPlacement,
1486
1487
  modifiers: [
1487
1488
  { name: 'preventOverflow', options: { padding: 8 } },
@@ -1489,11 +1490,17 @@ function Tooltip(_a) {
1489
1490
  { name: 'offset', options: { offset: [0, 8] } },
1490
1491
  { name: 'arrow', options: { padding: 5, element: arrowElement } }
1491
1492
  ]
1492
- }), styles = _o.styles, attributes = _o.attributes, update = _o.update;
1493
- var show = function () { return tslib.__awaiter(_this, void 0, void 0, function () {
1493
+ }), styles = _m.styles, attributes = _m.attributes, update = _m.update;
1494
+ // Show the tooltip
1495
+ var show = React.useCallback(function () { return tslib.__awaiter(_this, void 0, void 0, function () {
1494
1496
  return tslib.__generator(this, function (_a) {
1495
1497
  switch (_a.label) {
1496
1498
  case 0:
1499
+ // Clear the hide timeout if there was one pending
1500
+ if (hideTimeoutRef.current) {
1501
+ clearTimeout(hideTimeoutRef.current);
1502
+ hideTimeoutRef.current = null;
1503
+ }
1497
1504
  if (!update) return [3 /*break*/, 2];
1498
1505
  return [4 /*yield*/, update()];
1499
1506
  case 1:
@@ -1505,45 +1512,31 @@ function Tooltip(_a) {
1505
1512
  return [2 /*return*/];
1506
1513
  }
1507
1514
  });
1508
- }); };
1509
- var hide = function (_a) {
1510
- var target = _a.target;
1511
- if (document.activeElement !== target) {
1512
- setTimeout(function () {
1513
- if (!hovering.current) {
1514
- setShowTooltip(false);
1515
- fireCustomEvent(false, targetElement);
1516
- }
1515
+ }); }, [
1516
+ targetElement,
1517
+ // update starts off as null
1518
+ update
1519
+ ]);
1520
+ // Hide the tooltip
1521
+ var hide = React.useCallback(function () {
1522
+ if (!hideTimeoutRef.current) {
1523
+ hideTimeoutRef.current = setTimeout(function () {
1524
+ hideTimeoutRef.current = null;
1525
+ setShowTooltip(false);
1526
+ fireCustomEvent(false, targetElement);
1517
1527
  }, TIP_HIDE_DELAY);
1518
1528
  }
1519
- };
1520
- var handleTriggerMouseEnter = function () {
1521
- hovering.current = true;
1522
- show();
1523
- };
1524
- var handleTriggerMouseLeave = function (e) {
1525
- hovering.current = false;
1526
- hide(e);
1527
- };
1528
- var handleTipMouseEnter = function () {
1529
- hovering.current = true;
1530
- };
1531
- var handleTipMouseLeave = function (e) {
1532
- hovering.current = false;
1533
- hide(e);
1534
- };
1529
+ }, [targetElement]);
1530
+ // Keep targetElement in sync with target prop
1535
1531
  React.useEffect(function () {
1536
1532
  var targetElement = target && 'current' in target ? target.current : target;
1537
1533
  setTargetElement(targetElement);
1538
1534
  }, [target]);
1539
- var popperPlacement = (attributes.popper &&
1535
+ // Get popper placement
1536
+ var placement = (attributes.popper &&
1540
1537
  attributes.popper['data-popper-placement']) ||
1541
1538
  initialPlacement;
1542
- React.useEffect(function () {
1543
- if (popperPlacement) {
1544
- setPlacement(popperPlacement);
1545
- }
1546
- }, [popperPlacement]);
1539
+ // Only listen to key ups when the tooltip is visible
1547
1540
  React.useEffect(function () {
1548
1541
  var handleEscape = function (event) {
1549
1542
  if (event.key === 'Escape' ||
@@ -1562,31 +1555,30 @@ function Tooltip(_a) {
1562
1555
  return function () {
1563
1556
  targetElement.removeEventListener('keyup', handleEscape);
1564
1557
  };
1565
- }, [showProp]);
1558
+ }, [showTooltip]);
1559
+ // Handle hover and focus events for the targetElement
1566
1560
  React.useEffect(function () {
1567
- if (typeof showProp !== undefined) {
1568
- targetElement === null || targetElement === void 0 ? void 0 : targetElement.addEventListener('mouseenter', handleTriggerMouseEnter);
1569
- targetElement === null || targetElement === void 0 ? void 0 : targetElement.addEventListener('mouseleave', handleTriggerMouseLeave);
1570
- targetElement === null || targetElement === void 0 ? void 0 : targetElement.addEventListener('focusin', show);
1571
- targetElement === null || targetElement === void 0 ? void 0 : targetElement.addEventListener('focusout', hide);
1572
- }
1561
+ targetElement === null || targetElement === void 0 ? void 0 : targetElement.addEventListener('mouseenter', show);
1562
+ targetElement === null || targetElement === void 0 ? void 0 : targetElement.addEventListener('mouseleave', hide);
1563
+ targetElement === null || targetElement === void 0 ? void 0 : targetElement.addEventListener('focusin', show);
1564
+ targetElement === null || targetElement === void 0 ? void 0 : targetElement.addEventListener('focusout', hide);
1573
1565
  return function () {
1574
1566
  targetElement === null || targetElement === void 0 ? void 0 : targetElement.removeEventListener('mouseenter', show);
1575
1567
  targetElement === null || targetElement === void 0 ? void 0 : targetElement.removeEventListener('mouseleave', hide);
1576
1568
  targetElement === null || targetElement === void 0 ? void 0 : targetElement.removeEventListener('focusin', show);
1577
1569
  targetElement === null || targetElement === void 0 ? void 0 : targetElement.removeEventListener('focusout', hide);
1578
1570
  };
1579
- }, [targetElement, showProp]);
1571
+ }, [targetElement, show, hide]);
1572
+ // Handle hover events for the tooltipElement
1580
1573
  React.useEffect(function () {
1581
- if (tooltipElement) {
1582
- tooltipElement === null || tooltipElement === void 0 ? void 0 : tooltipElement.addEventListener('mouseenter', handleTipMouseEnter);
1583
- tooltipElement === null || tooltipElement === void 0 ? void 0 : tooltipElement.addEventListener('mouseleave', handleTipMouseLeave);
1584
- }
1574
+ tooltipElement === null || tooltipElement === void 0 ? void 0 : tooltipElement.addEventListener('mouseenter', show);
1575
+ tooltipElement === null || tooltipElement === void 0 ? void 0 : tooltipElement.addEventListener('mouseleave', hide);
1585
1576
  return function () {
1586
- tooltipElement === null || tooltipElement === void 0 ? void 0 : tooltipElement.removeEventListener('mouseenter', handleTipMouseEnter);
1587
- tooltipElement === null || tooltipElement === void 0 ? void 0 : tooltipElement.removeEventListener('mouseleave', handleTipMouseLeave);
1577
+ tooltipElement === null || tooltipElement === void 0 ? void 0 : tooltipElement.removeEventListener('mouseenter', show);
1578
+ tooltipElement === null || tooltipElement === void 0 ? void 0 : tooltipElement.removeEventListener('mouseleave', hide);
1588
1579
  };
1589
- }, [tooltipElement]);
1580
+ }, [tooltipElement, show, hide]);
1581
+ // Keep the target's id in sync
1590
1582
  React.useEffect(function () {
1591
1583
  var attrText = targetElement === null || targetElement === void 0 ? void 0 : targetElement.getAttribute(association);
1592
1584
  if (!(attrText === null || attrText === void 0 ? void 0 : attrText.includes(id || ''))) {
@@ -2194,7 +2186,8 @@ var Link = function (_a) {
2194
2186
  var children = _a.children, linkRef = _a.linkRef, className = _a.className, variant = _a.variant, other = tslib.__rest(_a, ["children", "linkRef", "className", "variant"]);
2195
2187
  return (React__default.createElement("a", tslib.__assign({ ref: linkRef, className: classNames(className, {
2196
2188
  Link: !variant,
2197
- 'Button--primary': variant === 'button'
2189
+ 'Button--primary': variant === 'button',
2190
+ 'Button--secondary': variant === 'button-secondary'
2198
2191
  }) }, other), children));
2199
2192
  };
2200
2193
  Link.propTypes = {
@@ -2328,7 +2321,7 @@ var RadioGroup = function (_a) {
2328
2321
  setCurrentValue(value);
2329
2322
  }, [value]);
2330
2323
  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"]);
2324
+ 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
2325
  var isChecked = currentValue === radioValue;
2333
2326
  var isFocused = focusIndex === index;
2334
2327
  return (React__default.createElement("div", { className: classNames('Radio is--flex-row', className), key: id },
@@ -2341,14 +2334,17 @@ var RadioGroup = function (_a) {
2341
2334
  var _a;
2342
2335
  handleChange(radioValue);
2343
2336
  onChange(radio, (_a = inputs.current) === null || _a === void 0 ? void 0 : _a[index]);
2344
- }, disabled: disabled, checked: isChecked }, other)),
2337
+ }, disabled: disabled, checked: isChecked, "aria-describedby": labelDescription && id + "Desc" }, other)),
2345
2338
  React__default.createElement("label", { htmlFor: id, className: classNames('Field__label', {
2346
2339
  'Field__label--disabled': disabled
2347
2340
  }) }, label),
2348
2341
  React__default.createElement(Icon, { className: classNames('Radio__overlay', {
2349
2342
  'Radio__overlay--focused': isFocused,
2350
2343
  'Radio__overlay--disabled': disabled
2351
- }), type: isChecked ? 'radio-checked' : 'radio-unchecked', "aria-hidden": "true", onClick: function () { return onRadioClick(index); } })));
2344
+ }), type: isChecked ? 'radio-checked' : 'radio-unchecked', "aria-hidden": "true", onClick: function () { return onRadioClick(index); } }),
2345
+ labelDescription && (React__default.createElement("span", { id: id + "Desc", className: classNames('Field__labelDescription', {
2346
+ 'Field__labelDescription--disabled': disabled
2347
+ }) }, labelDescription))));
2352
2348
  });
2353
2349
  // reset the input refs array
2354
2350
  // refs get clobbered every re-render anyway and this supports "dynamic" radios
@@ -2361,7 +2357,8 @@ RadioGroup.propTypes = {
2361
2357
  radios: PropTypes.arrayOf(PropTypes.shape({
2362
2358
  value: PropTypes.string.isRequired,
2363
2359
  id: PropTypes.string.isRequired,
2364
- label: PropTypes.string.isRequired
2360
+ label: PropTypes.string.isRequired,
2361
+ labelDescription: PropTypes.string
2365
2362
  })).isRequired,
2366
2363
  hasLabel: function (props, propName, componentName) {
2367
2364
  if (!props['aria-label'] && !props['aria-labelledby']) {
@@ -2375,7 +2372,7 @@ RadioGroup.propTypes = {
2375
2372
  RadioGroup.displayName = 'RadioGroup';
2376
2373
 
2377
2374
  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"]);
2375
+ 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
2376
  var _d = tslib.__read(React.useState(checked), 2), isChecked = _d[0], setIsChecked = _d[1];
2380
2377
  var _e = tslib.__read(React.useState(false), 2), focused = _e[0], setFocused = _e[1];
2381
2378
  var checkRef = React.useRef(null);
@@ -2386,10 +2383,19 @@ var Checkbox = React.forwardRef(function (_a, ref) {
2386
2383
  if (typeof refProp === 'function') {
2387
2384
  refProp(checkRef.current);
2388
2385
  }
2389
- var errorId = React.useMemo(function () { return nextId__default(); }, []);
2390
- var ariaDescribedbyId = error
2391
- ? tokenList(errorId, ariaDescribedby)
2392
- : ariaDescribedby;
2386
+ var _f = React.useMemo(function () {
2387
+ return {
2388
+ labelDescriptionId: nextId__default(),
2389
+ errorId: nextId__default()
2390
+ };
2391
+ }, []), errorId = _f.errorId, labelDescriptionId = _f.labelDescriptionId;
2392
+ var ariaDescribedbyId = ariaDescribedby;
2393
+ if (error) {
2394
+ ariaDescribedbyId = tokenList(errorId, ariaDescribedbyId);
2395
+ }
2396
+ if (labelDescription) {
2397
+ ariaDescribedbyId = tokenList(labelDescriptionId, ariaDescribedbyId);
2398
+ }
2393
2399
  return (React__default.createElement(React__default.Fragment, null,
2394
2400
  React__default.createElement("div", { className: classNames('Checkbox is--flex-row', className) },
2395
2401
  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 +2419,9 @@ var Checkbox = React.forwardRef(function (_a, ref) {
2413
2419
  else {
2414
2420
  (_b = checkRef.current) === null || _b === void 0 ? void 0 : _b.click();
2415
2421
  }
2416
- } })),
2417
- error && (React__default.createElement("div", { id: errorId, className: "Error" }, error))));
2422
+ } }),
2423
+ labelDescription && (React__default.createElement("span", { id: labelDescriptionId, className: "Field__labelDescription" }, labelDescription)),
2424
+ error && (React__default.createElement("div", { id: errorId, className: "Error" }, error)))));
2418
2425
  });
2419
2426
  Checkbox.displayName = 'Checkbox';
2420
2427
 
@@ -8259,23 +8266,34 @@ var DescriptionDetails = function (_a) {
8259
8266
  DescriptionDetails.displayName = 'DescriptionDetails';
8260
8267
  DescriptionDetails.propTypes = commonPropTypes;
8261
8268
 
8262
- var isTooltip = function (props) {
8269
+ var isTooltipProps = function (props) {
8263
8270
  return !!props.tooltip;
8264
8271
  };
8265
8272
  var Step = function (props) {
8266
- var status = props.status, className = props.className, other = tslib.__rest(props, ["status", "className"]);
8267
- return (React__default.createElement("li", tslib.__assign({ className: classNames('Stepper__step', "Stepper__step--" + status, className), "aria-current": status === 'current' ? 'step' : 'false' }, other),
8273
+ var _a;
8274
+ var children = props.children, status = props.status, className = props.className, other = tslib.__rest(props, ["children", "status", "className"]);
8275
+ var tooltip;
8276
+ var tooltipText;
8277
+ var liProps;
8278
+ var isTooltip = isTooltipProps(other);
8279
+ if (isTooltip) {
8280
+ (_a = other, (tooltip = _a.tooltip, tooltipText = _a.tooltipText, _a), liProps = tslib.__rest(_a, ["tooltip", "tooltipText"]));
8281
+ }
8282
+ else {
8283
+ liProps = other;
8284
+ }
8285
+ return (React__default.createElement("li", tslib.__assign({ className: classNames('Stepper__step', "Stepper__step--" + status, className), "aria-current": status === 'current' ? 'step' : 'false' }, liProps),
8268
8286
  React__default.createElement("div", { className: "Stepper__step-line" }),
8269
- React__default.createElement("div", { className: "Stepper__step-content" }, isTooltip(props) ? (React__default.createElement(TooltipTabstop, { placement: "bottom", tooltip: props.tooltip,
8287
+ React__default.createElement("div", { className: "Stepper__step-content" }, isTooltip ? (React__default.createElement(TooltipTabstop, { placement: "bottom", tooltip: tooltip,
8270
8288
  // the pseudo content (ex: "1") is conveyed
8271
8289
  // by the list item's position in the set of
8272
8290
  // list items, therefore it is safe to clobber
8273
8291
  // it with the contents of the tooltip in the
8274
8292
  // tab stop's accessible name.
8275
- association: "aria-labelledby", "aria-label": isTooltip(props) ? props.tooltipText : undefined },
8293
+ association: "aria-labelledby", "aria-label": tooltipText },
8276
8294
  React__default.createElement("div", { className: "Stepper__step-indicator" }))) : (React__default.createElement(React__default.Fragment, null,
8277
8295
  React__default.createElement("div", { className: "Stepper__step-indicator" }),
8278
- 'children' in props && (React__default.createElement("div", { className: "Stepper__step-label" }, props.children)))))));
8296
+ children ? (React__default.createElement("div", { className: "Stepper__step-label" }, children)) : null)))));
8279
8297
  };
8280
8298
  Step.displayName = 'Step';
8281
8299
  Step.propTypes = {
@@ -8297,22 +8315,32 @@ Stepper.propTypes = {
8297
8315
  var Panel = function (_a) {
8298
8316
  var _b;
8299
8317
  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();
8318
+ var headingId = !heading
8319
+ ? undefined
8320
+ : typeof heading === 'object' && 'id' in heading
8321
+ ? heading.id
8322
+ : randomId();
8323
+ var Heading = function () {
8324
+ if (!headingId) {
8325
+ return null;
8326
+ }
8327
+ var HeadingComponent = "h" + (typeof heading === 'object' && 'level' in heading && !!heading.level
8328
+ ? heading.level
8329
+ : 2);
8330
+ return (React__default.createElement(HeadingComponent, { id: headingId, className: "Panel__Heading" }, typeof heading === 'object' && 'text' in heading
8331
+ ? heading.text
8332
+ : heading));
8333
+ };
8304
8334
  return (React__default.createElement("section", tslib.__assign({ "aria-labelledby": headingId, className: classNames('Panel', className, (_b = {},
8305
8335
  _b['Panel--collapsed'] = collapsed,
8306
8336
  _b)) }, other),
8307
- React__default.createElement(Heading, { id: headingId, className: "Panel__Heading" }, typeof heading === 'object' && 'text' in heading
8308
- ? heading.text
8309
- : heading),
8337
+ React__default.createElement(Heading, null),
8310
8338
  children));
8311
8339
  };
8312
8340
  Panel.displayName = 'Panel';
8313
8341
  Panel.propTypes = {
8314
8342
  children: PropTypes.node.isRequired,
8315
- heading: PropTypes.oneOfType([PropTypes.object, PropTypes.node]).isRequired,
8343
+ heading: PropTypes.oneOfType([PropTypes.object, PropTypes.node]),
8316
8344
  className: PropTypes.string
8317
8345
  };
8318
8346
 
@@ -8386,7 +8414,7 @@ var Pagination = React__default.forwardRef(function (_a, ref) {
8386
8414
  React__default.createElement("span", { role: "log", "aria-atomic": "true" }, statusLabel || (React__default.createElement("span", null,
8387
8415
  "Showing ",
8388
8416
  React__default.createElement("strong", null, itemStart),
8389
- " of",
8417
+ " to",
8390
8418
  ' ',
8391
8419
  React__default.createElement("strong", null, itemEnd),
8392
8420
  " 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.3eec0660",
4
4
  "description": "Fully accessible react components library for Deque Cauldron",
5
5
  "publishConfig": {
6
6
  "access": "public"