@deque/cauldron-react 6.17.1-canary.82f455cd → 6.17.1-canary.8bc06dca
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.
|
@@ -4,8 +4,6 @@ type ActionMenuTriggerFunction = (props: ActionMenuTriggerProps, open: boolean)
|
|
|
4
4
|
declare const ActionMenu: React.ForwardRefExoticComponent<{
|
|
5
5
|
children: React.ReactElement;
|
|
6
6
|
trigger: React.ReactElement | ActionMenuTriggerFunction;
|
|
7
|
-
/** Render the action menu in a different location in the dom. */
|
|
8
|
-
portal?: HTMLElement | React.RefObject<HTMLElement> | undefined;
|
|
9
7
|
} & Pick<{
|
|
10
8
|
target: HTMLElement | React.RefObject<HTMLElement> | React.MutableRefObject<HTMLElement>;
|
|
11
9
|
placement?: "auto" | import("@floating-ui/utils").Placement | "auto-start" | "auto-end" | undefined;
|
|
@@ -21,7 +19,6 @@ declare const ActionMenu: React.ForwardRefExoticComponent<{
|
|
|
21
19
|
returnFocus?: boolean | undefined;
|
|
22
20
|
returnFocusElement?: import("../../types").ElementOrRef<HTMLElement> | undefined;
|
|
23
21
|
} | undefined;
|
|
24
|
-
portal?: HTMLElement | React.RefObject<HTMLElement> | undefined;
|
|
25
22
|
children?: React.ReactNode;
|
|
26
23
|
} & React.HTMLAttributes<HTMLElement> & {
|
|
27
24
|
as?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined;
|
|
@@ -20,8 +20,6 @@ declare const AnchoredOverlay: React.ForwardRefExoticComponent<{
|
|
|
20
20
|
focusTrap?: boolean | undefined;
|
|
21
21
|
/** When `focusTrap` is true, optional arguments to configure the focus trap. */
|
|
22
22
|
focusTrapOptions?: Parameters<typeof useFocusTrap>[1];
|
|
23
|
-
/** Render the anchored overlay in a different location in the dom. */
|
|
24
|
-
portal?: HTMLElement | React.RefObject<HTMLElement> | undefined;
|
|
25
23
|
children?: React.ReactNode;
|
|
26
24
|
} & React.HTMLAttributes<HTMLElement> & {
|
|
27
25
|
as?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined;
|
|
@@ -8,7 +8,6 @@ type BaseProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
|
8
8
|
show: boolean;
|
|
9
9
|
onClose: () => void;
|
|
10
10
|
placement?: React.ComponentProps<typeof AnchoredOverlay>['placement'];
|
|
11
|
-
/** Render the popover in a different location in the dom. */
|
|
12
11
|
portal?: React.RefObject<HTMLElement> | HTMLElement;
|
|
13
12
|
};
|
|
14
13
|
type CustomProps = BaseProps & {
|
|
@@ -9,7 +9,6 @@ export interface TooltipProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
9
9
|
show?: boolean | undefined;
|
|
10
10
|
defaultShow?: boolean;
|
|
11
11
|
placement?: React.ComponentProps<typeof AnchoredOverlay>['placement'];
|
|
12
|
-
/** Render the tooltip in a different location in the dom. */
|
|
13
12
|
portal?: React.RefObject<HTMLElement> | HTMLElement;
|
|
14
13
|
hideElementOnHidden?: boolean;
|
|
15
14
|
}
|
package/lib/index.js
CHANGED
|
@@ -1783,7 +1783,7 @@ function getAutoAlignment(placement) {
|
|
|
1783
1783
|
}
|
|
1784
1784
|
var AnchoredOverlay = React.forwardRef(function (_a, refProp) {
|
|
1785
1785
|
var _b, _c;
|
|
1786
|
-
var as = _a.as, _d = _a.placement, initialPlacement = _d === void 0 ? 'auto' : _d, target = _a.target, children = _a.children, style = _a.style, _e = _a.open, open = _e === void 0 ? false : _e, offset = _a.offset, focusTrap = _a.focusTrap, focusTrapOptions = _a.focusTrapOptions, onOpenChange = _a.onOpenChange, onPlacementChange = _a.onPlacementChange, onShiftChange = _a.onShiftChange,
|
|
1786
|
+
var as = _a.as, _d = _a.placement, initialPlacement = _d === void 0 ? 'auto' : _d, target = _a.target, children = _a.children, style = _a.style, _e = _a.open, open = _e === void 0 ? false : _e, offset = _a.offset, focusTrap = _a.focusTrap, focusTrapOptions = _a.focusTrapOptions, onOpenChange = _a.onOpenChange, onPlacementChange = _a.onPlacementChange, onShiftChange = _a.onShiftChange, props = tslib.__rest(_a, ["as", "placement", "target", "children", "style", "open", "offset", "focusTrap", "focusTrapOptions", "onOpenChange", "onPlacementChange", "onShiftChange"]);
|
|
1787
1787
|
var ref = useSharedRef(refProp);
|
|
1788
1788
|
var Component = as || 'div';
|
|
1789
1789
|
var _f = reactDom$1.useFloating({
|
|
@@ -1835,18 +1835,7 @@ var AnchoredOverlay = React.forwardRef(function (_a, refProp) {
|
|
|
1835
1835
|
});
|
|
1836
1836
|
}
|
|
1837
1837
|
}, [onShiftChange, (_b = middlewareData.shift) === null || _b === void 0 ? void 0 : _b.x, (_c = middlewareData.shift) === null || _c === void 0 ? void 0 : _c.y]);
|
|
1838
|
-
|
|
1839
|
-
if (portal && !isBrowser()) {
|
|
1840
|
-
return null;
|
|
1841
|
-
}
|
|
1842
|
-
if (portal && typeof portal !== 'undefined') {
|
|
1843
|
-
var portalElement = (portal && 'current' in portal ? portal.current : portal) ||
|
|
1844
|
-
(
|
|
1845
|
-
// eslint-disable-next-line ssr-friendly/no-dom-globals-in-react-fc
|
|
1846
|
-
document === null || document === void 0 ? void 0 : document.body);
|
|
1847
|
-
return reactDom.createPortal(AnchoredOverlayComponent, portalElement);
|
|
1848
|
-
}
|
|
1849
|
-
return AnchoredOverlayComponent;
|
|
1838
|
+
return (React__default["default"].createElement(Component, tslib.__assign({ ref: ref }, props, { style: tslib.__assign(tslib.__assign({}, floatingStyles), style) }), children));
|
|
1850
1839
|
});
|
|
1851
1840
|
AnchoredOverlay.displayName = 'AnchoredOverlay';
|
|
1852
1841
|
|
|
@@ -1996,18 +1985,18 @@ function Tooltip(_a) {
|
|
|
1996
1985
|
// that the arrow needs to shift
|
|
1997
1986
|
setArrowShift(x * -1);
|
|
1998
1987
|
}, [variant]);
|
|
1999
|
-
return (React__default["default"].createElement(React__default["default"].Fragment, null, (showTooltip || hideElementOnHidden) && isBrowser()
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
1988
|
+
return (React__default["default"].createElement(React__default["default"].Fragment, null, (showTooltip || hideElementOnHidden) && isBrowser()
|
|
1989
|
+
? reactDom.createPortal(React__default["default"].createElement(AnchoredOverlay, tslib.__assign({ id: id, target: target, placement: initialPlacement, onPlacementChange: setPlacement, open: showTooltip && typeof showProp !== 'boolean', onOpenChange: setShowTooltip, onShiftChange: updateArrowShiftPosition, className: classNames__default["default"]('Tooltip', "Tooltip--".concat(placement), className, {
|
|
1990
|
+
TooltipInfo: variant === 'info',
|
|
1991
|
+
'Tooltip--hidden': !showTooltip && hideElementOnHidden,
|
|
1992
|
+
'Tooltip--big': variant === 'big'
|
|
1993
|
+
}), ref: setTooltipElement, role: "tooltip", offset: 8 }, props),
|
|
1994
|
+
variant !== 'big' && React__default["default"].createElement("div", { className: "TooltipArrow", style: arrowShift ? { transform: "translateX(".concat(arrowShift, "px)") } : undefined }),
|
|
1995
|
+
children), (portal && 'current' in portal ? portal.current : portal) ||
|
|
1996
|
+
(
|
|
1997
|
+
// eslint-disable-next-line ssr-friendly/no-dom-globals-in-react-fc
|
|
1998
|
+
document === null || document === void 0 ? void 0 : document.body))
|
|
1999
|
+
: null));
|
|
2011
2000
|
}
|
|
2012
2001
|
Tooltip.displayName = 'Tooltip';
|
|
2013
2002
|
var TooltipHead = function (_a) {
|
|
@@ -4654,20 +4643,19 @@ var Popover = React.forwardRef(function (_a, ref) {
|
|
|
4654
4643
|
active: show
|
|
4655
4644
|
}, [show]);
|
|
4656
4645
|
useFocusTrap(popoverRef, { disabled: !show, returnFocus: true });
|
|
4657
|
-
if (!show || !isBrowser())
|
|
4646
|
+
if (!show || !isBrowser())
|
|
4658
4647
|
return null;
|
|
4659
|
-
}
|
|
4660
|
-
return (React__default["default"].createElement(ClickOutsideListener$1, { onClickOutside: handleClickOutside },
|
|
4648
|
+
return reactDom.createPortal(React__default["default"].createElement(ClickOutsideListener$1, { onClickOutside: handleClickOutside },
|
|
4661
4649
|
React__default["default"].createElement(AnchoredOverlay, tslib.__assign({ id: id, className: classNames__default["default"]('Popover', "Popover--".concat(placement), className, {
|
|
4662
4650
|
'Popover--hidden': !show,
|
|
4663
4651
|
'Popover--prompt': variant === 'prompt'
|
|
4664
|
-
}), ref: popoverRef, role: "dialog", target: target, open: show, placement: initialPlacement, onPlacementChange: setPlacement, offset: 8,
|
|
4665
|
-
// guarded by isBrowser() check
|
|
4666
|
-
// eslint-disable-next-line ssr-friendly/no-dom-globals-in-react-fc
|
|
4667
|
-
portal: portal || (document === null || document === void 0 ? void 0 : document.body) }, additionalProps, props),
|
|
4652
|
+
}), ref: popoverRef, role: "dialog", target: target, open: show, placement: initialPlacement, onPlacementChange: setPlacement, offset: 8 }, additionalProps, props),
|
|
4668
4653
|
React__default["default"].createElement("div", { className: "Popover__popoverArrow" }),
|
|
4669
4654
|
React__default["default"].createElement("div", { className: "Popover__borderLeft" }),
|
|
4670
|
-
variant === 'prompt' ? (React__default["default"].createElement(PromptPopoverContent, { applyButtonText: applyButtonText, onApply: onApply, closeButtonText: closeButtonText, infoText: infoText || '', onClose: handleClosePopover, infoTextId: "".concat(id, "-label") })) : (children))))
|
|
4655
|
+
variant === 'prompt' ? (React__default["default"].createElement(PromptPopoverContent, { applyButtonText: applyButtonText, onApply: onApply, closeButtonText: closeButtonText, infoText: infoText || '', onClose: handleClosePopover, infoTextId: "".concat(id, "-label") })) : (children))), (portal && 'current' in portal ? portal.current : portal) ||
|
|
4656
|
+
// Dependent on "isBrowser" check above:
|
|
4657
|
+
// eslint-disable-next-line ssr-friendly/no-dom-globals-in-react-fc
|
|
4658
|
+
document.body);
|
|
4671
4659
|
});
|
|
4672
4660
|
Popover.displayName = 'Popover';
|
|
4673
4661
|
|
|
@@ -5082,7 +5070,7 @@ ActionListLinkItem.displayName = 'ActionListLinkItem';
|
|
|
5082
5070
|
|
|
5083
5071
|
var _a = tslib.__read(['ArrowDown', 'ArrowUp'], 2), ArrowDown = _a[0], ArrowUp = _a[1];
|
|
5084
5072
|
var ActionMenu = React.forwardRef(function (_a, ref) {
|
|
5085
|
-
var className = _a.className, style = _a.style, trigger = _a.trigger, _b = _a.placement, placement = _b === void 0 ? 'bottom-start' : _b, actionMenuList = _a.children,
|
|
5073
|
+
var className = _a.className, style = _a.style, trigger = _a.trigger, _b = _a.placement, placement = _b === void 0 ? 'bottom-start' : _b, actionMenuList = _a.children, props = tslib.__rest(_a, ["className", "style", "trigger", "placement", "children"]);
|
|
5086
5074
|
var _c = tslib.__read(React.useState(false), 2), open = _c[0], setOpen = _c[1];
|
|
5087
5075
|
var _d = tslib.__read(React.useState('first'), 2), focusStrategy = _d[0], setFocusStrategy = _d[1];
|
|
5088
5076
|
var triggerRef = React.useRef(null);
|
|
@@ -5150,7 +5138,7 @@ var ActionMenu = React.forwardRef(function (_a, ref) {
|
|
|
5150
5138
|
}, [open]);
|
|
5151
5139
|
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
5152
5140
|
React__default["default"].createElement(ClickOutsideListener$1, { onClickOutside: handleClickOutside, mouseEvent: open ? undefined : false, touchEvent: open ? undefined : false }, actionMenuTrigger),
|
|
5153
|
-
React__default["default"].createElement(AnchoredOverlay, tslib.__assign({ ref: actionMenuRef, role: "presentation", className: classNames__default["default"]('ActionMenu', className), open: open, onOpenChange: setOpen, target: triggerRef, placement: placement, offset: 4,
|
|
5141
|
+
React__default["default"].createElement(AnchoredOverlay, tslib.__assign({ ref: actionMenuRef, role: "presentation", className: classNames__default["default"]('ActionMenu', className), open: open, onOpenChange: setOpen, target: triggerRef, placement: placement, offset: 4, style: tslib.__assign({ display: !open ? 'none' : undefined }, style) }, props), React__default["default"].cloneElement(actionMenuList, {
|
|
5154
5142
|
ref: actionMenuListRef,
|
|
5155
5143
|
role: 'menu',
|
|
5156
5144
|
onAction: handleAction,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deque/cauldron-react",
|
|
3
|
-
"version": "6.17.1-canary.
|
|
3
|
+
"version": "6.17.1-canary.8bc06dca",
|
|
4
4
|
"license": "MPL-2.0",
|
|
5
5
|
"description": "Fully accessible react components library for Deque Cauldron",
|
|
6
6
|
"homepage": "https://cauldron.dequelabs.com/",
|