@deque/cauldron-react 4.2.1 → 4.3.0-canary.7b91d476

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.
@@ -4,6 +4,7 @@ interface Props extends SyntaxHighlighterProps {
4
4
  children: React.ReactNode;
5
5
  language?: 'javascript' | 'css' | 'html' | 'yaml';
6
6
  className?: string;
7
+ tabIndex?: number;
7
8
  }
8
9
  declare const Code: React.ComponentType<Props>;
9
10
  export default Code;
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
+ import { IconType } from '../Icon';
3
4
  export interface PanelTriggerProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
4
5
  children?: ((props: {
5
6
  open: boolean;
@@ -7,14 +8,18 @@ export interface PanelTriggerProps extends React.ButtonHTMLAttributes<HTMLButton
7
8
  open?: boolean;
8
9
  fullWidth?: string;
9
10
  onClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;
11
+ iconExpanded?: IconType;
12
+ iconCollapsed?: IconType;
10
13
  }
11
- declare function PanelTrigger({ children, className, open, fullWidth, onClick, ...other }: PanelTriggerProps): JSX.Element;
14
+ declare function PanelTrigger({ children, className, open, fullWidth, onClick, iconExpanded, iconCollapsed, ...other }: PanelTriggerProps): JSX.Element;
12
15
  declare namespace PanelTrigger {
13
16
  var propTypes: {
14
17
  children: PropTypes.Requireable<string | number | boolean | {} | PropTypes.ReactElementLike | PropTypes.ReactNodeArray>;
15
18
  open: PropTypes.Requireable<boolean>;
16
19
  onClick: PropTypes.Requireable<(...args: any[]) => any>;
17
20
  className: PropTypes.Requireable<string>;
21
+ iconExpanded: PropTypes.Requireable<string>;
22
+ iconCollapsed: PropTypes.Requireable<string>;
18
23
  };
19
24
  }
20
25
  declare const _default: React.MemoExoticComponent<typeof PanelTrigger>;
@@ -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' | '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' | '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[];
@@ -6,9 +6,11 @@ interface TableHeaderProps extends ThHTMLAttributes<HTMLTableCellElement> {
6
6
  sortDirection?: SortDirection;
7
7
  onSort?: () => void;
8
8
  className?: string;
9
+ sortAscendingAnnouncement?: string;
10
+ sortDescendingAnnouncemen?: string;
9
11
  }
10
12
  declare const TableHeader: {
11
- ({ children, sortDirection, onSort, className, ...other }: TableHeaderProps): JSX.Element;
13
+ ({ children, sortDirection, onSort, className, sortAscendingAnnouncement, sortDescendingAnnouncemen, ...other }: TableHeaderProps): JSX.Element;
12
14
  displayName: string;
13
15
  propTypes: {
14
16
  children: PropTypes.Validator<string | number | boolean | {} | PropTypes.ReactElementLike | PropTypes.ReactNodeArray>;
@@ -1,8 +1,10 @@
1
1
  import React from 'react';
2
+ import SkipLink from '../SkipLink';
2
3
  interface TwoColumnPanelProps extends React.HTMLAttributes<HTMLDivElement> {
3
4
  initialCollapsed?: boolean;
4
5
  showCollapsedPanelLabel?: string;
5
6
  hideCollapsedPanelLabel?: string;
7
+ skipLink?: SkipLink;
6
8
  }
7
9
  declare const TwoColumnPanel: React.ForwardRefExoticComponent<TwoColumnPanelProps & React.RefAttributes<HTMLDivElement>>;
8
10
  export default TwoColumnPanel;
package/lib/index.js CHANGED
@@ -164,6 +164,7 @@ var iconTypes = [
164
164
  'lock',
165
165
  'magnifying-glass',
166
166
  'menu',
167
+ 'minus',
167
168
  'new-releases',
168
169
  'new',
169
170
  'no',
@@ -229,6 +230,7 @@ function __variableDynamicImportRuntime0__(path) {
229
230
  case './icons/lock.svg': return Promise.resolve().then(function () { return require('./lock.js'); });
230
231
  case './icons/magnifying-glass.svg': return Promise.resolve().then(function () { return require('./magnifying-glass.js'); });
231
232
  case './icons/menu.svg': return Promise.resolve().then(function () { return require('./menu.js'); });
233
+ case './icons/minus.svg': return Promise.resolve().then(function () { return require('./minus.js'); });
232
234
  case './icons/new-releases.svg': return Promise.resolve().then(function () { return require('./new-releases.js'); });
233
235
  case './icons/new.svg': return Promise.resolve().then(function () { return require('./new.js'); });
234
236
  case './icons/no.svg': return Promise.resolve().then(function () { return require('./no.js'); });
@@ -1421,8 +1423,9 @@ var SkipLink = /** @class */ (function (_super) {
1421
1423
  return (React__default.createElement("nav", tslib.__assign({ className: classNames('SkipLink', currentClass) }, other),
1422
1424
  React__default.createElement("a", { href: target, className: "SkipLink__link", onClick: this.onClick, onFocus: this.onFocus, onBlur: this.onBlur },
1423
1425
  React__default.createElement("span", { className: "SkipLink__item--first" }, skipText),
1424
- "\u00A0",
1425
- React__default.createElement("span", { className: "SkipLink__item--second" }, targetText))));
1426
+ React__default.createElement("span", { className: "SkipLink__item--second" },
1427
+ React__default.createElement(Icon, { type: "triangle-right" }),
1428
+ targetText))));
1426
1429
  };
1427
1430
  SkipLink.prototype.onClick = function () {
1428
1431
  if (!isBrowser()) {
@@ -2597,16 +2600,18 @@ var TextField = /** @class */ (function (_super) {
2597
2600
  }(React__default.Component));
2598
2601
 
2599
2602
  function PanelTrigger(_a) {
2600
- var children = _a.children, className = _a.className, open = _a.open, fullWidth = _a.fullWidth, onClick = _a.onClick, other = tslib.__rest(_a, ["children", "className", "open", "fullWidth", "onClick"]);
2603
+ var children = _a.children, className = _a.className, open = _a.open, fullWidth = _a.fullWidth, onClick = _a.onClick, _b = _a.iconExpanded, iconExpanded = _b === void 0 ? 'chevron-down' : _b, _c = _a.iconCollapsed, iconCollapsed = _c === void 0 ? 'chevron-right' : _c, other = tslib.__rest(_a, ["children", "className", "open", "fullWidth", "onClick", "iconExpanded", "iconCollapsed"]);
2601
2604
  return (React__default.createElement("button", tslib.__assign({}, other, { className: classNames('ExpandCollapse__trigger', fullWidth ? 'fullWidth' : '', className), type: "button", "aria-expanded": open, onClick: onClick }),
2602
2605
  React__default.createElement("div", { className: "ExpandCollapse__trigger-title" }, typeof children === 'function' ? children({ open: !!open }) : children),
2603
- React__default.createElement(Icon, { type: open ? 'chevron-down' : 'chevron-right' })));
2606
+ React__default.createElement(Icon, { type: open ? iconExpanded : iconCollapsed })));
2604
2607
  }
2605
2608
  PanelTrigger.propTypes = {
2606
2609
  children: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
2607
2610
  open: PropTypes.bool,
2608
2611
  onClick: PropTypes.func,
2609
- className: PropTypes.string
2612
+ className: PropTypes.string,
2613
+ iconExpanded: PropTypes.string,
2614
+ iconCollapsed: PropTypes.string
2610
2615
  };
2611
2616
  var PanelTrigger$1 = React__default.memo(PanelTrigger);
2612
2617
 
@@ -7981,8 +7986,8 @@ SyntaxHighlighter.registerLanguage('css', css_1);
7981
7986
  SyntaxHighlighter.registerLanguage('html', xml_1);
7982
7987
  SyntaxHighlighter.registerLanguage('yaml', yaml_1);
7983
7988
  var Code = function (_a) {
7984
- var children = _a.children, className = _a.className, props = tslib.__rest(_a, ["children", "className"]);
7985
- return (React__default.createElement(SyntaxHighlighter, tslib.__assign({}, props, { useInlineStyles: false, className: classNames('Code', className) }), children));
7989
+ var children = _a.children, className = _a.className, tabIndex = _a.tabIndex, props = tslib.__rest(_a, ["children", "className", "tabIndex"]);
7990
+ return (React__default.createElement(SyntaxHighlighter, tslib.__assign({}, props, { useInlineStyles: false, className: classNames('Code', className), tabIndex: tabIndex }), children));
7986
7991
  };
7987
7992
  Code.displayName = 'Code';
7988
7993
  Code.propTypes = {
@@ -7997,9 +8002,31 @@ function AxeLoader() {
7997
8002
  React__default.createElement("path", { fill: "currentColor", d: "M379 549.9h-27.6v-16.7c-7.4 13.5-22.8 20.2-39 20.2-37.1 0-58.9-28.9-58.9-61.6 0-36.5 26.4-61.4 58.9-61.4 21.1 0 34 11.2 39 20.5V434H379v115.9zm-97.8-57.4c0 14.3 10.3 35.2 35.2 35.2 15.4 0 25.5-8 30.8-18.6 2.7-5.1 4-10.5 4.4-16.2.2-5.5-.8-11.2-3.2-16.2-4.9-11-15.6-20.5-32.3-20.5-22.4 0-35 18.1-35 36.1v.2zM436.2 488.9l-39-54.8h33.3l22.6 35.6 22.6-35.6h32.9l-38.8 54.8 43.2 61h-34L453.1 510l-26.2 39.9h-33.5l42.8-61z" })));
7998
8003
  }
7999
8004
 
8000
- var LoaderOverlay = React__default.forwardRef(function (_a, ref) {
8005
+ /**
8006
+ * When a component needs to track an internal ref on a component that has a
8007
+ * forwarded ref, useSharedRef will return a MutableRefObject<T> that will
8008
+ * correctly invoke the parent ref as well providing an internal ref.
8009
+ *
8010
+ * @example
8011
+ * React.forwardRef(function Component({ children }, ref) {
8012
+ * const internalRef = useSharedRef<HTMLElement>(ref)
8013
+ * if (internalRef.current) {
8014
+ * // do something with the internal ref...
8015
+ * }
8016
+ * return (<div ref={internalRef}>...</div>)
8017
+ * })
8018
+ */
8019
+ function useSharedRef(ref) {
8020
+ var internalRef = React.useRef();
8021
+ React.useEffect(function () {
8022
+ setRef(ref, internalRef.current);
8023
+ }, [ref]);
8024
+ return internalRef;
8025
+ }
8026
+
8027
+ var LoaderOverlay = React.forwardRef(function (_a, ref) {
8001
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"]);
8002
- var overlayRef = typeof ref === 'function' || !ref ? React.createRef() : ref;
8029
+ var overlayRef = useSharedRef(ref);
8003
8030
  React.useEffect(function () {
8004
8031
  if (!!focusOnInitialRender && overlayRef.current) {
8005
8032
  setTimeout(function () {
@@ -8009,11 +8036,6 @@ var LoaderOverlay = React__default.forwardRef(function (_a, ref) {
8009
8036
  }
8010
8037
  return;
8011
8038
  }, [overlayRef.current]);
8012
- React.useEffect(function () {
8013
- if (typeof ref === 'function') {
8014
- ref(overlayRef.current);
8015
- }
8016
- }, [ref]);
8017
8039
  return (React__default.createElement("div", tslib.__assign({ className: classNames('Loader__overlay', className, variant === 'large'
8018
8040
  ? 'Loader__overlay--large'
8019
8041
  : variant === 'small'
@@ -8103,13 +8125,26 @@ TableHead.propTypes = {
8103
8125
  };
8104
8126
 
8105
8127
  var TableHeader = function (_a) {
8106
- var children = _a.children, sortDirection = _a.sortDirection, onSort = _a.onSort, className = _a.className, other = tslib.__rest(_a, ["children", "sortDirection", "onSort", "className"]);
8128
+ var children = _a.children, sortDirection = _a.sortDirection, onSort = _a.onSort, className = _a.className, _b = _a.sortAscendingAnnouncement, sortAscendingAnnouncement = _b === void 0 ? 'sorted ascending' : _b, _c = _a.sortDescendingAnnouncemen, sortDescendingAnnouncemen = _c === void 0 ? 'sorted descending' : _c, other = tslib.__rest(_a, ["children", "sortDirection", "onSort", "className", "sortAscendingAnnouncement", "sortDescendingAnnouncemen"]);
8129
+ // When the sort direction changes, we want to announce the change in a live region
8130
+ // because changes to the sort value is not widely supported yet
8131
+ // see: https://a11ysupport.io/tech/aria/aria-sort_attribute
8132
+ var _d = tslib.__read(React.useState(''), 2), announcement = _d[0], setAnnouncement = _d[1];
8133
+ React.useEffect(function () {
8134
+ if (sortDirection !== 'none') {
8135
+ setAnnouncement(sortDirection === 'ascending'
8136
+ ? sortAscendingAnnouncement
8137
+ : sortDescendingAnnouncemen);
8138
+ }
8139
+ }, [sortDirection]);
8107
8140
  return (React__default.createElement("th", tslib.__assign({ "aria-sort": sortDirection, className: classNames('TableHeader', className, {
8108
8141
  'TableHeader--sort-ascending': sortDirection === 'ascending',
8109
8142
  'TableHeader--sort-descending': sortDirection === 'descending'
8110
8143
  }) }, other), !!onSort && !!sortDirection ? (React__default.createElement("button", { onClick: onSort, className: "TableHeader__sort-button", type: "button" },
8111
8144
  children,
8112
- 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)));
8145
+ 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" }))),
8146
+ React__default.createElement(Offscreen, null,
8147
+ React__default.createElement("span", { role: "status", "aria-live": "polite" }, announcement)))) : (children)));
8113
8148
  };
8114
8149
  TableHeader.displayName = 'TableHeader';
8115
8150
  TableHeader.propTypes = {
@@ -8523,11 +8558,23 @@ var BreadcrumbLink = React.forwardRef(function (_a, ref) {
8523
8558
  return (React__default.createElement(ElementType, tslib.__assign({ className: classNames('Link', 'Breadcrumb__Link', className), ref: ref }, props), children));
8524
8559
  });
8525
8560
 
8561
+ var ColumnLeft = React.forwardRef(function (_a, ref) {
8562
+ var className = _a.className, children = _a.children, props = tslib.__rest(_a, ["className", "children"]);
8563
+ return (React__default.createElement("section", tslib.__assign({ className: classNames('TwoColumnPanel__Left', className) }, props, { ref: ref }), children));
8564
+ });
8565
+ ColumnLeft.displayName = 'ColumnLeft';
8566
+
8567
+ var ColumnRight = React.forwardRef(function (_a, ref) {
8568
+ var className = _a.className, children = _a.children, props = tslib.__rest(_a, ["className", "children"]);
8569
+ return (React__default.createElement("section", tslib.__assign({ className: classNames('TwoColumnPanel__Right', className) }, props, { ref: ref }), children));
8570
+ });
8571
+ ColumnRight.displayName = 'ColumnRight';
8572
+
8526
8573
  var TwoColumnPanel = React.forwardRef(function (_a, ref) {
8527
- var className = _a.className, children = _a.children, _b = _a.initialCollapsed, initialCollapsed = _b === void 0 ? false : _b, _c = _a.showCollapsedPanelLabel, showCollapsedPanelLabel = _c === void 0 ? 'Show Panel' : _c, _d = _a.hideCollapsedPanelLabel, hideCollapsedPanelLabel = _d === void 0 ? 'Hide Panel' : _d, props = tslib.__rest(_a, ["className", "children", "initialCollapsed", "showCollapsedPanelLabel", "hideCollapsedPanelLabel"]);
8528
- var _e = tslib.__read(React.useState(initialCollapsed), 2), isCollapsed = _e[0], setCollapsed = _e[1];
8529
- var _f = tslib.__read(React.useState(false), 2), isFocusTrap = _f[0], setIsFocusTrap = _f[1];
8530
- var _g = tslib.__read(React.useState(!initialCollapsed), 2), showPanel = _g[0], setShowPanel = _g[1];
8574
+ var className = _a.className, children = _a.children, _b = _a.initialCollapsed, initialCollapsed = _b === void 0 ? false : _b, _c = _a.showCollapsedPanelLabel, showCollapsedPanelLabel = _c === void 0 ? 'Show Panel' : _c, _d = _a.hideCollapsedPanelLabel, hideCollapsedPanelLabel = _d === void 0 ? 'Hide Panel' : _d, _e = _a.skipLink, skipLink = _e === void 0 ? null : _e, props = tslib.__rest(_a, ["className", "children", "initialCollapsed", "showCollapsedPanelLabel", "hideCollapsedPanelLabel", "skipLink"]);
8575
+ var _f = tslib.__read(React.useState(initialCollapsed), 2), isCollapsed = _f[0], setCollapsed = _f[1];
8576
+ var _g = tslib.__read(React.useState(false), 2), isFocusTrap = _g[0], setIsFocusTrap = _g[1];
8577
+ var _h = tslib.__read(React.useState(!initialCollapsed), 2), showPanel = _h[0], setShowPanel = _h[1];
8531
8578
  var togglePanel = function () {
8532
8579
  if (isCollapsed) {
8533
8580
  setShowPanel(true);
@@ -8654,6 +8701,7 @@ var TwoColumnPanel = React.forwardRef(function (_a, ref) {
8654
8701
  fallbackFocus: columnLeftRef.current
8655
8702
  }, containerElements: [columnLeftRef.current] }),
8656
8703
  React__default.createElement(ClickOutsideListener, { onClickOutside: handleClickOutside, target: columnLeftRef.current }),
8704
+ isCollapsed ? null : skipLink,
8657
8705
  showPanel ? ColumnLeftComponent : null,
8658
8706
  ColumnRightComponent));
8659
8707
  });
@@ -8671,18 +8719,6 @@ var ColumnGroupHeader = React.forwardRef(function (_a, ref) {
8671
8719
  });
8672
8720
  ColumnGroupHeader.displayName = 'ColumnGroupHeader';
8673
8721
 
8674
- var ColumnLeft = React.forwardRef(function (_a, ref) {
8675
- var className = _a.className, children = _a.children, props = tslib.__rest(_a, ["className", "children"]);
8676
- return (React__default.createElement("section", tslib.__assign({ className: classNames('TwoColumnPanel__Left', className) }, props, { ref: ref }), children));
8677
- });
8678
- ColumnLeft.displayName = 'ColumnLeft';
8679
-
8680
- var ColumnRight = React.forwardRef(function (_a, ref) {
8681
- var className = _a.className, children = _a.children, props = tslib.__rest(_a, ["className", "children"]);
8682
- return (React__default.createElement("section", tslib.__assign({ className: classNames('TwoColumnPanel__Right', className) }, props, { ref: ref }), children));
8683
- });
8684
- ColumnRight.displayName = 'ColumnRight';
8685
-
8686
8722
  var ColumnList = React.forwardRef(function (_a, ref) {
8687
8723
  var className = _a.className, children = _a.children, props = tslib.__rest(_a, ["className", "children"]);
8688
8724
  return (React__default.createElement("div", tslib.__assign({ className: classNames('TwoColumnPanel__List', className) }, props, { ref: ref }), children));
package/lib/minus.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 SvgMinus = 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: "M19 13H5v-2h14v2z",
21
+ vectorEffect: "non-scaling-stroke",
22
+ fill: "currentColor"
23
+ })));
24
+
25
+ exports.default = SvgMinus;
@@ -0,0 +1,16 @@
1
+ import { MutableRefObject, Ref } from 'react';
2
+ /**
3
+ * When a component needs to track an internal ref on a component that has a
4
+ * forwarded ref, useSharedRef will return a MutableRefObject<T> that will
5
+ * correctly invoke the parent ref as well providing an internal ref.
6
+ *
7
+ * @example
8
+ * React.forwardRef(function Component({ children }, ref) {
9
+ * const internalRef = useSharedRef<HTMLElement>(ref)
10
+ * if (internalRef.current) {
11
+ * // do something with the internal ref...
12
+ * }
13
+ * return (<div ref={internalRef}>...</div>)
14
+ * })
15
+ */
16
+ export default function useSharedRef<T>(ref: Ref<T>): MutableRefObject<T>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deque/cauldron-react",
3
- "version": "4.2.1",
3
+ "version": "4.3.0-canary.7b91d476",
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
+ }