@deque/cauldron-react 6.4.2-canary.c0101d73 → 6.4.2-canary.d80fe1ac
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.
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface BadgeProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
size?: 'default' | 'small';
|
|
5
|
+
}
|
|
6
|
+
interface BadgeLabelProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
export declare const BadgeLabel: React.ForwardRefExoticComponent<BadgeLabelProps & React.RefAttributes<HTMLDivElement>>;
|
|
10
|
+
declare const Badge: React.ForwardRefExoticComponent<BadgeProps & React.RefAttributes<HTMLDivElement>>;
|
|
11
|
+
export default Badge;
|
|
@@ -10,6 +10,7 @@ export interface NoticeProps extends Omit<React.HTMLAttributes<HTMLDivElement>,
|
|
|
10
10
|
type?: keyof typeof iconTypeMap;
|
|
11
11
|
title: ContentNode;
|
|
12
12
|
icon?: IconType;
|
|
13
|
+
variant?: 'default' | 'condensed';
|
|
13
14
|
children?: ReactNode;
|
|
14
15
|
}
|
|
15
16
|
declare const Notice: React.ForwardRefExoticComponent<NoticeProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -7,11 +7,12 @@ export interface TooltipProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
7
7
|
variant?: 'text' | 'info' | 'big';
|
|
8
8
|
association?: 'aria-labelledby' | 'aria-describedby' | 'none';
|
|
9
9
|
show?: boolean | undefined;
|
|
10
|
+
defaultShow?: boolean;
|
|
10
11
|
placement?: Placement;
|
|
11
12
|
portal?: React.RefObject<HTMLElement> | HTMLElement;
|
|
12
13
|
hideElementOnHidden?: boolean;
|
|
13
14
|
}
|
|
14
|
-
declare function Tooltip({ id: propId, placement: initialPlacement, children, portal, target, association, variant, show:
|
|
15
|
+
declare function Tooltip({ id: propId, placement: initialPlacement, children, portal, target, association, variant, show: showProp, defaultShow, hideElementOnHidden, className, ...props }: TooltipProps): JSX.Element;
|
|
15
16
|
declare namespace Tooltip {
|
|
16
17
|
var displayName: string;
|
|
17
18
|
}
|
package/lib/index.d.ts
CHANGED
|
@@ -38,6 +38,7 @@ 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
40
|
export { default as Tag, TagLabel } from './components/Tag';
|
|
41
|
+
export { default as Badge, BadgeLabel } from './components/Badge';
|
|
41
42
|
export { default as TagButton } from './components/TagButton';
|
|
42
43
|
export { default as Table, TableBody, TableCell, TableHead, TableHeader, TableRow, TableFooter } from './components/Table';
|
|
43
44
|
export { default as Tabs, Tab, TabPanel } from './components/Tabs';
|
package/lib/index.js
CHANGED
|
@@ -1654,10 +1654,10 @@ var fireCustomEvent = function (show, button) {
|
|
|
1654
1654
|
};
|
|
1655
1655
|
function Tooltip(_a) {
|
|
1656
1656
|
var _this = this;
|
|
1657
|
-
var propId = _a.id, _b = _a.placement, initialPlacement = _b === void 0 ? 'auto' : _b, children = _a.children, portal = _a.portal, target = _a.target, _c = _a.association, association = _c === void 0 ? 'aria-describedby' : _c, _d = _a.variant, variant = _d === void 0 ? 'text' : _d,
|
|
1657
|
+
var propId = _a.id, _b = _a.placement, initialPlacement = _b === void 0 ? 'auto' : _b, children = _a.children, portal = _a.portal, target = _a.target, _c = _a.association, association = _c === void 0 ? 'aria-describedby' : _c, _d = _a.variant, variant = _d === void 0 ? 'text' : _d, showProp = _a.show, _e = _a.defaultShow, defaultShow = _e === void 0 ? false : _e, _f = _a.hideElementOnHidden, hideElementOnHidden = _f === void 0 ? false : _f, className = _a.className, props = tslib.__rest(_a, ["id", "placement", "children", "portal", "target", "association", "variant", "show", "defaultShow", "hideElementOnHidden", "className"]);
|
|
1658
1658
|
var _g = tslib.__read(propId ? [propId] : nextId.useId(1, 'tooltip'), 1), id = _g[0];
|
|
1659
1659
|
var hideTimeoutRef = React.useRef(null);
|
|
1660
|
-
var _h = tslib.__read(React.useState(!!
|
|
1660
|
+
var _h = tslib.__read(React.useState(!!showProp || defaultShow), 2), showTooltip = _h[0], setShowTooltip = _h[1];
|
|
1661
1661
|
var _j = tslib.__read(React.useState(null), 2), targetElement = _j[0], setTargetElement = _j[1];
|
|
1662
1662
|
var _k = tslib.__read(React.useState(null), 2), tooltipElement = _k[0], setTooltipElement = _k[1];
|
|
1663
1663
|
var _l = tslib.__read(React.useState(null), 2), arrowElement = _l[0], setArrowElement = _l[1];
|
|
@@ -1709,12 +1709,20 @@ function Tooltip(_a) {
|
|
|
1709
1709
|
fireCustomEvent(false, targetElement);
|
|
1710
1710
|
}, TIP_HIDE_DELAY);
|
|
1711
1711
|
}
|
|
1712
|
+
return function () {
|
|
1713
|
+
clearTimeout(hideTimeoutRef.current);
|
|
1714
|
+
};
|
|
1712
1715
|
}, [targetElement]);
|
|
1713
1716
|
// Keep targetElement in sync with target prop
|
|
1714
1717
|
React.useEffect(function () {
|
|
1715
1718
|
var targetElement = target && 'current' in target ? target.current : target;
|
|
1716
1719
|
setTargetElement(targetElement);
|
|
1717
1720
|
}, [target]);
|
|
1721
|
+
React.useEffect(function () {
|
|
1722
|
+
if (typeof showProp === 'boolean') {
|
|
1723
|
+
setShowTooltip(showProp);
|
|
1724
|
+
}
|
|
1725
|
+
}, [showProp]);
|
|
1718
1726
|
// Get popper placement
|
|
1719
1727
|
var placement = (attributes.popper &&
|
|
1720
1728
|
attributes.popper['data-popper-placement']) ||
|
|
@@ -1729,7 +1737,7 @@ function Tooltip(_a) {
|
|
|
1729
1737
|
}
|
|
1730
1738
|
};
|
|
1731
1739
|
var targetElement = document.body;
|
|
1732
|
-
if (showTooltip) {
|
|
1740
|
+
if (showTooltip && typeof showProp !== 'boolean') {
|
|
1733
1741
|
targetElement.addEventListener('keyup', handleEscape, { capture: true });
|
|
1734
1742
|
}
|
|
1735
1743
|
else {
|
|
@@ -1742,29 +1750,33 @@ function Tooltip(_a) {
|
|
|
1742
1750
|
capture: true
|
|
1743
1751
|
});
|
|
1744
1752
|
};
|
|
1745
|
-
}, [showTooltip]);
|
|
1753
|
+
}, [showTooltip, showProp]);
|
|
1746
1754
|
// Handle hover and focus events for the targetElement
|
|
1747
1755
|
React.useEffect(function () {
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1756
|
+
if (typeof showProp !== 'boolean') {
|
|
1757
|
+
targetElement === null || targetElement === void 0 ? void 0 : targetElement.addEventListener('mouseenter', show);
|
|
1758
|
+
targetElement === null || targetElement === void 0 ? void 0 : targetElement.addEventListener('mouseleave', hide);
|
|
1759
|
+
targetElement === null || targetElement === void 0 ? void 0 : targetElement.addEventListener('focusin', show);
|
|
1760
|
+
targetElement === null || targetElement === void 0 ? void 0 : targetElement.addEventListener('focusout', hide);
|
|
1761
|
+
}
|
|
1752
1762
|
return function () {
|
|
1753
1763
|
targetElement === null || targetElement === void 0 ? void 0 : targetElement.removeEventListener('mouseenter', show);
|
|
1754
1764
|
targetElement === null || targetElement === void 0 ? void 0 : targetElement.removeEventListener('mouseleave', hide);
|
|
1755
1765
|
targetElement === null || targetElement === void 0 ? void 0 : targetElement.removeEventListener('focusin', show);
|
|
1756
1766
|
targetElement === null || targetElement === void 0 ? void 0 : targetElement.removeEventListener('focusout', hide);
|
|
1757
1767
|
};
|
|
1758
|
-
}, [targetElement, show, hide]);
|
|
1768
|
+
}, [targetElement, show, hide, showProp]);
|
|
1759
1769
|
// Handle hover events for the tooltipElement
|
|
1760
1770
|
React.useEffect(function () {
|
|
1761
|
-
|
|
1762
|
-
|
|
1771
|
+
if (typeof showProp !== 'boolean') {
|
|
1772
|
+
tooltipElement === null || tooltipElement === void 0 ? void 0 : tooltipElement.addEventListener('mouseenter', show);
|
|
1773
|
+
tooltipElement === null || tooltipElement === void 0 ? void 0 : tooltipElement.addEventListener('mouseleave', hide);
|
|
1774
|
+
}
|
|
1763
1775
|
return function () {
|
|
1764
1776
|
tooltipElement === null || tooltipElement === void 0 ? void 0 : tooltipElement.removeEventListener('mouseenter', show);
|
|
1765
1777
|
tooltipElement === null || tooltipElement === void 0 ? void 0 : tooltipElement.removeEventListener('mouseleave', hide);
|
|
1766
1778
|
};
|
|
1767
|
-
}, [tooltipElement, show, hide]);
|
|
1779
|
+
}, [tooltipElement, show, hide, showProp]);
|
|
1768
1780
|
// Keep the target's id in sync
|
|
1769
1781
|
React.useEffect(function () {
|
|
1770
1782
|
if (hasAriaAssociation) {
|
|
@@ -2601,6 +2613,19 @@ var Tag = function (_a) {
|
|
|
2601
2613
|
};
|
|
2602
2614
|
Tag.displayName = 'Tag';
|
|
2603
2615
|
|
|
2616
|
+
var BadgeLabel = React.forwardRef(function (_a, ref) {
|
|
2617
|
+
var children = _a.children, className = _a.className, other = tslib.__rest(_a, ["children", "className"]);
|
|
2618
|
+
return (React__default["default"].createElement("div", tslib.__assign({ ref: ref, className: classNames__default["default"]('Badge__Label', className) }, other), children));
|
|
2619
|
+
});
|
|
2620
|
+
BadgeLabel.displayName = 'BadgeLabel';
|
|
2621
|
+
var Badge = React.forwardRef(function (_a, ref) {
|
|
2622
|
+
var children = _a.children, className = _a.className, _b = _a.size, size = _b === void 0 ? 'default' : _b, other = tslib.__rest(_a, ["children", "className", "size"]);
|
|
2623
|
+
return (React__default["default"].createElement("div", tslib.__assign({ className: classNames__default["default"]('Badge', className, {
|
|
2624
|
+
'Badge--small': size === 'small'
|
|
2625
|
+
}), ref: ref }, other), children));
|
|
2626
|
+
});
|
|
2627
|
+
Badge.displayName = 'Badge';
|
|
2628
|
+
|
|
2604
2629
|
var TagButton = React__default["default"].forwardRef(function (_a, ref) {
|
|
2605
2630
|
var label = _a.label, value = _a.value, icon = _a.icon, className = _a.className, rest = tslib.__rest(_a, ["label", "value", "icon", "className"]);
|
|
2606
2631
|
return (React__default["default"].createElement(Button, tslib.__assign({ variant: "tag", className: classNames__default["default"]('TagButton', className), ref: ref }, rest),
|
|
@@ -3167,13 +3192,13 @@ var iconTypeMap = {
|
|
|
3167
3192
|
};
|
|
3168
3193
|
var Notice = React.forwardRef(function (_a, ref) {
|
|
3169
3194
|
var _b;
|
|
3170
|
-
var _c = _a.type, type = _c === void 0 ? 'info' : _c, title = _a.title, icon = _a.icon, children = _a.children, otherProps = tslib.__rest(_a, ["type", "title", "icon", "children"]);
|
|
3195
|
+
var _c = _a.type, type = _c === void 0 ? 'info' : _c, title = _a.title, icon = _a.icon, _d = _a.variant, variant = _d === void 0 ? 'default' : _d, children = _a.children, otherProps = tslib.__rest(_a, ["type", "title", "icon", "variant", "children"]);
|
|
3171
3196
|
return (React__default["default"].createElement("div", tslib.__assign({ className: classNames__default["default"]('Notice', (_b = {},
|
|
3172
3197
|
_b["Notice--".concat(type)] = type,
|
|
3198
|
+
_b["Notice--condensed"] = variant === 'condensed',
|
|
3173
3199
|
_b)), ref: ref }, otherProps),
|
|
3174
|
-
React__default["default"].createElement(
|
|
3175
|
-
|
|
3176
|
-
title),
|
|
3200
|
+
React__default["default"].createElement(Icon, { type: icon || iconTypeMap[type] }),
|
|
3201
|
+
React__default["default"].createElement("div", { className: "Notice__title" }, title),
|
|
3177
3202
|
children && React__default["default"].createElement("div", { className: "Notice__content" }, children)));
|
|
3178
3203
|
});
|
|
3179
3204
|
Notice.displayName = 'Notice';
|
|
@@ -4100,6 +4125,8 @@ exports.Alert = Alert;
|
|
|
4100
4125
|
exports.AlertActions = AlertActions;
|
|
4101
4126
|
exports.AlertContent = AlertContent;
|
|
4102
4127
|
exports.AriaIsolate = AriaIsolate;
|
|
4128
|
+
exports.Badge = Badge;
|
|
4129
|
+
exports.BadgeLabel = BadgeLabel;
|
|
4103
4130
|
exports.Breadcrumb = Breadcrumb;
|
|
4104
4131
|
exports.BreadcrumbItem = BreadcrumbItem;
|
|
4105
4132
|
exports.BreadcrumbLink = BreadcrumbLink;
|
package/package.json
CHANGED