@deque/cauldron-react 6.27.0-canary.24bf1e41 → 6.27.0-canary.34834ec5

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.
@@ -6,6 +6,7 @@ interface DialogContextValue {
6
6
  onClose: () => void;
7
7
  forceAction: boolean;
8
8
  closeButtonText: string;
9
+ scrollable: boolean;
9
10
  }
10
11
  declare const DialogContext: React.Context<DialogContextValue | null>;
11
12
  declare function useDialogContext(): DialogContextValue;
@@ -12,6 +12,7 @@ export interface DialogProps extends React.HTMLAttributes<HTMLDivElement> {
12
12
  };
13
13
  closeButtonText?: string;
14
14
  portal?: React.RefObject<HTMLElement> | HTMLElement;
15
+ scrollable?: boolean;
15
16
  }
16
17
  declare const Dialog: React.ForwardRefExoticComponent<DialogProps & React.RefAttributes<HTMLDivElement>>;
17
18
  export default Dialog;
@@ -7,18 +7,6 @@ export interface IconButtonProps extends PolymorphicProps<React.HTMLAttributes<H
7
7
  label: React.ReactNode;
8
8
  tooltipProps?: Omit<TooltipProps, 'children' | 'target'>;
9
9
  disabled?: boolean;
10
- /**
11
- * @deprecated use `tooltipProps.placement` instead
12
- */
13
- tooltipPlacement?: TooltipProps['placement'];
14
- /**
15
- * @deprecated use `tooltipProps.variant` instead
16
- */
17
- tooltipVariant?: TooltipProps['variant'];
18
- /**
19
- * @deprecated use `tooltipProps.portal` instead
20
- */
21
- tooltipPortal?: TooltipProps['portal'];
22
10
  variant?: 'primary' | 'secondary' | 'tertiary' | 'error';
23
11
  large?: boolean;
24
12
  }
@@ -2,8 +2,9 @@ import React from 'react';
2
2
  import { DialogProps } from '../Dialog';
3
3
  interface ModalProps extends Omit<DialogProps, 'forceAction'> {
4
4
  variant?: 'info';
5
+ scrollable?: boolean;
5
6
  }
