@doist/reactist 13.0.0 → 14.1.1

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.
Files changed (29) hide show
  1. package/dist/reactist.cjs.development.js +42 -24
  2. package/dist/reactist.cjs.development.js.map +1 -1
  3. package/dist/reactist.cjs.production.min.js +1 -1
  4. package/dist/reactist.cjs.production.min.js.map +1 -1
  5. package/es/components/color-picker/color-picker.js +1 -0
  6. package/es/components/color-picker/color-picker.js.map +1 -1
  7. package/es/components/deprecated-dropdown/dropdown.js +4 -2
  8. package/es/components/deprecated-dropdown/dropdown.js.map +1 -1
  9. package/es/components/tooltip/tooltip.js +12 -6
  10. package/es/components/tooltip/tooltip.js.map +1 -1
  11. package/es/new-components/tabs/tabs.js +25 -15
  12. package/es/new-components/tabs/tabs.js.map +1 -1
  13. package/es/new-components/tabs/tabs.module.css.js +1 -1
  14. package/lib/components/color-picker/color-picker.js +1 -1
  15. package/lib/components/color-picker/color-picker.js.map +1 -1
  16. package/lib/components/deprecated-dropdown/dropdown.d.ts +6 -2
  17. package/lib/components/deprecated-dropdown/dropdown.js +1 -1
  18. package/lib/components/deprecated-dropdown/dropdown.js.map +1 -1
  19. package/lib/components/tooltip/tooltip.d.ts +1 -1
  20. package/lib/components/tooltip/tooltip.js +1 -1
  21. package/lib/components/tooltip/tooltip.js.map +1 -1
  22. package/lib/new-components/tabs/tabs.d.ts +5 -10
  23. package/lib/new-components/tabs/tabs.js +1 -1
  24. package/lib/new-components/tabs/tabs.js.map +1 -1
  25. package/lib/new-components/tabs/tabs.module.css.js +1 -1
  26. package/package.json +4 -6
  27. package/styles/reactist.css +1 -1
  28. package/styles/tabs.css +3 -3
  29. package/styles/tabs.module.css.css +1 -1
@@ -479,9 +479,13 @@ function Tooltip(_ref) {
479
479
  });
480
480
  const child = React__default.Children.only(children);
481
481
 
