@deque/cauldron-react 4.3.0-canary.e2302853 → 4.4.0

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,7 +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
+ labelDescription?: React.ReactNode;
6
6
  error?: React.ReactNode;
7
7
  customIcon?: React.ReactNode;
8
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' | 'minus' | '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';
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' | 'dropper' | 'exchange' | 'external-link' | 'eye' | 'filter' | 'flag' | 'gears' | 'grid' | 'hamburger-menu' | 'highlight' | 'info-circle-alt' | 'info-circle' | 'info-square' | 'kabob' | 'list' | 'lock' | 'magnifying-glass' | 'menu' | 'minus' | '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[];
@@ -1,9 +1,16 @@
1
+ /**
2
+ * Unfortunately, eslint does not recognize the Polymorphic component has propTypes set
3
+ *
4
+ * We might be able to remove this if we upgrade eslint and associated plugins
5
+ * See: https://github.com/dequelabs/cauldron/issues/451
6
+ */
7
+ import React from 'react';
1
8
  import * as Polymorphic from '../../utils/polymorphic-type';
2
9
  import { IconType } from '../Icon';
3
10
  import { TooltipProps } from '../Tooltip';
4
11
  export interface IconButtonOwnProps {
5
12
  icon: IconType;
6
- label: string;
13
+ label: React.ReactNode;
7
14
  tooltipPlacement?: TooltipProps['placement'];
8
15
  tooltipVariant?: TooltipProps['variant'];
9
16
  tooltipPortal?: TooltipProps['portal'];
@@ -4,6 +4,7 @@ interface LoaderOverlayProps extends React.HTMLAttributes<HTMLDivElement> {
4
4
  label?: string;
5
5
  focusOnInitialRender?: boolean;
6
6
  children?: React.ReactNode;
7
+ focusTrap?: boolean;
7
8
  }
8
9
  declare const LoaderOverlay: React.ForwardRefExoticComponent<LoaderOverlayProps & React.RefAttributes<HTMLDivElement>>;
9
10
  export default LoaderOverlay;
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  export interface RadioItem extends React.InputHTMLAttributes<HTMLInputElement> {
4
- label: string;
4
+ label: React.ReactNode;
5
5
  value?: string;
6
- labelDescription?: string;
6
+ labelDescription?: React.ReactNode;
7
7
  }
8
8
  export interface RadioGroupProps {
9
9
  name?: string;
@@ -1,11 +1,7 @@
1
- import React from 'react';
1
+ import { TableHTMLAttributes } from 'react';
2
2
  import PropTypes from 'prop-types';
3
- interface TableProps {
4
- children: React.ReactNode;
5
- className?: string;
6
- }
7
3
  declare const Table: {
8
- ({ children, className, ...other }: TableProps): JSX.Element;
4
+ ({ children, className, ...other }: TableHTMLAttributes<HTMLTableElement>): JSX.Element;
9
5
  displayName: string;
10
6
  propTypes: {
11
7
  children: PropTypes.Validator<string | number | boolean | {} | PropTypes.ReactElementLike | PropTypes.ReactNodeArray>;
@@ -1,11 +1,7 @@
1
- import React from 'react';
1
+ import { HTMLAttributes } from 'react';
2
2
  import PropTypes from 'prop-types';
3
- interface TableBodyProps {
4
- children: React.ReactNode;
5
- className?: string;
6
- }
7
3
  declare const TableBody: {
8
- ({ children, className, ...other }: TableBodyProps): JSX.Element;
4
+ ({ children, className, ...other }: HTMLAttributes<HTMLTableSectionElement>): JSX.Element;
9
5
  displayName: string;
10
6
  propTypes: {
11
7
  children: PropTypes.Validator<string | number | boolean | {} | PropTypes.ReactElementLike | PropTypes.ReactNodeArray>;
@@ -1,11 +1,7 @@
1
- import React, { TdHTMLAttributes } from 'react';
1
+ import { TdHTMLAttributes } from 'react';
2
2
  import PropTypes from 'prop-types';
3
- interface TableCellProps extends TdHTMLAttributes<HTMLTableCellElement> {
4
- children: React.ReactNode;
5
- className?: string;
6
- }
7
3
  declare const TableCell: {
8
- ({ children, className, ...other }: TableCellProps): JSX.Element;
4
+ ({ children, className, ...other }: TdHTMLAttributes<HTMLTableCellElement>): JSX.Element;
9
5
  displayName: string;
10
6
  propTypes: {
11
7
  children: PropTypes.Validator<string | number | boolean | {} | PropTypes.ReactElementLike | PropTypes.ReactNodeArray>;
@@ -1,11 +1,7 @@
1
- import React from 'react';
1
+ import { HTMLAttributes } from 'react';
2
2
  import PropTypes from 'prop-types';
3
- interface TableHeadProps {
4
- children: React.ReactNode;
5
- className?: string;
6
- }
7
3
  declare const TableHead: {
8
- ({ children, className, ...other }: TableHeadProps): JSX.Element;
4
+ ({ children, className, ...other }: HTMLAttributes<HTMLTableSectionElement>): JSX.Element;
9
5
  displayName: string;
10
6
  propTypes: {
11
7
  children: PropTypes.Validator<string | number | boolean | {} | PropTypes.ReactElementLike | PropTypes.ReactNodeArray>;
@@ -1,11 +1,9 @@
1
- import React, { ThHTMLAttributes } from 'react';
1
+ import { ThHTMLAttributes } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  declare type SortDirection = 'ascending' | 'descending' | 'none';
4
4
  interface TableHeaderProps extends ThHTMLAttributes<HTMLTableCellElement> {
5
- children: React.ReactNode;
6
5
  sortDirection?: SortDirection;
7
6
  onSort?: () => void;
8
- className?: string;
9
7
  sortAscendingAnnouncement?: string;
10
8
  sortDescendingAnnouncement?: string;
11
9
  }
@@ -1,11 +1,7 @@
1
- import React from 'react';
1
+ import { HTMLAttributes } from 'react';
2
2
  import PropTypes from 'prop-types';
3
- interface TableRowProps {
4
- children: React.ReactNode;
5
- className?: string;
6
- }
7
3
  declare const TableRow: {
8
- ({ children, className, ...other }: TableRowProps): JSX.Element;
4
+ ({ children, className, ...other }: HTMLAttributes<HTMLTableRowElement>): JSX.Element;
9
5
  displayName: string;
10
6
  propTypes: {
11
7
  children: PropTypes.Validator<string | number | boolean | {} | PropTypes.ReactElementLike | PropTypes.ReactNodeArray>;
package/lib/dropper.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 SvgDropper = 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: "m20.71 5.63-2.34-2.34a.996.996 0 0 0-1.41 0l-3.12 3.12-1.93-1.91-1.41 1.41 1.42 1.42L3 16.25V21h4.75l8.92-8.92 1.42 1.42 1.41-1.41-1.92-1.92 3.12-3.12c.4-.4.4-1.03.01-1.42zM6.92 19 5 17.08l8.06-8.06 1.92 1.92L6.92 19z",
20
+ fill: "currentColor",
21
+ vectorEffect: "non-scaling-stroke"
22
+ })));
23
+
24
+ exports.default = SvgDropper;
package/lib/index.js CHANGED
@@ -147,6 +147,7 @@ var iconTypes = [
147
147
  'code',
148
148
  'copy',
149
149
  'download',
150
+ 'dropper',
150
151
  'exchange',
151
152
  'external-link',
152
153
  'eye',
@@ -213,6 +214,7 @@ function __variableDynamicImportRuntime0__(path) {
213
214
  case './icons/code.svg': return Promise.resolve().then(function () { return require('./code.js'); });
214
215
  case './icons/copy.svg': return Promise.resolve().then(function () { return require('./copy.js'); });
215
216
  case './icons/download.svg': return Promise.resolve().then(function () { return require('./download.js'); });
217
+ case './icons/dropper.svg': return Promise.resolve().then(function () { return require('./dropper.js'); });
216
218
  case './icons/exchange.svg': return Promise.resolve().then(function () { return require('./exchange.js'); });
217
219
  case './icons/external-link.svg': return Promise.resolve().then(function () { return require('./external-link.js'); });
218
220
  case './icons/eye.svg': return Promise.resolve().then(function () { return require('./eye.js'); });
@@ -1663,13 +1665,6 @@ var IconButton = React.forwardRef(function (_a, ref) {
1663
1665
  accessibilityProps['aria-disabled'] = disabled;
1664
1666
  }
1665
1667
  }
1666
- React.useEffect(function () {
1667
- var _a;
1668
- if (!disabled) {
1669
- return;
1670
- }
1671
- (_a = internalRef.current) === null || _a === void 0 ? void 0 : _a.setAttribute('aria-label', label);
1672
- }, [disabled]);
1673
1668
  return (React__default.createElement(React__default.Fragment, null,
1674
1669
  React__default.createElement(Component, tslib.__assign({ className: classNames(className, {
1675
1670
  IconButton: true,
@@ -1677,7 +1672,8 @@ var IconButton = React.forwardRef(function (_a, ref) {
1677
1672
  'IconButton--secondary': variant === 'secondary',
1678
1673
  'IconButton--error': variant === 'error'
1679
1674
  }), ref: internalRef, disabled: disabled, tabIndex: disabled ? -1 : tabIndex }, accessibilityProps, other),
1680
- React__default.createElement(Icon, { type: icon })),
1675
+ React__default.createElement(Icon, { type: icon }),
1676
+ React__default.createElement(Offscreen, null, label)),
1681
1677
  !disabled && (React__default.createElement(Tooltip, { target: internalRef, placement: tooltipPlacement, variant: tooltipVariant, portal: tooltipPortal, association: "aria-labelledby", hideElementOnHidden: true }, label))));
1682
1678
  });
1683
1679
  IconButton.propTypes = {
@@ -1685,7 +1681,7 @@ IconButton.propTypes = {
1685
1681
  as: PropTypes.elementType,
1686
1682
  // @ts-expect-error
1687
1683
  icon: PropTypes.string.isRequired,
1688
- label: PropTypes.string.isRequired,
1684
+ label: PropTypes.node.isRequired,
1689
1685
  // @ts-expect-error
1690
1686
  tooltipPlacement: PropTypes.string,
1691
1687
  // @ts-expect-error
@@ -2360,7 +2356,7 @@ var RadioGroup = function (_a) {
2360
2356
  var _a;
2361
2357
  handleChange(radioValue);
2362
2358
  onChange(radio, (_a = inputs.current) === null || _a === void 0 ? void 0 : _a[index]);
2363
- }, disabled: disabled, checked: isChecked, "aria-describedby": labelDescription && id + "Desc" }, other)),
2359
+ }, disabled: disabled, checked: isChecked, "aria-describedby": labelDescription ? id + "Desc" : undefined }, other)),
2364
2360
  React__default.createElement("label", { htmlFor: id, className: classNames('Field__label', {
2365
2361
  'Field__label--disabled': disabled
2366
2362
  }) }, label),
@@ -8025,7 +8021,7 @@ function useSharedRef(ref) {
8025
8021
  }
8026
8022
 
8027
8023
  var LoaderOverlay = React.forwardRef(function (_a, ref) {
8028
- var className = _a.className, variant = _a.variant, label = _a.label, children = _a.children, focusOnInitialRender = _a.focusOnInitialRender, other = tslib.__rest(_a, ["className", "variant", "label", "children", "focusOnInitialRender"]);
8024
+ var className = _a.className, variant = _a.variant, label = _a.label, children = _a.children, focusOnInitialRender = _a.focusOnInitialRender, _b = _a.focusTrap, focusTrap = _b === void 0 ? false : _b, other = tslib.__rest(_a, ["className", "variant", "label", "children", "focusOnInitialRender", "focusTrap"]);
8029
8025
  var overlayRef = useSharedRef(ref);
8030
8026
  React.useEffect(function () {
8031
8027
  if (!!focusOnInitialRender && overlayRef.current) {
@@ -8036,16 +8032,25 @@ var LoaderOverlay = React.forwardRef(function (_a, ref) {
8036
8032
  }
8037
8033
  return;
8038
8034
  }, [overlayRef.current]);
8039
- return (React__default.createElement("div", tslib.__assign({ className: classNames('Loader__overlay', className, variant === 'large'
8040
- ? 'Loader__overlay--large'
8041
- : variant === 'small'
8042
- ? 'Loader__overlay--small'
8043
- : ''), ref: overlayRef, tabIndex: -1 }, other),
8044
- React__default.createElement("div", { className: "Loader__overlay__loader" },
8045
- React__default.createElement(Loader, { variant: variant }),
8046
- React__default.createElement(AxeLoader, null)),
8047
- label ? React__default.createElement("span", { className: "Loader__overlay__label" }, label) : null,
8048
- children));
8035
+ var Wrapper = focusTrap ? FocusTrap : React__default.Fragment;
8036
+ var wrapperProps = focusTrap
8037
+ ? {
8038
+ focusTrapOptions: {
8039
+ fallbackFocus: '.Loader__overlay'
8040
+ }
8041
+ }
8042
+ : {};
8043
+ return (React__default.createElement(Wrapper, tslib.__assign({}, wrapperProps),
8044
+ React__default.createElement("div", tslib.__assign({ className: classNames('Loader__overlay', className, variant === 'large'
8045
+ ? 'Loader__overlay--large'
8046
+ : variant === 'small'
8047
+ ? 'Loader__overlay--small'
8048
+ : ''), ref: overlayRef, tabIndex: -1 }, other),
8049
+ React__default.createElement("div", { className: "Loader__overlay__loader" },
8050
+ React__default.createElement(Loader, { variant: variant }),
8051
+ React__default.createElement(AxeLoader, null)),
8052
+ label ? (React__default.createElement("span", { className: "Loader__overlay__label" }, label)) : null,
8053
+ children)));
8049
8054
  });
8050
8055
  LoaderOverlay.propTypes = {
8051
8056
  className: PropTypes.string,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deque/cauldron-react",
3
- "version": "4.3.0-canary.e2302853",
3
+ "version": "4.4.0",
4
4
  "description": "Fully accessible react components library for Deque Cauldron",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -124,4 +124,4 @@
124
124
  "\\.svg$": "<rootDir>/__tests__/svgMock.js"
125
125
  }
126
126
  }
127
- }
127
+ }