6
- declare const Modal: ({ children, className, variant, ...other }: ModalProps) => React.JSX.Element;
7
+ declare const Modal: ({ children, className, variant, scrollable, ...other }: ModalProps) => React.JSX.Element;
7
8
  declare const ModalHeader: {
8
9
  ({ children, className, ...other }: import("../Dialog").DialogHeaderProps): React.JSX.Element;
9
10
  displayName: string;
@@ -1,39 +1,19 @@
1
1
  import React from 'react';
2
- import AriaIsolate from '../../utils/aria-isolate';
3
2
  export interface ToastProps extends React.HTMLAttributes<HTMLDivElement> {
4
3
  type: 'confirmation' | 'caution' | 'error' | 'action-needed' | 'info';
5
- onDismiss: () => void;
4
+ onDismiss?: () => void;
6
5
  dismissText?: string;
7
- toastRef: React.Ref<HTMLDivElement>;
6
+ toastRef?: React.Ref<HTMLDivElement>;
8
7
  focus?: boolean;
9
8
  show?: boolean;
10
9
  dismissible?: boolean;
11
10
  children: React.ReactNode;
12
11
  }
13
- interface ToastState {
14
- animationClass: string;
15
- isolator?: AriaIsolate;
16
- }
17
12
  /**
18
13
  * The cauldron toast notification component
19
14
  */
20
- export default class Toast extends React.Component<ToastProps, ToastState> {
21
- static defaultProps: {
22
- dismissText: string;
23
- onDismiss: () => void;
24
- toastRef: () => void;
25
- focus: boolean;
26
- show: boolean;
27
- dismissible: boolean;
28
- };
29
- static displayName: string;
30
- private el;
31
- constructor(props: ToastProps);
32
- componentDidMount(): void;
33
- componentDidUpdate(prevProps: ToastProps): void;
34
- componentWillUnmount(): void;
35
- render(): React.JSX.Element;
36
- dismissToast(): void;
37
- showToast(): void;
38
- }
39
- export {};
15
+ declare const Toast: {
16
+ ({ type, children, onDismiss, dismissText, toastRef, focus, show, dismissible, className, ...otherProps }: ToastProps): React.JSX.Element;
17
+ displayName: string;
18
+ };
19
+ export default Toast;
package/lib/index.js CHANGED
@@ -1532,9 +1532,9 @@ var isEscape = function (event) {
1532
1532
  return event.key === 'Escape' || event.key === 'Esc' || event.keyCode === 27;
1533
1533
  };
1534
1534
  var Dialog = React.forwardRef(function (_a, ref) {
1535
- var dialogRefProp = _a.dialogRef, _b = _a.forceAction, forceAction = _b === void 0 ? false : _b, className = _a.className, children = _a.children, _c = _a.closeButtonText, closeButtonText = _c === void 0 ? 'Close' : _c, heading = _a.heading, _d = _a.show, show = _d === void 0 ? false : _d, portal = _a.portal, _e = _a.onClose, onClose = _e === void 0 ? function () { return null; } : _e, other = tslib.__rest(_a, ["dialogRef", "forceAction", "className", "children", "closeButtonText", "heading", "show", "portal", "onClose"]);
1535
+ var dialogRefProp = _a.dialogRef, _b = _a.forceAction, forceAction = _b === void 0 ? false : _b, className = _a.className, children = _a.children, _c = _a.closeButtonText, closeButtonText = _c === void 0 ? 'Close' : _c, heading = _a.heading, _d = _a.show, show = _d === void 0 ? false : _d, portal = _a.portal, _e = _a.scrollable, scrollable = _e === void 0 ? false : _e, _f = _a.onClose, onClose = _f === void 0 ? function () { return null; } : _f, other = tslib.__rest(_a, ["dialogRef", "forceAction", "className", "children", "closeButtonText", "heading", "show", "portal", "scrollable", "onClose"]);
1536
1536
  var dialogRef = useSharedRef(dialogRefProp || ref);
1537
- var _f = tslib.__read(nextId.useId(1, 'dialog-title-'), 1), headingId = _f[0];
1537
+ var _g = tslib.__read(nextId.useId(1, 'dialog-title-'), 1), headingId = _g[0];
1538
1538
  var headingRef = React.useRef(null);
1539
1539
  var isolatorRef = React.useRef();
1540
1540
  var headingLevel = typeof heading === 'object' && 'level' in heading && heading.level
@@ -1605,14 +1605,16 @@ var Dialog = React.forwardRef(function (_a, ref) {
1605
1605
  headingLevel: headingLevel,
1606
1606
  onClose: handleClose,
1607
1607
  forceAction: forceAction,
1608
- closeButtonText: closeButtonText
1608
+ closeButtonText: closeButtonText,
1609
+ scrollable: scrollable
1609
1610
  }); }, [
1610
1611
  headingId,
1611
1612
  headingRef,
1612
1613
  headingLevel,
1613
1614
  handleClose,
1614
1615
  forceAction,
1615
- closeButtonText
1616
+ closeButtonText,
1617
+ scrollable
1616
1618
  ]);
1617
1619
  if (!show || !isBrowser()) {
1618
1620
  return null;
@@ -1642,11 +1644,12 @@ var Dialog = React.forwardRef(function (_a, ref) {
1642
1644
  Dialog.displayName = 'Dialog';
1643
1645
  var DialogContent = function (_a) {
1644
1646
  var children = _a.children, className = _a.className, align = _a.align, other = tslib.__rest(_a, ["children", "className", "align"]);
1647
+ var context = React.useContext(DialogContext);
1645
1648
  return (React__default["default"].createElement("div", tslib.__assign({ className: classNames__default["default"]('Dialog__content', className, {
1646
1649
  'text--align-left': align === 'left',
1647
1650
  'text--align-center': align === 'center',
1648
1651
  'text--align-right': align === 'right'
1649
- }) }, other), children));
1652
+ }), tabIndex: (context === null || context === void 0 ? void 0 : context.scrollable) ? -1 : undefined }, other), children));
1650
1653
  };
