@deque/cauldron-react 6.4.1-canary.fead02fc → 6.4.2-canary.0b8be6a5

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.
package/lib/cauldron.css CHANGED
@@ -42,11 +42,10 @@
42
42
  a.Button--primary,
43
43
  a.Button--secondary {
44
44
  text-decoration: none;
45
- padding: 9px 18px;
46
45
  }
47
46
 
48
47
  a.Button--thin {
49
- padding: 0 16px;
48
+ padding: 0 var(--space-small);
50
49
  }
51
50
 
52
51
  .Icon {
@@ -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;
@@ -1,7 +1,7 @@
1
1
  import React, { ButtonHTMLAttributes, Ref } from 'react';
2
2
  export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
3
3
  buttonRef?: Ref<HTMLButtonElement>;
4
- variant?: 'primary' | 'secondary' | 'error' | 'link' | 'tag';
4
+ variant?: 'primary' | 'secondary' | 'tertiary' | 'error' | 'link' | 'tag';
5
5
  thin?: boolean;
6
6
  }
7
7
  declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
@@ -19,7 +19,7 @@ export interface IconButtonProps extends PolymorphicProps<React.HTMLAttributes<H
19
19
  * @deprecated use `tooltipProps.portal` instead
20
20
  */
21
21
  tooltipPortal?: TooltipProps['portal'];
22
- variant?: 'primary' | 'secondary' | 'error';
22
+ variant?: 'primary' | 'secondary' | 'tertiary' | 'error';
23
23
  large?: boolean;
24
24
  }
25
25
  declare const IconButton: PolymorphicComponent<IconButtonProps>;
@@ -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: initialShow, hideElementOnHidden, className, ...props }: TooltipProps): JSX.Element;
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
@@ -1594,6 +1594,7 @@ var Button = React.forwardRef(function (_a, ref) {
1594
1594
  'Button--primary': variant === 'primary',
1595
1595
  'Button--secondary': variant === 'secondary',
1596
1596
  'Button--error': variant === 'error',
1597
+ 'Button--tertiary': variant === 'tertiary',
1597
1598
  Link: variant === 'link',
1598
1599
  Tag: variant === 'tag',
1599
1600
  'Button--tag': variant === 'tag',
@@ -1653,10 +1654,10 @@ var fireCustomEvent = function (show, button) {
1653
1654
  };
1654
1655
  function Tooltip(_a) {
1655
1656
  var _this = this;
1656
- 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, _e = _a.show, initialShow = _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", "hideElementOnHidden", "className"]);
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"]);
1657
1658
  var _g = tslib.__read(propId ? [propId] : nextId.useId(1, 'tooltip'), 1), id = _g[0];
1658
1659
  var hideTimeoutRef = React.useRef(null);
1659
- var _h = tslib.__read(React.useState(!!initialShow), 2), showTooltip = _h[0], setShowTooltip = _h[1];
1660
+ var _h = tslib.__read(React.useState(!!showProp || defaultShow), 2), showTooltip = _h[0], setShowTooltip = _h[1];
1660
1661
  var _j = tslib.__read(React.useState(null), 2), targetElement = _j[0], setTargetElement = _j[1];
1661
1662
  var _k = tslib.__read(React.useState(null), 2), tooltipElement = _k[0], setTooltipElement = _k[1];
1662
1663
  var _l = tslib.__read(React.useState(null), 2), arrowElement = _l[0], setArrowElement = _l[1];
@@ -1708,12 +1709,20 @@ function Tooltip(_a) {
1708
1709
  fireCustomEvent(false, targetElement);
1709
1710
  }, TIP_HIDE_DELAY);
1710
1711
  }
1712
+ return function () {
1713
+ clearTimeout(hideTimeoutRef.current);
1714
+ };
1711
1715
  }, [targetElement]);
1712
1716
  // Keep targetElement in sync with target prop
