@deque/cauldron-react 6.27.0-canary.7fd2f1e5 → 6.27.0-canary.90942368
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.
|
@@ -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;
|
|
@@ -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
|
|
4
|
+
onDismiss?: () => void;
|
|
6
5
|
dismissText?: string;
|
|
7
|
-
toastRef
|
|
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
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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 =
|
|
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
|
|
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
|
-
|
|
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;
|
|
@@ -2209,126 +2213,110 @@ var tabIndexHandler = function (reset, toast) {
|
|
|
2209
2213
|
};
|
|
2210
2214
|
|
|
2211
2215
|
/**
|
|
2212
|
-
*
|
|
2216
|
+
* Hook to be used similarly to the React.Component#componentDidMount.
|
|
2217
|
+
* Executes the provided `effect` when `dependencies` change but does not
|
|
2218
|
+
* execute the effect initially (on mount) - only on update.
|
|
2219
|
+
*
|
|
2220
|
+
* @param effect {Function} function to be executed when dependencies update
|
|
2221
|
+
* @param dependencies {Any} any valid dependency argument to React.useEffect
|
|
2213
2222
|
*/
|
|
2214
|
-
var
|
|
2215
|
-
|
|
2216
|
-
function
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
};
|
|
2221
|
-
_this.dismissToast = _this.dismissToast.bind(_this);
|
|
2222
|
-
_this.showToast = _this.showToast.bind(_this);
|
|
2223
|
-
return _this;
|
|
2224
|
-
}
|
|
2225
|
-
Toast.prototype.componentDidMount = function () {
|
|
2226
|
-
var show = this.props.show;
|
|
2227
|
-
if (show) {
|
|
2228
|
-
// Timeout because CSS display: none/block and opacity:
|
|
2229
|
-
// 0/1 properties cannot be toggled in the same tick
|
|
2230
|
-
// see: https://codepen.io/isnerms/pen/eyQaLP
|
|
2231
|
-
setTimeout(this.showToast);
|
|
2223
|
+
var useDidUpdate = function (effect, dependencies) {
|
|
2224
|
+
var mounted = React__default["default"].useRef(false);
|
|
2225
|
+
React__default["default"].useEffect(function () {
|
|
2226
|
+
if (!mounted.current) {
|
|
2227
|
+
mounted.current = true;
|
|
2228
|
+
return;
|
|
2232
2229
|
}
|
|
2230
|
+
effect();
|
|
2231
|
+
}, dependencies);
|
|
2232
|
+
};
|
|
2233
|
+
|
|
2234
|
+
/**
|
|
2235
|
+
* The cauldron toast notification component
|
|
2236
|
+
*/
|
|
2237
|
+
var Toast = function (_a) {
|
|
2238
|
+
var type = _a.type, children = _a.children, _b = _a.onDismiss, onDismiss = _b === void 0 ? function () {
|
|
2239
|
+
// noop
|
|
2240
|
+
} : _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"]);
|
|
2241
|
+
var elRef = useSharedRef(toastRef !== null && toastRef !== void 0 ? toastRef : null);
|
|
2242
|
+
var isolatorRef = React.useRef(null);
|
|
2243
|
+
var timeoutsRef = React.useRef(new Set());
|
|
2244
|
+
var _g = tslib.__read(React.useState(show ? 'FadeIn--flex' : 'is--hidden'), 2), animationClass = _g[0], setAnimationClass = _g[1];
|
|
2245
|
+
// Timeout because CSS display: none/block and opacity:
|
|
2246
|
+
// 0/1 properties cannot be toggled in the same tick
|
|
2247
|
+
// see: https://codepen.io/isnerms/pen/eyQaLP
|
|
2248
|
+
var scheduleNextTick = function (fn) {
|
|
2249
|
+
var id = setTimeout(function () {
|
|
2250
|
+
timeoutsRef.current.delete(id);
|
|
2251
|
+
fn();
|
|
2252
|
+
});
|
|
2253
|
+
timeoutsRef.current.add(id);
|
|
2233
2254
|
};
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
});
|
|
2242
|
-
}
|
|
2243
|
-
else {
|
|
2244
|
-
this.dismissToast();
|
|
2245
|
-
}
|
|
2255
|
+
var showToast = React.useCallback(function () {
|
|
2256
|
+
setAnimationClass('FadeIn--flex FadeIn');
|
|
2257
|
+
if (type === 'action-needed' && elRef.current) {
|
|
2258
|
+
var isolator = new AriaIsolate(elRef.current);
|
|
2259
|
+
tabIndexHandler(false, elRef.current);
|
|
2260
|
+
isolatorRef.current = isolator;
|
|
2261
|
+
isolator.activate();
|
|
2246
2262
|
}
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
var isolator = this.state.isolator;
|
|
2250
|
-
isolator === null || isolator === void 0 ? void 0 : isolator.deactivate();
|
|
2251
|
-
};
|
|
2252
|
-
Toast.prototype.render = function () {
|
|
2253
|
-
var _this = this;
|
|
2254
|
-
var animationClass = this.state.animationClass;
|
|
2255
|
-
var _a = this.props, type = _a.type, children = _a.children;
|
|
2256
|
-
// prevent `onDismiss` from being passed-through to DOM
|
|
2257
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2258
|
-
_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"]);
|
|
2259
|
-
var scrim = type === 'action-needed' && show ? (React__default["default"].createElement("div", { className: "Scrim--light Scrim--show Scrim--fade-in" })) : null;
|
|
2260
|
-
var defaultProps = {
|
|
2261
|
-
tabIndex: -1,
|
|
2262
|
-
className: classNames__default["default"]('Toast', "Toast--".concat(typeMap[type].className), animationClass, { 'Toast--non-dismissible': !dismissible }, className)
|
|
2263
|
-
};
|
|
2264
|
-
if (!focus) {
|
|
2265
|
-
defaultProps.role = 'alert';
|
|
2263
|
+
if (elRef.current && !!focus) {
|
|
2264
|
+
elRef.current.focus();
|
|
2266
2265
|
}
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
setRef(toastRef, el);
|
|
2271
|
-
} }, defaultProps, otherProps),
|
|
2272
|
-
React__default["default"].createElement("div", { className: "Toast__message" },
|
|
2273
|
-
React__default["default"].createElement(Icon, { type: typeMap[type].icon }),
|
|
2274
|
-
React__default["default"].createElement("div", { className: "Toast__message-content" }, children)),
|
|
2275
|
-
type !== 'action-needed' && dismissible && (React__default["default"].createElement("button", { type: "button", className: 'Toast__dismiss', "aria-label": dismissText, onClick: this.dismissToast },
|
|
2276
|
-
React__default["default"].createElement(Icon, { type: "close" })))),
|
|
2277
|
-
scrim));
|
|
2278
|
-
};
|
|
2279
|
-
Toast.prototype.dismissToast = function () {
|
|
2280
|
-
var _this = this;
|
|
2281
|
-
if (!this.el) {
|
|
2266
|
+
}, [type, focus]);
|
|
2267
|
+
var dismissToast = React.useCallback(function () {
|
|
2268
|
+
if (!elRef.current) {
|
|
2282
2269
|
return;
|
|
2283
2270
|
}
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
animationClass: 'FadeIn--flex'
|
|
2288
|
-
}, function () {
|
|
2289
|
-
// Timeout because CSS display: none/block and opacity:
|
|
2290
|
-
// 0/1 properties cannot be toggled in the same tick
|
|
2291
|
-
// see: https://codepen.io/isnerms/pen/eyQaLP
|
|
2292
|
-
setTimeout(function () {
|
|
2293
|
-
if (type === 'action-needed') {
|
|
2294
|
-
tabIndexHandler(true, _this.el);
|
|
2295
|
-
isolator === null || isolator === void 0 ? void 0 : isolator.deactivate();
|
|
2296
|
-
}
|
|
2297
|
-
_this.setState({ animationClass: 'is--hidden' }, onDismiss);
|
|
2298
|
-
});
|
|
2299
|
-
});
|
|
2300
|
-
};
|
|
2301
|
-
Toast.prototype.showToast = function () {
|
|
2302
|
-
var _this = this;
|
|
2303
|
-
var _a = this.props, type = _a.type, focus = _a.focus;
|
|
2304
|
-
this.setState({
|
|
2305
|
-
animationClass: 'FadeIn--flex FadeIn'
|
|
2306
|
-
}, function () {
|
|
2271
|
+
setAnimationClass('FadeIn--flex');
|
|
2272
|
+
scheduleNextTick(function () {
|
|
2273
|
+
var _a;
|
|
2307
2274
|
if (type === 'action-needed') {
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
_this.setState({ isolator: isolator });
|
|
2311
|
-
isolator.activate();
|
|
2312
|
-
}
|
|
2313
|
-
if (_this.el && !!focus) {
|
|
2314
|
-
// focus the toast
|
|
2315
|
-
_this.el.focus();
|
|
2275
|
+
tabIndexHandler(true, elRef.current);
|
|
2276
|
+
(_a = isolatorRef.current) === null || _a === void 0 ? void 0 : _a.deactivate();
|
|
2316
2277
|
}
|
|
2278
|
+
setAnimationClass('is--hidden');
|
|
2279
|
+
onDismiss();
|
|
2317
2280
|
});
|
|
2281
|
+
}, [type, onDismiss]);
|
|
2282
|
+
React.useEffect(function () {
|
|
2283
|
+
if (show) {
|
|
2284
|
+
scheduleNextTick(showToast);
|
|
2285
|
+
}
|
|
2286
|
+
return function () {
|
|
2287
|
+
var _a;
|
|
2288
|
+
timeoutsRef.current.forEach(clearTimeout);
|
|
2289
|
+
timeoutsRef.current.clear();
|
|
2290
|
+
(_a = isolatorRef.current) === null || _a === void 0 ? void 0 : _a.deactivate();
|
|
2291
|
+
};
|
|
2292
|
+
}, []);
|
|
2293
|
+
useDidUpdate(function () {
|
|
2294
|
+
if (show) {
|
|
2295
|
+
setAnimationClass('FadeIn--flex');
|
|
2296
|
+
scheduleNextTick(showToast);
|
|
2297
|
+
}
|
|
2298
|
+
else {
|
|
2299
|
+
dismissToast();
|
|
2300
|
+
}
|
|
2301
|
+
}, [show]);
|
|
2302
|
+
var scrim = type === 'action-needed' && show ? (React__default["default"].createElement("div", { className: "Scrim--light Scrim--show Scrim--fade-in" })) : null;
|
|
2303
|
+
var defaultProps = {
|
|
2304
|
+
tabIndex: -1,
|
|
2305
|
+
className: classNames__default["default"]('Toast', "Toast--".concat(typeMap[type].className), animationClass, { 'Toast--non-dismissible': !dismissible }, className)
|
|
2318
2306
|
};
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2307
|
+
if (!focus) {
|
|
2308
|
+
defaultProps.role = 'alert';
|
|
2309
|
+
}
|
|
2310
|
+
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
2311
|
+
React__default["default"].createElement("div", tslib.__assign({ ref: elRef }, defaultProps, otherProps),
|
|
2312
|
+
React__default["default"].createElement("div", { className: "Toast__message" },
|
|
2313
|
+
React__default["default"].createElement(Icon, { type: typeMap[type].icon }),
|
|
2314
|
+
React__default["default"].createElement("div", { className: "Toast__message-content" }, children)),
|
|
2315
|
+
type !== 'action-needed' && dismissible && (React__default["default"].createElement("button", { type: "button", className: "Toast__dismiss", "aria-label": dismissText, onClick: dismissToast },
|
|
2316
|
+
React__default["default"].createElement(Icon, { type: "close" })))),
|
|
2317
|
+
scrim));
|
|
2318
|
+
};
|
|
2319
|
+
Toast.displayName = 'Toast';
|
|
2332
2320
|
|
|
2333
2321
|
var Link = React.forwardRef(function (_a, ref) {
|
|
2334
2322
|
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"]);
|
|
@@ -3227,25 +3215,6 @@ var Tab = React__default["default"].forwardRef(function (_a, ref) {
|
|
|
3227
3215
|
});
|
|
3228
3216
|
Tab.displayName = 'Tab';
|
|
3229
3217
|
|
|
3230
|
-
/**
|
|
3231
|
-
* Hook to be used similarly to the React.Component#componentDidMount.
|
|
3232
|
-
* Executes the provided `effect` when `dependencies` change but does not
|
|
3233
|
-
* execute the effect initially (on mount) - only on update.
|
|
3234
|
-
*
|
|
3235
|
-
* @param effect {Function} function to be executed when dependencies update
|
|
3236
|
-
* @param dependencies {Any} any valid dependency argument to React.useEffect
|
|
3237
|
-
*/
|
|
3238
|
-
var useDidUpdate = function (effect, dependencies) {
|
|
3239
|
-
var mounted = React__default["default"].useRef(false);
|
|
3240
|
-
React__default["default"].useEffect(function () {
|
|
3241
|
-
if (!mounted.current) {
|
|
3242
|
-
mounted.current = true;
|
|
3243
|
-
return;
|
|
3244
|
-
}
|
|
3245
|
-
effect();
|
|
3246
|
-
}, dependencies);
|
|
3247
|
-
};
|
|
3248
|
-
|
|
3249
3218
|
var Tabs = function (_a) {
|
|
3250
3219
|
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"]);
|
|
3251
3220
|
var _d = tslib.__read(React.useState(initialActiveIndex), 2), activeIndex = _d[0], setActiveIndex = _d[1];
|
|
@@ -4602,16 +4571,6 @@ var Combobox = React.forwardRef(function (_a, ref) {
|
|
|
4602
4571
|
: ComboboxNoResults;
|
|
4603
4572
|
}, [renderNoResults]);
|
|
4604
4573
|
var noMatchingOptions = !!inputValue && !matchingOptions.size && (React__default["default"].createElement(NoMatchingOptions, null));
|
|
4605
|
-
var comboboxListbox = (
|
|
4606
|
-
// eslint-disable-next-line
|
|
4607
|
-
// @ts-expect-error
|
|
4608
|
-
// multiselect & value props are passed to Listbox, but TS is unable to infer that
|
|
4609
|
-
// it's a correct mapping from Combobox's multiselect & value props
|
|
4610
|
-
React__default["default"].createElement(Listbox, { className: classNames__default["default"]('Combobox__listbox', {
|
|
4611
|
-
'Combobox__listbox--open': open
|
|
4612
|
-
}), 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 },
|
|
4613
|
-
comboboxOptions,
|
|
4614
|
-
noMatchingOptions));
|
|
4615
4574
|
var errorId = "".concat(id, "-error");
|
|
4616
4575
|
var descriptionId = "".concat(id, "-description");
|
|
4617
4576
|
var describedby = ariaDescribedby;
|
|
@@ -4622,6 +4581,16 @@ var Combobox = React.forwardRef(function (_a, ref) {
|
|
|
4622
4581
|
describedby = addIdRef(describedby, errorId);
|
|
4623
4582
|
}
|
|
4624
4583
|
var inputProps = tslib.__assign(tslib.__assign({}, props), { 'aria-describedby': describedby });
|
|
4584
|
+
var comboboxListbox = (
|
|
4585
|
+
// eslint-disable-next-line
|
|
4586
|
+
// @ts-expect-error
|
|
4587
|
+
// multiselect & value props are passed to Listbox, but TS is unable to infer that
|
|
4588
|
+
// it's a correct mapping from Combobox's multiselect & value props
|
|
4589
|
+
React__default["default"].createElement(Listbox, { className: classNames__default["default"]('Combobox__listbox', {
|
|
4590
|
+
'Combobox__listbox--open': open
|
|
4591
|
+
}), 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 },
|
|
4592
|
+
comboboxOptions,
|
|
4593
|
+
noMatchingOptions));
|
|
4625
4594
|
return (React__default["default"].createElement("div", { id: id, className: classNames__default["default"]('Combobox', { 'Combobox--multiselect': multiselect }, className), ref: comboboxRef },
|
|
4626
4595
|
name &&
|
|
4627
4596
|
formValues.map(function (formValue, index) { return (React__default["default"].createElement("input", { type: "hidden", key: index, name: name, value: formValue })); }),
|
|
@@ -4654,7 +4623,7 @@ var Combobox = React.forwardRef(function (_a, ref) {
|
|
|
4654
4623
|
};
|
|
4655
4624
|
return (React__default["default"].createElement(ComboboxPill, { ref: refCallback, key: value, value: value, removeOptionLabel: removeOptionLabels[index], disabled: disabled, onClick: handleClick, onKeyDown: handlePillKeyDown }));
|
|
4656
4625
|
}),
|
|
4657
|
-
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 })),
|
|
4626
|
+
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 })),
|
|
4658
4627
|
React__default["default"].createElement("span", { className: "Combobox__arrow" })),
|
|
4659
4628
|
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'
|
|
4660
4629
|
? 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.
|
|
3
|
+
"version": "6.27.0-canary.90942368",
|
|
4
4
|
"license": "MPL-2.0",
|
|
5
5
|
"description": "Fully accessible react components library for Deque Cauldron",
|
|
6
6
|
"homepage": "https://cauldron.dequelabs.com/",
|