@deque/cauldron-react 6.27.0 → 7.0.0
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.
- package/lib/components/Button/index.d.ts +11 -2
- package/lib/components/CopyButton/index.d.ts +1 -1
- package/lib/components/Dialog/DialogContext.d.ts +1 -0
- package/lib/components/Dialog/index.d.ts +1 -0
- package/lib/components/IconButton/index.d.ts +0 -12
- package/lib/components/Modal/index.d.ts +2 -1
- package/lib/components/Table/TableHeader.d.ts +2 -0
- package/lib/components/Tag/index.d.ts +2 -1
- package/lib/components/TagButton/index.d.ts +4 -2
- package/lib/index.d.ts +1 -1
- package/lib/index.js +42 -45
- package/package.json +1 -1
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
import React, { type ButtonHTMLAttributes, type Ref } from 'react';
|
|
2
|
-
|
|
2
|
+
import type { TagSize } from '../Tag';
|
|
3
|
+
interface ButtonBaseProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
3
4
|
buttonRef?: Ref<HTMLButtonElement>;
|
|
4
|
-
variant?: 'primary' | 'secondary' | 'tertiary' | 'error' | 'danger' | 'danger-secondary' | 'link' | 'tag' | 'badge';
|
|
5
5
|
thin?: boolean;
|
|
6
6
|
}
|
|
7
|
+
interface ButtonTagProps extends ButtonBaseProps {
|
|
8
|
+
variant: 'tag';
|
|
9
|
+
size?: TagSize;
|
|
10
|
+
}
|
|
11
|
+
interface ButtonNonTagProps extends ButtonBaseProps {
|
|
12
|
+
variant?: 'primary' | 'secondary' | 'tertiary' | 'error' | 'danger' | 'danger-secondary' | 'link' | 'badge';
|
|
13
|
+
size?: never;
|
|
14
|
+
}
|
|
15
|
+
export type ButtonProps = ButtonTagProps | ButtonNonTagProps;
|
|
7
16
|
declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
8
17
|
export default Button;
|
|
@@ -3,7 +3,7 @@ import { ContentNode } from '../../types';
|
|
|
3
3
|
import Button from '../Button';
|
|
4
4
|
import Tooltip from '../Tooltip';
|
|
5
5
|
type ButtonProps = React.ComponentProps<typeof Button>;
|
|
6
|
-
export interface CopyButtonProps extends Omit<ButtonProps, 'onCopy' | 'onClick'> {
|
|
6
|
+
export interface CopyButtonProps extends Omit<ButtonProps, 'onCopy' | 'onClick' | 'size'> {
|
|
7
7
|
value: string;
|
|
8
8
|
variant?: Extract<ButtonProps['variant'], 'primary' | 'secondary' | 'tertiary'>;
|
|
9
9
|
children?: ContentNode;
|
|
@@ -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;
|
|
@@ -4,7 +4,9 @@ type SortDirection = 'ascending' | 'descending' | 'none';
|
|
|
4
4
|
interface TableHeaderProps extends Omit<React.ThHTMLAttributes<HTMLTableHeaderCellElement>, 'align'> {
|
|
5
5
|
sortDirection?: SortDirection;
|
|
6
6
|
onSort?: () => void;
|
|
7
|
+
/** @deprecated No longer used. Sort state is communicated via aria-sort. */
|
|
7
8
|
sortAscendingAnnouncement?: string;
|
|
9
|
+
/** @deprecated No longer used. Sort state is communicated via aria-sort. */
|
|
8
10
|
sortDescendingAnnouncement?: string;
|
|
9
11
|
align?: ColumnAlignment;
|
|
10
12
|
variant?: 'header' | 'cell';
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
export type TagSize = 'default' | 'small';
|
|
2
3
|
interface TagProps {
|
|
3
4
|
children: React.ReactNode;
|
|
4
5
|
className?: string;
|
|
5
|
-
size?:
|
|
6
|
+
size?: TagSize;
|
|
6
7
|
}
|
|
7
8
|
export declare const TagLabel: {
|
|
8
9
|
({ children, className, ...other }: TagProps): React.JSX.Element;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { type ButtonHTMLAttributes } from 'react';
|
|
2
2
|
import { IconType } from '../Icon';
|
|
3
3
|
import { ContentNode } from '../../types';
|
|
4
|
-
|
|
4
|
+
import { type TagSize } from '../Tag';
|
|
5
|
+
interface TagButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'value'> {
|
|
5
6
|
label: ContentNode;
|
|
6
7
|
value: ContentNode;
|
|
7
8
|
icon: IconType;
|
|
8
9
|
onClick: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
10
|
+
size?: TagSize;
|
|
9
11
|
}
|
|
10
12
|
declare const TagButton: React.ForwardRefExoticComponent<TagButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
11
13
|
export default TagButton;
|
package/lib/index.d.ts
CHANGED
|
@@ -37,7 +37,7 @@ export { default as Sidebar, SideBarItem } from './components/SideBar';
|
|
|
37
37
|
export { default as Code } from './components/Code';
|
|
38
38
|
export { default as LoaderOverlay } from './components/LoaderOverlay';
|
|
39
39
|
export { default as Line } from './components/Line';
|
|
40
|
-
export { default as Tag, TagLabel } from './components/Tag';
|
|
40
|
+
export { default as Tag, TagLabel, type TagSize } from './components/Tag';
|
|
41
41
|
export { default as Badge, BadgeLabel } from './components/Badge';
|
|
42
42
|
export { default as ImpactBadge } from './components/ImpactBadge';
|
|
43
43
|
export { default as TagButton } from './components/TagButton';
|
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;
|
|
@@ -1768,7 +1772,7 @@ var SkipLink = /** @class */ (function (_super) {
|
|
|
1768
1772
|
}(React__default["default"].Component));
|
|
1769
1773
|
|
|
1770
1774
|
var Button = React.forwardRef(function (_a, ref) {
|
|
1771
|
-
var _b = _a.variant, variant = _b === void 0 ? 'primary' : _b, thin = _a.thin, children = _a.children, className = _a.className, buttonRef = _a.buttonRef, other = tslib.__rest(_a, ["variant", "thin", "children", "className", "buttonRef"]);
|
|
1775
|
+
var _b = _a.variant, variant = _b === void 0 ? 'primary' : _b, thin = _a.thin, size = _a.size, children = _a.children, className = _a.className, buttonRef = _a.buttonRef, other = tslib.__rest(_a, ["variant", "thin", "size", "children", "className", "buttonRef"]);
|
|
1772
1776
|
return (React__default["default"].createElement("button", tslib.__assign({ type: "button", className: classNames__default["default"](className, {
|
|
1773
1777
|
'Button--primary': variant === 'primary',
|
|
1774
1778
|
'Button--secondary': variant === 'secondary',
|
|
@@ -1779,6 +1783,7 @@ var Button = React.forwardRef(function (_a, ref) {
|
|
|
1779
1783
|
Link: variant === 'link',
|
|
1780
1784
|
Tag: variant === 'tag',
|
|
1781
1785
|
'Button--tag': variant === 'tag',
|
|
1786
|
+
'Tag--small': variant === 'tag' && size === 'small',
|
|
1782
1787
|
'Button--thin': thin,
|
|
1783
1788
|
'Button--badge': variant === 'badge'
|
|
1784
1789
|
}), ref: ref || buttonRef }, other), children));
|
|
@@ -2118,7 +2123,7 @@ var looksLikeLink = function (props) {
|
|
|
2118
2123
|
return 'to' in props || 'href' in props;
|
|
2119
2124
|
};
|
|
2120
2125
|
var IconButton = React.forwardRef(function (_a, ref) {
|
|
2121
|
-
var _b = _a.as, Component = _b === void 0 ? 'button' : _b, icon = _a.icon, label = _a.label,
|
|
2126
|
+
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"]);
|
|
2122
2127
|
var internalRef = React.useRef();
|
|
2123
2128
|
React.useImperativeHandle(ref, function () { return internalRef.current; });
|
|
2124
2129
|
// Configure additional properties based on the type of the Component
|
|
@@ -2136,15 +2141,7 @@ var IconButton = React.forwardRef(function (_a, ref) {
|
|
|
2136
2141
|
accessibilityProps['aria-disabled'] = disabled;
|
|
2137
2142
|
}
|
|
2138
2143
|
}
|
|
2139
|
-
|
|
2140
|
-
if (!!tooltipPlacement || !!tooltipVariant || !!tooltipPortal) {
|
|
2141
|
-
React__default["default"].useEffect(function () {
|
|
2142
|
-
console.warn('[IconButton] The following props are deprecated: tooltipPlacement, tooltipVariant, tooltipPortal. ' +
|
|
2143
|
-
'See https://cauldron.dequelabs.com/components/IconButton for recommended replacement.');
|
|
2144
|
-
}, []);
|
|
2145
|
-
}
|
|
2146
|
-
}
|
|
2147
|
-
var tooltipProps = tslib.__assign({ placement: tooltipPlacement || 'auto', variant: tooltipVariant, portal: tooltipPortal, association: 'aria-labelledby', hideElementOnHidden: true }, tooltipPropsProp);
|
|
2144
|
+
var tooltipProps = tslib.__assign({ placement: 'auto', association: 'aria-labelledby', hideElementOnHidden: true }, tooltipPropsProp);
|
|
2148
2145
|
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
2149
2146
|
React__default["default"].createElement(Component, tslib.__assign({ className: classNames__default["default"](className, {
|
|
2150
2147
|
IconButton: true,
|
|
@@ -3042,8 +3039,8 @@ var ImpactBadge = React.forwardRef(function (_a, ref) {
|
|
|
3042
3039
|
ImpactBadge.displayName = 'ImpactBadge';
|
|
3043
3040
|
|
|
3044
3041
|
var TagButton = React__default["default"].forwardRef(function (_a, ref) {
|
|
3045
|
-
var label = _a.label, value = _a.value, icon = _a.icon, className = _a.className, rest = tslib.__rest(_a, ["label", "value", "icon", "className"]);
|
|
3046
|
-
return (React__default["default"].createElement(Button, tslib.__assign({ variant: "tag", className: classNames__default["default"]('TagButton', className), ref: ref }, rest),
|
|
3042
|
+
var label = _a.label, value = _a.value, icon = _a.icon, className = _a.className, size = _a.size, rest = tslib.__rest(_a, ["label", "value", "icon", "className", "size"]);
|
|
3043
|
+
return (React__default["default"].createElement(Button, tslib.__assign({ variant: "tag", className: classNames__default["default"]('TagButton', className), size: size, ref: ref }, rest),
|
|
3047
3044
|
React__default["default"].createElement(TagLabel, null, label),
|
|
3048
3045
|
value,
|
|
3049
3046
|
React__default["default"].createElement(Icon, { className: "TagButton__icon", type: icon })));
|
|
@@ -3186,23 +3183,25 @@ var TableHead = React.forwardRef(function (_a, ref) {
|
|
|
3186
3183
|
TableHead.displayName = 'TableHead';
|
|
3187
3184
|
|
|
3188
3185
|
var TableHeader = React.forwardRef(function (_a, ref) {
|
|
3189
|
-
var children = _a.children, sortDirection = _a.sortDirection, onSort = _a.onSort, className = _a.className,
|
|
3186
|
+
var children = _a.children, sortDirection = _a.sortDirection, onSort = _a.onSort, className = _a.className, _sortAscendingAnnouncement = _a.sortAscendingAnnouncement, _sortDescendingAnnouncement = _a.sortDescendingAnnouncement, align = _a.align, _b = _a.variant, variant = _b === void 0 ? 'header' : _b, style = _a.style, other = tslib.__rest(_a, ["children", "sortDirection", "onSort", "className", "sortAscendingAnnouncement", "sortDescendingAnnouncement", "align", "variant", "style"]);
|
|
3190
3187
|
var tableHeaderRef = useSharedRef(ref);
|
|
3191
|
-
var
|
|
3188
|
+
var _c = useTable(), layout = _c.layout, columns = _c.columns;
|
|
3192
3189
|
var tableGridStyles = useTableGridStyles({
|
|
3193
3190
|
elementRef: tableHeaderRef,
|
|
3194
3191
|
align: align,
|
|
3195
3192
|
columns: columns,
|
|
3196
3193
|
layout: layout
|
|
3197
3194
|
});
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3195
|
+
React.useEffect(function () {
|
|
3196
|
+
if (process.env.NODE_ENV === 'production')
|
|
3197
|
+
return;
|
|
3198
|
+
if (_sortAscendingAnnouncement !== undefined ||
|
|
3199
|
+
_sortDescendingAnnouncement !== undefined) {
|
|
3200
|
+
console.warn('[TableHeader] The following props are deprecated and no longer used: sortAscendingAnnouncement, sortDescendingAnnouncement. ' +
|
|
3201
|
+
'Sort state is communicated via aria-sort. ' +
|
|
3202
|
+
'See https://cauldron.dequelabs.com/components/Table for more information.');
|
|
3203
|
+
}
|
|
3204
|
+
}, [_sortAscendingAnnouncement, _sortDescendingAnnouncement]);
|
|
3206
3205
|
return (React__default["default"].createElement("th", tslib.__assign({ ref: tableHeaderRef, "aria-sort": sortDirection, className: classNames__default["default"](variant === 'cell'
|
|
3207
3206
|
? ['TableCell', 'TableHeader--cell-variant']
|
|
3208
3207
|
: 'TableHeader', className, {
|
|
@@ -3210,9 +3209,7 @@ var TableHeader = React.forwardRef(function (_a, ref) {
|
|
|
3210
3209
|
'TableHeader--sort-descending': sortDirection === 'descending'
|
|
3211
3210
|
}), style: tslib.__assign(tslib.__assign({}, tableGridStyles), style) }, other), !!onSort && !!sortDirection ? (React__default["default"].createElement("button", { onClick: onSort, className: "TableHeader__sort-button", type: "button" },
|
|
3212
3211
|
children,
|
|
3213
|
-
React__default["default"].createElement("span", { "aria-hidden": "true" }, sortDirection === 'none' ? (React__default["default"].createElement(Icon, { type: "sort-triangle" })) : sortDirection === 'ascending' ? (React__default["default"].createElement(Icon, { type: "table-sort-ascending" })) : (React__default["default"].createElement(Icon, { type: "table-sort-descending" })))
|
|
3214
|
-
React__default["default"].createElement(Offscreen, null,
|
|
3215
|
-
React__default["default"].createElement("span", { role: "status", "aria-live": "polite" }, announcement)))) : (children)));
|
|
3212
|
+
React__default["default"].createElement("span", { "aria-hidden": "true" }, sortDirection === 'none' ? (React__default["default"].createElement(Icon, { type: "sort-triangle" })) : sortDirection === 'ascending' ? (React__default["default"].createElement(Icon, { type: "table-sort-ascending" })) : (React__default["default"].createElement(Icon, { type: "table-sort-descending" }))))) : (children)));
|
|
3216
3213
|
});
|
|
3217
3214
|
TableHeader.displayName = 'TableHeader';
|
|
3218
3215
|
|
|
@@ -4609,16 +4606,6 @@ var Combobox = React.forwardRef(function (_a, ref) {
|
|
|
4609
4606
|
: ComboboxNoResults;
|
|
4610
4607
|
}, [renderNoResults]);
|
|
4611
4608
|
var noMatchingOptions = !!inputValue && !matchingOptions.size && (React__default["default"].createElement(NoMatchingOptions, null));
|
|
4612
|
-
var comboboxListbox = (
|
|
4613
|
-
// eslint-disable-next-line
|
|
4614
|
-
// @ts-expect-error
|
|
4615
|
-
// multiselect & value props are passed to Listbox, but TS is unable to infer that
|
|
4616
|
-
// it's a correct mapping from Combobox's multiselect & value props
|
|
4617
|
-
React__default["default"].createElement(Listbox, { className: classNames__default["default"]('Combobox__listbox', {
|
|
4618
|
-
'Combobox__listbox--open': open
|
|
4619
|
-
}), 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 },
|
|
4620
|
-
comboboxOptions,
|
|
4621
|
-
noMatchingOptions));
|
|
4622
4609
|
var errorId = "".concat(id, "-error");
|
|
4623
4610
|
var descriptionId = "".concat(id, "-description");
|
|
4624
4611
|
var describedby = ariaDescribedby;
|
|
@@ -4629,6 +4616,16 @@ var Combobox = React.forwardRef(function (_a, ref) {
|
|
|
4629
4616
|
describedby = addIdRef(describedby, errorId);
|
|
4630
4617
|
}
|
|
4631
4618
|
var inputProps = tslib.__assign(tslib.__assign({}, props), { 'aria-describedby': describedby });
|
|
4619
|
+
var comboboxListbox = (
|
|
4620
|
+
// eslint-disable-next-line
|
|
4621
|
+
// @ts-expect-error
|
|
4622
|
+
// multiselect & value props are passed to Listbox, but TS is unable to infer that
|
|
4623
|
+
// it's a correct mapping from Combobox's multiselect & value props
|
|
4624
|
+
React__default["default"].createElement(Listbox, { className: classNames__default["default"]('Combobox__listbox', {
|
|
4625
|
+
'Combobox__listbox--open': open
|
|
4626
|
+
}), 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 },
|
|
4627
|
+
comboboxOptions,
|
|
4628
|
+
noMatchingOptions));
|
|
4632
4629
|
return (React__default["default"].createElement("div", { id: id, className: classNames__default["default"]('Combobox', { 'Combobox--multiselect': multiselect }, className), ref: comboboxRef },
|
|
4633
4630
|
name &&
|
|
4634
4631
|
formValues.map(function (formValue, index) { return (React__default["default"].createElement("input", { type: "hidden", key: index, name: name, value: formValue })); }),
|
|
@@ -4661,7 +4658,7 @@ var Combobox = React.forwardRef(function (_a, ref) {
|
|
|
4661
4658
|
};
|
|
4662
4659
|
return (React__default["default"].createElement(ComboboxPill, { ref: refCallback, key: value, value: value, removeOptionLabel: removeOptionLabels[index], disabled: disabled, onClick: handleClick, onKeyDown: handlePillKeyDown }));
|
|
4663
4660
|
}),
|
|
4664
|
-
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 })),
|
|
4661
|
+
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 })),
|
|
4665
4662
|
React__default["default"].createElement("span", { className: "Combobox__arrow" })),
|
|
4666
4663
|
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'
|
|
4667
4664
|
? reactDom.createPortal(comboboxListbox,
|