482
- if (!content) {
482
+ if (!content || !child) {
483
483
  return child;
484
484
  }
485
+
486
+ if (typeof child.ref === 'string') {
487
+ throw new Error('Tooltip: String refs cannot be used as they cannot be forwarded');
488
+ }
485
489
  /**
486
490
  * Prevents the tooltip from automatically firing on focus all the time. This is to prevent
487
491
  * tooltips from showing when the trigger element is focused back after a popover or dialog that
@@ -513,13 +517,15 @@ function Tooltip(_ref) {
513
517
  child == null ? void 0 : (_child$props = child.props) == null ? void 0 : _child$props.onFocus == null ? void 0 : _child$props.onFocus(event);
514
518
  }
515
519
 
516
- return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(tooltip.TooltipAnchor, _objectSpread2(_objectSpread2({
517
- state: state
518
- }, child.props), {}, {
520
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(tooltip.TooltipAnchor, {
521
+ state: state,
519
522
  ref: child.ref,
520
523
  onFocus: handleFocus
521
- }), anchorProps => {
522
- return /*#__PURE__*/React__default.cloneElement(child, anchorProps);
524
+ }, anchorProps => {
525
+ // Let child props override anchor props so user can specify attributes like tabIndex
526
+ // Also, do not apply the child's props to TooltipAnchor as props like `as` can create problems
527
+ // by applying the replacement component/element twice
528
+ return /*#__PURE__*/React__default.cloneElement(child, _objectSpread2(_objectSpread2({}, anchorProps), child.props));
523
529
  }), state.visible ? /*#__PURE__*/React__default.createElement(tooltip.Tooltip, _objectSpread2(_objectSpread2({}, props), {}, {
524
530
  state: state,
525
531
  className: classNames('reactist_tooltip', className)
@@ -1552,7 +1558,7 @@ function usePrevious(value) {
1552
1558
  return ref.current;
1553
1559
  }
1554
1560
 
1555
- var modules_40c67f5b = {"tab":"_15d4bbf4","tab-normal":"ca31866d","tab-primary":"_421272bd","tab-secondary":"acbdf95a","tab-tertiary":"_8c59ab40","tab-plain":"a41904c9"};
1561
+ var modules_40c67f5b = {"tab":"a1064a3b","track":"_06f1b8a1","tab-neutral":"dabbec7d","tab-themed":"e6f5ae4e","track-neutral":"_43913ce5","track-themed":"_39bdfdde","track-xsmall":"_1c148f4e","track-small":"_2a370df5","track-medium":"_77430437","track-large":"_33db5352","track-xlarge":"_60bf9564","track-xxlarge":"_29a35080"};
1556
1562
 
1557
1563
  const _excluded$m = ["as", "children", "id", "exceptionallySetClassName"],
1558
1564
  _excluded2$1 = ["children", "space"],
@@ -1566,8 +1572,7 @@ function Tabs({
1566
1572
  children,
1567
1573
  selectedId,
1568
1574
  defaultSelectedId,
1569
- color = 'primary',
1570
- variant = 'normal',
1575
+ variant = 'neutral',
1571
1576
  onSelectedIdChange
1572
1577
  }) {
1573
1578
  const tabState = tab.useTabState({
@@ -1587,10 +1592,9 @@ function Tabs({
1587
1592
  const memoizedTabState = React.useMemo(function memoizeTabState() {
1588
1593
  return {
1589
1594
  tabState,
1590
- color,
1591
1595
  variant
1592
1596
  };
1593
- }, [color, variant, tabState]);
1597
+ }, [variant, tabState]);
1594
1598
  return /*#__PURE__*/React.createElement(TabsContext.Provider, {
1595
1599
  value: memoizedTabState
1596
1600
  }, children);
@@ -1615,13 +1619,12 @@ const Tab = /*#__PURE__*/polymorphicComponent(function Tab(_ref, ref) {
1615
1619
  }
1616
1620
 
1617
1621
  const {
1618
- color,
1619
1622
  variant,
1620
1623
  tabState
1621
1624
  } = tabContextValue;
1622
1625
  return /*#__PURE__*/React.createElement(tab.Tab, _objectSpread2(_objectSpread2({}, props), {}, {
1623
1626
  as: as,
1624
- className: classNames(exceptionallySetClassName, modules_40c67f5b.tab, modules_40c67f5b["tab-" + (variant != null ? variant : '')], modules_40c67f5b["tab-" + (color != null ? color : '')]),
1627
+ className: classNames(exceptionallySetClassName, modules_40c67f5b.tab, modules_40c67f5b["tab-" + variant]),
1625
1628
  id: id,
1626
1629
  state: tabState,
1627
1630
  ref: ref
@@ -1634,7 +1637,7 @@ const Tab = /*#__PURE__*/polymorphicComponent(function Tab(_ref, ref) {
1634
1637
  function TabList(_ref2) {
1635
1638
  let {
1636
1639
  children,
1637
- space = 'medium'
1640
+ space = 'xsmall'
1638
1641
  } = _ref2,
1639
1642
  props = _objectWithoutProperties(_ref2, _excluded2$1);
1640
1643
 
@@ -1645,13 +1648,24 @@ function TabList(_ref2) {
1645
1648
  }
1646
1649
 
1647
1650
  const {
1648
- tabState
1651
+ tabState,
1652
+ variant
1649
1653
  } = tabContextValue;
1650
- return /*#__PURE__*/React.createElement(tab.TabList, _objectSpread2({
1651
- state: tabState
1652
- }, props), /*#__PURE__*/React.createElement(Inline, {
1653
- space: space
1654
- }, children));
1654
+ return (
1655
+ /*#__PURE__*/
1656
+ // The extra <Box> prevents <Inline>'s negative margins from collapsing when used in a flex container
1657
+ // which will render the track with the wrong height
1658
+ React.createElement(Box, null, /*#__PURE__*/React.createElement(tab.TabList, _objectSpread2({
1659
+ state: tabState,
1660
+ as: Box,
1661
+ position: "relative",
1662
+ width: "maxContent"
1663
+ }, props), /*#__PURE__*/React.createElement(Box, {
1664
+ className: classNames(modules_40c67f5b.track, modules_40c67f5b["track-" + space], modules_40c67f5b["track-" + variant])
1665
+ }), /*#__PURE__*/React.createElement(Inline, {
1666
+ space: space
1667
+ }, children)))
1668
+ );
1655
1669
  }
1656
1670
  /**
1657
1671
  * Used to define the content to be rendered when a tab is active. Each `<TabPanel>` must have a corresponding `<Tab>` component.
@@ -1682,13 +1696,14 @@ const TabPanel = /*#__PURE__*/polymorphicComponent(function TabPanel(_ref3, ref)
1682
1696
  const {
1683
1697
  tabState
1684
1698
  } = tabContextValue;
1685
- return /*#__PURE__*/React.createElement(tab.TabPanel, _objectSpread2(_objectSpread2({
1699
+ const shouldRender = render === 'always' || render === 'active' && tabIsActive || render === 'lazy' && (tabIsActive || tabRendered);
1700
+ return shouldRender ? /*#__PURE__*/React.createElement(tab.TabPanel, _objectSpread2(_objectSpread2({
1686
1701
  tabId: id
1687
1702
  }, props), {}, {
1688
1703
  state: tabState,
1689
1704
  as: as,
1690
1705
  ref: ref
1691
- }), render === 'always' ? children : null, render === 'active' && tabIsActive ? children : null, render === 'lazy' && (tabIsActive || tabRendered) ? children : null);
1706
+ }), children) : null;
1692
1707
  });
1693
1708
  /**
1694
1709
  * Allows content to be rendered based on the current tab being selected while outside of the TabPanel
@@ -2146,7 +2161,8 @@ class Box$1 extends React__default.Component {
2146
2161
  style: {
2147
2162
  display: 'inline-block'
2148
2163
  },
2149
- className: className
2164
+ className: className,
2165
+ "data-testid": "reactist-dropdown-box"
2150
2166
  }, top && this._getBodyComponent(), this._getTriggerComponent(), !top && this._getBodyComponent());
2151
2167
  }
2152
2168
 
@@ -2204,7 +2220,8 @@ function Body({
2204
2220
  ref: setPosition,
2205
2221
  style: style,
2206
2222
  className: "body",
2207
- id: "reactist-dropdown-body"
2223
+ id: "reactist-dropdown-body",
2224
+ "data-testid": "reactist-dropdown-body"
2208
2225
  }, children);
2209
2226
  }
2210
2227
 
@@ -2271,6 +2288,7 @@ function ColorItem({
2271
2288
  tooltip
2272
2289
  }) {
2273
2290
  const item = /*#__PURE__*/React__default.createElement("span", {
2291
+ "data-testid": "reactist-color-item",
2274
2292
  className: 'reactist color_item' + (isActive ? ' active' : ''),
2275
2293
  style: {
2276
2294
  backgroundColor: color