1713
1717
  React.useEffect(function () {
1714
1718
  var targetElement = target && 'current' in target ? target.current : target;
1715
1719
  setTargetElement(targetElement);
1716
1720
  }, [target]);
1721
+ React.useEffect(function () {
1722
+ if (typeof showProp === 'boolean') {
1723
+ setShowTooltip(showProp);
1724
+ }
1725
+ }, [showProp]);
1717
1726
  // Get popper placement
1718
1727
  var placement = (attributes.popper &&
1719
1728
  attributes.popper['data-popper-placement']) ||
@@ -1728,38 +1737,46 @@ function Tooltip(_a) {
1728
1737
  }
1729
1738
  };
1730
1739
  var targetElement = document.body;
1731
- if (showTooltip) {
1732
- targetElement.addEventListener('keyup', handleEscape);
1740
+ if (showTooltip && typeof showProp !== 'boolean') {
1741
+ targetElement.addEventListener('keyup', handleEscape, { capture: true });
1733
1742
  }
1734
1743
  else {
1735
- targetElement.removeEventListener('keyup', handleEscape);
1744
+ targetElement.removeEventListener('keyup', handleEscape, {
1745
+ capture: true
1746
+ });
1736
1747
  }
1737
1748
  return function () {
1738
- targetElement.removeEventListener('keyup', handleEscape);
1749
+ targetElement.removeEventListener('keyup', handleEscape, {
1750
+ capture: true
1751
+ });
1739
1752
  };
1740
- }, [showTooltip]);
1753
+ }, [showTooltip, showProp]);
1741
1754
  // Handle hover and focus events for the targetElement
1742
1755
  React.useEffect(function () {
1743
- targetElement === null || targetElement === void 0 ? void 0 : targetElement.addEventListener('mouseenter', show);
1744
- targetElement === null || targetElement === void 0 ? void 0 : targetElement.addEventListener('mouseleave', hide);
1745
- targetElement === null || targetElement === void 0 ? void 0 : targetElement.addEventListener('focusin', show);
1746
- targetElement === null || targetElement === void 0 ? void 0 : targetElement.addEventListener('focusout', hide);
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
+ }
1747
1762
  return function () {
1748
1763
  targetElement === null || targetElement === void 0 ? void 0 : targetElement.removeEventListener('mouseenter', show);
1749
1764
  targetElement === null || targetElement === void 0 ? void 0 : targetElement.removeEventListener('mouseleave', hide);
1750
1765
  targetElement === null || targetElement === void 0 ? void 0 : targetElement.removeEventListener('focusin', show);
1751
1766
  targetElement === null || targetElement === void 0 ? void 0 : targetElement.removeEventListener('focusout', hide);
1752
1767
  };
1753
- }, [targetElement, show, hide]);
1768
+ }, [targetElement, show, hide, showProp]);
1754
1769
  // Handle hover events for the tooltipElement
1755
1770
  React.useEffect(function () {
1756
- tooltipElement === null || tooltipElement === void 0 ? void 0 : tooltipElement.addEventListener('mouseenter', show);
1757
- tooltipElement === null || tooltipElement === void 0 ? void 0 : tooltipElement.addEventListener('mouseleave', hide);
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
+ }
1758
1775
  return function () {
1759
1776
  tooltipElement === null || tooltipElement === void 0 ? void 0 : tooltipElement.removeEventListener('mouseenter', show);
1760
1777
  tooltipElement === null || tooltipElement === void 0 ? void 0 : tooltipElement.removeEventListener('mouseleave', hide);
1761
1778
  };
1762
- }, [tooltipElement, show, hide]);
1779
+ }, [tooltipElement, show, hide, showProp]);
1763
1780
  // Keep the target's id in sync
