@deque/cauldron-react 6.4.0 → 6.4.1-canary.1b7c98fb
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.
|
@@ -7,8 +7,8 @@ export interface DialogProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
7
7
|
dialogRef?: React.Ref<HTMLDivElement>;
|
|
8
8
|
onClose?: () => void;
|
|
9
9
|
forceAction?: boolean;
|
|
10
|
-
heading: React.ReactElement<any> | {
|
|
11
|
-
text: React.ReactElement<any
|
|
10
|
+
heading: string | React.ReactElement<any> | {
|
|
11
|
+
text: React.ReactElement<any> | string;
|
|
12
12
|
level: number | undefined;
|
|
13
13
|
};
|
|
14
14
|
closeButtonText?: string;
|
|
@@ -2,7 +2,7 @@ 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 | HTMLAnchorElement
|
|
5
|
+
export interface IconButtonProps extends PolymorphicProps<React.HTMLAttributes<HTMLButtonElement | HTMLAnchorElement>> {
|
|
6
6
|
icon: IconType;
|
|
7
7
|
label: React.ReactNode;
|
|
8
8
|
tooltipProps?: Omit<TooltipProps, 'children' | 'target'>;
|
|
@@ -22,5 +22,5 @@ export interface IconButtonProps extends PolymorphicProps<React.HTMLAttributes<H
|
|
|
22
22
|
variant?: 'primary' | 'secondary' | 'error';
|
|
23
23
|
large?: boolean;
|
|
24
24
|
}
|
|
25
|
-
declare const IconButton: PolymorphicComponent<IconButtonProps
|
|
25
|
+
declare const IconButton: PolymorphicComponent<IconButtonProps>;
|
|
26
26
|
export default IconButton;
|
package/lib/index.js
CHANGED
|
@@ -1437,6 +1437,7 @@ var Dialog = /** @class */ (function (_super) {
|
|
|
1437
1437
|
? heading.level
|
|
1438
1438
|
: 2);
|
|
1439
1439
|
var Dialog = (React__default["default"].createElement(FocusTrap__default["default"], { focusTrapOptions: {
|
|
1440
|
+
allowOutsideClick: true,
|
|
1440
1441
|
onDeactivate: this.close,
|
|
1441
1442
|
escapeDeactivates: !forceAction,
|
|
1442
1443
|
fallbackFocus: '.Dialog__heading'
|
|
@@ -1836,9 +1837,7 @@ var IconButton = React.forwardRef(function (_a, ref) {
|
|
|
1836
1837
|
'IconButton--secondary': variant === 'secondary',
|
|
1837
1838
|
'IconButton--error': variant === 'error',
|
|
1838
1839
|
'IconButton--large': large
|
|
1839
|
-
}),
|
|
1840
|
-
// @ts-expect-error the concrete type is unknown, so HTMLElement is expected
|
|
1841
|
-
ref: internalRef, disabled: disabled, tabIndex: disabled ? -1 : tabIndex }, accessibilityProps, other),
|
|
1840
|
+
}), ref: internalRef, disabled: disabled, tabIndex: disabled ? -1 : tabIndex }, accessibilityProps, other),
|
|
1842
1841
|
React__default["default"].createElement(Icon, { type: icon }),
|
|
1843
1842
|
disabled && React__default["default"].createElement(Offscreen, null, label)),
|
|
1844
1843
|
!disabled && (React__default["default"].createElement(Tooltip, tslib.__assign({ target: internalRef }, tooltipProps), label))));
|
|
@@ -2558,13 +2557,9 @@ var LoaderOverlay = React.forwardRef(function (_a, ref) {
|
|
|
2558
2557
|
}, [focusTrap, overlayRef.current]);
|
|
2559
2558
|
React.useEffect(function () {
|
|
2560
2559
|
if (!!focusOnInitialRender && overlayRef.current) {
|
|
2561
|
-
|
|
2562
|
-
var _a;
|
|
2563
|
-
return (_a = overlayRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
2564
|
-
});
|
|
2560
|
+
overlayRef.current.focus();
|
|
2565
2561
|
}
|
|
2566
|
-
|
|
2567
|
-
}, [overlayRef.current]);
|
|
2562
|
+
}, []);
|
|
2568
2563
|
var Wrapper = focusTrap ? FocusTrap__default["default"] : React__default["default"].Fragment;
|
|
2569
2564
|
var wrapperProps = focusTrap
|
|
2570
2565
|
? {
|
|
@@ -3608,7 +3603,7 @@ var Combobox = React.forwardRef(function (_a, ref) {
|
|
|
3608
3603
|
var isAutoComplete = autocomplete !== 'none';
|
|
3609
3604
|
var hasError = !!error;
|
|
3610
3605
|
var comboboxOptions = children ||
|
|
3611
|
-
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)); });
|
|
3606
|
+
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)); });
|
|
3612
3607
|
var triggerListboxKeyDown = React__default["default"].useCallback(function (key) {
|
|
3613
3608
|
var _a;
|
|
3614
3609
|
(_a = listboxRef.current) === null || _a === void 0 ? void 0 : _a.dispatchEvent(new KeyboardEvent('keydown', {
|
|
@@ -3690,6 +3685,11 @@ var Combobox = React.forwardRef(function (_a, ref) {
|
|
|
3690
3685
|
/* istanbul ignore next: default value */ '';
|
|
3691
3686
|
setValue(stringValue);
|
|
3692
3687
|
setSelectedValue(stringValue);
|
|
3688
|
+
onSelectionChange === null || onSelectionChange === void 0 ? void 0 : onSelectionChange({
|
|
3689
|
+
target: activeDescendant.element,
|
|
3690
|
+
value: stringValue,
|
|
3691
|
+
previousValue: value
|
|
3692
|
+
});
|
|
3693
3693
|
}
|
|
3694
3694
|
}, [autocomplete, activeDescendant, onBlur]);
|
|
3695
3695
|
var handleKeyDown = React.useCallback(function (event) {
|
package/lib/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactElement,
|
|
1
|
+
import type { ReactElement, ReactPortal } from 'react';
|
|
2
2
|
export declare namespace Cauldron {
|
|
3
3
|
type LabelProps = {
|
|
4
4
|
'aria-label': string;
|
|
@@ -10,4 +10,4 @@ export declare namespace Cauldron {
|
|
|
10
10
|
* This type is meant to ensure that a prop can actually be rendered as content.
|
|
11
11
|
* Explicit equivalent of Exclude<ReactNode, boolean | null | undefined>
|
|
12
12
|
*/
|
|
13
|
-
export type ContentNode = string | number |
|
|
13
|
+
export type ContentNode = string | number | ReactPortal | ReactElement;
|
package/package.json
CHANGED