@deque/cauldron-react 4.7.0-canary.b07c7ee0 → 4.7.0-canary.b75fad1d

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.
@@ -8,6 +8,7 @@ export interface ClickOutsideListenerProps<T extends HTMLElement = HTMLElement>
8
8
  target?: T;
9
9
  }
10
10
  export default class ClickOutsideListener extends React.Component<ClickOutsideListenerProps> {
11
+ static displayName: string;
11
12
  static defaultProps: {
12
13
  mouseEvent: string;
13
14
  touchEvent: string;
@@ -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' | 'clipboard' | 'close' | 'code' | 'copy' | 'download' | 'dropper' | 'exchange' | 'export-solid' | 'external-link' | 'eye' | 'filter-solid' | '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' | 'play' | 'plus' | 'question-circle-alt' | 'question-circle' | 'radio-checked' | 'radio-unchecked' | 'recycle-square' | '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' | 'clipboard' | 'close' | 'code' | 'copy' | 'download' | 'dropper' | 'exchange' | 'export-solid' | 'external-link' | 'eye' | 'filter-solid' | 'filter' | 'flag' | 'gears' | 'grid' | 'hamburger-menu' | 'highlight' | 'info-circle-alt' | 'info-circle' | 'info-square' | 'kabob' | 'link' | 'list' | 'lock' | 'magnifying-glass' | 'menu' | 'minus' | 'new-releases' | 'new' | 'no' | 'pencil' | 'play' | 'plus' | 'question-circle-alt' | 'question-circle' | 'radio-checked' | 'radio-unchecked' | 'recycle-square' | '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,5 +1,5 @@
1
1
  import React from 'react';
2
- interface LoaderOverlayProps extends React.HTMLAttributes<HTMLDivElement> {
2
+ export interface LoaderOverlayProps extends React.HTMLAttributes<HTMLDivElement> {
3
3
  variant?: 'large' | 'small';
4
4
  label?: string;
5
5
  focusOnInitialRender?: boolean;
@@ -5,7 +5,7 @@ export interface SideBarProps extends React.HTMLAttributes<HTMLUListElement> {
5
5
  onDismiss: () => void;
6
6
  className?: string;
7
7
  show: boolean;
8
- navProps: React.HTMLAttributes<HTMLElement>;
8
+ navProps?: React.HTMLAttributes<HTMLElement>;
9
9
  }
10
10
  interface SideBarState {
11
11
  wide: boolean;
@@ -1,11 +1,15 @@
1
1
  import { TableHTMLAttributes } from 'react';
2
2
  import PropTypes from 'prop-types';
3
+ interface TableProps extends TableHTMLAttributes<HTMLTableElement> {
4
+ variant?: 'border';
5
+ }
3
6
  declare const Table: {
4
- ({ children, className, ...other }: TableHTMLAttributes<HTMLTableElement>): JSX.Element;
7
+ ({ children, className, variant, ...other }: TableProps): JSX.Element;
5
8
  displayName: string;
6
9
  propTypes: {
7
10
  children: PropTypes.Validator<string | number | boolean | {} | PropTypes.ReactElementLike | PropTypes.ReactNodeArray>;
8
11
  className: PropTypes.Requireable<string>;
12
+ variant: PropTypes.Requireable<string>;
9
13
  };
10
14
  };
11
15
  export default Table;
@@ -8,6 +8,7 @@ export interface ToastProps {
8
8
  toastRef: React.Ref<HTMLDivElement>;
9
9
  focus?: boolean;
10
10
  show?: boolean;
11
+ dismissible?: boolean;
11
12
  children: React.ReactNode;
12
13
  }
13
14
  interface ToastState {
@@ -24,6 +25,7 @@ export default class Toast extends React.Component<ToastProps, ToastState> {
24
25
  toastRef: () => void;
25
26
  focus: boolean;
26
27
  show: boolean;
28
+ dismissible: boolean;
27
29
  };
28
30
  static propTypes: {
29
31
  children: PropTypes.Validator<string | number | boolean | {} | PropTypes.ReactElementLike | PropTypes.ReactNodeArray>;
@@ -35,6 +37,7 @@ export default class Toast extends React.Component<ToastProps, ToastState> {
35
37
  }>>;
36
38
  focus: PropTypes.Requireable<boolean>;
37
39
  show: PropTypes.Requireable<boolean>;
40
+ dismissible: PropTypes.Requireable<boolean>;
38
41
  };
39
42
  static displayName: string;
40
43
  private el;
package/lib/index.js CHANGED
@@ -164,6 +164,7 @@ var iconTypes = [
164
164
  'info-circle',
165
165
  'info-square',
166
166
  'kabob',
167
+ 'link',
167
168
  'list',
168
169
  'lock',
169
170
  'magnifying-glass',
@@ -237,6 +238,7 @@ function __variableDynamicImportRuntime0__(path) {
237
238
  case './icons/info-circle.svg': return Promise.resolve().then(function () { return require('./info-circle.js'); });
238
239
  case './icons/info-square.svg': return Promise.resolve().then(function () { return require('./info-square.js'); });
239
240
  case './icons/kabob.svg': return Promise.resolve().then(function () { return require('./kabob.js'); });
241
+ case './icons/link.svg': return Promise.resolve().then(function () { return require('./link.js'); });
240
242
  case './icons/list.svg': return Promise.resolve().then(function () { return require('./list.js'); });
241
243
  case './icons/lock.svg': return Promise.resolve().then(function () { return require('./lock.js'); });
242
244
  case './icons/magnifying-glass.svg': return Promise.resolve().then(function () { return require('./magnifying-glass.js'); });
@@ -305,7 +307,7 @@ var Icon = React.forwardRef(function (_a, ref) {
305
307
  var data = tslib.__assign(tslib.__assign({}, other), { 'aria-hidden': !label, className: classNames('Icon', "Icon--".concat(type), className, (_b = {},
306
308
  _b["Icon__".concat(direction)] = !!direction,
307
309
  _b)) });
308
- return (React__default.createElement("div", tslib.__assign({ ref: ref }, data),
310
+ return (React__default.createElement("span", tslib.__assign({ ref: ref }, data),
309
311
  label && React__default.createElement(Offscreen, null, label),
310
312
  IconSVG && React__default.createElement(IconSVG, null)));
311
313
  });
@@ -326,7 +328,7 @@ var PanelTrigger = function (_a) {
326
328
  React__default.createElement("button", tslib.__assign({ className: classNames(className, 'ExpandCollapse__trigger', {
327
329
  fullWidth: fullWidth
328
330
  }), type: "button", "aria-expanded": open, onClick: onClick }, otherProps),
329
- React__default.createElement("div", { className: "ExpandCollapse__trigger-title" }, typeof children === 'function'
331
+ React__default.createElement("span", { className: "ExpandCollapse__trigger-title" }, typeof children === 'function'
330
332
  ? children({ open: !!open })
331
333
  : children),
332
334
  React__default.createElement(Icon, { type: open ? iconExpanded : iconCollapsed }))));
@@ -899,6 +901,7 @@ var ClickOutsideListener = /** @class */ (function (_super) {
899
901
  ref: resolveRef
900
902
  });
901
903
  };
904
+ ClickOutsideListener.displayName = 'ClickOutsideListener';
902
905
  ClickOutsideListener.defaultProps = {
903
906
  mouseEvent: 'click',
904
907
  touchEvent: 'touchend'
@@ -1560,8 +1563,10 @@ var Dialog = /** @class */ (function (_super) {
1560
1563
  };
1561
1564
  Dialog.prototype.close = function () {
1562
1565
  var _a, _b, _c;
1563
- (_a = this.state.isolator) === null || _a === void 0 ? void 0 : _a.deactivate();
1564
- (_c = (_b = this.props).onClose) === null || _c === void 0 ? void 0 : _c.call(_b);
1566
+ if (this.props.show) {
1567
+ (_a = this.state.isolator) === null || _a === void 0 ? void 0 : _a.deactivate();
1568
+ (_c = (_b = this.props).onClose) === null || _c === void 0 ? void 0 : _c.call(_b);
1569
+ }
1565
1570
  };
1566
1571
  Dialog.prototype.handleClickOutside = function () {
1567
1572
  var _a = this.props, show = _a.show, forceAction = _a.forceAction;
@@ -1720,7 +1725,7 @@ var fireCustomEvent = function (show, button) {
1720
1725
  if (!button) {
1721
1726
  return;
1722
1727
  }
1723
- var event = new Event(show ? 'cauldron:tooltip:show' : 'cauldron:tooltip:hide', {
1728
+ var event = new CustomEvent(show ? 'cauldron:tooltip:show' : 'cauldron:tooltip:hide', {
1724
1729
  bubbles: true
1725
1730
  });
1726
1731
  button.dispatchEvent(event);
@@ -2339,7 +2344,7 @@ var Toast = /** @class */ (function (_super) {
2339
2344
  var _a = this.props, type = _a.type, children = _a.children,
2340
2345
  // prevent `onDismiss` from being passed-through to DOM
2341
2346
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
2342
- onDismiss = _a.onDismiss, dismissText = _a.dismissText, toastRef = _a.toastRef, focus = _a.focus, show = _a.show, otherProps = tslib.__rest(_a, ["type", "children", "onDismiss", "dismissText", "toastRef", "focus", "show"]);
2347
+ onDismiss = _a.onDismiss, dismissText = _a.dismissText, toastRef = _a.toastRef, focus = _a.focus, show = _a.show, dismissible = _a.dismissible, otherProps = tslib.__rest(_a, ["type", "children", "onDismiss", "dismissText", "toastRef", "focus", "show", "dismissible"]);
2343
2348
  var scrim = type === 'action-needed' && show ? (React__default.createElement("div", { className: "Scrim--light Scrim--show Scrim--fade-in" })) : null;
2344
2349
  var defaultProps = {
2345
2350
  tabIndex: -1,
@@ -2356,7 +2361,7 @@ var Toast = /** @class */ (function (_super) {
2356
2361
  React__default.createElement("div", { className: "Toast__message" },
2357
2362
  React__default.createElement(Icon, { type: typeMap[type].icon }),
2358
2363
  React__default.createElement("div", { className: "Toast__message-content" }, children)),
2359
- type !== 'action-needed' && (React__default.createElement("button", { type: "button", className: 'Toast__dismiss', "aria-label": dismissText, onClick: this.dismissToast },
2364
+ type !== 'action-needed' && dismissible && (React__default.createElement("button", { type: "button", className: 'Toast__dismiss', "aria-label": dismissText, onClick: this.dismissToast },
2360
2365
  React__default.createElement(Icon, { type: "close" })))),
2361
2366
  scrim));
2362
2367
  };
@@ -2407,7 +2412,8 @@ var Toast = /** @class */ (function (_super) {
2407
2412
  // eslint-disable-next-line @typescript-eslint/no-empty-function
2408
2413
  toastRef: function () { },
2409
2414
  focus: true,
2410
- show: false
2415
+ show: false,
2416
+ dismissible: true
2411
2417
  };
2412
2418
  Toast.propTypes = {
2413
2419
  // the ui to be added as the message of the toast
@@ -2426,7 +2432,9 @@ var Toast = /** @class */ (function (_super) {
2426
2432
  // whether or not to focus the toast
2427
2433
  focus: PropTypes.bool,
2428
2434
  // whether or not to show the toast
2429
- show: PropTypes.bool
2435
+ show: PropTypes.bool,
2436
+ // whether or not the toast is dismissible
2437
+ dismissible: PropTypes.bool
2430
2438
  };
2431
2439
  Toast.displayName = 'Toast';
2432
2440
  return Toast;
@@ -8252,13 +8260,14 @@ Tag.propTypes = {
8252
8260
  };
8253
8261
 
8254
8262
  var Table = function (_a) {
8255
- var children = _a.children, className = _a.className, other = tslib.__rest(_a, ["children", "className"]);
8256
- return (React__default.createElement("table", tslib.__assign({ className: classNames('Table', className) }, other), children));
8263
+ var children = _a.children, className = _a.className, variant = _a.variant, other = tslib.__rest(_a, ["children", "className", "variant"]);
8264
+ return (React__default.createElement("table", tslib.__assign({ className: classNames('Table', variant === 'border' && 'Table--border', className) }, other), children));
8257
8265
  };
8258
8266
  Table.displayName = 'Table';
8259
8267
  Table.propTypes = {
8260
8268
  children: PropTypes.node.isRequired,
8261
- className: PropTypes.string
8269
+ className: PropTypes.string,
8270
+ variant: PropTypes.string
8262
8271
  };
8263
8272
 
8264
8273
  var TableBody = function (_a) {
@@ -8365,7 +8374,6 @@ var Tabs = function (_a) {
8365
8374
  var children = _a.children, thin = _a.thin, _b = _a.orientation, orientation = _b === void 0 ? 'horizontal' : _b, _c = _a.initialActiveIndex, initialActiveIndex = _c === void 0 ? 0 : _c, className = _a.className, onChange = _a.onChange, labelProp = tslib.__rest(_a, ["children", "thin", "orientation", "initialActiveIndex", "className", "onChange"]);
8366
8375
  var _d = tslib.__read(React.useState(initialActiveIndex), 2), activeIndex = _d[0], setActiveIndex = _d[1];
8367
8376
  var tabsRef = React.useRef(null);
8368
- var focusedTabRef = React.useRef(null);
8369
8377
  var tabs = React__default.Children.toArray(children).filter(function (child) { return child.type === Tab; });
8370
8378
  var tabCount = tabs.length;
8371
8379
  var handleClick = function (index) {
@@ -8438,14 +8446,15 @@ var Tabs = function (_a) {
8438
8446
  }, [activeIndex]);
8439
8447
  var config = tslib.__assign((_a = { id: id, className: classNames('Tab', {
8440
8448
  'Tab--active': selected
8441
- }), tabIndex: index === activeIndex ? 0 : -1 }, _a['aria-controls'] = (_b = target.current) === null || _b === void 0 ? void 0 : _b.id, _a['aria-selected'] = selected, _a.ref = index === activeIndex ? focusedTabRef : null, _a.onClick = function () { return handleClick(index); }, _a), other);
8449
+ }), tabIndex: index === activeIndex ? 0 : -1 }, _a['aria-controls'] = (_b = target.current) === null || _b === void 0 ? void 0 : _b.id, _a['aria-selected'] = selected, _a.onClick = function () { return handleClick(index); }, _a), other);
8442
8450
  return React__default.cloneElement(child, config);
8443
8451
  });
8444
8452
  useDidUpdate(function () {
8445
8453
  var _a;
8446
- (_a = focusedTabRef.current) === null || _a === void 0 ? void 0 : _a.focus();
8454
+ var activeTab = (_a = tabsRef.current) === null || _a === void 0 ? void 0 : _a.querySelector(':scope > [role="tablist"] > [aria-selected="true"]');
8455
+ activeTab === null || activeTab === void 0 ? void 0 : activeTab.focus();
8447
8456
  if (typeof onChange === 'function') {
8448
- onChange({ activeTabIndex: activeIndex, target: focusedTabRef.current });
8457
+ onChange({ activeTabIndex: activeIndex, target: activeTab });
8449
8458
  }
8450
8459
  }, [activeIndex]);
8451
8460
  return (React__default.createElement("div", { className: classNames('Tabs', className, {
package/lib/link.js ADDED
@@ -0,0 +1,25 @@
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 SvgLink = props => /*#__PURE__*/React.createElement("svg", _extends({
13
+ xmlns: "http://www.w3.org/2000/svg",
14
+ overflow: "visible",
15
+ preserveAspectRatio: "none",
16
+ viewBox: "0 0 24 24",
17
+ height: 24,
18
+ width: 24
19
+ }, props), _path || (_path = /*#__PURE__*/React.createElement("path", {
20
+ d: "M18.5 16.01c0 .26-.11.51-.29.7l-1.53 1.52c-.19.18-.45.28-.71.27-.26 0-.52-.1-.71-.28l-2.14-2.16a.99.99 0 0 1-.29-.71c0-.29.12-.57.34-.76l.19.2.22.22.2.16c.08.06.17.11.27.14.1.01.19.01.29 0 .55 0 1-.45 1-1 .01-.1.01-.19 0-.29a.867.867 0 0 0-.14-.27l-.2-.16-.22-.22-.2-.19c.19-.21.46-.33.75-.33.27 0 .52.1.71.29l2.17 2.17c.19.19.29.44.29.71v-.01zm-7.32-7.34c0 .29-.12.57-.34.76l-.19-.2-.23-.22-.2-.16a.744.744 0 0 0-.22-.14c-.1-.01-.19-.01-.29 0-.55 0-1 .45-1 1-.01.09-.01.19 0 .29.03.1.08.19.14.27l.15.16.22.22.2.19c-.19.21-.47.32-.75.32a.98.98 0 0 1-.67-.27L5.79 8.72c-.19-.19-.29-.45-.29-.71 0-.26.11-.51.29-.7l1.54-1.52c.18-.18.42-.28.67-.28.27 0 .52.1.71.29l2.14 2.16c.19.19.29.44.29.71h.04zm9.32 7.34c.01-.8-.3-1.56-.87-2.12l-2.17-2.17c-1.16-1.18-3.06-1.21-4.24-.05l-.05.05-.92-.92c.6-.57.93-1.36.92-2.18.02-.79-.29-1.56-.86-2.11L10.16 4.4C9.6 3.81 8.81 3.48 8 3.51c-.79-.02-1.56.29-2.11.86L4.39 5.9c-.58.54-.9 1.31-.89 2.11-.01.8.3 1.56.87 2.12l2.17 2.17c.56.57 1.32.88 2.12.87.82.01 1.61-.32 2.17-.92l.92.92c-.6.57-.93 1.36-.92 2.18-.02.79.29 1.56.86 2.11l2.14 2.16a3 3 0 0 0 4.24 0l1.53-1.52c.58-.54.9-1.3.9-2.09z",
21
+ fill: "currentColor",
22
+ vectorEffect: "non-scaling-stroke"
23
+ })));
24
+
25
+ exports.default = SvgLink;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deque/cauldron-react",
3
- "version": "4.7.0-canary.b07c7ee0",
3
+ "version": "4.7.0-canary.b75fad1d",
4
4
  "description": "Fully accessible react components library for Deque Cauldron",
5
5
  "publishConfig": {
6
6
  "access": "public"