1764
1781
  React.useEffect(function () {
1765
1782
  if (hasAriaAssociation) {
@@ -1835,6 +1852,7 @@ var IconButton = React.forwardRef(function (_a, ref) {
1835
1852
  IconButton: true,
1836
1853
  'IconButton--primary': variant === 'primary',
1837
1854
  'IconButton--secondary': variant === 'secondary',
1855
+ 'IconButton--tertiary': variant === 'tertiary',
1838
1856
  'IconButton--error': variant === 'error',
1839
1857
  'IconButton--large': large
1840
1858
  }), ref: internalRef, disabled: disabled, tabIndex: disabled ? -1 : tabIndex }, accessibilityProps, other),
@@ -2595,6 +2613,19 @@ var Tag = function (_a) {
2595
2613
  };
2596
2614
  Tag.displayName = 'Tag';
2597
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
+
2598
2629
  var TagButton = React__default["default"].forwardRef(function (_a, ref) {
2599
2630
  var label = _a.label, value = _a.value, icon = _a.icon, className = _a.className, rest = tslib.__rest(_a, ["label", "value", "icon", "className"]);
2600
2631
  return (React__default["default"].createElement(Button, tslib.__assign({ variant: "tag", className: classNames__default["default"]('TagButton', className), ref: ref }, rest),
@@ -3161,13 +3192,13 @@ var iconTypeMap = {
3161
3192
  };
3162
3193
  var Notice = React.forwardRef(function (_a, ref) {
3163
3194
  var _b;
3164
- 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"]);
3165
3196
  return (React__default["default"].createElement("div", tslib.__assign({ className: classNames__default["default"]('Notice', (_b = {},
3166
3197
  _b["Notice--".concat(type)] = type,
3198
+ _b["Notice--condensed"] = variant === 'condensed',
3167
3199
  _b)), ref: ref }, otherProps),
3168
- React__default["default"].createElement("div", { className: "Notice__title" },
3169
- React__default["default"].createElement(Icon, { type: icon || iconTypeMap[type] }),
3170
- title),
3200
+ React__default["default"].createElement(Icon, { type: icon || iconTypeMap[type] }),
3201
+ React__default["default"].createElement("div", { className: "Notice__title" }, title),
3171
3202
  children && React__default["default"].createElement("div", { className: "Notice__content" }, children)));
3172
3203
  });
3173
3204
  Notice.displayName = 'Notice';
@@ -4094,6 +4125,8 @@ exports.Alert = Alert;
4094
4125
  exports.AlertActions = AlertActions;
4095
4126
  exports.AlertContent = AlertContent;
4096
4127
  exports.AriaIsolate = AriaIsolate;
4128
+ exports.Badge = Badge;
4129
+ exports.BadgeLabel = BadgeLabel;
4097
4130
  exports.Breadcrumb = Breadcrumb;
4098
4131
  exports.BreadcrumbItem = BreadcrumbItem;
4099
4132
  exports.BreadcrumbLink = BreadcrumbLink;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deque/cauldron-react",
3
- "version": "6.4.1-canary.fead02fc",
3
+ "version": "6.4.2-canary.0b8be6a5",
4
4
  "license": "MPL-2.0",
5
5
  "description": "Fully accessible react components library for Deque Cauldron",
6
6
  "homepage": "https://cauldron.dequelabs.com/",
@@ -47,7 +47,6 @@
47
47
  "@testing-library/react": "^12",
48
48
  "@testing-library/user-event": "^14.5.2",
49
49
  "@types/classnames": "^2.2.10",
50
- "@types/enzyme-adapter-react-16": "^1.0.9",
51
50
  "@types/jest": "^29.5.11",
52
51
  "@types/jest-axe": "^3.5.4",
53
52
  "@types/node": "^17.0.42",
@@ -59,8 +58,6 @@
59
58
  "babel-plugin-module-resolver": "^4.0.0",
60
59
  "babel-plugin-transform-export-extensions": "^6.22.0",
61
60
  "concurrently": "^5.3.0",
62
- "enzyme": "^3.11.0",
63
- "enzyme-adapter-react-16": "^1.15.2",
64
61
  "jest": "^29.7.0",
65
62
  "jest-axe": "^8.0.0",
66
63
  "jest-environment-jsdom": "^29.7.0",