1651
1654
  DialogContent.displayName = 'DialogContent';
1652
1655
  var DialogFooter = function (_a) {
@@ -1700,10 +1703,11 @@ var AlertContent = DialogContent;
1700
1703
  var AlertActions = DialogFooter;
1701
1704
 
1702
1705
  var Modal = function (_a) {
1703
- var children = _a.children, className = _a.className, variant = _a.variant, other = tslib.__rest(_a, ["children", "className", "variant"]);
1706
+ var children = _a.children, className = _a.className, variant = _a.variant, scrollable = _a.scrollable, other = tslib.__rest(_a, ["children", "className", "variant", "scrollable"]);
1704
1707
  return (React__default["default"].createElement(Dialog, tslib.__assign({ className: classNames__default["default"]('Modal', className, {
1705
- 'Modal--info': variant === 'info'
1706
- }) }, other, { forceAction: false }), children));
1708
+ 'Modal--info': variant === 'info',
1709
+ 'Modal--scrollable': scrollable
1710
+ }) }, other, { scrollable: scrollable, forceAction: false }), children));
1707
1711
  };
1708
1712
  var ModalHeader = DialogHeader;
1709
1713
  var ModalHeading = DialogHeading;
@@ -2029,10 +2033,17 @@ function Tooltip(_a) {
2029
2033
  fireCustomEvent(false, targetElement);
2030
2034
  }, TIP_HIDE_DELAY);
2031
2035
  }
