@deque/cauldron-react 1.0.0-canary.3ad6ac95 → 1.0.0-canary.5aade533
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,10 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { TooltipProps } from '../Tooltip';
|
|
3
|
+
interface IconButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
4
4
|
icon: string;
|
|
5
5
|
label: string;
|
|
6
|
-
tooltipPlacement?:
|
|
7
|
-
|
|
6
|
+
tooltipPlacement?: TooltipProps['placement'];
|
|
7
|
+
tooltipVariant?: TooltipProps['variant'];
|
|
8
|
+
tooltipPortal?: TooltipProps['portal'];
|
|
9
|
+
variant?: 'primary' | 'secondary' | 'error';
|
|
8
10
|
}
|
|
9
11
|
declare const IconButton: React.ForwardRefExoticComponent<IconButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
10
12
|
export default IconButton;
|
package/lib/index.js
CHANGED
|
@@ -472,11 +472,10 @@ var TopBar = /** @class */ (function (_super) {
|
|
|
472
472
|
}(React__default.Component));
|
|
473
473
|
|
|
474
474
|
var TopBar$1 = function (props) {
|
|
475
|
-
var children = props.children, className = props.className,
|
|
475
|
+
var children = props.children, className = props.className, other = tslib.__rest(props, ["children", "className"]);
|
|
476
476
|
return (React__default.createElement("div", tslib.__assign({ className: classNames(className, {
|
|
477
477
|
// TopBar's default style is dark mode
|
|
478
|
-
TopBar: true
|
|
479
|
-
'TopBar--light': variant === 'light'
|
|
478
|
+
TopBar: true
|
|
480
479
|
}) }, other), children));
|
|
481
480
|
};
|
|
482
481
|
|
|
@@ -1251,6 +1250,7 @@ var SkipLink = /** @class */ (function (_super) {
|
|
|
1251
1250
|
return (React__default.createElement("nav", tslib.__assign({ className: classNames('SkipLink', currentClass) }, other),
|
|
1252
1251
|
React__default.createElement("a", { href: target, className: "SkipLink__link", onClick: this.onClick, onFocus: this.onFocus, onBlur: this.onBlur },
|
|
1253
1252
|
React__default.createElement("span", { className: "SkipLink__item--first" }, skipText),
|
|
1253
|
+
"\u00A0",
|
|
1254
1254
|
React__default.createElement("span", { className: "SkipLink__item--second" }, targetText))));
|
|
1255
1255
|
};
|
|
1256
1256
|
SkipLink.prototype.onClick = function () {
|
|
@@ -1471,20 +1471,18 @@ var TooltipContent = function (_a) {
|
|
|
1471
1471
|
};
|
|
1472
1472
|
|
|
1473
1473
|
var IconButton = React.forwardRef(function (_a, ref) {
|
|
1474
|
-
var icon = _a.icon, label = _a.label, _b = _a.tooltipPlacement, tooltipPlacement = _b === void 0 ? 'auto' : _b, className = _a.className, _c = _a.variant, variant = _c === void 0 ? 'secondary' : _c, disabled = _a.disabled, other = tslib.__rest(_a, ["icon", "label", "tooltipPlacement", "className", "variant", "disabled"]);
|
|
1474
|
+
var icon = _a.icon, label = _a.label, _b = _a.tooltipPlacement, tooltipPlacement = _b === void 0 ? 'auto' : _b, tooltipVariant = _a.tooltipVariant, tooltipPortal = _a.tooltipPortal, className = _a.className, _c = _a.variant, variant = _c === void 0 ? 'secondary' : _c, disabled = _a.disabled, other = tslib.__rest(_a, ["icon", "label", "tooltipPlacement", "tooltipVariant", "tooltipPortal", "className", "variant", "disabled"]);
|
|
1475
1475
|
var buttonRef = React.useRef();
|
|
1476
1476
|
React.useImperativeHandle(ref, function () { return buttonRef.current; });
|
|
1477
1477
|
return (React__default.createElement(React__default.Fragment, null,
|
|
1478
1478
|
React__default.createElement("button", tslib.__assign({ type: 'button', className: classNames(className, {
|
|
1479
1479
|
IconButton: true,
|
|
1480
|
-
'IconButton--light': variant === 'light',
|
|
1481
|
-
'IconButton--dark': variant === 'dark',
|
|
1482
1480
|
'IconButton--primary': variant === 'primary',
|
|
1483
1481
|
'IconButton--secondary': variant === 'secondary',
|
|
1484
1482
|
'IconButton--error': variant === 'error'
|
|
1485
1483
|
}), ref: buttonRef, disabled: disabled }, other),
|
|
1486
1484
|
React__default.createElement(Icon, { type: icon })),
|
|
1487
|
-
!disabled && (React__default.createElement(Tooltip, { target: buttonRef, placement: tooltipPlacement, association: "aria-labelledby", hideElementOnHidden: true }, label))));
|
|
1485
|
+
!disabled && (React__default.createElement(Tooltip, { target: buttonRef, placement: tooltipPlacement, variant: tooltipVariant, portal: tooltipPortal, association: "aria-labelledby", hideElementOnHidden: true }, label))));
|
|
1488
1486
|
});
|
|
1489
1487
|
IconButton.propTypes = {
|
|
1490
1488
|
icon: PropTypes.string.isRequired,
|
|
@@ -1492,6 +1490,9 @@ IconButton.propTypes = {
|
|
|
1492
1490
|
// @ts-ignore
|
|
1493
1491
|
tooltipPlacement: PropTypes.string,
|
|
1494
1492
|
// @ts-ignore
|
|
1493
|
+
tooltipVariant: PropTypes.string,
|
|
1494
|
+
tooltipPortal: PropTypes.any,
|
|
1495
|
+
// @ts-ignore
|
|
1495
1496
|
variant: PropTypes.string
|
|
1496
1497
|
};
|
|
1497
1498
|
IconButton.displayName = 'IconButton';
|