@doist/reactist 22.0.2-beta → 22.2.0

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 (74) hide show
  1. package/dist/reactist.cjs.development.js +203 -156
  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/alert/alert.js +4 -3
  6. package/es/alert/alert.js.map +1 -1
  7. package/es/alert/alert.module.css.js +1 -1
  8. package/es/base-field/base-field.module.css.js +1 -1
  9. package/es/checkbox-field/checkbox-field.js +1 -1
  10. package/es/checkbox-field/checkbox-field.js.map +1 -1
  11. package/es/hooks/use-previous/use-previous.js +26 -0
  12. package/es/hooks/use-previous/use-previous.js.map +1 -0
  13. package/es/icons/alert-icon.js +12 -12
  14. package/es/icons/alert-icon.js.map +1 -1
  15. package/es/menu/menu.js +38 -35
  16. package/es/menu/menu.js.map +1 -1
  17. package/es/modal/modal.js +4 -3
  18. package/es/modal/modal.js.map +1 -1
  19. package/es/select-field/select-field.module.css.js +1 -1
  20. package/es/tabs/tabs.js +47 -40
  21. package/es/tabs/tabs.js.map +1 -1
  22. package/es/text-area/text-area.module.css.js +1 -1
  23. package/es/text-field/text-field.module.css.js +1 -1
  24. package/es/toast/use-toasts.js +1 -1
  25. package/es/toast/use-toasts.js.map +1 -1
  26. package/es/tooltip/tooltip.js +62 -20
  27. package/es/tooltip/tooltip.js.map +1 -1
  28. package/lib/alert/alert.js +1 -1
  29. package/lib/alert/alert.js.map +1 -1
  30. package/lib/alert/alert.module.css.js +1 -1
  31. package/lib/base-field/base-field.module.css.js +1 -1
  32. package/lib/checkbox-field/checkbox-field.js +1 -1
  33. package/lib/checkbox-field/checkbox-field.js.map +1 -1
  34. package/lib/hooks/use-previous/use-previous.js +2 -0
  35. package/lib/hooks/use-previous/use-previous.js.map +1 -0
  36. package/lib/icons/alert-icon.js +1 -1
  37. package/lib/icons/alert-icon.js.map +1 -1
  38. package/lib/menu/menu.d.ts +4 -4
  39. package/lib/menu/menu.js +1 -1
  40. package/lib/menu/menu.js.map +1 -1
  41. package/lib/modal/modal.d.ts +2 -1
  42. package/lib/modal/modal.js +1 -1
  43. package/lib/modal/modal.js.map +1 -1
  44. package/lib/select-field/select-field.module.css.js +1 -1
  45. package/lib/tabs/tabs.d.ts +8 -10
  46. package/lib/tabs/tabs.js +1 -1
  47. package/lib/tabs/tabs.js.map +1 -1
  48. package/lib/text-area/text-area.module.css.js +1 -1
  49. package/lib/text-field/text-field.module.css.js +1 -1
  50. package/lib/toast/use-toasts.js +1 -1
  51. package/lib/toast/use-toasts.js.map +1 -1
  52. package/lib/tooltip/tooltip.d.ts +4 -2
  53. package/lib/tooltip/tooltip.js +1 -1
  54. package/lib/tooltip/tooltip.js.map +1 -1
  55. package/lib/utils/test-helpers.d.ts +2 -13
  56. package/package.json +4 -2
  57. package/styles/alert.css +1 -1
  58. package/styles/alert.module.css.css +1 -1
  59. package/styles/base-field.css +1 -1
  60. package/styles/base-field.module.css.css +1 -1
  61. package/styles/password-field.css +2 -2
  62. package/styles/reactist.css +6 -6
  63. package/styles/select-field.css +2 -2
  64. package/styles/select-field.module.css.css +1 -1
  65. package/styles/switch-field.css +1 -1
  66. package/styles/text-area.css +2 -2
  67. package/styles/text-area.module.css.css +1 -1
  68. package/styles/text-field.css +2 -2
  69. package/styles/text-field.module.css.css +1 -1
  70. package/es/checkbox-field/use-fork-ref.js +0 -35
  71. package/es/checkbox-field/use-fork-ref.js.map +0 -1
  72. package/lib/checkbox-field/use-fork-ref.d.ts +0 -11
  73. package/lib/checkbox-field/use-fork-ref.js +0 -2
  74. package/lib/checkbox-field/use-fork-ref.js.map +0 -1
@@ -8,10 +8,15 @@ var React = require('react');
8
8
  var React__default = _interopDefault(React);
9
9
  var classNames = _interopDefault(require('classnames'));
10
10
  var flattenChildren = _interopDefault(require('react-keyed-flatten-children'));
11
- var react = require('@ariakit/react');
11
+ var tooltip = require('ariakit/tooltip');
12
+ var portal = require('ariakit/portal');
13
+ var ariakitReactUtils = require('ariakit-react-utils');
12
14
  var useCallbackRef = require('use-callback-ref');
13
15
  var FocusLock = _interopDefault(require('react-focus-lock'));
14
16
  var ariaHidden = require('aria-hidden');
17
+ var dialog = require('ariakit/dialog');
18
+ var tab = require('ariakit/tab');
19
+ var Ariakit = require('ariakit/menu');
15
20
  var ReactDOM = _interopDefault(require('react-dom'));
16
21
  var dayjs = _interopDefault(require('dayjs'));
17
22
  var LocalizedFormat = _interopDefault(require('dayjs/plugin/localizedFormat'));
