@deque/cauldron-react 4.0.0-canary.5854bd2a → 4.0.0-canary.78d6a743

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,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' | '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;
@@ -1,14 +1,19 @@
1
1
  import React, { ThHTMLAttributes } from 'react';
2
2
  import PropTypes from 'prop-types';
3
+ declare type SortDirection = 'ascending' | 'descending' | 'none';
3
4
  interface TableHeaderProps extends ThHTMLAttributes<HTMLTableCellElement> {
4
5
  children: React.ReactNode;
6
+ sortDirection?: SortDirection;
7
+ onSort?: () => void;
5
8
  className?: string;
6
9
  }
7
10
  declare const TableHeader: {
8
- ({ children, className, ...other }: TableHeaderProps): JSX.Element;
11
+ ({ children, sortDirection, onSort, className, ...other }: TableHeaderProps): JSX.Element;
9
12
  displayName: string;
10
13
  propTypes: {
11
14
  children: PropTypes.Validator<string | number | boolean | {} | PropTypes.ReactElementLike | PropTypes.ReactNodeArray>;
15
+ sortDirection: PropTypes.Requireable<string>;
16
+ onSort: PropTypes.Requireable<(...args: any[]) => any>;
12
17
  className: PropTypes.Requireable<string>;
13
18
  };
14
19
  };
package/lib/index.js CHANGED
@@ -173,10 +173,12 @@ 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',
179
180
  'share',
181
+ 'sort-triangle',
180
182
  'sort',
181
183
  'star',
182
184
  'sun',
@@ -236,10 +238,12 @@ function __variableDynamicImportRuntime0__(path) {
236
238
  case './icons/radio-checked.svg': return Promise.resolve().then(function () { return require('./radio-checked.js'); });
237
239
  case './icons/radio-unchecked.svg': return Promise.resolve().then(function () { return require('./radio-unchecked.js'); });
238
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'); });
239
242
  case './icons/robot.svg': return Promise.resolve().then(function () { return require('./robot.js'); });
240
243
  case './icons/run-again.svg': return Promise.resolve().then(function () { return require('./run-again.js'); });
241
244
  case './icons/save.svg': return Promise.resolve().then(function () { return require('./save.js'); });
242
245
  case './icons/share.svg': return Promise.resolve().then(function () { return require('./share.js'); });
246
+ case './icons/sort-triangle.svg': return Promise.resolve().then(function () { return require('./sort-triangle.js'); });
243
247
  case './icons/sort.svg': return Promise.resolve().then(function () { return require('./sort.js'); });
244
248
  case './icons/star.svg': return Promise.resolve().then(function () { return require('./star.js'); });
245
249
  case './icons/sun.svg': return Promise.resolve().then(function () { return require('./sun.js'); });
@@ -2326,7 +2330,7 @@ var RadioGroup = function (_a) {
2326
2330
  setCurrentValue(value);
2327
2331
  }, [value]);
2328
2332
  var radioButtons = radios.map(function (radio, index) {
2329
- 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"]);
2330
2334
  var isChecked = currentValue === radioValue;
2331
2335
  var isFocused = focusIndex === index;
2332
2336
  return (React__default.createElement("div", { className: classNames('Radio is--flex-row', className), key: id },
@@ -2339,14 +2343,17 @@ var RadioGroup = function (_a) {
2339
2343
  var _a;
2340
2344
  handleChange(radioValue);
2341
2345
  onChange(radio, (_a = inputs.current) === null || _a === void 0 ? void 0 : _a[index]);
2342
- }, disabled: disabled, checked: isChecked }, other)),
2346
+ }, disabled: disabled, checked: isChecked, "aria-describedby": labelDescription && id + "Desc" }, other)),
2343
2347
  React__default.createElement("label", { htmlFor: id, className: classNames('Field__label', {
2344
2348
  'Field__label--disabled': disabled
2345
2349
  }) }, label),
