@deque/cauldron-react 6.4.2-canary.d63c6c5f → 6.4.2-canary.f1f01638

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 {
@@ -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>;
@@ -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.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,7 +1737,7 @@ function Tooltip(_a) {
1728
1737
  }
1729
1738
  };
1730
1739
  var targetElement = document.body;
1731
- if (showTooltip) {
1740
+ if (showTooltip && typeof showProp !== 'boolean') {
1732
1741
  targetElement.addEventListener('keyup', handleEscape, { capture: true });
1733
1742
  }
1734
1743
  else {
@@ -1741,29 +1750,33 @@ function Tooltip(_a) {
1741
1750
  capture: true
1742
1751
  });
1743
1752
  };
1744
- }, [showTooltip]);
1753
+ }, [showTooltip, showProp]);
1745
1754
  // Handle hover and focus events for the targetElement
1746
1755
  React.useEffect(function () {
1747
- targetElement === null || targetElement === void 0 ? void 0 : targetElement.addEventListener('mouseenter', show);
1748
- targetElement === null || targetElement === void 0 ? void 0 : targetElement.addEventListener('mouseleave', hide);
1749
- targetElement === null || targetElement === void 0 ? void 0 : targetElement.addEventListener('focusin', show);
1750
- 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
+ }
1751
1762
  return function () {
1752
1763
  targetElement === null || targetElement === void 0 ? void 0 : targetElement.removeEventListener('mouseenter', show);
1753
1764
  targetElement === null || targetElement === void 0 ? void 0 : targetElement.removeEventListener('mouseleave', hide);
1754
1765
  targetElement === null || targetElement === void 0 ? void 0 : targetElement.removeEventListener('focusin', show);
1755
1766
  targetElement === null || targetElement === void 0 ? void 0 : targetElement.removeEventListener('focusout', hide);
1756
1767
  };
1757
- }, [targetElement, show, hide]);
1768
+ }, [targetElement, show, hide, showProp]);
1758
1769
  // Handle hover events for the tooltipElement
1759
1770
  React.useEffect(function () {
1760
- tooltipElement === null || tooltipElement === void 0 ? void 0 : tooltipElement.addEventListener('mouseenter', show);
1761
- 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
+ }
1762
1775
  return function () {
1763
1776
  tooltipElement === null || tooltipElement === void 0 ? void 0 : tooltipElement.removeEventListener('mouseenter', show);
1764
1777
  tooltipElement === null || tooltipElement === void 0 ? void 0 : tooltipElement.removeEventListener('mouseleave', hide);
1765
1778
  };
1766
- }, [tooltipElement, show, hide]);
1779
+ }, [tooltipElement, show, hide, showProp]);
1767
1780
  // Keep the target's id in sync
1768
1781
  React.useEffect(function () {
1769
1782
  if (hasAriaAssociation) {
@@ -1839,6 +1852,7 @@ var IconButton = React.forwardRef(function (_a, ref) {
1839
1852
  IconButton: true,
1840
1853
  'IconButton--primary': variant === 'primary',
1841
1854
  'IconButton--secondary': variant === 'secondary',
1855
+ 'IconButton--tertiary': variant === 'tertiary',
1842
1856
  'IconButton--error': variant === 'error',
1843
1857
  'IconButton--large': large
1844
1858
  }), ref: internalRef, disabled: disabled, tabIndex: disabled ? -1 : tabIndex }, accessibilityProps, other),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deque/cauldron-react",
3
- "version": "6.4.2-canary.d63c6c5f",
3
+ "version": "6.4.2-canary.f1f01638",
4
4
  "license": "MPL-2.0",
5
5
  "description": "Fully accessible react components library for Deque Cauldron",
6
6
  "homepage": "https://cauldron.dequelabs.com/",