@@ -450,6 +455,18 @@ const HiddenVisually = /*#__PURE__*/polymorphicComponent(function HiddenVisually
450
455
 
451
456
  var modules_95f1407a = {"tooltip":"_487c82cd"};
452
457
 
458
+ const SHOW_DELAY = 500;
459
+ const HIDE_DELAY = 100;
460
+
461
+ function useDelayedTooltipState(initialState) {
462
+ const tooltipState = tooltip.useTooltipState(initialState);
463
+ const delay = useDelay();
464
+ return React.useMemo(() => _objectSpread2(_objectSpread2({}, tooltipState), {}, {
465
+ show: delay(() => tooltipState.show(), SHOW_DELAY),
466
+ hide: delay(() => tooltipState.hide(), HIDE_DELAY)
467
+ }), [delay, tooltipState]);
468
+ }
469
+
453
470
  function Tooltip({
454
471
  children,
455
472
  content,
@@ -458,12 +475,10 @@ function Tooltip({
458
475
  withArrow = false,
459
476
  exceptionallySetClassName
460
477
  }) {
461
- const tooltip = react.useTooltipStore({
478
+ const state = useDelayedTooltipState({
462
479
  placement: position,
463
- showTimeout: 500,
464
- hideTimeout: 100
480
+ gutter: gapSize
465
481
  });
466
- const isOpen = tooltip.useState('open');
467
482
  const child = React.Children.only(children);
468
483
 
469
484
  if (!child) {
@@ -492,7 +507,7 @@ function Tooltip({
492
507
  const eventKey = event.key;
493
508
 
494
509
  if (eventKey !== 'Escape' && eventKey !== 'Enter' && eventKey !== 'Space') {
495
- tooltip.show();
510
+ state.show();
496
511
  }
497
512
  }
498
513
 
@@ -507,23 +522,25 @@ function Tooltip({
507
522
  function handleBlur(event) {
508
523
  var _child$props2;
509
524
 
510
- tooltip.hide();
525
+ state.hide();
511
526
  child == null ? void 0 : (_child$props2 = child.props) == null ? void 0 : _child$props2.onBlur == null ? void 0 : _child$props2.onBlur(event);
512
527
  }
513
528
 
514
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(react.TooltipAnchor, {
515
- render: anchorProps => {
516
- return /*#__PURE__*/React.cloneElement(child, _objectSpread2(_objectSpread2(_objectSpread2({}, child.props), anchorProps), {}, {
517
- onFocus: handleFocus,
518
- onBlur: handleBlur
519
- }));
520
- },
521
- store: tooltip,
522
- ref: child.ref
523
- }), isOpen && content ? /*#__PURE__*/React.createElement(Box, {
524
- as: react.Tooltip,
525
- gutter: gapSize,
526
- store: tooltip,
529
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(tooltip.TooltipAnchor, {
530
+ state: state,
531
+ ref: child.ref,
532
+ described: true
533
+ }, anchorProps => {
534
+ // Let child props override anchor props so user can specify attributes like tabIndex
535
+ // Also, do not apply the child's props to TooltipAnchor as props like `as` can create problems
536
+ // by applying the replacement component/element twice
537
+ return /*#__PURE__*/React.cloneElement(child, _objectSpread2(_objectSpread2(_objectSpread2({}, anchorProps), child.props), {}, {
538
+ onFocus: handleFocus,
539
+ onBlur: handleBlur
540
+ }));
541
+ }), state.open && content ? /*#__PURE__*/React.createElement(Box, {
542
+ as: tooltip.Tooltip,
543
+ state: state,
527
544
  className: [modules_95f1407a.tooltip, exceptionallySetClassName],
528
545
  background: "toast",
529
546
  borderRadius: "standard",
@@ -533,7 +550,37 @@ function Tooltip({
533
550
  width: "fitContent",
534
551
  overflow: "hidden",
535
552
  textAlign: "center"
536
- }, withArrow ? /*#__PURE__*/React.createElement(react.TooltipArrow, null) : null, typeof content === 'function' ? content() : content) : null);
553
+ }, withArrow ? /*#__PURE__*/React.createElement(tooltip.TooltipArrow, null) : null, typeof content === 'function' ? content() : content) : null);
554
+ }
555
+ // Internal helpers
556
+ //
557
+
558
+ /**
559
+ * Returns a function offering the same interface as setTimeout, but cleans up on unmount.
560
+ *
561
+ * The timeout state is shared, and only one delayed function can be active at any given time. If
562
+ * a new delayed function is called while another one was waiting for its time to run, that older
563
+ * invocation is cleared and it never runs.
564
+ *
565
+ * This is suitable for our use case here, but probably not the most intuitive thing in general.
566
+ * That's why this is not made a shared util or something like it.
567
+ */
568
+
569
+ function useDelay() {
570
+ const timeoutRef = React.useRef();
571
+ const clearTimeouts = React.useCallback(function clearTimeouts() {
572
+ if (timeoutRef.current != null) {
573
+ clearTimeout(timeoutRef.current);
574
+ }
575
+ }, []); // Runs clearTimeouts when the component is unmounted
576
+
577
+ React.useEffect(() => clearTimeouts, [clearTimeouts]);
578
+ return React.useCallback(function delay(fn, delay) {
579
+ return () => {
580
+ clearTimeouts();
581
+ timeoutRef.current = setTimeout(fn, delay);
582
+ };
583
+ }, [clearTimeouts]);
537
584
  }
538
585
 
539
586
  var modules_c7f5018f = {"svg":"_51539197","spinner":"_54fbe2b3","tint":"a0c466ed","fill":"_745b73d3"};
@@ -678,56 +725,56 @@ function AlertIcon(_ref) {
678
725
 
679
726
  function AlertInfoIcon(props) {
680
727
  return /*#__PURE__*/React.createElement("svg", _objectSpread2({
728
+ xmlns: "http://www.w3.org/2000/svg",
681
729
  width: "24",
682
730
  height: "24",
683
- fill: "none",
684
- xmlns: "http://www.w3.org/2000/svg"
731
+ viewBox: "0 0 24 24"
685
732
  }, props), /*#__PURE__*/React.createElement("path", {
686
733
  fillRule: "evenodd",
687
734
  clipRule: "evenodd",
688
- d: "M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zm0-1a8 8 0 1 1 0-16 8 8 0 0 1 0 16zm1.18-11.84a.84.84 0 1 1-1.68 0 .84.84 0 0 1 1.68 0zM12.5 10a.5.5 0 0 1 .5.5V15h1a.5.5 0 0 1 0 1h-3a.5.5 0 0 1 0-1h1v-4h-1a.5.5 0 0 1 0-1h1.5z",
735
+ d: "M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-8-3.94a1 1 0 1 1-2 0 1 1 0 0 1 2 0ZM10.25 10a.75.75 0 0 0 0 1.5h1.25V15h-1.25a.75.75 0 0 0 0 1.5h3.5a.75.75 0 0 0 0-1.5H13v-4.25a.75.75 0 0 0-.75-.75h-2Z",
689
736
  fill: "currentColor"
690
737
  }));
691
738
  }
692
739
 
693
740
  function AlertPositiveIcon(props) {
694
741
  return /*#__PURE__*/React.createElement("svg", _objectSpread2({
742
+ xmlns: "http://www.w3.org/2000/svg",
695
743
  width: "24",
696
744
  height: "24",
697
- fill: "none",
698
- xmlns: "http://www.w3.org/2000/svg"
745
+ viewBox: "0 0 24 24"
699
746
  }, props), /*#__PURE__*/React.createElement("path", {
700
747
  fillRule: "evenodd",
701
748
  clipRule: "evenodd",
702
- d: "M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zm0-1a8 8 0 1 1 0-16 8 8 0 0 1 0 16zm-4.354-8.104a.5.5 0 0 1 .708 0l2.146 2.147 5.146-5.147a.5.5 0 0 1 .708.708l-5.5 5.5a.5.5 0 0 1-.708 0l-2.5-2.5a.5.5 0 0 1 0-.708z",
749
+ d: "M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-5.555-2.99a.75.75 0 0 1 1.06 1.06l-5.303 5.304a.748.748 0 0 1-1.061 0l-2.475-2.475a.75.75 0 0 1 1.06-1.06l1.945 1.944 4.774-4.773Z",
703
750
  fill: "currentColor"
704
751
  }));
705
752
  }
706
753
 
707
754
  function AlertCautionIcon(props) {
708
755
  return /*#__PURE__*/React.createElement("svg", _objectSpread2({
756
+ xmlns: "http://www.w3.org/2000/svg",
709
757
  width: "24",
710
758
  height: "24",
711
- fill: "none",
712
- xmlns: "http://www.w3.org/2000/svg"
759
+ viewBox: "0 0 24 24"
713
760
  }, props), /*#__PURE__*/React.createElement("path", {
714
761
  fillRule: "evenodd",
715
762
  clipRule: "evenodd",
716
- d: "m3.254 16.992 7.018-12.03a2 2 0 0 1 3.455 0l7.018 12.03A2 2 0 0 1 19.018 20H4.982a2 2 0 0 1-1.728-3.008zm8.242-11.887a1 1 0 0 0-.36.36l-7.018 12.03A1 1 0 0 0 4.982 19h14.036a1 1 0 0 0 .864-1.504l-7.018-12.03a1 1 0 0 0-1.368-.36zM13 16.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm-.014-7.014a.987.987 0 1 0-1.971.055l.236 4.25c.053.945 1.445.945 1.498 0l.236-4.25.001-.027v-.028z",
763
+ d: "m10.272 4.962-7.018 12.03A2 2 0 0 0 4.982 20h14.036a2 2 0 0 0 1.727-3.008l-7.018-12.03a2 2 0 0 0-3.455 0ZM13 16.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0Zm-.014-7.013A.987.987 0 0 0 12 8.5h-.028l-.027.002a.987.987 0 0 0-.93 1.04l.236 4.25c.052.944 1.445.944 1.498 0l.236-4.25a1.925 1.925 0 0 0 .001-.055Z",
717
764
  fill: "currentColor"
718
765
  }));
719
766
  }
720
767
 
721
768
  function AlertCriticalIcon(props) {
722
769
  return /*#__PURE__*/React.createElement("svg", _objectSpread2({
770
+ xmlns: "http://www.w3.org/2000/svg",
723
771
  width: "24",
724
772
  height: "24",
725
- fill: "none",
726
- xmlns: "http://www.w3.org/2000/svg"
773
+ viewBox: "0 0 24 24"
727
774
  }, props), /*#__PURE__*/React.createElement("path", {
728
775
  fillRule: "evenodd",
729
776
  clipRule: "evenodd",
730
- d: "M12 3.5a8.5 8.5 0 1 0 0 17 8.5 8.5 0 0 0 0-17zM2.5 12a9.5 9.5 0 1 1 19 0 9.5 9.5 0 0 1-19 0zM13 15.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm-.014-7.014A.987.987 0 0 0 12 7.5h-.027l-.028.002a.987.987 0 0 0-.93 1.04l.236 4.25c.053.944 1.445.944 1.498 0l.236-4.25.001-.028v-.027z",
777
+ d: "M12.9866 2.25049C12.3729 1.91683 11.6271 1.91683 11.0134 2.25049L4.04793 6.03744C3.40122 6.38904 2.99999 7.05702 2.99999 7.78208V15.2184C2.99999 15.9435 3.40122 16.6115 4.04793 16.963L11.0134 20.75C11.6271 21.0837 12.3729 21.0837 12.9866 20.75L19.9521 16.963C20.5988 16.6114 21 15.9435 21 15.2184V7.78208C21 7.05701 20.5988 6.38904 19.9521 6.03744L12.9866 2.25049ZM12 7.00024C12.5448 7.00024 12.9865 7.44191 12.9865 7.98674C12.9864 8.00043 12.9863 8.00727 12.9861 8.01411C12.9859 8.02095 12.9856 8.02779 12.985 8.04146L12.7489 12.2918C12.6964 13.2364 11.3036 13.2364 11.2512 12.2918L11.015 8.04146C10.9848 7.49747 11.4013 7.03198 11.9453 7.00176L11.9726 7.00062L12 7.00024ZM13 15.0002C13 15.5525 12.5523 16.0002 12 16.0002C11.4477 16.0002 11 15.5525 11 15.0002C11 14.448 11.4477 14.0002 12 14.0002C12.5523 14.0002 13 14.448 13 15.0002Z",
731
778
  fill: "currentColor"
732
779
  }));
733
780
  }
@@ -743,7 +790,7 @@ function CloseIcon(props) {
743
790
  }));
744
791
  }
745
792
 
746
- var modules_6205a58e = {"container":"eb665121","tone-info":"d0373ff9","tone-positive":"bb18dcab","tone-caution":"_0af02331","tone-critical":"f76146f9"};
793
+ var modules_6205a58e = {"container":"_51a84fb3","tone-info":"_5649104a","icon":"_79fa06e2","tone-positive":"c67632e4","tone-caution":"_654ff216","tone-critical":"b1ee4ff1"};
747
794
 
748
795
  function Alert({
749
796
  id,
@@ -756,15 +803,16 @@ function Alert({
756
803
  id: id,
757
804
  role: "alert",
758
805
  "aria-live": "polite",
759
- borderRadius: "standard",
806
+ borderRadius: "full",
760
807
  className: [modules_6205a58e.container, getClassNames(modules_6205a58e, 'tone', tone)]
761
808
  }, /*#__PURE__*/React.createElement(Columns, {
762
809
  space: "small",
763
- alignY: "top"
810
+ alignY: "center"
764
811
  }, /*#__PURE__*/React.createElement(Column, {
765
812
  width: "content"
766
813
  }, /*#__PURE__*/React.createElement(AlertIcon, {
767
- tone: tone
814
+ tone: tone,
815
+ className: modules_6205a58e.icon
768
816
  })), /*#__PURE__*/React.createElement(Column, null, /*#__PURE__*/React.createElement(Box, {
769
817
  paddingY: "xsmall",
770
818
  paddingRight: onClose != null && closeLabel != null ? undefined : 'small'
@@ -1307,7 +1355,7 @@ function ToastsProvider({
1307
1355
  }, [defaultAutoDismissDelay, defaultDismissLabel, removeToast]);
1308
1356
  return /*#__PURE__*/React__default.createElement(ToastsContext.Provider, {
1309
1357
  value: showToast
1310
- }, children, /*#__PURE__*/React__default.createElement(react.Portal, null, toasts.length === 0 ? null : /*#__PURE__*/React__default.createElement(Box, {
1358
+ }, children, /*#__PURE__*/React__default.createElement(portal.Portal, null, toasts.length === 0 ? null : /*#__PURE__*/React__default.createElement(Box, {
1311
1359
  className: [modules_d11e18f0.stackedToastsView, containerClassName],
1312
1360
  position: "fixed",
1313
1361
  width: "full",
@@ -1556,37 +1604,6 @@ function CheckboxIcon(_ref) {
1556
1604
 
1557
1605
  var modules_664a6a80 = {"container":"_84dfdb83","disabled":"_131a2ca4","checked":"_95b1556d","keyFocused":"_49de7ebd","icon":"_6b4b1851","label":"_9047f3bd"};
1558
1606
 
1559
- /**
1560
- * Sets both a function and object React ref.
1561
- */
1562
-
1563
- function setRef(ref, value) {
1564
- if (typeof ref === 'function') {
1565
- ref(value);
1566
- } else if (ref) {
1567
- ref.current = value;
1568
- }
1569
- }
1570
- /**
1571
- * Merges React Refs into a single memoized function ref so you can pass it to an element.
1572
- * @example
1573
- * const Component = React.forwardRef((props, ref) => {
1574
- * const internalRef = React.useRef();
1575
- * return <div {...props} ref={useForkRef(internalRef, ref)} />;
1576
- * });
1577
- */
1578
-
1579
-
1580
- function useForkRef(...refs) {
1581
- return React.useMemo(() => {
1582
- if (!refs.some(Boolean)) return;
1583
- return value => {
1584
- refs.forEach(ref => setRef(ref, value));
1585
- };
1586
- }, // eslint-disable-next-line react-hooks/exhaustive-deps
1587
- refs);
1588
- }
1589
-
1590
1607
  const _excluded$j = ["label", "icon", "disabled", "indeterminate", "defaultChecked", "onChange"];
1591
1608
  const CheckboxField = /*#__PURE__*/React.forwardRef(function CheckboxField(_ref, ref) {
1592
1609
  var _ref2, _props$checked, _props$checked2;
@@ -1618,7 +1635,7 @@ const CheckboxField = /*#__PURE__*/React.forwardRef(function CheckboxField(_ref,
1618
1635
  const [checkedState, setChecked] = React.useState((_ref2 = (_props$checked = props.checked) != null ? _props$checked : defaultChecked) != null ? _ref2 : false);
1619
1636
  const isChecked = (_props$checked2 = props.checked) != null ? _props$checked2 : checkedState;
1620
1637
  const internalRef = React.useRef(null);
1621
- const combinedRef = useForkRef(internalRef, ref);
1638
+ const combinedRef = ariakitReactUtils.useForkRef(internalRef, ref);
1622
1639
  React.useEffect(function setIndeterminate() {
1623
1640
  if (internalRef.current && typeof indeterminate === 'boolean') {
1624
1641
  internalRef.current.indeterminate = indeterminate;
@@ -1708,7 +1725,7 @@ function PasswordHiddenIcon(props) {
1708
1725
  })));
1709
1726
  }
1710
1727
 
1711
- var modules_540a88ff = {"container":"_616a033e","auxiliaryLabel":"_0b88d85e","bordered":"c466cda3","error":"_4156d9cb","primaryLabel":"_274ef80a","secondaryLabel":"_2c4a8aed","messageIcon":"cd105f69"};
1728
+ var modules_540a88ff = {"container":"_7acdc928","auxiliaryLabel":"_815bad88","bordered":"e35886fe","error":"_6c7b5dc8","primaryLabel":"ec74af87","secondaryLabel":"_6db0ec44","messageIcon":"_05c35af8"};
1712
1729
 
1713
1730
  function FieldHint(props) {
1714
1731
  return /*#__PURE__*/React.createElement(Text, _objectSpread2({
@@ -1810,7 +1827,7 @@ function BaseField({
1810
1827
  }, hint) : null);
1811
1828
  }
1812
1829
 
1813
- var modules_aaf25250 = {"inputWrapper":"_483abe7b","bordered":"fce9399c","error":"_603b8c4b","slot":"_79ca0da5"};
1830
+ var modules_aaf25250 = {"inputWrapper":"dea25485","bordered":"_80b6b376","error":"_1a32867a","slot":"dbbd207e"};
1814
1831
 
1815
1832
  const _excluded$k = ["variant", "id", "label", "secondaryLabel", "auxiliaryLabel", "hint", "message", "tone", "type", "maxWidth", "hidden", "aria-describedby", "startSlot", "endSlot"];
1816
1833
  const TextField = /*#__PURE__*/React.forwardRef(function TextField(_ref, ref) {
@@ -1899,7 +1916,7 @@ const PasswordField = /*#__PURE__*/React.forwardRef(function PasswordField(_ref,
1899
1916
  }));
1900
1917
  });
1901
1918
 
1902
- var modules_1fa9b208 = {"selectWrapper":"a9cbb3a6","bordered":"f3869290","error":"aefdbdaa"};
1919
+ var modules_1fa9b208 = {"selectWrapper":"b930bb07","bordered":"e1f620b6","error":"_7e87474e"};
1903
1920
 
1904
1921
  const _excluded$m = ["variant", "id", "label", "secondaryLabel", "auxiliaryLabel", "hint", "message", "tone", "maxWidth", "children", "hidden", "aria-describedby"];
1905
1922
  const SelectField = /*#__PURE__*/React.forwardRef(function SelectField(_ref, ref) {
@@ -2029,7 +2046,7 @@ const SwitchField = /*#__PURE__*/React.forwardRef(function SwitchField(_ref, ref
2029
2046
  }, hint) : null);
2030
2047
  });
2031
2048
 
2032
- var modules_2728c236 = {"textAreaContainer":"_29503131","innerContainer":"_6ea894ce","bordered":"e1e8b6a7","error":"_1b94ff46","autoExpand":"e82223c4"};
2049
+ var modules_2728c236 = {"textAreaContainer":"_55ccf266","innerContainer":"_89bb7098","bordered":"_02a47358","error":"_704ff540","autoExpand":"_145ca8f0"};
2033
2050
 
2034
2051
  const _excluded$o = ["variant", "id", "label", "secondaryLabel", "auxiliaryLabel", "hint", "message", "tone", "maxWidth", "hidden", "aria-describedby", "rows", "autoExpand"];
2035
2052
  const TextArea = /*#__PURE__*/React.forwardRef(function TextArea(_ref, ref) {
@@ -2229,7 +2246,7 @@ function Modal(_ref) {
2229
2246
  onDismiss == null ? void 0 : onDismiss();
2230
2247
  }
2231
2248
  }, [onDismiss]);
2232
- const store = react.useDialogStore({
2249
+ const state = dialog.useDialogState({
2233
2250
  open: isOpen,
2234
2251
  setOpen
2235
2252
  });
@@ -2263,7 +2280,7 @@ function Modal(_ref) {
2263
2280
  return null;
2264
2281
  }
2265
2282
 
2266
- return /*#__PURE__*/React.createElement(react.Portal, {
2283
+ return /*#__PURE__*/React.createElement(portal.Portal, {
2267
2284
  portalRef: portalRef,
2268
2285
  portalElement: portalElement
2269
2286
  }, /*#__PURE__*/React.createElement(Box, {
@@ -2282,10 +2299,10 @@ function Modal(_ref) {
2282
2299
  autoFocus: autoFocus,
2283
2300
  whiteList: isNotInternalFrame,
2284
2301
  returnFocus: true
2285
- }, /*#__PURE__*/React.createElement(react.Dialog, _objectSpread2(_objectSpread2({}, props), {}, {
2302
+ }, /*#__PURE__*/React.createElement(dialog.Dialog, _objectSpread2(_objectSpread2({}, props), {}, {
2286
2303
  ref: dialogRef,
2287
2304
  as: Box,
2288
- store: store,
2305
+ state: state,
2289
2306
  hideOnEscape: hideOnEscape,
2290
2307
  preventBodyScroll: true,
2291
2308
  borderRadius: "full",
@@ -2447,6 +2464,28 @@ function ModalActions(_ref5) {
2447
2464
  }, children));
2448
2465
  }
2449
2466
 
2467
+ /**
2468
+ * usePrevious tracks the change of the given value -
2469
+ * when a given value has been changed from a previous call,
2470
+ * it will return the value prior to the change.
2471
+ *
2472
+ * Example:
2473
+ *
2474
+ * const [x, setX] = useState(1)
2475
+ * const prevX = usePrevious(x)
2476
+ *
2477
+ * Suppose `setX(2)` is called, then in the next component render
2478
+ * x = 2 and prevX = 1
2479
+ */
2480
+
2481
+ function usePrevious(value) {
2482
+ const ref = React.useRef(null);
2483
+ React.useEffect(() => {
2484
+ ref.current = value;
2485
+ }, [value]);
2486
+ return ref.current;
2487
+ }
2488
+
2450
2489
  var modules_40c67f5b = {"tab":"e96bf360","track":"_430e252d","tab-neutral":"f631ccbe","tab-themed":"_6ba96acc","track-neutral":"ef4cd8d3","track-themed":"_344b3b10"};
2451
2490
 
2452
2491
  const _excluded$s = ["as", "children", "id", "exceptionallySetClassName"],
@@ -2464,21 +2503,26 @@ function Tabs({
2464
2503
  variant = 'neutral',
2465
2504
  onSelectedIdChange
2466
2505
  }) {
2467
- const tabStore = react.useTabStore({
2468
- defaultSelectedId,
2506
+ const tabState = tab.useTabState({
2469
2507
  selectedId,
2470
2508
  setSelectedId: onSelectedIdChange
2471
2509
  });
2472
- const actualSelectedId = tabStore.useState('selectedId');
2473
- const memoizedTabState = React.useMemo(() => {
2474
- var _ref;
2475
-
2510
+ const previousDefaultSelectedId = usePrevious(defaultSelectedId);
2511
+ const {
2512
+ selectedId: actualSelectedId,
2513
+ select
2514
+ } = tabState;
2515
+ React.useEffect(function selectDefaultTab() {
2516
+ if (!selectedId && defaultSelectedId !== previousDefaultSelectedId && defaultSelectedId !== actualSelectedId && defaultSelectedId !== undefined) {
2517
+ select(defaultSelectedId);
2518
+ }
2519
+ }, [selectedId, defaultSelectedId, actualSelectedId, select, previousDefaultSelectedId]);
2520
+ const memoizedTabState = React.useMemo(function memoizeTabState() {
2476
2521
  return {
2477
- tabStore,
2478
- variant,
2479
- selectedId: (_ref = selectedId != null ? selectedId : actualSelectedId) != null ? _ref : null
2522
+ tabState,
2523
+ variant
2480
2524
  };
2481
- }, [variant, tabStore, selectedId, actualSelectedId]);
2525
+ }, [variant, tabState]);
2482
2526
  return /*#__PURE__*/React.createElement(TabsContext.Provider, {
2483
2527
  value: memoizedTabState
2484
2528
  }, children);
@@ -2488,27 +2532,30 @@ function Tabs({
2488
2532
  */
2489
2533
 
2490
2534
 
2491
- const Tab = /*#__PURE__*/polymorphicComponent(function Tab(_ref2, ref) {
2535
+ const Tab = /*#__PURE__*/polymorphicComponent(function Tab(_ref, ref) {
2492
2536
  let {
2493
2537
  as,
2494
2538
  children,
2495
2539
  id,
2496
2540
  exceptionallySetClassName
2497
- } = _ref2,
2498
- props = _objectWithoutProperties(_ref2, _excluded$s);
2541
+ } = _ref,
2542
+ props = _objectWithoutProperties(_ref, _excluded$s);
2499
2543
 
2500
2544
  const tabContextValue = React.useContext(TabsContext);
2501
- if (!tabContextValue) return null;
2545
+
2546
+ if (!tabContextValue) {
2547
+ return null;
2548
+ }
2549
+
2502
2550
  const {
2503
2551
  variant,
2504
- tabStore
2552
+ tabState
2505
2553
  } = tabContextValue;
2506
- const className = classNames(exceptionallySetClassName, modules_40c67f5b.tab, modules_40c67f5b["tab-" + variant]);
2507
- return /*#__PURE__*/React.createElement(react.Tab, _objectSpread2(_objectSpread2({}, props), {}, {
2554
+ return /*#__PURE__*/React.createElement(tab.Tab, _objectSpread2(_objectSpread2({}, props), {}, {
2508
2555
  as: as,
2509
- className: className,
2556
+ className: classNames(exceptionallySetClassName, modules_40c67f5b.tab, modules_40c67f5b["tab-" + variant]),
2510
2557
  id: id,
2511
- store: tabStore,
2558
+ state: tabState,
2512
2559
  ref: ref
2513
2560
  }), children);
2514
2561
  });
@@ -2516,12 +2563,12 @@ const Tab = /*#__PURE__*/polymorphicComponent(function Tab(_ref2, ref) {
2516
2563
  * A component used to group `<Tab>` elements together.
2517
2564
  */
2518
2565
 
2519
- function TabList(_ref3) {
2566
+ function TabList(_ref2) {
2520
2567
  let {
2521
2568
  children,
2522
2569
  space
2523
- } = _ref3,
2524
- props = _objectWithoutProperties(_ref3, _excluded2$2);
2570
+ } = _ref2,
2571
+ props = _objectWithoutProperties(_ref2, _excluded2$2);
2525
2572
 
2526
2573
  const tabContextValue = React.useContext(TabsContext);
2527
2574
 
@@ -2530,15 +2577,15 @@ function TabList(_ref3) {
2530
2577
  }
2531
2578
 
2532
2579
  const {
2533
- tabStore,
2580
+ tabState,
2534
2581
  variant
2535
2582
  } = tabContextValue;
2536
2583
  return (
2537
2584
  /*#__PURE__*/
2538
2585
  // The extra <Box> prevents <Inline>'s negative margins from collapsing when used in a flex container
2539
2586
  // which will render the track with the wrong height
2540
- React.createElement(Box, null, /*#__PURE__*/React.createElement(react.TabList, _objectSpread2({
2541
- store: tabStore,
2587
+ React.createElement(Box, null, /*#__PURE__*/React.createElement(tab.TabList, _objectSpread2({
2588
+ state: tabState,
2542
2589
  as: Box,
2543
2590
  position: "relative",
2544
2591
  width: "maxContent"
@@ -2550,24 +2597,22 @@ function TabList(_ref3) {
2550
2597
  );
2551
2598
  }
2552
2599
  /**
2553
- * Used to define the content to be rendered when a tab is active. Each `<TabPanel>` must have a
2554
- * corresponding `<Tab>` component.
2600
+ * Used to define the content to be rendered when a tab is active. Each `<TabPanel>` must have a corresponding `<Tab>` component.
2555
2601
  */
2556
2602
 
2557
2603
 
2558
- const TabPanel = /*#__PURE__*/polymorphicComponent(function TabPanel(_ref4, ref) {
2604
+ const TabPanel = /*#__PURE__*/polymorphicComponent(function TabPanel(_ref3, ref) {
2559
2605
  let {
2560
2606
  children,
2561
2607
  id,
2562
2608
  as,
2563
2609
  render = 'always'
2564
- } = _ref4,
2565
- props = _objectWithoutProperties(_ref4, _excluded3$1);
2610
+ } = _ref3,
2611
+ props = _objectWithoutProperties(_ref3, _excluded3$1);
2566
2612
 
2567
2613
  const tabContextValue = React.useContext(TabsContext);
2568
2614
  const [tabRendered, setTabRendered] = React.useState(false);
2569
- const selectedId = tabContextValue == null ? void 0 : tabContextValue.tabStore.useState('selectedId');
2570
- const tabIsActive = selectedId === id;
2615
+ const tabIsActive = (tabContextValue == null ? void 0 : tabContextValue.tabState.selectedId) === id;
2571
2616
  React.useEffect(function trackTabRenderedState() {
2572
2617
  if (!tabRendered && tabIsActive) {
2573
2618
  setTabRendered(true);
@@ -2579,28 +2624,28 @@ const TabPanel = /*#__PURE__*/polymorphicComponent(function TabPanel(_ref4, ref)
2579
2624
  }
2580
2625
 
2581
2626
  const {
2582
- tabStore
2627
+ tabState
2583
2628
  } = tabContextValue;
2584
2629
  const shouldRender = render === 'always' || render === 'active' && tabIsActive || render === 'lazy' && (tabIsActive || tabRendered);
2585
- return shouldRender ? /*#__PURE__*/React.createElement(react.TabPanel, _objectSpread2(_objectSpread2({}, props), {}, {
2586
- tabId: id,
2587
- store: tabStore,
2630
+ return shouldRender ? /*#__PURE__*/React.createElement(tab.TabPanel, _objectSpread2(_objectSpread2({
2631
+ tabId: id
2632
+ }, props), {}, {
2633
+ state: tabState,
2588
2634
  as: as,
2589
2635
  ref: ref
2590
2636
  }), children) : null;
2591
2637
  });
2592
2638
  /**
2593
- * Allows content to be rendered based on the current tab being selected while outside of the
2594
- * TabPanel component. Can be placed freely within the main `<Tabs>` component.
2639
+ * Allows content to be rendered based on the current tab being selected while outside of the TabPanel
2640
+ * component. Can be placed freely within the main `<Tabs>` component.
2595
2641
  */
2596
2642
 
2597
2643
  function TabAwareSlot({
2598
2644
  children
2599
2645
  }) {
2600
2646
  const tabContextValue = React.useContext(TabsContext);
2601
- const selectedId = tabContextValue == null ? void 0 : tabContextValue.tabStore.useState('selectedId');
2602
2647
  return tabContextValue ? children({
2603
- selectedId
2648
+ selectedId: tabContextValue == null ? void 0 : tabContextValue.tabState.selectedId
2604
2649
  }) : null;
2605
2650
  }
2606
2651
 
@@ -2628,20 +2673,27 @@ function Menu(_ref) {
2628
2673
  } = _ref,
2629
2674
  props = _objectWithoutProperties(_ref, _excluded$t);
2630
2675
 
2631
- const [anchorRect, setAnchorRect] = React.useState(null);
2632
- const getAnchorRect = React.useMemo(() => anchorRect ? () => anchorRect : null, [anchorRect]);
2633
- const menuStore = react.useMenuStore(_objectSpread2({
2634
- focusLoop: true
2676
+ const [anchorRect, handleAnchorRectChange] = React.useState(null);
2677
+ const getAnchorRect = React.useMemo(() => {
2678
+ return anchorRect ? () => anchorRect : undefined;
2679
+ }, [anchorRect]);
2680
+ const state = Ariakit.useMenuState(_objectSpread2({
2681
+ focusLoop: true,
2682
+ gutter: 8,
2683
+ shift: 4,
2684
+ getAnchorRect
2635
2685
  }, props));
2686
+ React.useEffect(() => {
2687
+ if (!state.open) handleAnchorRectChange(null);
2688
+ }, [state.open]);
2636
2689
  const handleItemSelect = React.useCallback(function handleItemSelect(value) {
2637
- onItemSelect == null ? void 0 : onItemSelect(value);
2690
+ if (onItemSelect) onItemSelect(value);
2638
2691
  }, [onItemSelect]);
2639
2692
  const value = React.useMemo(() => ({
2640
- menuStore,
2693
+ state,
2641
2694
  handleItemSelect,
2642
- getAnchorRect,
2643
- setAnchorRect
2644
- }), [menuStore, handleItemSelect, getAnchorRect, setAnchorRect]);
2695
+ handleAnchorRectChange
2696
+ }), [state, handleItemSelect]);
2645
2697
  return /*#__PURE__*/React.createElement(MenuContext.Provider, {
2646
2698
  value: value
2647
2699
  }, children);
@@ -2658,10 +2710,10 @@ const MenuButton = /*#__PURE__*/polymorphicComponent(function MenuButton(_ref2,
2658
2710
  props = _objectWithoutProperties(_ref2, _excluded2$3);
2659
2711
 
2660
2712
  const {
2661
- menuStore
2713
+ state
2662
2714
  } = React.useContext(MenuContext);
2663
- return /*#__PURE__*/React.createElement(react.MenuButton, _objectSpread2(_objectSpread2({}, props), {}, {
2664
- store: menuStore,
2715
+ return /*#__PURE__*/React.createElement(Ariakit.MenuButton, _objectSpread2(_objectSpread2({}, props), {}, {
2716
+ state: state,
2665
2717
  ref: ref,
2666
2718
  className: classNames('reactist_menubutton', exceptionallySetClassName)
2667
2719
  }));
@@ -2676,17 +2728,17 @@ const ContextMenuTrigger = /*#__PURE__*/polymorphicComponent(function ContextMen
2676
2728
  props = _objectWithoutProperties(_ref3, _excluded3$2);
2677
2729
 
2678
2730
  const {
2679
- setAnchorRect,
2680
- menuStore
2731
+ handleAnchorRectChange,
2732
+ state
2681
2733
  } = React.useContext(MenuContext);
2682
- const handleContextMenu = React.useCallback(function handleContextMenu(event) {
2734
+ const handleContextMenu = React.useCallback(event => {
2683
2735
  event.preventDefault();
2684
- setAnchorRect({
2736
+ handleAnchorRectChange({
2685
2737
  x: event.clientX,
2686
2738
  y: event.clientY
2687
2739
  });
2688
- menuStore.show();
2689
- }, [setAnchorRect, menuStore]);
2740
+ state.show();
2741
+ }, [handleAnchorRectChange, state]);
2690
2742
  return /*#__PURE__*/React.createElement(component, _objectSpread2(_objectSpread2({}, props), {}, {
2691
2743
  onContextMenu: handleContextMenu,
2692
2744
  ref
@@ -2704,19 +2756,14 @@ const MenuList = /*#__PURE__*/polymorphicComponent(function MenuList(_ref4, ref)
2704
2756
  props = _objectWithoutProperties(_ref4, _excluded4$1);
2705
2757
 
2706
2758
  const {
2707
- menuStore,
2708
- getAnchorRect
2759
+ state
2709
2760
  } = React.useContext(MenuContext);
2710
- const isOpen = menuStore.useState('open');
2711
- return isOpen ? /*#__PURE__*/React.createElement(react.Portal, {
2761
+ return state.open ? /*#__PURE__*/React.createElement(portal.Portal, {
2712
2762
  preserveTabOrder: true
2713
- }, /*#__PURE__*/React.createElement(react.Menu, _objectSpread2(_objectSpread2({}, props), {}, {
2714
- store: menuStore,
2715
- gutter: 8,
2716
- shift: 4,
2763
+ }, /*#__PURE__*/React.createElement(Ariakit.Menu, _objectSpread2(_objectSpread2({}, props), {}, {
2764
+ state: state,
2717
2765
  ref: ref,
2718
2766
  className: classNames('reactist_menulist', exceptionallySetClassName),
2719
- getAnchorRect: getAnchorRect != null ? getAnchorRect : undefined,
2720
2767
  modal: modal
2721
2768
  }))) : null;
2722
2769
  });
@@ -2739,11 +2786,11 @@ const MenuItem = /*#__PURE__*/polymorphicComponent(function MenuItem(_ref5, ref)
2739
2786
 
2740
2787
  const {
2741
2788
  handleItemSelect,
2742
- menuStore
2789
+ state
2743
2790
  } = React.useContext(MenuContext);
2744
2791
  const {
2745
2792
  hide
2746
- } = menuStore;
2793
+ } = state;
2747
2794
  const handleClick = React.useCallback(function handleClick(event) {
2748
2795
  onClick == null ? void 0 : onClick(event);
2749
2796
  const onSelectResult = onSelect && !event.defaultPrevented ? onSelect() : undefined;
@@ -2751,9 +2798,9 @@ const MenuItem = /*#__PURE__*/polymorphicComponent(function MenuItem(_ref5, ref)
2751
2798
  handleItemSelect(value);
2752
2799
  if (shouldClose) hide();
2753
2800
  }, [onSelect, onClick, handleItemSelect, hideOnSelect, hide, value]);
2754
- return /*#__PURE__*/React.createElement(react.MenuItem, _objectSpread2(_objectSpread2({}, props), {}, {
2801
+ return /*#__PURE__*/React.createElement(Ariakit.MenuItem, _objectSpread2(_objectSpread2({}, props), {}, {
2755
2802
  as: as,
2756
- store: menuStore,
2803
+ state: state,
2757
2804
  ref: ref,
2758
2805
  onClick: handleClick,
2759
2806
  className: exceptionallySetClassName,
@@ -2788,11 +2835,11 @@ const SubMenu = /*#__PURE__*/React.forwardRef(function SubMenu({
2788
2835
  }, ref) {
2789
2836
  const {
2790
2837
  handleItemSelect: parentMenuItemSelect,
2791
- menuStore
2838
+ state
2792
2839
  } = React.useContext(MenuContext);
2793
2840
  const {
2794
2841
  hide: parentMenuHide
2795
- } = menuStore;
2842
+ } = state;
2796
2843
  const handleSubItemSelect = React.useCallback(function handleSubItemSelect(value) {
2797
2844
  if (onItemSelect) onItemSelect(value);
2798
2845
  parentMenuItemSelect(value);
@@ -2806,9 +2853,9 @@ const SubMenu = /*#__PURE__*/React.forwardRef(function SubMenu({
2806
2853
  }, [button]);
2807
2854
  return /*#__PURE__*/React.createElement(Menu, {
2808
2855
  onItemSelect: handleSubItemSelect
2809
- }, /*#__PURE__*/React.createElement(react.MenuItem, {
2856
+ }, /*#__PURE__*/React.createElement(Ariakit.MenuItem, {
2810
2857
  as: "div",
2811
- store: menuStore,
2858
+ state: state,
2812
2859
  ref: ref,
2813
2860
  hideOnClick: false
2814
2861
  }, renderMenuButton), list);
@@ -2829,11 +2876,11 @@ const MenuGroup = /*#__PURE__*/polymorphicComponent(function MenuGroup(_ref6, re
2829
2876
  props = _objectWithoutProperties(_ref6, _excluded6);
2830
2877
 
2831
2878
  const {
2832
- menuStore
2879
+ state
2833
2880
  } = React.useContext(MenuContext);
2834
- return /*#__PURE__*/React.createElement(react.MenuGroup, _objectSpread2(_objectSpread2({}, props), {}, {
2881
+ return /*#__PURE__*/React.createElement(Ariakit.MenuGroup, _objectSpread2(_objectSpread2({}, props), {}, {
2835
2882
  ref: ref,
2836
- store: menuStore,
2883
+ state: state,
2837
2884
  className: exceptionallySetClassName
2838
2885
  }), label ? /*#__PURE__*/React.createElement("div", {
2839
2886
  role: "presentation",