2346
2350
  React__default.createElement(Icon, { className: classNames('Radio__overlay', {
2347
2351
  'Radio__overlay--focused': isFocused,
2348
2352
  'Radio__overlay--disabled': disabled
2349
- }), 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))));
2350
2357
  });
2351
2358
  // reset the input refs array
2352
2359
  // refs get clobbered every re-render anyway and this supports "dynamic" radios
@@ -2359,7 +2366,8 @@ RadioGroup.propTypes = {
2359
2366
  radios: PropTypes.arrayOf(PropTypes.shape({
2360
2367
  value: PropTypes.string.isRequired,
2361
2368
  id: PropTypes.string.isRequired,
2362
- label: PropTypes.string.isRequired
2369
+ label: PropTypes.string.isRequired,
2370
+ labelDescription: PropTypes.string
2363
2371
  })).isRequired,
2364
2372
  hasLabel: function (props, propName, componentName) {
2365
2373
  if (!props['aria-label'] && !props['aria-labelledby']) {
@@ -8054,12 +8062,19 @@ TableHead.propTypes = {
8054
8062
  };
8055
8063
 
8056
8064
  var TableHeader = function (_a) {
8057
- var children = _a.children, className = _a.className, other = tslib.__rest(_a, ["children", "className"]);
8058
- return (React__default.createElement("th", tslib.__assign({ className: classNames('TableHeader', className) }, other), children));
8065
+ var children = _a.children, sortDirection = _a.sortDirection, onSort = _a.onSort, className = _a.className, other = tslib.__rest(_a, ["children", "sortDirection", "onSort", "className"]);
8066
+ return (React__default.createElement("th", tslib.__assign({ "aria-sort": sortDirection, className: classNames('TableHeader', className, {
8067
+ 'TableHeader--sort-ascending': sortDirection === 'ascending',
8068
+ 'TableHeader--sort-descending': sortDirection === 'descending'
8069
+ }) }, other), !!onSort && !!sortDirection ? (React__default.createElement("button", { onClick: onSort, className: "TableHeader__sort-button", type: "button" },
8070
+ children,
8071
+ React__default.createElement("span", { "aria-hidden": "true" }, sortDirection === 'none' ? (React__default.createElement(Icon, { type: "sort-triangle" })) : sortDirection === 'ascending' ? (React__default.createElement(Icon, { type: "triangle-up" })) : (React__default.createElement(Icon, { type: "triangle-down" }))))) : (children)));
8059
8072
  };
8060
8073
  TableHeader.displayName = 'TableHeader';
8061
8074
  TableHeader.propTypes = {
8062
8075
  children: PropTypes.node.isRequired,
8076
+ sortDirection: PropTypes.string,
8077
+ onSort: PropTypes.func,
8063
8078
  className: PropTypes.string
8064
8079
  };
8065
8080
 
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;
@@ -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 SvgSortTriangle = 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: "M17.13 13.54a.634.634 0 0 0-.47-.2H7.34c-.36 0-.66.29-.67.65 0 .18.07.35.2.48l4.66 4.66c.25.26.66.27.92.02l.02-.02 4.66-4.66c.26-.25.28-.65.03-.91-.01-.02-.02-.02-.03-.02zm0-4-4.66-4.66a.649.649 0 0 0-.92-.02l-.02.02-4.66 4.66c-.25.27-.24.69.03.95.12.11.28.18.44.18h9.33c.36 0 .66-.3.66-.66a.72.72 0 0 0-.2-.47z",
20
+ fill: "currentColor",
21
+ vectorEffect: "non-scaling-stroke"
22
+ })));
23
+
24
+ exports.default = SvgSortTriangle;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deque/cauldron-react",
3
- "version": "4.0.0-canary.5854bd2a",
3
+ "version": "4.0.0-canary.78d6a743",
4
4
  "description": "Fully accessible react components library for Deque Cauldron",
5
5
  "publishConfig": {
6
6
  "access": "public"