2036
+ }, [target]);
2037
+ // Cancel any pending hide timeout when the Tooltip unmounts so it
2038
+ // does not fire setShowTooltip on an unmounted component.
2039
+ React.useEffect(function () {
2032
2040
  return function () {
2033
- clearTimeout(hideTimeoutRef.current);
2041
+ if (hideTimeoutRef.current) {
2042
+ clearTimeout(hideTimeoutRef.current);
2043
+ hideTimeoutRef.current = null;
2044
+ }
2034
2045
  };
2035
- }, [target]);
2046
+ }, []);
2036
2047
  React.useEffect(function () {
2037
2048
  if (typeof showProp === 'boolean') {
2038
2049
  setShowTooltip(showProp);
@@ -2119,7 +2130,7 @@ var looksLikeLink = function (props) {
2119
2130
  return 'to' in props || 'href' in props;
2120
2131
  };
2121
2132
  var IconButton = React.forwardRef(function (_a, ref) {
2122
- var _b = _a.as, Component = _b === void 0 ? 'button' : _b, icon = _a.icon, label = _a.label, tooltipPlacement = _a.tooltipPlacement, tooltipVariant = _a.tooltipVariant, tooltipPortal = _a.tooltipPortal, _c = _a.tooltipProps, tooltipPropsProp = _c === void 0 ? {} : _c, className = _a.className, _d = _a.variant, variant = _d === void 0 ? 'secondary' : _d, disabled = _a.disabled, _e = _a.tabIndex, tabIndex = _e === void 0 ? 0 : _e, large = _a.large, other = tslib.__rest(_a, ["as", "icon", "label", "tooltipPlacement", "tooltipVariant", "tooltipPortal", "tooltipProps", "className", "variant", "disabled", "tabIndex", "large"]);
2133
+ var _b = _a.as, Component = _b === void 0 ? 'button' : _b, icon = _a.icon, label = _a.label, _c = _a.tooltipProps, tooltipPropsProp = _c === void 0 ? {} : _c, className = _a.className, _d = _a.variant, variant = _d === void 0 ? 'secondary' : _d, disabled = _a.disabled, _e = _a.tabIndex, tabIndex = _e === void 0 ? 0 : _e, large = _a.large, other = tslib.__rest(_a, ["as", "icon", "label", "tooltipProps", "className", "variant", "disabled", "tabIndex", "large"]);
2123
2134
  var internalRef = React.useRef();
2124
2135
  React.useImperativeHandle(ref, function () { return internalRef.current; });
2125
2136
  // Configure additional properties based on the type of the Component
@@ -2137,15 +2148,7 @@ var IconButton = React.forwardRef(function (_a, ref) {
2137
2148
  accessibilityProps['aria-disabled'] = disabled;
2138
2149
  }
2139
2150
  }
2140
- if (process.env.NODE_ENV !== 'production') {
2141
- if (!!tooltipPlacement || !!tooltipVariant || !!tooltipPortal) {
2142
- React__default["default"].useEffect(function () {
2143
- console.warn('[IconButton] The following props are deprecated: tooltipPlacement, tooltipVariant, tooltipPortal. ' +
2144
- 'See https://cauldron.dequelabs.com/components/IconButton for recommended replacement.');
2145
- }, []);
2146
- }
2147
- }
2148
- var tooltipProps = tslib.__assign({ placement: tooltipPlacement || 'auto', variant: tooltipVariant, portal: tooltipPortal, association: 'aria-labelledby', hideElementOnHidden: true }, tooltipPropsProp);
2151
+ var tooltipProps = tslib.__assign({ placement: 'auto', association: 'aria-labelledby', hideElementOnHidden: true }, tooltipPropsProp);
2149
2152
  return (React__default["default"].createElement(React__default["default"].Fragment, null,
2150
2153
  React__default["default"].createElement(Component, tslib.__assign({ className: classNames__default["default"](className, {
2151
2154
  IconButton: true,
@@ -2217,126 +2220,110 @@ var tabIndexHandler = function (reset, toast) {
2217
2220
  };
2218
2221
 
2219
2222
  /**
2220
- * The cauldron toast notification component
2223
+ * Hook to be used similarly to the React.Component#componentDidMount.
2224
+ * Executes the provided `effect` when `dependencies` change but does not
2225
+ * execute the effect initially (on mount) - only on update.
2226
+ *
2227
+ * @param effect {Function} function to be executed when dependencies update
2228
+ * @param dependencies {Any} any valid dependency argument to React.useEffect
2221
2229
  */
2222
- var Toast = /** @class */ (function (_super) {
2223
- tslib.__extends(Toast, _super);
2224
- function Toast(props) {
2225
- var _this = _super.call(this, props) || this;
2226
- _this.state = {
2227
- animationClass: props.show ? 'FadeIn--flex' : 'is--hidden'
2228
- };
2229
- _this.dismissToast = _this.dismissToast.bind(_this);
2230
- _this.showToast = _this.showToast.bind(_this);
2231
- return _this;
2232
- }
2233
- Toast.prototype.componentDidMount = function () {
2234
- var show = this.props.show;
2235
- if (show) {
2236
- // Timeout because CSS display: none/block and opacity:
2237
- // 0/1 properties cannot be toggled in the same tick
2238
- // see: https://codepen.io/isnerms/pen/eyQaLP
2239
- setTimeout(this.showToast);
2230
+ var useDidUpdate = function (effect, dependencies) {
2231
+ var mounted = React__default["default"].useRef(false);
2232
+ React__default["default"].useEffect(function () {
2233
+ if (!mounted.current) {
2234
+ mounted.current = true;
2235
+ return;
2240
2236
  }
2237
+ effect();
2238
+ }, dependencies);
2239
+ };
2240
+
2241
+ /**
2242
+ * The cauldron toast notification component
2243
+ */
2244
+ var Toast = function (_a) {
2245
+ var type = _a.type, children = _a.children, _b = _a.onDismiss, onDismiss = _b === void 0 ? function () {
2246
+ // noop
2247
+ } : _b, _c = _a.dismissText, dismissText = _c === void 0 ? 'Dismiss' : _c, toastRef = _a.toastRef, _d = _a.focus, focus = _d === void 0 ? true : _d, _e = _a.show, show = _e === void 0 ? false : _e, _f = _a.dismissible, dismissible = _f === void 0 ? true : _f, className = _a.className, otherProps = tslib.__rest(_a, ["type", "children", "onDismiss", "dismissText", "toastRef", "focus", "show", "dismissible", "className"]);
2248
+ var elRef = useSharedRef(toastRef !== null && toastRef !== void 0 ? toastRef : null);
2249
+ var isolatorRef = React.useRef(null);
2250
+ var timeoutsRef = React.useRef(new Set());
2251
+ var _g = tslib.__read(React.useState(show ? 'FadeIn--flex' : 'is--hidden'), 2), animationClass = _g[0], setAnimationClass = _g[1];
2252
+ // Timeout because CSS display: none/block and opacity:
2253
+ // 0/1 properties cannot be toggled in the same tick
2254
+ // see: https://codepen.io/isnerms/pen/eyQaLP
2255
+ var scheduleNextTick = function (fn) {
2256
+ var id = setTimeout(function () {
2257
+ timeoutsRef.current.delete(id);
2258
+ fn();
2259
+ });
2260
+ timeoutsRef.current.add(id);
2241
2261
  };
2242
- Toast.prototype.componentDidUpdate = function (prevProps) {
2243
- var _this = this;
2244
- var show = this.props.show;
2245
- if (prevProps.show !== show) {
2246
- if (show) {
2247
- this.setState({ animationClass: 'FadeIn--flex' }, function () {
2248
- setTimeout(_this.showToast);
2249
- });
2250
- }
2251
- else {
2252
- this.dismissToast();
2253
- }
2262
+ var showToast = React.useCallback(function () {
2263
+ setAnimationClass('FadeIn--flex FadeIn');
2264
+ if (type === 'action-needed' && elRef.current) {
2265
+ var isolator = new AriaIsolate(elRef.current);
2266
+ tabIndexHandler(false, elRef.current);
2267
+ isolatorRef.current = isolator;
2268
+ isolator.activate();
2254
2269
  }
2255
- };
2256
- Toast.prototype.componentWillUnmount = function () {
2257
- var isolator = this.state.isolator;
2258
- isolator === null || isolator === void 0 ? void 0 : isolator.deactivate();
2259
- };
2260
- Toast.prototype.render = function () {
2261
- var _this = this;
2262
- var animationClass = this.state.animationClass;
2263
- var _a = this.props, type = _a.type, children = _a.children;
2264
- // prevent `onDismiss` from being passed-through to DOM
2265
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
2266
- _a.onDismiss; var dismissText = _a.dismissText, toastRef = _a.toastRef, focus = _a.focus, show = _a.show, dismissible = _a.dismissible, className = _a.className, otherProps = tslib.__rest(_a, ["type", "children", "onDismiss", "dismissText", "toastRef", "focus", "show", "dismissible", "className"]);
2267
- var scrim = type === 'action-needed' && show ? (React__default["default"].createElement("div", { className: "Scrim--light Scrim--show Scrim--fade-in" })) : null;
2268
- var defaultProps = {
2269
- tabIndex: -1,
2270
- className: classNames__default["default"]('Toast', "Toast--".concat(typeMap[type].className), animationClass, { 'Toast--non-dismissible': !dismissible }, className)
2271
- };
2272
- if (!focus) {
2273
- defaultProps.role = 'alert';
2270
+ if (elRef.current && !!focus) {
2271
+ elRef.current.focus();
2274
2272
  }
2275
- return (React__default["default"].createElement(React__default["default"].Fragment, null,
2276
- React__default["default"].createElement("div", tslib.__assign({ ref: function (el) {
2277
- _this.el = el;
2278
- setRef(toastRef, el);
2279
- } }, defaultProps, otherProps),
2280
- React__default["default"].createElement("div", { className: "Toast__message" },
2281
- React__default["default"].createElement(Icon, { type: typeMap[type].icon }),
2282
- React__default["default"].createElement("div", { className: "Toast__message-content" }, children)),
2283
- type !== 'action-needed' && dismissible && (React__default["default"].createElement("button", { type: "button", className: 'Toast__dismiss', "aria-label": dismissText, onClick: this.dismissToast },
2284
- React__default["default"].createElement(Icon, { type: "close" })))),
2285
- scrim));
2286
- };
2287
- Toast.prototype.dismissToast = function () {
2288
- var _this = this;
2289
- if (!this.el) {
2273
+ }, [type, focus]);
2274
+ var dismissToast = React.useCallback(function () {
2275
+ if (!elRef.current) {
2290
2276
  return;
2291
2277
  }
2292
- var _a = this.props, onDismiss = _a.onDismiss, type = _a.type;
2293
- var isolator = this.state.isolator;
2294
- this.setState({
2295
- animationClass: 'FadeIn--flex'
2296
- }, function () {
2297
- // Timeout because CSS display: none/block and opacity:
2298
- // 0/1 properties cannot be toggled in the same tick
2299
- // see: https://codepen.io/isnerms/pen/eyQaLP
2300
- setTimeout(function () {
2301
- if (type === 'action-needed') {
2302
- tabIndexHandler(true, _this.el);
2303
- isolator === null || isolator === void 0 ? void 0 : isolator.deactivate();
2304
- }
2305
- _this.setState({ animationClass: 'is--hidden' }, onDismiss);
2306
- });
2307
- });
2308
- };
2309
- Toast.prototype.showToast = function () {
2310
- var _this = this;
2311
- var _a = this.props, type = _a.type, focus = _a.focus;
2312
- this.setState({
2313
- animationClass: 'FadeIn--flex FadeIn'
2314
- }, function () {
2278
+ setAnimationClass('FadeIn--flex');
2279
+ scheduleNextTick(function () {
2280
+ var _a;
2315
2281
  if (type === 'action-needed') {
2316
- var isolator = new AriaIsolate(_this.el);
2317
- tabIndexHandler(false, _this.el);
2318
- _this.setState({ isolator: isolator });
2319
- isolator.activate();
2320
- }
2321
- if (_this.el && !!focus) {
2322
- // focus the toast
2323
- _this.el.focus();
2282
+ tabIndexHandler(true, elRef.current);
2283
+ (_a = isolatorRef.current) === null || _a === void 0 ? void 0 : _a.deactivate();
2324
2284
  }
2285
+ setAnimationClass('is--hidden');
2286
+ onDismiss();
2325
2287
  });
2288
+ }, [type, onDismiss]);
2289
+ React.useEffect(function () {
2290
+ if (show) {
2291
+ scheduleNextTick(showToast);
2292
+ }
2293
+ return function () {
2294
+ var _a;
2295
+ timeoutsRef.current.forEach(clearTimeout);
2296
+ timeoutsRef.current.clear();
2297
+ (_a = isolatorRef.current) === null || _a === void 0 ? void 0 : _a.deactivate();
2298
+ };
2299
+ }, []);
2300
+ useDidUpdate(function () {
2301
+ if (show) {
2302
+ setAnimationClass('FadeIn--flex');
2303
+ scheduleNextTick(showToast);
2304
+ }
2305
+ else {
2306
+ dismissToast();
2307
+ }
2308
+ }, [show]);
2309
+ var scrim = type === 'action-needed' && show ? (React__default["default"].createElement("div", { className: "Scrim--light Scrim--show Scrim--fade-in" })) : null;
2310
+ var defaultProps = {
2311
+ tabIndex: -1,
2312
+ className: classNames__default["default"]('Toast', "Toast--".concat(typeMap[type].className), animationClass, { 'Toast--non-dismissible': !dismissible }, className)
2326
2313
  };
2327
- Toast.defaultProps = {
2328
- dismissText: 'Dismiss',
2329
- // eslint-disable-next-line @typescript-eslint/no-empty-function
2330
- onDismiss: function () { },
2331
- // eslint-disable-next-line @typescript-eslint/no-empty-function
2332
- toastRef: function () { },
2333
- focus: true,
2334
- show: false,
2335
- dismissible: true
2336
- };
2337
- Toast.displayName = 'Toast';
2338
- return Toast;
2339
- }(React__default["default"].Component));
2314
+ if (!focus) {
2315
+ defaultProps.role = 'alert';
2316
+ }
2317
+ return (React__default["default"].createElement(React__default["default"].Fragment, null,
2318
+ React__default["default"].createElement("div", tslib.__assign({ ref: elRef }, defaultProps, otherProps),
2319
+ React__default["default"].createElement("div", { className: "Toast__message" },
2320
+ React__default["default"].createElement(Icon, { type: typeMap[type].icon }),
2321
+ React__default["default"].createElement("div", { className: "Toast__message-content" }, children)),
2322
+ type !== 'action-needed' && dismissible && (React__default["default"].createElement("button", { type: "button", className: "Toast__dismiss", "aria-label": dismissText, onClick: dismissToast },
2323
+ React__default["default"].createElement(Icon, { type: "close" })))),
2324
+ scrim));
2325
+ };
2326
+ Toast.displayName = 'Toast';
2340
2327
 
2341
2328
  var Link = React.forwardRef(function (_a, ref) {
2342
2329
  var children = _a.children, linkRef = _a.linkRef, className = _a.className, variant = _a.variant, thin = _a.thin, other = tslib.__rest(_a, ["children", "linkRef", "className", "variant", "thin"]);
@@ -3235,25 +3222,6 @@ var Tab = React__default["default"].forwardRef(function (_a, ref) {
3235
3222
  });
3236
3223
  Tab.displayName = 'Tab';
3237
3224
 
3238
- /**
3239
- * Hook to be used similarly to the React.Component#componentDidMount.
3240
- * Executes the provided `effect` when `dependencies` change but does not
3241
- * execute the effect initially (on mount) - only on update.
3242
- *
3243
- * @param effect {Function} function to be executed when dependencies update
3244
- * @param dependencies {Any} any valid dependency argument to React.useEffect
3245
- */
3246
- var useDidUpdate = function (effect, dependencies) {
3247
- var mounted = React__default["default"].useRef(false);
3248
- React__default["default"].useEffect(function () {
3249
- if (!mounted.current) {
3250
- mounted.current = true;
3251
- return;
3252
- }
3253
- effect();
3254
- }, dependencies);
3255
- };
3256
-
3257
3225
  var Tabs = function (_a) {
3258
3226
  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"]);
3259
3227
  var _d = tslib.__read(React.useState(initialActiveIndex), 2), activeIndex = _d[0], setActiveIndex = _d[1];
@@ -4610,16 +4578,6 @@ var Combobox = React.forwardRef(function (_a, ref) {
4610
4578
  : ComboboxNoResults;
4611
4579
  }, [renderNoResults]);
4612
4580
  var noMatchingOptions = !!inputValue && !matchingOptions.size && (React__default["default"].createElement(NoMatchingOptions, null));
4613
- var comboboxListbox = (
4614
- // eslint-disable-next-line
4615
- // @ts-expect-error
4616
- // multiselect & value props are passed to Listbox, but TS is unable to infer that
4617
- // it's a correct mapping from Combobox's multiselect & value props
4618
- React__default["default"].createElement(Listbox, { className: classNames__default["default"]('Combobox__listbox', {
4619
- 'Combobox__listbox--open': open
4620
- }), role: noMatchingOptions ? 'presentation' : 'listbox', "aria-labelledby": noMatchingOptions ? undefined : "".concat(id, "-label"), id: "".concat(id, "-listbox"), value: multiselect ? selectedValues : selectedValues[0], onMouseDown: handleComboboxOptionMouseDown, onClick: handleComboboxOptionClick, onSelectionChange: handleSelectionChange, onActiveChange: handleActiveChange, ref: listboxRef, tabIndex: noMatchingOptions ? undefined : -1, "aria-activedescendant": undefined, multiselect: multiselect, disabled: disabled },
4621
- comboboxOptions,
4622
- noMatchingOptions));
4623
4581
  var errorId = "".concat(id, "-error");
4624
4582
  var descriptionId = "".concat(id, "-description");
4625
4583
  var describedby = ariaDescribedby;
@@ -4630,6 +4588,16 @@ var Combobox = React.forwardRef(function (_a, ref) {
4630
4588
  describedby = addIdRef(describedby, errorId);
4631
4589
  }
4632
4590
  var inputProps = tslib.__assign(tslib.__assign({}, props), { 'aria-describedby': describedby });
4591
+ var comboboxListbox = (
4592
+ // eslint-disable-next-line
4593
+ // @ts-expect-error
4594
+ // multiselect & value props are passed to Listbox, but TS is unable to infer that
4595
+ // it's a correct mapping from Combobox's multiselect & value props
4596
+ React__default["default"].createElement(Listbox, { className: classNames__default["default"]('Combobox__listbox', {
4597
+ 'Combobox__listbox--open': open
4598
+ }), role: noMatchingOptions ? 'presentation' : 'listbox', "aria-labelledby": noMatchingOptions ? undefined : "".concat(id, "-label"), "aria-describedby": describedby, id: "".concat(id, "-listbox"), value: multiselect ? selectedValues : selectedValues[0], onMouseDown: handleComboboxOptionMouseDown, onClick: handleComboboxOptionClick, onSelectionChange: handleSelectionChange, onActiveChange: handleActiveChange, ref: listboxRef, tabIndex: noMatchingOptions ? undefined : -1, "aria-activedescendant": undefined, multiselect: multiselect, disabled: disabled },
4599
+ comboboxOptions,
4600
+ noMatchingOptions));
4633
4601
  return (React__default["default"].createElement("div", { id: id, className: classNames__default["default"]('Combobox', { 'Combobox--multiselect': multiselect }, className), ref: comboboxRef },
4634
4602
  name &&
4635
4603
  formValues.map(function (formValue, index) { return (React__default["default"].createElement("input", { type: "hidden", key: index, name: name, value: formValue })); }),
@@ -4662,7 +4630,7 @@ var Combobox = React.forwardRef(function (_a, ref) {
4662
4630
  };
4663
4631
  return (React__default["default"].createElement(ComboboxPill, { ref: refCallback, key: value, value: value, removeOptionLabel: removeOptionLabels[index], disabled: disabled, onClick: handleClick, onKeyDown: handlePillKeyDown }));
4664
4632
  }),
4665
- React__default["default"].createElement("input", tslib.__assign({ type: "text", id: "".concat(id, "-input"), ref: inputRef, value: inputValue, role: "combobox", disabled: disabled, "aria-autocomplete": !isAutoComplete ? 'none' : 'list', "aria-controls": "".concat(id, "-listbox"), "aria-expanded": open, "aria-haspopup": "listbox", "aria-activedescendant": open && activeDescendant ? activeDescendant.element.id : undefined }, inputProps, { onChange: handleChange, onKeyDown: handleKeyDown, onFocus: handleFocus, onBlur: handleBlur })),
4633
+ React__default["default"].createElement("input", tslib.__assign({ type: "text", id: "".concat(id, "-input"), ref: inputRef, value: inputValue, role: "combobox", disabled: disabled, "aria-invalid": error ? true : undefined, "aria-autocomplete": !isAutoComplete ? 'none' : 'list', "aria-controls": "".concat(id, "-listbox"), "aria-expanded": open, "aria-haspopup": "listbox", "aria-activedescendant": open && activeDescendant ? activeDescendant.element.id : undefined }, inputProps, { onChange: handleChange, onKeyDown: handleKeyDown, onFocus: handleFocus, onBlur: handleBlur })),
4666
4634
  React__default["default"].createElement("span", { className: "Combobox__arrow" })),
4667
4635
  React__default["default"].createElement(ComboboxProvider, { autocomplete: autocomplete, inputValue: inputValue, formValues: formValues, selectedValues: selectedValues, removeOptionLabels: removeOptionLabels, setRemoveOptionLabels: setRemoveOptionLabels, matches: !isAutoComplete || defaultAutoCompleteMatches, matchingOptions: matchingOptions, setMatchingOptions: setMatchingOptions, setFormValues: setFormValues }, portal && typeof document !== 'undefined'
4668
4636
  ? reactDom.createPortal(comboboxListbox,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deque/cauldron-react",
3
- "version": "6.27.0-canary.24bf1e41",
3
+ "version": "6.27.0-canary.34834ec5",
4
4
  "license": "MPL-2.0",
5
5
  "description": "Fully accessible react components library for Deque Cauldron",
6
6
  "homepage": "https://cauldron.dequelabs.com/",