@deque/cauldron-react 6.3.2 → 6.4.0-canary.0f061da6
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { PolymorphicProps, PolymorphicComponent } from '../../utils/polymorphicComponent';
|
|
3
|
-
type BreadcrumbLinkProps = PolymorphicProps<React.
|
|
3
|
+
type BreadcrumbLinkProps = PolymorphicProps<React.AnchorHTMLAttributes<HTMLAnchorElement>>;
|
|
4
4
|
declare const BreadcrumbLink: PolymorphicComponent<BreadcrumbLinkProps>;
|
|
5
5
|
export default BreadcrumbLink;
|
|
@@ -2,14 +2,25 @@ import React from 'react';
|
|
|
2
2
|
import { IconType } from '../Icon';
|
|
3
3
|
import { TooltipProps } from '../Tooltip';
|
|
4
4
|
import { PolymorphicProps, PolymorphicComponent } from '../../utils/polymorphicComponent';
|
|
5
|
-
export interface IconButtonProps extends PolymorphicProps<React.HTMLAttributes<HTMLButtonElement
|
|
5
|
+
export interface IconButtonProps extends PolymorphicProps<React.HTMLAttributes<HTMLButtonElement | HTMLAnchorElement>> {
|
|
6
6
|
icon: IconType;
|
|
7
7
|
label: React.ReactNode;
|
|
8
|
+
tooltipProps?: Omit<TooltipProps, 'children' | 'target'>;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated use `tooltipProps.placement` instead
|
|
12
|
+
*/
|
|
8
13
|
tooltipPlacement?: TooltipProps['placement'];
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated use `tooltipProps.variant` instead
|
|
16
|
+
*/
|
|
9
17
|
tooltipVariant?: TooltipProps['variant'];
|
|
18
|
+
/**
|
|
19
|
+
* @deprecated use `tooltipProps.portal` instead
|
|
20
|
+
*/
|
|
10
21
|
tooltipPortal?: TooltipProps['portal'];
|
|
11
22
|
variant?: 'primary' | 'secondary' | 'error';
|
|
12
23
|
large?: boolean;
|
|
13
24
|
}
|
|
14
|
-
declare const IconButton: PolymorphicComponent<IconButtonProps
|
|
25
|
+
declare const IconButton: PolymorphicComponent<IconButtonProps>;
|
|
15
26
|
export default IconButton;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import AriaIsolate from '../../utils/aria-isolate';
|
|
3
|
-
export interface ToastProps {
|
|
3
|
+
export interface ToastProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
4
|
type: 'confirmation' | 'caution' | 'error' | 'action-needed' | 'info';
|
|
5
5
|
onDismiss: () => void;
|
|
6
6
|
dismissText?: string;
|
package/lib/index.js
CHANGED
|
@@ -1797,25 +1797,38 @@ var TooltipContent = function (_a) {
|
|
|
1797
1797
|
return (React__default["default"].createElement("div", tslib.__assign({ className: classNames__default["default"]('TooltipContent', className) }, other)));
|
|
1798
1798
|
};
|
|
1799
1799
|
|
|
1800
|
+
var isButton = function (component) { return component === 'button'; };
|
|
1801
|
+
var looksLikeLink = function (props) {
|
|
1802
|
+
return 'to' in props || 'href' in props;
|
|
1803
|
+
};
|
|
1800
1804
|
var IconButton = React.forwardRef(function (_a, ref) {
|
|
1801
|
-
var _b = _a.as, Component = _b === void 0 ? 'button' : _b, icon = _a.icon, label = _a.label,
|
|
1805
|
+
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"]);
|
|
1802
1806
|
var internalRef = React.useRef();
|
|
1803
1807
|
React.useImperativeHandle(ref, function () { return internalRef.current; });
|
|
1804
1808
|
// Configure additional properties based on the type of the Component
|
|
1805
1809
|
// for accessibility
|
|
1806
1810
|
var accessibilityProps = {};
|
|
1807
|
-
if (Component
|
|
1811
|
+
if (isButton(Component)) {
|
|
1808
1812
|
accessibilityProps.type = 'button';
|
|
1809
1813
|
}
|
|
1810
1814
|
else {
|
|
1811
1815
|
// We don't need to set an anchor's role, since it would be redundant
|
|
1812
1816
|
if (Component !== 'a') {
|
|
1813
|
-
accessibilityProps.role = other
|
|
1817
|
+
accessibilityProps.role = looksLikeLink(other) ? 'link' : 'button';
|
|
1814
1818
|
}
|
|
1815
1819
|
if (disabled) {
|
|
1816
1820
|
accessibilityProps['aria-disabled'] = disabled;
|
|
1817
1821
|
}
|
|
1818
1822
|
}
|
|
1823
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1824
|
+
if (!!tooltipPlacement || !!tooltipVariant || !!tooltipPortal) {
|
|
1825
|
+
React__default["default"].useEffect(function () {
|
|
1826
|
+
console.warn('[IconButton] The following props are deprecated: tooltipPlacement, tooltipVariant, tooltipPortal. ' +
|
|
1827
|
+
'See https://cauldron.dequelabs.com/components/IconButton for recommended replacement.');
|
|
1828
|
+
}, []);
|
|
1829
|
+
}
|
|
1830
|
+
}
|
|
1831
|
+
var tooltipProps = tslib.__assign({ placement: tooltipPlacement || 'auto', variant: tooltipVariant, portal: tooltipPortal, association: 'aria-labelledby', hideElementOnHidden: true }, tooltipPropsProp);
|
|
1819
1832
|
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
1820
1833
|
React__default["default"].createElement(Component, tslib.__assign({ className: classNames__default["default"](className, {
|
|
1821
1834
|
IconButton: true,
|
|
@@ -1826,7 +1839,7 @@ var IconButton = React.forwardRef(function (_a, ref) {
|
|
|
1826
1839
|
}), ref: internalRef, disabled: disabled, tabIndex: disabled ? -1 : tabIndex }, accessibilityProps, other),
|
|
1827
1840
|
React__default["default"].createElement(Icon, { type: icon }),
|
|
1828
1841
|
disabled && React__default["default"].createElement(Offscreen, null, label)),
|
|
1829
|
-
!disabled && (React__default["default"].createElement(Tooltip, { target: internalRef
|
|
1842
|
+
!disabled && (React__default["default"].createElement(Tooltip, tslib.__assign({ target: internalRef }, tooltipProps), label))));
|
|
1830
1843
|
});
|
|
1831
1844
|
IconButton.displayName = 'IconButton';
|
|
1832
1845
|
|
|
@@ -1932,11 +1945,11 @@ var Toast = /** @class */ (function (_super) {
|
|
|
1932
1945
|
var _a = this.props, type = _a.type, children = _a.children;
|
|
1933
1946
|
// prevent `onDismiss` from being passed-through to DOM
|
|
1934
1947
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1935
|
-
_a.onDismiss; var dismissText = _a.dismissText, toastRef = _a.toastRef, focus = _a.focus, show = _a.show, dismissible = _a.dismissible, otherProps = tslib.__rest(_a, ["type", "children", "onDismiss", "dismissText", "toastRef", "focus", "show", "dismissible"]);
|
|
1948
|
+
_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"]);
|
|
1936
1949
|
var scrim = type === 'action-needed' && show ? (React__default["default"].createElement("div", { className: "Scrim--light Scrim--show Scrim--fade-in" })) : null;
|
|
1937
1950
|
var defaultProps = {
|
|
1938
1951
|
tabIndex: -1,
|
|
1939
|
-
className: classNames__default["default"]('Toast', "Toast--".concat(typeMap[type].className), animationClass, { 'Toast--non-dismissible': !dismissible })
|
|
1952
|
+
className: classNames__default["default"]('Toast', "Toast--".concat(typeMap[type].className), animationClass, { 'Toast--non-dismissible': !dismissible }, className)
|
|
1940
1953
|
};
|
|
1941
1954
|
if (!focus) {
|
|
1942
1955
|
defaultProps.role = 'alert';
|
|
@@ -2267,7 +2280,7 @@ var RadioCardGroup = function (_a) {
|
|
|
2267
2280
|
RadioCardGroup.displayName = 'RadioCardGroup';
|
|
2268
2281
|
|
|
2269
2282
|
var Checkbox = React.forwardRef(function (_a, ref) {
|
|
2270
|
-
var id = _a.id, label = _a.label, labelDescription = _a.labelDescription, error = _a.error, checkboxRef = _a.checkboxRef, className = _a.className, onChange = _a.onChange, onFocus = _a.onFocus, onBlur = _a.onBlur, ariaDescribedby = _a["aria-describedby"], _b = _a.disabled, disabled = _b === void 0 ? false : _b, _c = _a.checked, checked = _c === void 0 ? false : _c
|
|
2283
|
+
var id = _a.id, label = _a.label, labelDescription = _a.labelDescription, error = _a.error, checkboxRef = _a.checkboxRef, className = _a.className, onChange = _a.onChange, onFocus = _a.onFocus, onBlur = _a.onBlur, ariaDescribedby = _a["aria-describedby"], _b = _a.disabled, disabled = _b === void 0 ? false : _b, _c = _a.checked, checked = _c === void 0 ? false : _c; _a.children; var other = tslib.__rest(_a, ["id", "label", "labelDescription", "error", "checkboxRef", "className", "onChange", "onFocus", "onBlur", 'aria-describedby', "disabled", "checked", "children"]);
|
|
2271
2284
|
var _d = tslib.__read(React.useState(checked), 2), isChecked = _d[0], setIsChecked = _d[1];
|
|
2272
2285
|
var _e = tslib.__read(React.useState(false), 2), focused = _e[0], setFocused = _e[1];
|
|
2273
2286
|
var checkRef = React.useRef(null);
|
|
@@ -2368,7 +2381,7 @@ var TextField = /** @class */ (function (_super) {
|
|
|
2368
2381
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2369
2382
|
_a.onChange;
|
|
2370
2383
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2371
|
-
_a.defaultValue; var _b = _a.error, error = _b === void 0 ? null : _b, requiredText = _a.requiredText, multiline = _a.multiline, ariaDescribedby = _a["aria-describedby"]
|
|
2384
|
+
_a.defaultValue; var _b = _a.error, error = _b === void 0 ? null : _b, requiredText = _a.requiredText, multiline = _a.multiline, ariaDescribedby = _a["aria-describedby"]; _a.children; var className = _a.className, other = tslib.__rest(_a, ["label", "fieldRef", "value", "onChange", "defaultValue", "error", "requiredText", "multiline", 'aria-describedby', "children", "className"]);
|
|
2372
2385
|
// typescript can't infer the type so it's complaining about
|
|
2373
2386
|
// textarea and input props being incompatible
|
|
2374
2387
|
// we should probably fix this
|
|
@@ -2543,13 +2556,9 @@ var LoaderOverlay = React.forwardRef(function (_a, ref) {
|
|
|
2543
2556
|
}, [focusTrap, overlayRef.current]);
|
|
2544
2557
|
React.useEffect(function () {
|
|
2545
2558
|
if (!!focusOnInitialRender && overlayRef.current) {
|
|
2546
|
-
|
|
2547
|
-
var _a;
|
|
2548
|
-
return (_a = overlayRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
2549
|
-
});
|
|
2559
|
+
overlayRef.current.focus();
|
|
2550
2560
|
}
|
|
2551
|
-
|
|
2552
|
-
}, [overlayRef.current]);
|
|
2561
|
+
}, []);
|
|
2553
2562
|
var Wrapper = focusTrap ? FocusTrap__default["default"] : React__default["default"].Fragment;
|
|
2554
2563
|
var wrapperProps = focusTrap
|
|
2555
2564
|
? {
|
|
@@ -2875,9 +2884,9 @@ var Pagination = React__default["default"].forwardRef(function (_a, ref) {
|
|
|
2875
2884
|
}) }, other),
|
|
2876
2885
|
React__default["default"].createElement("ul", null,
|
|
2877
2886
|
React__default["default"].createElement("li", null,
|
|
2878
|
-
React__default["default"].createElement(IconButton, { icon: "chevron-double-left",
|
|
2887
|
+
React__default["default"].createElement(IconButton, { icon: "chevron-double-left", tooltipProps: { placement: tooltipPlacement }, label: firstPageLabel, "aria-disabled": isFirstPage, onClick: isFirstPage ? undefined : onFirstPageClick })),
|
|
2879
2888
|
React__default["default"].createElement("li", null,
|
|
2880
|
-
React__default["default"].createElement(IconButton, { icon: "chevron-left",
|
|
2889
|
+
React__default["default"].createElement(IconButton, { icon: "chevron-left", tooltipProps: { placement: tooltipPlacement }, label: previousPageLabel, "aria-disabled": isFirstPage, onClick: isFirstPage ? undefined : onPreviousPageClick })),
|
|
2881
2890
|
React__default["default"].createElement("li", null,
|
|
2882
2891
|
React__default["default"].createElement("span", { role: "log", "aria-atomic": "true", "aria-live": "polite" }, statusLabel || (React__default["default"].createElement("span", null,
|
|
2883
2892
|
"Showing ",
|
|
@@ -2888,9 +2897,9 @@ var Pagination = React__default["default"].forwardRef(function (_a, ref) {
|
|
|
2888
2897
|
" of ",
|
|
2889
2898
|
React__default["default"].createElement("strong", null, totalItems))))),
|
|
2890
2899
|
React__default["default"].createElement("li", null,
|
|
2891
|
-
React__default["default"].createElement(IconButton, { icon: "chevron-right",
|
|
2900
|
+
React__default["default"].createElement(IconButton, { icon: "chevron-right", tooltipProps: { placement: tooltipPlacement }, label: nextPageLabel, "aria-disabled": isLastPage, onClick: isLastPage ? undefined : onNextPageClick })),
|
|
2892
2901
|
React__default["default"].createElement("li", null,
|
|
2893
|
-
React__default["default"].createElement(IconButton, { icon: "chevron-double-right",
|
|
2902
|
+
React__default["default"].createElement(IconButton, { icon: "chevron-double-right", tooltipProps: { placement: tooltipPlacement }, label: lastPageLabel, "aria-disabled": isLastPage, onClick: isLastPage ? undefined : onLastPageClick })))));
|
|
2894
2903
|
});
|
|
2895
2904
|
Pagination.displayName = 'Pagination';
|
|
2896
2905
|
|
|
@@ -3593,7 +3602,7 @@ var Combobox = React.forwardRef(function (_a, ref) {
|
|
|
3593
3602
|
var isAutoComplete = autocomplete !== 'none';
|
|
3594
3603
|
var hasError = !!error;
|
|
3595
3604
|
var comboboxOptions = children ||
|
|
3596
|
-
options.map(function (option, index) { return (React__default["default"].createElement(ComboboxOption, { key: option.key || index, id: "".concat(id, "-option-").concat(index + 1), description: option.description }, option.label)); });
|
|
3605
|
+
options.map(function (option, index) { return (React__default["default"].createElement(ComboboxOption, { key: option.key || index, id: "".concat(id, "-option-").concat(index + 1), description: option.description, value: option.value }, option.label)); });
|
|
3597
3606
|
var triggerListboxKeyDown = React__default["default"].useCallback(function (key) {
|
|
3598
3607
|
var _a;
|
|
3599
3608
|
(_a = listboxRef.current) === null || _a === void 0 ? void 0 : _a.dispatchEvent(new KeyboardEvent('keydown', {
|
|
@@ -3675,6 +3684,11 @@ var Combobox = React.forwardRef(function (_a, ref) {
|
|
|
3675
3684
|
/* istanbul ignore next: default value */ '';
|
|
3676
3685
|
setValue(stringValue);
|
|
3677
3686
|
setSelectedValue(stringValue);
|
|
3687
|
+
onSelectionChange === null || onSelectionChange === void 0 ? void 0 : onSelectionChange({
|
|
3688
|
+
target: activeDescendant.element,
|
|
3689
|
+
value: stringValue,
|
|
3690
|
+
previousValue: value
|
|
3691
|
+
});
|
|
3678
3692
|
}
|
|
3679
3693
|
}, [autocomplete, activeDescendant, onBlur]);
|
|
3680
3694
|
var handleKeyDown = React.useCallback(function (event) {
|
package/package.json
CHANGED